Skip to content

fix(tokenless): build OpenClaw plugin to dist/index.js#589

Open
kongche-jbw wants to merge 1 commit into
alibaba:mainfrom
kongche-jbw:fix/tokenless/openclaw-plugin-build
Open

fix(tokenless): build OpenClaw plugin to dist/index.js#589
kongche-jbw wants to merge 1 commit into
alibaba:mainfrom
kongche-jbw:fix/tokenless/openclaw-plugin-build

Conversation

@kongche-jbw
Copy link
Copy Markdown
Collaborator

Description

The tokenless OpenClaw plugin shipped without its compiled entrypoint:
package.json declares main/openclaw.extensions = ./dist/index.js,
but the Makefile only built Rust artifacts and copied adapters/tokenless
verbatim, so $SHARE_DIR/openclaw/dist/index.js never existed and the RPM's
%build resorted to an npx esbuild / sed fallback.

This PR converges on the same boundary as sec-core/openclaw-plugin:
the Makefile compiles TS to dist/, the spec/install steps only deliver
the compiled tree, and install.sh is deploy-only.

  • src/tokenless/Makefile: new build-openclaw-plugin target
    (npm install --legacy-peer-deps --no-audit --no-fund --package-lock=false
    then npm run build); wired into build and as a prerequisite of
    install-adapter-resources, which now also strips node_modules /
    package-lock.json from the install tree and asserts
    $SHARE_DIR/openclaw/dist/index.js exists.
  • adapters/tokenless/openclaw/package.json: main and
    openclaw.extensions now point to dist/index.js; added scripts.build
    and devDependencies (typescript, @types/node).
  • New adapters/tokenless/openclaw/tsconfig.json (ES2022 / Node16,
    outDir: dist).
  • tokenless.spec.in: %build calls make build-openclaw-plugin; %install
    and %files declare openclaw/dist/index.js instead of openclaw/index.js;
    added BuildRequires: nodejs npm.
  • adapters/tokenless/openclaw/scripts/install.sh: removed the ad-hoc
    compile path; deploys only an already-built plugin. Honors
    OPENCLAW_BIN for orchestrator injection and runs the CLI under
    env -u OPENCLAW_HOME to avoid ~/.openclaw/.openclaw/... nesting.
    If dist/index.js is missing, exits with a clear instruction to run
    make -C src/tokenless build-openclaw-plugin.
  • adapters/tokenless/openclaw/index.ts: one-char fix — undefined
    checkToon() -> checkTokenless() (the compress-toon subcommand is
    hosted by the tokenless binary; this blocked TS compilation).
  • New adapters/tokenless/openclaw/.gitignore: dist/, node_modules/,
    package-lock.json.

scripts/build-all.sh is untouched — build-all continues to invoke each
component's own make install, which now produces a complete tokenless
adapter on its own.

Related Issue

no-issue: internal build/packaging fix; converges tokenless OpenClaw plugin
on the sec-core build boundary

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional change)
  • Performance improvement
  • CI/CD or build changes

Scope

  • cosh (copilot-shell)
  • sec-core (agent-sec-core)
  • skill (os-skills)
  • sight (agentsight)
  • tokenless (tokenless)
  • Multiple / Project-wide

Checklist

  • I have read the Contributing Guide
  • My code follows the project's code style
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the documentation accordingly
  • For cosh: Lint passes, type check passes, and tests pass
  • For sec-core (Rust): cargo clippy -- -D warnings and cargo fmt --check pass
  • For sec-core (Python): Ruff format and pytest pass
  • For skill: Skill directory structure is valid and shell scripts pass syntax check
  • For sight: cargo clippy -- -D warnings and cargo fmt --check pass
  • For tokenless: cargo clippy -- -D warnings and cargo fmt --check pass
  • Lock files are up to date (package-lock.json / Cargo.lock)

Testing

Verified locally with a staged DESTDIR:

rm -rf src/tokenless/adapters/tokenless/openclaw/{dist,node_modules,package-lock.json}
make -C src/tokenless build-openclaw-plugin
test -f src/tokenless/adapters/tokenless/openclaw/dist/index.js   # OK

TMP=$(mktemp -d)
make -C src/tokenless install-adapter-resources \
    DESTDIR="$TMP" INSTALL_PROFILE=user PREFIX="$HOME/.local"
test -f "$TMP$HOME/.local/share/anolisa/adapters/tokenless/openclaw/dist/index.js"  # OK
! test -e "$TMP$HOME/.local/share/anolisa/adapters/tokenless/openclaw/node_modules"        # OK
! test -e "$TMP$HOME/.local/share/anolisa/adapters/tokenless/openclaw/package-lock.json"   # OK

    - add Makefile build-openclaw-plugin (npm install + tsc)
    - wire it into build and install-adapter-resources
    - update package.json to dist/index.js; add tsconfig
    - drop spec esbuild/sed hack; use make build-openclaw-plugin
    - install.sh: deploy-only, honor OPENCLAW_BIN, env -u OPENCLAW_HOME
    - fix index.ts: checkToon -> checkTokenless (was undefined)
    - gitignore dist/, node_modules/, package-lock.json
Copy link
Copy Markdown
Collaborator

@shiloong shiloong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM,thx!

@github-actions github-actions Bot added the component:tokenless src/tokenless/ label May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:tokenless src/tokenless/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants