@duct-sdk/sdk 0.5.10 → 0.5.11

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,5 +1,10 @@
1
1
  # Changelog — @duct-sdk/sdk
2
2
 
3
+ ## [0.5.11] — 2026-07-22
4
+
5
+ ### Added
6
+ - **`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.
7
+
3
8
  ## [0.5.10] — 2026-07-19
4
9
 
5
10
  ### Added
package/dist/cli/index.js CHANGED
@@ -24,7 +24,7 @@ import { readFileSync, existsSync } from "fs";
24
24
  import { DuctConfigSchema, crossValidateDuctConfig } from "../core/config.js";
25
25
  import { runAgentSafetyChecks } from "./agents/reviewer-agent.js";
26
26
  import { ConfigRuntimeReferenceError, loadDuctConfig, } from "./config-loader.js";
27
- import { computeManifestPrivilegeDiff, fetchLiveManifestConfig, formatManifestPrivilegeDiff, } from "./manifest-diff.js";
27
+ import { computeManifestPrivilegeDiff, fetchLiveManifestConfig, formatManifestPrivilegeDiff, detectDashboardNetworkReverts, } from "./manifest-diff.js";
28
28
  import { applyActiveProfileEnvSync, ensureProfileExists, getDuctProfileFilePath, listProfileNames, readProfileFileSync, resolveActiveProfileName, resolveProfileUrls, setActiveProfileSync, } from "../core/profile.js";
29
29
  // ----------------------------------------------------------------
30
30
  // Load all standard .env files in dotenv priority order
@@ -421,6 +421,24 @@ program
421
421
  " Re-run with --yes to acknowledge (CI override).\n"));
422
422
  process.exit(1);
423
423
  }
424
+ // Dashboard-managed network settings (intershell_enabled, registry_visibility) are toggled
425
+ // live in the dashboard. A push whose config would turn OFF what the dashboard has ON is the
426
+ // silent-revert footgun — flag it and block unless --yes so a stale/CI config can't quietly
427
+ // disable cross-shell reachability. The dashboard stays the default winner.
428
+ const networkReverts = detectDashboardNetworkReverts(liveConfig, validated);
429
+ const forceDashboardNetworkOverride = networkReverts.length > 0 && opts.yes;
430
+ if (networkReverts.length > 0) {
431
+ console.log(chalk.yellow("\n ⚠ Network settings you changed in the dashboard would be reverted by this push:\n"));
432
+ for (const r of networkReverts)
433
+ console.log(chalk.yellow(` • ${r}`));
434
+ console.log(chalk.gray("\n The dashboard is the live control for these settings. To keep them, set the\n" +
435
+ " matching values in duct.config.ts (e.g. `intershell_enabled: true`).\n"));
436
+ if (!opts.yes) {
437
+ console.log(chalk.yellow(" Push blocked. Re-run with --yes to apply this push and override the dashboard.\n"));
438
+ process.exit(1);
439
+ }
440
+ console.log(chalk.gray(" Continuing with --yes — the dashboard settings will be overwritten.\n"));
441
+ }
424
442
  if (opts.dryRun) {
425
443
  console.log(chalk.green("✓ Dry-run complete — manifest not pushed.\n"));
426
444
  return;
@@ -458,7 +476,12 @@ program
458
476
  "Content-Type": "application/json",
459
477
  Authorization: `Bearer ${apiKey}`,
460
478
  },
461
- body: JSON.stringify({ config }),
479
+ body: JSON.stringify({
480
+ config,
481
+ ...(forceDashboardNetworkOverride
482
+ ? { force_dashboard_network_override: true }
483
+ : {}),
484
+ }),
462
485
  });
463
486
  if (response.ok) {
464
487
  success = true;
@@ -16,6 +16,16 @@ export interface ManifestPrivilegeDiff {
16
16
  * return privilege-increasing deltas operators must acknowledge before push.
17
17
  */
18
18
  export declare function computeManifestPrivilegeDiff(candidate: DuctConfig, live: DuctConfig | null | undefined): ManifestPrivilegeDiff;
19
+ /**
20
+ * Dashboard-managed network settings (intershell_enabled, registry_visibility) can be toggled
21
+ * live in the dashboard, which persists them into the stored manifest. A `duct push` whose config
22
+ * would turn one OFF while the dashboard has it ON is the silent-revert footgun — the dashboard is
23
+ * the live control for these. Returns human-readable revert descriptions (empty when no conflict).
24
+ *
25
+ * Note: the config schema defaults these to false/'private', so an omitted field arrives as an
26
+ * explicit off — which is exactly why this must be caught at push time rather than server-side.
27
+ */
28
+ export declare function detectDashboardNetworkReverts(live: Pick<DuctConfig, "intershell_enabled" | "registry_visibility"> | null, candidate: Pick<DuctConfig, "intershell_enabled" | "registry_visibility">): string[];
19
29
  /** Fetch the live manifest config from Duct cloud (null when shell has no manifest yet). */
20
30
  export declare function fetchLiveManifestConfig(shellId: string, apiKey: string, profile?: EndpointProfile | null): Promise<DuctConfig | null>;
21
31
  export declare function formatManifestPrivilegeDiff(diff: ManifestPrivilegeDiff): string[];
@@ -122,6 +122,27 @@ export function computeManifestPrivilegeDiff(candidate, live) {
122
122
  hasPrivilegeIncrease: deltas.length > 0,
123
123
  };
124
124
  }
125
+ /**
126
+ * Dashboard-managed network settings (intershell_enabled, registry_visibility) can be toggled
127
+ * live in the dashboard, which persists them into the stored manifest. A `duct push` whose config
128
+ * would turn one OFF while the dashboard has it ON is the silent-revert footgun — the dashboard is
129
+ * the live control for these. Returns human-readable revert descriptions (empty when no conflict).
130
+ *
131
+ * Note: the config schema defaults these to false/'private', so an omitted field arrives as an
132
+ * explicit off — which is exactly why this must be caught at push time rather than server-side.
133
+ */
134
+ export function detectDashboardNetworkReverts(live, candidate) {
135
+ const reverts = [];
136
+ if (!live)
137
+ return reverts;
138
+ if (live.intershell_enabled === true && candidate.intershell_enabled !== true) {
139
+ reverts.push("intershell_enabled — dashboard has cross-shell calls ON; this config would turn it OFF");
140
+ }
141
+ if (live.registry_visibility === "public" && candidate.registry_visibility !== "public") {
142
+ reverts.push("registry_visibility — dashboard has this shell PUBLIC; this config would make it PRIVATE");
143
+ }
144
+ return reverts;
145
+ }
125
146
  /** Fetch the live manifest config from Duct cloud (null when shell has no manifest yet). */
126
147
  export async function fetchLiveManifestConfig(shellId, apiKey, profile) {
127
148
  const bases = getManifestApiBases(profile);
@@ -1,6 +1,6 @@
1
1
  import { describe, it } from "node:test";
2
2
  import assert from "node:assert/strict";
3
- import { computeManifestPrivilegeDiff } from "./manifest-diff.js";
3
+ import { computeManifestPrivilegeDiff, detectDashboardNetworkReverts } from "./manifest-diff.js";
4
4
  function baseConfig(overrides = {}) {
5
5
  return {
6
6
  shellId: "shell_acme_prod",
@@ -102,3 +102,43 @@ describe("computeManifestPrivilegeDiff", () => {
102
102
  assert.ok(diff.deltas.some((d) => d.kind === "allowed_callers_widened"));
103
103
  });
104
104
  });
105
+ describe("detectDashboardNetworkReverts", () => {
106
+ it("returns nothing on first push (no live manifest)", () => {
107
+ assert.deepEqual(detectDashboardNetworkReverts(null, baseConfig()), []);
108
+ });
109
+ it("flags intershell going ON (dashboard) → OFF (config) — the drift footgun", () => {
110
+ const live = baseConfig({ intershell_enabled: true, registry_visibility: "public" });
111
+ const candidate = baseConfig({ intershell_enabled: false, registry_visibility: "public" });
112
+ const reverts = detectDashboardNetworkReverts(live, candidate);
113
+ assert.equal(reverts.length, 1);
114
+ assert.match(reverts[0], /intershell_enabled/);
115
+ });
116
+ it("flags an omitted intershell (defaults false) against a live-ON dashboard", () => {
117
+ // The config schema defaults intershell_enabled to false, so an omitted field reads as off.
118
+ const live = baseConfig({ intershell_enabled: true });
119
+ const candidate = baseConfig({ intershell_enabled: false });
120
+ assert.equal(detectDashboardNetworkReverts(live, candidate).length, 1);
121
+ });
122
+ it("flags registry_visibility public → private", () => {
123
+ const live = baseConfig({ registry_visibility: "public" });
124
+ const candidate = baseConfig({ registry_visibility: "private" });
125
+ const reverts = detectDashboardNetworkReverts(live, candidate);
126
+ assert.equal(reverts.length, 1);
127
+ assert.match(reverts[0], /registry_visibility/);
128
+ });
129
+ it("does not flag the enable direction (OFF → ON is a privilege increase, handled elsewhere)", () => {
130
+ const live = baseConfig({ intershell_enabled: false, registry_visibility: "private" });
131
+ const candidate = baseConfig({ intershell_enabled: true, registry_visibility: "public" });
132
+ assert.deepEqual(detectDashboardNetworkReverts(live, candidate), []);
133
+ });
134
+ it("does not flag when config matches the dashboard (both ON)", () => {
135
+ const live = baseConfig({ intershell_enabled: true, registry_visibility: "public" });
136
+ const candidate = baseConfig({ intershell_enabled: true, registry_visibility: "public" });
137
+ assert.deepEqual(detectDashboardNetworkReverts(live, candidate), []);
138
+ });
139
+ it("flags both settings when both would revert", () => {
140
+ const live = baseConfig({ intershell_enabled: true, registry_visibility: "public" });
141
+ const candidate = baseConfig({ intershell_enabled: false, registry_visibility: "private" });
142
+ assert.equal(detectDashboardNetworkReverts(live, candidate).length, 2);
143
+ });
144
+ });
package/package.json CHANGED
@@ -1,94 +1,94 @@
1
- {
2
- "name": "@duct-sdk/sdk",
3
- "version": "0.5.10",
4
- "type": "module",
5
- "description": "Duct SDK — manifest, CLI, and embed components for permissioned human and agent access to your product APIs.",
6
- "main": "dist/index.js",
7
- "types": "dist/index.d.ts",
8
- "bin": {
9
- "duct": "dist/cli/index.js"
10
- },
11
- "exports": {
12
- ".": "./dist/index.js",
13
- "./server": "./dist/server.js",
14
- "./next": "./dist/adapters/next/index.js",
15
- "./remix": "./dist/adapters/remix/index.js",
16
- "./vite": "./dist/adapters/vite/index.js",
17
- "./sveltekit": "./dist/adapters/sveltekit/index.js",
18
- "./react": "./dist/adapters/react/index.js"
19
- },
20
- "scripts": {
21
- "build": "npm run build --prefix ../contracts && tsc",
22
- "dev": "tsc --watch",
23
- "test": "npm run build && node --test dist/core/*.test.js dist/adapters/react/*.test.js dist/cli/*.test.js dist/cli/generators/*.test.js dist/cli/processors/*.test.js",
24
- "verify:publish": "node scripts/verify-publish.mjs",
25
- "pack:release": "npm run build && npm run verify:publish && node scripts/pack-release.mjs",
26
- "prepublishOnly": "npm run build && npm run verify:publish"
27
- },
28
- "dependencies": {
29
- "@duct-sdk/contracts": "file:../contracts",
30
- "@anthropic-ai/sdk": "^0.24.0",
31
- "jose": "^5.0.0",
32
- "ignore": "^5.0.0",
33
- "commander": "^12.0.0",
34
- "chalk": "^5.0.0",
35
- "ora": "^8.0.0",
36
- "inquirer": "^9.0.0",
37
- "zod": "^3.0.0",
38
- "node-fetch": "^3.0.0",
39
- "glob": "^10.0.0",
40
- "yaml": "^2.0.0"
41
- },
42
- "devDependencies": {
43
- "typescript": "^5.0.0",
44
- "@types/node": "^20.0.0",
45
- "@types/inquirer": "^9.0.0",
46
- "@types/react": "^18.0.0",
47
- "next": "^14.0.0",
48
- "react": "^18.0.0",
49
- "react-dom": "^18.0.0"
50
- },
51
- "peerDependencies": {
52
- "react": "^18.0.0 || ^19.0.0",
53
- "react-dom": "^18.0.0 || ^19.0.0",
54
- "next": ">=14.0.0"
55
- },
56
- "peerDependenciesMeta": {
57
- "react": {
58
- "optional": true
59
- },
60
- "react-dom": {
61
- "optional": true
62
- },
63
- "next": {
64
- "optional": true
65
- }
66
- },
67
- "files": [
68
- "dist",
69
- "assets",
70
- "README.md",
71
- "CHANGELOG.md",
72
- "TOKEN_SPEC.md"
73
- ],
74
- "keywords": [
75
- "duct",
76
- "ai",
77
- "agent",
78
- "shell",
79
- "cli",
80
- "llm",
81
- "ai-agent",
82
- "deeplink",
83
- "next",
84
- "nextjs",
85
- "remix",
86
- "vite",
87
- "sveltekit",
88
- "sdk"
89
- ],
90
- "publishConfig": {
91
- "registry": "https://registry.npmjs.org",
92
- "access": "public"
93
- }
94
- }
1
+ {
2
+ "name": "@duct-sdk/sdk",
3
+ "version": "0.5.11",
4
+ "type": "module",
5
+ "description": "Duct SDK — manifest, CLI, and embed components for permissioned human and agent access to your product APIs.",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "bin": {
9
+ "duct": "dist/cli/index.js"
10
+ },
11
+ "exports": {
12
+ ".": "./dist/index.js",
13
+ "./server": "./dist/server.js",
14
+ "./next": "./dist/adapters/next/index.js",
15
+ "./remix": "./dist/adapters/remix/index.js",
16
+ "./vite": "./dist/adapters/vite/index.js",
17
+ "./sveltekit": "./dist/adapters/sveltekit/index.js",
18
+ "./react": "./dist/adapters/react/index.js"
19
+ },
20
+ "scripts": {
21
+ "build": "npm run build --prefix ../contracts && tsc",
22
+ "dev": "tsc --watch",
23
+ "test": "npm run build && node --test dist/core/*.test.js dist/adapters/react/*.test.js dist/cli/*.test.js dist/cli/generators/*.test.js dist/cli/processors/*.test.js",
24
+ "verify:publish": "node scripts/verify-publish.mjs",
25
+ "pack:release": "npm run build && npm run verify:publish && node scripts/pack-release.mjs",
26
+ "prepublishOnly": "npm run build && npm run verify:publish"
27
+ },
28
+ "dependencies": {
29
+ "@duct-sdk/contracts": "file:../contracts",
30
+ "@anthropic-ai/sdk": "^0.24.0",
31
+ "jose": "^5.0.0",
32
+ "ignore": "^5.0.0",
33
+ "commander": "^12.0.0",
34
+ "chalk": "^5.0.0",
35
+ "ora": "^8.0.0",
36
+ "inquirer": "^9.0.0",
37
+ "zod": "^3.0.0",
38
+ "node-fetch": "^3.0.0",
39
+ "glob": "^10.0.0",
40
+ "yaml": "^2.0.0"
41
+ },
42
+ "devDependencies": {
43
+ "typescript": "^5.0.0",
44
+ "@types/node": "^20.0.0",
45
+ "@types/inquirer": "^9.0.0",
46
+ "@types/react": "^18.0.0",
47
+ "next": "^14.0.0",
48
+ "react": "^18.0.0",
49
+ "react-dom": "^18.0.0"
50
+ },
51
+ "peerDependencies": {
52
+ "react": "^18.0.0 || ^19.0.0",
53
+ "react-dom": "^18.0.0 || ^19.0.0",
54
+ "next": ">=14.0.0"
55
+ },
56
+ "peerDependenciesMeta": {
57
+ "react": {
58
+ "optional": true
59
+ },
60
+ "react-dom": {
61
+ "optional": true
62
+ },
63
+ "next": {
64
+ "optional": true
65
+ }
66
+ },
67
+ "files": [
68
+ "dist",
69
+ "assets",
70
+ "README.md",
71
+ "CHANGELOG.md",
72
+ "TOKEN_SPEC.md"
73
+ ],
74
+ "keywords": [
75
+ "duct",
76
+ "ai",
77
+ "agent",
78
+ "shell",
79
+ "cli",
80
+ "llm",
81
+ "ai-agent",
82
+ "deeplink",
83
+ "next",
84
+ "nextjs",
85
+ "remix",
86
+ "vite",
87
+ "sveltekit",
88
+ "sdk"
89
+ ],
90
+ "publishConfig": {
91
+ "registry": "https://registry.npmjs.org",
92
+ "access": "public"
93
+ }
94
+ }