@cygnuxlabs/tracekit 1.7.3 → 1.8.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/README.md CHANGED
@@ -71,6 +71,10 @@ await client.close(); // waits for what is i
71
71
  - **Fail modes:** only when the signer cannot be reached does `decide` return the run's fail mode for the tool class
72
72
  (`fields.tool_class_hint`, from `register_run`'s `fail_modes`, default closed) with `unavailable: true`. A refusal
73
73
  from the signer rejects with `RPCError`, never an allow.
74
+ - **Transfers (experimental):** `await run.transfer(sender, receiver, payload, modality, { projector, measured, keep })`
75
+ records and gates a hand-off of a model's internal state between agents before it happens, as Python's
76
+ `RunHandle.transfer` does ([latent transfers](../../docs/c2c.md#runtransfer)). It resolves the decision with `ok`: hand
77
+ the payload over only when `ok` is true. With the signer unreachable it is not ok, whatever the run's fail modes.
74
78
  - **Serverless:** `client.waitUntil(promise)` and `await client.flush()` before the host freezes the process.
75
79
  - `withRun(run, fn)` makes `run` the `currentRun()` of everything `fn` awaits (AsyncLocalStorage).
76
80
  - `argsDigest(tool, args)`, `canonicalize`, `strictParse`: JCS (RFC 8785) and the strict parser, byte-identical to
@@ -148,6 +148,21 @@ export declare class RunHandle {
148
148
  * reached, is incompatible or refuses) is `{ ok: false, reason }` (once decided there is no fail mode: the call
149
149
  * doesn't run). */
150
150
  approvalConsume(toolCallId: string, tool: string, args: unknown, approvalIdHint?: string, fields?: Frame): Promise<Frame>;
151
+ /** Experimental, as Python's `RunHandle.transfer` (docs/c2c.md#runtransfer): records and gates a transfer from `sender`
152
+ * to `receiver` before it happens, as the tool a2a:transfer. `payload` is hashed here: the signer gets its size and
153
+ * sha256 digest, never the payload. `measured` adds fields the caller computed itself and may not reuse the transfer's
154
+ * own (it throws). An `ask` waits up to 300 s for a person. Fails closed: with the signer unreachable the transfer
155
+ * may not happen, whatever the run's fail modes. Resolves the decision with `ok`, whether the transfer may happen now
156
+ * (and `reason` when it may not for one the signer gave); one that may is recorded as made before this resolves.
157
+ * `keep`: the payload (hex) goes in the result, for a signer keeping content. */
158
+ transfer(sender: string, receiver: string, payload: string | Uint8Array, modality: string, { projector, measured, keep }?: {
159
+ projector?: string;
160
+ measured?: Frame;
161
+ keep?: boolean;
162
+ }): Promise<Decision & {
163
+ ok: boolean;
164
+ reason?: string;
165
+ }>;
151
166
  /** Records content that entered the run other than as a tool result (a mail, a ticket, a page the app fetched) for
152
167
  * the signer's provenance index; the task or user prompt goes in with trust "trusted". Only its commitment is recorded. */
153
168
  observe(value: unknown, source: string, trust?: "trusted" | "untrusted", fields?: Frame): Promise<Frame>;
package/dist/v2/client.js CHANGED
@@ -23,7 +23,7 @@
23
23
  */
24
24
  import { AsyncLocalStorage } from "node:async_hooks";
25
25
  import { execFile } from "node:child_process";
26
- import { createHmac, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
26
+ import { createHash, createHmac, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
27
27
  import { existsSync, lstatSync, readFileSync, statSync } from "node:fs";
28
28
  import { Agent, request } from "node:https";
29
29
  import { createConnection } from "node:net";
@@ -32,7 +32,7 @@ import { basename, extname, join } from "node:path";
32
32
  import { setTimeout as sleep } from "node:timers/promises";
33
33
  import { TracekitAgents } from "./adapters/openai-agents.js";
34
34
  import { tracekitAI } from "./adapters/vercel-ai.js";
35
- import { argsDigest } from "./jcs.js";
35
+ import { argsDigest, canonicalize } from "./jcs.js";
36
36
  import { INSTALL_HINT, signerCommand, signerEnv } from "./launcher.js";
37
37
  import { REQUESTS, RPC_VERSION } from "./rpc_schema.js";
38
38
  import { validate } from "./validate.js";
@@ -671,6 +671,9 @@ export function failOpen(failModes, toolClass) {
671
671
  const NEW_WORK = new Set(["decide", "model_event", "observe", "state_write"]); // to the current run
672
672
  const BY_CALL = new Set(["complete", "approval_request", "approval_consume"]); // to the run the call was decided in
673
673
  const KEEP = 4096; // tool calls and approvals whose run is remembered
674
+ const TRANSFER = "a2a:transfer"; // the tool RunHandle.transfer decides
675
+ const TRANSFER_FIELDS = ["sender", "receiver", "modality", "projector", "size", "digest", "claimed", "measured"];
676
+ const MAX_LINE = 1 << 20; // bytes of one transport frame (MAX_LINE in tracekit/signer/quotas.py)
674
677
  function remember(m, k, v) {
675
678
  m.delete(k);
676
679
  m.set(k, v);
@@ -824,6 +827,50 @@ export class RunHandle {
824
827
  return { ok: false, rule_ids: [], reason: `approval_consume failed: ${why}`.slice(0, 1024) };
825
828
  }
826
829
  }
830
+ /** Experimental, as Python's `RunHandle.transfer` (docs/c2c.md#runtransfer): records and gates a transfer from `sender`
831
+ * to `receiver` before it happens, as the tool a2a:transfer. `payload` is hashed here: the signer gets its size and
832
+ * sha256 digest, never the payload. `measured` adds fields the caller computed itself and may not reuse the transfer's
833
+ * own (it throws). An `ask` waits up to 300 s for a person. Fails closed: with the signer unreachable the transfer
834
+ * may not happen, whatever the run's fail modes. Resolves the decision with `ok`, whether the transfer may happen now
835
+ * (and `reason` when it may not for one the signer gave); one that may is recorded as made before this resolves.
836
+ * `keep`: the payload (hex) goes in the result, for a signer keeping content. */
837
+ async transfer(sender, receiver, payload, modality, { projector, measured, keep = false } = {}) {
838
+ const data = Buffer.from(payload);
839
+ const more = measured ?? {};
840
+ const collision = TRANSFER_FIELDS.filter((k) => Object.hasOwn(more, k));
841
+ if (collision.length)
842
+ throw new Error(`measured keys replace reserved transfer fields: ${collision.sort().join(", ")}`);
843
+ const head = { sender, receiver, modality, ...(projector ? { projector } : {}) };
844
+ const args = { ...head, claimed: Object.keys(head).sort(), size: data.length, digest: `sha256:${createHash("sha256").update(data).digest("hex")}`,
845
+ // in Python's order, by code point (UTF-8 bytes): sort() alone compares UTF-16 units
846
+ ...more, measured: ["size", "digest", ...Object.keys(more)].sort((a, b) => Buffer.compare(Buffer.from(a), Buffer.from(b))) };
847
+ const toolCallId = `tx-${randomBytes(16).toString("hex")}`;
848
+ const d = await this.decide(toolCallId, TRANSFER, args);
849
+ if (d.unavailable || d.decision === "deny")
850
+ return { ...d, ok: false };
851
+ let hint;
852
+ if (d.decision === "ask") {
853
+ hint = (await this.approvalRequest(toolCallId)).approval_id;
854
+ const state = (await this.approvalWait(hint, 300_000)).state;
855
+ if (state !== "approved") {
856
+ if (state === "requested") // unanswered: withdrawn, so no one approves a transfer that is gone
857
+ await this.call("approval_abandon", { approval_id: hint, reason: "no answer within run.transfer's wait" });
858
+ return { ...d, ok: false, reason: `approval ${state}` };
859
+ }
860
+ }
861
+ const c = await this.approvalConsume(toolCallId, TRANSFER, args, hint);
862
+ if (c.ok) {
863
+ let kept = keep ? { payload: data.toString("hex") } : undefined;
864
+ // lean: up to a quarter frame of payload (its hex in half a frame) is kept; send it in parts, each a record of its
865
+ // own, once larger caches must be kept
866
+ if (kept && canonicalize(kept).length > MAX_LINE / 2) {
867
+ warn(`tracekit: transfer ${toolCallId} is recorded but not kept: its ${data.length} bytes are more than one frame carries (about ${MAX_LINE / 4}); keep a smaller one`);
868
+ kept = undefined;
869
+ }
870
+ await this.complete(toolCallId, "ok", kept ? { result: kept } : {});
871
+ }
872
+ return { ...d, ok: c.ok, ...(c.reason ? { reason: c.reason } : {}) };
873
+ }
827
874
  /** Records content that entered the run other than as a tool result (a mail, a ticket, a page the app fetched) for
828
875
  * the signer's provenance index; the task or user prompt goes in with trust "trusted". Only its commitment is recorded. */
829
876
  observe(value, source, trust = "untrusted", fields = {}) {
@@ -1,3 +1,3 @@
1
1
  import type { Schema } from "./validate.js";
2
- export declare const RPC_VERSION = 26;
2
+ export declare const RPC_VERSION = 29;
3
3
  export declare const REQUESTS: Record<string, Schema>;
@@ -1,21 +1,22 @@
1
- export const RPC_VERSION = 26;
1
+ export const RPC_VERSION = 29;
2
2
  export const REQUESTS = {
3
3
  "register_run": { "type": "object", "additionalProperties": false, "required": ["request_id", "agent"], "properties": { "request_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "tenant": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "principal": { "type": "string", "maxLength": 256 }, "principal_token": { "type": "string", "maxLength": 16384 }, "source": { "const": "migrated" }, "analyzes": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "replay_of": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "investigation": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "parent": { "type": "object", "additionalProperties": false, "required": ["run_id", "run_token"], "properties": { "run_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_token": { "type": "string", "maxLength": 1024, "minLength": 1 } } }, "caller": { "type": "string", "maxLength": 256, "pattern": "^[a-z0-9_]+:[^\\n]+(?![\\s\\S])" }, "box": { "type": "object", "additionalProperties": false, "required": ["id", "image_digest", "allow"], "properties": { "id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "image_digest": { "type": "string", "maxLength": 71, "pattern": "^sha256:[0-9a-f]{64}(?![\\s\\S])" }, "channel": { "const": "agent" }, "allow": { "type": "array", "maxItems": 256, "items": { "type": "string", "maxLength": 261, "minLength": 1, "pattern": "^[A-Za-z0-9.*:\\[\\]_-]+(?![\\s\\S])" } } } }, "continues": { "const": true }, "agent": { "type": "object", "additionalProperties": false, "required": ["name"], "properties": { "name": { "type": "string", "maxLength": 128, "minLength": 1 }, "version": { "type": "string", "maxLength": 64 } } } } },
4
- "decide": { "type": "object", "additionalProperties": false, "required": ["request_id", "run_id", "run_token", "stream", "client_seq", "tool_call_id", "tool", "args_source", "args"], "properties": { "request_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_token": { "type": "string", "maxLength": 1024, "minLength": 1 }, "stream": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "client_seq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "caller": { "type": "string", "maxLength": 256, "pattern": "^[a-z0-9_]+:[^\\n]+(?![\\s\\S])" }, "tool_call_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "attempt": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "tool": { "type": "string", "maxLength": 256, "minLength": 1 }, "tool_class_hint": { "type": "string", "maxLength": 64 }, "args_source": { "enum": ["raw", "parsed", "coerced"] }, "args": {} }, "if": { "properties": { "args_source": { "const": "raw" } } }, "then": { "properties": { "args": { "type": "string", "maxLength": 1048576 } } } },
4
+ "decide": { "type": "object", "additionalProperties": false, "required": ["request_id", "run_id", "run_token", "stream", "client_seq", "tool_call_id", "tool", "args_source", "args"], "properties": { "request_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_token": { "type": "string", "maxLength": 1024, "minLength": 1 }, "stream": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "client_seq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "caller": { "type": "string", "maxLength": 256, "pattern": "^[a-z0-9_]+:[^\\n]+(?![\\s\\S])" }, "tool_call_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "attempt": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "tool": { "type": "string", "maxLength": 256, "minLength": 1 }, "tool_class_hint": { "type": "string", "maxLength": 64 }, "agent_id": { "type": "string", "maxLength": 200, "minLength": 1 }, "args_source": { "enum": ["raw", "parsed", "coerced"] }, "args": {} }, "if": { "properties": { "args_source": { "const": "raw" } } }, "then": { "properties": { "args": { "type": "string", "maxLength": 1048576 } } } },
5
5
  "complete": { "type": "object", "additionalProperties": false, "required": ["request_id", "run_id", "run_token", "stream", "client_seq", "tool_call_id", "decision_id", "args_digest", "status"], "properties": { "request_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_token": { "type": "string", "maxLength": 1024, "minLength": 1 }, "stream": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "client_seq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "caller": { "type": "string", "maxLength": 256, "pattern": "^[a-z0-9_]+:[^\\n]+(?![\\s\\S])" }, "tool_call_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "attempt": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "decision_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "args_digest": { "type": "string", "maxLength": 71, "pattern": "^sha256:[0-9a-f]{64}(?![\\s\\S])" }, "status": { "enum": ["ok", "error"] }, "result": {}, "error": { "type": "string", "maxLength": 4096 }, "redacted": { "const": true }, "redaction": { "type": "object", "additionalProperties": false, "required": [], "properties": { "rules": { "type": "array", "maxItems": 32, "items": { "type": "string", "maxLength": 64 } }, "count": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } } } } },
6
6
  "observe": { "type": "object", "additionalProperties": false, "required": ["request_id", "run_id", "run_token", "stream", "client_seq", "source", "trust", "value"], "properties": { "request_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_token": { "type": "string", "maxLength": 1024, "minLength": 1 }, "stream": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "client_seq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "caller": { "type": "string", "maxLength": 256, "pattern": "^[a-z0-9_]+:[^\\n]+(?![\\s\\S])" }, "source": { "type": "string", "maxLength": 256, "minLength": 1 }, "trust": { "enum": ["trusted", "untrusted"] }, "value": {} } },
7
7
  "state_write": { "type": "object", "additionalProperties": false, "required": ["request_id", "run_id", "run_token", "stream", "client_seq", "key", "value_digest"], "properties": { "request_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_token": { "type": "string", "maxLength": 1024, "minLength": 1 }, "stream": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "client_seq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "key": { "type": "string", "maxLength": 256, "minLength": 1 }, "value_digest": { "type": "string", "maxLength": 71, "pattern": "^sha256:[0-9a-f]{64}(?![\\s\\S])" }, "prev_digest": { "oneOf": [{ "type": "string", "maxLength": 71, "pattern": "^sha256:[0-9a-f]{64}(?![\\s\\S])" }, { "type": "null" }] } } },
8
8
  "model_event": { "type": "object", "additionalProperties": false, "required": ["request_id", "run_id", "run_token", "stream", "client_seq", "provider", "model", "phase"], "properties": { "request_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_token": { "type": "string", "maxLength": 1024, "minLength": 1 }, "stream": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "client_seq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "provider": { "type": "string", "maxLength": 64 }, "model": { "type": "string", "maxLength": 128 }, "phase": { "enum": ["request", "response"] }, "content_digest": { "type": "string", "maxLength": 71, "pattern": "^sha256:[0-9a-f]{64}(?![\\s\\S])" }, "exchange_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "streamed": { "type": "boolean" }, "stop_reason": { "type": "string", "maxLength": 100 }, "error": { "type": "string", "maxLength": 1024 }, "usage": { "type": "object", "additionalProperties": false, "required": [], "properties": { "input_tokens": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "output_tokens": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "cache_read_tokens": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "cache_write_tokens": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "reasoning_tokens": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } } }, "tool_uses": { "type": "array", "maxItems": 128, "items": { "type": "object", "additionalProperties": false, "required": ["id", "name", "executed_by"], "properties": { "id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "name": { "type": "string", "maxLength": 256, "minLength": 1 }, "executed_by": { "enum": ["client", "provider"] }, "args_source": { "enum": ["raw", "parsed", "coerced"] }, "args_digest": { "type": "string", "maxLength": 71, "pattern": "^sha256:[0-9a-f]{64}(?![\\s\\S])" }, "args_unparseable": { "const": true }, "id_synthetic": { "const": true } }, "oneOf": [{ "additionalProperties": false, "properties": { "id": {}, "name": {}, "executed_by": { "const": "provider" }, "id_synthetic": {} } }, { "required": ["args_source", "args_digest"], "additionalProperties": false, "properties": { "id": {}, "name": {}, "executed_by": { "const": "provider" }, "id_synthetic": {}, "args_source": {}, "args_digest": {} } }, { "required": ["args_source", "args_digest"], "properties": { "executed_by": { "const": "client" } } }, { "required": ["args_source", "args_unparseable"], "properties": { "executed_by": { "const": "client" } } }] } }, "said_only": { "const": true }, "tool_results_sent": { "type": "array", "maxItems": 1024, "items": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" } }, "tool_results": { "type": "array", "maxItems": 1024, "items": { "type": "object", "additionalProperties": false, "required": ["id", "forms"], "properties": { "id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "forms": { "type": "array", "minItems": 1, "maxItems": 3, "items": { "type": "object", "additionalProperties": false, "required": ["digest", "result_digest"], "properties": { "digest": { "type": "string", "maxLength": 71, "pattern": "^sha256:[0-9a-f]{64}(?![\\s\\S])" }, "result_digest": { "type": "string", "maxLength": 71, "pattern": "^sha256:[0-9a-f]{64}(?![\\s\\S])" } } } } } } }, "caller": { "type": "string", "maxLength": 256, "pattern": "^[a-z0-9_]+:[^\\n]+(?![\\s\\S])" }, "amended": { "type": "array", "minItems": 1, "maxItems": 16, "items": { "type": "string", "maxLength": 256, "pattern": "^(/([^~/]|~[01])*)+(?![\\s\\S])" } }, "body": {} } },
9
- "approval_request": { "type": "object", "additionalProperties": false, "required": ["request_id", "run_id", "run_token", "tool_call_id"], "properties": { "request_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_token": { "type": "string", "maxLength": 1024, "minLength": 1 }, "caller": { "type": "string", "maxLength": 256, "pattern": "^[a-z0-9_]+:[^\\n]+(?![\\s\\S])" }, "tool_call_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "attempt": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "reason": { "type": "string", "maxLength": 1024 } } },
10
- "approval_decide": { "type": "object", "additionalProperties": false, "required": ["request_id", "approval_id", "decision"], "properties": { "request_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "approval_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "decision": { "enum": ["approve", "reject", "escalate"] }, "reason": { "type": "string", "maxLength": 1024 }, "on_behalf": { "type": "object", "additionalProperties": false, "required": ["subject", "person"], "properties": { "subject": { "type": "string", "maxLength": 256, "minLength": 1 }, "person": { "type": "string", "maxLength": 256, "minLength": 1 }, "groups": { "type": "array", "maxItems": 64, "items": { "type": "string", "maxLength": 256 } }, "tenant": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" } } }, "passkey": { "type": "object", "additionalProperties": false, "required": ["credential_id", "client_data_json", "authenticator_data", "signature"], "properties": { "credential_id": { "type": "string", "maxLength": 4096, "minLength": 1, "pattern": "^[A-Za-z0-9_-]+(?![\\s\\S])" }, "client_data_json": { "type": "string", "maxLength": 4096, "minLength": 1, "pattern": "^[A-Za-z0-9_-]+(?![\\s\\S])" }, "authenticator_data": { "type": "string", "maxLength": 4096, "minLength": 1, "pattern": "^[A-Za-z0-9_-]+(?![\\s\\S])" }, "signature": { "type": "string", "maxLength": 4096, "minLength": 1, "pattern": "^[A-Za-z0-9_-]+(?![\\s\\S])" } } }, "asserted": { "type": "object", "additionalProperties": false, "required": [], "properties": { "model": { "type": "string", "maxLength": 128 }, "version": { "type": "string", "maxLength": 64 }, "prompt_hash": { "type": "string", "maxLength": 71, "pattern": "^sha256:[0-9a-f]{64}(?![\\s\\S])" } } } } },
9
+ "approval_request": { "type": "object", "additionalProperties": false, "required": ["request_id", "run_id", "run_token", "tool_call_id"], "properties": { "request_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_token": { "type": "string", "maxLength": 1024, "minLength": 1 }, "caller": { "type": "string", "maxLength": 256, "pattern": "^[a-z0-9_]+:[^\\n]+(?![\\s\\S])" }, "tool_call_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "attempt": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "reason": { "type": "string", "maxLength": 1024 }, "project": { "type": "string", "maxLength": 1024, "minLength": 1 } } },
10
+ "approval_decide": { "type": "object", "additionalProperties": false, "required": ["request_id", "approval_id", "decision"], "properties": { "request_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "approval_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "decision": { "enum": ["approve", "reject", "escalate"] }, "reason": { "type": "string", "maxLength": 1024 }, "on_behalf": { "type": "object", "additionalProperties": false, "required": ["subject", "person"], "properties": { "subject": { "type": "string", "maxLength": 256, "minLength": 1 }, "person": { "type": "string", "maxLength": 256, "minLength": 1 }, "groups": { "type": "array", "maxItems": 64, "items": { "type": "string", "maxLength": 256 } }, "tenant": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" } } }, "passkey": { "type": "object", "additionalProperties": false, "required": ["credential_id", "client_data_json", "authenticator_data", "signature"], "properties": { "credential_id": { "type": "string", "maxLength": 4096, "minLength": 1, "pattern": "^[A-Za-z0-9_-]+(?![\\s\\S])" }, "client_data_json": { "type": "string", "maxLength": 4096, "minLength": 1, "pattern": "^[A-Za-z0-9_-]+(?![\\s\\S])" }, "authenticator_data": { "type": "string", "maxLength": 4096, "minLength": 1, "pattern": "^[A-Za-z0-9_-]+(?![\\s\\S])" }, "signature": { "type": "string", "maxLength": 4096, "minLength": 1, "pattern": "^[A-Za-z0-9_-]+(?![\\s\\S])" } } }, "asserted": { "type": "object", "additionalProperties": false, "required": [], "properties": { "model": { "type": "string", "maxLength": 128 }, "version": { "type": "string", "maxLength": 64 }, "prompt_hash": { "type": "string", "maxLength": 71, "pattern": "^sha256:[0-9a-f]{64}(?![\\s\\S])" } } }, "ai": { "type": "object", "additionalProperties": false, "required": ["answers"], "properties": { "answers": { "type": "array", "minItems": 1, "maxItems": 2, "items": { "type": "object", "additionalProperties": false, "required": ["model", "decision"], "properties": { "model": { "type": "string", "maxLength": 128, "minLength": 1 }, "decision": { "enum": ["approve", "reject", "escalate"] }, "identity": { "type": "string", "maxLength": 256, "minLength": 1 } } } } } }, "view_digest": { "type": "string", "maxLength": 71, "pattern": "^sha256:[0-9a-f]{64}(?![\\s\\S])" } } },
11
11
  "approval_decide_on_behalf": { "type": "object", "additionalProperties": false, "required": ["request_id", "approval_id", "decision", "approver"], "properties": { "request_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "approval_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "decision": { "enum": ["approve", "reject"] }, "approver": { "type": "string", "maxLength": 64, "pattern": "^slack:[A-Z0-9]+/[A-Z0-9]+(?![\\s\\S])" }, "groups": { "type": "array", "maxItems": 32, "items": { "type": "string", "maxLength": 64, "pattern": "^slack:[A-Z0-9]+/[A-Z0-9]+(?![\\s\\S])" } } } },
12
12
  "approval_wait": { "type": "object", "additionalProperties": false, "required": ["run_id", "run_token", "approval_id"], "properties": { "run_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_token": { "type": "string", "maxLength": 1024, "minLength": 1 }, "caller": { "type": "string", "maxLength": 256, "pattern": "^[a-z0-9_]+:[^\\n]+(?![\\s\\S])" }, "approval_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "timeout_ms": { "type": "integer", "minimum": 0, "maximum": 300000 } } },
13
13
  "approval_consume": { "type": "object", "additionalProperties": false, "required": ["request_id", "run_id", "run_token", "tool_call_id", "tool", "args_source", "args"], "properties": { "request_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_token": { "type": "string", "maxLength": 1024, "minLength": 1 }, "caller": { "type": "string", "maxLength": 256, "pattern": "^[a-z0-9_]+:[^\\n]+(?![\\s\\S])" }, "tool_call_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "attempt": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "tool": { "type": "string", "maxLength": 256, "minLength": 1 }, "args_source": { "enum": ["raw", "parsed", "coerced"] }, "args": {}, "approval_id_hint": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" } }, "if": { "properties": { "args_source": { "const": "raw" } } }, "then": { "properties": { "args": { "type": "string", "maxLength": 1048576 } } } },
14
14
  "approval_get": { "type": "object", "additionalProperties": false, "required": ["approval_id"], "properties": { "approval_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "on_behalf": { "type": "object", "additionalProperties": false, "required": ["subject", "person"], "properties": { "subject": { "type": "string", "maxLength": 256, "minLength": 1 }, "person": { "type": "string", "maxLength": 256, "minLength": 1 }, "groups": { "type": "array", "maxItems": 64, "items": { "type": "string", "maxLength": 256 } }, "tenant": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" } } } } },
15
- "approval_list": { "type": "object", "additionalProperties": false, "required": [], "properties": { "run_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "cursor": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "limit": { "type": "integer", "minimum": 1, "maximum": 1000 }, "on_behalf": { "type": "object", "additionalProperties": false, "required": ["subject", "person"], "properties": { "subject": { "type": "string", "maxLength": 256, "minLength": 1 }, "person": { "type": "string", "maxLength": 256, "minLength": 1 }, "groups": { "type": "array", "maxItems": 64, "items": { "type": "string", "maxLength": 256 } }, "tenant": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" } } }, "state": { "enum": ["requested", "approved", "rejected", "expired", "consumed"] }, "escalated": { "type": "boolean" }, "for": { "enum": ["agent", "person"] } } },
15
+ "approval_list": { "type": "object", "additionalProperties": false, "required": [], "properties": { "run_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "cursor": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "limit": { "type": "integer", "minimum": 1, "maximum": 1000 }, "on_behalf": { "type": "object", "additionalProperties": false, "required": ["subject", "person"], "properties": { "subject": { "type": "string", "maxLength": 256, "minLength": 1 }, "person": { "type": "string", "maxLength": 256, "minLength": 1 }, "groups": { "type": "array", "maxItems": 64, "items": { "type": "string", "maxLength": 256 } }, "tenant": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" } } }, "state": { "enum": ["requested", "approved", "rejected", "expired", "consumed"] }, "escalated": { "type": "boolean" }, "ended": { "type": "boolean" }, "for": { "enum": ["agent", "person"] } } },
16
16
  "approval_review": { "type": "object", "additionalProperties": false, "required": ["approval_id"], "properties": { "approval_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" } } },
17
17
  "approval_revoke": { "type": "object", "additionalProperties": false, "required": ["request_id", "approval_id"], "properties": { "request_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "approval_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "reason": { "type": "string", "maxLength": 1024 }, "on_behalf": { "type": "object", "additionalProperties": false, "required": ["subject", "person"], "properties": { "subject": { "type": "string", "maxLength": 256, "minLength": 1 }, "person": { "type": "string", "maxLength": 256, "minLength": 1 }, "groups": { "type": "array", "maxItems": 64, "items": { "type": "string", "maxLength": 256 } }, "tenant": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" } } } } },
18
18
  "approval_agents": { "type": "object", "additionalProperties": false, "required": ["request_id", "enabled"], "properties": { "request_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "enabled": { "type": "boolean" }, "reason": { "type": "string", "maxLength": 1024 } } },
19
+ "approver": { "type": "object", "additionalProperties": false, "required": ["action"], "properties": { "request_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "action": { "enum": ["status", "on", "off", "accept", "retire", "drop", "revoke", "enable"] }, "id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "rules": { "type": "array", "minItems": 1, "maxItems": 32, "items": { "type": "string", "maxLength": 64 } }, "reason": { "type": "string", "maxLength": 1024 } }, "oneOf": [{ "properties": { "action": { "const": "status" } } }, { "properties": { "action": { "enum": ["on", "off", "accept", "retire", "drop", "revoke", "enable"] } }, "required": ["request_id"] }] },
19
20
  "approval_abandon": { "type": "object", "additionalProperties": false, "required": ["request_id", "run_id", "run_token", "approval_id"], "properties": { "request_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_token": { "type": "string", "maxLength": 1024, "minLength": 1 }, "approval_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "reason": { "type": "string", "maxLength": 1024 } } },
20
21
  "close_run": { "type": "object", "additionalProperties": false, "required": ["request_id", "run_id", "run_token"], "properties": { "request_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_token": { "type": "string", "maxLength": 1024, "minLength": 1 }, "reason": { "type": "string", "maxLength": 256 }, "caller": { "type": "string", "maxLength": 256, "pattern": "^[a-z0-9_]+:[^\\n]+(?![\\s\\S])" }, "last_client_seq": { "type": "array", "maxItems": 64, "items": { "type": "object", "additionalProperties": false, "required": ["stream", "client_seq"], "properties": { "stream": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "client_seq": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } } } } } },
21
22
  "delegate_run": { "type": "object", "additionalProperties": false, "required": ["run_id", "run_token", "identity"], "properties": { "run_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_token": { "type": "string", "maxLength": 1024, "minLength": 1 }, "identity": { "type": "string", "maxLength": 256, "pattern": "^[a-z0-9_]+:[^\\n]+(?![\\s\\S])" } } },
@@ -42,6 +43,7 @@ export const REQUESTS = {
42
43
  "response_resume": { "type": "object", "additionalProperties": false, "required": ["request_id"], "properties": { "request_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "reason": { "type": "string", "maxLength": 1024 } } },
43
44
  "suspend": { "type": "object", "additionalProperties": false, "required": ["request_id", "identity"], "properties": { "request_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "identity": { "type": "string", "maxLength": 256, "pattern": "^[a-z0-9_]+:[^\\n]+(?![\\s\\S])" }, "reason": { "type": "string", "maxLength": 1024 } } },
44
45
  "unsuspend": { "type": "object", "additionalProperties": false, "required": ["request_id", "identity"], "properties": { "request_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "identity": { "type": "string", "maxLength": 256, "pattern": "^[a-z0-9_]+:[^\\n]+(?![\\s\\S])" }, "reason": { "type": "string", "maxLength": 1024 } } },
46
+ "run_label_clear": { "type": "object", "additionalProperties": false, "required": ["request_id", "run_id", "label"], "properties": { "request_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "label": { "enum": ["secrets_access", "untrusted_content"] }, "reason": { "type": "string", "maxLength": 1024 } } },
45
47
  "pcm_sign": { "type": "object", "additionalProperties": false, "required": ["request_id", "run_id", "run_token", "message"], "properties": { "request_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_token": { "type": "string", "maxLength": 1024, "minLength": 1 }, "message": { "type": "object", "additionalProperties": false, "required": ["from", "to", "intent"], "properties": { "to": { "type": "object", "additionalProperties": false, "required": ["agent"], "properties": { "agent": { "type": "string", "maxLength": 256, "pattern": "^[a-z0-9_]+:[^\\n]+(?![\\s\\S])" } } }, "intent": { "type": "object", "additionalProperties": false, "required": ["type", "args"], "properties": { "type": { "type": "string", "maxLength": 136, "pattern": "^[a-z][a-z0-9_.-]{0,63}@sha256:[0-9a-f]{64}(?![\\s\\S])" }, "args": {} } }, "claims": { "type": "array", "maxItems": 8, "items": { "type": "object", "additionalProperties": false, "required": ["type", "args"], "properties": { "type": { "enum": ["tests_passed", "approved_by", "reached_host", "file_written"] }, "args": {}, "evidence": { "type": "object", "additionalProperties": false, "required": ["checkpoint", "records"], "properties": { "checkpoint": { "type": "string", "maxLength": 16384, "minLength": 1 }, "records": { "type": "array", "minItems": 1, "maxItems": 16, "items": { "type": "object", "additionalProperties": false, "required": ["event", "hash", "proof"], "properties": { "event": {}, "hash": { "type": "string", "maxLength": 71, "pattern": "^sha256:[0-9a-f]{64}(?![\\s\\S])" }, "proof": { "type": "array", "maxItems": 64, "items": { "type": "string", "maxLength": 44 } }, "salt": { "type": "string", "maxLength": 64, "pattern": "^[0-9a-f]{64}(?![\\s\\S])" }, "args": {} } } } } } } } }, "grants": { "type": "array", "maxItems": 8, "items": { "type": "object", "additionalProperties": false, "required": ["pcm_grant", "ts", "issuer", "subject", "intent", "caveats", "expires_at", "delegable", "parent", "sig"], "properties": { "pcm_grant": { "type": "integer", "const": 0 }, "ts": { "type": "string", "maxLength": 27, "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{6}Z(?![\\s\\S])" }, "issuer": { "type": "object", "additionalProperties": false, "required": ["kind", "id", "run", "tenant"], "properties": { "kind": { "enum": ["person", "agent"] }, "id": { "type": "string", "maxLength": 256 }, "person": { "type": "string", "maxLength": 256 }, "run": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "tenant": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "approval_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" } } }, "subject": { "type": "string", "maxLength": 256, "pattern": "^[a-z0-9_]+:[^\\n]+(?![\\s\\S])" }, "intent": { "type": "string", "maxLength": 136, "pattern": "^[a-z][a-z0-9_.-]{0,63}@sha256:[0-9a-f]{64}(?![\\s\\S])" }, "caveats": { "type": "array", "maxItems": 16, "items": { "type": "object", "additionalProperties": false, "required": ["field", "op", "value"], "properties": { "field": { "type": "string", "maxLength": 64, "pattern": "^[a-z][a-z0-9_]*(?![\\s\\S])" }, "op": { "enum": ["==", "<=", ">=", "<", ">", "in"] }, "value": {} } } }, "expires_at": { "type": "string", "maxLength": 27, "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{6}Z(?![\\s\\S])" }, "delegable": { "type": "boolean" }, "parent": { "oneOf": [{ "type": "string", "maxLength": 71, "pattern": "^sha256:[0-9a-f]{64}(?![\\s\\S])" }, { "type": "null" }] }, "sig": { "type": "object", "additionalProperties": false, "required": ["key", "sig"], "properties": { "key": { "type": "string", "maxLength": 300, "minLength": 1 }, "sig": { "type": "string", "maxLength": 88 } } } } } }, "payload": { "oneOf": [{ "type": "object", "additionalProperties": false, "required": ["kind", "text"], "properties": { "kind": { "const": "text" }, "text": { "type": "string", "maxLength": 65536 } } }, { "type": "object", "additionalProperties": false, "required": ["kind", "data"], "properties": { "kind": { "const": "data" }, "data": {} } }] }, "from": { "type": "object", "additionalProperties": false, "required": ["agent", "run", "tenant"], "properties": { "agent": { "type": "string", "maxLength": 256, "pattern": "^[a-z0-9_]+:[^\\n]+(?![\\s\\S])" }, "run": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "tenant": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" } } } } } } },
46
48
  "pcm_grant": { "type": "object", "additionalProperties": false, "required": ["request_id", "run_id", "run_token", "tool_call_id", "args"], "properties": { "request_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_token": { "type": "string", "maxLength": 1024, "minLength": 1 }, "tool_call_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "attempt": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "args": { "type": "object", "additionalProperties": false, "required": ["subject", "intent", "expires_at", "delegable"], "properties": { "subject": { "type": "string", "maxLength": 256, "pattern": "^[a-z0-9_]+:[^\\n]+(?![\\s\\S])" }, "intent": { "type": "string", "maxLength": 136, "pattern": "^[a-z][a-z0-9_.-]{0,63}@sha256:[0-9a-f]{64}(?![\\s\\S])" }, "caveats": { "type": "array", "maxItems": 16, "items": { "type": "object", "additionalProperties": false, "required": ["field", "op", "value"], "properties": { "field": { "type": "string", "maxLength": 64, "pattern": "^[a-z][a-z0-9_]*(?![\\s\\S])" }, "op": { "enum": ["==", "<=", ">=", "<", ">", "in"] }, "value": {} } } }, "expires_at": { "type": "string", "maxLength": 27, "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{6}Z(?![\\s\\S])" }, "delegable": { "type": "boolean" } } } } },
47
49
  "pcm_delegate": { "type": "object", "additionalProperties": false, "required": ["request_id", "run_id", "run_token", "parent", "subject", "expires_at", "delegable"], "properties": { "request_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "run_token": { "type": "string", "maxLength": 1024, "minLength": 1 }, "parent": { "type": "object", "additionalProperties": false, "required": ["pcm_grant", "ts", "issuer", "subject", "intent", "caveats", "expires_at", "delegable", "parent", "sig"], "properties": { "pcm_grant": { "type": "integer", "const": 0 }, "ts": { "type": "string", "maxLength": 27, "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{6}Z(?![\\s\\S])" }, "issuer": { "type": "object", "additionalProperties": false, "required": ["kind", "id", "run", "tenant"], "properties": { "kind": { "enum": ["person", "agent"] }, "id": { "type": "string", "maxLength": 256 }, "person": { "type": "string", "maxLength": 256 }, "run": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "tenant": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" }, "approval_id": { "type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9._:-]+(?![\\s\\S])" } } }, "subject": { "type": "string", "maxLength": 256, "pattern": "^[a-z0-9_]+:[^\\n]+(?![\\s\\S])" }, "intent": { "type": "string", "maxLength": 136, "pattern": "^[a-z][a-z0-9_.-]{0,63}@sha256:[0-9a-f]{64}(?![\\s\\S])" }, "caveats": { "type": "array", "maxItems": 16, "items": { "type": "object", "additionalProperties": false, "required": ["field", "op", "value"], "properties": { "field": { "type": "string", "maxLength": 64, "pattern": "^[a-z][a-z0-9_]*(?![\\s\\S])" }, "op": { "enum": ["==", "<=", ">=", "<", ">", "in"] }, "value": {} } } }, "expires_at": { "type": "string", "maxLength": 27, "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{6}Z(?![\\s\\S])" }, "delegable": { "type": "boolean" }, "parent": { "oneOf": [{ "type": "string", "maxLength": 71, "pattern": "^sha256:[0-9a-f]{64}(?![\\s\\S])" }, { "type": "null" }] }, "sig": { "type": "object", "additionalProperties": false, "required": ["key", "sig"], "properties": { "key": { "type": "string", "maxLength": 300, "minLength": 1 }, "sig": { "type": "string", "maxLength": 88 } } } } }, "subject": { "type": "string", "maxLength": 256, "pattern": "^[a-z0-9_]+:[^\\n]+(?![\\s\\S])" }, "caveats": { "type": "array", "maxItems": 16, "items": { "type": "object", "additionalProperties": false, "required": ["field", "op", "value"], "properties": { "field": { "type": "string", "maxLength": 64, "pattern": "^[a-z][a-z0-9_]*(?![\\s\\S])" }, "op": { "enum": ["==", "<=", ">=", "<", ">", "in"] }, "value": {} } } }, "expires_at": { "type": "string", "maxLength": 27, "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{6}Z(?![\\s\\S])" }, "delegable": { "type": "boolean" } } },
@@ -3,6 +3,8 @@
3
3
  * for the verifier's `incidents` check. A port kept in step with the reference by tests/test_ts_verifier.py.
4
4
  */
5
5
  type J = any;
6
+ /** fnmatch.fnmatchcase's pattern as a RegExp: `*`, `?` and `[...]` (`[!...]` negated). */
7
+ export declare function glob(pat: string): RegExp;
6
8
  type Fired = [string, string[], string, {
7
9
  kind: string;
8
10
  id: string;
@@ -10,7 +10,7 @@ function ts(t) {
10
10
  return (Date.parse(m[1] + "Z") / 1000 * 1e6 + Number((m[2] ?? "").padEnd(6, "0"))) / 1e6;
11
11
  }
12
12
  /** fnmatch.fnmatchcase's pattern as a RegExp: `*`, `?` and `[...]` (`[!...]` negated). */
13
- function glob(pat) {
13
+ export function glob(pat) {
14
14
  let out = "";
15
15
  for (let i = 0; i < pat.length; i++) {
16
16
  const c = pat[i], end = c === "[" ? pat.indexOf("]", i + 2) : -1;
@@ -212,6 +212,14 @@ export const MEANING = {
212
212
  },
213
213
  "incident policies": { warn: "Policies an incident cites that aren't in the bundle: those incidents are the "
214
214
  + "signer's word." },
215
+ "run labels": {
216
+ pass: "What each run had done that its run conditions read (a secret read, untrusted content), replayed from its "
217
+ + "records under its policy, and what it inherited from another run of the same requester.",
218
+ fail: "A run label was added without a record that sets it, left out after one, or cleared by the run's own owner, "
219
+ + "or a call was held under a label the run didn't carry.",
220
+ },
221
+ "label policies": { warn: "Policies runs were decided under that neither the bundle nor the trust config carries: "
222
+ + "their labels are the signer's word, and one it left out wouldn't show." },
215
223
  "content vault": { pass: "Who read or erased retained content, as the signer recorded it." },
216
224
  "tiers": {
217
225
  pass: "Tool calls by how they were captured: T2 gateway or executor, T1 adapter, T3 import (receipt only).",
@@ -236,6 +244,20 @@ export const MEANING = {
236
244
  + "lacks the policy they were held under.",
237
245
  fail: "An agent approved a call the rules for agent approvals don't let it approve.",
238
246
  },
247
+ "AI approvals": {
248
+ pass: "Held calls an AI approver answered, each yes with two model answers that agree and a person's earlier yes "
249
+ + "to a call like it, checked where the bundle holds that yes.",
250
+ fail: "An AI approver's yes decided a call without two answers that agree, without a person's earlier yes to a "
251
+ + "call like it, with a person's rejection of a call like it, or on an earlier yes that doesn't hold: another "
252
+ + "kind of call, a self-approval or break-glass answer, a run that wasn't clean, given after it or over 30 days "
253
+ + "before it, or revoked before it.",
254
+ },
255
+ "AI run bound": {
256
+ pass: "AI approvals in runs that carried a label (a secret read, say), each checked against the run bound of the "
257
+ + "policy it was decided under: none of those labels closed the run to the AI approver.",
258
+ fail: "An AI approver's yes in a run whose label the policy's run bound names, or one whose policy snapshot the "
259
+ + "bundle doesn't hold, so nothing shows the run bound allowed it. Export with the policy snapshots.",
260
+ },
239
261
  "break-glass approvals": { warn: "Approvals given under the break-glass role, with who and why." },
240
262
  "not interpreted": { warn: "Records carry an extension this verifier doesn't read. They verified like every other "
241
263
  + "record." },
@@ -247,6 +269,11 @@ export const MEANING = {
247
269
  warn: "A record carries a gateway amendment where or how the signer never writes one. The record verified like "
248
270
  + "every other.",
249
271
  },
272
+ "approval decision": {
273
+ pass: "Each used approval names the decision it ran under: one of the same call and attempt, signed before the use.",
274
+ warn: "A used approval names a decision the bundle doesn't hold before it, of another call or attempt, or no "
275
+ + "decision at all: the signer never writes that. The record verified like every other.",
276
+ },
250
277
  "openshell policy": {
251
278
  pass: "Changes of the sandbox's policy or configuration that NVIDIA OpenShell reported, signed into the run as "
252
279
  + "OpenShell's report.",
@@ -23,10 +23,10 @@ import { type Floats } from "./jcs.js";
23
23
  export { MAX_ENTRIES, MAX_ENTRY, MAX_TOTAL, Unusable, readZip } from "./zip.js";
24
24
  export { StrictJSONError, canonicalize, strictParse, strictParseBytes } from "./jcs.js";
25
25
  /** This verifier's release (the package's). */
26
- export declare const VERSION = "1.7.3";
26
+ export declare const VERSION = "1.8.0";
27
27
  /** The newest bundle format version this verifier reads: the reference's VERSIONS' newest row (tracekit/bundle_v2.py),
28
28
  * or VERSION when later (tracekit/verify/v2.py READS); a bundle needing a later one is UNVERIFIABLE. */
29
- export declare const READS = "1.7.3";
29
+ export declare const READS = "1.8.0";
30
30
  export declare const EXIT_OK = 0, EXIT_FAIL = 1, EXIT_BAD = 2, EXIT_WARN = 3;
31
31
  /** The integrity of a trust config that can't be used: nothing in the bundle was checked. */
32
32
  export declare const TRUST_UNUSABLE = "UNVERIFIABLE (the trust file can't be used)";
@@ -83,12 +83,22 @@ export declare function verify(bundle: Uint8Array, trust: Uint8Array | null, nam
83
83
  * number.
84
84
  */
85
85
  export declare function checkGrants(rep: Report, events: J[], floats: Floats): Promise<void>;
86
+ /**
87
+ * ext.approval.decision (1.8.0): each approval.consumed names a policy.decision of its own run, tool_call_id and attempt
88
+ * that comes before it. The signer writes the decision it checked the approval's use against; the check is a warning,
89
+ * not a failure, when the bundle doesn't hold it (an ext name is non-critical).
90
+ */
91
+ export declare function checkApprovalDecision(rep: Report, events: J[]): void;
86
92
  /**
87
93
  * A line per ext name the records carry: its EXT_CHECKS check, or a `not interpreted` warning. The records were checked
88
94
  * like every other (signature, chain, inclusion); `full`: the manifest's advisory verifier_version; `floats`: the
89
95
  * parser's.
90
96
  */
91
97
  export declare function checkExt(rep: Report, events: J[], full: J, floats: Floats): Promise<void>;
98
+ /** The rules an operator's approval_agent may list (tracekit/policy2/compile.py APPROVER_RULES). */
99
+ export declare const APPROVER_RULES: J[];
100
+ /** How long a person's answer counts as a precedent (tracekit/signer/pipeline.py PRECEDENT_S). */
101
+ export declare const PRECEDENT_S: number;
92
102
  /** §4: null when `r` is a v2 record signed by one of `keys` (SPKI DER) with an allowed algorithm that is the key's own,
93
103
  * else why not. `floats`: where the parser read number tokens with a fraction or exponent (`v` is the integer 2). */
94
104
  export declare function verifyRecord(r: J, keys: Uint8Array[], algs: string[], floats?: Floats): Promise<string | null>;