@duct-sdk/sdk 0.5.9 → 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 +18 -0
- package/dist/adapters/react/shell.d.ts +2 -2
- package/dist/adapters/react/shell.js +1 -2
- package/dist/cli/generators/config.test.js +3 -0
- package/dist/cli/index.js +62 -2
- 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/prompts/review.js +14 -0
- package/dist/core/config-roundtrip.test.js +48 -0
- package/dist/core/config.d.ts +28 -0
- package/dist/core/config.js +20 -0
- package/dist/core/evidence-bundle.conformance.test.d.ts +1 -0
- package/dist/core/evidence-bundle.conformance.test.js +110 -0
- package/dist/core/evidence-bundle.d.ts +59 -0
- package/dist/core/evidence-bundle.js +68 -0
- package/dist/core/evidence-bundle.test.d.ts +1 -0
- package/dist/core/evidence-bundle.test.js +58 -0
- package/dist/core/readiness-checks.d.ts +24 -6
- package/dist/core/readiness-checks.js +75 -23
- package/dist/core/readiness-checks.test.js +58 -1
- package/dist/core/receipt.d.ts +5 -1
- package/dist/core/types.d.ts +23 -0
- package/dist/core/types.js +3 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/server.d.ts +1 -0
- package/dist/server.js +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
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
|
+
|
|
8
|
+
## [0.5.10] — 2026-07-19
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **`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`.
|
|
12
|
+
- **Intershell manifest validation** — `agentPermissions.allowedCallees` schema; `crossValidateDuctConfig` requires `webhooks.identityUrl` when `intershell_enabled` and protected actions coexist.
|
|
13
|
+
|
|
14
|
+
### Improved
|
|
15
|
+
- **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.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- **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.
|
|
19
|
+
- **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.
|
|
20
|
+
|
|
3
21
|
## [0.5.9] — 2026-07-18
|
|
4
22
|
|
|
5
23
|
### Added
|
|
@@ -89,7 +89,7 @@ export interface DuctShellProps {
|
|
|
89
89
|
panelWidth?: number;
|
|
90
90
|
/**
|
|
91
91
|
* Panel height in pixels. Ignored when `preset` is set.
|
|
92
|
-
* @default
|
|
92
|
+
* @default 680
|
|
93
93
|
*/
|
|
94
94
|
panelHeight?: number;
|
|
95
95
|
/** Override container styles (wrapper div). */
|
|
@@ -97,7 +97,7 @@ export interface DuctShellProps {
|
|
|
97
97
|
className?: string;
|
|
98
98
|
/**
|
|
99
99
|
* Optional launcher icon source.
|
|
100
|
-
* When omitted, the SDK tries the host
|
|
100
|
+
* When omitted, the SDK tries the shell host `/duct-text-no-bg.png`, then `/assets/logo.png`.
|
|
101
101
|
*/
|
|
102
102
|
launcherIconSrc?: string;
|
|
103
103
|
/**
|
|
@@ -269,7 +269,7 @@ function cancelRafUpdate(rafRef, pendingRef, commit) {
|
|
|
269
269
|
* />
|
|
270
270
|
* ```
|
|
271
271
|
*/
|
|
272
|
-
export function DuctShell({ shellId, userContext, onTokenRequest, onNavigate, onPageContext, open, onOpenChange, defaultOpen = false, shellHost = DUCT_SHELL_HOST_DEFAULT, position = "bottom-right", preset, theme = "system", draggable = true, panelWidth = 420, panelHeight =
|
|
272
|
+
export function DuctShell({ shellId, userContext, onTokenRequest, onNavigate, onPageContext, open, onOpenChange, defaultOpen = false, shellHost = DUCT_SHELL_HOST_DEFAULT, position = "bottom-right", preset, theme = "system", draggable = true, panelWidth = 420, panelHeight = 680, style, className, launcherIconSrc, readyCheck = false, }) {
|
|
273
273
|
const iframeRef = useRef(null);
|
|
274
274
|
const panelRef = useRef(null);
|
|
275
275
|
const [isReady, setIsReady] = useState(false);
|
|
@@ -334,7 +334,6 @@ export function DuctShell({ shellId, userContext, onTokenRequest, onNavigate, on
|
|
|
334
334
|
const iconCandidates = launcherIconSrc
|
|
335
335
|
? [launcherIconSrc]
|
|
336
336
|
: [
|
|
337
|
-
"/duct-text-no-bg.png",
|
|
338
337
|
`${shellOrigin}/duct-text-no-bg.png`,
|
|
339
338
|
DUCT_LAUNCHER_ICON_LOCAL_FALLBACK,
|
|
340
339
|
];
|
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({
|
|
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;
|
|
@@ -1381,6 +1404,43 @@ migrateCmd
|
|
|
1381
1404
|
}
|
|
1382
1405
|
});
|
|
1383
1406
|
// ----------------------------------------------------------------
|
|
1407
|
+
// duct verify-evidence — offline evidence bundle verification
|
|
1408
|
+
// ----------------------------------------------------------------
|
|
1409
|
+
program
|
|
1410
|
+
.command("verify-evidence")
|
|
1411
|
+
.description("Verify a duct:audit-evidence:v1 bundle offline")
|
|
1412
|
+
.requiredOption("--bundle <path>", "Path to evidence bundle JSON file")
|
|
1413
|
+
.option("--hmac-secret <secret>", "HMAC secret for legacy gate receipts")
|
|
1414
|
+
.action(async (opts) => {
|
|
1415
|
+
const { verifyEvidenceBundle } = await import("../core/evidence-bundle.js");
|
|
1416
|
+
const raw = await fs.readFile(path.resolve(opts.bundle), "utf-8");
|
|
1417
|
+
const bundle = JSON.parse(raw);
|
|
1418
|
+
const result = verifyEvidenceBundle(bundle, {
|
|
1419
|
+
hmacSecret: opts.hmacSecret ?? process.env.RECEIPT_SIGNING_KEY,
|
|
1420
|
+
});
|
|
1421
|
+
if (process.stdout.isTTY) {
|
|
1422
|
+
console.log(chalk.bold(result.valid ? "✓ Bundle verified" : "✗ Bundle failed verification"));
|
|
1423
|
+
console.log(chalk.dim(` Schema: ${result.schema}`));
|
|
1424
|
+
console.log(chalk.dim(` Completeness: ${result.completeness}`));
|
|
1425
|
+
console.log(chalk.dim(` Receipts verified: ${result.verified_receipts}`));
|
|
1426
|
+
if (result.warnings.length) {
|
|
1427
|
+
console.log(chalk.yellow("\nWarnings:"));
|
|
1428
|
+
for (const w of result.warnings)
|
|
1429
|
+
console.log(chalk.yellow(` • ${w}`));
|
|
1430
|
+
}
|
|
1431
|
+
if (result.failed_receipts.length) {
|
|
1432
|
+
console.log(chalk.red("\nFailed receipts:"));
|
|
1433
|
+
for (const f of result.failed_receipts) {
|
|
1434
|
+
console.log(chalk.red(` • ${f.receipt_id ?? "?"}: ${f.reason}`));
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
else {
|
|
1439
|
+
console.log(JSON.stringify(result, null, 2));
|
|
1440
|
+
}
|
|
1441
|
+
process.exit(result.valid ? 0 : 1);
|
|
1442
|
+
});
|
|
1443
|
+
// ----------------------------------------------------------------
|
|
1384
1444
|
// Error handling
|
|
1385
1445
|
// ----------------------------------------------------------------
|
|
1386
1446
|
program.exitOverride();
|
|
@@ -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
|
+
});
|
|
@@ -40,6 +40,15 @@ function requiresPrompt(action) {
|
|
|
40
40
|
const lowConfidence = (action.confidence ?? 0) < 0.85;
|
|
41
41
|
return isSideEffect || lowConfidence;
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* True when at least one agent-accessible action requires auth or has side effects —
|
|
45
|
+
* i.e. this shell needs `webhooks.identityUrl` configured before intershell callers
|
|
46
|
+
* can ever authorize it (see `crossValidateDuctConfig` in core/config.ts for the
|
|
47
|
+
* authoritative, enforced version of this check against the final assembled config).
|
|
48
|
+
*/
|
|
49
|
+
function hasProtectedAgentAccessibleAction(actions) {
|
|
50
|
+
return actions.some((a) => a.agentAccessible && (a.requiresAuth || a.sideEffects));
|
|
51
|
+
}
|
|
43
52
|
// ----------------------------------------------------------------
|
|
44
53
|
// Single-action prompt (readline-based, not inquirer)
|
|
45
54
|
// ----------------------------------------------------------------
|
|
@@ -276,6 +285,11 @@ export async function runInteractiveReview(pipelineResult, opts = {}) {
|
|
|
276
285
|
}
|
|
277
286
|
}
|
|
278
287
|
}
|
|
288
|
+
if (hasProtectedAgentAccessibleAction(approvedActions)) {
|
|
289
|
+
console.log(chalk.yellow("\n [DUCT] intershell_enabled shells with protected actions must configure webhooks.identityUrl\n" +
|
|
290
|
+
" Set webhooks.identityUrl (Dashboard → Shell → Settings → Webhooks) or cross-shell\n" +
|
|
291
|
+
" callers will never be able to authorize these actions.\n"));
|
|
292
|
+
}
|
|
279
293
|
}
|
|
280
294
|
rl.close();
|
|
281
295
|
const agentAccessibleCount = approvedActions.filter((a) => a.agentAccessible).length;
|
|
@@ -129,4 +129,52 @@ describe("config field round-trip", () => {
|
|
|
129
129
|
assert.equal(result.data.actions[0].sensitivityLevel, "none");
|
|
130
130
|
}
|
|
131
131
|
});
|
|
132
|
+
it("preserves allowedCallees and webhooks (intershell egress + identity config)", () => {
|
|
133
|
+
const config = minimalConfig({
|
|
134
|
+
intershell_enabled: true,
|
|
135
|
+
registry_visibility: "public",
|
|
136
|
+
agentPermissions: {
|
|
137
|
+
defaultLevel: "none",
|
|
138
|
+
requireUserConsent: true,
|
|
139
|
+
allowedCallees: ["shell_partner_prod", "*"],
|
|
140
|
+
},
|
|
141
|
+
webhooks: {
|
|
142
|
+
consentCallback: "https://app.acme.com/duct/consent-callback",
|
|
143
|
+
identityUrl: "https://app.acme.com/duct/identity",
|
|
144
|
+
secret: "whsec_test123",
|
|
145
|
+
},
|
|
146
|
+
});
|
|
147
|
+
const result = validateDuctConfigStrict(config);
|
|
148
|
+
assert.equal(result.ok, true);
|
|
149
|
+
if (!result.ok)
|
|
150
|
+
return;
|
|
151
|
+
assert.deepEqual(result.data.agentPermissions.allowedCallees, [
|
|
152
|
+
"shell_partner_prod",
|
|
153
|
+
"*",
|
|
154
|
+
]);
|
|
155
|
+
assert.equal(result.data.webhooks?.identityUrl, "https://app.acme.com/duct/identity");
|
|
156
|
+
assert.equal(result.data.webhooks?.secret, "whsec_test123");
|
|
157
|
+
});
|
|
158
|
+
it("rejects a malformed allowedCallees entry", () => {
|
|
159
|
+
const config = minimalConfig({
|
|
160
|
+
agentPermissions: {
|
|
161
|
+
defaultLevel: "none",
|
|
162
|
+
requireUserConsent: true,
|
|
163
|
+
allowedCallees: ["not-a-valid-shell-id"],
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
const result = validateDuctConfigStrict(config);
|
|
167
|
+
assert.equal(result.ok, false);
|
|
168
|
+
});
|
|
169
|
+
it("flags intershell_enabled shells with a protected action but no webhooks.identityUrl", () => {
|
|
170
|
+
const config = minimalConfig({
|
|
171
|
+
intershell_enabled: true,
|
|
172
|
+
registry_visibility: "public",
|
|
173
|
+
});
|
|
174
|
+
const result = validateDuctConfigStrict(config);
|
|
175
|
+
assert.equal(result.ok, false);
|
|
176
|
+
if (result.ok)
|
|
177
|
+
return;
|
|
178
|
+
assert.ok(result.issues.some((issue) => issue.issue.includes("webhooks.identityUrl")));
|
|
179
|
+
});
|
|
132
180
|
});
|
package/dist/core/config.d.ts
CHANGED
|
@@ -441,6 +441,7 @@ export declare const DuctConfigSchema: z.ZodObject<{
|
|
|
441
441
|
defaultLevel: z.ZodEnum<["none", "read", "write", "admin"]>;
|
|
442
442
|
actionOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<["none", "read", "write", "admin"]>>>;
|
|
443
443
|
allowedCallers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
444
|
+
allowedCallees: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
444
445
|
requireUserConsent: z.ZodBoolean;
|
|
445
446
|
allowedActions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
446
447
|
validFrom: z.ZodOptional<z.ZodString>;
|
|
@@ -451,6 +452,7 @@ export declare const DuctConfigSchema: z.ZodObject<{
|
|
|
451
452
|
requireUserConsent: boolean;
|
|
452
453
|
actionOverrides?: Record<string, "none" | "read" | "write" | "admin"> | undefined;
|
|
453
454
|
allowedCallers?: string[] | undefined;
|
|
455
|
+
allowedCallees?: string[] | undefined;
|
|
454
456
|
allowedActions?: string[] | undefined;
|
|
455
457
|
validFrom?: string | undefined;
|
|
456
458
|
validUntil?: string | undefined;
|
|
@@ -460,6 +462,7 @@ export declare const DuctConfigSchema: z.ZodObject<{
|
|
|
460
462
|
requireUserConsent: boolean;
|
|
461
463
|
actionOverrides?: Record<string, "none" | "read" | "write" | "admin"> | undefined;
|
|
462
464
|
allowedCallers?: string[] | undefined;
|
|
465
|
+
allowedCallees?: string[] | undefined;
|
|
463
466
|
allowedActions?: string[] | undefined;
|
|
464
467
|
validFrom?: string | undefined;
|
|
465
468
|
validUntil?: string | undefined;
|
|
@@ -563,6 +566,19 @@ export declare const DuctConfigSchema: z.ZodObject<{
|
|
|
563
566
|
}>>;
|
|
564
567
|
registry_visibility: z.ZodDefault<z.ZodOptional<z.ZodEnum<["public", "private"]>>>;
|
|
565
568
|
intershell_enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
569
|
+
webhooks: z.ZodOptional<z.ZodObject<{
|
|
570
|
+
consentCallback: z.ZodOptional<z.ZodString>;
|
|
571
|
+
identityUrl: z.ZodOptional<z.ZodString>;
|
|
572
|
+
secret: z.ZodOptional<z.ZodString>;
|
|
573
|
+
}, "strip", z.ZodTypeAny, {
|
|
574
|
+
consentCallback?: string | undefined;
|
|
575
|
+
identityUrl?: string | undefined;
|
|
576
|
+
secret?: string | undefined;
|
|
577
|
+
}, {
|
|
578
|
+
consentCallback?: string | undefined;
|
|
579
|
+
identityUrl?: string | undefined;
|
|
580
|
+
secret?: string | undefined;
|
|
581
|
+
}>>;
|
|
566
582
|
}, "strip", z.ZodTypeAny, {
|
|
567
583
|
auth: {
|
|
568
584
|
strategy: "none" | "nextauth" | "clerk" | "auth0" | "custom-jwt" | "session-cookie" | "unknown";
|
|
@@ -691,6 +707,7 @@ export declare const DuctConfigSchema: z.ZodObject<{
|
|
|
691
707
|
requireUserConsent: boolean;
|
|
692
708
|
actionOverrides?: Record<string, "none" | "read" | "write" | "admin"> | undefined;
|
|
693
709
|
allowedCallers?: string[] | undefined;
|
|
710
|
+
allowedCallees?: string[] | undefined;
|
|
694
711
|
allowedActions?: string[] | undefined;
|
|
695
712
|
validFrom?: string | undefined;
|
|
696
713
|
validUntil?: string | undefined;
|
|
@@ -726,6 +743,11 @@ export declare const DuctConfigSchema: z.ZodObject<{
|
|
|
726
743
|
dimensions?: string[] | undefined;
|
|
727
744
|
}[];
|
|
728
745
|
} | undefined;
|
|
746
|
+
webhooks?: {
|
|
747
|
+
consentCallback?: string | undefined;
|
|
748
|
+
identityUrl?: string | undefined;
|
|
749
|
+
secret?: string | undefined;
|
|
750
|
+
} | undefined;
|
|
729
751
|
}, {
|
|
730
752
|
auth: {
|
|
731
753
|
strategy: "none" | "nextauth" | "clerk" | "auth0" | "custom-jwt" | "session-cookie" | "unknown";
|
|
@@ -754,6 +776,7 @@ export declare const DuctConfigSchema: z.ZodObject<{
|
|
|
754
776
|
requireUserConsent: boolean;
|
|
755
777
|
actionOverrides?: Record<string, "none" | "read" | "write" | "admin"> | undefined;
|
|
756
778
|
allowedCallers?: string[] | undefined;
|
|
779
|
+
allowedCallees?: string[] | undefined;
|
|
757
780
|
allowedActions?: string[] | undefined;
|
|
758
781
|
validFrom?: string | undefined;
|
|
759
782
|
validUntil?: string | undefined;
|
|
@@ -889,6 +912,11 @@ export declare const DuctConfigSchema: z.ZodObject<{
|
|
|
889
912
|
} | undefined;
|
|
890
913
|
registry_visibility?: "public" | "private" | undefined;
|
|
891
914
|
intershell_enabled?: boolean | undefined;
|
|
915
|
+
webhooks?: {
|
|
916
|
+
consentCallback?: string | undefined;
|
|
917
|
+
identityUrl?: string | undefined;
|
|
918
|
+
secret?: string | undefined;
|
|
919
|
+
} | undefined;
|
|
892
920
|
}>;
|
|
893
921
|
export type ValidatedDuctConfig = z.infer<typeof DuctConfigSchema>;
|
|
894
922
|
export interface DuctConfigValidationIssue {
|
package/dist/core/config.js
CHANGED
|
@@ -119,12 +119,20 @@ const AgentPermissionsSchema = z.object({
|
|
|
119
119
|
defaultLevel: AgentPermissionLevelSchema,
|
|
120
120
|
actionOverrides: z.record(AgentPermissionLevelSchema).optional(),
|
|
121
121
|
allowedCallers: z.array(z.string()).optional(),
|
|
122
|
+
allowedCallees: z
|
|
123
|
+
.array(z.string().regex(/^(shell_[a-z0-9_]+|\*)$/, "allowedCallees entries must be a shell_ id or '*'"))
|
|
124
|
+
.optional(),
|
|
122
125
|
requireUserConsent: z.boolean(),
|
|
123
126
|
allowedActions: z.array(z.string()).optional(),
|
|
124
127
|
validFrom: iso8601Schema.optional(),
|
|
125
128
|
validUntil: iso8601Schema.optional(),
|
|
126
129
|
consentActionScope: z.array(z.string().min(1)).optional(),
|
|
127
130
|
});
|
|
131
|
+
const WebhooksConfigSchema = z.object({
|
|
132
|
+
consentCallback: z.string().url().optional(),
|
|
133
|
+
identityUrl: z.string().url().optional(),
|
|
134
|
+
secret: z.string().optional(),
|
|
135
|
+
});
|
|
128
136
|
const WidgetConfigSchema = z.object({
|
|
129
137
|
primaryColor: z.string().optional(),
|
|
130
138
|
position: z
|
|
@@ -180,6 +188,7 @@ export const DuctConfigSchema = z.object({
|
|
|
180
188
|
dataModel: DataModelSchema.optional(),
|
|
181
189
|
registry_visibility: z.enum(['public', 'private']).optional().default('private'),
|
|
182
190
|
intershell_enabled: z.boolean().optional().default(false),
|
|
191
|
+
webhooks: WebhooksConfigSchema.optional(),
|
|
183
192
|
});
|
|
184
193
|
function zodIssuesToValidationIssues(errors) {
|
|
185
194
|
return errors.map((e) => ({
|
|
@@ -298,6 +307,17 @@ export function crossValidateDuctConfig(data) {
|
|
|
298
307
|
}
|
|
299
308
|
}
|
|
300
309
|
}
|
|
310
|
+
if (data.intershell_enabled) {
|
|
311
|
+
const hasProtectedAction = data.actions.some((action) => action.requiresAuth || action.sideEffects);
|
|
312
|
+
if (hasProtectedAction && !data.webhooks?.identityUrl) {
|
|
313
|
+
issues.push({
|
|
314
|
+
severity: "error",
|
|
315
|
+
area: "webhooks",
|
|
316
|
+
issue: "intershell_enabled shells with protected actions must configure webhooks.identityUrl",
|
|
317
|
+
fix: "Set webhooks.identityUrl to the company's identity resolver route, or disable intershell_enabled",
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
}
|
|
301
321
|
return issues;
|
|
302
322
|
}
|
|
303
323
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { describe, it } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { createHmac } from 'crypto';
|
|
4
|
+
import { verifyEvidenceBundle } from './evidence-bundle.js';
|
|
5
|
+
import { computeReceiptId } from './receipt.js';
|
|
6
|
+
import { canonicalizeJson } from './jcs.js';
|
|
7
|
+
const HMAC_SECRET = 'conformance-fixture-secret-32bytes!!';
|
|
8
|
+
function signReceipt(body) {
|
|
9
|
+
const receipt_id = computeReceiptId(body);
|
|
10
|
+
const signature = createHmac('sha256', HMAC_SECRET).update(canonicalizeJson(body)).digest('hex');
|
|
11
|
+
return { ...body, receipt_id, signature, kid: 'duct-gateway-hs256-v1' };
|
|
12
|
+
}
|
|
13
|
+
function goldenReadActionBundle() {
|
|
14
|
+
const gate = signReceipt({
|
|
15
|
+
claim_type: 'duct:action:v1',
|
|
16
|
+
issued_at: '2026-01-01T00:00:01.000Z',
|
|
17
|
+
shell_id: 'shell_fixture',
|
|
18
|
+
action_id: 'get_items',
|
|
19
|
+
caller_type: 'human',
|
|
20
|
+
decision: 'permit',
|
|
21
|
+
reason: 'Passes all permission checks',
|
|
22
|
+
permission_source: 'default',
|
|
23
|
+
capture_mode: 'gateway_observed',
|
|
24
|
+
scope_of_claim: {
|
|
25
|
+
asserts: ['gate'],
|
|
26
|
+
does_not_assert: ['upstream'],
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
const execution = signReceipt({
|
|
30
|
+
claim_type: 'duct:execution:v1',
|
|
31
|
+
issued_at: '2026-01-01T00:00:05.000Z',
|
|
32
|
+
shell_id: 'shell_fixture',
|
|
33
|
+
action_id: 'get_items',
|
|
34
|
+
caller_type: 'human',
|
|
35
|
+
decision: 'permit',
|
|
36
|
+
reason: 'upstream_observed',
|
|
37
|
+
permission_source: 'gateway',
|
|
38
|
+
capture_mode: 'gateway_observed',
|
|
39
|
+
scope_of_claim: {
|
|
40
|
+
asserts: ['dispatch'],
|
|
41
|
+
does_not_assert: ['business correctness'],
|
|
42
|
+
},
|
|
43
|
+
gate_receipt_ref: gate.receipt_id,
|
|
44
|
+
execution_id: 'EX123',
|
|
45
|
+
upstream_status_class: 'success',
|
|
46
|
+
});
|
|
47
|
+
return {
|
|
48
|
+
manifest: {
|
|
49
|
+
schema: 'duct:audit-evidence:v1',
|
|
50
|
+
bundle_id: 'fixture-read-action',
|
|
51
|
+
exported_at: '2026-01-01T00:10:00.000Z',
|
|
52
|
+
shell_id: 'shell_fixture',
|
|
53
|
+
company_id: 'co_fixture',
|
|
54
|
+
profile: 'standard',
|
|
55
|
+
completeness: 'complete',
|
|
56
|
+
complete: true,
|
|
57
|
+
non_claims: [
|
|
58
|
+
'does_not_assert_llm_reasoning_correctness',
|
|
59
|
+
'does_not_assert_upstream_business_data_correctness',
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
conversation: [
|
|
63
|
+
{
|
|
64
|
+
turn_id: 't_fixture',
|
|
65
|
+
message_preview: 'show my items',
|
|
66
|
+
reply_preview: 'Here are your items.',
|
|
67
|
+
occurred_at: '2026-01-01T00:00:00.000Z',
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
evidence_events: [
|
|
71
|
+
{ stage: 'request_observed' },
|
|
72
|
+
{ stage: 'action_selected' },
|
|
73
|
+
{ stage: 'policy_decided' },
|
|
74
|
+
{ stage: 'upstream_dispatched' },
|
|
75
|
+
{ stage: 'upstream_completed' },
|
|
76
|
+
{ stage: 'response_delivered' },
|
|
77
|
+
],
|
|
78
|
+
receipts: [gate, execution],
|
|
79
|
+
redaction_ledger: [],
|
|
80
|
+
integrity: { valid: true, window_size: 1 },
|
|
81
|
+
replay_descriptor: {
|
|
82
|
+
executions: [
|
|
83
|
+
{
|
|
84
|
+
execution_id: 'EX123',
|
|
85
|
+
action_id: 'get_items',
|
|
86
|
+
request_hash: 'abc123',
|
|
87
|
+
result_hash: 'def456',
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
sandbox_only: true,
|
|
91
|
+
requires_fresh_approval: true,
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
describe('evidence bundle conformance fixtures', () => {
|
|
96
|
+
it('verifies the golden read-action scenario', () => {
|
|
97
|
+
const bundle = goldenReadActionBundle();
|
|
98
|
+
const result = verifyEvidenceBundle(bundle, { hmacSecret: HMAC_SECRET });
|
|
99
|
+
assert.equal(result.valid, true);
|
|
100
|
+
assert.equal(result.verified_receipts, 2);
|
|
101
|
+
assert.equal(result.completeness, 'complete');
|
|
102
|
+
assert.deepEqual(result.missing_stages, []);
|
|
103
|
+
});
|
|
104
|
+
it('flags partial bundles with warnings', () => {
|
|
105
|
+
const bundle = goldenReadActionBundle();
|
|
106
|
+
bundle.manifest.completeness = 'partial';
|
|
107
|
+
const result = verifyEvidenceBundle(bundle, { hmacSecret: HMAC_SECRET });
|
|
108
|
+
assert.ok(result.warnings.some((w) => w.includes('partial')));
|
|
109
|
+
});
|
|
110
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Offline verification for duct:audit-evidence:v1 bundles.
|
|
3
|
+
*/
|
|
4
|
+
import { type ReceiptJwks, type SignedDuctReceipt, type VerifyReceiptOptions } from "./receipt.js";
|
|
5
|
+
export interface EvidenceBundleManifest {
|
|
6
|
+
schema: string;
|
|
7
|
+
bundle_id: string;
|
|
8
|
+
exported_at: string;
|
|
9
|
+
shell_id: string;
|
|
10
|
+
company_id: string;
|
|
11
|
+
profile: string;
|
|
12
|
+
completeness: "legacy" | "partial" | "complete";
|
|
13
|
+
complete: boolean;
|
|
14
|
+
verification_keys?: ReceiptJwks;
|
|
15
|
+
non_claims?: string[];
|
|
16
|
+
}
|
|
17
|
+
export interface EvidenceBundleIntegrity {
|
|
18
|
+
valid: boolean;
|
|
19
|
+
window_size: number;
|
|
20
|
+
head_hash?: string | null;
|
|
21
|
+
signed_checkpoint?: {
|
|
22
|
+
shell_id: string;
|
|
23
|
+
head_hash: string;
|
|
24
|
+
row_count_at_checkpoint: number;
|
|
25
|
+
issued_at: string;
|
|
26
|
+
signature: string;
|
|
27
|
+
kid: string;
|
|
28
|
+
};
|
|
29
|
+
redacted_count?: number;
|
|
30
|
+
}
|
|
31
|
+
export interface EvidenceBundle {
|
|
32
|
+
manifest: EvidenceBundleManifest;
|
|
33
|
+
conversation: unknown[];
|
|
34
|
+
evidence_events: unknown[];
|
|
35
|
+
receipts: SignedDuctReceipt[];
|
|
36
|
+
integrity?: EvidenceBundleIntegrity;
|
|
37
|
+
redaction_ledger: unknown[];
|
|
38
|
+
replay_descriptor?: {
|
|
39
|
+
executions: unknown[];
|
|
40
|
+
sandbox_only: boolean;
|
|
41
|
+
requires_fresh_approval: boolean;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export interface VerifyEvidenceBundleResult {
|
|
45
|
+
valid: boolean;
|
|
46
|
+
schema: string;
|
|
47
|
+
completeness: string;
|
|
48
|
+
verified_receipts: number;
|
|
49
|
+
failed_receipts: Array<{
|
|
50
|
+
receipt_id?: string;
|
|
51
|
+
reason: string;
|
|
52
|
+
}>;
|
|
53
|
+
integrity_valid: boolean;
|
|
54
|
+
missing_stages: string[];
|
|
55
|
+
redacted_fields: string[];
|
|
56
|
+
non_claims: string[];
|
|
57
|
+
warnings: string[];
|
|
58
|
+
}
|
|
59
|
+
export declare function verifyEvidenceBundle(bundle: EvidenceBundle, options?: VerifyReceiptOptions): VerifyEvidenceBundleResult;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Offline verification for duct:audit-evidence:v1 bundles.
|
|
3
|
+
*/
|
|
4
|
+
import { verifyReceipt } from "./receipt.js";
|
|
5
|
+
export function verifyEvidenceBundle(bundle, options = {}) {
|
|
6
|
+
const warnings = [];
|
|
7
|
+
const failedReceipts = [];
|
|
8
|
+
let verifiedReceipts = 0;
|
|
9
|
+
const jwks = bundle.manifest.verification_keys ?? options.jwks;
|
|
10
|
+
const verifyOpts = { ...options, jwks: jwks ?? options.jwks };
|
|
11
|
+
for (const raw of bundle.receipts) {
|
|
12
|
+
const result = verifyReceipt(raw, verifyOpts);
|
|
13
|
+
if (result.valid) {
|
|
14
|
+
verifiedReceipts += 1;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
failedReceipts.push({
|
|
18
|
+
receipt_id: raw.receipt_id,
|
|
19
|
+
reason: result.reason,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const stages = new Set(bundle.evidence_events.map((e) => e.stage).filter(Boolean));
|
|
24
|
+
const required = [
|
|
25
|
+
"request_observed",
|
|
26
|
+
"policy_decided",
|
|
27
|
+
"upstream_dispatched",
|
|
28
|
+
"upstream_completed",
|
|
29
|
+
"response_delivered",
|
|
30
|
+
];
|
|
31
|
+
const missingStages = required.filter((s) => !stages.has(s));
|
|
32
|
+
const redactedFields = [];
|
|
33
|
+
for (const ev of bundle.evidence_events) {
|
|
34
|
+
const fields = ev.disclosed_fields;
|
|
35
|
+
if (!fields)
|
|
36
|
+
continue;
|
|
37
|
+
for (const f of fields) {
|
|
38
|
+
if (f.mode === "redacted" || f.mode === "masked") {
|
|
39
|
+
redactedFields.push(f.key);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (bundle.manifest.completeness === "partial") {
|
|
44
|
+
warnings.push("Bundle completeness is partial — some evidence stages may be missing");
|
|
45
|
+
}
|
|
46
|
+
if (bundle.integrity && !bundle.integrity.valid) {
|
|
47
|
+
warnings.push("Hash chain integrity check failed for included window");
|
|
48
|
+
}
|
|
49
|
+
if (!bundle.manifest.complete) {
|
|
50
|
+
warnings.push("Bundle is paginated — additional pages may be required");
|
|
51
|
+
}
|
|
52
|
+
const integrityValid = bundle.integrity?.valid !== false;
|
|
53
|
+
const valid = failedReceipts.length === 0 &&
|
|
54
|
+
integrityValid &&
|
|
55
|
+
bundle.manifest.schema === "duct:audit-evidence:v1";
|
|
56
|
+
return {
|
|
57
|
+
valid,
|
|
58
|
+
schema: bundle.manifest.schema,
|
|
59
|
+
completeness: bundle.manifest.completeness,
|
|
60
|
+
verified_receipts: verifiedReceipts,
|
|
61
|
+
failed_receipts: failedReceipts,
|
|
62
|
+
integrity_valid: integrityValid,
|
|
63
|
+
missing_stages: missingStages,
|
|
64
|
+
redacted_fields: [...new Set(redactedFields)],
|
|
65
|
+
non_claims: bundle.manifest.non_claims ?? [],
|
|
66
|
+
warnings,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { describe, it } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { createHmac } from 'crypto';
|
|
4
|
+
import { verifyEvidenceBundle } from './evidence-bundle.js';
|
|
5
|
+
import { computeReceiptId } from './receipt.js';
|
|
6
|
+
import { canonicalizeJson } from './jcs.js';
|
|
7
|
+
const HMAC_SECRET = 'x'.repeat(32);
|
|
8
|
+
function minimalReceipt() {
|
|
9
|
+
const body = {
|
|
10
|
+
claim_type: 'duct:action:v1',
|
|
11
|
+
issued_at: new Date().toISOString(),
|
|
12
|
+
shell_id: 'shell_test',
|
|
13
|
+
action_id: 'get_items',
|
|
14
|
+
caller_type: 'human',
|
|
15
|
+
decision: 'permit',
|
|
16
|
+
reason: 'Passes all permission checks',
|
|
17
|
+
permission_source: 'default',
|
|
18
|
+
capture_mode: 'gateway_observed',
|
|
19
|
+
scope_of_claim: {
|
|
20
|
+
asserts: ['test'],
|
|
21
|
+
does_not_assert: ['test'],
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
const receipt_id = computeReceiptId(body);
|
|
25
|
+
const canonical = canonicalizeJson(body);
|
|
26
|
+
const signature = createHmac('sha256', HMAC_SECRET).update(canonical).digest('hex');
|
|
27
|
+
return { ...body, receipt_id, signature, kid: 'duct-gateway-hs256-v1' };
|
|
28
|
+
}
|
|
29
|
+
describe('verifyEvidenceBundle', () => {
|
|
30
|
+
it('validates a minimal complete bundle', () => {
|
|
31
|
+
const receipt = minimalReceipt();
|
|
32
|
+
const result = verifyEvidenceBundle({
|
|
33
|
+
manifest: {
|
|
34
|
+
schema: 'duct:audit-evidence:v1',
|
|
35
|
+
bundle_id: 'b1',
|
|
36
|
+
exported_at: new Date().toISOString(),
|
|
37
|
+
shell_id: 'shell_test',
|
|
38
|
+
company_id: 'co_1',
|
|
39
|
+
profile: 'standard',
|
|
40
|
+
completeness: 'complete',
|
|
41
|
+
complete: true,
|
|
42
|
+
},
|
|
43
|
+
conversation: [],
|
|
44
|
+
evidence_events: [
|
|
45
|
+
{ stage: 'request_observed' },
|
|
46
|
+
{ stage: 'policy_decided' },
|
|
47
|
+
{ stage: 'upstream_dispatched' },
|
|
48
|
+
{ stage: 'upstream_completed' },
|
|
49
|
+
{ stage: 'response_delivered' },
|
|
50
|
+
],
|
|
51
|
+
receipts: [receipt],
|
|
52
|
+
redaction_ledger: [],
|
|
53
|
+
integrity: { valid: true, window_size: 1 },
|
|
54
|
+
}, { hmacSecret: HMAC_SECRET });
|
|
55
|
+
assert.equal(result.valid, true);
|
|
56
|
+
assert.equal(result.verified_receipts, 1);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
@@ -23,6 +23,8 @@ export declare const ReadinessReportSchema: z.ZodObject<{
|
|
|
23
23
|
ok: z.ZodBoolean;
|
|
24
24
|
generatedAt: z.ZodString;
|
|
25
25
|
docsUrl: z.ZodOptional<z.ZodString>;
|
|
26
|
+
/** Marketing site status page — used by dashboard shell readiness. */
|
|
27
|
+
statusUrl: z.ZodOptional<z.ZodString>;
|
|
26
28
|
checks: z.ZodArray<z.ZodObject<{
|
|
27
29
|
id: z.ZodString;
|
|
28
30
|
label: z.ZodString;
|
|
@@ -53,6 +55,7 @@ export declare const ReadinessReportSchema: z.ZodObject<{
|
|
|
53
55
|
url?: string | undefined;
|
|
54
56
|
}[];
|
|
55
57
|
docsUrl?: string | undefined;
|
|
58
|
+
statusUrl?: string | undefined;
|
|
56
59
|
}, {
|
|
57
60
|
ok: boolean;
|
|
58
61
|
generatedAt: string;
|
|
@@ -64,6 +67,7 @@ export declare const ReadinessReportSchema: z.ZodObject<{
|
|
|
64
67
|
url?: string | undefined;
|
|
65
68
|
}[];
|
|
66
69
|
docsUrl?: string | undefined;
|
|
70
|
+
statusUrl?: string | undefined;
|
|
67
71
|
}>;
|
|
68
72
|
export type ReadinessCheckStatus = z.infer<typeof ReadinessCheckStatusSchema>;
|
|
69
73
|
export type ReadinessCheck = z.infer<typeof ReadinessCheckSchema>;
|
|
@@ -96,6 +100,24 @@ export interface CliReadinessOptions {
|
|
|
96
100
|
probe?: (url: string) => Promise<HealthProbeResult>;
|
|
97
101
|
}
|
|
98
102
|
export declare function buildCliReadinessReport(options: CliReadinessOptions): Promise<ReadinessReport>;
|
|
103
|
+
export interface ReachabilityProbeResult {
|
|
104
|
+
/** True when any HTTP response was received (including 4xx/5xx). */
|
|
105
|
+
reachable: boolean;
|
|
106
|
+
status?: number;
|
|
107
|
+
error?: string;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Probe whether a URL accepts connections. Any HTTP response counts as reachable;
|
|
111
|
+
* only network errors / timeouts do not.
|
|
112
|
+
*/
|
|
113
|
+
export declare function probeReachable(url: string, timeoutMs?: number, fetchFn?: typeof fetch): Promise<ReachabilityProbeResult>;
|
|
114
|
+
/** Rewrite loopback hosts so a Dockerized probe can reach the operator's machine. */
|
|
115
|
+
export declare function rewriteLoopbackForDocker(url: string): string | null;
|
|
116
|
+
/**
|
|
117
|
+
* Probe a product base URL, retrying once via host.docker.internal when the
|
|
118
|
+
* configured host is loopback.
|
|
119
|
+
*/
|
|
120
|
+
export declare function probeProductBaseUrl(url: string, fetchFn?: typeof fetch): Promise<ReachabilityProbeResult>;
|
|
99
121
|
export interface ShellReadinessInput {
|
|
100
122
|
shellId: string;
|
|
101
123
|
manifestPushed: boolean;
|
|
@@ -103,11 +125,7 @@ export interface ShellReadinessInput {
|
|
|
103
125
|
actionCount: number;
|
|
104
126
|
recentMessages: number;
|
|
105
127
|
recentInvokeTurns: number;
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
apiHealthUrl: string;
|
|
109
|
-
docsUrl: string;
|
|
110
|
-
};
|
|
111
|
-
probe?: (url: string) => Promise<HealthProbeResult>;
|
|
128
|
+
statusUrl?: string;
|
|
129
|
+
probeProduct?: (url: string) => Promise<ReachabilityProbeResult>;
|
|
112
130
|
}
|
|
113
131
|
export declare function buildShellReadinessReport(input: ShellReadinessInput): Promise<ReadinessReport>;
|
|
@@ -11,6 +11,8 @@ export const ReadinessReportSchema = z.object({
|
|
|
11
11
|
ok: z.boolean(),
|
|
12
12
|
generatedAt: z.string(),
|
|
13
13
|
docsUrl: z.string().optional(),
|
|
14
|
+
/** Marketing site status page — used by dashboard shell readiness. */
|
|
15
|
+
statusUrl: z.string().optional(),
|
|
14
16
|
checks: z.array(ReadinessCheckSchema),
|
|
15
17
|
});
|
|
16
18
|
export function readinessReportOk(checks) {
|
|
@@ -69,42 +71,92 @@ export async function buildCliReadinessReport(options) {
|
|
|
69
71
|
checks,
|
|
70
72
|
};
|
|
71
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Probe whether a URL accepts connections. Any HTTP response counts as reachable;
|
|
76
|
+
* only network errors / timeouts do not.
|
|
77
|
+
*/
|
|
78
|
+
export async function probeReachable(url, timeoutMs = 3000, fetchFn = fetch) {
|
|
79
|
+
const controller = new AbortController();
|
|
80
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
81
|
+
try {
|
|
82
|
+
const response = await fetchFn(url, {
|
|
83
|
+
signal: controller.signal,
|
|
84
|
+
redirect: 'follow',
|
|
85
|
+
method: 'GET',
|
|
86
|
+
});
|
|
87
|
+
return { reachable: true, status: response.status };
|
|
88
|
+
}
|
|
89
|
+
catch (err) {
|
|
90
|
+
return {
|
|
91
|
+
reachable: false,
|
|
92
|
+
error: err instanceof Error ? err.message : String(err),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
finally {
|
|
96
|
+
clearTimeout(timer);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/** Rewrite loopback hosts so a Dockerized probe can reach the operator's machine. */
|
|
100
|
+
export function rewriteLoopbackForDocker(url) {
|
|
101
|
+
try {
|
|
102
|
+
const parsed = new URL(url);
|
|
103
|
+
if (parsed.hostname !== 'localhost' && parsed.hostname !== '127.0.0.1') {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
parsed.hostname = 'host.docker.internal';
|
|
107
|
+
return parsed.toString();
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Probe a product base URL, retrying once via host.docker.internal when the
|
|
115
|
+
* configured host is loopback.
|
|
116
|
+
*/
|
|
117
|
+
export async function probeProductBaseUrl(url, fetchFn = fetch) {
|
|
118
|
+
const first = await probeReachable(url, 3000, fetchFn);
|
|
119
|
+
if (first.reachable)
|
|
120
|
+
return first;
|
|
121
|
+
const rewritten = rewriteLoopbackForDocker(url);
|
|
122
|
+
if (!rewritten || rewritten === url)
|
|
123
|
+
return first;
|
|
124
|
+
const second = await probeReachable(rewritten, 3000, fetchFn);
|
|
125
|
+
if (second.reachable)
|
|
126
|
+
return second;
|
|
127
|
+
return first;
|
|
128
|
+
}
|
|
72
129
|
export async function buildShellReadinessReport(input) {
|
|
73
|
-
const probe = input.
|
|
130
|
+
const probe = input.probeProduct ?? ((url) => probeProductBaseUrl(url));
|
|
74
131
|
const checks = [];
|
|
75
132
|
checks.push(makeCheck('manifest_pushed', 'Manifest pushed', input.manifestPushed ? 'pass' : 'fail', {
|
|
76
133
|
message: input.manifestPushed
|
|
77
134
|
? 'Shell status is live'
|
|
78
135
|
: 'Run npx duct push to publish your manifest',
|
|
79
|
-
}), makeCheck('product_base_url', 'Product base URL', input.productBaseUrl ? 'pass' : 'warn', {
|
|
80
|
-
message: input.productBaseUrl || 'Set product.baseUrl in duct.config.ts',
|
|
81
|
-
}), makeCheck('actions_defined', 'Actions defined', input.actionCount > 0 ? 'pass' : 'fail', { message: `${input.actionCount} action(s) in manifest` }), makeCheck('recent_activity', 'Recent shell activity', input.recentMessages > 0 || input.recentInvokeTurns > 0 ? 'pass' : 'warn', {
|
|
82
|
-
message: input.recentMessages > 0 || input.recentInvokeTurns > 0
|
|
83
|
-
? `${input.recentMessages} message(s), ${input.recentInvokeTurns} agent invoke(s) in the last 30 days`
|
|
84
|
-
: 'No messages or agent invokes yet — try the playground',
|
|
85
136
|
}));
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
]) {
|
|
90
|
-
const result = await probe(url);
|
|
91
|
-
checks.push(makeCheck(id, label, result.ok ? 'pass' : 'fail', {
|
|
92
|
-
url,
|
|
93
|
-
message: result.ok
|
|
94
|
-
? 'Reachable'
|
|
95
|
-
: result.status !== undefined
|
|
96
|
-
? `HTTP ${result.status}`
|
|
97
|
-
: result.error ?? 'unreachable',
|
|
137
|
+
if (!input.productBaseUrl) {
|
|
138
|
+
checks.push(makeCheck('product_base_url', 'Product base URL', 'warn', {
|
|
139
|
+
message: 'Set product.baseUrl in duct.config.ts',
|
|
98
140
|
}));
|
|
99
141
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
142
|
+
else {
|
|
143
|
+
const result = await probe(input.productBaseUrl);
|
|
144
|
+
checks.push(makeCheck('product_base_url', 'Product base URL', result.reachable ? 'pass' : 'fail', {
|
|
145
|
+
url: input.productBaseUrl,
|
|
146
|
+
message: result.reachable
|
|
147
|
+
? input.productBaseUrl
|
|
148
|
+
: `${input.productBaseUrl} — ${result.error ?? 'unreachable'}`,
|
|
149
|
+
}));
|
|
150
|
+
}
|
|
151
|
+
checks.push(makeCheck('actions_defined', 'Actions defined', input.actionCount > 0 ? 'pass' : 'fail', { message: `${input.actionCount} action(s) in manifest` }), makeCheck('recent_activity', 'Recent shell activity', input.recentMessages > 0 || input.recentInvokeTurns > 0 ? 'pass' : 'warn', {
|
|
152
|
+
message: input.recentMessages > 0 || input.recentInvokeTurns > 0
|
|
153
|
+
? `${input.recentMessages} message(s), ${input.recentInvokeTurns} agent invoke(s) in the last 30 days`
|
|
154
|
+
: 'No messages or agent invokes yet — try the playground',
|
|
103
155
|
}));
|
|
104
156
|
return {
|
|
105
157
|
ok: readinessReportOk(checks),
|
|
106
158
|
generatedAt: new Date().toISOString(),
|
|
107
|
-
|
|
159
|
+
statusUrl: input.statusUrl,
|
|
108
160
|
checks,
|
|
109
161
|
};
|
|
110
162
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, it } from 'node:test';
|
|
2
2
|
import assert from 'node:assert/strict';
|
|
3
|
-
import { ReadinessReportSchema, buildCliReadinessReport, readinessReportOk, } from './readiness-checks.js';
|
|
3
|
+
import { ReadinessReportSchema, buildCliReadinessReport, buildShellReadinessReport, probeProductBaseUrl, readinessReportOk, rewriteLoopbackForDocker, } from './readiness-checks.js';
|
|
4
4
|
describe('readiness-checks', () => {
|
|
5
5
|
it('buildCliReadinessReport emits schema-valid output', async () => {
|
|
6
6
|
const report = await buildCliReadinessReport({
|
|
@@ -46,4 +46,61 @@ describe('readiness-checks', () => {
|
|
|
46
46
|
const api = report.checks.find((c) => c.id === 'api_reachable');
|
|
47
47
|
assert.equal(api?.status, 'fail');
|
|
48
48
|
});
|
|
49
|
+
it('rewriteLoopbackForDocker rewrites localhost hosts', () => {
|
|
50
|
+
assert.equal(rewriteLoopbackForDocker('http://localhost:5173'), 'http://host.docker.internal:5173/');
|
|
51
|
+
assert.equal(rewriteLoopbackForDocker('https://app.example.com'), null);
|
|
52
|
+
});
|
|
53
|
+
it('probeProductBaseUrl retries via host.docker.internal', async () => {
|
|
54
|
+
const attempted = [];
|
|
55
|
+
const fetchFn = (async (input) => {
|
|
56
|
+
const url = String(input);
|
|
57
|
+
attempted.push(url);
|
|
58
|
+
if (url.includes('host.docker.internal')) {
|
|
59
|
+
return new Response('ok', { status: 200 });
|
|
60
|
+
}
|
|
61
|
+
throw new Error('fetch failed');
|
|
62
|
+
});
|
|
63
|
+
const result = await probeProductBaseUrl('http://localhost:5173', fetchFn);
|
|
64
|
+
assert.equal(result.reachable, true);
|
|
65
|
+
assert.deepEqual(attempted, [
|
|
66
|
+
'http://localhost:5173',
|
|
67
|
+
'http://host.docker.internal:5173/',
|
|
68
|
+
]);
|
|
69
|
+
});
|
|
70
|
+
it('buildShellReadinessReport is shell-only and probes product URL', async () => {
|
|
71
|
+
const report = await buildShellReadinessReport({
|
|
72
|
+
shellId: 'shell_test',
|
|
73
|
+
manifestPushed: true,
|
|
74
|
+
productBaseUrl: 'http://localhost:5173',
|
|
75
|
+
actionCount: 2,
|
|
76
|
+
recentMessages: 1,
|
|
77
|
+
recentInvokeTurns: 0,
|
|
78
|
+
statusUrl: 'http://localhost:3005/status',
|
|
79
|
+
probeProduct: async () => ({ reachable: false, error: 'fetch failed' }),
|
|
80
|
+
});
|
|
81
|
+
assert.equal(ReadinessReportSchema.safeParse(report).success, true);
|
|
82
|
+
assert.equal(report.ok, false);
|
|
83
|
+
assert.equal(report.statusUrl, 'http://localhost:3005/status');
|
|
84
|
+
assert.equal(report.checks.length, 4);
|
|
85
|
+
assert.ok(!report.checks.some((c) => c.id === 'auth_reachable'));
|
|
86
|
+
assert.ok(!report.checks.some((c) => c.id === 'api_reachable'));
|
|
87
|
+
assert.ok(!report.checks.some((c) => c.id === 'docs_url'));
|
|
88
|
+
const product = report.checks.find((c) => c.id === 'product_base_url');
|
|
89
|
+
assert.equal(product?.status, 'fail');
|
|
90
|
+
assert.match(product?.message ?? '', /fetch failed/);
|
|
91
|
+
});
|
|
92
|
+
it('buildShellReadinessReport passes when product URL is reachable', async () => {
|
|
93
|
+
const report = await buildShellReadinessReport({
|
|
94
|
+
shellId: 'shell_test',
|
|
95
|
+
manifestPushed: true,
|
|
96
|
+
productBaseUrl: 'http://localhost:5173',
|
|
97
|
+
actionCount: 1,
|
|
98
|
+
recentMessages: 0,
|
|
99
|
+
recentInvokeTurns: 1,
|
|
100
|
+
probeProduct: async () => ({ reachable: true, status: 200 }),
|
|
101
|
+
});
|
|
102
|
+
assert.equal(report.ok, true);
|
|
103
|
+
const product = report.checks.find((c) => c.id === 'product_base_url');
|
|
104
|
+
assert.equal(product?.status, 'pass');
|
|
105
|
+
});
|
|
49
106
|
});
|
package/dist/core/receipt.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type ReceiptClaimType = "duct:action:v1" | "duct:authority:v1" | "duct:intent:v1";
|
|
1
|
+
export type ReceiptClaimType = "duct:action:v1" | "duct:authority:v1" | "duct:intent:v1" | "duct:execution:v1";
|
|
2
2
|
export type ReceiptDecision = "permit" | "deny" | "ask";
|
|
3
3
|
export type ReceiptCaptureMode = "gateway_observed" | "self_attested";
|
|
4
4
|
export type ReceiptRejectionReason = "WRONG_CLAIM" | "INVALID_SIGNATURE" | "RECEIPT_ID_MISMATCH" | "SIGNING_KEY_UNAVAILABLE";
|
|
@@ -23,6 +23,10 @@ export interface DuctReceiptBody {
|
|
|
23
23
|
capture_mode: ReceiptCaptureMode;
|
|
24
24
|
scope_of_claim: ScopeOfClaim;
|
|
25
25
|
intent_ref?: string;
|
|
26
|
+
upstream_status_class?: string;
|
|
27
|
+
result_hash?: string;
|
|
28
|
+
execution_id?: string;
|
|
29
|
+
gate_receipt_ref?: string;
|
|
26
30
|
}
|
|
27
31
|
export interface SignedDuctReceipt extends DuctReceiptBody {
|
|
28
32
|
receipt_id: string;
|
package/dist/core/types.d.ts
CHANGED
|
@@ -273,6 +273,13 @@ export interface AgentPermissions {
|
|
|
273
273
|
* To close this shell to cross-shell calls entirely, set intershell_enabled: false.
|
|
274
274
|
*/
|
|
275
275
|
allowedCallers?: string[];
|
|
276
|
+
/**
|
|
277
|
+
* Optional egress restriction: if set (non-empty), this shell may ONLY call the listed
|
|
278
|
+
* shell IDs cross-shell. Absent/empty = may call any shell that admits it (subject to
|
|
279
|
+
* the target's inbound gate). '*' = explicitly open egress.
|
|
280
|
+
* Cross-company calls additionally require the target to admit this shell AND be verified.
|
|
281
|
+
*/
|
|
282
|
+
allowedCallees?: string[];
|
|
276
283
|
/** Whether to require explicit user consent for agent actions */
|
|
277
284
|
requireUserConsent: boolean;
|
|
278
285
|
/** Allowed actions (action IDs) */
|
|
@@ -491,6 +498,22 @@ export interface DuctConfig {
|
|
|
491
498
|
registry_visibility?: 'public' | 'private';
|
|
492
499
|
/** Master switch: allow other shells to call this one. Default: false */
|
|
493
500
|
intershell_enabled?: boolean;
|
|
501
|
+
/** Identity/consent webhook wiring — required for cross-shell protected actions. */
|
|
502
|
+
webhooks?: WebhooksConfig;
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* Identity/consent webhook wiring for this shell. Read dynamically from manifest JSON
|
|
506
|
+
* by the auth service (`consent-state.ts`); typed here so `duct` can validate that any
|
|
507
|
+
* shell with a requiresAuth/sideEffects action AND intershell_enabled also declares
|
|
508
|
+
* `identityUrl` — otherwise cross-shell protected actions can never be authorized.
|
|
509
|
+
*/
|
|
510
|
+
export interface WebhooksConfig {
|
|
511
|
+
/** Duct redirects the browser here after consent approval to deliver the auth code. */
|
|
512
|
+
consentCallback?: string;
|
|
513
|
+
/** Company identity resolver: thin route wired to the company's existing login/session. */
|
|
514
|
+
identityUrl?: string;
|
|
515
|
+
/** Shared webhook signing secret (whsec_…) used to verify identity vouches + signed callbacks. */
|
|
516
|
+
secret?: string;
|
|
494
517
|
}
|
|
495
518
|
export interface ShellManifest {
|
|
496
519
|
shellId: string;
|
package/dist/core/types.js
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
// ============================================================
|
|
5
5
|
/** Pixel dimensions for each shell preset. Single source of truth. */
|
|
6
6
|
export const SHELL_PRESET_DIMENSIONS = {
|
|
7
|
-
tall: { width: 400, height:
|
|
8
|
-
square: { width: 460, height:
|
|
9
|
-
large: { width: 560, height:
|
|
7
|
+
tall: { width: 400, height: 700 },
|
|
8
|
+
square: { width: 460, height: 540 },
|
|
9
|
+
large: { width: 560, height: 760 },
|
|
10
10
|
};
|
|
11
11
|
export const DEFAULT_SHELL_PRESET = 'tall';
|
|
12
12
|
/** Viewport margins applied to the opened shell panel (matches DuctShell CSS). */
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export type { ValidatedDuctConfig, ManifestAction, ErrorEnvelope, ConfirmationSt
|
|
|
3
3
|
export { generateDuctToken, verifyDuctToken, generateDeeplinkToken, verifyDeeplinkToken, createDevReplayStore, InMemoryReplayStore, RedisReplayStore, } from "./core/token.js";
|
|
4
4
|
export type { GenerateTokenOptions, GenerateTokenResult, VerifyTokenOptions, VerifyTokenResult, GenerateDeeplinkTokenOptions, GenerateDeeplinkTokenResult, VerifyDeeplinkTokenOptions, VerifyDeeplinkResult, DeeplinkReplayStore, RedisSetClient, } from "./core/token.js";
|
|
5
5
|
export { verifyReceipt, computeReceiptId } from "./core/receipt.js";
|
|
6
|
+
export { verifyEvidenceBundle } from "./core/evidence-bundle.js";
|
|
6
7
|
export type { SignedDuctReceipt, DuctReceiptBody, ReceiptClaimType, ReceiptJwks, VerifyReceiptOptions, VerifyReceiptResult, ReceiptRejectionReason, } from "./core/receipt.js";
|
|
7
8
|
export { buildAction, checkActionPermission, buildActionSearchIndex, shouldDeferActions, } from "./core/action.js";
|
|
8
9
|
export type { ActionSearchEntry } from "./core/action.js";
|
|
@@ -15,4 +16,4 @@ export type { ShellPreset, ShellPanelViewportInsets } from "./core/types.js";
|
|
|
15
16
|
export type { DuctPageContext } from "./core/types.js";
|
|
16
17
|
export { useDuctPageContext } from "./adapters/react/use-page-context.js";
|
|
17
18
|
export type { UseDuctPageContextOptions } from "./adapters/react/use-page-context.js";
|
|
18
|
-
export type { RouteManifest, RouteParam, QueryParam, UIStateHint, ActionManifest, ActionParam, SensitivityLevel, ApprovalPredicate, ApprovalCompareOp, ApprovalLogicalOp, ActionLimitPolicy, ActionRuntimeFields, ActionDef, BuiltActionDef, ActionValidationResult, AuthSchema, AuthStrategy, DeeplinkDefinition, StateField, ReviewResult, ReviewIssue, ReviewIssueSeverity, DuctConfig, ProductConfig, AgentPermissions, AgentPermissionLevel, WidgetConfig, ShellManifest, ModalityDecision, ScoredModalityDecision, ShellSessionPhase, ShellSessionState, ShellSessionType, ShellCallChain, ActionPermissionContext, ActionPermissionResult, PermissionDecision, PermissionRuleSource, SessionContext, Message, DuctTokenPayload, DeeplinkTokenPayload, DuctAdapter, ReceiverOptions, ShellOptions, } from "./core/types.js";
|
|
19
|
+
export type { RouteManifest, RouteParam, QueryParam, UIStateHint, ActionManifest, ActionParam, SensitivityLevel, ApprovalPredicate, ApprovalCompareOp, ApprovalLogicalOp, ActionLimitPolicy, ActionRuntimeFields, ActionDef, BuiltActionDef, ActionValidationResult, AuthSchema, AuthStrategy, DeeplinkDefinition, StateField, ReviewResult, ReviewIssue, ReviewIssueSeverity, DuctConfig, ProductConfig, AgentPermissions, AgentPermissionLevel, WidgetConfig, WebhooksConfig, ShellManifest, ModalityDecision, ScoredModalityDecision, ShellSessionPhase, ShellSessionState, ShellSessionType, ShellCallChain, ActionPermissionContext, ActionPermissionResult, PermissionDecision, PermissionRuleSource, SessionContext, Message, DuctTokenPayload, DeeplinkTokenPayload, DuctAdapter, ReceiverOptions, ShellOptions, } from "./core/types.js";
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ export { defineDuctConfig, DuctConfigSchema, crossValidateDuctConfig, ManifestAc
|
|
|
11
11
|
export { generateDuctToken, verifyDuctToken, generateDeeplinkToken, verifyDeeplinkToken, createDevReplayStore, InMemoryReplayStore, RedisReplayStore, } from "./core/token.js";
|
|
12
12
|
// Outcome receipt verification (crypto layer)
|
|
13
13
|
export { verifyReceipt, computeReceiptId } from "./core/receipt.js";
|
|
14
|
+
export { verifyEvidenceBundle } from "./core/evidence-bundle.js";
|
|
14
15
|
// Action factory
|
|
15
16
|
export { buildAction, checkActionPermission, buildActionSearchIndex, shouldDeferActions, } from "./core/action.js";
|
|
16
17
|
// Shell status (server-side)
|
package/dist/server.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export type { ValidatedDuctConfig, ManifestAction, ErrorEnvelope, ConfirmationSt
|
|
|
3
3
|
export { generateDuctToken, verifyDuctToken, generateDeeplinkToken, verifyDeeplinkToken, createDevReplayStore, InMemoryReplayStore, RedisReplayStore, } from "./core/token.js";
|
|
4
4
|
export type { GenerateTokenOptions, GenerateTokenResult, VerifyTokenOptions, VerifyTokenResult, GenerateDeeplinkTokenOptions, GenerateDeeplinkTokenResult, VerifyDeeplinkTokenOptions, VerifyDeeplinkResult, DeeplinkReplayStore, RedisSetClient, } from "./core/token.js";
|
|
5
5
|
export { verifyReceipt, computeReceiptId } from "./core/receipt.js";
|
|
6
|
+
export { verifyEvidenceBundle } from "./core/evidence-bundle.js";
|
|
6
7
|
export type { SignedDuctReceipt, DuctReceiptBody, ReceiptClaimType, ReceiptJwks, VerifyReceiptOptions, VerifyReceiptResult, ReceiptRejectionReason, } from "./core/receipt.js";
|
|
7
8
|
export { createIntrospectHandler, createIntrospectPageHandler, createIntrospectExpressHandler, } from "./core/introspect.js";
|
|
8
9
|
export type { IntrospectEntity, IntrospectResult, IntrospectContext, IntrospectResolver, IntrospectHandlerOptions, } from "./core/introspect.js";
|
package/dist/server.js
CHANGED
|
@@ -15,6 +15,7 @@ export { defineDuctConfig, DuctConfigSchema, crossValidateDuctConfig, ManifestAc
|
|
|
15
15
|
export { generateDuctToken, verifyDuctToken, generateDeeplinkToken, verifyDeeplinkToken, createDevReplayStore, InMemoryReplayStore, RedisReplayStore, } from "./core/token.js";
|
|
16
16
|
// Outcome receipt verification (crypto layer)
|
|
17
17
|
export { verifyReceipt, computeReceiptId } from "./core/receipt.js";
|
|
18
|
+
export { verifyEvidenceBundle } from "./core/evidence-bundle.js";
|
|
18
19
|
// Introspect handler factories
|
|
19
20
|
export { createIntrospectHandler, createIntrospectPageHandler, createIntrospectExpressHandler, } from "./core/introspect.js";
|
|
20
21
|
// Page-resolve handler factories (agent deeplink resolution)
|
package/package.json
CHANGED