@duct-sdk/sdk 0.6.0 → 0.7.1

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.
package/CHANGELOG.md CHANGED
@@ -1,385 +1,413 @@
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)
1
+ # Changelog — @duct-sdk/sdk
2
+
3
+ ## [0.7.1] — 2026-11-24
4
+
5
+ ### Fixed
6
+ - **`duct setup` uses your API's own description** (OpenAPI `info.description`, first paragraph that is not a heading, plain text, at most 300 characters) for `product.description`, instead of "<name> — connected to Duct". The assistant answers "what can you help me with?" from it.
7
+
8
+ ### Added
9
+ - **`upstreamProtection` in `duct/project.json`** (default on): learned per-endpoint timeouts, a duplicate request for slow read-only GETs, and a short pause when your API keeps failing. Set `false` for one request with a fixed 30 s timeout.
10
+
11
+ ## [0.7.0] — 2026-11-23
12
+
13
+ ### Added
14
+ - **`duct push` replays recent real calls against the new version** and prints what would change ("get_order by agent "Support bot": allowed → stopped (40 calls)"). A push that would stop calls that work today stops for `--yes`, like a privilege increase.
15
+ - **`duct push` names actions that may be confused** with each other when routing, measured from the shell's example requests when available. Informational; never blocks.
16
+
17
+ ### Changed
18
+ - `duct setup` no longer generates a consent-callback route, and the setup MCP no longer offers `consent_callback`: Duct keeps a person's approval of an agent, so companies have nothing to receive or exchange. The generated consent-token middleware is unchanged.
19
+
20
+ ### Added
21
+ - `policy.agents.consentHours` `{ low, medium, high }`: how many hours a person's approval of an agent lasts, by the most sensitive action it covers (defaults 24, 8 and 1; at most 168). Compiles to `agentPermissions.consentGrantHours`.
22
+
23
+ ## [0.6.1] — 2026-11-23
24
+
25
+ ### Security
26
+ - Transitive dependency fixes within the declared ranges.
27
+
28
+ ### Fixed
29
+ - **Receipt IDs documented correctly** — the README and `TOKEN_SPEC.md` said outcome receipt IDs start with `rcpt_`. They are the first 32 hex characters of the SHA-256 of the receipt body, with no prefix, which is what `verifyReceipt()` already checks.
30
+
31
+ ## [0.6.0] — 2026-11-20
32
+
33
+ ### Added
34
+ - **`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`.
35
+ - **`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.
36
+ - **`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.
37
+ - **MCP `duct_create_shell`** — previews, then creates only with `confirm: true`; returns the shell ID and the file path, never the secret.
38
+ - **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`.
39
+ - **`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.
40
+ - **`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`.
41
+ - **`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).
42
+ - **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.
43
+ - **`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.
44
+ - **`duct sync`** refreshes `capabilities.json` from its recorded source and keeps reviewed fields (name, description, sensitivity, side-effect classification + ack).
45
+ - **`duct split`** migrates `duct.config.ts` → `duct/`; files are written only after recompiling to identical enforcement for every action.
46
+ - **`duct add identity | shell`** — optional layers (token route, receiver, middleware snippet with auth + login-page detection; chat shell component + `duct/shell.ts`).
47
+ - **`duct prompt`** — instructions for the developer's coding agent to fill `capabilities.json` when there is no OpenAPI spec.
48
+ - **Tests** in `packages/sdk/tests/` (compiler, split equivalence, static loader safety, discovery, sync merge, CLI end-to-end against a fake Duct cloud).
49
+
50
+ ### Changed
51
+ - **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.
52
+ - README and the identity audit hint point to `npx @duct-sdk/sdk mcp` / `add identity` instead of the retired integration prompt page.
53
+ - **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`.
54
+ - **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."
55
+ - **`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.
56
+ - CLI hints use `npx @duct-sdk/sdk` everywhere (`npx duct` resolves to a different package).
57
+
58
+ ### Removed
59
+ - Unused internal modules `core/auth-boundaries.ts` and `core/limits.ts` (never exported).
60
+ - **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.
61
+
62
+ ### Fixed
63
+ - The npm package no longer ships compiled test files (`dist/**/*.test.*`): 216 → 166 files.
64
+ - **`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.
65
+ - **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.
66
+ - **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.
67
+ - **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.
68
+ - 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`.
69
+ - **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`.
70
+ - Static config loader no longer rejects configs whose **string values** contain words like "process" or "fetch".
71
+
72
+ ## [0.5.13] — 2026-07-26
73
+
74
+ ### Added
75
+ - **Manifest `approval.stepUp` and `operatorNotifications`** schema defaults.
76
+ - **Token conformance vectors** (`fixtures/token-conformance-vectors.json`) and drift test.
77
+ - **`duct checkup` hosted-private upstream** detection for local `apiBaseUrl` against hosted profiles.
78
+ - **Root export guard** — `DuctSdkWrongEntrypointError` when React is not installed.
79
+
80
+ ## [0.5.12] — 2026-07-25
81
+
82
+ ### Added
83
+ - **`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.
84
+
85
+ ## [0.5.11] — 2026-07-22
86
+
87
+ ### Added
88
+ - **`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.
89
+
90
+ ## [0.5.10] — 2026-07-19
91
+
92
+ ### Added
93
+ - **`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`.
94
+ - **Intershell manifest validation** — `agentPermissions.allowedCallees` schema; `crossValidateDuctConfig` requires `webhooks.identityUrl` when `intershell_enabled` and protected actions coexist.
95
+
96
+ ### Improved
97
+ - **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.
98
+
99
+ ### Changed
100
+ - **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.
101
+ - **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.
102
+
103
+ ## [0.5.9] — 2026-07-18
104
+
105
+ ### Added
106
+ - **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`.
107
+ - **Profile resolution tests** — `profile.test.ts` covers file load, env precedence, and protected shell keys.
108
+ - **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.
109
+
110
+ ## [0.5.8] — 2026-07-18
111
+
112
+ ### Added
113
+ - **CLI diagnostics** — `duct whoami`, `duct logout`, and `duct env --redact` for account and endpoint inspection with secret redaction.
114
+ - **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`.
115
+
116
+ ## [0.5.7] — 2026-07-18
117
+
118
+ ### Added
119
+ - **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.
120
+
121
+ ## [0.5.6] — 2026-07-18
122
+
123
+ ### Fixed
124
+ - **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`).
125
+
126
+ ## [0.5.5] — 2026-07-18
127
+
128
+ ### Fixed
129
+ - **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"`).
130
+ - **`.env` precedence** — `.env.local` now correctly overrides `.env` for the same key; shell/process environment still wins over both.
131
+
132
+ ## [0.5.4] — 2026-07-17
133
+
134
+ ### Added
135
+ - **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`).
136
+
137
+ ## [0.5.3] — 2026-07-17
138
+
139
+ ### Security
140
+ - **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.
141
+
142
+ ### Changed
143
+ - Generated consent callback snippets (Next.js App Router + Express) updated for the authorization-code delivery flow; store redeemed tokens server-side for agent retrieval.
144
+
145
+ ## [0.5.2] — 2026-07-12
146
+
147
+ ### Added
148
+ - **`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.
149
+
150
+ ## [0.5.1] — 2026-07-09
151
+
152
+ ### Changed
153
+ - **`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.
154
+
155
+ Public release notes for the Duct SDK. Versioning follows [semver](https://semver.org).
156
+
157
+ ## [0.5.0] — 2026-07-08
158
+
159
+ ### Added
160
+ - `duct init` framework support: Nuxt, Vue 3, Express, and FastAPI / Python generators; Express + FastAPI detection.
161
+
162
+ ### Fixed
163
+ - Token-route generator emitted `return return …` (uncompilable) when `guestAllowed:false`; fixed across all frameworks.
164
+ - Unknown / unsupported stacks now hard-stop with guidance instead of writing Next.js files.
165
+
166
+
167
+ Public release notes for the Duct SDK. Versioning follows [semver](https://semver.org).
168
+
169
+ ## [0.4.7] — 2026-07-08
170
+
171
+ ### Added
172
+ - **`TOKEN_SPEC.md`** — language-agnostic token verification spec (prefixes, claims, TTLs, HS256 + Ed25519/JWKS paths) with Python, Go, and Ruby verify snippets.
173
+ - **`verifyReceipt()`** — pure crypto-layer outcome receipt verification in `@duct-sdk/sdk/server` (HMAC + optional Ed25519 JWKS/public keys).
174
+ - **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.
175
+ - **Richer manifest policy schema** — `validFrom`/`validUntil`, `approveIf`, `actionLimit` (rate vs count), and `agentPermissions.consentActionScope` with Zod + cross-validation.
176
+
177
+ ### Fixed
178
+ - **`duct pull`** — restored `duct.config.ts` now imports `@duct-sdk/sdk` (was `@duct/sdk`).
179
+
180
+ ### Docs
181
+ - Deeplink receiver docs (README + generated receiver comments) document `jti` replay protection and `RedisReplayStore` for production.
182
+
183
+ ## [0.4.6] — 2026-07-08
184
+
185
+ ### Security
186
+ - **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.
187
+ - **`generateDuctToken` allowlist** — session fields are copied only from `auth.sessionFields` (denylist retained as secondary guard).
188
+ - **`duct push` safety gate** — runs `crossValidateDuctConfig` (hard-fail) and agent-safety checks; warnings require `--yes` to override in CI.
189
+ - **Config loading** — `duct.config.ts` is parsed as static data (no `process` in VM context); runtime references are rejected.
190
+ - **Embed hardening** — generated Vue/Nuxt shells validate `event.origin` and same-origin deeplink URLs; `useDuctPageContext` fails closed without `shellHost`.
191
+ - **Express consent middleware** — `ductOrConsentAuth` rejects unrecognized Bearer tokens instead of calling `next()`; verify snippets document `expectedShellId`.
192
+
193
+ ### Changed
194
+ - **`duct init`** — detects existing generated files and prompts to skip/overwrite instead of clobbering (`--yes` skips existing files).
195
+ - **`duct login`** — documents credential storage, warns that `--token` leaks to shell history, notes Windows NTFS ACL reliance.
196
+
197
+ ## [0.4.5] — 2026-07-05
198
+
199
+ ### Added
200
+ - **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.
201
+ - **`consentCallbackSnippet` / `consentCallbackSnippetPath`** on `WiringPlan`.
202
+ - `generateConsentCallbackSnippet(framework)` exported from `wiring-snippets.ts`.
203
+
204
+ ### Changed
205
+ - **`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.
206
+
207
+ ## [0.4.4] — 2026-07-04
208
+
209
+ ### Changed
210
+ - **`product.logoUrl`** — logo URL belongs under `product` in `duct.config.ts` (removed from `widget`). `duct init` auto-detects `public/logo.*` and resolves against `baseUrl`.
211
+
212
+ ## [0.4.3] — 2026-07-03
213
+
214
+ ### Fixed
215
+ - **`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.
216
+
217
+ ## [0.4.2] — 2026-07-03
218
+
219
+ ### Fixed
220
+ - **`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.
221
+
222
+ ## [0.4.1] — 2026-07-03
223
+
224
+ ### Added
225
+ - **`auth.loginRoutePath` and `auth.loginDeeplinkId`** — optional manifest fields that tell the shell where to send unauthenticated users before invoking `requiresAuth` actions.
226
+ - **`core/login-handoff.ts`** — `detectLoginRoutePath()`, `enrichAuthLoginHandoff()`, and `resolveLoginHandoff()` helpers shared with codegen.
227
+ - **`duct init` auto-wiring** — pipeline sets `loginRoutePath` (and `loginDeeplinkId` when a matching deeplink exists) from discovered routes.
228
+
229
+ ## [0.4.0] — 2026-07-02
230
+
231
+ ### Added
232
+ - **`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).
233
+ - **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.
234
+ - **Third-party agent prompt** — init asks whether partner agents need user-scoped access (`none` / Duct consent / company OAuth) and generates the matching middleware guidance.
235
+ - **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.
236
+ - **29 automated tests** — config normalization, token routes, wiring snippets, integration audit, verify-discovery, curl-parser.
237
+
238
+ ### Improved
239
+ - **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.
240
+ - **`duct init --api-spec`** — RouteAgent still runs in parallel so UI routes and deeplinks are discovered alongside OpenAPI actions.
241
+ - **Pre-write validation** — `validateDuctConfigStrict()` aborts init with an issues table on invalid config.
242
+ - **Relaxed `/api/` filter** — non-`/api/` action paths kept with a warning and confidence cap instead of dropped silently.
243
+ - **Webhook next-steps** — printed when side-effect actions are approved during review.
244
+ - **Ship checklist** — post-init next steps include middleware wiring path and `duct checkup`.
245
+
246
+ ### Fixed
247
+ - **`tokenEndpoint` Zod validation** — relative paths normalized to full URLs before codegen; invalid values omitted.
248
+ - **Intershell review answers** — `intershell_enabled` / `registry_visibility` from interactive review now reach the generated config.
249
+ - **`apiBaseUrl` + `logoUrl`** — emitted in generated `duct.config.ts` product/widget blocks.
250
+ - **Server imports** — all generated token/receiver routes import from `@duct-sdk/sdk/server`.
251
+ - **Docs URL in config header** — points at Duct docs instead of a fabricated `docs.<company-domain>` link.
252
+ - **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.
253
+
254
+ ## [0.3.13] — 2026-07-02
255
+
256
+ ### Fixed
257
+ - **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.
258
+ - **Claim validation** — all four receivers reject tokens missing `iss` or `sub` claims after verification.
259
+
260
+ ### Changed
261
+ - **Unified `onReceive` result** — `ReceiverResult` / `RemixReceiverResult` / `ViteReceiverResult` / `SvelteKitReceiverResult` now share the same shape (`redirectUrl`, `data`, `headers`). Next adapter applies `headers` on JSON responses.
262
+ - **`@duct-sdk/sdk/server`** — exports `buildDeeplinkRedirectUrl`, `buildDeeplinkSession`, `validateDeeplinkClaims`, `confirmDeeplinkReceipt`, and `DeeplinkReceiverResult`.
263
+
264
+ ## [0.3.11] — 2026-06-16
265
+
266
+ ### Fixed
267
+ - **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.
268
+
269
+ ## [0.3.10] — 2026-06-16
270
+
271
+ ### Improved
272
+ - **`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.
273
+
274
+ ## [0.3.9] — 2026-06-14
275
+
276
+ ### Added
277
+ - **`duct init --curl-collection`** — import actions from curl scripts or Postman Collection v2.1 JSON (deterministic, no LLM)
278
+ - **`core/auth-boundaries.ts`** — shared helpers for action-definition fingerprints and risk-tiered scope checks (aligned with Duct platform auth validation)
279
+
280
+ ### Improved
281
+ - **OpenAPI import** — `$ref` resolution for requestBody schemas; tag-based action ID derivation; collision suffixes; lower confidence when `operationId` is absent
282
+
283
+ ## [0.3.8] — 2026-06-11
284
+
285
+ ### Fixed
286
+ - **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.
287
+
288
+ ## [0.3.7] — 2026-06-11
289
+
290
+ ### Added
291
+ - `@duct-sdk/sdk/server` exports `sendIntershellAction` and `sendIntershellQuery` — thin cross-shell client with consent retry (IS-29)
292
+
293
+ ## [0.3.6] — 2026-06-10
294
+
295
+ ### Fixed
296
+ - **Launcher drag UX** — closed bubble drags from the icon itself (4px threshold); no grab cursor or extra handle on hover. Tap still opens.
297
+ - **Panel drag handle** — grab bar only renders while the panel is open; themed “Drag to move” tooltip replaces the native browser title.
298
+
299
+ ## [0.3.5] — 2026-06-10
300
+
301
+ ### Fixed
302
+ - **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.
303
+
304
+ ## [0.3.4] — 2026-06-10
305
+
306
+ ### Fixed
307
+ - **`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.
308
+
309
+ ### Changed
310
+ - **Manual mode template** — `duct init --manual` product block now documents optional `apiBaseUrl` (action proxy target; defaults to `baseUrl`).
311
+
312
+ ## [0.3.3] — 2026-06-09
313
+
314
+ ### Fixed
315
+ - **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.
316
+
317
+ ## [0.3.2] — 2026-06-09
318
+
319
+ ### Added
320
+ - **`@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.
321
+
322
+ ### Fixed
323
+ - **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.
324
+ - **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.
325
+ - **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.
326
+ - **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.
327
+ - **`+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.
328
+
329
+ ## [0.3.1] — 2026-06-09
330
+
331
+ ### Added
332
+ - Draggable open panel with viewport clamping — panel stays on-screen after free-drag via top handle
333
+
334
+ ### Fixed
335
+ - Panel position clamped to viewport bounds on drag end
336
+
337
+ ## [0.3.0] — 2026-06-09
338
+
339
+ ### Added
340
+ - **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.
341
+ - **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}`.
342
+ - **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.
343
+ - `DUCT_PANEL_SIZE` postMessage now carries `preset`, so a shell's manifest can drive panel sizing on the host.
344
+
345
+ ### Changed
346
+ - Launcher logo now uses the Duct word-mark (`duct-text-no-bg.png`) with the previous `duct-logo.png` kept as a fallback candidate.
347
+ - Generated framework embeds (`duct init` for Next/Remix/Vite) now emit `preset` + `position` and drop the fixed `width`/`height` style override.
348
+ - The Next.js adapter (`@duct-sdk/sdk/next`) now re-exports the React implementation to prevent the two adapters from drifting.
349
+ - `WidgetConfig` Zod schema widened to validate `preset`, `theme`, `placeholder`, `width`, `height`, `logoUrl`, and `customCSS` (previously stripped on `duct push`).
350
+
351
+ ## [0.2.3] — 2026-06-08
352
+
353
+ ### Added
354
+ - `widget.maxToolIterations` and `widget.maxPlanSteps` on `DuctConfig` — configurable agent loop ceilings (defaults 12 / 8).
355
+ - `core/limits.ts` — exported default and hard-ceiling constants for manifest tooling.
356
+ - `duct init --api-spec <path>` now works end-to-end without requiring an LLM.
357
+ A new deterministic OpenAPI parser (`cli/processors/openapi-parser.ts`) maps
358
+ every path + method in an OpenAPI 3.x or Swagger 2.x spec directly to
359
+ `ActionManifest[]` and `RouteManifest[]`:
360
+ - GET operations → `agentAccessible: false` by default (interactive review applies)
361
+ - POST/PUT/PATCH/DELETE → `sideEffects: true`
362
+ - Operations with `operationId` → `confidence: 1.0`; without → `confidence: 0.95`
363
+ - Sensitivity inferred from path + description keywords
364
+ - `x-duct-sensitivity` extension accepted for manual override
365
+ - Internal Duct / NextAuth routes excluded automatically
366
+ - Path + query parameters extracted; `inputSchema` populated from `requestBody`
367
+ - YAML spec support (`.yaml` / `.yml`) via the new `yaml` dependency (v2.x, zero deps).
368
+
369
+ ### Fixed
370
+ - **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.
371
+ - **`pipeline.ts` spec-mode bug:** when `--api-spec` was provided the API agent was
372
+ incorrectly added to the skip list, returning zero actions. The deterministic parser
373
+ now runs directly in the pipeline; the Auth agent still runs in parallel to detect
374
+ auth patterns from project source files.
375
+ - **`pipeline.ts`:** `skipAgents` scope bug — deeplink/review skip flags now work in spec-mode as well as normal mode.
376
+ - **`openapi-parser.ts`:** removed unused parameter.
377
+
378
+ ### Changed
379
+ - `pipeline.ts`: spec-mode and normal-mode are now separate branches in Stage 1.
380
+ Both paths feed the same Deeplink + Reviewer agents in Stage 2 and Stage 3.
381
+
382
+ ## [0.2.2] — 2026-06-07
383
+
384
+ ### Changed
385
+ - `RouteManifest.searchAction` docs updated — runtime now invokes the declared action in-shell for data queries instead of deeplink navigation
386
+ - `dataModel` field docs clarified; entity-resolution runtime wiring tracked separately
387
+
388
+ ## [0.2.1] — 2026-06-06
389
+
390
+ ### Changed
391
+ - Smaller published package (removed unused bundled image asset)
392
+
393
+ ## [0.2.0] — 2026-06-06
394
+
395
+ ### Added
396
+ - `duct init --manual` — commented `duct.config.ts` template without LLM
397
+ - `duct init --update` — re-scan only files changed since last push
398
+ - `duct promote --from <id> --to <id>` — copy manifest between environment shells
399
+ - Interactive init review with confidence scores for detected routes and actions
400
+
401
+ ### Changed
402
+ - `allowedCallers` is canonical; legacy `allowedAgents` removed from config types
403
+ - Generated configs and examples use environment-configurable base URLs
404
+
405
+ ## [0.1.13] — 2026-06-05
406
+
407
+ ### Fixed
408
+ - More stable generator output for empty manifests
409
+
410
+ ## [0.1.0] — 2026-03-15
411
+
412
+ ### Added
413
+ - Initial publish: `login`, `init`, `push`, `pull`, framework adapters (Next, Remix, Vite, SvelteKit, React)