@duct-sdk/sdk 0.6.0 → 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 +405 -385
- package/README.md +1 -1
- package/TOKEN_SPEC.md +2 -2
- package/dist/cli/action-confusion-format.d.ts +17 -0
- package/dist/cli/action-confusion-format.js +24 -0
- package/dist/cli/cloud.d.ts +30 -1
- package/dist/cli/cloud.js +8 -0
- package/dist/cli/generators/wiring-snippets.d.ts +0 -14
- package/dist/cli/generators/wiring-snippets.js +188 -305
- package/dist/cli/mcp-setup.js +1 -9
- package/dist/cli/policy-replay-format.d.ts +9 -0
- package/dist/cli/policy-replay-format.js +46 -0
- package/dist/cli/push.js +33 -1
- package/dist/core/compile.js +2 -0
- package/dist/core/config.d.ts +74 -18
- package/dist/core/config.js +8 -0
- package/dist/core/project.d.ts +66 -0
- package/dist/core/project.js +13 -0
- package/dist/core/types.d.ts +9 -0
- package/package.json +1 -1
package/dist/cli/push.js
CHANGED
|
@@ -16,7 +16,9 @@ import { formatSideEffectMismatchLines, findSideEffectReviewMismatches, resolveS
|
|
|
16
16
|
import { generateConfigFile } from "./generators/config.js";
|
|
17
17
|
import { computeManifestPrivilegeDiff, detectDashboardNetworkReverts, fetchLiveManifestConfig, formatManifestPrivilegeDiff, } from "./manifest-diff.js";
|
|
18
18
|
import { resolveProjectConfig } from "./project-loader.js";
|
|
19
|
-
import { CloudError, pushManifest, readAuth, resolveApiKey } from "./cloud.js";
|
|
19
|
+
import { CloudError, checkActionConfusion, checkPolicyReplay, pushManifest, readAuth, resolveApiKey } from "./cloud.js";
|
|
20
|
+
import { formatActionConfusion } from "./action-confusion-format.js";
|
|
21
|
+
import { formatPolicyReplay } from "./policy-replay-format.js";
|
|
20
22
|
export class PushAbortedError extends Error {
|
|
21
23
|
details;
|
|
22
24
|
constructor(message, details = []) {
|
|
@@ -211,6 +213,36 @@ export async function runPush(opts) {
|
|
|
211
213
|
if (privilegeDiff.hasPrivilegeIncrease && !opts.yes) {
|
|
212
214
|
throw new PushAbortedError("Push blocked — this push gives agents more power. Review the diff above, then re-run with --yes.");
|
|
213
215
|
}
|
|
216
|
+
// What this version would have done to the shell's recent real calls (needs a live shell).
|
|
217
|
+
if (apiKey && liveConfig) {
|
|
218
|
+
const replaySpinner = ora("Replaying recent calls against this version…").start();
|
|
219
|
+
const replay = await checkPolicyReplay(authProfile, apiKey, shellId, config).catch(() => null);
|
|
220
|
+
replaySpinner.stop();
|
|
221
|
+
if (replay) {
|
|
222
|
+
const { lines, breaksCalls } = formatPolicyReplay(replay);
|
|
223
|
+
console.log(chalk.bold(" Effect on recent calls:\n"));
|
|
224
|
+
for (const line of lines)
|
|
225
|
+
console.log((breaksCalls ? chalk.red : chalk.gray)(` ${line}`));
|
|
226
|
+
console.log();
|
|
227
|
+
if (breaksCalls && !opts.yes) {
|
|
228
|
+
throw new PushAbortedError("Push blocked — this version would stop calls that work today. Review the list above, then re-run with --yes.");
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
console.log(chalk.gray(" Could not replay recent calls; continuing.\n"));
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
// Actions that read alike get routed to each other; say so before they go live (never blocks).
|
|
236
|
+
if (apiKey) {
|
|
237
|
+
const confusion = await checkActionConfusion(authProfile, apiKey, shellId, config).catch(() => null);
|
|
238
|
+
const lines = confusion ? formatActionConfusion(confusion) : [];
|
|
239
|
+
if (lines.length > 0) {
|
|
240
|
+
console.log(chalk.yellow(" Actions that may be confused:\n"));
|
|
241
|
+
for (const line of lines)
|
|
242
|
+
console.log(chalk.yellow(` ${line}`));
|
|
243
|
+
console.log();
|
|
244
|
+
}
|
|
245
|
+
}
|
|
214
246
|
const networkReverts = detectDashboardNetworkReverts(liveConfig, validated);
|
|
215
247
|
if (networkReverts.length > 0) {
|
|
216
248
|
console.log(chalk.yellow("\n ! Network settings you changed in the dashboard would be reverted by this push:\n"));
|
package/dist/core/compile.js
CHANGED
|
@@ -247,6 +247,7 @@ export function compileProject(input) {
|
|
|
247
247
|
requireUserConsent: policy.agents.userConsent,
|
|
248
248
|
...(Object.keys(actionOverrides).length > 0 ? { actionOverrides } : {}),
|
|
249
249
|
...(policy.agents.consentScope ? { consentActionScope: policy.agents.consentScope } : {}),
|
|
250
|
+
...(policy.agents.consentHours ? { consentGrantHours: policy.agents.consentHours } : {}),
|
|
250
251
|
...(policy.agents.validFrom ? { validFrom: policy.agents.validFrom } : {}),
|
|
251
252
|
...(policy.agents.validUntil ? { validUntil: policy.agents.validUntil } : {}),
|
|
252
253
|
...(project.network?.allowedCallers ? { allowedCallers: project.network.allowedCallers } : {}),
|
|
@@ -361,6 +362,7 @@ export function enforcementDiff(before, after) {
|
|
|
361
362
|
const shellChecks = [
|
|
362
363
|
["requireUserConsent", pa.requireUserConsent, pb.requireUserConsent],
|
|
363
364
|
["consentActionScope", pa.consentActionScope ?? null, pb.consentActionScope ?? null],
|
|
365
|
+
["consentGrantHours", pa.consentGrantHours ?? null, pb.consentGrantHours ?? null],
|
|
364
366
|
["validFrom", pa.validFrom ?? null, pb.validFrom ?? null],
|
|
365
367
|
["validUntil", pa.validUntil ?? null, pb.validUntil ?? null],
|
|
366
368
|
["allowedCallers", pa.allowedCallers ?? null, pb.allowedCallers ?? null],
|
package/dist/core/config.d.ts
CHANGED
|
@@ -254,6 +254,19 @@ export declare const AgentPermissionsSchema: z.ZodObject<{
|
|
|
254
254
|
validFrom: z.ZodOptional<z.ZodString>;
|
|
255
255
|
validUntil: z.ZodOptional<z.ZodString>;
|
|
256
256
|
consentActionScope: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
257
|
+
consentGrantHours: z.ZodOptional<z.ZodObject<{
|
|
258
|
+
low: z.ZodOptional<z.ZodNumber>;
|
|
259
|
+
medium: z.ZodOptional<z.ZodNumber>;
|
|
260
|
+
high: z.ZodOptional<z.ZodNumber>;
|
|
261
|
+
}, "strict", z.ZodTypeAny, {
|
|
262
|
+
low?: number | undefined;
|
|
263
|
+
medium?: number | undefined;
|
|
264
|
+
high?: number | undefined;
|
|
265
|
+
}, {
|
|
266
|
+
low?: number | undefined;
|
|
267
|
+
medium?: number | undefined;
|
|
268
|
+
high?: number | undefined;
|
|
269
|
+
}>>;
|
|
257
270
|
}, "strip", z.ZodTypeAny, {
|
|
258
271
|
defaultLevel: "none" | "read" | "write" | "admin";
|
|
259
272
|
requireUserConsent: boolean;
|
|
@@ -264,6 +277,11 @@ export declare const AgentPermissionsSchema: z.ZodObject<{
|
|
|
264
277
|
validFrom?: string | undefined;
|
|
265
278
|
validUntil?: string | undefined;
|
|
266
279
|
consentActionScope?: string[] | undefined;
|
|
280
|
+
consentGrantHours?: {
|
|
281
|
+
low?: number | undefined;
|
|
282
|
+
medium?: number | undefined;
|
|
283
|
+
high?: number | undefined;
|
|
284
|
+
} | undefined;
|
|
267
285
|
}, {
|
|
268
286
|
defaultLevel: "none" | "read" | "write" | "admin";
|
|
269
287
|
requireUserConsent: boolean;
|
|
@@ -274,6 +292,11 @@ export declare const AgentPermissionsSchema: z.ZodObject<{
|
|
|
274
292
|
validFrom?: string | undefined;
|
|
275
293
|
validUntil?: string | undefined;
|
|
276
294
|
consentActionScope?: string[] | undefined;
|
|
295
|
+
consentGrantHours?: {
|
|
296
|
+
low?: number | undefined;
|
|
297
|
+
medium?: number | undefined;
|
|
298
|
+
high?: number | undefined;
|
|
299
|
+
} | undefined;
|
|
277
300
|
}>;
|
|
278
301
|
export declare const WebhooksConfigSchema: z.ZodObject<{
|
|
279
302
|
consentCallback: z.ZodOptional<z.ZodString>;
|
|
@@ -718,6 +741,11 @@ export declare const DuctConfigSchema: z.ZodObject<{
|
|
|
718
741
|
paramMappings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
719
742
|
navigatesTo: z.ZodOptional<z.ZodString>;
|
|
720
743
|
}, "strip", z.ZodTypeAny, {
|
|
744
|
+
method: "GET" | "DELETE" | "POST" | "PUT" | "PATCH";
|
|
745
|
+
path: string;
|
|
746
|
+
sideEffects: boolean;
|
|
747
|
+
sensitivityLevel: "low" | "none" | "medium" | "high" | "critical";
|
|
748
|
+
id: string;
|
|
721
749
|
params: {
|
|
722
750
|
type: "string" | "number" | "boolean" | "object" | "array";
|
|
723
751
|
name: string;
|
|
@@ -725,14 +753,9 @@ export declare const DuctConfigSchema: z.ZodObject<{
|
|
|
725
753
|
description?: string | undefined;
|
|
726
754
|
schema?: Record<string, unknown> | undefined;
|
|
727
755
|
}[];
|
|
728
|
-
path: string;
|
|
729
756
|
name: string;
|
|
730
757
|
description: string;
|
|
731
|
-
id: string;
|
|
732
|
-
method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
733
758
|
agentAccessible: boolean;
|
|
734
|
-
sideEffects: boolean;
|
|
735
|
-
sensitivityLevel: "none" | "low" | "medium" | "high" | "critical";
|
|
736
759
|
requiresAuth: boolean;
|
|
737
760
|
sideEffectsReviewAck?: string | undefined;
|
|
738
761
|
responseSchema?: Record<string, unknown> | undefined;
|
|
@@ -764,14 +787,14 @@ export declare const DuctConfigSchema: z.ZodObject<{
|
|
|
764
787
|
paramMappings?: Record<string, string> | undefined;
|
|
765
788
|
navigatesTo?: string | undefined;
|
|
766
789
|
}, {
|
|
790
|
+
method: "GET" | "DELETE" | "POST" | "PUT" | "PATCH";
|
|
767
791
|
path: string;
|
|
792
|
+
sideEffects: boolean;
|
|
793
|
+
sensitivityLevel: "low" | "none" | "medium" | "high" | "critical";
|
|
794
|
+
id: string;
|
|
768
795
|
name: string;
|
|
769
796
|
description: string;
|
|
770
|
-
id: string;
|
|
771
|
-
method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
772
797
|
agentAccessible: boolean;
|
|
773
|
-
sideEffects: boolean;
|
|
774
|
-
sensitivityLevel: "none" | "low" | "medium" | "high" | "critical";
|
|
775
798
|
requiresAuth: boolean;
|
|
776
799
|
params?: {
|
|
777
800
|
type: "string" | "number" | "boolean" | "object" | "array";
|
|
@@ -913,6 +936,19 @@ export declare const DuctConfigSchema: z.ZodObject<{
|
|
|
913
936
|
validFrom: z.ZodOptional<z.ZodString>;
|
|
914
937
|
validUntil: z.ZodOptional<z.ZodString>;
|
|
915
938
|
consentActionScope: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
939
|
+
consentGrantHours: z.ZodOptional<z.ZodObject<{
|
|
940
|
+
low: z.ZodOptional<z.ZodNumber>;
|
|
941
|
+
medium: z.ZodOptional<z.ZodNumber>;
|
|
942
|
+
high: z.ZodOptional<z.ZodNumber>;
|
|
943
|
+
}, "strict", z.ZodTypeAny, {
|
|
944
|
+
low?: number | undefined;
|
|
945
|
+
medium?: number | undefined;
|
|
946
|
+
high?: number | undefined;
|
|
947
|
+
}, {
|
|
948
|
+
low?: number | undefined;
|
|
949
|
+
medium?: number | undefined;
|
|
950
|
+
high?: number | undefined;
|
|
951
|
+
}>>;
|
|
916
952
|
}, "strip", z.ZodTypeAny, {
|
|
917
953
|
defaultLevel: "none" | "read" | "write" | "admin";
|
|
918
954
|
requireUserConsent: boolean;
|
|
@@ -923,6 +959,11 @@ export declare const DuctConfigSchema: z.ZodObject<{
|
|
|
923
959
|
validFrom?: string | undefined;
|
|
924
960
|
validUntil?: string | undefined;
|
|
925
961
|
consentActionScope?: string[] | undefined;
|
|
962
|
+
consentGrantHours?: {
|
|
963
|
+
low?: number | undefined;
|
|
964
|
+
medium?: number | undefined;
|
|
965
|
+
high?: number | undefined;
|
|
966
|
+
} | undefined;
|
|
926
967
|
}, {
|
|
927
968
|
defaultLevel: "none" | "read" | "write" | "admin";
|
|
928
969
|
requireUserConsent: boolean;
|
|
@@ -933,6 +974,11 @@ export declare const DuctConfigSchema: z.ZodObject<{
|
|
|
933
974
|
validFrom?: string | undefined;
|
|
934
975
|
validUntil?: string | undefined;
|
|
935
976
|
consentActionScope?: string[] | undefined;
|
|
977
|
+
consentGrantHours?: {
|
|
978
|
+
low?: number | undefined;
|
|
979
|
+
medium?: number | undefined;
|
|
980
|
+
high?: number | undefined;
|
|
981
|
+
} | undefined;
|
|
936
982
|
}>;
|
|
937
983
|
widget: z.ZodOptional<z.ZodObject<{
|
|
938
984
|
primaryColor: z.ZodOptional<z.ZodString>;
|
|
@@ -1141,6 +1187,11 @@ export declare const DuctConfigSchema: z.ZodObject<{
|
|
|
1141
1187
|
} | undefined;
|
|
1142
1188
|
}[];
|
|
1143
1189
|
actions: {
|
|
1190
|
+
method: "GET" | "DELETE" | "POST" | "PUT" | "PATCH";
|
|
1191
|
+
path: string;
|
|
1192
|
+
sideEffects: boolean;
|
|
1193
|
+
sensitivityLevel: "low" | "none" | "medium" | "high" | "critical";
|
|
1194
|
+
id: string;
|
|
1144
1195
|
params: {
|
|
1145
1196
|
type: "string" | "number" | "boolean" | "object" | "array";
|
|
1146
1197
|
name: string;
|
|
@@ -1148,14 +1199,9 @@ export declare const DuctConfigSchema: z.ZodObject<{
|
|
|
1148
1199
|
description?: string | undefined;
|
|
1149
1200
|
schema?: Record<string, unknown> | undefined;
|
|
1150
1201
|
}[];
|
|
1151
|
-
path: string;
|
|
1152
1202
|
name: string;
|
|
1153
1203
|
description: string;
|
|
1154
|
-
id: string;
|
|
1155
|
-
method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
1156
1204
|
agentAccessible: boolean;
|
|
1157
|
-
sideEffects: boolean;
|
|
1158
|
-
sensitivityLevel: "none" | "low" | "medium" | "high" | "critical";
|
|
1159
1205
|
requiresAuth: boolean;
|
|
1160
1206
|
sideEffectsReviewAck?: string | undefined;
|
|
1161
1207
|
responseSchema?: Record<string, unknown> | undefined;
|
|
@@ -1222,6 +1268,11 @@ export declare const DuctConfigSchema: z.ZodObject<{
|
|
|
1222
1268
|
validFrom?: string | undefined;
|
|
1223
1269
|
validUntil?: string | undefined;
|
|
1224
1270
|
consentActionScope?: string[] | undefined;
|
|
1271
|
+
consentGrantHours?: {
|
|
1272
|
+
low?: number | undefined;
|
|
1273
|
+
medium?: number | undefined;
|
|
1274
|
+
high?: number | undefined;
|
|
1275
|
+
} | undefined;
|
|
1225
1276
|
};
|
|
1226
1277
|
registry_visibility: "public" | "private";
|
|
1227
1278
|
intershell_enabled: boolean;
|
|
@@ -1304,6 +1355,11 @@ export declare const DuctConfigSchema: z.ZodObject<{
|
|
|
1304
1355
|
validFrom?: string | undefined;
|
|
1305
1356
|
validUntil?: string | undefined;
|
|
1306
1357
|
consentActionScope?: string[] | undefined;
|
|
1358
|
+
consentGrantHours?: {
|
|
1359
|
+
low?: number | undefined;
|
|
1360
|
+
medium?: number | undefined;
|
|
1361
|
+
high?: number | undefined;
|
|
1362
|
+
} | undefined;
|
|
1307
1363
|
};
|
|
1308
1364
|
routes?: {
|
|
1309
1365
|
name: string;
|
|
@@ -1335,14 +1391,14 @@ export declare const DuctConfigSchema: z.ZodObject<{
|
|
|
1335
1391
|
} | undefined;
|
|
1336
1392
|
}[] | undefined;
|
|
1337
1393
|
actions?: {
|
|
1394
|
+
method: "GET" | "DELETE" | "POST" | "PUT" | "PATCH";
|
|
1338
1395
|
path: string;
|
|
1396
|
+
sideEffects: boolean;
|
|
1397
|
+
sensitivityLevel: "low" | "none" | "medium" | "high" | "critical";
|
|
1398
|
+
id: string;
|
|
1339
1399
|
name: string;
|
|
1340
1400
|
description: string;
|
|
1341
|
-
id: string;
|
|
1342
|
-
method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
1343
1401
|
agentAccessible: boolean;
|
|
1344
|
-
sideEffects: boolean;
|
|
1345
|
-
sensitivityLevel: "none" | "low" | "medium" | "high" | "critical";
|
|
1346
1402
|
requiresAuth: boolean;
|
|
1347
1403
|
params?: {
|
|
1348
1404
|
type: "string" | "number" | "boolean" | "object" | "array";
|
package/dist/core/config.js
CHANGED
|
@@ -127,6 +127,14 @@ export 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
139
|
export const WebhooksConfigSchema = z.object({
|
|
132
140
|
consentCallback: z.string().url().optional(),
|
package/dist/core/project.d.ts
CHANGED
|
@@ -737,6 +737,24 @@ export declare const PolicyAgentsSchema: z.ZodObject<{
|
|
|
737
737
|
userConsent: z.ZodDefault<z.ZodBoolean>;
|
|
738
738
|
/** Limit which actions a user's consent can cover (exact action ids). */
|
|
739
739
|
consentScope: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
740
|
+
/**
|
|
741
|
+
* How many hours a person's approval of an agent lasts, by the most sensitive action it
|
|
742
|
+
* covers. Defaults: low 24, medium 8, high 1 (high includes critical). At most 168.
|
|
743
|
+
* Side-effect actions still need a human approval on every call.
|
|
744
|
+
*/
|
|
745
|
+
consentHours: z.ZodOptional<z.ZodObject<{
|
|
746
|
+
low: z.ZodOptional<z.ZodNumber>;
|
|
747
|
+
medium: z.ZodOptional<z.ZodNumber>;
|
|
748
|
+
high: z.ZodOptional<z.ZodNumber>;
|
|
749
|
+
}, "strict", z.ZodTypeAny, {
|
|
750
|
+
low?: number | undefined;
|
|
751
|
+
medium?: number | undefined;
|
|
752
|
+
high?: number | undefined;
|
|
753
|
+
}, {
|
|
754
|
+
low?: number | undefined;
|
|
755
|
+
medium?: number | undefined;
|
|
756
|
+
high?: number | undefined;
|
|
757
|
+
}>>;
|
|
740
758
|
validFrom: z.ZodOptional<z.ZodString>;
|
|
741
759
|
validUntil: z.ZodOptional<z.ZodString>;
|
|
742
760
|
}, "strict", z.ZodTypeAny, {
|
|
@@ -748,6 +766,11 @@ export declare const PolicyAgentsSchema: z.ZodObject<{
|
|
|
748
766
|
validUntil?: string | undefined;
|
|
749
767
|
levels?: Record<string, "none" | "read" | "write" | "admin"> | undefined;
|
|
750
768
|
consentScope?: string[] | undefined;
|
|
769
|
+
consentHours?: {
|
|
770
|
+
low?: number | undefined;
|
|
771
|
+
medium?: number | undefined;
|
|
772
|
+
high?: number | undefined;
|
|
773
|
+
} | undefined;
|
|
751
774
|
}, {
|
|
752
775
|
allow?: string[] | undefined;
|
|
753
776
|
deny?: string[] | undefined;
|
|
@@ -757,6 +780,11 @@ export declare const PolicyAgentsSchema: z.ZodObject<{
|
|
|
757
780
|
levels?: Record<string, "none" | "read" | "write" | "admin"> | undefined;
|
|
758
781
|
userConsent?: boolean | undefined;
|
|
759
782
|
consentScope?: string[] | undefined;
|
|
783
|
+
consentHours?: {
|
|
784
|
+
low?: number | undefined;
|
|
785
|
+
medium?: number | undefined;
|
|
786
|
+
high?: number | undefined;
|
|
787
|
+
} | undefined;
|
|
760
788
|
}>;
|
|
761
789
|
export declare const PolicyApproversSchema: z.ZodObject<{
|
|
762
790
|
/** Who gets notified when an agent request is waiting for approval. */
|
|
@@ -807,6 +835,24 @@ export declare const PolicyFileSchema: z.ZodObject<{
|
|
|
807
835
|
userConsent: z.ZodDefault<z.ZodBoolean>;
|
|
808
836
|
/** Limit which actions a user's consent can cover (exact action ids). */
|
|
809
837
|
consentScope: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
838
|
+
/**
|
|
839
|
+
* How many hours a person's approval of an agent lasts, by the most sensitive action it
|
|
840
|
+
* covers. Defaults: low 24, medium 8, high 1 (high includes critical). At most 168.
|
|
841
|
+
* Side-effect actions still need a human approval on every call.
|
|
842
|
+
*/
|
|
843
|
+
consentHours: z.ZodOptional<z.ZodObject<{
|
|
844
|
+
low: z.ZodOptional<z.ZodNumber>;
|
|
845
|
+
medium: z.ZodOptional<z.ZodNumber>;
|
|
846
|
+
high: z.ZodOptional<z.ZodNumber>;
|
|
847
|
+
}, "strict", z.ZodTypeAny, {
|
|
848
|
+
low?: number | undefined;
|
|
849
|
+
medium?: number | undefined;
|
|
850
|
+
high?: number | undefined;
|
|
851
|
+
}, {
|
|
852
|
+
low?: number | undefined;
|
|
853
|
+
medium?: number | undefined;
|
|
854
|
+
high?: number | undefined;
|
|
855
|
+
}>>;
|
|
810
856
|
validFrom: z.ZodOptional<z.ZodString>;
|
|
811
857
|
validUntil: z.ZodOptional<z.ZodString>;
|
|
812
858
|
}, "strict", z.ZodTypeAny, {
|
|
@@ -818,6 +864,11 @@ export declare const PolicyFileSchema: z.ZodObject<{
|
|
|
818
864
|
validUntil?: string | undefined;
|
|
819
865
|
levels?: Record<string, "none" | "read" | "write" | "admin"> | undefined;
|
|
820
866
|
consentScope?: string[] | undefined;
|
|
867
|
+
consentHours?: {
|
|
868
|
+
low?: number | undefined;
|
|
869
|
+
medium?: number | undefined;
|
|
870
|
+
high?: number | undefined;
|
|
871
|
+
} | undefined;
|
|
821
872
|
}, {
|
|
822
873
|
allow?: string[] | undefined;
|
|
823
874
|
deny?: string[] | undefined;
|
|
@@ -827,6 +878,11 @@ export declare const PolicyFileSchema: z.ZodObject<{
|
|
|
827
878
|
levels?: Record<string, "none" | "read" | "write" | "admin"> | undefined;
|
|
828
879
|
userConsent?: boolean | undefined;
|
|
829
880
|
consentScope?: string[] | undefined;
|
|
881
|
+
consentHours?: {
|
|
882
|
+
low?: number | undefined;
|
|
883
|
+
medium?: number | undefined;
|
|
884
|
+
high?: number | undefined;
|
|
885
|
+
} | undefined;
|
|
830
886
|
}>>;
|
|
831
887
|
/** Require human approval when a call matches the condition. Later entries win. */
|
|
832
888
|
approveWhen: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<Condition, z.ZodTypeDef, Condition>>>;
|
|
@@ -944,6 +1000,11 @@ export declare const PolicyFileSchema: z.ZodObject<{
|
|
|
944
1000
|
validUntil?: string | undefined;
|
|
945
1001
|
levels?: Record<string, "none" | "read" | "write" | "admin"> | undefined;
|
|
946
1002
|
consentScope?: string[] | undefined;
|
|
1003
|
+
consentHours?: {
|
|
1004
|
+
low?: number | undefined;
|
|
1005
|
+
medium?: number | undefined;
|
|
1006
|
+
high?: number | undefined;
|
|
1007
|
+
} | undefined;
|
|
947
1008
|
};
|
|
948
1009
|
approveWhen?: Record<string, Condition> | undefined;
|
|
949
1010
|
limits?: Record<string, {
|
|
@@ -980,6 +1041,11 @@ export declare const PolicyFileSchema: z.ZodObject<{
|
|
|
980
1041
|
levels?: Record<string, "none" | "read" | "write" | "admin"> | undefined;
|
|
981
1042
|
userConsent?: boolean | undefined;
|
|
982
1043
|
consentScope?: string[] | undefined;
|
|
1044
|
+
consentHours?: {
|
|
1045
|
+
low?: number | undefined;
|
|
1046
|
+
medium?: number | undefined;
|
|
1047
|
+
high?: number | undefined;
|
|
1048
|
+
} | undefined;
|
|
983
1049
|
} | undefined;
|
|
984
1050
|
approveWhen?: Record<string, Condition> | undefined;
|
|
985
1051
|
limits?: Record<string, {
|
package/dist/core/project.js
CHANGED
|
@@ -191,6 +191,19 @@ export const PolicyAgentsSchema = z
|
|
|
191
191
|
userConsent: z.boolean().default(true),
|
|
192
192
|
/** Limit which actions a user's consent can cover (exact action ids). */
|
|
193
193
|
consentScope: z.array(z.string().regex(ACTION_ID_RE)).optional(),
|
|
194
|
+
/**
|
|
195
|
+
* How many hours a person's approval of an agent lasts, by the most sensitive action it
|
|
196
|
+
* covers. Defaults: low 24, medium 8, high 1 (high includes critical). At most 168.
|
|
197
|
+
* Side-effect actions still need a human approval on every call.
|
|
198
|
+
*/
|
|
199
|
+
consentHours: z
|
|
200
|
+
.object({
|
|
201
|
+
low: z.number().positive().max(168).optional(),
|
|
202
|
+
medium: z.number().positive().max(168).optional(),
|
|
203
|
+
high: z.number().positive().max(168).optional(),
|
|
204
|
+
})
|
|
205
|
+
.strict()
|
|
206
|
+
.optional(),
|
|
194
207
|
validFrom: iso8601Schema.optional(),
|
|
195
208
|
validUntil: iso8601Schema.optional(),
|
|
196
209
|
})
|
package/dist/core/types.d.ts
CHANGED
|
@@ -305,6 +305,15 @@ export interface AgentPermissions {
|
|
|
305
305
|
* issuance (auth service) and the Duct gateway on invoke.
|
|
306
306
|
*/
|
|
307
307
|
consentActionScope?: string[];
|
|
308
|
+
/**
|
|
309
|
+
* Hours a person's approval of an agent lasts, by the most sensitive action it covers
|
|
310
|
+
* (Duct defaults: low 24, medium 8, high 1; at most 168). From policy.agents.consentHours.
|
|
311
|
+
*/
|
|
312
|
+
consentGrantHours?: {
|
|
313
|
+
low?: number;
|
|
314
|
+
medium?: number;
|
|
315
|
+
high?: number;
|
|
316
|
+
};
|
|
308
317
|
}
|
|
309
318
|
/**
|
|
310
319
|
* Shell panel size/shape presets.
|
package/package.json
CHANGED