@namzu/sdk 7.0.0 → 8.0.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 +437 -0
- package/dist/agents/SupervisorAgent.d.ts.map +1 -1
- package/dist/agents/SupervisorAgent.js +172 -162
- package/dist/agents/SupervisorAgent.js.map +1 -1
- package/dist/agents/__tests__/supervisor-inbox-scope.test.d.ts +2 -0
- package/dist/agents/__tests__/supervisor-inbox-scope.test.d.ts.map +1 -0
- package/dist/agents/__tests__/supervisor-inbox-scope.test.js +125 -0
- package/dist/agents/__tests__/supervisor-inbox-scope.test.js.map +1 -0
- package/dist/bridge/a2a/mapper.d.ts.map +1 -1
- package/dist/bridge/a2a/mapper.js +4 -0
- package/dist/bridge/a2a/mapper.js.map +1 -1
- package/dist/bridge/sse/mapper.d.ts.map +1 -1
- package/dist/bridge/sse/mapper.js +24 -0
- package/dist/bridge/sse/mapper.js.map +1 -1
- package/dist/contracts/api.d.ts +1 -1
- package/dist/contracts/api.d.ts.map +1 -1
- package/dist/gateway/__tests__/completion-inbox.test.js +292 -2
- package/dist/gateway/__tests__/completion-inbox.test.js.map +1 -1
- package/dist/gateway/completion-inbox.d.ts +94 -6
- package/dist/gateway/completion-inbox.d.ts.map +1 -1
- package/dist/gateway/completion-inbox.js +235 -15
- package/dist/gateway/completion-inbox.js.map +1 -1
- package/dist/manager/run/persistence.d.ts +8 -0
- package/dist/manager/run/persistence.d.ts.map +1 -1
- package/dist/manager/run/persistence.js +12 -0
- package/dist/manager/run/persistence.js.map +1 -1
- package/dist/run/reporter.d.ts.map +1 -1
- package/dist/run/reporter.js +11 -0
- package/dist/run/reporter.js.map +1 -1
- package/dist/runtime/query/__tests__/completion-does-not-erase-the-answer.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/completion-does-not-erase-the-answer.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/completion-does-not-erase-the-answer.test.js +142 -0
- package/dist/runtime/query/__tests__/completion-does-not-erase-the-answer.test.js.map +1 -0
- package/dist/runtime/query/__tests__/completion-notification.test.js +414 -32
- package/dist/runtime/query/__tests__/completion-notification.test.js.map +1 -1
- package/dist/runtime/query/__tests__/context-size-on-the-wire.test.d.ts +2 -0
- package/dist/runtime/query/__tests__/context-size-on-the-wire.test.d.ts.map +1 -0
- package/dist/runtime/query/__tests__/context-size-on-the-wire.test.js +100 -0
- package/dist/runtime/query/__tests__/context-size-on-the-wire.test.js.map +1 -0
- package/dist/runtime/query/guard.d.ts +28 -0
- package/dist/runtime/query/guard.d.ts.map +1 -1
- package/dist/runtime/query/guard.js +31 -0
- package/dist/runtime/query/guard.js.map +1 -1
- package/dist/runtime/query/iteration/__tests__/settle-grace.test.d.ts +2 -0
- package/dist/runtime/query/iteration/__tests__/settle-grace.test.d.ts.map +1 -0
- package/dist/runtime/query/iteration/__tests__/settle-grace.test.js +226 -0
- package/dist/runtime/query/iteration/__tests__/settle-grace.test.js.map +1 -0
- package/dist/runtime/query/iteration/index.d.ts +92 -0
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +814 -566
- package/dist/runtime/query/iteration/index.js.map +1 -1
- package/dist/runtime/query/iteration/phases/__tests__/compaction-declined.test.d.ts +2 -0
- package/dist/runtime/query/iteration/phases/__tests__/compaction-declined.test.d.ts.map +1 -0
- package/dist/runtime/query/iteration/phases/__tests__/compaction-declined.test.js +95 -0
- package/dist/runtime/query/iteration/phases/__tests__/compaction-declined.test.js.map +1 -0
- package/dist/runtime/query/iteration/phases/compaction.d.ts +34 -0
- package/dist/runtime/query/iteration/phases/compaction.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.js +61 -4
- package/dist/runtime/query/iteration/phases/compaction.js.map +1 -1
- package/dist/tools/__tests__/untrusted-envelope.test.js +16 -0
- package/dist/tools/__tests__/untrusted-envelope.test.js.map +1 -1
- package/dist/tools/coordinator/__tests__/completion-delivery.test.js +117 -0
- package/dist/tools/coordinator/__tests__/completion-delivery.test.js.map +1 -1
- package/dist/tools/coordinator/__tests__/task-list.test.js +57 -0
- package/dist/tools/coordinator/__tests__/task-list.test.js.map +1 -1
- package/dist/tools/coordinator/index.d.ts.map +1 -1
- package/dist/tools/coordinator/index.js +109 -11
- package/dist/tools/coordinator/index.js.map +1 -1
- package/dist/tools/untrusted-envelope.d.ts.map +1 -1
- package/dist/tools/untrusted-envelope.js +9 -1
- package/dist/tools/untrusted-envelope.js.map +1 -1
- package/dist/types/agent/gateway.d.ts +18 -0
- package/dist/types/agent/gateway.d.ts.map +1 -1
- package/dist/types/provider/interface.d.ts +35 -0
- package/dist/types/provider/interface.d.ts.map +1 -1
- package/dist/types/run/entity.d.ts +16 -0
- package/dist/types/run/entity.d.ts.map +1 -1
- package/dist/types/run/events.d.ts +75 -0
- package/dist/types/run/events.d.ts.map +1 -1
- package/dist/types/run/events.js.map +1 -1
- package/dist/types/run/prepare-step.d.ts +17 -2
- package/dist/types/run/prepare-step.d.ts.map +1 -1
- package/dist/types/verification/index.d.ts +98 -0
- package/dist/types/verification/index.d.ts.map +1 -1
- package/dist/types/verification/index.js +10 -0
- package/dist/types/verification/index.js.map +1 -1
- package/dist/verification/__tests__/argument-pattern.test.d.ts +2 -0
- package/dist/verification/__tests__/argument-pattern.test.d.ts.map +1 -0
- package/dist/verification/__tests__/argument-pattern.test.js +122 -0
- package/dist/verification/__tests__/argument-pattern.test.js.map +1 -0
- package/dist/verification/gate.d.ts.map +1 -1
- package/dist/verification/gate.js +44 -0
- package/dist/verification/gate.js.map +1 -1
- package/dist/verification/rules.d.ts.map +1 -1
- package/dist/verification/rules.js +27 -0
- package/dist/verification/rules.js.map +1 -1
- package/package.json +1 -1
- package/src/agents/SupervisorAgent.ts +175 -166
- package/src/agents/__tests__/supervisor-inbox-scope.test.ts +149 -0
- package/src/bridge/a2a/mapper.ts +4 -0
- package/src/bridge/sse/mapper.ts +25 -0
- package/src/contracts/api.ts +1 -0
- package/src/gateway/__tests__/completion-inbox.test.ts +348 -2
- package/src/gateway/completion-inbox.ts +248 -16
- package/src/manager/run/persistence.ts +12 -0
- package/src/run/reporter.ts +12 -0
- package/src/runtime/query/__tests__/completion-does-not-erase-the-answer.test.ts +163 -0
- package/src/runtime/query/__tests__/completion-notification.test.ts +486 -34
- package/src/runtime/query/__tests__/context-size-on-the-wire.test.ts +122 -0
- package/src/runtime/query/guard.ts +32 -0
- package/src/runtime/query/iteration/__tests__/settle-grace.test.ts +265 -0
- package/src/runtime/query/iteration/index.ts +902 -636
- package/src/runtime/query/iteration/phases/__tests__/compaction-declined.test.ts +124 -0
- package/src/runtime/query/iteration/phases/compaction.ts +83 -10
- package/src/tools/__tests__/untrusted-envelope.test.ts +23 -0
- package/src/tools/coordinator/__tests__/completion-delivery.test.ts +147 -0
- package/src/tools/coordinator/__tests__/task-list.test.ts +72 -0
- package/src/tools/coordinator/index.ts +122 -15
- package/src/tools/untrusted-envelope.ts +9 -1
- package/src/types/agent/gateway.ts +18 -0
- package/src/types/provider/interface.ts +39 -0
- package/src/types/run/entity.ts +17 -0
- package/src/types/run/events.ts +75 -0
- package/src/types/run/prepare-step.ts +17 -2
- package/src/types/verification/index.ts +61 -0
- package/src/verification/__tests__/argument-pattern.test.ts +158 -0
- package/src/verification/gate.ts +45 -0
- package/src/verification/rules.ts +28 -0
|
@@ -39,6 +39,24 @@ export interface TaskGateway {
|
|
|
39
39
|
waitForTask(taskId: TaskId): Promise<TaskHandle>;
|
|
40
40
|
continueTask(taskId: TaskId, message: string): Promise<void>;
|
|
41
41
|
cancelTask(taskId: TaskId): void;
|
|
42
|
+
/**
|
|
43
|
+
* The task's current state, or `undefined` if this gateway does not know
|
|
44
|
+
* about it.
|
|
45
|
+
*
|
|
46
|
+
* **A task that has just settled should still be findable here.** The
|
|
47
|
+
* kernel uses this to recover one specific race: `createTask` resolves a
|
|
48
|
+
* microtask before its caller can record whose the task is, so a worker
|
|
49
|
+
* that finishes inside that window is announced to a listener that cannot
|
|
50
|
+
* yet place it. `CompletionInbox` buffers the announcement AND asks this
|
|
51
|
+
* method, and the second is what covers the case the buffer could not
|
|
52
|
+
* hold.
|
|
53
|
+
*
|
|
54
|
+
* This is a request, not a requirement, and the cost of not meeting it is
|
|
55
|
+
* yours: a gateway that forgets a task the instant it completes still
|
|
56
|
+
* works, but under a burst large enough to overflow the buffer a fast
|
|
57
|
+
* worker's result can go unannounced. `LocalTaskGateway` meets it for as
|
|
58
|
+
* long as the manager holds the record.
|
|
59
|
+
*/
|
|
42
60
|
getTask(taskId: TaskId): TaskHandle | undefined;
|
|
43
61
|
listTasks(): TaskHandle[];
|
|
44
62
|
onTaskCompleted(callback: (handle: TaskHandle) => void): () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../../../src/types/agent/gateway.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAE/C,MAAM,WAAW,UAAU;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAA;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,eAAe,CAAA;IACjC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAC7B;AAED;;;;;;;;;;GAUG;AACH,MAAM,MAAM,oBAAoB,GAAG,UAAU,GAAG,iBAAiB,CAAA;AAEjE,MAAM,WAAW,iBAAiB;IACjC;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,oBAAoB,EAAE,IAAI,CAAA;IAEvD,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CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI,CAAA;CAC/D"}
|
|
@@ -42,5 +42,40 @@ export interface LLMProvider {
|
|
|
42
42
|
* so the doctor doesn't mark them as failing — see ses_007 Q6.4.
|
|
43
43
|
*/
|
|
44
44
|
doctorCheck?(): Promise<DoctorCheckResult>;
|
|
45
|
+
/**
|
|
46
|
+
* Which {@link ChatCompletionParams.effort} levels this model accepts,
|
|
47
|
+
* under the thinking configuration you intend to send with it.
|
|
48
|
+
*
|
|
49
|
+
* Asked rather than assumed because effort is **refused, not clamped**:
|
|
50
|
+
* a level a model does not have makes the vendor reject the request, so a
|
|
51
|
+
* caller offering a choice it cannot honour produces a run that fails at
|
|
52
|
+
* the start rather than a quieter one. Building that choice needs the
|
|
53
|
+
* answer BEFORE the request exists.
|
|
54
|
+
*
|
|
55
|
+
* There are three states and they mean different things:
|
|
56
|
+
*
|
|
57
|
+
* - **method absent** — this driver has no effort concept at all. Setting
|
|
58
|
+
* `effort` on a run using it is refused, not ignored, so a caller should
|
|
59
|
+
* offer no control rather than a disabled one.
|
|
60
|
+
* - **empty array** — the driver implements effort and THIS model has no
|
|
61
|
+
* levels. A real answer, not a missing one.
|
|
62
|
+
* - **non-empty** — offer exactly these, and nothing else.
|
|
63
|
+
*
|
|
64
|
+
* `thinking` is a parameter rather than the caller reading two sibling
|
|
65
|
+
* arrays, and that is the whole reason this is a function. At least one
|
|
66
|
+
* model family accepts a narrower set of levels while thinking is
|
|
67
|
+
* disabled than while it is on, so an API returning both sets invites a
|
|
68
|
+
* caller to render a picker from one and then send the other — a
|
|
69
|
+
* combination the vendor rejects, on exactly one family, discovered in
|
|
70
|
+
* production. Passing the configuration you are actually going to send
|
|
71
|
+
* makes that mistake unspellable: there is one answer and it is the one
|
|
72
|
+
* for your request.
|
|
73
|
+
*
|
|
74
|
+
* The levels are not stable across models and have moved twice already,
|
|
75
|
+
* so a caller must not copy the answer into its own table. A copy goes
|
|
76
|
+
* stale on the next model release and goes stale SILENTLY — surfacing as
|
|
77
|
+
* a vendor rejection rather than a failing build.
|
|
78
|
+
*/
|
|
79
|
+
effortLevelsFor?(model: string, thinking?: import('./chat.js').ThinkingConfig): readonly import('./chat.js').ReasoningEffort[];
|
|
45
80
|
}
|
|
46
81
|
//# sourceMappingURL=interface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/types/provider/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAE3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AACrD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,MAAM,WAAW,WAAW;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IAErB;;;;;;;OAOG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,oBAAoB,CAAA;IAE5C;;;;;;;;;;;;;;OAcG;IACH,UAAU,CAAC,MAAM,EAAE,oBAAoB,GAAG,aAAa,CAAC,WAAW,CAAC,CAAA;IAEpE,UAAU,CAAC,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,CAAA;IAEnC,WAAW,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,CAAA;IAEhC;;;;;;;OAOG;IACH,WAAW,CAAC,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/types/provider/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAE3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AACrD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,MAAM,WAAW,WAAW;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IAErB;;;;;;;OAOG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,oBAAoB,CAAA;IAE5C;;;;;;;;;;;;;;OAcG;IACH,UAAU,CAAC,MAAM,EAAE,oBAAoB,GAAG,aAAa,CAAC,WAAW,CAAC,CAAA;IAEpE,UAAU,CAAC,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,CAAA;IAEnC,WAAW,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,CAAA;IAEhC;;;;;;;OAOG;IACH,WAAW,CAAC,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAAA;IAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,eAAe,CAAC,CACf,KAAK,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,OAAO,WAAW,EAAE,cAAc,GAC3C,SAAS,OAAO,WAAW,EAAE,eAAe,EAAE,CAAA;CACjD"}
|
|
@@ -53,6 +53,22 @@ export interface Run {
|
|
|
53
53
|
* for `structured_output_failed`.
|
|
54
54
|
*/
|
|
55
55
|
structuredOutput?: unknown;
|
|
56
|
+
/**
|
|
57
|
+
* Delegated tasks that were still running when this run ended.
|
|
58
|
+
*
|
|
59
|
+
* A run can settle while a worker it launched is still going — the model
|
|
60
|
+
* answered, a terminal tool decided the result, a `stopWhen` fired. The
|
|
61
|
+
* worker is NOT cancelled: giving up on a wait is a statement about the
|
|
62
|
+
* waiter, not about the work, and killing a child that may be mid-write
|
|
63
|
+
* because its parent finished early is a policy only the host can judge.
|
|
64
|
+
* A host that wants them stopped has `cancel_task` and the run controller.
|
|
65
|
+
*
|
|
66
|
+
* What the kernel owes instead is not pretending the results arrived.
|
|
67
|
+
* These ids are the honest form of that: the run says which work it walked
|
|
68
|
+
* away from, so a host can reconcile, cancel, or wait on them itself.
|
|
69
|
+
* Absent when a run ended with nothing outstanding.
|
|
70
|
+
*/
|
|
71
|
+
abandonedTaskIds?: readonly string[];
|
|
56
72
|
parentRunId?: RunId;
|
|
57
73
|
depth?: number;
|
|
58
74
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/types/run/entity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC3E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,MAAM,WAAW,gBAAgB;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,cAAc,CAAA;IACtB,QAAQ,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,MAAM,eAAe,GAAG,gBAAgB,CAAA;AAE9C;;;;;;;;;;GAUG;AACH,MAAM,WAAW,GAAG;IACnB,EAAE,EAAE,KAAK,CAAA;IACT,MAAM,EAAE,WAAW,CAAA;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48 @@ type CoreRunEvent = {
|
|
|
73
73
|
* want to surface that the run is running tight.
|
|
74
74
|
*/
|
|
75
75
|
reachedResetThreshold?: boolean;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* A compaction pass ran and shed nothing, so the history is unchanged.
|
|
79
|
+
*
|
|
80
|
+
* A shed that did not happen is exactly as consequential as one that did,
|
|
81
|
+
* and until this existed only one of them was on the wire. The three
|
|
82
|
+
* decline paths all reached a log line — and a host that silences its
|
|
83
|
+
* logger, which every command-line entry point does, made a failed
|
|
84
|
+
* compaction invisible to the user, to the host AND to the model. The run
|
|
85
|
+
* then continued at full context toward a provider rejection several turns
|
|
86
|
+
* later that named none of this.
|
|
87
|
+
*
|
|
88
|
+
* The history is guaranteed untouched on every one of these: the reducer's
|
|
89
|
+
* result is installed whole or not at all, so there is no partial state to
|
|
90
|
+
* reason about. That is the property that makes reporting sufficient and a
|
|
91
|
+
* repair unnecessary.
|
|
92
|
+
*/
|
|
93
|
+
| {
|
|
94
|
+
type: 'compaction_failed';
|
|
95
|
+
runId: RunId;
|
|
96
|
+
iteration: number;
|
|
97
|
+
/**
|
|
98
|
+
* Which decline path was taken. These want different responses, so
|
|
99
|
+
* a single "it failed" would put the reader back where the silence
|
|
100
|
+
* did:
|
|
101
|
+
*
|
|
102
|
+
* - `reducer_threw` — the reducer raised. Usually a bug or a failed
|
|
103
|
+
* model call inside a summarising reducer; the next pass may work.
|
|
104
|
+
* - `shed_nothing` — it returned no fewer messages than it was
|
|
105
|
+
* given. The history is already at its floor, or the reducer's
|
|
106
|
+
* own threshold disagrees with the trigger's, and every later
|
|
107
|
+
* pass will decline identically.
|
|
108
|
+
* - `split_tool_pair` — its result separated a `tool_use` from its
|
|
109
|
+
* `tool_result`, so it was refused wholesale rather than sent to
|
|
110
|
+
* a provider that rejects the pairing. A reducer bug, and one
|
|
111
|
+
* `findSafeTrimIndex` exists to prevent.
|
|
112
|
+
*/
|
|
113
|
+
cause: 'reducer_threw' | 'shed_nothing' | 'split_tool_pair';
|
|
114
|
+
/** Unchanged, and stated so a reader need not infer it. */
|
|
115
|
+
messages: number;
|
|
116
|
+
/** Present only for `reducer_threw`. */
|
|
117
|
+
error?: string;
|
|
76
118
|
} | {
|
|
77
119
|
type: 'tool_executing';
|
|
78
120
|
runId: RunId;
|
|
@@ -304,6 +346,39 @@ type CoreRunEvent = {
|
|
|
304
346
|
runId: RunId;
|
|
305
347
|
usage: TokenUsage;
|
|
306
348
|
cost: CostInfo;
|
|
349
|
+
/**
|
|
350
|
+
* How large the CONTEXT is right now, and how large it may get.
|
|
351
|
+
*
|
|
352
|
+
* These are a different quantity from `usage` beside them and the
|
|
353
|
+
* distinction is the whole reason they are named this explicitly.
|
|
354
|
+
* `usage` is CUMULATIVE SPEND over the run: prompt plus completion
|
|
355
|
+
* tokens summed across every turn, monotonically increasing, and
|
|
356
|
+
* untouched by compaction. `contextTokens` is the size of the
|
|
357
|
+
* conversation being sent right now, which falls when a compaction
|
|
358
|
+
* sheds.
|
|
359
|
+
*
|
|
360
|
+
* Dividing the first by a context window is a category error, and
|
|
361
|
+
* it is one this estate shipped: a host did exactly that, so its
|
|
362
|
+
* indicator climbed toward full on any long run no matter how much
|
|
363
|
+
* room the conversation actually had — most wrong precisely when
|
|
364
|
+
* someone needed it most. The numbers are here so nobody has to
|
|
365
|
+
* reach for the wrong one, and named so reaching for it is a
|
|
366
|
+
* visible mistake rather than a plausible guess.
|
|
367
|
+
*
|
|
368
|
+
* `contextMeasuredBy` says whether the provider counted the prompt
|
|
369
|
+
* or we estimated it, and `windowSource` where the ceiling came
|
|
370
|
+
* from. A fraction of two numbers is only as honest as the weaker
|
|
371
|
+
* of them, and a surface rendering these owes a reader the same
|
|
372
|
+
* distinction rather than presenting an estimate as a measurement.
|
|
373
|
+
*
|
|
374
|
+
* Absent when the run has no compaction configuration, because
|
|
375
|
+
* nothing then resolves a window and inventing one would be the
|
|
376
|
+
* guess this exists to replace.
|
|
377
|
+
*/
|
|
378
|
+
contextTokens?: number;
|
|
379
|
+
contextMeasuredBy?: 'provider' | 'estimate';
|
|
380
|
+
contextWindowTokens?: number;
|
|
381
|
+
windowSource?: 'config' | 'model-table' | 'default';
|
|
307
382
|
} | {
|
|
308
383
|
type: 'activity_created';
|
|
309
384
|
runId: RunId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/types/run/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACrE,OAAO,KAAK,EACX,UAAU,EACV,SAAS,EACT,MAAM,EACN,QAAQ,EACR,KAAK,EACL,SAAS,EACT,MAAM,EACN,SAAS,EACT,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACrE,OAAO,KAAK,EACX,oBAAoB,EACpB,uBAAuB,EACvB,sBAAsB,EACtB,MAAM,wBAAwB,CAAA;AAE/B,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAErE;;;;;;;;GAQG;AACH,UAAU,gBAAgB;IACzB;;;;;OAKG;IACH,aAAa,CAAC,E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"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../../src/types/run/events.ts"],"names":[],"mappings":"AAymBA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,qBAAqB,GAAkC,IAAI,GAAG,CAAmB;IACtF,YAAY;IACZ,kBAAkB;IAClB,mEAAmE;IACnE,6CAA6C;IAC7C,iBAAiB;IACjB,sEAAsE;IACtE,uEAAuE;IACvE,oCAAoC;IACpC,eAAe;CACf,CAAC,CAAA;AAEF,MAAM,UAAU,gBAAgB,CAAC,KAAe;IAC/C,OAAO,qBAAqB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;AAC7C,CAAC"}
|
|
@@ -41,8 +41,23 @@ export interface PrepareStepResult {
|
|
|
41
41
|
/**
|
|
42
42
|
* Restrict which tools the model may call this step, by name. Names
|
|
43
43
|
* that are not registered are dropped with a warning rather than
|
|
44
|
-
* failing the run
|
|
45
|
-
*
|
|
44
|
+
* failing the run.
|
|
45
|
+
*
|
|
46
|
+
* **Dropping every name leaves the step able to call nothing**, and that
|
|
47
|
+
* is deliberate rather than an accident of the filter. This list means
|
|
48
|
+
* "only these": if a rename outlives a phase list, the only set
|
|
49
|
+
* satisfying "only the tools that no longer exist" is the empty one, and
|
|
50
|
+
* widening back to the run's list would grant precisely what the caller
|
|
51
|
+
* did not ask for. The step is constrained, not crashed — the model
|
|
52
|
+
* answers from what it has and the run continues.
|
|
53
|
+
*
|
|
54
|
+
* This changed meaning when the list started bounding what may RUN
|
|
55
|
+
* rather than only what the model is shown. Before, an aged-out list hid
|
|
56
|
+
* every tool from the model while leaving all of them callable, which
|
|
57
|
+
* was neither reading.
|
|
58
|
+
*
|
|
59
|
+
* The warning is the part to watch: it goes to the logger, and a host
|
|
60
|
+
* that silences its logger sees a phase quietly stop doing anything.
|
|
46
61
|
*
|
|
47
62
|
* **This costs a prompt-cache prefix.** Tools render at position 0, so
|
|
48
63
|
* changing the set between steps invalidates the cached prefix for that
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare-step.d.ts","sourceRoot":"","sources":["../../../src/types/run/prepare-step.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAE3C;;;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;IACrB,mEAAmE;IACnE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,uEAAuE;IACvE,QAAQ,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAA;IACrC,sCAAsC;IACtC,QAAQ,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,CAAA;IAErC;;;;;;;OAOG;IACH,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAA;CAC9C;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IACjC
|
|
1
|
+
{"version":3,"file":"prepare-step.d.ts","sourceRoot":"","sources":["../../../src/types/run/prepare-step.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAE3C;;;;;;;;;;GAUG;AACH,MAAM,W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
|
type: 'deny_by_name';
|
|
20
20
|
toolNames: string[];
|
|
21
21
|
} | {
|
|
22
|
+
/**
|
|
23
|
+
* Match a regular expression against the tool's NAME, the
|
|
24
|
+
* serialised arguments, or both concatenated.
|
|
25
|
+
*
|
|
26
|
+
* Read `target: 'args'` carefully before writing one: it tests
|
|
27
|
+
* `JSON.stringify(toolInput)`, so the subject is the JSON TEXT of
|
|
28
|
+
* the whole argument object — `{"command":"git push origin main"}`
|
|
29
|
+
* — and not any single argument. The name suggests otherwise, and
|
|
30
|
+
* that is what makes it a trap: an anchored pattern like
|
|
31
|
+
* `^git push.*$` is a natural thing to write and can never match,
|
|
32
|
+
* so the rule silently decides nothing. `'both'` PREFIXES the tool
|
|
33
|
+
* name to that text rather than requiring it, so it is not a scope
|
|
34
|
+
* either — a rule written with `bash` in mind still sees every
|
|
35
|
+
* other tool's arguments.
|
|
36
|
+
*
|
|
37
|
+
* When you mean "this tool, this argument", use
|
|
38
|
+
* {@link VerificationRule} `argument_pattern` instead. This one
|
|
39
|
+
* stays for the case it is actually good at: matching anywhere in
|
|
40
|
+
* the serialised input without caring where.
|
|
41
|
+
*/
|
|
22
42
|
type: 'custom_pattern';
|
|
23
43
|
pattern: string;
|
|
24
44
|
target: 'name' | 'args' | 'both';
|
|
25
45
|
decision: 'allow' | 'deny';
|
|
46
|
+
} | {
|
|
47
|
+
/**
|
|
48
|
+
* Match a regular expression against ONE named argument of ONE
|
|
49
|
+
* named set of tools.
|
|
50
|
+
*
|
|
51
|
+
* This exists because `custom_pattern` could express neither half.
|
|
52
|
+
* It carries no tool scope, so a rule an operator wrote about
|
|
53
|
+
* `bash` decided `edit` calls too; and its argument target tests
|
|
54
|
+
* the serialised object, so pinning the tool cost the ability to
|
|
55
|
+
* anchor and anchoring cost the tool scope. Every pattern rule was
|
|
56
|
+
* therefore one of those two wrong things.
|
|
57
|
+
*
|
|
58
|
+
* The subject here is the argument's own VALUE, so `^git push`
|
|
59
|
+
* means what it looks like it means.
|
|
60
|
+
*
|
|
61
|
+
* A rule whose tool is not called, or whose argument is absent,
|
|
62
|
+
* decides nothing — the rule's precondition simply is not met. So
|
|
63
|
+
* does one whose argument holds an object or an array: a pattern
|
|
64
|
+
* cannot say anything true about a structured value, and pretending
|
|
65
|
+
* otherwise by matching its serialisation would reintroduce exactly
|
|
66
|
+
* the confusion this rule was added to remove. If you need to
|
|
67
|
+
* refuse a tool over the SHAPE of its input rather than a string in
|
|
68
|
+
* it, deny it by name.
|
|
69
|
+
*/
|
|
70
|
+
type: 'argument_pattern';
|
|
71
|
+
toolNames: string[];
|
|
72
|
+
/** The argument key, at the top level of the tool's input. */
|
|
73
|
+
argument: string;
|
|
74
|
+
pattern: string;
|
|
75
|
+
decision: 'allow' | 'deny';
|
|
26
76
|
} | {
|
|
27
77
|
type: 'allow_by_tier';
|
|
28
78
|
tiers: string[];
|
|
@@ -81,6 +131,24 @@ export declare const VerificationRuleSchema: z.ZodDiscriminatedUnion<"type", [z.
|
|
|
81
131
|
target: "name" | "args" | "both";
|
|
82
132
|
pattern: string;
|
|
83
133
|
decision: "deny" | "allow";
|
|
134
|
+
}>, z.ZodObject<{
|
|
135
|
+
type: z.ZodLiteral<"argument_pattern">;
|
|
136
|
+
toolNames: z.ZodArray<z.ZodString, "many">;
|
|
137
|
+
argument: z.ZodString;
|
|
138
|
+
pattern: z.ZodString;
|
|
139
|
+
decision: z.ZodEnum<["allow", "deny"]>;
|
|
140
|
+
}, "strip", z.ZodTypeAny, {
|
|
141
|
+
type: "argument_pattern";
|
|
142
|
+
pattern: string;
|
|
143
|
+
toolNames: string[];
|
|
144
|
+
decision: "deny" | "allow";
|
|
145
|
+
argument: string;
|
|
146
|
+
}, {
|
|
147
|
+
type: "argument_pattern";
|
|
148
|
+
pattern: string;
|
|
149
|
+
toolNames: string[];
|
|
150
|
+
decision: "deny" | "allow";
|
|
151
|
+
argument: string;
|
|
84
152
|
}>, z.ZodObject<{
|
|
85
153
|
type: z.ZodLiteral<"allow_by_tier">;
|
|
86
154
|
tiers: z.ZodArray<z.ZodString, "many">;
|
|
@@ -147,6 +215,24 @@ export declare const VerificationGateConfigSchema: z.ZodObject<{
|
|
|
147
215
|
target: "name" | "args" | "both";
|
|
148
216
|
pattern: string;
|
|
149
217
|
decision: "deny" | "allow";
|
|
218
|
+
}>, z.ZodObject<{
|
|
219
|
+
type: z.ZodLiteral<"argument_pattern">;
|
|
220
|
+
toolNames: z.ZodArray<z.ZodString, "many">;
|
|
221
|
+
argument: z.ZodString;
|
|
222
|
+
pattern: z.ZodString;
|
|
223
|
+
decision: z.ZodEnum<["allow", "deny"]>;
|
|
224
|
+
}, "strip", z.ZodTypeAny, {
|
|
225
|
+
type: "argument_pattern";
|
|
226
|
+
pattern: string;
|
|
227
|
+
toolNames: string[];
|
|
228
|
+
decision: "deny" | "allow";
|
|
229
|
+
argument: string;
|
|
230
|
+
}, {
|
|
231
|
+
type: "argument_pattern";
|
|
232
|
+
pattern: string;
|
|
233
|
+
toolNames: string[];
|
|
234
|
+
decision: "deny" | "allow";
|
|
235
|
+
argument: string;
|
|
150
236
|
}>, z.ZodObject<{
|
|
151
237
|
type: z.ZodLiteral<"allow_by_tier">;
|
|
152
238
|
tiers: z.ZodArray<z.ZodString, "many">;
|
|
@@ -180,6 +266,12 @@ export declare const VerificationGateConfigSchema: z.ZodObject<{
|
|
|
180
266
|
target: "name" | "args" | "both";
|
|
181
267
|
pattern: string;
|
|
182
268
|
decision: "deny" | "allow";
|
|
269
|
+
} | {
|
|
270
|
+
type: "argument_pattern";
|
|
271
|
+
pattern: string;
|
|
272
|
+
toolNames: string[];
|
|
273
|
+
decision: "deny" | "allow";
|
|
274
|
+
argument: string;
|
|
183
275
|
} | {
|
|
184
276
|
type: "allow_by_tier";
|
|
185
277
|
tiers: string[];
|
|
@@ -207,6 +299,12 @@ export declare const VerificationGateConfigSchema: z.ZodObject<{
|
|
|
207
299
|
target: "name" | "args" | "both";
|
|
208
300
|
pattern: string;
|
|
209
301
|
decision: "deny" | "allow";
|
|
302
|
+
} | {
|
|
303
|
+
type: "argument_pattern";
|
|
304
|
+
pattern: string;
|
|
305
|
+
toolNames: string[];
|
|
306
|
+
decision: "deny" | "allow";
|
|
307
|
+
argument: string;
|
|
210
308
|
} | {
|
|
211
309
|
type: "allow_by_tier";
|
|
212
310
|
tiers: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/verification/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAA;AAEtD,MAAM,WAAW,oBAAoB;IACpC,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAA;IAC/B,QAAQ,CAAC,WAAW,EAAE,gBAAgB,GAAG,IAAI,CAAA;IAC7C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,MAAM,gBAAgB,GACzB;IAAE,IAAI,EAAE,iBAAiB,CAAA;CAAE,GAC3B;IAAE,IAAI,EAAE,yBAAyB,CAAA;CAAE,GACnC;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,GACnD;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,SAAS,EAAE,MAAM,EAAE,CAAA;CAAE,GAC9C;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,SAAS,EAAE,MAAM,EAAE,CAAA;CAAE,GAC7C;IACA,IAAI,EAAE,gBAAgB,CAAA;IACtB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;IAChC,QAAQ,EAAE,OAAO,GAAG,MAAM,CAAA;CACzB,GACD;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAAA;
|
|
1
|
+
{"version":3,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AA;AAoC7C,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IASjC,CAAA;AAEF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMvC,CAAA;AAEF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAA"}
|
|
@@ -20,6 +20,15 @@ const CustomPatternSchema = z.object({
|
|
|
20
20
|
target: z.enum(['name', 'args', 'both']),
|
|
21
21
|
decision: z.enum(['allow', 'deny']),
|
|
22
22
|
});
|
|
23
|
+
const ArgumentPatternSchema = z.object({
|
|
24
|
+
type: z.literal('argument_pattern'),
|
|
25
|
+
toolNames: z.array(z.string()).min(1),
|
|
26
|
+
// A rule that names no argument would silently apply to none, which is the
|
|
27
|
+
// fail-open shape this rule type exists to remove.
|
|
28
|
+
argument: z.string().min(1),
|
|
29
|
+
pattern: z.string().max(MAX_CUSTOM_PATTERN_LENGTH),
|
|
30
|
+
decision: z.enum(['allow', 'deny']),
|
|
31
|
+
});
|
|
23
32
|
const AllowByTierSchema = z.object({
|
|
24
33
|
type: z.literal('allow_by_tier'),
|
|
25
34
|
tiers: z.array(z.string()),
|
|
@@ -31,6 +40,7 @@ export const VerificationRuleSchema = z.discriminatedUnion('type', [
|
|
|
31
40
|
AllowByNameSchema,
|
|
32
41
|
DenyByNameSchema,
|
|
33
42
|
CustomPatternSchema,
|
|
43
|
+
ArgumentPatternSchema,
|
|
34
44
|
AllowByTierSchema,
|
|
35
45
|
]);
|
|
36
46
|
export const VerificationGateConfigSchema = z.object({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/verification/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/verification/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAA;AA2EjF,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAA;AAC5E,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,yBAAyB,CAAC,EAAE,CAAC,CAAA;AAC5F,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC;IACpC,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAC/B,CAAC,CAAA;AACF,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC;IAChC,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAC9B,CAAC,CAAA;AACF,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC;IAC/B,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAC9B,CAAC,CAAA;AACF,MAAM,mBAAmB,GAAG,CA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AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACpD,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IACnC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IAClD,kBAAkB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IAC9C,qBAAqB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IACjD,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;CACvC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"argument-pattern.test.d.ts","sourceRoot":"","sources":["../../../src/verification/__tests__/argument-pattern.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { getRootLogger } from '../../utils/logger.js';
|
|
3
|
+
import { VerificationGate } from '../gate.js';
|
|
4
|
+
/**
|
|
5
|
+
* Every pattern rule an operator could write was one of two wrong things.
|
|
6
|
+
*
|
|
7
|
+
* `custom_pattern` carries no tool scope, so a rule written about `bash`
|
|
8
|
+
* decided `edit` calls as well. And `target: 'args'` tests
|
|
9
|
+
* `JSON.stringify(toolInput)`, so the subject is the JSON TEXT of the whole
|
|
10
|
+
* argument object — meaning the natural, anchored thing to write
|
|
11
|
+
* (`^git push.*$`) can never match, and the rule silently decides nothing.
|
|
12
|
+
* Pinning the tool cost the anchor; anchoring cost the tool scope.
|
|
13
|
+
*/
|
|
14
|
+
function gate(rules) {
|
|
15
|
+
return new VerificationGate({
|
|
16
|
+
enabled: true,
|
|
17
|
+
rules,
|
|
18
|
+
allowReadOnlyTools: false,
|
|
19
|
+
denyDangerousPatterns: false,
|
|
20
|
+
logDecisions: false,
|
|
21
|
+
}, getRootLogger());
|
|
22
|
+
}
|
|
23
|
+
/** Only the fields the gate reads. */
|
|
24
|
+
function toolDef(name) {
|
|
25
|
+
return { name, isReadOnly: () => false };
|
|
26
|
+
}
|
|
27
|
+
const PUSH_RULE = {
|
|
28
|
+
type: 'argument_pattern',
|
|
29
|
+
toolNames: ['bash'],
|
|
30
|
+
argument: 'command',
|
|
31
|
+
pattern: '^git push',
|
|
32
|
+
decision: 'deny',
|
|
33
|
+
};
|
|
34
|
+
function evaluate(rules, toolName, toolInput) {
|
|
35
|
+
return gate(rules).evaluate({ toolName, toolInput, toolDef: toolDef(toolName) });
|
|
36
|
+
}
|
|
37
|
+
describe('a rule can name one tool and one argument at once', () => {
|
|
38
|
+
it('denies the call it was written about', () => {
|
|
39
|
+
const result = evaluate([PUSH_RULE], 'bash', { command: 'git push origin main' });
|
|
40
|
+
expect(result.decision).toBe('deny');
|
|
41
|
+
});
|
|
42
|
+
it('anchors against the value, which is what the old rule could not do', () => {
|
|
43
|
+
// The whole defect in one assertion: this same pattern under
|
|
44
|
+
// `custom_pattern` with `target: 'args'` is tested against
|
|
45
|
+
// `{"command":"git push origin main"}`, where `^git push` cannot match
|
|
46
|
+
// because the string does not start there.
|
|
47
|
+
const viaOldRule = evaluate([{ type: 'custom_pattern', pattern: '^git push', target: 'args', decision: 'deny' }], 'bash', { command: 'git push origin main' });
|
|
48
|
+
expect(viaOldRule.decision, 'the old rule silently decided nothing').not.toBe('deny');
|
|
49
|
+
expect(evaluate([PUSH_RULE], 'bash', { command: 'git push origin main' }).decision).toBe('deny');
|
|
50
|
+
});
|
|
51
|
+
it('leaves a different tool alone', () => {
|
|
52
|
+
// The other half: a rule about `bash` used to decide `edit` too,
|
|
53
|
+
// because the pattern was matched against a serialisation that has no
|
|
54
|
+
// idea which tool produced it.
|
|
55
|
+
const result = evaluate([PUSH_RULE], 'edit', { command: 'git push origin main' });
|
|
56
|
+
expect(result.decision).not.toBe('deny');
|
|
57
|
+
});
|
|
58
|
+
it('leaves a different argument alone', () => {
|
|
59
|
+
const result = evaluate([PUSH_RULE], 'bash', { description: 'git push origin main' });
|
|
60
|
+
expect(result.decision).not.toBe('deny');
|
|
61
|
+
});
|
|
62
|
+
it('says which argument decided, so a model knows whether to reword', () => {
|
|
63
|
+
const result = evaluate([PUSH_RULE], 'bash', { command: 'git push origin main' });
|
|
64
|
+
expect(result.reason).toContain('command');
|
|
65
|
+
expect(result.reason).toContain('^git push');
|
|
66
|
+
expect(result.reason).toContain('bash');
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
describe('what it deliberately does not decide', () => {
|
|
70
|
+
it('decides nothing when the argument is absent', () => {
|
|
71
|
+
const result = evaluate([PUSH_RULE], 'bash', {});
|
|
72
|
+
expect(result.decision).not.toBe('deny');
|
|
73
|
+
});
|
|
74
|
+
it('decides nothing about a structured argument', () => {
|
|
75
|
+
// No string a pattern could match says anything true about an object,
|
|
76
|
+
// and serialising it to try would put this rule back where
|
|
77
|
+
// `custom_pattern` already is. An operator who needs to refuse a tool
|
|
78
|
+
// over the SHAPE of its input wants deny_by_name.
|
|
79
|
+
const rule = { ...PUSH_RULE, argument: 'env', pattern: 'PROD' };
|
|
80
|
+
const result = evaluate([rule], 'bash', { env: { NODE_ENV: 'PROD' } });
|
|
81
|
+
expect(result.decision).not.toBe('deny');
|
|
82
|
+
});
|
|
83
|
+
it('reads a number or a boolean rather than skipping it', () => {
|
|
84
|
+
// These render unambiguously, so skipping them would be a fail-open
|
|
85
|
+
// with no upside: a rule about a numeric argument is a rule someone
|
|
86
|
+
// can reasonably write.
|
|
87
|
+
const rule = {
|
|
88
|
+
type: 'argument_pattern',
|
|
89
|
+
toolNames: ['sleep'],
|
|
90
|
+
argument: 'seconds',
|
|
91
|
+
pattern: '^[0-9]{4,}$',
|
|
92
|
+
decision: 'deny',
|
|
93
|
+
};
|
|
94
|
+
expect(evaluate([rule], 'sleep', { seconds: 86400 }).decision).toBe('deny');
|
|
95
|
+
expect(evaluate([rule], 'sleep', { seconds: 5 }).decision).not.toBe('deny');
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
describe('a rule that cannot be compiled decides nothing at all', () => {
|
|
99
|
+
it('does not widen into a rule about the whole tool', () => {
|
|
100
|
+
// The failure this forbids: a typo'd regex turning "deny bash when its
|
|
101
|
+
// command matches X" into "deny bash" — a far larger authorization than
|
|
102
|
+
// anybody wrote, granted by a mistake nobody would notice.
|
|
103
|
+
//
|
|
104
|
+
// What actually secures it is the missing-pattern check at the top of
|
|
105
|
+
// `evaluateRule`, which returns before the tool name is consulted. The
|
|
106
|
+
// gate's construction order (compile first, only then record the names)
|
|
107
|
+
// is defence in depth and NOT the mechanism: reversing those two lines
|
|
108
|
+
// fails nothing, which was measured rather than assumed. So this test
|
|
109
|
+
// pins the OUTCOME and the comment in the gate says which line to keep.
|
|
110
|
+
const broken = { ...PUSH_RULE, pattern: '([unclosed' };
|
|
111
|
+
const result = evaluate([broken], 'bash', { command: 'ls' });
|
|
112
|
+
expect(result.decision).not.toBe('deny');
|
|
113
|
+
});
|
|
114
|
+
it('is secured by the pattern check, not by the construction order', () => {
|
|
115
|
+
// The honest version of the mutation: remove the check that actually
|
|
116
|
+
// holds and this fails. A rule whose pattern never compiled has no
|
|
117
|
+
// pattern to test, so it must decide nothing even for a tool it names.
|
|
118
|
+
const broken = { ...PUSH_RULE, pattern: '([unclosed' };
|
|
119
|
+
expect(evaluate([broken], 'bash', { command: 'git push origin main' }).decision).not.toBe('deny');
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
//# sourceMappingURL=argument-pattern.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"argument-pattern.test.js","sourceRoot":"","sources":["../../../src/verification/__tests__/argument-pattern.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAI7C,OAAO,EAAE,aAAa,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,CAAA;QAExE,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,sBAAsB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,IAAI,CACxF,MAAM,CACN,CAAA;IACF,CAAC,CAAC,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../../src/verification/gate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,KAAK,EACX,oBAAoB,EACpB,sBAAsB,EACtB,gBAAgB,EAChB,MAAM,gCAAgC,CAAA;AAEvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAGhD,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,OAAO,EAAE,cAAc,GAAG,SAAS,CAAA;CAC5C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../../src/verification/gate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,KAAK,EACX,oBAAoB,EACpB,sBAAsB,EACtB,gBAAgB,EAChB,MAAM,gCAAgC,CAAA;AAEvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAGhD,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,OAAO,EAAE,cAAc,GAAG,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