Skip to content

fix(sdk-vue,sdk-svelte,sdk-solid): import agent API from @wraith-protocol/sdk-agent - #253

Open
Classictowo wants to merge 1 commit into
wraith-protocol:developfrom
Classictowo:fix/companion-agent-imports-249
Open

Classictowo wants to merge 1 commit into
wraith-protocol:developfrom
Classictowo:fix/companion-agent-imports-249

Conversation

@Classictowo

Copy link
Copy Markdown

Summary

On develop, importing @wraith-protocol/sdk-vue, @wraith-protocol/sdk-svelte or @wraith-protocol/sdk-solid from Node throws before any code runs:

SyntaxError: The requested module '@wraith-protocol/sdk' does not provide an export named 'Chain'

#193 moved Wraith, WraithAgent and Chain from @wraith-protocol/sdk to @wraith-protocol/sdk-agent, but these three companions still imported them from the core. React and agent were unaffected.

Closes #249

Changes

  • Imports - packages/sdk-vue/src/composables/useWraith.ts, packages/sdk-svelte/src/primitives/useWraith.ts and packages/sdk-solid/src/primitives/createActivity.ts now import Wraith, WraithAgent, Chain and the agent types from @wraith-protocol/sdk-agent.
  • Dependencies - added @wraith-protocol/sdk-agent: workspace:* to each companion's dependencies (lockfile updated).
  • Build - added @wraith-protocol/sdk-agent to each companion's tsup external list, and the root pnpm build now also builds @wraith-protocol/sdk-agent. The companions' unit tests and the SSR import check load that package's built dist/, so it must exist after pnpm build (the SSR script itself documents "run pnpm build first").
  • Tests - pointed the useWraith / createActivity mocks at @wraith-protocol/sdk-agent.
  • SSR smoke test - removed the three companions from KNOWN_IMPORT_FAILURES in scripts/compat/verify-ssr-imports.mjs; they import cleanly now, so the check fails until the entries are removed (as its comment describes).

Verification

  • pnpm build produces dist/ for the core and packages/sdk-agent/dist/.
  • node scripts/compat/verify-ssr-imports.mjs - every companion imports and renders server-side:
ok   ssr import @wraith-protocol/sdk-agent
ok   ssr render @wraith-protocol/sdk-agent (agent)
ok   ssr import @wraith-protocol/sdk-react
ok   ssr render @wraith-protocol/sdk-react (react)
ok   ssr import @wraith-protocol/sdk-solid
ok   ssr render @wraith-protocol/sdk-solid (solid)
ok   ssr import @wraith-protocol/sdk-svelte
ok   ssr render @wraith-protocol/sdk-svelte (svelte)
ok   ssr import @wraith-protocol/sdk-vue
ok   ssr render @wraith-protocol/sdk-vue (vue)
  • Node import repro (built dist), ESM and CJS, all three companions:
vue ESM ok: function   svelte ESM ok: function   solid ESM ok: function
vue CJS ok: function   solid CJS ok: function
  • pnpm test:types passes; packages/sdk-vue/test/useWraith.test.ts (5 tests) and packages/sdk-solid/test/createActivity.test.ts (13 tests) pass; pnpm --filter @wraith-protocol/sdk-svelte test (10 tests) passes.
  • pnpm test:compat reaches the SSR step green; the only local failure on this Windows runner is verify-package.mjs's EPERM symlink step, which is unrelated to this change and passes on Linux CI.

Notes

  • COMPAT.md reports "stale" on a Windows checkout purely because of CRLF line endings; node scripts/compat/check.mjs --write produces a zero-byte diff against the committed file, so it is left untouched.

…ocol/sdk-agent

The Vue, Svelte and Solid companions imported Wraith, WraithAgent and Chain from the core @wraith-protocol/sdk, but wraith-protocol#193 moved those exports to @wraith-protocol/sdk-agent, so importing any companion on the server threw before any code ran:

SyntaxError: The requested module '@wraith-protocol/sdk' does not provide an export named 'Chain'

Fix: import the agent names from @wraith-protocol/sdk-agent and declare it as a workspace dependency in each companion; externalize it in each tsup config; point the useWraith/createActivity test mocks at the new module; and drop the three companions from verify-ssr-imports.mjs KNOWN_IMPORT_FAILURES. The root pnpm build now also builds @wraith-protocol/sdk-agent so the unit tests and the SSR import check resolve its built dist.

Closes wraith-protocol#249
@drips-wave

drips-wave Bot commented Oct 16, 2026

Copy link
Copy Markdown

@Classictowo Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@truthixify truthixify left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The companion-package import correction looks right, but the required test jobs fail at the formatting gate. Prettier reports changes in packages/sdk-solid/src/primitives/createActivity.ts and packages/sdk-svelte/src/primitives/useWraith.ts. Please format those files and rerun CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sdk-vue, sdk-svelte, and sdk-solid fail to import: core no longer exports Chain, Wraith, WraithAgent

3 participants