@duct-sdk/sdk 0.5.12 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/CHANGELOG.md +385 -336
  2. package/README.md +418 -264
  3. package/TOKEN_SPEC.md +243 -237
  4. package/dist/cli/add.d.ts +7 -0
  5. package/dist/cli/add.js +152 -0
  6. package/dist/cli/agent-prompt.d.ts +3 -0
  7. package/dist/cli/agent-prompt.js +39 -0
  8. package/dist/cli/api-sources.d.ts +26 -0
  9. package/dist/cli/api-sources.js +222 -0
  10. package/dist/cli/cloud.d.ts +133 -0
  11. package/dist/cli/cloud.js +298 -0
  12. package/dist/cli/config-loader.d.ts +14 -0
  13. package/dist/cli/config-loader.js +56 -7
  14. package/dist/cli/device-login.d.ts +17 -0
  15. package/dist/cli/device-login.js +75 -0
  16. package/dist/cli/drift.js +6 -6
  17. package/dist/cli/generators/any-stack.d.ts +3 -0
  18. package/dist/cli/generators/any-stack.js +97 -0
  19. package/dist/cli/generators/config.js +3 -2
  20. package/dist/cli/generators/receiver.js +7 -7
  21. package/dist/cli/generators/shell.js +12 -12
  22. package/dist/cli/generators/token-route.js +245 -245
  23. package/dist/cli/index.js +402 -611
  24. package/dist/cli/mcp-core.d.ts +42 -0
  25. package/dist/cli/mcp-core.js +161 -0
  26. package/dist/cli/mcp-setup.d.ts +4 -0
  27. package/dist/cli/mcp-setup.js +360 -0
  28. package/dist/cli/mcp.d.ts +2 -0
  29. package/dist/cli/mcp.js +457 -0
  30. package/dist/cli/migrate-intershell.js +5 -5
  31. package/dist/cli/policy-defaults.d.ts +37 -0
  32. package/dist/cli/policy-defaults.js +127 -0
  33. package/dist/cli/processors/integration-audit.js +2 -2
  34. package/dist/cli/processors/openapi-parser.d.ts +5 -0
  35. package/dist/cli/processors/openapi-parser.js +8 -3
  36. package/dist/cli/project-loader.d.ts +58 -0
  37. package/dist/cli/project-loader.js +198 -0
  38. package/dist/cli/project-writer.d.ts +23 -0
  39. package/dist/cli/project-writer.js +171 -0
  40. package/dist/cli/push.d.ts +43 -0
  41. package/dist/cli/push.js +276 -0
  42. package/dist/cli/safety-checks.d.ts +9 -0
  43. package/dist/cli/safety-checks.js +29 -0
  44. package/dist/cli/setup.d.ts +20 -0
  45. package/dist/cli/setup.js +349 -0
  46. package/dist/cli/shell-name.d.ts +8 -0
  47. package/dist/cli/shell-name.js +29 -0
  48. package/dist/cli/shells.d.ts +22 -0
  49. package/dist/cli/shells.js +122 -0
  50. package/dist/cli/split.d.ts +7 -0
  51. package/dist/cli/split.js +71 -0
  52. package/dist/cli/sync.d.ts +25 -0
  53. package/dist/cli/sync.js +120 -0
  54. package/dist/cli/test-runner.d.ts +21 -0
  55. package/dist/cli/test-runner.js +281 -0
  56. package/dist/core/compile.d.ts +43 -0
  57. package/dist/core/compile.js +510 -0
  58. package/dist/core/config.d.ts +533 -1
  59. package/dist/core/config.js +32 -12
  60. package/dist/core/hosted-upstream-check.d.ts +3 -0
  61. package/dist/core/hosted-upstream-check.js +35 -0
  62. package/dist/core/login-handoff.d.ts +1 -1
  63. package/dist/core/login-handoff.js +1 -1
  64. package/dist/core/project.d.ts +1798 -0
  65. package/dist/core/project.js +278 -0
  66. package/dist/core/readiness-checks.js +2 -2
  67. package/dist/core/types.d.ts +26 -1
  68. package/dist/index.d.ts +6 -0
  69. package/dist/index.js +16 -0
  70. package/dist/project.d.ts +4 -0
  71. package/dist/project.js +8 -0
  72. package/dist/server.d.ts +2 -0
  73. package/dist/server.js +1 -0
  74. package/fixtures/token-conformance-vectors.json +26 -0
  75. package/package.json +94 -94
  76. package/dist/adapters/react/page-context-guard.test.d.ts +0 -1
  77. package/dist/adapters/react/page-context-guard.test.js +0 -15
  78. package/dist/cli/agents/api-agent.d.ts +0 -22
  79. package/dist/cli/agents/api-agent.js +0 -761
  80. package/dist/cli/agents/auth-agent.d.ts +0 -7
  81. package/dist/cli/agents/auth-agent.js +0 -212
  82. package/dist/cli/agents/deeplink-agent.d.ts +0 -6
  83. package/dist/cli/agents/deeplink-agent.js +0 -285
  84. package/dist/cli/agents/llm.d.ts +0 -33
  85. package/dist/cli/agents/llm.js +0 -309
  86. package/dist/cli/agents/pipeline.d.ts +0 -72
  87. package/dist/cli/agents/pipeline.js +0 -421
  88. package/dist/cli/agents/reviewer-agent.d.ts +0 -13
  89. package/dist/cli/agents/reviewer-agent.js +0 -450
  90. package/dist/cli/agents/route-agent.d.ts +0 -17
  91. package/dist/cli/agents/route-agent.js +0 -383
  92. package/dist/cli/config-loader.test.d.ts +0 -1
  93. package/dist/cli/config-loader.test.js +0 -63
  94. package/dist/cli/detectors/topology.d.ts +0 -46
  95. package/dist/cli/detectors/topology.js +0 -417
  96. package/dist/cli/generators/config.test.d.ts +0 -1
  97. package/dist/cli/generators/config.test.js +0 -222
  98. package/dist/cli/generators/shell.test.d.ts +0 -1
  99. package/dist/cli/generators/shell.test.js +0 -73
  100. package/dist/cli/generators/token-route.test.d.ts +0 -1
  101. package/dist/cli/generators/token-route.test.js +0 -53
  102. package/dist/cli/generators/wiring-snippets.test.d.ts +0 -1
  103. package/dist/cli/generators/wiring-snippets.test.js +0 -80
  104. package/dist/cli/init.d.ts +0 -32
  105. package/dist/cli/init.js +0 -1336
  106. package/dist/cli/manifest-diff.test.d.ts +0 -1
  107. package/dist/cli/manifest-diff.test.js +0 -144
  108. package/dist/cli/processors/curl-parser.test.d.ts +0 -1
  109. package/dist/cli/processors/curl-parser.test.js +0 -24
  110. package/dist/cli/processors/integration-audit.test.d.ts +0 -1
  111. package/dist/cli/processors/integration-audit.test.js +0 -154
  112. package/dist/cli/processors/postprocess.d.ts +0 -22
  113. package/dist/cli/processors/postprocess.js +0 -107
  114. package/dist/cli/processors/prisma-parser.d.ts +0 -35
  115. package/dist/cli/processors/prisma-parser.js +0 -117
  116. package/dist/cli/processors/verify-discovery.d.ts +0 -33
  117. package/dist/cli/processors/verify-discovery.js +0 -193
  118. package/dist/cli/processors/verify-discovery.test.d.ts +0 -1
  119. package/dist/cli/processors/verify-discovery.test.js +0 -153
  120. package/dist/cli/processors/zod-extractor.d.ts +0 -27
  121. package/dist/cli/processors/zod-extractor.js +0 -153
  122. package/dist/cli/prompts/review.d.ts +0 -61
  123. package/dist/cli/prompts/review.js +0 -410
  124. package/dist/cli/selectors/express.d.ts +0 -12
  125. package/dist/cli/selectors/express.js +0 -117
  126. package/dist/cli/selectors/fastapi.d.ts +0 -12
  127. package/dist/cli/selectors/fastapi.js +0 -122
  128. package/dist/cli/selectors/generic.d.ts +0 -10
  129. package/dist/cli/selectors/generic.js +0 -74
  130. package/dist/cli/selectors/index.d.ts +0 -37
  131. package/dist/cli/selectors/index.js +0 -315
  132. package/dist/cli/selectors/next.d.ts +0 -12
  133. package/dist/cli/selectors/next.js +0 -130
  134. package/dist/core/config-policy.test.d.ts +0 -1
  135. package/dist/core/config-policy.test.js +0 -101
  136. package/dist/core/config-roundtrip.test.d.ts +0 -1
  137. package/dist/core/config-roundtrip.test.js +0 -180
  138. package/dist/core/endpoint-guard.test.d.ts +0 -1
  139. package/dist/core/endpoint-guard.test.js +0 -57
  140. package/dist/core/env-diagnostics.test.d.ts +0 -1
  141. package/dist/core/env-diagnostics.test.js +0 -31
  142. package/dist/core/evidence-bundle.conformance.test.d.ts +0 -1
  143. package/dist/core/evidence-bundle.conformance.test.js +0 -110
  144. package/dist/core/evidence-bundle.test.d.ts +0 -1
  145. package/dist/core/evidence-bundle.test.js +0 -58
  146. package/dist/core/invariants.test.d.ts +0 -1
  147. package/dist/core/invariants.test.js +0 -217
  148. package/dist/core/login-handoff.test.d.ts +0 -1
  149. package/dist/core/login-handoff.test.js +0 -31
  150. package/dist/core/profile.test.d.ts +0 -1
  151. package/dist/core/profile.test.js +0 -95
  152. package/dist/core/readiness-checks.test.d.ts +0 -1
  153. package/dist/core/readiness-checks.test.js +0 -106
  154. package/dist/core/receipt.test.d.ts +0 -1
  155. package/dist/core/receipt.test.js +0 -75
  156. package/dist/core/side-effects-review.test.d.ts +0 -1
  157. package/dist/core/side-effects-review.test.js +0 -28
  158. package/dist/core/token.test.d.ts +0 -1
  159. package/dist/core/token.test.js +0 -66
package/CHANGELOG.md CHANGED
@@ -1,336 +1,385 @@
1
- # Changelog — @duct-sdk/sdk
2
-
3
- ## [0.5.12] — 2026-07-25
4
-
5
- ### Added
6
- - **`sideEffectsReviewAck`** — manifest action field (reason string) when declared `sideEffects` intentionally disagrees with HTTP-method-derived expectation. `duct push` blocks CI/non-TTY pushes until set; interactive push prompts and writes acks into `duct.config.ts`. No `--force` skip.
7
-
8
- ## [0.5.11] — 2026-07-22
9
-
10
- ### Added
11
- - **`duct push` flags dashboard network reverts** — a push whose config would turn OFF a network setting the dashboard has ON (`intershell_enabled` true→false, or `registry_visibility` public→private) is flagged and blocked unless `--yes`. Because the config schema defaults these to off/`private`, an omitted field reads as an explicit off, so a stale or CI config could otherwise silently disable cross-shell reachability that was enabled in the dashboard. Detection lives in the pure, tested `detectDashboardNetworkReverts`. With `--yes`, the SDK sends `force_dashboard_network_override: true` so the server applies the config values intentionally.
12
-
13
- ## [0.5.10] — 2026-07-19
14
-
15
- ### Added
16
- - **`duct verify-evidence`** — offline verification for `duct:audit-evidence:v1` bundles (receipt signatures, chain integrity, signed checkpoints); exported from `@duct-sdk/sdk` and `@duct-sdk/sdk/server`.
17
- - **Intershell manifest validation** — `agentPermissions.allowedCallees` schema; `crossValidateDuctConfig` requires `webhooks.identityUrl` when `intershell_enabled` and protected actions coexist.
18
-
19
- ### Improved
20
- - **Readiness product URL probe** — `duct checkup` and shared readiness helpers now HTTP-probe `product.baseUrl` (with a Docker `host.docker.internal` fallback for loopback URLs) and optionally check the platform status page URL.
21
-
22
- ### Changed
23
- - **Shell panel defaults** — default `panelHeight` 640→680; preset heights +40px (`tall` 700, `square` 540, `large` 760) so trust footer does not shrink the chat area.
24
- - **Launcher icon** — default closed-widget candidates prefer shell-origin Duct assets; removed host-relative `/duct-text-no-bg.png` first candidate that could show a host site's own file.
25
-
26
- ## [0.5.9] — 2026-07-18
27
-
28
- ### Added
29
- - **SDK-01 profile discovery** — `duct profile` commands (`show`, `list`, `use`, `init`) and auto-load from `~/.duct/profile.json`. Built-in `local` and `hosted` presets map service URLs; `DUCT_PROFILE` env still wins. Localhost guard respects `profile=local`.
30
- - **Profile resolution tests** — `profile.test.ts` covers file load, env precedence, and protected shell keys.
31
- - **Consumer-safe contracts packaging** — release tarballs declare the contracts semver and bundle the matching runtime schemas; publish smoke installs the packed SDK in a clean project.
32
-
33
- ## [0.5.8] — 2026-07-18
34
-
35
- ### Added
36
- - **CLI diagnostics** — `duct whoami`, `duct logout`, and `duct env --redact` for account and endpoint inspection with secret redaction.
37
- - **Hosted localhost guard** — `init`, `login`, `push`, and `checkup` fail in hosted mode when service URLs resolve to localhost unless `DUCT_PROFILE=local` or `DUCT_ALLOW_LOCALHOST=true`.
38
-
39
- ## [0.5.7] — 2026-07-18
40
-
41
- ### Added
42
- - **READINESS-01 (partial)** — shared `readiness-checks` schema (Zod) plus `duct checkup --json` machine-readable report (env signals, auth/API/shell/dashboard health, docs URL). Dashboard go-live section reuses the same check definitions.
43
-
44
- ## [0.5.6] — 2026-07-18
45
-
46
- ### Fixed
47
- - **Config schema parity** — `DuctConfigSchema` now accepts documented manifest fields that were previously stripped by Zod parse: action `inputSchema`, `dependsOn`, semantic metadata (`semanticType`, `outputSchema`, `paramMappings`, `navigatesTo`), `searchHint`/`alwaysInclude`/`interruptBehavior`, route `searchAction`, `dataModel`, and widget loop limits (`compactionTurns`, `maxToolIterations`, `maxPlanSteps`).
48
-
49
- ## [0.5.5] — 2026-07-18
50
-
51
- ### Fixed
52
- - **CLI ESM crash** — Replaced `require()` calls in the CLI entry point with ESM `import`/`readFileSync`/`existsSync` so `npx @duct-sdk/sdk --help` works from the published tarball (`"type": "module"`).
53
- - **`.env` precedence** — `.env.local` now correctly overrides `.env` for the same key; shell/process environment still wins over both.
54
-
55
- ## [0.5.4] — 2026-07-17
56
-
57
- ### Added
58
- - **Host panel close (loading)** — `DuctShell` renders a close control on the panel chrome until the iframe posts `DUCT_READY`, so users can dismiss the panel while the shell is still connecting. After the shell is live, close stays inside the embedded shell UI (`DUCT_CLOSE`).
59
-
60
- ## [0.5.3] — 2026-07-17
61
-
62
- ### Security
63
- - **Consent callback scaffold (v2)** — `duct init` consent-callback routes receive `duct_consent_code` in the redirect (90s TTL) and exchange it server-to-server via `POST /v1/consent/redeem` with shell credentials. Long-lived consent tokens are never placed in browser URLs or query strings.
64
-
65
- ### Changed
66
- - Generated consent callback snippets (Next.js App Router + Express) updated for the authorization-code delivery flow; store redeemed tokens server-side for agent retrieval.
67
-
68
- ## [0.5.2] — 2026-07-12
69
-
70
- ### Added
71
- - **`DUCT_TOKEN_PUSH`** — `DuctShell` pushes a fresh `onTokenRequest` token when the iframe is ready and whenever the panel opens, so host login reconnects the chat without a hard refresh.
72
-
73
- ## [0.5.1] — 2026-07-09
74
-
75
- ### Changed
76
- - **`DuctShell`** — removed the host-panel close control. The embedded shell host renders the panel close and posts `DUCT_CLOSE`; the SDK still listens and collapses the panel.
77
-
78
- Public release notes for the Duct SDK. Versioning follows [semver](https://semver.org).
79
-
80
- ## [0.5.0] — 2026-07-08
81
-
82
- ### Added
83
- - `duct init` framework support: Nuxt, Vue 3, Express, and FastAPI / Python generators; Express + FastAPI detection.
84
-
85
- ### Fixed
86
- - Token-route generator emitted `return return …` (uncompilable) when `guestAllowed:false`; fixed across all frameworks.
87
- - Unknown / unsupported stacks now hard-stop with guidance instead of writing Next.js files.
88
-
89
-
90
- Public release notes for the Duct SDK. Versioning follows [semver](https://semver.org).
91
-
92
- ## [0.4.7] — 2026-07-08
93
-
94
- ### Added
95
- - **`TOKEN_SPEC.md`** — language-agnostic token verification spec (prefixes, claims, TTLs, HS256 + Ed25519/JWKS paths) with Python, Go, and Ruby verify snippets.
96
- - **`verifyReceipt()`** — pure crypto-layer outcome receipt verification in `@duct-sdk/sdk/server` (HMAC + optional Ed25519 JWKS/public keys).
97
- - **Manifest privilege diff at push** — `duct push` fetches the live manifest, prints privilege-increasing deltas, and blocks unless `--yes`. `duct push --dry-run` prints the diff and exits without pushing.
98
- - **Richer manifest policy schema** — `validFrom`/`validUntil`, `approveIf`, `actionLimit` (rate vs count), and `agentPermissions.consentActionScope` with Zod + cross-validation.
99
-
100
- ### Fixed
101
- - **`duct pull`** — restored `duct.config.ts` now imports `@duct-sdk/sdk` (was `@duct/sdk`).
102
-
103
- ### Docs
104
- - Deeplink receiver docs (README + generated receiver comments) document `jti` replay protection and `RedisReplayStore` for production.
105
-
106
- ## [0.4.6] — 2026-07-08
107
-
108
- ### Security
109
- - **Deeplink replay protection** — `DeeplinkTokenPayload` now includes `jti`; `verifyDeeplinkToken` accepts an optional `replayStore` and ships `createDevReplayStore` / `RedisReplayStore`. Generated receivers wire the dev store; Remix/Express/SvelteKit templates now include replay logic.
110
- - **`generateDuctToken` allowlist** — session fields are copied only from `auth.sessionFields` (denylist retained as secondary guard).
111
- - **`duct push` safety gate** — runs `crossValidateDuctConfig` (hard-fail) and agent-safety checks; warnings require `--yes` to override in CI.
112
- - **Config loading** — `duct.config.ts` is parsed as static data (no `process` in VM context); runtime references are rejected.
113
- - **Embed hardening** — generated Vue/Nuxt shells validate `event.origin` and same-origin deeplink URLs; `useDuctPageContext` fails closed without `shellHost`.
114
- - **Express consent middleware** — `ductOrConsentAuth` rejects unrecognized Bearer tokens instead of calling `next()`; verify snippets document `expectedShellId`.
115
-
116
- ### Changed
117
- - **`duct init`** — detects existing generated files and prompts to skip/overwrite instead of clobbering (`--yes` skips existing files).
118
- - **`duct login`** — documents credential storage, warns that `--token` leaks to shell history, notes Windows NTFS ACL reliance.
119
-
120
- ## [0.4.5] — 2026-07-05
121
-
122
- ### Added
123
- - **Consent callback route scaffold** — `duct init` with `duct-consent` mode now emits a consent callback route (`app/api/duct/callback/route.ts` for Next.js App Router, `routes/duct/callback.ts` for Express) that handles the `?user_consent_token=…&user_ref=…` redirect from Duct, with TODO markers for DB/queue storage.
124
- - **`consentCallbackSnippet` / `consentCallbackSnippetPath`** on `WiringPlan`.
125
- - `generateConsentCallbackSnippet(framework)` exported from `wiring-snippets.ts`.
126
-
127
- ### Changed
128
- - **`uct-consent-auth.ts` snippet updated** — `verifyUct` / `verifyConsentToken` now surface `user_ref` from `/v1/verify/consent-token`. Express version sets `req.ductUserRef`; Next.js/App Router version returns `{ userRef }` from `resolveAgentAwareUser`. Snippets no longer claim to return a generic `user` object.
129
-
130
- ## [0.4.4] — 2026-07-04
131
-
132
- ### Changed
133
- - **`product.logoUrl`** — logo URL belongs under `product` in `duct.config.ts` (removed from `widget`). `duct init` auto-detects `public/logo.*` and resolves against `baseUrl`.
134
-
135
- ## [0.4.3] — 2026-07-03
136
-
137
- ### Fixed
138
- - **`DuctShell` launcher icon when the shell host is unreachable** — bubble icon tries the host app's `/duct-text-no-bg.png` before the shell host URL; removed the nonexistent `duct-logo.png` candidate; final fallback is the `duↄt` wordmark instead of a broken orange SVG.
139
-
140
- ## [0.4.2] — 2026-07-03
141
-
142
- ### Fixed
143
- - **`DuctShell` drag position after handoff** — panel drag position is now persisted in `localStorage` alongside the launcher bubble, so deeplink/sign-in navigations no longer reset a repositioned embed. Legacy `{ x, y }` bubble-only storage remains supported.
144
-
145
- ## [0.4.1] — 2026-07-03
146
-
147
- ### Added
148
- - **`auth.loginRoutePath` and `auth.loginDeeplinkId`** — optional manifest fields that tell the shell where to send unauthenticated users before invoking `requiresAuth` actions.
149
- - **`core/login-handoff.ts`** — `detectLoginRoutePath()`, `enrichAuthLoginHandoff()`, and `resolveLoginHandoff()` helpers shared with codegen.
150
- - **`duct init` auto-wiring** — pipeline sets `loginRoutePath` (and `loginDeeplinkId` when a matching deeplink exists) from discovered routes.
151
-
152
- ## [0.4.0] — 2026-07-02
153
-
154
- ### Added
155
- - **`duct init` wiring plan** — prints create/modify/verify steps before writing files; writes `.duct/snippets/verify-duct-token.ts` (and optional consent-auth snippet when third-party agents are enabled).
156
- - **Post-init integration audit** — deterministic issues table after file write (token route, receiver, embed, env, deeplinks, middleware). Same audit runs in `duct checkup` when `duct.config.ts` exists.
157
- - **Third-party agent prompt** — init asks whether partner agents need user-scoped access (`none` / Duct consent / company OAuth) and generates the matching middleware guidance.
158
- - **Ground-truth verification** — routes and actions matched against the filesystem; hallucinated endpoints downgraded or dropped; evidence persisted as inline comments and schemas in generated config.
159
- - **29 automated tests** — config normalization, token routes, wiring snippets, integration audit, verify-discovery, curl-parser.
160
-
161
- ### Improved
162
- - **Auth-aware token routes** — per-strategy session lookup (NextAuth, Clerk, Auth0, session-cookie, custom-jwt, Express, Remix, SvelteKit); returns 401 when `guestAllowed: false` and session is empty.
163
- - **`duct init --api-spec`** — RouteAgent still runs in parallel so UI routes and deeplinks are discovered alongside OpenAPI actions.
164
- - **Pre-write validation** — `validateDuctConfigStrict()` aborts init with an issues table on invalid config.
165
- - **Relaxed `/api/` filter** — non-`/api/` action paths kept with a warning and confidence cap instead of dropped silently.
166
- - **Webhook next-steps** — printed when side-effect actions are approved during review.
167
- - **Ship checklist** — post-init next steps include middleware wiring path and `duct checkup`.
168
-
169
- ### Fixed
170
- - **`tokenEndpoint` Zod validation** — relative paths normalized to full URLs before codegen; invalid values omitted.
171
- - **Intershell review answers** — `intershell_enabled` / `registry_visibility` from interactive review now reach the generated config.
172
- - **`apiBaseUrl` + `logoUrl`** — emitted in generated `duct.config.ts` product/widget blocks.
173
- - **Server imports** — all generated token/receiver routes import from `@duct-sdk/sdk/server`.
174
- - **Docs URL in config header** — points at Duct docs instead of a fabricated `docs.<company-domain>` link.
175
- - **Docs URL in every receiver file** — `generators/receiver.ts` (Next App/Pages, Remix, Express, SvelteKit) still hardcoded `docs.your-domain.com` after the config-file fix; all five now resolve via `getDocsUrl()` too.
176
-
177
- ## [0.3.13] — 2026-07-02
178
-
179
- ### Fixed
180
- - **Deeplink receipt confirmation** — Remix, Vite, and SvelteKit receivers now call `/v1/deeplinks/:id/confirm` (fire-and-forget) when `DUCT_API_KEY` is set, matching the Next.js adapter. Extracted into shared `core/receiver.ts` so adapters cannot drift.
181
- - **Claim validation** — all four receivers reject tokens missing `iss` or `sub` claims after verification.
182
-
183
- ### Changed
184
- - **Unified `onReceive` result** — `ReceiverResult` / `RemixReceiverResult` / `ViteReceiverResult` / `SvelteKitReceiverResult` now share the same shape (`redirectUrl`, `data`, `headers`). Next adapter applies `headers` on JSON responses.
185
- - **`@duct-sdk/sdk/server`** — exports `buildDeeplinkRedirectUrl`, `buildDeeplinkSession`, `validateDeeplinkClaims`, `confirmDeeplinkReceipt`, and `DeeplinkReceiverResult`.
186
-
187
- ## [0.3.11] — 2026-06-16
188
-
189
- ### Fixed
190
- - **Panel drag handle (light theme)** — grab bar uses a solid mid-gray with subtle shadow instead of 20% black, so it stays visible on light shell headers.
191
-
192
- ## [0.3.10] — 2026-06-16
193
-
194
- ### Improved
195
- - **`duct init` shell generator** — `DuctShellEmbed` now passes `theme` from `duct.config.ts` → `widget.theme`; Svelte/Vue/Nuxt iframe URLs include `?theme=` so the hosted shell matches before push.
196
-
197
- ## [0.3.9] — 2026-06-14
198
-
199
- ### Added
200
- - **`duct init --curl-collection`** — import actions from curl scripts or Postman Collection v2.1 JSON (deterministic, no LLM)
201
- - **`core/auth-boundaries.ts`** — shared helpers for action-definition fingerprints and risk-tiered scope checks (aligned with Duct platform auth validation)
202
-
203
- ### Improved
204
- - **OpenAPI import** — `$ref` resolution for requestBody schemas; tag-based action ID derivation; collision suffixes; lower confidence when `operationId` is absent
205
-
206
- ## [0.3.8] — 2026-06-11
207
-
208
- ### Fixed
209
- - **Smoother shell drag** — bubble and panel drags batch position updates to one React commit per animation frame, attach move listeners synchronously on pointer down, use pointer capture, and disable panel `transform` while dragging.
210
-
211
- ## [0.3.7] — 2026-06-11
212
-
213
- ### Added
214
- - `@duct-sdk/sdk/server` exports `sendIntershellAction` and `sendIntershellQuery` — thin cross-shell client with consent retry (IS-29)
215
-
216
- ## [0.3.6] — 2026-06-10
217
-
218
- ### Fixed
219
- - **Launcher drag UX** — closed bubble drags from the icon itself (4px threshold); no grab cursor or extra handle on hover. Tap still opens.
220
- - **Panel drag handle** — grab bar only renders while the panel is open; themed “Drag to move” tooltip replaces the native browser title.
221
-
222
- ## [0.3.5] — 2026-06-10
223
-
224
- ### Fixed
225
- - **Explicit drag handles** — `DuctShell` launcher and open panel no longer treat the whole chrome as a drag target. A small grab handle is the only drag surface; the bubble uses a normal click to open and the panel header stays fully interactive.
226
-
227
- ## [0.3.4] — 2026-06-10
228
-
229
- ### Fixed
230
- - **`duct push` schema validation** — validates the loaded manifest against `DuctConfigSchema` before upload. Catches missing `product.baseUrl` and other required fields instead of pushing a broken manifest that fails at action-invoke time.
231
-
232
- ### Changed
233
- - **Manual mode template** — `duct init --manual` product block now documents optional `apiBaseUrl` (action proxy target; defaults to `baseUrl`).
234
-
235
- ## [0.3.3] — 2026-06-09
236
-
237
- ### Fixed
238
- - **Stable iframe `src`** — `userContext` is no longer embedded in the shell iframe URL; context is delivered via `DUCT_READY` postMessage instead. Prevents full iframe reloads when the host page navigates after a deeplink handoff.
239
-
240
- ## [0.3.2] — 2026-06-09
241
-
242
- ### Added
243
- - **`@duct-sdk/sdk/server` subpath** — backend-safe entry point with token helpers (`generateDuctToken`, `verifyDuctToken`, `verifyDeeplinkToken`), config, and introspect handlers. No React dependency. Safe in Express, Fastify, Next.js API routes, Remix loaders, SvelteKit hooks, and any Node.js/Edge runtime. The root `@duct-sdk/sdk` export pulls React adapters and **crashes** plain Node backends where React is not installed; use `/server` for all backend code.
244
-
245
- ### Fixed
246
- - **Panel re-anchors to bubble after drag** — dragging the bubble to a new screen position now clears the previous panel position, so opening the shell always places the panel near the bubble's current location rather than the old dragged spot.
247
- - **Token retry after mid-session login** — if the first token request returned empty (user not yet logged in), each subsequent message now retries the token fetch instead of silently staying unauthenticated for the life of the session.
248
- - **Sticky "Working on it…" spinner** — the router progress indicator is now cleared when any terminal event arrives (`text_done`, `error`, deeplink, generative UI, clarification). Previously the spinner persisted alongside the final answer.
249
- - **Hydration mismatch on shell embed** — messages and session ID are now loaded from `localStorage` in `useEffect` (post-hydration) instead of during initial `useState`, eliminating the React SSR/client HTML mismatch error in the shell iframe.
250
- - **`+New` button unclickable** — the panel drag overlay was covering the full header including the `+New` and close buttons. The overlay now ends before the header action cluster so buttons are always clickable.
251
-
252
- ## [0.3.1] — 2026-06-09
253
-
254
- ### Added
255
- - Draggable open panel with viewport clamping — panel stays on-screen after free-drag via top handle
256
-
257
- ### Fixed
258
- - Panel position clamped to viewport bounds on drag end
259
-
260
- ## [0.3.0] — 2026-06-09
261
-
262
- ### Added
263
- - **Shell size presets** — `widget.preset` and the `<DuctShell preset>` prop accept `'tall'` (vertical rectangle, default), `'square'` (Copilot-style), or `'large'`. Dimensions resolve from a single source of truth (`SHELL_PRESET_DIMENSIONS`, `resolveShellDimensions()`), replacing ad-hoc `width`/`height` guessing. Raw `width`/`height` still work as an override.
264
- - **Draggable launcher and panel** — the floating bubble can be dragged anywhere on the page (free drop, persisted per shell), and the opened panel can also be moved via its top handle. `position` now only sets the starting corner. Disable with `draggable={false}`.
265
- - **Theme-aware bubble** — new `<DuctShell theme>` prop (`'light' | 'dark' | 'system'`, default `'system'`); the launcher chrome adapts to light/dark instead of a hardcoded dark circle.
266
- - `DUCT_PANEL_SIZE` postMessage now carries `preset`, so a shell's manifest can drive panel sizing on the host.
267
-
268
- ### Changed
269
- - Launcher logo now uses the Duct word-mark (`duct-text-no-bg.png`) with the previous `duct-logo.png` kept as a fallback candidate.
270
- - Generated framework embeds (`duct init` for Next/Remix/Vite) now emit `preset` + `position` and drop the fixed `width`/`height` style override.
271
- - The Next.js adapter (`@duct-sdk/sdk/next`) now re-exports the React implementation to prevent the two adapters from drifting.
272
- - `WidgetConfig` Zod schema widened to validate `preset`, `theme`, `placeholder`, `width`, `height`, `logoUrl`, and `customCSS` (previously stripped on `duct push`).
273
-
274
- ## [0.2.3] — 2026-06-08
275
-
276
- ### Added
277
- - `widget.maxToolIterations` and `widget.maxPlanSteps` on `DuctConfig` — configurable agent loop ceilings (defaults 12 / 8).
278
- - `core/limits.ts` — exported default and hard-ceiling constants for manifest tooling.
279
- - `duct init --api-spec <path>` now works end-to-end without requiring an LLM.
280
- A new deterministic OpenAPI parser (`cli/processors/openapi-parser.ts`) maps
281
- every path + method in an OpenAPI 3.x or Swagger 2.x spec directly to
282
- `ActionManifest[]` and `RouteManifest[]`:
283
- - GET operations → `agentAccessible: false` by default (interactive review applies)
284
- - POST/PUT/PATCH/DELETE → `sideEffects: true`
285
- - Operations with `operationId` → `confidence: 1.0`; without → `confidence: 0.95`
286
- - Sensitivity inferred from path + description keywords
287
- - `x-duct-sensitivity` extension accepted for manual override
288
- - Internal Duct / NextAuth routes excluded automatically
289
- - Path + query parameters extracted; `inputSchema` populated from `requestBody`
290
- - YAML spec support (`.yaml` / `.yml`) via the new `yaml` dependency (v2.x, zero deps).
291
-
292
- ### Fixed
293
- - **SDK embed security:** React and Next.js `DuctShell` adapters now validate `event.source === iframe.contentWindow` and reject deeplink URLs that are not same-origin or relative paths.
294
- - **`pipeline.ts` spec-mode bug:** when `--api-spec` was provided the API agent was
295
- incorrectly added to the skip list, returning zero actions. The deterministic parser
296
- now runs directly in the pipeline; the Auth agent still runs in parallel to detect
297
- auth patterns from project source files.
298
- - **`pipeline.ts`:** `skipAgents` scope bug — deeplink/review skip flags now work in spec-mode as well as normal mode.
299
- - **`openapi-parser.ts`:** removed unused parameter.
300
-
301
- ### Changed
302
- - `pipeline.ts`: spec-mode and normal-mode are now separate branches in Stage 1.
303
- Both paths feed the same Deeplink + Reviewer agents in Stage 2 and Stage 3.
304
-
305
- ## [0.2.2] — 2026-06-07
306
-
307
- ### Changed
308
- - `RouteManifest.searchAction` docs updated — runtime now invokes the declared action in-shell for data queries instead of deeplink navigation
309
- - `dataModel` field docs clarified; entity-resolution runtime wiring tracked separately
310
-
311
- ## [0.2.1] — 2026-06-06
312
-
313
- ### Changed
314
- - Smaller published package (removed unused bundled image asset)
315
-
316
- ## [0.2.0] — 2026-06-06
317
-
318
- ### Added
319
- - `duct init --manual` — commented `duct.config.ts` template without LLM
320
- - `duct init --update` — re-scan only files changed since last push
321
- - `duct promote --from <id> --to <id>` — copy manifest between environment shells
322
- - Interactive init review with confidence scores for detected routes and actions
323
-
324
- ### Changed
325
- - `allowedCallers` is canonical; legacy `allowedAgents` removed from config types
326
- - Generated configs and examples use environment-configurable base URLs
327
-
328
- ## [0.1.13] — 2026-06-05
329
-
330
- ### Fixed
331
- - More stable generator output for empty manifests
332
-
333
- ## [0.1.0] — 2026-03-15
334
-
335
- ### Added
336
- - Initial publish: `login`, `init`, `push`, `pull`, framework adapters (Next, Remix, Vite, SvelteKit, React)
1
+ # Changelog — @duct-sdk/sdk
2
+
3
+ ## [0.6.0] — 2026-11-20
4
+
5
+ ### Added
6
+ - **`duct mcp-setup` (duct-setup MCP server)** — a second, separate server so an assistant can finish the dashboard side without loading the onboarding tools: `setup_status`, `setup_configure` (preview, then `confirm: true`), `setup_check`, `setup_partner`. A generated webhook signing secret is written to a git-ignored `.env.duct.<shell>` file and never returned. Both servers share `mcp-core.ts`.
7
+ - **`duct login` signs in through the browser** — it shows a short code, opens the dashboard to approve this machine, and receives a key made for it. Nothing is pasted; other keys keep working. `--paste` (masked prompt) and `--token` remain, and `setup` uses the same flow when signed out.
8
+ - **`duct shells` and `duct shells create <name> --domain <url>`** — prod, staging, dev, or a custom name (checkout-prod, us-east). Credentials go to a git-ignored `.env.duct.<name>` file (never overwritten, never printed). A name that exists points to the existing shell; `setup --shell` accepts a name or an ID.
9
+ - **MCP `duct_create_shell`** — previews, then creates only with `confirm: true`; returns the shell ID and the file path, never the secret.
10
+ - **One shell-name rule everywhere** — `shell-name.ts` matches auth and the dashboard; all three run the shared cases in `packages/contracts/src/fixtures/shell-names.json`.
11
+ - **`duct mcp` — onboarding MCP server (`duct-onboarding`)** for Claude Code, Cursor, VS Code, Codex and other assistants, over stdio with no extra dependencies. Five tools: `duct_status` (sign-in, shells, existing project, API specs found, next step), `duct_setup` (writes `duct/`, never pushes; refuses to guess between several shells), `duct_check` (validate or cloud checks as a structured report), `duct_push` (preview of what would change, warnings included; publishes only when called again with `confirm: true` and the preview's token, so what ships is exactly what the developer approved), `duct_add` (identity or embed wiring); plus an `onboard` prompt. Each tool runs the same CLI command in a subprocess, so behaviour matches the CLI and nothing printed can corrupt the protocol stream. The API key never reaches the assistant: sign-in stays `duct login` in the developer's terminal or `DUCT_API_KEY`. Tools that write refuse to run outside a repository unless given `projectDir`, since some clients start servers in the home directory.
12
+ - **`duct setup`** (default command — `npx @duct-sdk/sdk`): sign in → pick shell → find the API (OpenAPI file in the repo, the spec a running API serves at `/openapi.json`, `/v3/api-docs`, `/api-json`, …, or a Postman / curl collection) → write `duct/` with safe defaults → verify with Duct cloud → push. `--source`, `--api-url`, `--shell`, `--yes`, `--no-push`, `--force`.
13
+ - **`duct/` project layout** — the single manifest split by concern: `project.ts`, `capabilities.json`, `policy.ts`, optional `shell.ts` and `tests.ts`. `push` compiles it into the same manifest the gateway enforces. New `@duct-sdk/sdk/project` entry exports `defineProject` / `definePolicy` / `defineShell` / `defineTests` (no React or Node-only deps).
14
+ - **Policy file**: `agents.access` (none | read | write), `allow` / `deny` snake_case globs (deny wins), `userConsent`, `approveWhen` conditions (`gt`/`gte`/`lt`/`lte`/`eq`/`neq`/`in`, `any`/`all`), `limits` (`perMinute`, `perHour`, `perDay`, `total`, `window`), `sensitivity`, `windows`, `approvers`. Default policy: reads open with consent (never high/critical), writes off for agents until you allow them (then each one waits for a human), DELETE denied, everything rate limited.
15
+ - **`duct test`**: local push gates plus Duct cloud checks — shell ownership, upstream reachability, built-in guardrails, `duct/tests.ts` expectations, live-vs-local drift. `--json`, `--offline`. **`duct validate`** for offline/CI.
16
+ - **`duct sync`** refreshes `capabilities.json` from its recorded source and keeps reviewed fields (name, description, sensitivity, side-effect classification + ack).
17
+ - **`duct split`** migrates `duct.config.ts` → `duct/`; files are written only after recompiling to identical enforcement for every action.
18
+ - **`duct add identity | shell`** — optional layers (token route, receiver, middleware snippet with auth + login-page detection; chat shell component + `duct/shell.ts`).
19
+ - **`duct prompt`** — instructions for the developer's coding agent to fill `capabilities.json` when there is no OpenAPI spec.
20
+ - **Tests** in `packages/sdk/tests/` (compiler, split equivalence, static loader safety, discovery, sync merge, CLI end-to-end against a fake Duct cloud).
21
+
22
+ ### Changed
23
+ - **README rewritten**: quickstart first, both MCP servers with their tools and client configs, the `duct/` policy fields explained, every CLI command grouped by task, webhook signature verification, receipts, and how the CLI finds your Duct deployment.
24
+ - README and the identity audit hint point to `npx @duct-sdk/sdk mcp` / `add identity` instead of the retired integration prompt page.
25
+ - **duct-setup confirms are bound to the preview** — `setup_configure` and `setup_partner` return a `preview_token`; confirm must echo it, so what is saved is what the developer approved. A new signing secret is only written inside a repository (or the `project_dir` given). Repository detection and preview tokens live in `mcp-core.ts`, shared with `duct mcp`.
26
+ - **Plain CLI output** — no decorative glyphs (section markers, warning symbols that render as emoji in some terminals); help shows `Usage: duct` with a one-line description; setup ends with "Setup complete. Your shell is live."
27
+ - **`duct init` now runs `setup`**; `push`, `scan`, `pull`, `rollback`, `checkup` auto-detect `duct/` or `duct.config.ts` (`--config` optional). `pull` restores into `duct/` when the project uses it.
28
+ - CLI hints use `npx @duct-sdk/sdk` everywhere (`npx duct` resolves to a different package).
29
+
30
+ ### Removed
31
+ - Unused internal modules `core/auth-boundaries.ts` and `core/limits.ts` (never exported).
32
+ - **LLM-based init pipeline** (route/API/auth/deeplink/reviewer agents, file selectors, post-processing, Prisma/Zod extraction) and the `@anthropic-ai/sdk`, `ignore`, `node-fetch` dependencies. The CLI no longer needs a model API key and no longer ships prompts.
33
+
34
+ ### Fixed
35
+ - The npm package no longer ships compiled test files (`dist/**/*.test.*`): 216 → 166 files.
36
+ - **`duct add identity` pointed to the wrong place for the secret** — it said to copy `DUCT_SECRET_KEY` from Shell → Settings; the key is shown once when the shell is created and rotated under Shell → Credentials.
37
+ - **Works with any stack** — `add identity` / `add shell` generated Next.js App Router code for any project the CLI did not recognise (Django, Rails, Go, Spring, Laravel, mobile backends). Unrecognised stacks now get `duct/identity-contract.md` (the three HTTP behaviours to implement in any language, with the token claims and where to find the conformance vectors) and `duct/shell-embed.html` (plain HTML / WebView embed whose deeplink handler only follows http(s) or same-site URLs). Setup, test, and push never depended on the framework.
38
+ - **Large APIs keep every DELETE denied** — the default policy dropped its deny list entirely when an API had more than 20 DELETE endpoints. Every DELETE is now denied, collapsed to `delete_*` when that pattern matches only DELETE actions.
39
+ - **Cloud checks stay small for large APIs** — `duct test` sent the whole compiled config to every check. Policy checks now send only the actions their cases name, and the reachability check only where the API lives. Verified end to end with 1,500 and 5,000 operations.
40
+ - Generated files and CLI hints told developers to run `npx duct init` (removed — and `npx duct` resolves to a different package). Headers now name the command that generated them (`npx @duct-sdk/sdk add identity` / `add shell`), and hints point at `setup`, `sync`, `push`.
41
+ - **OpenAPI paths with parameters** (`/orders/{id}`) were silently dropped by the importer, and `{param}` was never interpolated by the gateway; paths are now imported as `/orders/:id`.
42
+ - Static config loader no longer rejects configs whose **string values** contain words like "process" or "fetch".
43
+
44
+ ## [0.5.13] — 2026-07-26
45
+
46
+ ### Added
47
+ - **Manifest `approval.stepUp` and `operatorNotifications`** schema defaults.
48
+ - **Token conformance vectors** (`fixtures/token-conformance-vectors.json`) and drift test.
49
+ - **`duct checkup` hosted-private upstream** detection for local `apiBaseUrl` against hosted profiles.
50
+ - **Root export guard** — `DuctSdkWrongEntrypointError` when React is not installed.
51
+
52
+ ## [0.5.12] — 2026-07-25
53
+
54
+ ### Added
55
+ - **`sideEffectsReviewAck`** — manifest action field (reason string) when declared `sideEffects` intentionally disagrees with HTTP-method-derived expectation. `duct push` blocks CI/non-TTY pushes until set; interactive push prompts and writes acks into `duct.config.ts`. No `--force` skip.
56
+
57
+ ## [0.5.11] — 2026-07-22
58
+
59
+ ### Added
60
+ - **`duct push` flags dashboard network reverts** — a push whose config would turn OFF a network setting the dashboard has ON (`intershell_enabled` true→false, or `registry_visibility` public→private) is flagged and blocked unless `--yes`. Because the config schema defaults these to off/`private`, an omitted field reads as an explicit off, so a stale or CI config could otherwise silently disable cross-shell reachability that was enabled in the dashboard. Detection lives in the pure, tested `detectDashboardNetworkReverts`. With `--yes`, the SDK sends `force_dashboard_network_override: true` so the server applies the config values intentionally.
61
+
62
+ ## [0.5.10] — 2026-07-19
63
+
64
+ ### Added
65
+ - **`duct verify-evidence`** — offline verification for `duct:audit-evidence:v1` bundles (receipt signatures, chain integrity, signed checkpoints); exported from `@duct-sdk/sdk` and `@duct-sdk/sdk/server`.
66
+ - **Intershell manifest validation** — `agentPermissions.allowedCallees` schema; `crossValidateDuctConfig` requires `webhooks.identityUrl` when `intershell_enabled` and protected actions coexist.
67
+
68
+ ### Improved
69
+ - **Readiness product URL probe** — `duct checkup` and shared readiness helpers now HTTP-probe `product.baseUrl` (with a Docker `host.docker.internal` fallback for loopback URLs) and optionally check the platform status page URL.
70
+
71
+ ### Changed
72
+ - **Shell panel defaults** — default `panelHeight` 640→680; preset heights +40px (`tall` 700, `square` 540, `large` 760) so trust footer does not shrink the chat area.
73
+ - **Launcher icon** — default closed-widget candidates prefer shell-origin Duct assets; removed host-relative `/duct-text-no-bg.png` first candidate that could show a host site's own file.
74
+
75
+ ## [0.5.9] — 2026-07-18
76
+
77
+ ### Added
78
+ - **SDK-01 profile discovery** — `duct profile` commands (`show`, `list`, `use`, `init`) and auto-load from `~/.duct/profile.json`. Built-in `local` and `hosted` presets map service URLs; `DUCT_PROFILE` env still wins. Localhost guard respects `profile=local`.
79
+ - **Profile resolution tests** — `profile.test.ts` covers file load, env precedence, and protected shell keys.
80
+ - **Consumer-safe contracts packaging** — release tarballs declare the contracts semver and bundle the matching runtime schemas; publish smoke installs the packed SDK in a clean project.
81
+
82
+ ## [0.5.8] — 2026-07-18
83
+
84
+ ### Added
85
+ - **CLI diagnostics** — `duct whoami`, `duct logout`, and `duct env --redact` for account and endpoint inspection with secret redaction.
86
+ - **Hosted localhost guard** — `init`, `login`, `push`, and `checkup` fail in hosted mode when service URLs resolve to localhost unless `DUCT_PROFILE=local` or `DUCT_ALLOW_LOCALHOST=true`.
87
+
88
+ ## [0.5.7] — 2026-07-18
89
+
90
+ ### Added
91
+ - **READINESS-01 (partial)** — shared `readiness-checks` schema (Zod) plus `duct checkup --json` machine-readable report (env signals, auth/API/shell/dashboard health, docs URL). Dashboard go-live section reuses the same check definitions.
92
+
93
+ ## [0.5.6] — 2026-07-18
94
+
95
+ ### Fixed
96
+ - **Config schema parity** — `DuctConfigSchema` now accepts documented manifest fields that were previously stripped by Zod parse: action `inputSchema`, `dependsOn`, semantic metadata (`semanticType`, `outputSchema`, `paramMappings`, `navigatesTo`), `searchHint`/`alwaysInclude`/`interruptBehavior`, route `searchAction`, `dataModel`, and widget loop limits (`compactionTurns`, `maxToolIterations`, `maxPlanSteps`).
97
+
98
+ ## [0.5.5] — 2026-07-18
99
+
100
+ ### Fixed
101
+ - **CLI ESM crash** — Replaced `require()` calls in the CLI entry point with ESM `import`/`readFileSync`/`existsSync` so `npx @duct-sdk/sdk --help` works from the published tarball (`"type": "module"`).
102
+ - **`.env` precedence** — `.env.local` now correctly overrides `.env` for the same key; shell/process environment still wins over both.
103
+
104
+ ## [0.5.4] — 2026-07-17
105
+
106
+ ### Added
107
+ - **Host panel close (loading)** — `DuctShell` renders a close control on the panel chrome until the iframe posts `DUCT_READY`, so users can dismiss the panel while the shell is still connecting. After the shell is live, close stays inside the embedded shell UI (`DUCT_CLOSE`).
108
+
109
+ ## [0.5.3] — 2026-07-17
110
+
111
+ ### Security
112
+ - **Consent callback scaffold (v2)** — `duct init` consent-callback routes receive `duct_consent_code` in the redirect (90s TTL) and exchange it server-to-server via `POST /v1/consent/redeem` with shell credentials. Long-lived consent tokens are never placed in browser URLs or query strings.
113
+
114
+ ### Changed
115
+ - Generated consent callback snippets (Next.js App Router + Express) updated for the authorization-code delivery flow; store redeemed tokens server-side for agent retrieval.
116
+
117
+ ## [0.5.2] — 2026-07-12
118
+
119
+ ### Added
120
+ - **`DUCT_TOKEN_PUSH`** — `DuctShell` pushes a fresh `onTokenRequest` token when the iframe is ready and whenever the panel opens, so host login reconnects the chat without a hard refresh.
121
+
122
+ ## [0.5.1] — 2026-07-09
123
+
124
+ ### Changed
125
+ - **`DuctShell`** — removed the host-panel close control. The embedded shell host renders the panel close and posts `DUCT_CLOSE`; the SDK still listens and collapses the panel.
126
+
127
+ Public release notes for the Duct SDK. Versioning follows [semver](https://semver.org).
128
+
129
+ ## [0.5.0] — 2026-07-08
130
+
131
+ ### Added
132
+ - `duct init` framework support: Nuxt, Vue 3, Express, and FastAPI / Python generators; Express + FastAPI detection.
133
+
134
+ ### Fixed
135
+ - Token-route generator emitted `return return …` (uncompilable) when `guestAllowed:false`; fixed across all frameworks.
136
+ - Unknown / unsupported stacks now hard-stop with guidance instead of writing Next.js files.
137
+
138
+
139
+ Public release notes for the Duct SDK. Versioning follows [semver](https://semver.org).
140
+
141
+ ## [0.4.7] — 2026-07-08
142
+
143
+ ### Added
144
+ - **`TOKEN_SPEC.md`** — language-agnostic token verification spec (prefixes, claims, TTLs, HS256 + Ed25519/JWKS paths) with Python, Go, and Ruby verify snippets.
145
+ - **`verifyReceipt()`** — pure crypto-layer outcome receipt verification in `@duct-sdk/sdk/server` (HMAC + optional Ed25519 JWKS/public keys).
146
+ - **Manifest privilege diff at push** — `duct push` fetches the live manifest, prints privilege-increasing deltas, and blocks unless `--yes`. `duct push --dry-run` prints the diff and exits without pushing.
147
+ - **Richer manifest policy schema** — `validFrom`/`validUntil`, `approveIf`, `actionLimit` (rate vs count), and `agentPermissions.consentActionScope` with Zod + cross-validation.
148
+
149
+ ### Fixed
150
+ - **`duct pull`** — restored `duct.config.ts` now imports `@duct-sdk/sdk` (was `@duct/sdk`).
151
+
152
+ ### Docs
153
+ - Deeplink receiver docs (README + generated receiver comments) document `jti` replay protection and `RedisReplayStore` for production.
154
+
155
+ ## [0.4.6] — 2026-07-08
156
+
157
+ ### Security
158
+ - **Deeplink replay protection** — `DeeplinkTokenPayload` now includes `jti`; `verifyDeeplinkToken` accepts an optional `replayStore` and ships `createDevReplayStore` / `RedisReplayStore`. Generated receivers wire the dev store; Remix/Express/SvelteKit templates now include replay logic.
159
+ - **`generateDuctToken` allowlist** — session fields are copied only from `auth.sessionFields` (denylist retained as secondary guard).
160
+ - **`duct push` safety gate** — runs `crossValidateDuctConfig` (hard-fail) and agent-safety checks; warnings require `--yes` to override in CI.
161
+ - **Config loading** — `duct.config.ts` is parsed as static data (no `process` in VM context); runtime references are rejected.
162
+ - **Embed hardening** — generated Vue/Nuxt shells validate `event.origin` and same-origin deeplink URLs; `useDuctPageContext` fails closed without `shellHost`.
163
+ - **Express consent middleware** — `ductOrConsentAuth` rejects unrecognized Bearer tokens instead of calling `next()`; verify snippets document `expectedShellId`.
164
+
165
+ ### Changed
166
+ - **`duct init`** — detects existing generated files and prompts to skip/overwrite instead of clobbering (`--yes` skips existing files).
167
+ - **`duct login`** — documents credential storage, warns that `--token` leaks to shell history, notes Windows NTFS ACL reliance.
168
+
169
+ ## [0.4.5] — 2026-07-05
170
+
171
+ ### Added
172
+ - **Consent callback route scaffold** — `duct init` with `duct-consent` mode now emits a consent callback route (`app/api/duct/callback/route.ts` for Next.js App Router, `routes/duct/callback.ts` for Express) that handles the `?user_consent_token=…&user_ref=…` redirect from Duct, with TODO markers for DB/queue storage.
173
+ - **`consentCallbackSnippet` / `consentCallbackSnippetPath`** on `WiringPlan`.
174
+ - `generateConsentCallbackSnippet(framework)` exported from `wiring-snippets.ts`.
175
+
176
+ ### Changed
177
+ - **`uct-consent-auth.ts` snippet updated** — `verifyUct` / `verifyConsentToken` now surface `user_ref` from `/v1/verify/consent-token`. Express version sets `req.ductUserRef`; Next.js/App Router version returns `{ userRef }` from `resolveAgentAwareUser`. Snippets no longer claim to return a generic `user` object.
178
+
179
+ ## [0.4.4] — 2026-07-04
180
+
181
+ ### Changed
182
+ - **`product.logoUrl`** — logo URL belongs under `product` in `duct.config.ts` (removed from `widget`). `duct init` auto-detects `public/logo.*` and resolves against `baseUrl`.
183
+
184
+ ## [0.4.3] — 2026-07-03
185
+
186
+ ### Fixed
187
+ - **`DuctShell` launcher icon when the shell host is unreachable** — bubble icon tries the host app's `/duct-text-no-bg.png` before the shell host URL; removed the nonexistent `duct-logo.png` candidate; final fallback is the `duↄt` wordmark instead of a broken orange SVG.
188
+
189
+ ## [0.4.2] — 2026-07-03
190
+
191
+ ### Fixed
192
+ - **`DuctShell` drag position after handoff** — panel drag position is now persisted in `localStorage` alongside the launcher bubble, so deeplink/sign-in navigations no longer reset a repositioned embed. Legacy `{ x, y }` bubble-only storage remains supported.
193
+
194
+ ## [0.4.1] — 2026-07-03
195
+
196
+ ### Added
197
+ - **`auth.loginRoutePath` and `auth.loginDeeplinkId`** — optional manifest fields that tell the shell where to send unauthenticated users before invoking `requiresAuth` actions.
198
+ - **`core/login-handoff.ts`** — `detectLoginRoutePath()`, `enrichAuthLoginHandoff()`, and `resolveLoginHandoff()` helpers shared with codegen.
199
+ - **`duct init` auto-wiring** — pipeline sets `loginRoutePath` (and `loginDeeplinkId` when a matching deeplink exists) from discovered routes.
200
+
201
+ ## [0.4.0] — 2026-07-02
202
+
203
+ ### Added
204
+ - **`duct init` wiring plan** — prints create/modify/verify steps before writing files; writes `.duct/snippets/verify-duct-token.ts` (and optional consent-auth snippet when third-party agents are enabled).
205
+ - **Post-init integration audit** — deterministic issues table after file write (token route, receiver, embed, env, deeplinks, middleware). Same audit runs in `duct checkup` when `duct.config.ts` exists.
206
+ - **Third-party agent prompt** — init asks whether partner agents need user-scoped access (`none` / Duct consent / company OAuth) and generates the matching middleware guidance.
207
+ - **Ground-truth verification** — routes and actions matched against the filesystem; hallucinated endpoints downgraded or dropped; evidence persisted as inline comments and schemas in generated config.
208
+ - **29 automated tests** — config normalization, token routes, wiring snippets, integration audit, verify-discovery, curl-parser.
209
+
210
+ ### Improved
211
+ - **Auth-aware token routes** — per-strategy session lookup (NextAuth, Clerk, Auth0, session-cookie, custom-jwt, Express, Remix, SvelteKit); returns 401 when `guestAllowed: false` and session is empty.
212
+ - **`duct init --api-spec`** — RouteAgent still runs in parallel so UI routes and deeplinks are discovered alongside OpenAPI actions.
213
+ - **Pre-write validation** — `validateDuctConfigStrict()` aborts init with an issues table on invalid config.
214
+ - **Relaxed `/api/` filter** — non-`/api/` action paths kept with a warning and confidence cap instead of dropped silently.
215
+ - **Webhook next-steps** — printed when side-effect actions are approved during review.
216
+ - **Ship checklist** — post-init next steps include middleware wiring path and `duct checkup`.
217
+
218
+ ### Fixed
219
+ - **`tokenEndpoint` Zod validation** — relative paths normalized to full URLs before codegen; invalid values omitted.
220
+ - **Intershell review answers** — `intershell_enabled` / `registry_visibility` from interactive review now reach the generated config.
221
+ - **`apiBaseUrl` + `logoUrl`** — emitted in generated `duct.config.ts` product/widget blocks.
222
+ - **Server imports** — all generated token/receiver routes import from `@duct-sdk/sdk/server`.
223
+ - **Docs URL in config header** — points at Duct docs instead of a fabricated `docs.<company-domain>` link.
224
+ - **Docs URL in every receiver file** — `generators/receiver.ts` (Next App/Pages, Remix, Express, SvelteKit) still hardcoded `docs.your-domain.com` after the config-file fix; all five now resolve via `getDocsUrl()` too.
225
+
226
+ ## [0.3.13] — 2026-07-02
227
+
228
+ ### Fixed
229
+ - **Deeplink receipt confirmation** — Remix, Vite, and SvelteKit receivers now call `/v1/deeplinks/:id/confirm` (fire-and-forget) when `DUCT_API_KEY` is set, matching the Next.js adapter. Extracted into shared `core/receiver.ts` so adapters cannot drift.
230
+ - **Claim validation** — all four receivers reject tokens missing `iss` or `sub` claims after verification.
231
+
232
+ ### Changed
233
+ - **Unified `onReceive` result** — `ReceiverResult` / `RemixReceiverResult` / `ViteReceiverResult` / `SvelteKitReceiverResult` now share the same shape (`redirectUrl`, `data`, `headers`). Next adapter applies `headers` on JSON responses.
234
+ - **`@duct-sdk/sdk/server`** — exports `buildDeeplinkRedirectUrl`, `buildDeeplinkSession`, `validateDeeplinkClaims`, `confirmDeeplinkReceipt`, and `DeeplinkReceiverResult`.
235
+
236
+ ## [0.3.11] — 2026-06-16
237
+
238
+ ### Fixed
239
+ - **Panel drag handle (light theme)** — grab bar uses a solid mid-gray with subtle shadow instead of 20% black, so it stays visible on light shell headers.
240
+
241
+ ## [0.3.10] — 2026-06-16
242
+
243
+ ### Improved
244
+ - **`duct init` shell generator** — `DuctShellEmbed` now passes `theme` from `duct.config.ts` → `widget.theme`; Svelte/Vue/Nuxt iframe URLs include `?theme=` so the hosted shell matches before push.
245
+
246
+ ## [0.3.9] — 2026-06-14
247
+
248
+ ### Added
249
+ - **`duct init --curl-collection`** — import actions from curl scripts or Postman Collection v2.1 JSON (deterministic, no LLM)
250
+ - **`core/auth-boundaries.ts`** — shared helpers for action-definition fingerprints and risk-tiered scope checks (aligned with Duct platform auth validation)
251
+
252
+ ### Improved
253
+ - **OpenAPI import** — `$ref` resolution for requestBody schemas; tag-based action ID derivation; collision suffixes; lower confidence when `operationId` is absent
254
+
255
+ ## [0.3.8] — 2026-06-11
256
+
257
+ ### Fixed
258
+ - **Smoother shell drag** — bubble and panel drags batch position updates to one React commit per animation frame, attach move listeners synchronously on pointer down, use pointer capture, and disable panel `transform` while dragging.
259
+
260
+ ## [0.3.7] — 2026-06-11
261
+
262
+ ### Added
263
+ - `@duct-sdk/sdk/server` exports `sendIntershellAction` and `sendIntershellQuery` — thin cross-shell client with consent retry (IS-29)
264
+
265
+ ## [0.3.6] — 2026-06-10
266
+
267
+ ### Fixed
268
+ - **Launcher drag UX** — closed bubble drags from the icon itself (4px threshold); no grab cursor or extra handle on hover. Tap still opens.
269
+ - **Panel drag handle** — grab bar only renders while the panel is open; themed “Drag to move” tooltip replaces the native browser title.
270
+
271
+ ## [0.3.5] — 2026-06-10
272
+
273
+ ### Fixed
274
+ - **Explicit drag handles** — `DuctShell` launcher and open panel no longer treat the whole chrome as a drag target. A small grab handle is the only drag surface; the bubble uses a normal click to open and the panel header stays fully interactive.
275
+
276
+ ## [0.3.4] — 2026-06-10
277
+
278
+ ### Fixed
279
+ - **`duct push` schema validation** — validates the loaded manifest against `DuctConfigSchema` before upload. Catches missing `product.baseUrl` and other required fields instead of pushing a broken manifest that fails at action-invoke time.
280
+
281
+ ### Changed
282
+ - **Manual mode template** — `duct init --manual` product block now documents optional `apiBaseUrl` (action proxy target; defaults to `baseUrl`).
283
+
284
+ ## [0.3.3] — 2026-06-09
285
+
286
+ ### Fixed
287
+ - **Stable iframe `src`** — `userContext` is no longer embedded in the shell iframe URL; context is delivered via `DUCT_READY` postMessage instead. Prevents full iframe reloads when the host page navigates after a deeplink handoff.
288
+
289
+ ## [0.3.2] — 2026-06-09
290
+
291
+ ### Added
292
+ - **`@duct-sdk/sdk/server` subpath** — backend-safe entry point with token helpers (`generateDuctToken`, `verifyDuctToken`, `verifyDeeplinkToken`), config, and introspect handlers. No React dependency. Safe in Express, Fastify, Next.js API routes, Remix loaders, SvelteKit hooks, and any Node.js/Edge runtime. The root `@duct-sdk/sdk` export pulls React adapters and **crashes** plain Node backends where React is not installed; use `/server` for all backend code.
293
+
294
+ ### Fixed
295
+ - **Panel re-anchors to bubble after drag** — dragging the bubble to a new screen position now clears the previous panel position, so opening the shell always places the panel near the bubble's current location rather than the old dragged spot.
296
+ - **Token retry after mid-session login** — if the first token request returned empty (user not yet logged in), each subsequent message now retries the token fetch instead of silently staying unauthenticated for the life of the session.
297
+ - **Sticky "Working on it…" spinner** — the router progress indicator is now cleared when any terminal event arrives (`text_done`, `error`, deeplink, generative UI, clarification). Previously the spinner persisted alongside the final answer.
298
+ - **Hydration mismatch on shell embed** — messages and session ID are now loaded from `localStorage` in `useEffect` (post-hydration) instead of during initial `useState`, eliminating the React SSR/client HTML mismatch error in the shell iframe.
299
+ - **`+New` button unclickable** — the panel drag overlay was covering the full header including the `+New` and close buttons. The overlay now ends before the header action cluster so buttons are always clickable.
300
+
301
+ ## [0.3.1] — 2026-06-09
302
+
303
+ ### Added
304
+ - Draggable open panel with viewport clamping — panel stays on-screen after free-drag via top handle
305
+
306
+ ### Fixed
307
+ - Panel position clamped to viewport bounds on drag end
308
+
309
+ ## [0.3.0] — 2026-06-09
310
+
311
+ ### Added
312
+ - **Shell size presets** — `widget.preset` and the `<DuctShell preset>` prop accept `'tall'` (vertical rectangle, default), `'square'` (Copilot-style), or `'large'`. Dimensions resolve from a single source of truth (`SHELL_PRESET_DIMENSIONS`, `resolveShellDimensions()`), replacing ad-hoc `width`/`height` guessing. Raw `width`/`height` still work as an override.
313
+ - **Draggable launcher and panel** — the floating bubble can be dragged anywhere on the page (free drop, persisted per shell), and the opened panel can also be moved via its top handle. `position` now only sets the starting corner. Disable with `draggable={false}`.
314
+ - **Theme-aware bubble** — new `<DuctShell theme>` prop (`'light' | 'dark' | 'system'`, default `'system'`); the launcher chrome adapts to light/dark instead of a hardcoded dark circle.
315
+ - `DUCT_PANEL_SIZE` postMessage now carries `preset`, so a shell's manifest can drive panel sizing on the host.
316
+
317
+ ### Changed
318
+ - Launcher logo now uses the Duct word-mark (`duct-text-no-bg.png`) with the previous `duct-logo.png` kept as a fallback candidate.
319
+ - Generated framework embeds (`duct init` for Next/Remix/Vite) now emit `preset` + `position` and drop the fixed `width`/`height` style override.
320
+ - The Next.js adapter (`@duct-sdk/sdk/next`) now re-exports the React implementation to prevent the two adapters from drifting.
321
+ - `WidgetConfig` Zod schema widened to validate `preset`, `theme`, `placeholder`, `width`, `height`, `logoUrl`, and `customCSS` (previously stripped on `duct push`).
322
+
323
+ ## [0.2.3] — 2026-06-08
324
+
325
+ ### Added
326
+ - `widget.maxToolIterations` and `widget.maxPlanSteps` on `DuctConfig` — configurable agent loop ceilings (defaults 12 / 8).
327
+ - `core/limits.ts` — exported default and hard-ceiling constants for manifest tooling.
328
+ - `duct init --api-spec <path>` now works end-to-end without requiring an LLM.
329
+ A new deterministic OpenAPI parser (`cli/processors/openapi-parser.ts`) maps
330
+ every path + method in an OpenAPI 3.x or Swagger 2.x spec directly to
331
+ `ActionManifest[]` and `RouteManifest[]`:
332
+ - GET operations → `agentAccessible: false` by default (interactive review applies)
333
+ - POST/PUT/PATCH/DELETE → `sideEffects: true`
334
+ - Operations with `operationId` → `confidence: 1.0`; without → `confidence: 0.95`
335
+ - Sensitivity inferred from path + description keywords
336
+ - `x-duct-sensitivity` extension accepted for manual override
337
+ - Internal Duct / NextAuth routes excluded automatically
338
+ - Path + query parameters extracted; `inputSchema` populated from `requestBody`
339
+ - YAML spec support (`.yaml` / `.yml`) via the new `yaml` dependency (v2.x, zero deps).
340
+
341
+ ### Fixed
342
+ - **SDK embed security:** React and Next.js `DuctShell` adapters now validate `event.source === iframe.contentWindow` and reject deeplink URLs that are not same-origin or relative paths.
343
+ - **`pipeline.ts` spec-mode bug:** when `--api-spec` was provided the API agent was
344
+ incorrectly added to the skip list, returning zero actions. The deterministic parser
345
+ now runs directly in the pipeline; the Auth agent still runs in parallel to detect
346
+ auth patterns from project source files.
347
+ - **`pipeline.ts`:** `skipAgents` scope bug — deeplink/review skip flags now work in spec-mode as well as normal mode.
348
+ - **`openapi-parser.ts`:** removed unused parameter.
349
+
350
+ ### Changed
351
+ - `pipeline.ts`: spec-mode and normal-mode are now separate branches in Stage 1.
352
+ Both paths feed the same Deeplink + Reviewer agents in Stage 2 and Stage 3.
353
+
354
+ ## [0.2.2] — 2026-06-07
355
+
356
+ ### Changed
357
+ - `RouteManifest.searchAction` docs updated — runtime now invokes the declared action in-shell for data queries instead of deeplink navigation
358
+ - `dataModel` field docs clarified; entity-resolution runtime wiring tracked separately
359
+
360
+ ## [0.2.1] — 2026-06-06
361
+
362
+ ### Changed
363
+ - Smaller published package (removed unused bundled image asset)
364
+
365
+ ## [0.2.0] — 2026-06-06
366
+
367
+ ### Added
368
+ - `duct init --manual` — commented `duct.config.ts` template without LLM
369
+ - `duct init --update` — re-scan only files changed since last push
370
+ - `duct promote --from <id> --to <id>` — copy manifest between environment shells
371
+ - Interactive init review with confidence scores for detected routes and actions
372
+
373
+ ### Changed
374
+ - `allowedCallers` is canonical; legacy `allowedAgents` removed from config types
375
+ - Generated configs and examples use environment-configurable base URLs
376
+
377
+ ## [0.1.13] — 2026-06-05
378
+
379
+ ### Fixed
380
+ - More stable generator output for empty manifests
381
+
382
+ ## [0.1.0] — 2026-03-15
383
+
384
+ ### Added
385
+ - Initial publish: `login`, `init`, `push`, `pull`, framework adapters (Next, Remix, Vite, SvelteKit, React)