Skip to content

feat: add legacy CJS decorator entrypoint - #95

Merged
sjungwon03 merged 2 commits into
devfrom
feat/94-legacy-cjs-decorators
Aug 3, 2026
Merged

feat: add legacy CJS decorator entrypoint#95
sjungwon03 merged 2 commits into
devfrom
feat/94-legacy-cjs-decorators

Conversation

@sjungwon03

Copy link
Copy Markdown
Member

Summary

  • Add @theorvane/type-chain/legacy for TypeScript experimentalDecorators CommonJS consumers.
  • Provide legacy Agent, Tool, and Policy metadata registration without changing the root Stage 3 API.
  • Bundle the legacy entrypoint as ESM/CJS and defer optional LangChain imports to async runtime adapters.
  • Add legacy fixture, packed CommonJS consumer verification, API documentation, and generated-fixture ignore rules.

Linked issue

Closes #94

Verification

  • npm run verify (Biome, typecheck, 52 tests, build, package artifact check)
  • npm run verify:consumer (packed standard and legacy CJS consumers)
  • git diff --check

Compatibility

./legacy supports public instance methods with string names only. toLangChainTools and buildAgent are async because optional LangChain dependencies load dynamically; standard and legacy decorators must not be mixed in one TypeScript compilation unit.

@sjungwon03 sjungwon03 added area:decorators Standard TypeScript decorator metadata and registration area:langchain LangChain Core or LangChain integration enhancement New feature or request test labels Aug 3, 2026

@sjungwon03-ai sjungwon03-ai left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Blocking on exact-head CI: npm 12 release readiness fails in scripts/verify-legacy-consumer.mjs because npm pack --json is destructured as an array while npm 12 returns a non-iterable object (existing scripts/pack-json.mjs already handles both shapes).

Comment thread scripts/verify-legacy-consumer.mjs Outdated
@sjungwon03

Copy link
Copy Markdown
Member Author

Addressed the npm 12 packed-consumer failure in ba843d9: verify-legacy-consumer.mjs now reuses getPackedTarballFilename() for both npm 11 array and npm 12 package-keyed JSON. Added a release-workflow contract assertion so the legacy script cannot bypass that normalization. Local npm run verify and npm run verify:consumer pass.

@sjungwon03-ai sjungwon03-ai left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Exact-head re-review of ba843d9: the legacy packed-consumer script now delegates npm pack JSON handling to getPackedTarballFilename(), preserving npm 11 array output and supporting npm 12 package-keyed output. Contract coverage and packed CommonJS consumer verification passed under npm 11.5.1 and 12.0.1; current CI is green. No blocking findings.

@sjungwon03
sjungwon03 merged commit b70e09e into dev Aug 3, 2026
2 checks passed

@sjungwon03-ai sjungwon03-ai left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The prior npm 12 packed-consumer blocker is resolved through shared tarball JSON normalization, and the exact-head CI workflow completed both required checks successfully. The published legacy ESM/CJS contract and consumer verification are consistent with the documented compatibility boundary.

@sjungwon03
sjungwon03 deleted the feat/94-legacy-cjs-decorators branch August 3, 2026 05:02
@sjungwon03-ai sjungwon03-ai added review:approved Automated review outcome: approved and removed review:changes-requested labels Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:decorators Standard TypeScript decorator metadata and registration area:langchain LangChain Core or LangChain integration enhancement New feature or request review:approved Automated review outcome: approved test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add legacy CJS decorator entrypoint

2 participants