@duct-sdk/sdk 0.5.13 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +61 -0
- package/README.md +418 -264
- package/TOKEN_SPEC.md +243 -243
- package/dist/cli/action-confusion-format.d.ts +17 -0
- package/dist/cli/action-confusion-format.js +24 -0
- package/dist/cli/add.d.ts +7 -0
- package/dist/cli/add.js +152 -0
- package/dist/cli/agent-prompt.d.ts +3 -0
- package/dist/cli/agent-prompt.js +39 -0
- package/dist/cli/api-sources.d.ts +26 -0
- package/dist/cli/api-sources.js +222 -0
- package/dist/cli/cloud.d.ts +162 -0
- package/dist/cli/cloud.js +306 -0
- package/dist/cli/config-loader.d.ts +14 -0
- package/dist/cli/config-loader.js +56 -7
- package/dist/cli/device-login.d.ts +17 -0
- package/dist/cli/device-login.js +75 -0
- package/dist/cli/drift.js +6 -6
- package/dist/cli/generators/any-stack.d.ts +3 -0
- package/dist/cli/generators/any-stack.js +97 -0
- package/dist/cli/generators/config.js +3 -2
- package/dist/cli/generators/receiver.js +7 -7
- package/dist/cli/generators/shell.js +12 -12
- package/dist/cli/generators/token-route.js +245 -245
- package/dist/cli/generators/wiring-snippets.d.ts +0 -14
- package/dist/cli/generators/wiring-snippets.js +188 -305
- package/dist/cli/index.js +396 -611
- package/dist/cli/mcp-core.d.ts +42 -0
- package/dist/cli/mcp-core.js +161 -0
- package/dist/cli/mcp-setup.d.ts +4 -0
- package/dist/cli/mcp-setup.js +352 -0
- package/dist/cli/mcp.d.ts +2 -0
- package/dist/cli/mcp.js +457 -0
- package/dist/cli/migrate-intershell.js +5 -5
- package/dist/cli/policy-defaults.d.ts +37 -0
- package/dist/cli/policy-defaults.js +127 -0
- package/dist/cli/policy-replay-format.d.ts +9 -0
- package/dist/cli/policy-replay-format.js +46 -0
- package/dist/cli/processors/integration-audit.js +2 -2
- package/dist/cli/processors/openapi-parser.d.ts +5 -0
- package/dist/cli/processors/openapi-parser.js +8 -3
- package/dist/cli/project-loader.d.ts +58 -0
- package/dist/cli/project-loader.js +198 -0
- package/dist/cli/project-writer.d.ts +23 -0
- package/dist/cli/project-writer.js +171 -0
- package/dist/cli/push.d.ts +43 -0
- package/dist/cli/push.js +308 -0
- package/dist/cli/safety-checks.d.ts +9 -0
- package/dist/cli/safety-checks.js +29 -0
- package/dist/cli/setup.d.ts +20 -0
- package/dist/cli/setup.js +349 -0
- package/dist/cli/shell-name.d.ts +8 -0
- package/dist/cli/shell-name.js +29 -0
- package/dist/cli/shells.d.ts +22 -0
- package/dist/cli/shells.js +122 -0
- package/dist/cli/split.d.ts +7 -0
- package/dist/cli/split.js +71 -0
- package/dist/cli/sync.d.ts +25 -0
- package/dist/cli/sync.js +120 -0
- package/dist/cli/test-runner.d.ts +21 -0
- package/dist/cli/test-runner.js +281 -0
- package/dist/core/compile.d.ts +43 -0
- package/dist/core/compile.js +512 -0
- package/dist/core/config.d.ts +538 -19
- package/dist/core/config.js +22 -14
- package/dist/core/login-handoff.d.ts +1 -1
- package/dist/core/login-handoff.js +1 -1
- package/dist/core/project.d.ts +1864 -0
- package/dist/core/project.js +291 -0
- package/dist/core/readiness-checks.js +2 -2
- package/dist/core/types.d.ts +10 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/project.d.ts +4 -0
- package/dist/project.js +8 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +1 -0
- package/package.json +94 -95
- package/dist/adapters/react/page-context-guard.test.d.ts +0 -1
- package/dist/adapters/react/page-context-guard.test.js +0 -15
- package/dist/cli/agents/api-agent.d.ts +0 -22
- package/dist/cli/agents/api-agent.js +0 -761
- package/dist/cli/agents/auth-agent.d.ts +0 -7
- package/dist/cli/agents/auth-agent.js +0 -212
- package/dist/cli/agents/deeplink-agent.d.ts +0 -6
- package/dist/cli/agents/deeplink-agent.js +0 -285
- package/dist/cli/agents/llm.d.ts +0 -33
- package/dist/cli/agents/llm.js +0 -309
- package/dist/cli/agents/pipeline.d.ts +0 -72
- package/dist/cli/agents/pipeline.js +0 -421
- package/dist/cli/agents/reviewer-agent.d.ts +0 -13
- package/dist/cli/agents/reviewer-agent.js +0 -450
- package/dist/cli/agents/route-agent.d.ts +0 -17
- package/dist/cli/agents/route-agent.js +0 -383
- package/dist/cli/config-loader.test.d.ts +0 -1
- package/dist/cli/config-loader.test.js +0 -63
- package/dist/cli/detectors/topology.d.ts +0 -46
- package/dist/cli/detectors/topology.js +0 -417
- package/dist/cli/generators/config.test.d.ts +0 -1
- package/dist/cli/generators/config.test.js +0 -222
- package/dist/cli/generators/shell.test.d.ts +0 -1
- package/dist/cli/generators/shell.test.js +0 -73
- package/dist/cli/generators/token-route.test.d.ts +0 -1
- package/dist/cli/generators/token-route.test.js +0 -53
- package/dist/cli/generators/wiring-snippets.test.d.ts +0 -1
- package/dist/cli/generators/wiring-snippets.test.js +0 -80
- package/dist/cli/init.d.ts +0 -32
- package/dist/cli/init.js +0 -1336
- package/dist/cli/manifest-diff.test.d.ts +0 -1
- package/dist/cli/manifest-diff.test.js +0 -144
- package/dist/cli/processors/curl-parser.test.d.ts +0 -1
- package/dist/cli/processors/curl-parser.test.js +0 -24
- package/dist/cli/processors/integration-audit.test.d.ts +0 -1
- package/dist/cli/processors/integration-audit.test.js +0 -154
- package/dist/cli/processors/postprocess.d.ts +0 -22
- package/dist/cli/processors/postprocess.js +0 -107
- package/dist/cli/processors/prisma-parser.d.ts +0 -35
- package/dist/cli/processors/prisma-parser.js +0 -117
- package/dist/cli/processors/verify-discovery.d.ts +0 -33
- package/dist/cli/processors/verify-discovery.js +0 -193
- package/dist/cli/processors/verify-discovery.test.d.ts +0 -1
- package/dist/cli/processors/verify-discovery.test.js +0 -153
- package/dist/cli/processors/zod-extractor.d.ts +0 -27
- package/dist/cli/processors/zod-extractor.js +0 -153
- package/dist/cli/prompts/review.d.ts +0 -61
- package/dist/cli/prompts/review.js +0 -410
- package/dist/cli/selectors/express.d.ts +0 -12
- package/dist/cli/selectors/express.js +0 -117
- package/dist/cli/selectors/fastapi.d.ts +0 -12
- package/dist/cli/selectors/fastapi.js +0 -122
- package/dist/cli/selectors/generic.d.ts +0 -10
- package/dist/cli/selectors/generic.js +0 -74
- package/dist/cli/selectors/index.d.ts +0 -37
- package/dist/cli/selectors/index.js +0 -315
- package/dist/cli/selectors/next.d.ts +0 -12
- package/dist/cli/selectors/next.js +0 -130
- package/dist/core/config-policy.test.d.ts +0 -1
- package/dist/core/config-policy.test.js +0 -101
- package/dist/core/config-roundtrip.test.d.ts +0 -1
- package/dist/core/config-roundtrip.test.js +0 -180
- package/dist/core/endpoint-guard.test.d.ts +0 -1
- package/dist/core/endpoint-guard.test.js +0 -57
- package/dist/core/env-diagnostics.test.d.ts +0 -1
- package/dist/core/env-diagnostics.test.js +0 -31
- package/dist/core/evidence-bundle.conformance.test.d.ts +0 -1
- package/dist/core/evidence-bundle.conformance.test.js +0 -110
- package/dist/core/evidence-bundle.test.d.ts +0 -1
- package/dist/core/evidence-bundle.test.js +0 -58
- package/dist/core/invariants.test.d.ts +0 -1
- package/dist/core/invariants.test.js +0 -217
- package/dist/core/login-handoff.test.d.ts +0 -1
- package/dist/core/login-handoff.test.js +0 -31
- package/dist/core/profile.test.d.ts +0 -1
- package/dist/core/profile.test.js +0 -95
- package/dist/core/readiness-checks.test.d.ts +0 -1
- package/dist/core/readiness-checks.test.js +0 -106
- package/dist/core/receipt.test.d.ts +0 -1
- package/dist/core/receipt.test.js +0 -75
- package/dist/core/sdk-entrypoint.test.d.ts +0 -1
- package/dist/core/sdk-entrypoint.test.js +0 -8
- package/dist/core/side-effects-review.test.d.ts +0 -1
- package/dist/core/side-effects-review.test.js +0 -28
- package/dist/core/token.conformance.test.d.ts +0 -1
- package/dist/core/token.conformance.test.js +0 -43
- package/dist/core/token.test.d.ts +0 -1
- package/dist/core/token.test.js +0 -66
package/dist/core/config.js
CHANGED
|
@@ -35,7 +35,7 @@ const QueryParamSchema = z.object({
|
|
|
35
35
|
description: z.string().optional(),
|
|
36
36
|
defaultValue: z.union([z.string(), z.number(), z.boolean()]).optional(),
|
|
37
37
|
});
|
|
38
|
-
const RouteManifestSchema = z.object({
|
|
38
|
+
export const RouteManifestSchema = z.object({
|
|
39
39
|
path: z.string().min(1).startsWith("/"),
|
|
40
40
|
name: z.string().min(1),
|
|
41
41
|
description: z.string().min(1),
|
|
@@ -55,7 +55,7 @@ const RouteManifestSchema = z.object({
|
|
|
55
55
|
})
|
|
56
56
|
.optional(),
|
|
57
57
|
});
|
|
58
|
-
const AuthStrategySchema = z.enum([
|
|
58
|
+
export const AuthStrategySchema = z.enum([
|
|
59
59
|
"nextauth",
|
|
60
60
|
"clerk",
|
|
61
61
|
"auth0",
|
|
@@ -64,7 +64,7 @@ const AuthStrategySchema = z.enum([
|
|
|
64
64
|
"none",
|
|
65
65
|
"unknown",
|
|
66
66
|
]);
|
|
67
|
-
const AuthSchemaSchema = z.object({
|
|
67
|
+
export const AuthSchemaSchema = z.object({
|
|
68
68
|
strategy: AuthStrategySchema,
|
|
69
69
|
sessionFields: z.array(z.string()).default([]),
|
|
70
70
|
guestAllowed: z.boolean(),
|
|
@@ -91,7 +91,7 @@ const PageResolverSchema = z.union([
|
|
|
91
91
|
z.object({ actionId: z.string().min(1) }),
|
|
92
92
|
z.object({ endpoint: z.string().min(1).startsWith("/") }),
|
|
93
93
|
]);
|
|
94
|
-
const DeeplinkDefinitionSchema = z.object({
|
|
94
|
+
export const DeeplinkDefinitionSchema = z.object({
|
|
95
95
|
id: z
|
|
96
96
|
.string()
|
|
97
97
|
.min(1)
|
|
@@ -109,13 +109,13 @@ const DeeplinkDefinitionSchema = z.object({
|
|
|
109
109
|
contentSelector: z.string().optional(),
|
|
110
110
|
updatedAt: z.string().optional(),
|
|
111
111
|
});
|
|
112
|
-
const AgentPermissionLevelSchema = z.enum([
|
|
112
|
+
export const AgentPermissionLevelSchema = z.enum([
|
|
113
113
|
"none",
|
|
114
114
|
"read",
|
|
115
115
|
"write",
|
|
116
116
|
"admin",
|
|
117
117
|
]);
|
|
118
|
-
const AgentPermissionsSchema = z.object({
|
|
118
|
+
export const AgentPermissionsSchema = z.object({
|
|
119
119
|
defaultLevel: AgentPermissionLevelSchema,
|
|
120
120
|
actionOverrides: z.record(AgentPermissionLevelSchema).optional(),
|
|
121
121
|
allowedCallers: z.array(z.string()).optional(),
|
|
@@ -127,31 +127,39 @@ const AgentPermissionsSchema = z.object({
|
|
|
127
127
|
validFrom: iso8601Schema.optional(),
|
|
128
128
|
validUntil: iso8601Schema.optional(),
|
|
129
129
|
consentActionScope: z.array(z.string().min(1)).optional(),
|
|
130
|
+
consentGrantHours: z
|
|
131
|
+
.object({
|
|
132
|
+
low: z.number().positive().max(168).optional(),
|
|
133
|
+
medium: z.number().positive().max(168).optional(),
|
|
134
|
+
high: z.number().positive().max(168).optional(),
|
|
135
|
+
})
|
|
136
|
+
.strict()
|
|
137
|
+
.optional(),
|
|
130
138
|
});
|
|
131
|
-
const WebhooksConfigSchema = z.object({
|
|
139
|
+
export const WebhooksConfigSchema = z.object({
|
|
132
140
|
consentCallback: z.string().url().optional(),
|
|
133
141
|
identityUrl: z.string().url().optional(),
|
|
134
142
|
secret: z.string().optional(),
|
|
135
143
|
deeplinkCallback: z.string().url().optional(),
|
|
136
144
|
eventStream: z.string().url().optional(),
|
|
137
145
|
});
|
|
138
|
-
const ApprovalStepUpConfigSchema = z.object({
|
|
146
|
+
export const ApprovalStepUpConfigSchema = z.object({
|
|
139
147
|
minSensitivity: SensitivityLevelSchema.optional().default('high'),
|
|
140
148
|
requireForSideEffects: z.boolean().optional().default(true),
|
|
141
149
|
sideEffectsMinSensitivity: SensitivityLevelSchema.optional().default('medium'),
|
|
142
150
|
});
|
|
143
|
-
const ApprovalConfigSchema = z.object({
|
|
151
|
+
export const ApprovalConfigSchema = z.object({
|
|
144
152
|
stepUp: ApprovalStepUpConfigSchema.optional().default({
|
|
145
153
|
minSensitivity: 'high',
|
|
146
154
|
requireForSideEffects: true,
|
|
147
155
|
sideEffectsMinSensitivity: 'medium',
|
|
148
156
|
}),
|
|
149
157
|
});
|
|
150
|
-
const OperatorNotificationsConfigSchema = z.object({
|
|
158
|
+
export const OperatorNotificationsConfigSchema = z.object({
|
|
151
159
|
approverEmails: z.array(z.string().email()).optional().default([]),
|
|
152
160
|
confirmationReminderLeadMinutes: z.number().int().positive().nullable().optional(),
|
|
153
161
|
});
|
|
154
|
-
const WidgetConfigSchema = z.object({
|
|
162
|
+
export const WidgetConfigSchema = z.object({
|
|
155
163
|
primaryColor: z.string().optional(),
|
|
156
164
|
position: z
|
|
157
165
|
.enum(["bottom-right", "bottom-left", "top-right", "top-left"])
|
|
@@ -179,10 +187,10 @@ const DataModelEntitySchema = z.object({
|
|
|
179
187
|
labelKey: z.string().min(1),
|
|
180
188
|
dimensions: z.array(z.string()).optional(),
|
|
181
189
|
});
|
|
182
|
-
const DataModelSchema = z.object({
|
|
190
|
+
export const DataModelSchema = z.object({
|
|
183
191
|
entities: z.array(DataModelEntitySchema),
|
|
184
192
|
});
|
|
185
|
-
const ProductConfigSchema = z.object({
|
|
193
|
+
export const ProductConfigSchema = z.object({
|
|
186
194
|
name: z.string().min(1),
|
|
187
195
|
description: z.string().min(1),
|
|
188
196
|
baseUrl: z.string().url(),
|
|
@@ -341,7 +349,7 @@ export function crossValidateDuctConfig(data) {
|
|
|
341
349
|
return issues;
|
|
342
350
|
}
|
|
343
351
|
/**
|
|
344
|
-
* Validate a Duct config without throwing — used by
|
|
352
|
+
* Validate a Duct config without throwing — used by the CLI before writing files.
|
|
345
353
|
*/
|
|
346
354
|
export function validateDuctConfigStrict(config) {
|
|
347
355
|
const result = DuctConfigSchema.safeParse(config);
|
|
@@ -27,7 +27,7 @@ export declare const DEFAULT_LOGIN_HANDOFF_MESSAGE = "You'll need to sign in fir
|
|
|
27
27
|
export declare function normalizeRoutePathForLogin(path: string): string;
|
|
28
28
|
/**
|
|
29
29
|
* Pick the best login route path from a manifest route inventory.
|
|
30
|
-
* Used by `duct
|
|
30
|
+
* Used by `duct add identity` to populate `auth.loginRoutePath`.
|
|
31
31
|
*/
|
|
32
32
|
export declare function detectLoginRoutePath(routes: LoginRouteLike[]): string | undefined;
|
|
33
33
|
/**
|
|
@@ -37,7 +37,7 @@ function buildHandoffUrl(baseUrl, path) {
|
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
39
|
* Pick the best login route path from a manifest route inventory.
|
|
40
|
-
* Used by `duct
|
|
40
|
+
* Used by `duct add identity` to populate `auth.loginRoutePath`.
|
|
41
41
|
*/
|
|
42
42
|
export function detectLoginRoutePath(routes) {
|
|
43
43
|
for (const route of routes) {
|