@duct-sdk/sdk 0.5.10 → 0.5.12
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 +10 -0
- package/dist/cli/index.js +55 -3
- package/dist/cli/manifest-diff.d.ts +10 -0
- package/dist/cli/manifest-diff.js +21 -0
- package/dist/cli/manifest-diff.test.js +41 -1
- package/dist/cli/side-effects-review-push.d.ts +11 -0
- package/dist/cli/side-effects-review-push.js +48 -0
- package/dist/core/config.d.ts +5 -0
- package/dist/core/side-effects-review.test.d.ts +1 -0
- package/dist/core/side-effects-review.test.js +28 -0
- package/dist/core/types.d.ts +5 -0
- package/package.json +94 -94
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog — @duct-sdk/sdk
|
|
2
2
|
|
|
3
|
+
## [0.5.12] — 2026-07-25
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- **`sideEffectsReviewAck`** — manifest action field (reason string) when declared `sideEffects` intentionally disagrees with HTTP-method-derived expectation. `duct push` blocks CI/non-TTY pushes until set; interactive push prompts and writes acks into `duct.config.ts`. No `--force` skip.
|
|
7
|
+
|
|
8
|
+
## [0.5.11] — 2026-07-22
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **`duct push` flags dashboard network reverts** — a push whose config would turn OFF a network setting the dashboard has ON (`intershell_enabled` true→false, or `registry_visibility` public→private) is flagged and blocked unless `--yes`. Because the config schema defaults these to off/`private`, an omitted field reads as an explicit off, so a stale or CI config could otherwise silently disable cross-shell reachability that was enabled in the dashboard. Detection lives in the pure, tested `detectDashboardNetworkReverts`. With `--yes`, the SDK sends `force_dashboard_network_override: true` so the server applies the config values intentionally.
|
|
12
|
+
|
|
3
13
|
## [0.5.10] — 2026-07-19
|
|
4
14
|
|
|
5
15
|
### Added
|
package/dist/cli/index.js
CHANGED
|
@@ -23,8 +23,10 @@ import { fileURLToPath } from "node:url";
|
|
|
23
23
|
import { readFileSync, existsSync } from "fs";
|
|
24
24
|
import { DuctConfigSchema, crossValidateDuctConfig } from "../core/config.js";
|
|
25
25
|
import { runAgentSafetyChecks } from "./agents/reviewer-agent.js";
|
|
26
|
+
import { formatSideEffectMismatchLines, findSideEffectReviewMismatches, resolveSideEffectReviewAcks, } from "./side-effects-review-push.js";
|
|
27
|
+
import { generateConfigFile } from "./generators/config.js";
|
|
26
28
|
import { ConfigRuntimeReferenceError, loadDuctConfig, } from "./config-loader.js";
|
|
27
|
-
import { computeManifestPrivilegeDiff, fetchLiveManifestConfig, formatManifestPrivilegeDiff, } from "./manifest-diff.js";
|
|
29
|
+
import { computeManifestPrivilegeDiff, fetchLiveManifestConfig, formatManifestPrivilegeDiff, detectDashboardNetworkReverts, } from "./manifest-diff.js";
|
|
28
30
|
import { applyActiveProfileEnvSync, ensureProfileExists, getDuctProfileFilePath, listProfileNames, readProfileFileSync, resolveActiveProfileName, resolveProfileUrls, setActiveProfileSync, } from "../core/profile.js";
|
|
29
31
|
// ----------------------------------------------------------------
|
|
30
32
|
// Load all standard .env files in dotenv priority order
|
|
@@ -333,7 +335,7 @@ program
|
|
|
333
335
|
process.exit(1);
|
|
334
336
|
}
|
|
335
337
|
config = validation.data;
|
|
336
|
-
|
|
338
|
+
let validated = validation.data;
|
|
337
339
|
const crossIssues = crossValidateDuctConfig(validated);
|
|
338
340
|
const crossErrors = crossIssues.filter((i) => i.severity === "error");
|
|
339
341
|
if (crossErrors.length > 0) {
|
|
@@ -378,6 +380,33 @@ program
|
|
|
378
380
|
}
|
|
379
381
|
console.log(chalk.gray("\n Continuing with --yes.\n"));
|
|
380
382
|
}
|
|
383
|
+
const interactiveReview = Boolean(process.stdin.isTTY) && process.env.CI !== "true";
|
|
384
|
+
const reviewMismatchesBefore = findSideEffectReviewMismatches(validated.actions);
|
|
385
|
+
if (reviewMismatchesBefore.length > 0) {
|
|
386
|
+
try {
|
|
387
|
+
const reviewedActions = await resolveSideEffectReviewAcks(validated.actions, {
|
|
388
|
+
interactive: interactiveReview,
|
|
389
|
+
});
|
|
390
|
+
if (reviewedActions !== validated.actions) {
|
|
391
|
+
validated = { ...validated, actions: reviewedActions };
|
|
392
|
+
config = { ...config, actions: reviewedActions };
|
|
393
|
+
const configPath = path.resolve(cwd, opts.config ?? "duct.config.ts");
|
|
394
|
+
await fs.writeFile(configPath, generateConfigFile(validated), "utf-8");
|
|
395
|
+
console.log(chalk.green("\n ✓ Wrote sideEffectsReviewAck reasons to duct.config.ts\n"));
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
catch (err) {
|
|
399
|
+
if (err instanceof Error && err.message === "side_effects_review_required") {
|
|
400
|
+
console.log(chalk.red("\n Push blocked — side-effect classification review required.\n"));
|
|
401
|
+
for (const line of formatSideEffectMismatchLines(reviewMismatchesBefore)) {
|
|
402
|
+
console.log(chalk.red(line));
|
|
403
|
+
}
|
|
404
|
+
console.log(chalk.gray("\n Add sideEffectsReviewAck with a reason on each listed action in duct.config.ts (no --force skip).\n"));
|
|
405
|
+
process.exit(1);
|
|
406
|
+
}
|
|
407
|
+
throw err;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
381
410
|
// Warn on weak DUCT_SECRET_KEY — must be ≥ 32 chars for adequate HMAC entropy
|
|
382
411
|
const secretKey = process.env["DUCT_SECRET_KEY"];
|
|
383
412
|
if (secretKey && secretKey.length < 32) {
|
|
@@ -421,6 +450,24 @@ program
|
|
|
421
450
|
" Re-run with --yes to acknowledge (CI override).\n"));
|
|
422
451
|
process.exit(1);
|
|
423
452
|
}
|
|
453
|
+
// Dashboard-managed network settings (intershell_enabled, registry_visibility) are toggled
|
|
454
|
+
// live in the dashboard. A push whose config would turn OFF what the dashboard has ON is the
|
|
455
|
+
// silent-revert footgun — flag it and block unless --yes so a stale/CI config can't quietly
|
|
456
|
+
// disable cross-shell reachability. The dashboard stays the default winner.
|
|
457
|
+
const networkReverts = detectDashboardNetworkReverts(liveConfig, validated);
|
|
458
|
+
const forceDashboardNetworkOverride = networkReverts.length > 0 && opts.yes;
|
|
459
|
+
if (networkReverts.length > 0) {
|
|
460
|
+
console.log(chalk.yellow("\n ⚠ Network settings you changed in the dashboard would be reverted by this push:\n"));
|
|
461
|
+
for (const r of networkReverts)
|
|
462
|
+
console.log(chalk.yellow(` • ${r}`));
|
|
463
|
+
console.log(chalk.gray("\n The dashboard is the live control for these settings. To keep them, set the\n" +
|
|
464
|
+
" matching values in duct.config.ts (e.g. `intershell_enabled: true`).\n"));
|
|
465
|
+
if (!opts.yes) {
|
|
466
|
+
console.log(chalk.yellow(" Push blocked. Re-run with --yes to apply this push and override the dashboard.\n"));
|
|
467
|
+
process.exit(1);
|
|
468
|
+
}
|
|
469
|
+
console.log(chalk.gray(" Continuing with --yes — the dashboard settings will be overwritten.\n"));
|
|
470
|
+
}
|
|
424
471
|
if (opts.dryRun) {
|
|
425
472
|
console.log(chalk.green("✓ Dry-run complete — manifest not pushed.\n"));
|
|
426
473
|
return;
|
|
@@ -458,7 +505,12 @@ program
|
|
|
458
505
|
"Content-Type": "application/json",
|
|
459
506
|
Authorization: `Bearer ${apiKey}`,
|
|
460
507
|
},
|
|
461
|
-
body: JSON.stringify({
|
|
508
|
+
body: JSON.stringify({
|
|
509
|
+
config,
|
|
510
|
+
...(forceDashboardNetworkOverride
|
|
511
|
+
? { force_dashboard_network_override: true }
|
|
512
|
+
: {}),
|
|
513
|
+
}),
|
|
462
514
|
});
|
|
463
515
|
if (response.ok) {
|
|
464
516
|
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
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type SideEffectReviewMismatch } from '@duct-sdk/contracts';
|
|
2
|
+
import type { ActionManifest } from '../core/types.js';
|
|
3
|
+
export declare function findSideEffectReviewMismatches(actions: ActionManifest[]): SideEffectReviewMismatch[];
|
|
4
|
+
export declare function formatSideEffectMismatchLines(mismatches: SideEffectReviewMismatch[]): string[];
|
|
5
|
+
/**
|
|
6
|
+
* Interactive: prompt for acknowledgment reasons and merge into actions.
|
|
7
|
+
* Non-interactive: throws with mismatch list (no --force escape hatch).
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolveSideEffectReviewAcks(actions: ActionManifest[], opts: {
|
|
10
|
+
interactive: boolean;
|
|
11
|
+
}): Promise<ActionManifest[]>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import inquirer from 'inquirer';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { collectSideEffectReviewMismatches, } from '@duct-sdk/contracts';
|
|
4
|
+
export function findSideEffectReviewMismatches(actions) {
|
|
5
|
+
return collectSideEffectReviewMismatches(actions.map((a) => ({
|
|
6
|
+
id: a.id,
|
|
7
|
+
method: a.method,
|
|
8
|
+
sideEffects: a.sideEffects,
|
|
9
|
+
sideEffectsReviewAck: a.sideEffectsReviewAck,
|
|
10
|
+
})));
|
|
11
|
+
}
|
|
12
|
+
export function formatSideEffectMismatchLines(mismatches) {
|
|
13
|
+
return mismatches.map((m) => ` • ${m.actionId} (${m.method}): declared sideEffects=${m.declared}, derived=${m.derived}`);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Interactive: prompt for acknowledgment reasons and merge into actions.
|
|
17
|
+
* Non-interactive: throws with mismatch list (no --force escape hatch).
|
|
18
|
+
*/
|
|
19
|
+
export async function resolveSideEffectReviewAcks(actions, opts) {
|
|
20
|
+
let working = actions.map((a) => ({ ...a }));
|
|
21
|
+
let mismatches = findSideEffectReviewMismatches(working);
|
|
22
|
+
if (mismatches.length === 0)
|
|
23
|
+
return working;
|
|
24
|
+
console.log(chalk.yellow('\n Side-effect classification review:\n'));
|
|
25
|
+
for (const line of formatSideEffectMismatchLines(mismatches)) {
|
|
26
|
+
console.log(chalk.yellow(line));
|
|
27
|
+
}
|
|
28
|
+
console.log(chalk.gray('\n Declared sideEffects disagrees with the HTTP method expectation. Add sideEffectsReviewAck with a reason in duct.config.ts (reviewed in git).\n'));
|
|
29
|
+
if (!opts.interactive) {
|
|
30
|
+
throw new Error('side_effects_review_required');
|
|
31
|
+
}
|
|
32
|
+
for (const mismatch of mismatches) {
|
|
33
|
+
const { reason } = await inquirer.prompt([
|
|
34
|
+
{
|
|
35
|
+
type: 'input',
|
|
36
|
+
name: 'reason',
|
|
37
|
+
message: `Acknowledge ${mismatch.actionId} (declared=${mismatch.declared}, derived=${mismatch.derived}) — reason:`,
|
|
38
|
+
validate: (v) => (v?.trim().length >= 8 ? true : 'Enter at least 8 characters'),
|
|
39
|
+
},
|
|
40
|
+
]);
|
|
41
|
+
working = working.map((a) => a.id === mismatch.actionId ? { ...a, sideEffectsReviewAck: reason.trim() } : a);
|
|
42
|
+
}
|
|
43
|
+
mismatches = findSideEffectReviewMismatches(working);
|
|
44
|
+
if (mismatches.length > 0) {
|
|
45
|
+
throw new Error('side_effects_review_incomplete');
|
|
46
|
+
}
|
|
47
|
+
return working;
|
|
48
|
+
}
|
package/dist/core/config.d.ts
CHANGED
|
@@ -184,6 +184,7 @@ export declare const DuctConfigSchema: z.ZodObject<{
|
|
|
184
184
|
path: z.ZodString;
|
|
185
185
|
agentAccessible: z.ZodBoolean;
|
|
186
186
|
sideEffects: z.ZodBoolean;
|
|
187
|
+
sideEffectsReviewAck: z.ZodOptional<z.ZodString>;
|
|
187
188
|
sensitivityLevel: z.ZodEnum<["none", "low", "medium", "high", "critical"]>;
|
|
188
189
|
params: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
189
190
|
name: z.ZodString;
|
|
@@ -270,6 +271,7 @@ export declare const DuctConfigSchema: z.ZodObject<{
|
|
|
270
271
|
sideEffects: boolean;
|
|
271
272
|
sensitivityLevel: "none" | "low" | "medium" | "high" | "critical";
|
|
272
273
|
requiresAuth: boolean;
|
|
274
|
+
sideEffectsReviewAck?: string | undefined;
|
|
273
275
|
responseSchema?: Record<string, unknown> | undefined;
|
|
274
276
|
inputSchema?: Record<string, unknown> | undefined;
|
|
275
277
|
rateLimit?: number | undefined;
|
|
@@ -315,6 +317,7 @@ export declare const DuctConfigSchema: z.ZodObject<{
|
|
|
315
317
|
description?: string | undefined;
|
|
316
318
|
schema?: Record<string, unknown> | undefined;
|
|
317
319
|
}[] | undefined;
|
|
320
|
+
sideEffectsReviewAck?: string | undefined;
|
|
318
321
|
responseSchema?: Record<string, unknown> | undefined;
|
|
319
322
|
inputSchema?: Record<string, unknown> | undefined;
|
|
320
323
|
rateLimit?: number | undefined;
|
|
@@ -648,6 +651,7 @@ export declare const DuctConfigSchema: z.ZodObject<{
|
|
|
648
651
|
sideEffects: boolean;
|
|
649
652
|
sensitivityLevel: "none" | "low" | "medium" | "high" | "critical";
|
|
650
653
|
requiresAuth: boolean;
|
|
654
|
+
sideEffectsReviewAck?: string | undefined;
|
|
651
655
|
responseSchema?: Record<string, unknown> | undefined;
|
|
652
656
|
inputSchema?: Record<string, unknown> | undefined;
|
|
653
657
|
rateLimit?: number | undefined;
|
|
@@ -828,6 +832,7 @@ export declare const DuctConfigSchema: z.ZodObject<{
|
|
|
828
832
|
description?: string | undefined;
|
|
829
833
|
schema?: Record<string, unknown> | undefined;
|
|
830
834
|
}[] | undefined;
|
|
835
|
+
sideEffectsReviewAck?: string | undefined;
|
|
831
836
|
responseSchema?: Record<string, unknown> | undefined;
|
|
832
837
|
inputSchema?: Record<string, unknown> | undefined;
|
|
833
838
|
rateLimit?: number | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { describe, it } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { collectSideEffectReviewMismatches, deriveExpectedSideEffects, } from '@duct-sdk/contracts';
|
|
4
|
+
describe('side-effects-review', () => {
|
|
5
|
+
it('derives sideEffects from HTTP method', () => {
|
|
6
|
+
assert.equal(deriveExpectedSideEffects('GET'), false);
|
|
7
|
+
assert.equal(deriveExpectedSideEffects('post'), true);
|
|
8
|
+
assert.equal(deriveExpectedSideEffects(''), null);
|
|
9
|
+
});
|
|
10
|
+
it('flags mismatches without acknowledgment', () => {
|
|
11
|
+
const mismatches = collectSideEffectReviewMismatches([
|
|
12
|
+
{ id: 'search', method: 'POST', sideEffects: false },
|
|
13
|
+
]);
|
|
14
|
+
assert.equal(mismatches.length, 1);
|
|
15
|
+
assert.equal(mismatches[0]?.actionId, 'search');
|
|
16
|
+
});
|
|
17
|
+
it('accepts acknowledged mismatches', () => {
|
|
18
|
+
const mismatches = collectSideEffectReviewMismatches([
|
|
19
|
+
{
|
|
20
|
+
id: 'search',
|
|
21
|
+
method: 'POST',
|
|
22
|
+
sideEffects: false,
|
|
23
|
+
sideEffectsReviewAck: 'Body-heavy search only; no mutations',
|
|
24
|
+
},
|
|
25
|
+
]);
|
|
26
|
+
assert.equal(mismatches.length, 0);
|
|
27
|
+
});
|
|
28
|
+
});
|
package/dist/core/types.d.ts
CHANGED
|
@@ -101,6 +101,11 @@ export interface ActionManifest {
|
|
|
101
101
|
agentAccessible: boolean;
|
|
102
102
|
/** Whether this action mutates state (POST/PUT/PATCH/DELETE) */
|
|
103
103
|
sideEffects: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Free-text reason when `sideEffects` intentionally disagrees with the HTTP-method-derived expectation.
|
|
106
|
+
* Required for push when declared ≠ derived (stored in git / manifest hash).
|
|
107
|
+
*/
|
|
108
|
+
sideEffectsReviewAck?: string;
|
|
104
109
|
/** Data sensitivity classification */
|
|
105
110
|
sensitivityLevel: SensitivityLevel;
|
|
106
111
|
/** Input parameters */
|
package/package.json
CHANGED
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@duct-sdk/sdk",
|
|
3
|
-
"version": "0.5.
|
|
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.12",
|
|
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
|
+
}
|