@duct-sdk/sdk 0.5.4 → 0.5.10

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +10 -10
  3. package/dist/adapters/react/shell.d.ts +2 -2
  4. package/dist/adapters/react/shell.js +1 -2
  5. package/dist/cli/generators/config.test.js +3 -0
  6. package/dist/cli/index.js +216 -36
  7. package/dist/cli/prompts/review.js +14 -0
  8. package/dist/core/config-roundtrip.test.d.ts +1 -0
  9. package/dist/core/config-roundtrip.test.js +180 -0
  10. package/dist/core/config.d.ts +281 -25
  11. package/dist/core/config.js +51 -67
  12. package/dist/core/endpoint-guard.d.ts +27 -0
  13. package/dist/core/endpoint-guard.js +71 -0
  14. package/dist/core/endpoint-guard.test.d.ts +1 -0
  15. package/dist/core/endpoint-guard.test.js +57 -0
  16. package/dist/core/env-diagnostics.d.ts +13 -0
  17. package/dist/core/env-diagnostics.js +63 -0
  18. package/dist/core/env-diagnostics.test.d.ts +1 -0
  19. package/dist/core/env-diagnostics.test.js +31 -0
  20. package/dist/core/evidence-bundle.conformance.test.d.ts +1 -0
  21. package/dist/core/evidence-bundle.conformance.test.js +110 -0
  22. package/dist/core/evidence-bundle.d.ts +59 -0
  23. package/dist/core/evidence-bundle.js +68 -0
  24. package/dist/core/evidence-bundle.test.d.ts +1 -0
  25. package/dist/core/evidence-bundle.test.js +58 -0
  26. package/dist/core/profile.d.ts +44 -0
  27. package/dist/core/profile.js +128 -0
  28. package/dist/core/profile.test.d.ts +1 -0
  29. package/dist/core/profile.test.js +95 -0
  30. package/dist/core/readiness-checks.d.ts +131 -0
  31. package/dist/core/readiness-checks.js +162 -0
  32. package/dist/core/readiness-checks.test.d.ts +1 -0
  33. package/dist/core/readiness-checks.test.js +106 -0
  34. package/dist/core/receipt.d.ts +5 -1
  35. package/dist/core/types.d.ts +23 -0
  36. package/dist/core/types.js +3 -3
  37. package/dist/index.d.ts +4 -3
  38. package/dist/index.js +2 -1
  39. package/dist/server.d.ts +3 -2
  40. package/dist/server.js +2 -1
  41. package/package.json +94 -93
@@ -0,0 +1,162 @@
1
+ import { z } from 'zod';
2
+ export const ReadinessCheckStatusSchema = z.enum(['pass', 'fail', 'warn', 'skip']);
3
+ export const ReadinessCheckSchema = z.object({
4
+ id: z.string(),
5
+ label: z.string(),
6
+ status: ReadinessCheckStatusSchema,
7
+ message: z.string().optional(),
8
+ url: z.string().optional(),
9
+ });
10
+ export const ReadinessReportSchema = z.object({
11
+ ok: z.boolean(),
12
+ generatedAt: z.string(),
13
+ docsUrl: z.string().optional(),
14
+ /** Marketing site status page — used by dashboard shell readiness. */
15
+ statusUrl: z.string().optional(),
16
+ checks: z.array(ReadinessCheckSchema),
17
+ });
18
+ export function readinessReportOk(checks) {
19
+ return !checks.some((check) => check.status === 'fail');
20
+ }
21
+ export async function probeHealth(url, timeoutMs = 3000, fetchFn = fetch) {
22
+ try {
23
+ const controller = new AbortController();
24
+ const timer = setTimeout(() => controller.abort(), timeoutMs);
25
+ const res = await fetchFn(url, { signal: controller.signal });
26
+ clearTimeout(timer);
27
+ return { ok: res.ok, status: res.status };
28
+ }
29
+ catch (err) {
30
+ const message = err instanceof Error ? err.message : String(err);
31
+ return { ok: false, error: message };
32
+ }
33
+ }
34
+ export function makeCheck(id, label, status, extras) {
35
+ return { id, label, status, ...extras };
36
+ }
37
+ export async function buildCliReadinessReport(options) {
38
+ const probe = options.probe ?? ((url) => probeHealth(url));
39
+ const { env, endpoints } = options;
40
+ const checks = [];
41
+ checks.push(makeCheck('env_duct_url', 'DUCT_URL', env.ductUrl ? 'pass' : 'warn', { message: env.ductUrl || 'Not set — using localhost defaults' }), makeCheck('env_shell_id', 'DUCT_SHELL_ID', env.shellId ? 'pass' : 'warn', { message: env.shellId || 'Not set' }), makeCheck('env_secret_key', 'DUCT_SECRET_KEY', env.secretKey ? 'pass' : 'warn', { message: env.secretKey ? `sk_...${env.secretKey.slice(-4)}` : 'Not set' }), makeCheck('auth_logged_in', 'CLI auth profile', env.authEmail ? 'pass' : 'warn', {
42
+ message: env.authEmail
43
+ ? `${env.authEmail} (${env.authSlug ?? 'unknown slug'})`
44
+ : 'Not logged in — run: npx duct login',
45
+ }));
46
+ const serviceChecks = [
47
+ { id: 'auth_reachable', label: 'Auth service', url: endpoints.authHealthUrl },
48
+ { id: 'api_reachable', label: 'Agent API', url: endpoints.apiHealthUrl },
49
+ { id: 'shell_reachable', label: 'Shell runtime', url: endpoints.shellHealthUrl },
50
+ { id: 'dashboard_reachable', label: 'Dashboard', url: endpoints.dashboardHealthUrl },
51
+ ];
52
+ for (const { id, label, url } of serviceChecks) {
53
+ const result = await probe(url);
54
+ checks.push(makeCheck(id, label, result.ok ? 'pass' : 'fail', {
55
+ url,
56
+ message: result.ok
57
+ ? 'Reachable'
58
+ : result.status !== undefined
59
+ ? `HTTP ${result.status}`
60
+ : result.error ?? 'unreachable',
61
+ }));
62
+ }
63
+ checks.push(makeCheck('docs_url', 'Docs URL', 'pass', {
64
+ url: endpoints.docsUrl,
65
+ message: endpoints.docsUrl,
66
+ }));
67
+ return {
68
+ ok: readinessReportOk(checks),
69
+ generatedAt: new Date().toISOString(),
70
+ docsUrl: endpoints.docsUrl,
71
+ checks,
72
+ };
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
+ }
129
+ export async function buildShellReadinessReport(input) {
130
+ const probe = input.probeProduct ?? ((url) => probeProductBaseUrl(url));
131
+ const checks = [];
132
+ checks.push(makeCheck('manifest_pushed', 'Manifest pushed', input.manifestPushed ? 'pass' : 'fail', {
133
+ message: input.manifestPushed
134
+ ? 'Shell status is live'
135
+ : 'Run npx duct push to publish your manifest',
136
+ }));
137
+ if (!input.productBaseUrl) {
138
+ checks.push(makeCheck('product_base_url', 'Product base URL', 'warn', {
139
+ message: 'Set product.baseUrl in duct.config.ts',
140
+ }));
141
+ }
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',
155
+ }));
156
+ return {
157
+ ok: readinessReportOk(checks),
158
+ generatedAt: new Date().toISOString(),
159
+ statusUrl: input.statusUrl,
160
+ checks,
161
+ };
162
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,106 @@
1
+ import { describe, it } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { ReadinessReportSchema, buildCliReadinessReport, buildShellReadinessReport, probeProductBaseUrl, readinessReportOk, rewriteLoopbackForDocker, } from './readiness-checks.js';
4
+ describe('readiness-checks', () => {
5
+ it('buildCliReadinessReport emits schema-valid output', async () => {
6
+ const report = await buildCliReadinessReport({
7
+ env: {
8
+ ductUrl: 'http://localhost:3005',
9
+ shellId: 'shell_test',
10
+ secretKey: 'sk_test1234',
11
+ authEmail: 'dev@example.com',
12
+ authSlug: 'acme',
13
+ },
14
+ endpoints: {
15
+ authHealthUrl: 'http://localhost:3001/health',
16
+ apiHealthUrl: 'http://localhost:3002/health',
17
+ shellHealthUrl: 'http://localhost:3000/api/health',
18
+ dashboardHealthUrl: 'http://localhost:3004/api/health',
19
+ docsUrl: 'http://localhost:3005/docs',
20
+ },
21
+ probe: async (url) => ({ ok: url.includes('/health'), status: 200 }),
22
+ });
23
+ assert.equal(ReadinessReportSchema.safeParse(report).success, true);
24
+ assert.equal(report.ok, true);
25
+ assert.equal(report.docsUrl, 'http://localhost:3005/docs');
26
+ assert.ok(report.checks.some((c) => c.id === 'api_reachable' && c.status === 'pass'));
27
+ assert.ok(report.checks.some((c) => c.id === 'docs_url'));
28
+ });
29
+ it('marks report not ok when a required service probe fails', async () => {
30
+ const report = await buildCliReadinessReport({
31
+ env: {},
32
+ endpoints: {
33
+ authHealthUrl: 'http://localhost:3001/health',
34
+ apiHealthUrl: 'http://localhost:3002/health',
35
+ shellHealthUrl: 'http://localhost:3000/api/health',
36
+ dashboardHealthUrl: 'http://localhost:3004/api/health',
37
+ docsUrl: 'http://localhost:3005/docs',
38
+ },
39
+ probe: async (url) => ({
40
+ ok: !url.includes(':3002'),
41
+ status: url.includes(':3002') ? 503 : 200,
42
+ }),
43
+ });
44
+ assert.equal(readinessReportOk(report.checks), false);
45
+ assert.equal(report.ok, false);
46
+ const api = report.checks.find((c) => c.id === 'api_reachable');
47
+ assert.equal(api?.status, 'fail');
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
+ });
106
+ });
@@ -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;
@@ -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;
@@ -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: 660 },
8
- square: { width: 460, height: 500 },
9
- large: { width: 560, height: 720 },
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
@@ -1,8 +1,9 @@
1
- export { defineDuctConfig, DuctConfigSchema, crossValidateDuctConfig } from "./core/config.js";
2
- export type { ValidatedDuctConfig } from "./core/config.js";
1
+ export { defineDuctConfig, DuctConfigSchema, crossValidateDuctConfig, ManifestActionSchema, ActionManifestSchema, SensitivityLevelSchema, ErrorEnvelopeSchema, ConfirmationStateSchema, } from "./core/config.js";
2
+ export type { ValidatedDuctConfig, ManifestAction, ErrorEnvelope, ConfirmationState } from "./core/config.js";
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
@@ -6,11 +6,12 @@
6
6
  // runtimes where React is not installed (e.g. plain Express).
7
7
  // ============================================================
8
8
  // Core config
9
- export { defineDuctConfig, DuctConfigSchema, crossValidateDuctConfig } from "./core/config.js";
9
+ export { defineDuctConfig, DuctConfigSchema, crossValidateDuctConfig, ManifestActionSchema, ActionManifestSchema, SensitivityLevelSchema, ErrorEnvelopeSchema, ConfirmationStateSchema, } from "./core/config.js";
10
10
  // Token utilities
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
@@ -1,8 +1,9 @@
1
- export { defineDuctConfig, DuctConfigSchema, crossValidateDuctConfig } from "./core/config.js";
2
- export type { ValidatedDuctConfig } from "./core/config.js";
1
+ export { defineDuctConfig, DuctConfigSchema, crossValidateDuctConfig, ManifestActionSchema, ActionManifestSchema, SensitivityLevelSchema, ErrorEnvelopeSchema, ConfirmationStateSchema, } from "./core/config.js";
2
+ export type { ValidatedDuctConfig, ManifestAction, ErrorEnvelope, ConfirmationState } from "./core/config.js";
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
@@ -10,11 +10,12 @@
10
10
  // is not installed.
11
11
  // ============================================================
12
12
  // Config
13
- export { defineDuctConfig, DuctConfigSchema, crossValidateDuctConfig } from "./core/config.js";
13
+ export { defineDuctConfig, DuctConfigSchema, crossValidateDuctConfig, ManifestActionSchema, ActionManifestSchema, SensitivityLevelSchema, ErrorEnvelopeSchema, ConfirmationStateSchema, } from "./core/config.js";
14
14
  // Token utilities — mint delegated JWTs, verify them, handle deeplinks
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
@@ -1,93 +1,94 @@
1
- {
2
- "name": "@duct-sdk/sdk",
3
- "version": "0.5.4",
4
- "type": "module",
5
- "description": "Duct SDK — manifest, CLI, and embed components for permissioned human and agent access to your product APIs.",
6
- "homepage": "https://ductai.vercel.app/docs",
7
- "main": "dist/index.js",
8
- "types": "dist/index.d.ts",
9
- "bin": {
10
- "duct": "dist/cli/index.js"
11
- },
12
- "exports": {
13
- ".": "./dist/index.js",
14
- "./server": "./dist/server.js",
15
- "./next": "./dist/adapters/next/index.js",
16
- "./remix": "./dist/adapters/remix/index.js",
17
- "./vite": "./dist/adapters/vite/index.js",
18
- "./sveltekit": "./dist/adapters/sveltekit/index.js",
19
- "./react": "./dist/adapters/react/index.js"
20
- },
21
- "scripts": {
22
- "build": "tsc",
23
- "dev": "tsc --watch",
24
- "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",
25
- "verify:publish": "node scripts/verify-publish.mjs",
26
- "prepublishOnly": "npm run build && npm run verify:publish"
27
- },
28
- "dependencies": {
29
- "@anthropic-ai/sdk": "^0.24.0",
30
- "jose": "^5.0.0",
31
- "ignore": "^5.0.0",
32
- "commander": "^12.0.0",
33
- "chalk": "^5.0.0",
34
- "ora": "^8.0.0",
35
- "inquirer": "^9.0.0",
36
- "zod": "^3.0.0",
37
- "node-fetch": "^3.0.0",
38
- "glob": "^10.0.0",
39
- "yaml": "^2.0.0"
40
- },
41
- "devDependencies": {
42
- "typescript": "^5.0.0",
43
- "@types/node": "^20.0.0",
44
- "@types/inquirer": "^9.0.0",
45
- "@types/react": "^18.0.0",
46
- "next": "^14.0.0",
47
- "react": "^18.0.0",
48
- "react-dom": "^18.0.0"
49
- },
50
- "peerDependencies": {
51
- "react": "^18.0.0 || ^19.0.0",
52
- "react-dom": "^18.0.0 || ^19.0.0",
53
- "next": ">=14.0.0"
54
- },
55
- "peerDependenciesMeta": {
56
- "react": {
57
- "optional": true
58
- },
59
- "react-dom": {
60
- "optional": true
61
- },
62
- "next": {
63
- "optional": true
64
- }
65
- },
66
- "files": [
67
- "dist",
68
- "assets",
69
- "README.md",
70
- "CHANGELOG.md",
71
- "TOKEN_SPEC.md"
72
- ],
73
- "keywords": [
74
- "duct",
75
- "ai",
76
- "agent",
77
- "shell",
78
- "cli",
79
- "llm",
80
- "ai-agent",
81
- "deeplink",
82
- "next",
83
- "nextjs",
84
- "remix",
85
- "vite",
86
- "sveltekit",
87
- "sdk"
88
- ],
89
- "publishConfig": {
90
- "registry": "https://registry.npmjs.org",
91
- "access": "public"
92
- }
93
- }
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
+ }