Repository navigation
refactor(integrations): generate the TypeScript transport copies from one source - #2623
Conversation
… one source DSH, OpenClaw, OpenCode, and Pi each ship a byte-identical src/transport.ts. Keep one source in integrations/lifecycle/ and let scripts/generate_integration_lifecycle.py write each plugin's copy at the path it already imports, marked as generated below the license header. `make integration-lifecycle-check` and the unit tests now reject a stale or hand-kept copy, replacing the shared-files identity check for transport.ts. Each copy gains only a comment, which the bundlers drop, so the committed DSH and OpenCode bundles and the OpenClaw build output are unchanged.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
hidb4ai
left a comment
There was a problem hiding this comment.
The shared transport source preserves the existing implementation and import paths in all four plugins. No new database tables or public interfaces, and no blocking findings.
Verified regeneration and drift rejection, targeted tests, and byte-identical DSH/OpenCode bundle output after rebuilding. CI is still in progress; real host acceptance was not rerun for this runtime change, which only adds generated-file comments.
Which issue or RFC does this PR close?
Part of #2250.
Rationale for this change
#2250 moves each language's host lifecycle into one module, with thin host shells around it. The Python module exists (#2318). The TypeScript plugins have no shared source: DSH, OpenClaw, OpenCode, and Pi each keep their own copies of the same helpers, and most of those copies have diverged.
This PR starts the TypeScript module with the one helper whose copies are still byte-identical,
src/transport.ts, and uses the same generate-and-check mechanism as the Python helpers. No plugin code moves: each plugin keeps importing its copy from the same path.A generated copy, rather than a bundler alias to a shared path, is needed because Pi loads its TypeScript sources directly and has no build step. It also keeps the bundles unchanged: tsdown names each inlined module by its path (
//#region src/transport.ts) and drops//comments.What changes are included in this PR?
integrations/lifecycle/transport.tsis the source, byte-identical to the current copies.integrations/capabilities.tomllists the directory underdirectory_exclusions, because it is not a host.scripts/generate_integration_lifecycle.pygets aTYPESCRIPT_COPIEStable. It writessrc/transport.tsin DSH, OpenClaw, OpenCode, and Pi. Below the license block, each copy gets two//lines that name its source andmake integration-lifecycle.make integration-lifecycle-checkis already part ofmake check, andtests/test_integration_lifecycle.pyruns it in the unit test jobs.transport.ts.tests/test_integration_lifecycle.pyalso fails when a TypeScript source imports anything other than anode:built-in. The plugins install different dependencies, so a copy cannot rely on any package.tests/test_integration_shared_files.pykeeps onlyshared/prompt-privacy.mjs, because the generator check now coverstransport.ts..github/ci-paths.tomladds[shared.lifecycle_typescript], so a change to the source or the generator selects thedsh,cindy,pi,opencode,openclaw, andzcodesuites.tests/test_ci_changes.pycovers both paths.AGENTS.mdand themake integration-lifecyclehelp name the TypeScript source next to the Python one.Not included, and planned as separate PRs:
scope.ts,config.ts,errors.ts/client.ts/invoke.ts, and the prompt-recall query bound behave differently between hosts for the same input. Each needs either a host parameter or a separate behavior PR before it moves. For example, OpenClaw keeps the first 8192 bytes of the recall query instead of followingtests/fixtures/recall_query_bound.json..mjshooks. They have no build step, so their copies would be type-stripped JavaScript. That comes with the first helper they share with the TypeScript plugins (secrets.ts/prompt-privacy.mjs).Are there any user-facing changes?
No. Each copy gains only a blank line and two comment lines. The committed DSH and OpenCode bundles and the OpenClaw build output are byte-identical to
master, and Pi's source changes only by those comments.How was this change tested?
make js-test(DSH: tests, build,lib/freshness, e2e),make opencode-test(tests, typecheck, build,lib/freshness),make pi-test(tests, typecheck), andmake openclaw-plugin-test(tests, typecheck, build) all pass.Bundle output:
git diff --exit-codeon DSH and OpenCodelib/passes after the rebuild.sha256of the OpenClawdist/index.jsis the same before and after the change (18a930a8…).make checkpasses.uv run pytest tests/test_recall_query_bound.py tests/test_automatic_prompt_privacy.py tests/test_transport.py tests/test_integration_lifecycle.py tests/test_integration_shared_files.py tests/test_ci_changes.py tests/test_ci_pipeline.py tests/test_integration_manifest.pypasses. These include the Python side of the shared fixtures.The generator check was confirmed to fail for each case it should catch:
transport.tsin another plugin,The import test was confirmed to fail for a package import and for a relative import.
No host was run. This change does not alter what any host loads beyond comments.
Self-review against
REVIEW.md, plus an independent review pass, found nothing blocking. Notes:StopIterationtraceback.//marker.transport.ts; its message names the fix.scripts/sync_dsh_plugin_tree.pyoverwrites the DSH copy.make checkthen reports it, as it already does foroperations.generated.ts.AI usage statement
Claude Code (Claude Opus 5.5) surveyed the copies and wrote the change, tests, and this description. I reviewed the design and the result.