@open-agent-toolkit/cli 0.3.7 → 0.3.8
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/assets/bundle-metadata.json +1 -1
- package/assets/docs/cli-utilities/configuration.md +15 -1
- package/assets/docs/cli-utilities/workflow-gates.md +37 -0
- package/assets/docs/provider-sync/commands.md +6 -0
- package/assets/docs/provider-sync/providers.md +20 -0
- package/assets/docs/provider-sync/scope-and-surface.md +2 -0
- package/assets/docs/reference/cli-reference.md +2 -1
- package/assets/docs/workflows/projects/evidence-layers.md +5 -1
- package/assets/docs/workflows/projects/retro.md +7 -0
- package/assets/public-package-versions.json +4 -4
- package/assets/skills/oat-agent-instructions-analyze/SKILL.md +1 -1
- package/assets/skills/oat-agent-instructions-analyze/scripts/resolve-providers.sh +17 -6
- package/assets/skills/oat-dispatch-subagents/SKILL.md +1 -1
- package/assets/skills/oat-dispatch-subagents/references/managed-claude-example.json +387 -0
- package/assets/skills/oat-dispatch-subagents/references/record-schema.md +75 -0
- package/assets/skills/oat-project-autonomous/references/gate-inventory.md +1 -1
- package/assets/skills/oat-project-document/references/docs/autonomy-contract.md +1 -1
- package/assets/skills/oat-project-implement/SKILL.md +1 -1
- package/assets/skills/oat-project-implement/references/dispatch-and-dry-run.md +24 -22
- package/assets/skills/oat-project-implement/references/docs/autonomy-contract.md +1 -1
- package/assets/skills/oat-project-lite/references/docs/autonomy-contract.md +1 -1
- package/assets/skills/oat-project-pr-final/references/docs/autonomy-contract.md +1 -1
- package/assets/skills/oat-project-quick-start/references/docs/autonomy-contract.md +1 -1
- package/assets/skills/oat-project-retro/SKILL.md +70 -6
- package/assets/skills/oat-project-review-provide/SKILL.md +3 -1
- package/assets/skills/oat-project-review-provide-remote/SKILL.md +3 -1
- package/dist/agents/canonical/resolve.d.ts +6 -4
- package/dist/agents/canonical/resolve.d.ts.map +1 -1
- package/dist/agents/canonical/resolve.js +6 -4
- package/dist/commands/gate/index.d.ts.map +1 -1
- package/dist/commands/gate/index.js +51 -2
- package/dist/commands/gate/review-verdict.d.ts +22 -0
- package/dist/commands/gate/review-verdict.d.ts.map +1 -1
- package/dist/commands/gate/review-verdict.js +111 -0
- package/dist/commands/project/dispatch/canonical-role.d.ts +33 -0
- package/dist/commands/project/dispatch/canonical-role.d.ts.map +1 -0
- package/dist/commands/project/dispatch/canonical-role.js +114 -0
- package/dist/commands/project/dispatch/index.d.ts.map +1 -1
- package/dist/commands/project/dispatch/index.js +3 -1
- package/dist/commands/project/dispatch/record.d.ts.map +1 -1
- package/dist/commands/project/dispatch/record.js +146 -4
- package/dist/commands/sync/apply.d.ts.map +1 -1
- package/dist/commands/sync/apply.js +28 -21
- package/dist/commands/tools/shared/sync-evidence.d.ts.map +1 -1
- package/dist/commands/tools/shared/sync-evidence.js +32 -5
- package/dist/config/oat-config.d.ts +8 -0
- package/dist/config/oat-config.d.ts.map +1 -1
- package/dist/config/oat-config.js +116 -1
- package/dist/engine/compute-plan.d.ts.map +1 -1
- package/dist/engine/compute-plan.js +31 -3
- package/dist/providers/claude/dispatch-envelope.d.ts +53 -0
- package/dist/providers/claude/dispatch-envelope.d.ts.map +1 -1
- package/dist/providers/claude/dispatch-envelope.js +324 -48
- package/dist/providers/claude/rule-transform.js +1 -1
- package/dist/providers/copilot/rule-transform.js +1 -1
- package/dist/providers/cursor/rule-transform.js +1 -1
- package/dist/providers/identity/absolute-paths.d.ts +13 -0
- package/dist/providers/identity/absolute-paths.d.ts.map +1 -1
- package/dist/providers/identity/absolute-paths.js +27 -14
- package/dist/providers/identity/generic-dispatch-record.d.ts +212 -0
- package/dist/providers/identity/generic-dispatch-record.d.ts.map +1 -1
- package/dist/providers/identity/generic-dispatch-record.js +78 -19
- package/dist/providers/identity/oat-dispatch-record.d.ts +5 -0
- package/dist/providers/identity/oat-dispatch-record.d.ts.map +1 -1
- package/dist/providers/identity/oat-dispatch-record.js +11 -2
- package/dist/providers/shared/registry.d.ts +6 -0
- package/dist/providers/shared/registry.d.ts.map +1 -1
- package/dist/providers/shared/registry.js +30 -0
- package/dist/rules/canonical/parse.d.ts.map +1 -1
- package/dist/rules/canonical/parse.js +38 -3
- package/package.json +2 -2
|
@@ -1,9 +1,204 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { type DispatchValueViolation } from './absolute-paths.js';
|
|
2
3
|
/**
|
|
3
4
|
* Whole-record ceiling, applied at every parse entry point so no combination
|
|
4
5
|
* of individually legal fields can produce an unbounded journal revision.
|
|
5
6
|
*/
|
|
6
7
|
export declare function assertBoundedDispatchRecordSize(value: unknown): void;
|
|
8
|
+
/**
|
|
9
|
+
* The closed field set before cross-field refinement. Exported so a caller
|
|
10
|
+
* that validates a partial record — the managed Claude `recordBase`, whose
|
|
11
|
+
* derived fields are omitted — can report every missing, mistyped, or unknown
|
|
12
|
+
* field in one pass instead of discovering them one run at a time.
|
|
13
|
+
*/
|
|
14
|
+
export declare const genericDispatchRecordBaseSchema: z.ZodObject<{
|
|
15
|
+
request_id: z.ZodString;
|
|
16
|
+
caller: z.ZodString;
|
|
17
|
+
scope: z.ZodString;
|
|
18
|
+
objective: z.ZodString;
|
|
19
|
+
action: z.ZodString;
|
|
20
|
+
role_name: z.ZodString;
|
|
21
|
+
role_class: z.ZodString;
|
|
22
|
+
provider: z.ZodString;
|
|
23
|
+
dispatch_context: z.ZodString;
|
|
24
|
+
dispatch_policy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
25
|
+
dispatch_ceiling: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
26
|
+
catalog_snapshot: z.ZodObject<{
|
|
27
|
+
id: z.ZodString;
|
|
28
|
+
source: z.ZodString;
|
|
29
|
+
observed_at: z.ZodString;
|
|
30
|
+
}, "strict", z.ZodTypeAny, {
|
|
31
|
+
id: string;
|
|
32
|
+
source: string;
|
|
33
|
+
observed_at: string;
|
|
34
|
+
}, {
|
|
35
|
+
id: string;
|
|
36
|
+
source: string;
|
|
37
|
+
observed_at: string;
|
|
38
|
+
}>;
|
|
39
|
+
authority: z.ZodString;
|
|
40
|
+
role_selector: z.ZodNullable<z.ZodString>;
|
|
41
|
+
model_selector: z.ZodNullable<z.ZodString>;
|
|
42
|
+
model_selector_granularity: z.ZodNullable<z.ZodString>;
|
|
43
|
+
effort_selector: z.ZodNullable<z.ZodString>;
|
|
44
|
+
reasoning_mode_selector: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
45
|
+
service_tier_selector: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
46
|
+
guidance_reference: z.ZodOptional<z.ZodString>;
|
|
47
|
+
guidance_version: z.ZodOptional<z.ZodString>;
|
|
48
|
+
guidance_verified_at: z.ZodOptional<z.ZodString>;
|
|
49
|
+
guidance_status: z.ZodOptional<z.ZodEnum<["fresh", "review-required", "stale"]>>;
|
|
50
|
+
selection_source: z.ZodEnum<["native-default", "policy-resolved", "explicit-user"]>;
|
|
51
|
+
candidates_considered: z.ZodArray<z.ZodString, "many">;
|
|
52
|
+
selection_reason: z.ZodEnum<["native-catalog", "native-catalog-unsatisfying", "pre-start-rejection", "inherit", "gate-target"]>;
|
|
53
|
+
selected_route: z.ZodString;
|
|
54
|
+
deadline_seconds: z.ZodNumber;
|
|
55
|
+
retry_limit: z.ZodNumber;
|
|
56
|
+
payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
57
|
+
launch_status: z.ZodEnum<["planned", "accepted", "blocked-before-start"]>;
|
|
58
|
+
child_outcome: z.ZodNullable<z.ZodString>;
|
|
59
|
+
configured_invocation_evidence: z.ZodArray<z.ZodUnknown, "many">;
|
|
60
|
+
runtime_confirmation: z.ZodString;
|
|
61
|
+
diagnostics: z.ZodArray<z.ZodString, "many">;
|
|
62
|
+
continuation_events: z.ZodArray<z.ZodUnknown, "many">;
|
|
63
|
+
fallback: z.ZodOptional<z.ZodObject<{
|
|
64
|
+
mode: z.ZodString;
|
|
65
|
+
target: z.ZodOptional<z.ZodString>;
|
|
66
|
+
allow_below_task_class_floor: z.ZodOptional<z.ZodBoolean>;
|
|
67
|
+
}, "strict", z.ZodTypeAny, {
|
|
68
|
+
mode: string;
|
|
69
|
+
target?: string | undefined;
|
|
70
|
+
allow_below_task_class_floor?: boolean | undefined;
|
|
71
|
+
}, {
|
|
72
|
+
mode: string;
|
|
73
|
+
target?: string | undefined;
|
|
74
|
+
allow_below_task_class_floor?: boolean | undefined;
|
|
75
|
+
}>>;
|
|
76
|
+
task_class: z.ZodOptional<z.ZodEnum<["mechanical-recon", "intelligent-recon", "default-implementation", "hard-reasoning", "consequential"]>>;
|
|
77
|
+
model_class_floor: z.ZodOptional<z.ZodString>;
|
|
78
|
+
classification_source: z.ZodOptional<z.ZodLiteral<"caller">>;
|
|
79
|
+
classification_reason: z.ZodOptional<z.ZodString>;
|
|
80
|
+
floor_satisfaction: z.ZodOptional<z.ZodEnum<["satisfied", "unsatisfied"]>>;
|
|
81
|
+
authorization_scope: z.ZodOptional<z.ZodString>;
|
|
82
|
+
expected_output: z.ZodOptional<z.ZodString>;
|
|
83
|
+
verification_evidence: z.ZodOptional<z.ZodString>;
|
|
84
|
+
escalate_when: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
85
|
+
}, "strict", z.ZodTypeAny, {
|
|
86
|
+
request_id: string;
|
|
87
|
+
caller: string;
|
|
88
|
+
scope: string;
|
|
89
|
+
objective: string;
|
|
90
|
+
action: string;
|
|
91
|
+
role_name: string;
|
|
92
|
+
role_class: string;
|
|
93
|
+
provider: string;
|
|
94
|
+
dispatch_context: string;
|
|
95
|
+
dispatch_policy?: string | null | undefined;
|
|
96
|
+
dispatch_ceiling?: string | null | undefined;
|
|
97
|
+
catalog_snapshot: {
|
|
98
|
+
id: string;
|
|
99
|
+
source: string;
|
|
100
|
+
observed_at: string;
|
|
101
|
+
};
|
|
102
|
+
authority: string;
|
|
103
|
+
role_selector: string | null;
|
|
104
|
+
model_selector: string | null;
|
|
105
|
+
model_selector_granularity: string | null;
|
|
106
|
+
effort_selector: string | null;
|
|
107
|
+
reasoning_mode_selector?: string | null | undefined;
|
|
108
|
+
service_tier_selector?: string | null | undefined;
|
|
109
|
+
guidance_reference?: string | undefined;
|
|
110
|
+
guidance_version?: string | undefined;
|
|
111
|
+
guidance_verified_at?: string | undefined;
|
|
112
|
+
guidance_status?: "fresh" | "review-required" | "stale" | undefined;
|
|
113
|
+
selection_source: "explicit-user" | "native-default" | "policy-resolved";
|
|
114
|
+
candidates_considered: string[];
|
|
115
|
+
selection_reason: "gate-target" | "inherit" | "native-catalog" | "native-catalog-unsatisfying" | "pre-start-rejection";
|
|
116
|
+
selected_route: string;
|
|
117
|
+
deadline_seconds: number;
|
|
118
|
+
retry_limit: number;
|
|
119
|
+
payload: Record<string, unknown>;
|
|
120
|
+
launch_status: "accepted" | "blocked-before-start" | "planned";
|
|
121
|
+
child_outcome: string | null;
|
|
122
|
+
configured_invocation_evidence: unknown[];
|
|
123
|
+
runtime_confirmation: string;
|
|
124
|
+
diagnostics: string[];
|
|
125
|
+
continuation_events: unknown[];
|
|
126
|
+
fallback?: {
|
|
127
|
+
mode: string;
|
|
128
|
+
target?: string | undefined;
|
|
129
|
+
allow_below_task_class_floor?: boolean | undefined;
|
|
130
|
+
} | undefined;
|
|
131
|
+
task_class?: "consequential" | "default-implementation" | "hard-reasoning" | "intelligent-recon" | "mechanical-recon" | undefined;
|
|
132
|
+
model_class_floor?: string | undefined;
|
|
133
|
+
classification_source?: "caller" | undefined;
|
|
134
|
+
classification_reason?: string | undefined;
|
|
135
|
+
floor_satisfaction?: "satisfied" | "unsatisfied" | undefined;
|
|
136
|
+
authorization_scope?: string | undefined;
|
|
137
|
+
expected_output?: string | undefined;
|
|
138
|
+
verification_evidence?: string | undefined;
|
|
139
|
+
escalate_when?: string[] | undefined;
|
|
140
|
+
}, {
|
|
141
|
+
request_id: string;
|
|
142
|
+
caller: string;
|
|
143
|
+
scope: string;
|
|
144
|
+
objective: string;
|
|
145
|
+
action: string;
|
|
146
|
+
role_name: string;
|
|
147
|
+
role_class: string;
|
|
148
|
+
provider: string;
|
|
149
|
+
dispatch_context: string;
|
|
150
|
+
dispatch_policy?: string | null | undefined;
|
|
151
|
+
dispatch_ceiling?: string | null | undefined;
|
|
152
|
+
catalog_snapshot: {
|
|
153
|
+
id: string;
|
|
154
|
+
source: string;
|
|
155
|
+
observed_at: string;
|
|
156
|
+
};
|
|
157
|
+
authority: string;
|
|
158
|
+
role_selector: string | null;
|
|
159
|
+
model_selector: string | null;
|
|
160
|
+
model_selector_granularity: string | null;
|
|
161
|
+
effort_selector: string | null;
|
|
162
|
+
reasoning_mode_selector?: string | null | undefined;
|
|
163
|
+
service_tier_selector?: string | null | undefined;
|
|
164
|
+
guidance_reference?: string | undefined;
|
|
165
|
+
guidance_version?: string | undefined;
|
|
166
|
+
guidance_verified_at?: string | undefined;
|
|
167
|
+
guidance_status?: "fresh" | "review-required" | "stale" | undefined;
|
|
168
|
+
selection_source: "explicit-user" | "native-default" | "policy-resolved";
|
|
169
|
+
candidates_considered: string[];
|
|
170
|
+
selection_reason: "gate-target" | "inherit" | "native-catalog" | "native-catalog-unsatisfying" | "pre-start-rejection";
|
|
171
|
+
selected_route: string;
|
|
172
|
+
deadline_seconds: number;
|
|
173
|
+
retry_limit: number;
|
|
174
|
+
payload: Record<string, unknown>;
|
|
175
|
+
launch_status: "accepted" | "blocked-before-start" | "planned";
|
|
176
|
+
child_outcome: string | null;
|
|
177
|
+
configured_invocation_evidence: unknown[];
|
|
178
|
+
runtime_confirmation: string;
|
|
179
|
+
diagnostics: string[];
|
|
180
|
+
continuation_events: unknown[];
|
|
181
|
+
fallback?: {
|
|
182
|
+
mode: string;
|
|
183
|
+
target?: string | undefined;
|
|
184
|
+
allow_below_task_class_floor?: boolean | undefined;
|
|
185
|
+
} | undefined;
|
|
186
|
+
task_class?: "consequential" | "default-implementation" | "hard-reasoning" | "intelligent-recon" | "mechanical-recon" | undefined;
|
|
187
|
+
model_class_floor?: string | undefined;
|
|
188
|
+
classification_source?: "caller" | undefined;
|
|
189
|
+
classification_reason?: string | undefined;
|
|
190
|
+
floor_satisfaction?: "satisfied" | "unsatisfied" | undefined;
|
|
191
|
+
authorization_scope?: string | undefined;
|
|
192
|
+
expected_output?: string | undefined;
|
|
193
|
+
verification_evidence?: string | undefined;
|
|
194
|
+
escalate_when?: string[] | undefined;
|
|
195
|
+
}>;
|
|
196
|
+
/**
|
|
197
|
+
* Cross-field rules over the base object. Every field is read defensively, so
|
|
198
|
+
* the same rules apply to a partial projection of the record (for example one
|
|
199
|
+
* with the managed Claude derived fields omitted).
|
|
200
|
+
*/
|
|
201
|
+
export declare function refineGenericDispatchRecord(record: Partial<z.infer<typeof genericDispatchRecordBaseSchema>>, context: z.RefinementCtx): void;
|
|
7
202
|
export declare const genericDispatchRecordSchema: z.ZodEffects<z.ZodObject<{
|
|
8
203
|
request_id: z.ZodString;
|
|
9
204
|
caller: z.ZodString;
|
|
@@ -298,7 +493,24 @@ export declare const genericDispatchRecordSchema: z.ZodEffects<z.ZodObject<{
|
|
|
298
493
|
}>;
|
|
299
494
|
export type GenericDispatchRecord = z.infer<typeof genericDispatchRecordSchema>;
|
|
300
495
|
export declare function normalizeDispatchKey(key: string): string;
|
|
496
|
+
/** The stable stand-in for a scrubbed secret-shaped value. */
|
|
497
|
+
export declare const REDACTED_SECRET = "<redacted-secret>";
|
|
498
|
+
/**
|
|
499
|
+
* Scrub every secret-shaped value from outgoing text, using the same value
|
|
500
|
+
* detector the sensitive-content walk uses. Each match is extended to the end
|
|
501
|
+
* of its token, so a pattern that recognizes only a prefix (a JWT's header and
|
|
502
|
+
* payload, say) does not leave the rest behind. Like the detector, this is a
|
|
503
|
+
* best-effort layer: a value that no pattern recognizes survives.
|
|
504
|
+
*/
|
|
505
|
+
export declare function redactSensitiveValues(text: string): string;
|
|
301
506
|
export declare function isSensitiveDispatchKey(key: string): boolean;
|
|
507
|
+
/**
|
|
508
|
+
* Collect every sensitive key and value, in the same depth-first order
|
|
509
|
+
* {@link assertNoSensitiveDispatchContent} visits them. A sensitive key is
|
|
510
|
+
* reported once and not descended into: everything beneath it is already
|
|
511
|
+
* forbidden, and its content must not be echoed back in a report.
|
|
512
|
+
*/
|
|
513
|
+
export declare function collectSensitiveDispatchContent(value: unknown, path?: string): DispatchValueViolation[];
|
|
302
514
|
export declare function assertNoSensitiveDispatchContent(value: unknown, path?: string): void;
|
|
303
515
|
/**
|
|
304
516
|
* The persistence-boundary path sanitizer for the generic record.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generic-dispatch-record.d.ts","sourceRoot":"","sources":["../../../src/providers/identity/generic-dispatch-record.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"generic-dispatch-record.d.ts","sourceRoot":"","sources":["../../../src/providers/identity/generic-dispatch-record.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,kBAAkB,CAAC;AAuK1B;;;GAGG;AACH,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAOpE;AAUD;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmEjC,CAAC;AAEZ;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC,EAChE,OAAO,EAAE,CAAC,CAAC,aAAa,GACvB,IAAI,CAyDN;AAED,eAAO,MAAM,2BAA2B;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|
15
15
|
const proseText = () => z.string().min(1).max(MAX_PROSE_LENGTH);
|
|
16
16
|
const requestIdSchema = z
|
|
17
17
|
.string()
|
|
18
|
-
.regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$/, 'request_id must be a stable contained identifier');
|
|
18
|
+
.regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$/, 'request_id must be a stable contained identifier: expected [a-zA-Z0-9] followed by up to 127 of [a-zA-Z0-9._-]');
|
|
19
19
|
const catalogSnapshotSchema = z
|
|
20
20
|
.object({
|
|
21
21
|
id: identifier(),
|
|
@@ -149,7 +149,13 @@ const TASK_CLASS_FIELDS = [
|
|
|
149
149
|
'classification_reason',
|
|
150
150
|
'floor_satisfaction',
|
|
151
151
|
];
|
|
152
|
-
|
|
152
|
+
/**
|
|
153
|
+
* The closed field set before cross-field refinement. Exported so a caller
|
|
154
|
+
* that validates a partial record — the managed Claude `recordBase`, whose
|
|
155
|
+
* derived fields are omitted — can report every missing, mistyped, or unknown
|
|
156
|
+
* field in one pass instead of discovering them one run at a time.
|
|
157
|
+
*/
|
|
158
|
+
export const genericDispatchRecordBaseSchema = z
|
|
153
159
|
.object({
|
|
154
160
|
request_id: requestIdSchema,
|
|
155
161
|
caller: identifier(),
|
|
@@ -216,8 +222,13 @@ export const genericDispatchRecordSchema = z
|
|
|
216
222
|
verification_evidence: proseText().optional(),
|
|
217
223
|
escalate_when: z.array(reasonText()).optional(),
|
|
218
224
|
})
|
|
219
|
-
.strict()
|
|
220
|
-
|
|
225
|
+
.strict();
|
|
226
|
+
/**
|
|
227
|
+
* Cross-field rules over the base object. Every field is read defensively, so
|
|
228
|
+
* the same rules apply to a partial projection of the record (for example one
|
|
229
|
+
* with the managed Claude derived fields omitted).
|
|
230
|
+
*/
|
|
231
|
+
export function refineGenericDispatchRecord(record, context) {
|
|
221
232
|
if (record.launch_status === 'accepted' && record.child_outcome === null) {
|
|
222
233
|
context.addIssue({
|
|
223
234
|
code: z.ZodIssueCode.custom,
|
|
@@ -264,7 +275,8 @@ export const genericDispatchRecordSchema = z
|
|
|
264
275
|
path: ['model_class_floor'],
|
|
265
276
|
});
|
|
266
277
|
}
|
|
267
|
-
}
|
|
278
|
+
}
|
|
279
|
+
export const genericDispatchRecordSchema = genericDispatchRecordBaseSchema.superRefine(refineGenericDispatchRecord);
|
|
268
280
|
/**
|
|
269
281
|
* Latin look-alikes from other scripts, folded to their Latin counterpart so a
|
|
270
282
|
* homoglyph spelling classifies as the token it imitates. This map is a
|
|
@@ -444,6 +456,37 @@ const SENSITIVE_VALUE_PATTERNS = [
|
|
|
444
456
|
/\bnpm_[A-Za-z0-9]{30,}/,
|
|
445
457
|
/\b[a-z][a-z0-9+.-]*:\/\/[^\s:/?#@]+:[^\s:/?#@]+@/i,
|
|
446
458
|
];
|
|
459
|
+
/** The stable stand-in for a scrubbed secret-shaped value. */
|
|
460
|
+
export const REDACTED_SECRET = '<redacted-secret>';
|
|
461
|
+
/**
|
|
462
|
+
* A private key block is multi-line, so the header pattern alone would leave
|
|
463
|
+
* its body behind; the whole block is replaced first. An unterminated block
|
|
464
|
+
* runs to the end of the text, which fails safe (no body line survives) but
|
|
465
|
+
* also consumes everything after it. Callers joining several messages should
|
|
466
|
+
* therefore scrub each message before joining, as the managed Claude report
|
|
467
|
+
* does, and keep this pass as the backstop.
|
|
468
|
+
*/
|
|
469
|
+
const PRIVATE_KEY_BLOCK = /-----BEGIN (?:RSA |EC |DSA |OPENSSH |PGP )?PRIVATE KEY-----[\s\S]*?(?:-----END (?:RSA |EC |DSA |OPENSSH |PGP )?PRIVATE KEY-----|$)/gi;
|
|
470
|
+
/**
|
|
471
|
+
* Scrub every secret-shaped value from outgoing text, using the same value
|
|
472
|
+
* detector the sensitive-content walk uses. Each match is extended to the end
|
|
473
|
+
* of its token, so a pattern that recognizes only a prefix (a JWT's header and
|
|
474
|
+
* payload, say) does not leave the rest behind. Like the detector, this is a
|
|
475
|
+
* best-effort layer: a value that no pattern recognizes survives.
|
|
476
|
+
*/
|
|
477
|
+
export function redactSensitiveValues(text) {
|
|
478
|
+
let redacted = text.replace(PRIVATE_KEY_BLOCK, REDACTED_SECRET);
|
|
479
|
+
for (const pattern of SENSITIVE_VALUE_PATTERNS) {
|
|
480
|
+
const flags = pattern.flags.includes('g')
|
|
481
|
+
? pattern.flags
|
|
482
|
+
: `${pattern.flags}g`;
|
|
483
|
+
redacted = redacted.replace(new RegExp(`(?:${pattern.source})[^\\s'"\`,;)\\]}]*`, flags),
|
|
484
|
+
// Extending to the token end also takes a sentence's closing period;
|
|
485
|
+
// give it back so the scrubbed message still reads as a sentence.
|
|
486
|
+
(match) => `${REDACTED_SECRET}${/\.+$/.exec(match)?.[0] ?? ''}`);
|
|
487
|
+
}
|
|
488
|
+
return redacted;
|
|
489
|
+
}
|
|
447
490
|
export function isSensitiveDispatchKey(key) {
|
|
448
491
|
const { normalized, unrecognized } = foldDispatchKey(key);
|
|
449
492
|
// Fail closed: a key this normalizer cannot fully account for is treated as
|
|
@@ -458,26 +501,42 @@ export function isSensitiveDispatchKey(key) {
|
|
|
458
501
|
return true;
|
|
459
502
|
return SENSITIVE_KEY_FAMILIES.some((family) => normalized.includes(family));
|
|
460
503
|
}
|
|
461
|
-
|
|
504
|
+
/**
|
|
505
|
+
* Collect every sensitive key and value, in the same depth-first order
|
|
506
|
+
* {@link assertNoSensitiveDispatchContent} visits them. A sensitive key is
|
|
507
|
+
* reported once and not descended into: everything beneath it is already
|
|
508
|
+
* forbidden, and its content must not be echoed back in a report.
|
|
509
|
+
*/
|
|
510
|
+
export function collectSensitiveDispatchContent(value, path = '<record>') {
|
|
462
511
|
if (typeof value === 'string') {
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
512
|
+
return SENSITIVE_VALUE_PATTERNS.some((pattern) => pattern.test(value))
|
|
513
|
+
? [
|
|
514
|
+
{
|
|
515
|
+
path,
|
|
516
|
+
message: `Sensitive dispatch content is forbidden at ${path}.`,
|
|
517
|
+
},
|
|
518
|
+
]
|
|
519
|
+
: [];
|
|
467
520
|
}
|
|
468
521
|
if (Array.isArray(value)) {
|
|
469
|
-
value.
|
|
470
|
-
return;
|
|
522
|
+
return value.flatMap((entry, index) => collectSensitiveDispatchContent(entry, `${path}[${index}]`));
|
|
471
523
|
}
|
|
472
524
|
if (value === null || typeof value !== 'object') {
|
|
473
|
-
return;
|
|
474
|
-
}
|
|
475
|
-
for (const [key, entry] of Object.entries(value)) {
|
|
476
|
-
if (isSensitiveDispatchKey(key)) {
|
|
477
|
-
throw new Error(`Sensitive dispatch content is forbidden at ${path}.${key}.`);
|
|
478
|
-
}
|
|
479
|
-
assertNoSensitiveDispatchContent(entry, `${path}.${key}`);
|
|
525
|
+
return [];
|
|
480
526
|
}
|
|
527
|
+
return Object.entries(value).flatMap(([key, entry]) => isSensitiveDispatchKey(key)
|
|
528
|
+
? [
|
|
529
|
+
{
|
|
530
|
+
path: `${path}.${key}`,
|
|
531
|
+
message: `Sensitive dispatch content is forbidden at ${path}.${key}.`,
|
|
532
|
+
},
|
|
533
|
+
]
|
|
534
|
+
: collectSensitiveDispatchContent(entry, `${path}.${key}`));
|
|
535
|
+
}
|
|
536
|
+
export function assertNoSensitiveDispatchContent(value, path = '<record>') {
|
|
537
|
+
const [first] = collectSensitiveDispatchContent(value, path);
|
|
538
|
+
if (first)
|
|
539
|
+
throw new Error(first.message);
|
|
481
540
|
}
|
|
482
541
|
/**
|
|
483
542
|
* Fields where an absolute path is incidental content rather than a malformed
|
|
@@ -1953,6 +1953,11 @@ declare const oatDispatchEvidenceEventSchema: z.ZodDiscriminatedUnion<"kind", [z
|
|
|
1953
1953
|
};
|
|
1954
1954
|
}>]>;
|
|
1955
1955
|
export type OatDispatchEvidenceEvent = z.infer<typeof oatDispatchEvidenceEventSchema>;
|
|
1956
|
+
/**
|
|
1957
|
+
* Non-throwing event validation, so a caller can report every event issue
|
|
1958
|
+
* alongside violations found in other stages of the same input.
|
|
1959
|
+
*/
|
|
1960
|
+
export declare function safeParseOatDispatchEvidenceEvent(value: unknown): z.SafeParseReturnType<unknown, OatDispatchEvidenceEvent>;
|
|
1956
1961
|
export declare function parsePersistedOatDispatchRecord(value: unknown): PersistedOatDispatchRecordV1;
|
|
1957
1962
|
export declare function augmentDispatchRecord(input: {
|
|
1958
1963
|
record: GenericDispatchRecord | PersistedOatDispatchRecordV1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oat-dispatch-record.d.ts","sourceRoot":"","sources":["../../../src/providers/identity/oat-dispatch-record.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAML,KAAK,qBAAqB,EAC3B,MAAM,2BAA2B,CAAC;AAEnC;;;;;GAKG;AACH,eAAO,MAAM,oCAAoC,YAC/C,yBAAyB,EACzB,2BAA2B,EAC3B,6BAA6B,EAC7B,6BAA6B,EAC7B,sCAAsC,EACtC,0BAA0B,EAC1B,wBAAwB,CAChB,CAAC;AAEX,MAAM,MAAM,+BAA+B,GACzC,CAAC,OAAO,oCAAoC,CAAC,CAAC,MAAM,CAAC,CAAC;AA0DxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,eAAO,MAAM,iCAAiC,omBAgCe,CAAC;AAE9D;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,wRAgBiB,CAAC;AAE9D,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAe5D;AAaD,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,qBAAqB,GAAG,MAAM,CAI7E;
|
|
1
|
+
{"version":3,"file":"oat-dispatch-record.d.ts","sourceRoot":"","sources":["../../../src/providers/identity/oat-dispatch-record.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAML,KAAK,qBAAqB,EAC3B,MAAM,2BAA2B,CAAC;AAEnC;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AwB,GAAG,CAAC,CAAC,KAAK,CAC5C,OAAO,8BAA8B,CACtC,CAAC;AAEF;;;GAGG;AACH,wBAAgB,iCAAiC,CAC/C,KAAK,EAAE,OAAO,GACb,CAAC,CAAC,mBAAmB,CAAC,OAAO,EAAE,wBAAwB,CAAC,CAE1D;AAgDD,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,OAAO,GACb,4BAA4B,CAiB9B;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IAC3C,MAAM,EAAE,qBAAqB,GAAG,4BAA4B,CAAC;IAC7D,KAAK,EAAE,wBAAwB,CAAC;IAChC,aAAa,CAAC,EAAE,4BAA4B,CAAC;IAC7C,cAAc,CAAC,EAAE,SAAS,4BAA4B,EAAE,CAAC;CAC1D,GAAG,4BAA4B,CA2K/B"}
|
|
@@ -194,7 +194,7 @@ function differingControlFields(left, right) {
|
|
|
194
194
|
}
|
|
195
195
|
const redactedPathSchema = z
|
|
196
196
|
.string()
|
|
197
|
-
.regex(/^<(?:loaded|user|project)>\/agents\/[a-z0-9][a-z0-9_-]*\.md
|
|
197
|
+
.regex(/^<(?:loaded|user|project)>\/agents\/[a-z0-9][a-z0-9_-]*\.md$/, 'expected <loaded|user|project>/agents/<name>.md');
|
|
198
198
|
const candidateMissSchema = z
|
|
199
199
|
.object({
|
|
200
200
|
tier: z.enum(['loaded', 'user', 'project']),
|
|
@@ -219,7 +219,9 @@ const resolvedRoleSchema = z
|
|
|
219
219
|
canonicalPath: redactedPathSchema,
|
|
220
220
|
selectedPath: redactedPathSchema,
|
|
221
221
|
roleVersion: z.string().min(1),
|
|
222
|
-
contentDigest: z
|
|
222
|
+
contentDigest: z
|
|
223
|
+
.string()
|
|
224
|
+
.regex(/^sha256:[a-f0-9]{64}$/, 'expected sha256:<64 lowercase hex>'),
|
|
223
225
|
candidateMisses: z.array(candidateMissSchema),
|
|
224
226
|
})
|
|
225
227
|
.strict();
|
|
@@ -522,6 +524,13 @@ const oatDispatchEvidenceEventSchema = z.discriminatedUnion('kind', [
|
|
|
522
524
|
})
|
|
523
525
|
.strict(),
|
|
524
526
|
]);
|
|
527
|
+
/**
|
|
528
|
+
* Non-throwing event validation, so a caller can report every event issue
|
|
529
|
+
* alongside violations found in other stages of the same input.
|
|
530
|
+
*/
|
|
531
|
+
export function safeParseOatDispatchEvidenceEvent(value) {
|
|
532
|
+
return oatDispatchEvidenceEventSchema.safeParse(value);
|
|
533
|
+
}
|
|
525
534
|
function initialOatRecord() {
|
|
526
535
|
return {
|
|
527
536
|
schemaVersion: 1,
|
|
@@ -52,6 +52,12 @@ export interface ProviderScopeContext {
|
|
|
52
52
|
registrations: readonly ProviderRegistration[];
|
|
53
53
|
}
|
|
54
54
|
export declare function resolveCatalogRefreshPolicy(supported: boolean, providerPolicy?: ProviderCatalogRefreshPolicy): ProviderCatalogRefreshPolicy;
|
|
55
|
+
/**
|
|
56
|
+
* Validates an untrusted catalog-refresh policy (for example one read back
|
|
57
|
+
* from a sync JSON payload) with the same provenance rules the registry
|
|
58
|
+
* applies to its own policies.
|
|
59
|
+
*/
|
|
60
|
+
export declare function isValidCatalogRefreshPolicy(value: unknown): value is ProviderCatalogRefreshPolicy;
|
|
55
61
|
export type UserAgentMaterializationCoverage = 'none' | 'bundled' | 'all';
|
|
56
62
|
export declare function userAgentMaterializationCoverage(input: {
|
|
57
63
|
registrations: readonly ProviderRegistration[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/providers/shared/registry.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAStD,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEhE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAE5E,MAAM,MAAM,sBAAsB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AU,EAAE,SAAS,0BAA0B,EAAE,CAAC;IAClD,aAAa,EAAE,SAAS,oBAAoB,EAAE,CAAC;CAChD;AA4BD,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,OAAO,EAClB,cAAc,CAAC,EAAE,4BAA4B,GAC5C,4BAA4B,CAG9B;AAgDD;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,4BAA4B,CA0BvC;AAED,MAAM,MAAM,gCAAgC,GAAG,MAAM,GAAG,SAAS,GAAG,KAAK,CAAC;AAE1E,wBAAgB,gCAAgC,CAAC,KAAK,EAAE;IACtD,aAAa,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAC/C,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC,GAAG,gCAAgC,CAiBnC;AAoFD,wBAAgB,6BAA6B,CAC3C,aAAa,EAAE,SAAS,oBAAoB,EAAE,GAC7C,IAAI,CAoDN;AAED,wBAAgB,wBAAwB,IAAI,SAAS,oBAAoB,EAAE,CAG1E;AAED,wBAAsB,2BAA2B,CAAC,KAAK,EAAE;IACvD,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,UAAU,CAAC;IACnB,aAAa,CAAC,EAAE,SAAS,oBAAoB,EAAE,CAAC;CACjD,GAAG,OAAO,CAAC,oBAAoB,CAAC,CA0BhC;AAED,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,IAAI,CACZ,oBAAoB,EACpB,OAAO,GAAG,cAAc,GAAG,mBAAmB,GAAG,eAAe,CACjE,EACD,MAAM,EAAE,UAAU,GACjB,oBAAoB,CA+CtB"}
|
|
@@ -60,6 +60,36 @@ function hasValidRefreshProvenance(policy) {
|
|
|
60
60
|
return (!Number.isNaN(date.getTime()) &&
|
|
61
61
|
date.toISOString().slice(0, 10) === provenance.verifiedAt);
|
|
62
62
|
}
|
|
63
|
+
const CATALOG_REFRESH_STATES = new Set([
|
|
64
|
+
'live',
|
|
65
|
+
'manual-refresh',
|
|
66
|
+
'restart-required',
|
|
67
|
+
'unknown',
|
|
68
|
+
]);
|
|
69
|
+
/**
|
|
70
|
+
* Validates an untrusted catalog-refresh policy (for example one read back
|
|
71
|
+
* from a sync JSON payload) with the same provenance rules the registry
|
|
72
|
+
* applies to its own policies.
|
|
73
|
+
*/
|
|
74
|
+
export function isValidCatalogRefreshPolicy(value) {
|
|
75
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
const candidate = value;
|
|
79
|
+
if (typeof candidate.state !== 'string' ||
|
|
80
|
+
!CATALOG_REFRESH_STATES.has(candidate.state)) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
if (candidate.state === 'unknown') {
|
|
84
|
+
return typeof candidate.reason === 'string';
|
|
85
|
+
}
|
|
86
|
+
if (typeof candidate.provenance !== 'object' ||
|
|
87
|
+
candidate.provenance === null ||
|
|
88
|
+
Array.isArray(candidate.provenance)) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
return hasValidRefreshProvenance(value);
|
|
92
|
+
}
|
|
63
93
|
export function userAgentMaterializationCoverage(input) {
|
|
64
94
|
const active = new Set(input.activeProviders);
|
|
65
95
|
let coverage = 'none';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../src/rules/canonical/parse.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,qBAAqB,EAGtB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../src/rules/canonical/parse.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,qBAAqB,EAGtB,MAAM,SAAS,CAAC;AAoIjB,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,EAChB,QAAQ,SAAa,GACpB;IACD,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC5C,IAAI,EAAE,MAAM,CAAC;CACd,CAiBA;AAED,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,MAAM,EAChB,QAAQ,SAAa,GACpB,qBAAqB,CAyCvB;AAED,wBAAsB,sBAAsB,CAC1C,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,qBAAqB,CAAC,CAGhC"}
|
|
@@ -51,6 +51,39 @@ function parseActivation(value, filePath) {
|
|
|
51
51
|
}
|
|
52
52
|
throw new CliError(`Frontmatter field "activation" in ${filePath} must be one of ${RULE_ACTIVATIONS.join(', ')}.`);
|
|
53
53
|
}
|
|
54
|
+
function isEmptyCursorGlobs(value) {
|
|
55
|
+
return (value === undefined ||
|
|
56
|
+
value === null ||
|
|
57
|
+
(typeof value === 'string' && value.trim() === '') ||
|
|
58
|
+
(Array.isArray(value) && value.length === 0));
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Resolves the rule activation. An explicit `activation` always wins. Without
|
|
62
|
+
* one, a Cursor-style `alwaysApply: true` (written by third-party installers
|
|
63
|
+
* such as `argent init`, GitHub issue #316) is accepted as an alias for
|
|
64
|
+
* `activation: always`. Canonical rules keep globs only for
|
|
65
|
+
* `activation: glob`, so under the alias a null or empty Cursor-style `globs`
|
|
66
|
+
* is ignored and a non-empty one is rejected. Any other `alwaysApply` value
|
|
67
|
+
* without `activation` stays an activation error.
|
|
68
|
+
*/
|
|
69
|
+
function resolveActivation(frontmatter, filePath) {
|
|
70
|
+
if (frontmatter.activation !== undefined) {
|
|
71
|
+
return {
|
|
72
|
+
activation: parseActivation(frontmatter.activation, filePath),
|
|
73
|
+
ignoreGlobs: false,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
if (frontmatter.alwaysApply === true) {
|
|
77
|
+
if (!isEmptyCursorGlobs(frontmatter.globs)) {
|
|
78
|
+
throw new CliError(`Frontmatter field "globs" in ${filePath} is not valid with "alwaysApply: true"; canonical rules keep globs only when activation is glob.`);
|
|
79
|
+
}
|
|
80
|
+
return { activation: 'always', ignoreGlobs: true };
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
activation: parseActivation(frontmatter.activation, filePath),
|
|
84
|
+
ignoreGlobs: false,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
54
87
|
export function stripTrailingOatMarker(content) {
|
|
55
88
|
return content.replace(OAT_MARKER_PATTERN, '').trimEnd();
|
|
56
89
|
}
|
|
@@ -72,11 +105,13 @@ export function parseMarkdownFrontmatter(markdown, filePath = '<inline>') {
|
|
|
72
105
|
export function parseCanonicalRuleMarkdown(markdown, filePath = '<inline>') {
|
|
73
106
|
const { frontmatter, body } = parseMarkdownFrontmatter(markdown, filePath);
|
|
74
107
|
if (!frontmatter) {
|
|
75
|
-
throw new CliError(
|
|
108
|
+
throw new CliError(`Rule markdown in ${filePath} must include YAML frontmatter.`);
|
|
76
109
|
}
|
|
77
|
-
const activation =
|
|
110
|
+
const { activation, ignoreGlobs } = resolveActivation(frontmatter, filePath);
|
|
78
111
|
const description = parseDescription(frontmatter.description, filePath);
|
|
79
|
-
const globs =
|
|
112
|
+
const globs = ignoreGlobs
|
|
113
|
+
? undefined
|
|
114
|
+
: parseGlobs(frontmatter.globs, filePath);
|
|
80
115
|
if (activation === 'glob' && (!globs || globs.length === 0)) {
|
|
81
116
|
throw new CliError(`Frontmatter field "globs" is required in ${filePath} when activation is glob.`);
|
|
82
117
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-agent-toolkit/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Open Agent Toolkit CLI",
|
|
6
6
|
"homepage": "https://github.com/voxmedia/open-agent-toolkit/tree/main/packages/cli",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"ora": "^9.0.0",
|
|
35
35
|
"yaml": "2.8.2",
|
|
36
36
|
"zod": "^3.25.76",
|
|
37
|
-
"@open-agent-toolkit/control-plane": "0.3.
|
|
37
|
+
"@open-agent-toolkit/control-plane": "0.3.8"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/node": "^22.10.0",
|