@duct-sdk/sdk 0.5.13 → 0.7.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.
- package/CHANGELOG.md +61 -0
- package/README.md +418 -264
- package/TOKEN_SPEC.md +243 -243
- package/dist/cli/action-confusion-format.d.ts +17 -0
- package/dist/cli/action-confusion-format.js +24 -0
- package/dist/cli/add.d.ts +7 -0
- package/dist/cli/add.js +152 -0
- package/dist/cli/agent-prompt.d.ts +3 -0
- package/dist/cli/agent-prompt.js +39 -0
- package/dist/cli/api-sources.d.ts +26 -0
- package/dist/cli/api-sources.js +222 -0
- package/dist/cli/cloud.d.ts +162 -0
- package/dist/cli/cloud.js +306 -0
- package/dist/cli/config-loader.d.ts +14 -0
- package/dist/cli/config-loader.js +56 -7
- package/dist/cli/device-login.d.ts +17 -0
- package/dist/cli/device-login.js +75 -0
- package/dist/cli/drift.js +6 -6
- package/dist/cli/generators/any-stack.d.ts +3 -0
- package/dist/cli/generators/any-stack.js +97 -0
- package/dist/cli/generators/config.js +3 -2
- package/dist/cli/generators/receiver.js +7 -7
- package/dist/cli/generators/shell.js +12 -12
- package/dist/cli/generators/token-route.js +245 -245
- package/dist/cli/generators/wiring-snippets.d.ts +0 -14
- package/dist/cli/generators/wiring-snippets.js +188 -305
- package/dist/cli/index.js +396 -611
- package/dist/cli/mcp-core.d.ts +42 -0
- package/dist/cli/mcp-core.js +161 -0
- package/dist/cli/mcp-setup.d.ts +4 -0
- package/dist/cli/mcp-setup.js +352 -0
- package/dist/cli/mcp.d.ts +2 -0
- package/dist/cli/mcp.js +457 -0
- package/dist/cli/migrate-intershell.js +5 -5
- package/dist/cli/policy-defaults.d.ts +37 -0
- package/dist/cli/policy-defaults.js +127 -0
- package/dist/cli/policy-replay-format.d.ts +9 -0
- package/dist/cli/policy-replay-format.js +46 -0
- package/dist/cli/processors/integration-audit.js +2 -2
- package/dist/cli/processors/openapi-parser.d.ts +5 -0
- package/dist/cli/processors/openapi-parser.js +8 -3
- package/dist/cli/project-loader.d.ts +58 -0
- package/dist/cli/project-loader.js +198 -0
- package/dist/cli/project-writer.d.ts +23 -0
- package/dist/cli/project-writer.js +171 -0
- package/dist/cli/push.d.ts +43 -0
- package/dist/cli/push.js +308 -0
- package/dist/cli/safety-checks.d.ts +9 -0
- package/dist/cli/safety-checks.js +29 -0
- package/dist/cli/setup.d.ts +20 -0
- package/dist/cli/setup.js +349 -0
- package/dist/cli/shell-name.d.ts +8 -0
- package/dist/cli/shell-name.js +29 -0
- package/dist/cli/shells.d.ts +22 -0
- package/dist/cli/shells.js +122 -0
- package/dist/cli/split.d.ts +7 -0
- package/dist/cli/split.js +71 -0
- package/dist/cli/sync.d.ts +25 -0
- package/dist/cli/sync.js +120 -0
- package/dist/cli/test-runner.d.ts +21 -0
- package/dist/cli/test-runner.js +281 -0
- package/dist/core/compile.d.ts +43 -0
- package/dist/core/compile.js +512 -0
- package/dist/core/config.d.ts +538 -19
- package/dist/core/config.js +22 -14
- package/dist/core/login-handoff.d.ts +1 -1
- package/dist/core/login-handoff.js +1 -1
- package/dist/core/project.d.ts +1864 -0
- package/dist/core/project.js +291 -0
- package/dist/core/readiness-checks.js +2 -2
- package/dist/core/types.d.ts +10 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/project.d.ts +4 -0
- package/dist/project.js +8 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +1 -0
- package/package.json +94 -95
- package/dist/adapters/react/page-context-guard.test.d.ts +0 -1
- package/dist/adapters/react/page-context-guard.test.js +0 -15
- package/dist/cli/agents/api-agent.d.ts +0 -22
- package/dist/cli/agents/api-agent.js +0 -761
- package/dist/cli/agents/auth-agent.d.ts +0 -7
- package/dist/cli/agents/auth-agent.js +0 -212
- package/dist/cli/agents/deeplink-agent.d.ts +0 -6
- package/dist/cli/agents/deeplink-agent.js +0 -285
- package/dist/cli/agents/llm.d.ts +0 -33
- package/dist/cli/agents/llm.js +0 -309
- package/dist/cli/agents/pipeline.d.ts +0 -72
- package/dist/cli/agents/pipeline.js +0 -421
- package/dist/cli/agents/reviewer-agent.d.ts +0 -13
- package/dist/cli/agents/reviewer-agent.js +0 -450
- package/dist/cli/agents/route-agent.d.ts +0 -17
- package/dist/cli/agents/route-agent.js +0 -383
- package/dist/cli/config-loader.test.d.ts +0 -1
- package/dist/cli/config-loader.test.js +0 -63
- package/dist/cli/detectors/topology.d.ts +0 -46
- package/dist/cli/detectors/topology.js +0 -417
- package/dist/cli/generators/config.test.d.ts +0 -1
- package/dist/cli/generators/config.test.js +0 -222
- package/dist/cli/generators/shell.test.d.ts +0 -1
- package/dist/cli/generators/shell.test.js +0 -73
- package/dist/cli/generators/token-route.test.d.ts +0 -1
- package/dist/cli/generators/token-route.test.js +0 -53
- package/dist/cli/generators/wiring-snippets.test.d.ts +0 -1
- package/dist/cli/generators/wiring-snippets.test.js +0 -80
- package/dist/cli/init.d.ts +0 -32
- package/dist/cli/init.js +0 -1336
- package/dist/cli/manifest-diff.test.d.ts +0 -1
- package/dist/cli/manifest-diff.test.js +0 -144
- package/dist/cli/processors/curl-parser.test.d.ts +0 -1
- package/dist/cli/processors/curl-parser.test.js +0 -24
- package/dist/cli/processors/integration-audit.test.d.ts +0 -1
- package/dist/cli/processors/integration-audit.test.js +0 -154
- package/dist/cli/processors/postprocess.d.ts +0 -22
- package/dist/cli/processors/postprocess.js +0 -107
- package/dist/cli/processors/prisma-parser.d.ts +0 -35
- package/dist/cli/processors/prisma-parser.js +0 -117
- package/dist/cli/processors/verify-discovery.d.ts +0 -33
- package/dist/cli/processors/verify-discovery.js +0 -193
- package/dist/cli/processors/verify-discovery.test.d.ts +0 -1
- package/dist/cli/processors/verify-discovery.test.js +0 -153
- package/dist/cli/processors/zod-extractor.d.ts +0 -27
- package/dist/cli/processors/zod-extractor.js +0 -153
- package/dist/cli/prompts/review.d.ts +0 -61
- package/dist/cli/prompts/review.js +0 -410
- package/dist/cli/selectors/express.d.ts +0 -12
- package/dist/cli/selectors/express.js +0 -117
- package/dist/cli/selectors/fastapi.d.ts +0 -12
- package/dist/cli/selectors/fastapi.js +0 -122
- package/dist/cli/selectors/generic.d.ts +0 -10
- package/dist/cli/selectors/generic.js +0 -74
- package/dist/cli/selectors/index.d.ts +0 -37
- package/dist/cli/selectors/index.js +0 -315
- package/dist/cli/selectors/next.d.ts +0 -12
- package/dist/cli/selectors/next.js +0 -130
- package/dist/core/config-policy.test.d.ts +0 -1
- package/dist/core/config-policy.test.js +0 -101
- package/dist/core/config-roundtrip.test.d.ts +0 -1
- package/dist/core/config-roundtrip.test.js +0 -180
- package/dist/core/endpoint-guard.test.d.ts +0 -1
- package/dist/core/endpoint-guard.test.js +0 -57
- package/dist/core/env-diagnostics.test.d.ts +0 -1
- package/dist/core/env-diagnostics.test.js +0 -31
- package/dist/core/evidence-bundle.conformance.test.d.ts +0 -1
- package/dist/core/evidence-bundle.conformance.test.js +0 -110
- package/dist/core/evidence-bundle.test.d.ts +0 -1
- package/dist/core/evidence-bundle.test.js +0 -58
- package/dist/core/invariants.test.d.ts +0 -1
- package/dist/core/invariants.test.js +0 -217
- package/dist/core/login-handoff.test.d.ts +0 -1
- package/dist/core/login-handoff.test.js +0 -31
- package/dist/core/profile.test.d.ts +0 -1
- package/dist/core/profile.test.js +0 -95
- package/dist/core/readiness-checks.test.d.ts +0 -1
- package/dist/core/readiness-checks.test.js +0 -106
- package/dist/core/receipt.test.d.ts +0 -1
- package/dist/core/receipt.test.js +0 -75
- package/dist/core/sdk-entrypoint.test.d.ts +0 -1
- package/dist/core/sdk-entrypoint.test.js +0 -8
- package/dist/core/side-effects-review.test.d.ts +0 -1
- package/dist/core/side-effects-review.test.js +0 -28
- package/dist/core/token.conformance.test.d.ts +0 -1
- package/dist/core/token.conformance.test.js +0 -43
- package/dist/core/token.test.d.ts +0 -1
- package/dist/core/token.test.js +0 -66
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,66 @@
|
|
|
1
1
|
# Changelog — @duct-sdk/sdk
|
|
2
2
|
|
|
3
|
+
## [0.7.0] — 2026-11-23
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- **`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.
|
|
7
|
+
- **`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.
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
- `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.
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- `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`.
|
|
14
|
+
|
|
15
|
+
## [0.6.1] — 2026-11-23
|
|
16
|
+
|
|
17
|
+
### Security
|
|
18
|
+
- Transitive dependency fixes within the declared ranges.
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
- **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.
|
|
22
|
+
|
|
23
|
+
## [0.6.0] — 2026-11-20
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
- **`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`.
|
|
27
|
+
- **`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.
|
|
28
|
+
- **`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.
|
|
29
|
+
- **MCP `duct_create_shell`** — previews, then creates only with `confirm: true`; returns the shell ID and the file path, never the secret.
|
|
30
|
+
- **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`.
|
|
31
|
+
- **`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.
|
|
32
|
+
- **`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`.
|
|
33
|
+
- **`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).
|
|
34
|
+
- **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.
|
|
35
|
+
- **`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.
|
|
36
|
+
- **`duct sync`** refreshes `capabilities.json` from its recorded source and keeps reviewed fields (name, description, sensitivity, side-effect classification + ack).
|
|
37
|
+
- **`duct split`** migrates `duct.config.ts` → `duct/`; files are written only after recompiling to identical enforcement for every action.
|
|
38
|
+
- **`duct add identity | shell`** — optional layers (token route, receiver, middleware snippet with auth + login-page detection; chat shell component + `duct/shell.ts`).
|
|
39
|
+
- **`duct prompt`** — instructions for the developer's coding agent to fill `capabilities.json` when there is no OpenAPI spec.
|
|
40
|
+
- **Tests** in `packages/sdk/tests/` (compiler, split equivalence, static loader safety, discovery, sync merge, CLI end-to-end against a fake Duct cloud).
|
|
41
|
+
|
|
42
|
+
### Changed
|
|
43
|
+
- **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.
|
|
44
|
+
- README and the identity audit hint point to `npx @duct-sdk/sdk mcp` / `add identity` instead of the retired integration prompt page.
|
|
45
|
+
- **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`.
|
|
46
|
+
- **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."
|
|
47
|
+
- **`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.
|
|
48
|
+
- CLI hints use `npx @duct-sdk/sdk` everywhere (`npx duct` resolves to a different package).
|
|
49
|
+
|
|
50
|
+
### Removed
|
|
51
|
+
- Unused internal modules `core/auth-boundaries.ts` and `core/limits.ts` (never exported).
|
|
52
|
+
- **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.
|
|
53
|
+
|
|
54
|
+
### Fixed
|
|
55
|
+
- The npm package no longer ships compiled test files (`dist/**/*.test.*`): 216 → 166 files.
|
|
56
|
+
- **`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.
|
|
57
|
+
- **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.
|
|
58
|
+
- **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.
|
|
59
|
+
- **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.
|
|
60
|
+
- 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`.
|
|
61
|
+
- **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`.
|
|
62
|
+
- Static config loader no longer rejects configs whose **string values** contain words like "process" or "fetch".
|
|
63
|
+
|
|
3
64
|
## [0.5.13] — 2026-07-26
|
|
4
65
|
|
|
5
66
|
### Added
|