@skrr-ai/cli 0.1.230 → 0.1.232
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 +22 -0
- package/bin/dev.cjs +4 -0
- package/dist/base-command.d.ts +0 -10
- package/dist/base-command.js +10 -39
- package/dist/commands/agent/message/context.d.ts +2 -0
- package/dist/commands/agent/message/context.js +18 -3
- package/dist/commands/agent/message/list.d.ts +22 -0
- package/dist/commands/agent/message/list.js +66 -0
- package/dist/commands/agent/message/send.d.ts +1 -1
- package/dist/commands/agent/message/send.js +1 -3
- package/dist/commands/agent/message/show.d.ts +14 -0
- package/dist/commands/agent/message/show.js +39 -0
- package/dist/commands/agents/chat.d.ts +2 -0
- package/dist/commands/agents/chat.js +20 -4
- package/dist/commands/agents/eval/show.d.ts +1 -0
- package/dist/commands/agents/eval/show.js +19 -0
- package/dist/commands/agents/intuitions/generate.js +1 -1
- package/dist/commands/agents/intuitions/list.js +1 -1
- package/dist/commands/code/acp.js +1 -1
- package/dist/commands/code/handover.d.ts +3 -3
- package/dist/commands/code/handover.js +12 -12
- package/dist/commands/code/index.d.ts +3 -8
- package/dist/commands/code/index.js +15 -21
- package/dist/commands/code/jobs/show.js +1 -0
- package/dist/commands/code/run.js +1 -1
- package/dist/commands/goals/plan-now.d.ts +5 -3
- package/dist/commands/goals/plan-now.js +21 -16
- package/dist/commands/runs/events.d.ts +14 -0
- package/dist/commands/runs/events.js +59 -0
- package/dist/commands/runs/list.d.ts +21 -0
- package/dist/commands/runs/list.js +87 -0
- package/dist/commands/runs/show.d.ts +13 -0
- package/dist/commands/runs/show.js +63 -0
- package/dist/commands/runs/stop.d.ts +14 -0
- package/dist/commands/runs/stop.js +78 -0
- package/dist/commands/runs/transcript.d.ts +17 -0
- package/dist/commands/runs/transcript.js +93 -0
- package/dist/commands/tasks/runs.js +7 -0
- package/dist/commands/tasks/start-receipt.js +8 -8
- package/dist/commands/tasks/start.js +12 -1
- package/dist/generated/agent-guides.json +226 -5
- package/dist/lib/agent-chat-queue.d.ts +2 -1
- package/dist/lib/agent-chat-queue.js +26 -21
- package/dist/lib/agent-runs.d.ts +41 -0
- package/dist/lib/agent-runs.js +177 -0
- package/dist/lib/agentic-stream.d.ts +1 -1
- package/dist/lib/agentic-stream.js +2 -2
- package/dist/lib/api-fetch.d.ts +2 -2
- package/dist/lib/api-fetch.js +5 -4
- package/dist/lib/code-handover.d.ts +2 -3
- package/dist/lib/code-handover.js +4 -6
- package/dist/lib/communication-history.d.ts +27 -0
- package/dist/lib/communication-history.js +45 -0
- package/dist/lib/execution-history.d.ts +31 -0
- package/dist/lib/execution-history.js +7 -0
- package/dist/lib/first-party-harness-broker.d.ts +1 -1
- package/dist/lib/first-party-harness-broker.js +3 -5
- package/dist/lib/inbound-messages.d.ts +1 -0
- package/dist/lib/inbound-messages.js +3 -0
- package/dist/lib/intuition-look.js +20 -4
- package/dist/lib/memory-history-session.d.ts +8 -4
- package/dist/lib/memory-history-session.js +30 -23
- package/dist/lib/task-agent-run.d.ts +4 -0
- package/dist/lib/task-agent-run.js +15 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.d.ts +9 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.js +35 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/toolApprovalSignature.d.ts +62 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/toolApprovalSignature.js +56 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.d.ts +9 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.js +29 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/toolApprovalSignature.d.ts +62 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/toolApprovalSignature.js +51 -0
- package/dist/node_modules/@skrr-ai/data-provider/index.js +10997 -10987
- package/oclif.manifest.json +1065 -1648
- package/package.json +5 -2
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
type RuntimeEnv = Record<string, string | undefined>;
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare
|
|
2
|
+
type HistoryReader = 'memory-history-v1' | 'agent-history-v1';
|
|
3
|
+
export declare function hasBoundHistoryRuntime(env?: RuntimeEnv): boolean;
|
|
4
|
+
export declare const hasMemoryHistoryRuntime: typeof hasBoundHistoryRuntime;
|
|
5
|
+
/** Each reader binds its exact GET route to the primary session credential. */
|
|
6
|
+
export declare function bindHistoryRead(pathOrUrl: string, method: string, env?: RuntimeEnv, reader?: HistoryReader): {
|
|
5
7
|
url: string;
|
|
6
8
|
origin: string;
|
|
7
9
|
token: string;
|
|
8
10
|
};
|
|
9
|
-
export declare
|
|
11
|
+
export declare const bindMemoryHistoryRead: typeof bindHistoryRead;
|
|
12
|
+
export declare function boundHistorySession(env?: RuntimeEnv, reader?: HistoryReader): {
|
|
10
13
|
sessionId: string;
|
|
11
14
|
token: string;
|
|
12
15
|
server: URL;
|
|
13
16
|
};
|
|
17
|
+
export declare const memoryHistorySession: typeof boundHistorySession;
|
|
14
18
|
export {};
|
|
@@ -1,61 +1,68 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasMemoryHistoryRuntime =
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
3
|
+
exports.memoryHistorySession = exports.bindMemoryHistoryRead = exports.hasMemoryHistoryRuntime = void 0;
|
|
4
|
+
exports.hasBoundHistoryRuntime = hasBoundHistoryRuntime;
|
|
5
|
+
exports.bindHistoryRead = bindHistoryRead;
|
|
6
|
+
exports.boundHistorySession = boundHistorySession;
|
|
6
7
|
const BIND_MEMORY_HISTORY_READ_RE = /^\/api\/agentic\/sessions\/([^/]+)\/memory\/agents\/([^/]+)\/versions(?:\/([^/]+))?$/;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
//
|
|
10
|
-
// silently turn a managed history read into an owner-account read.
|
|
8
|
+
const BIND_AGENT_HISTORY_READ_RE = /^\/api\/agentic\/sessions\/([^/]+)\/(?:communication-history\/(?:list|show|outreach)|execution-history\/(?:list|show|transcript))$/;
|
|
9
|
+
function hasBoundHistoryRuntime(env = process.env) {
|
|
10
|
+
// A partial tuple must not change an Agent read into an owner-account read.
|
|
11
11
|
return env.OVERSKY_AUTONOMOUS_SESSION === '1' ||
|
|
12
12
|
Boolean(env.OVERSKY_SESSION_ID?.trim() || env.OVERSKY_SESSION_TOKEN?.trim());
|
|
13
13
|
}
|
|
14
|
+
exports.hasMemoryHistoryRuntime = hasBoundHistoryRuntime;
|
|
14
15
|
function refusal(message, code, status) {
|
|
15
16
|
return Object.assign(new Error(message), { code, status });
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
function historyReaderLabel(reader) {
|
|
19
|
+
return reader === 'memory-history-v1' ? 'Memory' : 'Agent';
|
|
20
|
+
}
|
|
21
|
+
/** Each reader binds its exact GET route to the primary session credential. */
|
|
22
|
+
function bindHistoryRead(pathOrUrl, method, env = process.env, reader = 'memory-history-v1') {
|
|
23
|
+
const memory = reader === 'memory-history-v1';
|
|
24
|
+
const label = historyReaderLabel(reader);
|
|
25
|
+
const { sessionId, token, server } = boundHistorySession(env, reader);
|
|
20
26
|
let target;
|
|
21
27
|
try {
|
|
22
28
|
target = new URL(pathOrUrl, server);
|
|
23
29
|
}
|
|
24
30
|
catch {
|
|
25
|
-
throw refusal('
|
|
31
|
+
throw refusal(label + ' history requires the bound session server. Start a new managed Agent session.', label.toUpperCase() + '_RUNTIME_ORIGIN_MISMATCH', 403);
|
|
26
32
|
}
|
|
27
33
|
if (target.origin !== server.origin || target.username || target.password) {
|
|
28
|
-
throw refusal('
|
|
34
|
+
throw refusal(label + ' history cannot send its session credential to another server.', label.toUpperCase() + '_RUNTIME_ORIGIN_MISMATCH', 403);
|
|
29
35
|
}
|
|
30
|
-
const route = BIND_MEMORY_HISTORY_READ_RE.exec(target.pathname);
|
|
36
|
+
const route = (memory ? BIND_MEMORY_HISTORY_READ_RE : BIND_AGENT_HISTORY_READ_RE).exec(target.pathname);
|
|
31
37
|
let selectedSession;
|
|
32
38
|
let selectedAgent;
|
|
33
39
|
try {
|
|
34
40
|
selectedSession = route ? decodeURIComponent(route[1]) : undefined;
|
|
35
|
-
selectedAgent = route ? decodeURIComponent(route[2]) : undefined;
|
|
41
|
+
selectedAgent = route?.[2] ? decodeURIComponent(route[2]) : undefined;
|
|
36
42
|
}
|
|
37
43
|
catch { /* malformed encoded selectors are refused below */ }
|
|
38
44
|
if (method.toUpperCase() !== 'GET' || !route || selectedSession !== sessionId ||
|
|
39
|
-
(env.OVERSKY_SESSION_AGENT_ID?.trim() && selectedAgent !== env.OVERSKY_SESSION_AGENT_ID.trim())) {
|
|
40
|
-
throw refusal('
|
|
45
|
+
(memory && env.OVERSKY_SESSION_AGENT_ID?.trim() && selectedAgent !== env.OVERSKY_SESSION_AGENT_ID.trim())) {
|
|
46
|
+
throw refusal(label + ' history must target this admitted Agent session. Start a session for the selected Agent.', label.toUpperCase() + '_RUNTIME_SCOPE_MISMATCH', 403);
|
|
41
47
|
}
|
|
42
48
|
return { url: target.toString(), origin: server.origin, token };
|
|
43
49
|
}
|
|
44
|
-
|
|
50
|
+
exports.bindMemoryHistoryRead = bindHistoryRead;
|
|
51
|
+
function boundHistorySession(env = process.env, reader = 'memory-history-v1') {
|
|
52
|
+
const label = historyReaderLabel(reader);
|
|
45
53
|
const sessionId = env.OVERSKY_SESSION_ID?.trim();
|
|
46
54
|
const token = env.OVERSKY_SESSION_TOKEN?.trim();
|
|
47
55
|
if (!sessionId || !token?.startsWith('agst_')) {
|
|
48
|
-
throw refusal('
|
|
56
|
+
throw refusal(label + ' history requires the bound Agent session credential. Start a managed Agent session; owner credentials cannot replace it.', label.toUpperCase() + '_RUNTIME_CREDENTIAL_MISSING', 401);
|
|
49
57
|
}
|
|
50
58
|
let trusted;
|
|
51
59
|
try {
|
|
52
60
|
trusted = new URL(env.OVERSKY_SERVER_URL || '');
|
|
53
61
|
}
|
|
54
|
-
catch {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (!['https:', 'http:'].includes(trusted.protocol) || trusted.username || trusted.password) {
|
|
58
|
-
throw refusal('Memory history cannot send its session credential to another server.', 'MEMORY_RUNTIME_ORIGIN_MISMATCH', 403);
|
|
62
|
+
catch { /* checked below */ }
|
|
63
|
+
if (!trusted || !['https:', 'http:'].includes(trusted.protocol) || trusted.username || trusted.password) {
|
|
64
|
+
throw refusal(label + ' history requires the bound session server. Start a new managed Agent session.', label.toUpperCase() + '_RUNTIME_ORIGIN_MISMATCH', 403);
|
|
59
65
|
}
|
|
60
66
|
return { sessionId, token, server: trusted };
|
|
61
67
|
}
|
|
68
|
+
exports.memoryHistorySession = boundHistorySession;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.taskAgentRunCommand = taskAgentRunCommand;
|
|
4
|
+
const agent_runs_1 = require("./agent-runs");
|
|
5
|
+
function taskAgentRunCommand(reference, bin) {
|
|
6
|
+
const id = (0, agent_runs_1.canonicalRunId)(reference?.agentRunId);
|
|
7
|
+
if (!id)
|
|
8
|
+
return undefined;
|
|
9
|
+
const workspace = reference?.agentRunWorkspaceId;
|
|
10
|
+
if (workspace === undefined)
|
|
11
|
+
return `${bin} runs show ${id}`;
|
|
12
|
+
return typeof workspace === 'string' && /^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(workspace)
|
|
13
|
+
? `${bin} runs show ${id} --workspace ${workspace}`
|
|
14
|
+
: undefined;
|
|
15
|
+
}
|
|
@@ -46,6 +46,8 @@
|
|
|
46
46
|
* heard is `firstPartyHarness.ts`'s and the API's `sessionProvider.js`'s
|
|
47
47
|
* decision, not this table's.
|
|
48
48
|
*/
|
|
49
|
+
/** The daemon enforces the Attempt binding and emits exact receipts on session requests. */
|
|
50
|
+
export declare const CANONICAL_DAEMON_ATTEMPT_CAPABILITY = "session_managed_attempt_v1";
|
|
49
51
|
export declare const DAEMON_WIRE_DIRECTIONS: readonly ["server_to_daemon", "daemon_to_server", "bidirectional"];
|
|
50
52
|
export type DaemonWireDirection = (typeof DAEMON_WIRE_DIRECTIONS)[number];
|
|
51
53
|
export declare const DAEMON_WIRE_DELIVERIES: readonly ["fire_and_forget", "acked"];
|
|
@@ -102,6 +104,13 @@ export interface DaemonWireEntry {
|
|
|
102
104
|
*/
|
|
103
105
|
readonly dormant?: string;
|
|
104
106
|
}
|
|
107
|
+
/** Confirms the recipient enforces the canonical native launch receipt. */
|
|
108
|
+
export declare const LOCAL_SESSION_CANONICAL_LAUNCH_CAPABILITY = "local_session_canonical_launch_v1";
|
|
109
|
+
export declare const LOCAL_SESSION_START_WORKSPACE_METHOD = "daemon:local-session-start-workspace:v1";
|
|
110
|
+
export declare const LOCAL_SESSION_FIRST_START_PROVIDER_CAPABILITIES: Readonly<{
|
|
111
|
+
readonly codex: "local_session_codex_first_start_v1";
|
|
112
|
+
readonly claude: "local_session_claude_first_start_v1";
|
|
113
|
+
}>;
|
|
105
114
|
/** Every daemon ⇄ API name, in declaration order (which the generated schema keeps). */
|
|
106
115
|
export declare const DAEMON_WIRE: readonly DaemonWireEntry[];
|
|
107
116
|
export declare const DAEMON_WIRE_NAMES: readonly string[];
|
|
@@ -18,12 +18,16 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var daemonWire_exports = {};
|
|
20
20
|
__export(daemonWire_exports, {
|
|
21
|
+
CANONICAL_DAEMON_ATTEMPT_CAPABILITY: () => CANONICAL_DAEMON_ATTEMPT_CAPABILITY,
|
|
21
22
|
DAEMON_WIRE: () => DAEMON_WIRE,
|
|
22
23
|
DAEMON_WIRE_CARRIERS: () => DAEMON_WIRE_CARRIERS,
|
|
23
24
|
DAEMON_WIRE_DELIVERIES: () => DAEMON_WIRE_DELIVERIES,
|
|
24
25
|
DAEMON_WIRE_DIRECTIONS: () => DAEMON_WIRE_DIRECTIONS,
|
|
25
26
|
DAEMON_WIRE_NAMES: () => DAEMON_WIRE_NAMES,
|
|
26
27
|
DAEMON_WIRE_STABILITIES: () => DAEMON_WIRE_STABILITIES,
|
|
28
|
+
LOCAL_SESSION_CANONICAL_LAUNCH_CAPABILITY: () => LOCAL_SESSION_CANONICAL_LAUNCH_CAPABILITY,
|
|
29
|
+
LOCAL_SESSION_FIRST_START_PROVIDER_CAPABILITIES: () => LOCAL_SESSION_FIRST_START_PROVIDER_CAPABILITIES,
|
|
30
|
+
LOCAL_SESSION_START_WORKSPACE_METHOD: () => LOCAL_SESSION_START_WORKSPACE_METHOD,
|
|
27
31
|
daemonWireEntry: () => daemonWireEntry,
|
|
28
32
|
daemonWireHandles: () => daemonWireHandles,
|
|
29
33
|
daemonWireSends: () => daemonWireSends
|
|
@@ -34,6 +38,7 @@ var import_computerWire = require("./computerWire.js");
|
|
|
34
38
|
const MODULE_RE = /(\{[a-zA-Z]+\})/;
|
|
35
39
|
const MODULE_RE_2 = /^\{[a-zA-Z]+\}$/;
|
|
36
40
|
const MODULE_RE_3 = /[.*+?^${}()|[\]\\]/g;
|
|
41
|
+
const CANONICAL_DAEMON_ATTEMPT_CAPABILITY = "session_managed_attempt_v1";
|
|
37
42
|
const DAEMON_WIRE_DIRECTIONS = [
|
|
38
43
|
"server_to_daemon",
|
|
39
44
|
"daemon_to_server",
|
|
@@ -73,6 +78,12 @@ const WORKSPACE_ISOLATION_PROBE = "workspace_isolation_probe_v1";
|
|
|
73
78
|
const TOOL_RESPONSE_OUTBOX = "tool_response_outbox_v1";
|
|
74
79
|
const SESSION_STEER = "session_steer_v1";
|
|
75
80
|
const QUESTION_ACK = "question_ack_v1";
|
|
81
|
+
const LOCAL_SESSION_CANONICAL_LAUNCH_CAPABILITY = "local_session_canonical_launch_v1";
|
|
82
|
+
const LOCAL_SESSION_START_WORKSPACE_METHOD = "daemon:local-session-start-workspace:v1";
|
|
83
|
+
const LOCAL_SESSION_FIRST_START_PROVIDER_CAPABILITIES = Object.freeze({
|
|
84
|
+
codex: "local_session_codex_first_start_v1",
|
|
85
|
+
claude: "local_session_claude_first_start_v1"
|
|
86
|
+
});
|
|
76
87
|
const CONNECTION = [
|
|
77
88
|
toServer("daemon:register", "The daemon introduces itself: identity, version, capabilities, sessions it holds.", {
|
|
78
89
|
delivery: "acked",
|
|
@@ -176,6 +187,18 @@ const RPC_METHODS = [
|
|
|
176
187
|
capability: SESSION_STEER,
|
|
177
188
|
stability: "experimental"
|
|
178
189
|
}),
|
|
190
|
+
toDaemon("daemon.session.steerAttempt", "Deliver a follow-up to the exact running daemon Attempt.", {
|
|
191
|
+
delivery: "acked",
|
|
192
|
+
carriers: RPC,
|
|
193
|
+
capability: SESSION_STEER,
|
|
194
|
+
stability: "experimental"
|
|
195
|
+
}),
|
|
196
|
+
toDaemon("daemon.session.inspectAttempt", "Read the start and terminal receipts of an exact daemon Attempt.", {
|
|
197
|
+
delivery: "acked",
|
|
198
|
+
carriers: RPC,
|
|
199
|
+
stability: "experimental",
|
|
200
|
+
capability: CANONICAL_DAEMON_ATTEMPT_CAPABILITY
|
|
201
|
+
}),
|
|
179
202
|
toDaemon("daemon.session.stop", "Stop one daemon session.", { delivery: "acked", carriers: RPC }),
|
|
180
203
|
toDaemon("daemon.session.spawn", "Start a daemon session under the daemon-session registry.", {
|
|
181
204
|
delivery: "acked",
|
|
@@ -339,7 +362,7 @@ const LOCAL_SESSION = [
|
|
|
339
362
|
stability: "experimental",
|
|
340
363
|
capability: "local_session_claude_native_turn_v1"
|
|
341
364
|
}),
|
|
342
|
-
toDaemon("daemon:local-session-stop:v1", "Ask the running native turn this daemon claimed to stop.
|
|
365
|
+
toDaemon("daemon:local-session-stop:v1", "Ask the exact running native turn this daemon claimed to stop. The source qualifies the recipient for a Continue or first start.", {
|
|
343
366
|
delivery: "acked",
|
|
344
367
|
carriers: RPC,
|
|
345
368
|
stability: "experimental",
|
|
@@ -357,7 +380,13 @@ const LOCAL_SESSION = [
|
|
|
357
380
|
stability: "experimental",
|
|
358
381
|
capability: "local_session_fork_v1"
|
|
359
382
|
}),
|
|
360
|
-
toDaemon(
|
|
383
|
+
toDaemon(LOCAL_SESSION_START_WORKSPACE_METHOD, "Prepare a validated working directory for a first start on the owner\u2019s personal machine. Returns an opaque directory reference.", {
|
|
384
|
+
delivery: "acked",
|
|
385
|
+
carriers: RPC,
|
|
386
|
+
stability: "experimental",
|
|
387
|
+
capability: "local_session_pending_start_v1"
|
|
388
|
+
}),
|
|
389
|
+
toDaemon("daemon:local-session-start:v1", "Start a new native session from a pending Chat. Requires the selected provider capability and journals the candidate before the first message.", {
|
|
361
390
|
delivery: "acked",
|
|
362
391
|
carriers: RPC,
|
|
363
392
|
stability: "experimental",
|
|
@@ -655,12 +684,16 @@ function daemonWireHandles(entry2, end) {
|
|
|
655
684
|
}
|
|
656
685
|
// Annotate the CommonJS export names for ESM import in node:
|
|
657
686
|
0 && (module.exports = {
|
|
687
|
+
CANONICAL_DAEMON_ATTEMPT_CAPABILITY,
|
|
658
688
|
DAEMON_WIRE,
|
|
659
689
|
DAEMON_WIRE_CARRIERS,
|
|
660
690
|
DAEMON_WIRE_DELIVERIES,
|
|
661
691
|
DAEMON_WIRE_DIRECTIONS,
|
|
662
692
|
DAEMON_WIRE_NAMES,
|
|
663
693
|
DAEMON_WIRE_STABILITIES,
|
|
694
|
+
LOCAL_SESSION_CANONICAL_LAUNCH_CAPABILITY,
|
|
695
|
+
LOCAL_SESSION_FIRST_START_PROVIDER_CAPABILITIES,
|
|
696
|
+
LOCAL_SESSION_START_WORKSPACE_METHOD,
|
|
664
697
|
daemonWireEntry,
|
|
665
698
|
daemonWireHandles,
|
|
666
699
|
daemonWireSends
|
|
@@ -166,6 +166,67 @@ export interface SignedToolApproval {
|
|
|
166
166
|
/** base64 Ed25519 signature over the domain prefix + `payload`. */
|
|
167
167
|
sig: string;
|
|
168
168
|
}
|
|
169
|
+
/** Common execution authority; sourceDocumentId belongs to the named physical carrier. */
|
|
170
|
+
type TaskCommandNativeInvocation = {
|
|
171
|
+
version: 1;
|
|
172
|
+
sourceDocumentId: string;
|
|
173
|
+
tenantId: string;
|
|
174
|
+
runId: string;
|
|
175
|
+
attemptId: string;
|
|
176
|
+
operationId: string;
|
|
177
|
+
controlGeneration: number;
|
|
178
|
+
sessionId: string;
|
|
179
|
+
nativeRequestId: string;
|
|
180
|
+
nativeDispatchId: string;
|
|
181
|
+
daemonId: string;
|
|
182
|
+
daemonIncarnation: string;
|
|
183
|
+
};
|
|
184
|
+
export type TaskCommandRunAuthority = TaskCommandNativeInvocation & ({
|
|
185
|
+
kind: 'ordinary_task';
|
|
186
|
+
resumedFromRunId: string;
|
|
187
|
+
resumedFromAttemptId: string;
|
|
188
|
+
workspaceStateDigest: string;
|
|
189
|
+
} | {
|
|
190
|
+
kind: 'scheduled_task';
|
|
191
|
+
});
|
|
192
|
+
/** Derived independently from the one server-authorized native start on each side of the transport. */
|
|
193
|
+
export declare function ordinaryTaskCommandAuthorityFromRequest(request: unknown): TaskCommandRunAuthority | null;
|
|
194
|
+
export type TaskCommandAnswerRelease = {
|
|
195
|
+
binding: {
|
|
196
|
+
runAuthority: TaskCommandRunAuthority;
|
|
197
|
+
};
|
|
198
|
+
bindingDigest: string;
|
|
199
|
+
requestId: string;
|
|
200
|
+
grantRequestId: string;
|
|
201
|
+
execution: {
|
|
202
|
+
toolName: string;
|
|
203
|
+
};
|
|
204
|
+
version: number;
|
|
205
|
+
expiresAt: number;
|
|
206
|
+
toolUseId: string;
|
|
207
|
+
state: 'released';
|
|
208
|
+
purpose: 'task-command-once';
|
|
209
|
+
signedRelease?: unknown;
|
|
210
|
+
};
|
|
211
|
+
export declare function taskCommandAnswerReleaseSigningInput(record: TaskCommandAnswerRelease): {
|
|
212
|
+
kind: string;
|
|
213
|
+
runAuthority: TaskCommandRunAuthority;
|
|
214
|
+
bindingDigest: string;
|
|
215
|
+
requestId: string;
|
|
216
|
+
grantRequestId: string;
|
|
217
|
+
execution: {
|
|
218
|
+
toolName: string;
|
|
219
|
+
};
|
|
220
|
+
version: number;
|
|
221
|
+
expiresAt: number;
|
|
222
|
+
};
|
|
223
|
+
/** Verify against the native invocation retained at dispatch and the independently pinned platform key. */
|
|
224
|
+
export declare function verifyTaskCommandAnswerRelease(record: TaskCommandAnswerRelease, expected: {
|
|
225
|
+
authority: TaskCommandRunAuthority;
|
|
226
|
+
daemonId: string;
|
|
227
|
+
requestId: string;
|
|
228
|
+
toolUseId: string;
|
|
229
|
+
}, keyset: ApprovalKeyset, now?: number): boolean;
|
|
169
230
|
/** Server side: mint and sign a v2 attestation after a person approved THIS call. */
|
|
170
231
|
export declare function signToolApproval(args: {
|
|
171
232
|
toolUseId: string;
|
|
@@ -281,3 +342,4 @@ export type ApprovalKeysetPinState = {
|
|
|
281
342
|
export declare function verifyToolApprovalAttestation(approval: unknown, call: SignedToolApprovalCall, pin: ApprovalKeysetPinState): SignedToolApprovalVerdict & {
|
|
282
343
|
signed?: boolean;
|
|
283
344
|
};
|
|
345
|
+
export {};
|
|
@@ -23,12 +23,15 @@ __export(toolApprovalSignature_exports, {
|
|
|
23
23
|
buildApprovalKeysetDocument: () => buildApprovalKeysetDocument,
|
|
24
24
|
canonicalApprovalKeysetText: () => canonicalApprovalKeysetText,
|
|
25
25
|
endorseApprovalKeysetText: () => endorseApprovalKeysetText,
|
|
26
|
+
ordinaryTaskCommandAuthorityFromRequest: () => ordinaryTaskCommandAuthorityFromRequest,
|
|
26
27
|
parseApprovalKeysetText: () => parseApprovalKeysetText,
|
|
27
28
|
signPersonalDataExecutorLease: () => signPersonalDataExecutorLease,
|
|
28
29
|
signToolApproval: () => signToolApproval,
|
|
30
|
+
taskCommandAnswerReleaseSigningInput: () => taskCommandAnswerReleaseSigningInput,
|
|
29
31
|
verifyApprovalKeysetDocument: () => verifyApprovalKeysetDocument,
|
|
30
32
|
verifyPersonalDataExecutorLease: () => verifyPersonalDataExecutorLease,
|
|
31
33
|
verifySignedToolApproval: () => verifySignedToolApproval,
|
|
34
|
+
verifyTaskCommandAnswerRelease: () => verifyTaskCommandAnswerRelease,
|
|
32
35
|
verifyToolApprovalAttestation: () => verifyToolApprovalAttestation
|
|
33
36
|
});
|
|
34
37
|
module.exports = __toCommonJS(toolApprovalSignature_exports);
|
|
@@ -205,6 +208,56 @@ function verifyApprovalKeysetDocument(doc, trust) {
|
|
|
205
208
|
}
|
|
206
209
|
return { ok: true, keyset, text, change: "rotated" };
|
|
207
210
|
}
|
|
211
|
+
function ordinaryTaskCommandAuthorityFromRequest(request) {
|
|
212
|
+
if (!request || typeof request !== "object")
|
|
213
|
+
return null;
|
|
214
|
+
const { sessionId, requestId, managedAttempt: start, ordinaryTaskExecutor: source, taskCheckoutAnswer: answer, expectedTaskWorkspacePlacementDigest } = request;
|
|
215
|
+
const id = (value) => typeof value === "string" && value.length > 0 && value.length <= 160;
|
|
216
|
+
if (source?.version !== 1 || answer?.version !== 1 || answer.decision !== "allow_once" || !id(sessionId) || !id(requestId) || source.sessionId !== sessionId || source.requestId !== requestId || !/^[a-f0-9]{24}$/.test(source.runDocumentId) || !id(source.dispatchId) || !id(source.daemonId) || !start || start.executor?.id !== source.daemonId || start.executor.targetId !== source.daemonId || !id(start.executor.incarnation) || !id(start.tenantId) || !id(start.runId) || !id(start.attemptId) || !id(start.operationId) || !Number.isSafeInteger(start.controlGeneration) || start.controlGeneration < 0 || !/^[a-f0-9]{64}$/.test(answer.workspaceStateDigest) || !/^[a-f0-9]{64}$/.test(answer.placementDigest) || answer.placementDigest !== expectedTaskWorkspacePlacementDigest || !id(answer.sourceRunId) || !id(answer.sourceAttemptId))
|
|
217
|
+
return null;
|
|
218
|
+
return Object.freeze({
|
|
219
|
+
version: 1,
|
|
220
|
+
kind: "ordinary_task",
|
|
221
|
+
sourceDocumentId: source.runDocumentId,
|
|
222
|
+
tenantId: start.tenantId,
|
|
223
|
+
runId: start.runId,
|
|
224
|
+
attemptId: start.attemptId,
|
|
225
|
+
operationId: start.operationId,
|
|
226
|
+
controlGeneration: start.controlGeneration,
|
|
227
|
+
sessionId,
|
|
228
|
+
nativeRequestId: requestId,
|
|
229
|
+
nativeDispatchId: source.dispatchId,
|
|
230
|
+
daemonId: source.daemonId,
|
|
231
|
+
daemonIncarnation: start.executor.incarnation,
|
|
232
|
+
resumedFromRunId: answer.sourceRunId,
|
|
233
|
+
resumedFromAttemptId: answer.sourceAttemptId,
|
|
234
|
+
workspaceStateDigest: answer.workspaceStateDigest
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
function taskCommandAnswerReleaseSigningInput(record) {
|
|
238
|
+
return {
|
|
239
|
+
kind: "task_command_answer_release",
|
|
240
|
+
runAuthority: record.binding.runAuthority,
|
|
241
|
+
bindingDigest: record.bindingDigest,
|
|
242
|
+
requestId: record.requestId,
|
|
243
|
+
grantRequestId: record.grantRequestId,
|
|
244
|
+
execution: record.execution,
|
|
245
|
+
version: record.version,
|
|
246
|
+
expiresAt: record.expiresAt
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
function verifyTaskCommandAnswerRelease(record, expected, keyset, now = Date.now()) {
|
|
250
|
+
if (record?.state !== "released" || record.purpose !== "task-command-once" || !Number.isSafeInteger(record.expiresAt) || record.expiresAt <= now || record.toolUseId !== expected.toolUseId || record.requestId !== expected.requestId || typeof record.execution?.toolName !== "string" || expected.authority.daemonId !== expected.daemonId || (0, import_daemonToolApproval.canonicalToolInputDigest)(record.binding?.runAuthority) !== (0, import_daemonToolApproval.canonicalToolInputDigest)(expected.authority))
|
|
251
|
+
return false;
|
|
252
|
+
return verifySignedToolApproval(record.signedRelease, {
|
|
253
|
+
toolUseId: expected.toolUseId,
|
|
254
|
+
toolName: record.execution.toolName,
|
|
255
|
+
toolInput: taskCommandAnswerReleaseSigningInput(record),
|
|
256
|
+
daemonId: expected.daemonId,
|
|
257
|
+
sessionId: expected.authority.sessionId,
|
|
258
|
+
now
|
|
259
|
+
}, keyset).ok;
|
|
260
|
+
}
|
|
208
261
|
function signToolApproval(args) {
|
|
209
262
|
const now = args.now ?? Date.now();
|
|
210
263
|
const payload = {
|
|
@@ -375,11 +428,14 @@ function verifyToolApprovalAttestation(approval, call, pin) {
|
|
|
375
428
|
buildApprovalKeysetDocument,
|
|
376
429
|
canonicalApprovalKeysetText,
|
|
377
430
|
endorseApprovalKeysetText,
|
|
431
|
+
ordinaryTaskCommandAuthorityFromRequest,
|
|
378
432
|
parseApprovalKeysetText,
|
|
379
433
|
signPersonalDataExecutorLease,
|
|
380
434
|
signToolApproval,
|
|
435
|
+
taskCommandAnswerReleaseSigningInput,
|
|
381
436
|
verifyApprovalKeysetDocument,
|
|
382
437
|
verifyPersonalDataExecutorLease,
|
|
383
438
|
verifySignedToolApproval,
|
|
439
|
+
verifyTaskCommandAnswerRelease,
|
|
384
440
|
verifyToolApprovalAttestation
|
|
385
441
|
});
|
|
@@ -46,6 +46,8 @@
|
|
|
46
46
|
* heard is `firstPartyHarness.ts`'s and the API's `sessionProvider.js`'s
|
|
47
47
|
* decision, not this table's.
|
|
48
48
|
*/
|
|
49
|
+
/** The daemon enforces the Attempt binding and emits exact receipts on session requests. */
|
|
50
|
+
export declare const CANONICAL_DAEMON_ATTEMPT_CAPABILITY = "session_managed_attempt_v1";
|
|
49
51
|
export declare const DAEMON_WIRE_DIRECTIONS: readonly ["server_to_daemon", "daemon_to_server", "bidirectional"];
|
|
50
52
|
export type DaemonWireDirection = (typeof DAEMON_WIRE_DIRECTIONS)[number];
|
|
51
53
|
export declare const DAEMON_WIRE_DELIVERIES: readonly ["fire_and_forget", "acked"];
|
|
@@ -102,6 +104,13 @@ export interface DaemonWireEntry {
|
|
|
102
104
|
*/
|
|
103
105
|
readonly dormant?: string;
|
|
104
106
|
}
|
|
107
|
+
/** Confirms the recipient enforces the canonical native launch receipt. */
|
|
108
|
+
export declare const LOCAL_SESSION_CANONICAL_LAUNCH_CAPABILITY = "local_session_canonical_launch_v1";
|
|
109
|
+
export declare const LOCAL_SESSION_START_WORKSPACE_METHOD = "daemon:local-session-start-workspace:v1";
|
|
110
|
+
export declare const LOCAL_SESSION_FIRST_START_PROVIDER_CAPABILITIES: Readonly<{
|
|
111
|
+
readonly codex: "local_session_codex_first_start_v1";
|
|
112
|
+
readonly claude: "local_session_claude_first_start_v1";
|
|
113
|
+
}>;
|
|
105
114
|
/** Every daemon ⇄ API name, in declaration order (which the generated schema keeps). */
|
|
106
115
|
export declare const DAEMON_WIRE: readonly DaemonWireEntry[];
|
|
107
116
|
export declare const DAEMON_WIRE_NAMES: readonly string[];
|
|
@@ -54,6 +54,8 @@ const MODULE_RE_3 = /[.*+?^${}()|[\]\\]/g;
|
|
|
54
54
|
// ---------------------------------------------------------------------------
|
|
55
55
|
// Vocabulary
|
|
56
56
|
// ---------------------------------------------------------------------------
|
|
57
|
+
/** The daemon enforces the Attempt binding and emits exact receipts on session requests. */
|
|
58
|
+
export const CANONICAL_DAEMON_ATTEMPT_CAPABILITY = 'session_managed_attempt_v1';
|
|
57
59
|
export const DAEMON_WIRE_DIRECTIONS = [
|
|
58
60
|
'server_to_daemon',
|
|
59
61
|
'daemon_to_server',
|
|
@@ -105,6 +107,13 @@ const WORKSPACE_ISOLATION_PROBE = 'workspace_isolation_probe_v1';
|
|
|
105
107
|
const TOOL_RESPONSE_OUTBOX = 'tool_response_outbox_v1';
|
|
106
108
|
const SESSION_STEER = 'session_steer_v1';
|
|
107
109
|
const QUESTION_ACK = 'question_ack_v1';
|
|
110
|
+
/** Confirms the recipient enforces the canonical native launch receipt. */
|
|
111
|
+
export const LOCAL_SESSION_CANONICAL_LAUNCH_CAPABILITY = 'local_session_canonical_launch_v1';
|
|
112
|
+
export const LOCAL_SESSION_START_WORKSPACE_METHOD = 'daemon:local-session-start-workspace:v1';
|
|
113
|
+
export const LOCAL_SESSION_FIRST_START_PROVIDER_CAPABILITIES = Object.freeze({
|
|
114
|
+
codex: 'local_session_codex_first_start_v1',
|
|
115
|
+
claude: 'local_session_claude_first_start_v1',
|
|
116
|
+
});
|
|
108
117
|
// ---------------------------------------------------------------------------
|
|
109
118
|
// Connection, identity, liveness
|
|
110
119
|
// ---------------------------------------------------------------------------
|
|
@@ -214,6 +223,18 @@ const RPC_METHODS = [
|
|
|
214
223
|
capability: SESSION_STEER,
|
|
215
224
|
stability: 'experimental',
|
|
216
225
|
}),
|
|
226
|
+
toDaemon('daemon.session.steerAttempt', 'Deliver a follow-up to the exact running daemon Attempt.', {
|
|
227
|
+
delivery: 'acked',
|
|
228
|
+
carriers: RPC,
|
|
229
|
+
capability: SESSION_STEER,
|
|
230
|
+
stability: 'experimental',
|
|
231
|
+
}),
|
|
232
|
+
toDaemon('daemon.session.inspectAttempt', 'Read the start and terminal receipts of an exact daemon Attempt.', {
|
|
233
|
+
delivery: 'acked',
|
|
234
|
+
carriers: RPC,
|
|
235
|
+
stability: 'experimental',
|
|
236
|
+
capability: CANONICAL_DAEMON_ATTEMPT_CAPABILITY,
|
|
237
|
+
}),
|
|
217
238
|
toDaemon('daemon.session.stop', 'Stop one daemon session.', { delivery: 'acked', carriers: RPC }),
|
|
218
239
|
toDaemon('daemon.session.spawn', 'Start a daemon session under the daemon-session registry.', {
|
|
219
240
|
delivery: 'acked',
|
|
@@ -391,7 +412,7 @@ const LOCAL_SESSION = [
|
|
|
391
412
|
stability: 'experimental',
|
|
392
413
|
capability: 'local_session_claude_native_turn_v1',
|
|
393
414
|
}),
|
|
394
|
-
toDaemon('daemon:local-session-stop:v1', 'Ask the running native turn this daemon claimed to stop.
|
|
415
|
+
toDaemon('daemon:local-session-stop:v1', 'Ask the exact running native turn this daemon claimed to stop. The source qualifies the recipient for a Continue or first start.', {
|
|
395
416
|
delivery: 'acked',
|
|
396
417
|
carriers: RPC,
|
|
397
418
|
stability: 'experimental',
|
|
@@ -409,7 +430,13 @@ const LOCAL_SESSION = [
|
|
|
409
430
|
stability: 'experimental',
|
|
410
431
|
capability: 'local_session_fork_v1',
|
|
411
432
|
}),
|
|
412
|
-
toDaemon(
|
|
433
|
+
toDaemon(LOCAL_SESSION_START_WORKSPACE_METHOD, 'Prepare a validated working directory for a first start on the owner’s personal machine. Returns an opaque directory reference.', {
|
|
434
|
+
delivery: 'acked',
|
|
435
|
+
carriers: RPC,
|
|
436
|
+
stability: 'experimental',
|
|
437
|
+
capability: 'local_session_pending_start_v1',
|
|
438
|
+
}),
|
|
439
|
+
toDaemon('daemon:local-session-start:v1', 'Start a new native session from a pending Chat. Requires the selected provider capability and journals the candidate before the first message.', {
|
|
413
440
|
delivery: 'acked',
|
|
414
441
|
carriers: RPC,
|
|
415
442
|
stability: 'experimental',
|
|
@@ -166,6 +166,67 @@ export interface SignedToolApproval {
|
|
|
166
166
|
/** base64 Ed25519 signature over the domain prefix + `payload`. */
|
|
167
167
|
sig: string;
|
|
168
168
|
}
|
|
169
|
+
/** Common execution authority; sourceDocumentId belongs to the named physical carrier. */
|
|
170
|
+
type TaskCommandNativeInvocation = {
|
|
171
|
+
version: 1;
|
|
172
|
+
sourceDocumentId: string;
|
|
173
|
+
tenantId: string;
|
|
174
|
+
runId: string;
|
|
175
|
+
attemptId: string;
|
|
176
|
+
operationId: string;
|
|
177
|
+
controlGeneration: number;
|
|
178
|
+
sessionId: string;
|
|
179
|
+
nativeRequestId: string;
|
|
180
|
+
nativeDispatchId: string;
|
|
181
|
+
daemonId: string;
|
|
182
|
+
daemonIncarnation: string;
|
|
183
|
+
};
|
|
184
|
+
export type TaskCommandRunAuthority = TaskCommandNativeInvocation & ({
|
|
185
|
+
kind: 'ordinary_task';
|
|
186
|
+
resumedFromRunId: string;
|
|
187
|
+
resumedFromAttemptId: string;
|
|
188
|
+
workspaceStateDigest: string;
|
|
189
|
+
} | {
|
|
190
|
+
kind: 'scheduled_task';
|
|
191
|
+
});
|
|
192
|
+
/** Derived independently from the one server-authorized native start on each side of the transport. */
|
|
193
|
+
export declare function ordinaryTaskCommandAuthorityFromRequest(request: unknown): TaskCommandRunAuthority | null;
|
|
194
|
+
export type TaskCommandAnswerRelease = {
|
|
195
|
+
binding: {
|
|
196
|
+
runAuthority: TaskCommandRunAuthority;
|
|
197
|
+
};
|
|
198
|
+
bindingDigest: string;
|
|
199
|
+
requestId: string;
|
|
200
|
+
grantRequestId: string;
|
|
201
|
+
execution: {
|
|
202
|
+
toolName: string;
|
|
203
|
+
};
|
|
204
|
+
version: number;
|
|
205
|
+
expiresAt: number;
|
|
206
|
+
toolUseId: string;
|
|
207
|
+
state: 'released';
|
|
208
|
+
purpose: 'task-command-once';
|
|
209
|
+
signedRelease?: unknown;
|
|
210
|
+
};
|
|
211
|
+
export declare function taskCommandAnswerReleaseSigningInput(record: TaskCommandAnswerRelease): {
|
|
212
|
+
kind: string;
|
|
213
|
+
runAuthority: TaskCommandRunAuthority;
|
|
214
|
+
bindingDigest: string;
|
|
215
|
+
requestId: string;
|
|
216
|
+
grantRequestId: string;
|
|
217
|
+
execution: {
|
|
218
|
+
toolName: string;
|
|
219
|
+
};
|
|
220
|
+
version: number;
|
|
221
|
+
expiresAt: number;
|
|
222
|
+
};
|
|
223
|
+
/** Verify against the native invocation retained at dispatch and the independently pinned platform key. */
|
|
224
|
+
export declare function verifyTaskCommandAnswerRelease(record: TaskCommandAnswerRelease, expected: {
|
|
225
|
+
authority: TaskCommandRunAuthority;
|
|
226
|
+
daemonId: string;
|
|
227
|
+
requestId: string;
|
|
228
|
+
toolUseId: string;
|
|
229
|
+
}, keyset: ApprovalKeyset, now?: number): boolean;
|
|
169
230
|
/** Server side: mint and sign a v2 attestation after a person approved THIS call. */
|
|
170
231
|
export declare function signToolApproval(args: {
|
|
171
232
|
toolUseId: string;
|
|
@@ -281,3 +342,4 @@ export type ApprovalKeysetPinState = {
|
|
|
281
342
|
export declare function verifyToolApprovalAttestation(approval: unknown, call: SignedToolApprovalCall, pin: ApprovalKeysetPinState): SignedToolApprovalVerdict & {
|
|
282
343
|
signed?: boolean;
|
|
283
344
|
};
|
|
345
|
+
export {};
|
|
@@ -264,6 +264,57 @@ export function verifyApprovalKeysetDocument(doc, trust) {
|
|
|
264
264
|
}
|
|
265
265
|
return { ok: true, keyset, text, change: 'rotated' };
|
|
266
266
|
}
|
|
267
|
+
/** Derived independently from the one server-authorized native start on each side of the transport. */
|
|
268
|
+
export function ordinaryTaskCommandAuthorityFromRequest(request) {
|
|
269
|
+
if (!request || typeof request !== 'object')
|
|
270
|
+
return null;
|
|
271
|
+
const { sessionId, requestId, managedAttempt: start, ordinaryTaskExecutor: source, taskCheckoutAnswer: answer, expectedTaskWorkspacePlacementDigest } = request;
|
|
272
|
+
const id = (value) => typeof value === 'string' && value.length > 0 && value.length <= 160;
|
|
273
|
+
if (source?.version !== 1 || answer?.version !== 1 || answer.decision !== 'allow_once' ||
|
|
274
|
+
!id(sessionId) || !id(requestId) || source.sessionId !== sessionId || source.requestId !== requestId ||
|
|
275
|
+
!/^[a-f0-9]{24}$/.test(source.runDocumentId) || !id(source.dispatchId) || !id(source.daemonId) ||
|
|
276
|
+
!start || start.executor?.id !== source.daemonId || start.executor.targetId !== source.daemonId ||
|
|
277
|
+
!id(start.executor.incarnation) || !id(start.tenantId) || !id(start.runId) || !id(start.attemptId) ||
|
|
278
|
+
!id(start.operationId) || !Number.isSafeInteger(start.controlGeneration) || start.controlGeneration < 0 ||
|
|
279
|
+
!/^[a-f0-9]{64}$/.test(answer.workspaceStateDigest) || !/^[a-f0-9]{64}$/.test(answer.placementDigest) ||
|
|
280
|
+
answer.placementDigest !== expectedTaskWorkspacePlacementDigest ||
|
|
281
|
+
!id(answer.sourceRunId) || !id(answer.sourceAttemptId))
|
|
282
|
+
return null;
|
|
283
|
+
return Object.freeze({
|
|
284
|
+
version: 1, kind: 'ordinary_task', sourceDocumentId: source.runDocumentId,
|
|
285
|
+
tenantId: start.tenantId, runId: start.runId, attemptId: start.attemptId, operationId: start.operationId,
|
|
286
|
+
controlGeneration: start.controlGeneration, sessionId, nativeRequestId: requestId,
|
|
287
|
+
nativeDispatchId: source.dispatchId, daemonId: source.daemonId, daemonIncarnation: start.executor.incarnation,
|
|
288
|
+
resumedFromRunId: answer.sourceRunId, resumedFromAttemptId: answer.sourceAttemptId,
|
|
289
|
+
workspaceStateDigest: answer.workspaceStateDigest,
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
export function taskCommandAnswerReleaseSigningInput(record) {
|
|
293
|
+
return {
|
|
294
|
+
kind: 'task_command_answer_release',
|
|
295
|
+
runAuthority: record.binding.runAuthority,
|
|
296
|
+
bindingDigest: record.bindingDigest,
|
|
297
|
+
requestId: record.requestId,
|
|
298
|
+
grantRequestId: record.grantRequestId,
|
|
299
|
+
execution: record.execution,
|
|
300
|
+
version: record.version,
|
|
301
|
+
expiresAt: record.expiresAt,
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
/** Verify against the native invocation retained at dispatch and the independently pinned platform key. */
|
|
305
|
+
export function verifyTaskCommandAnswerRelease(record, expected, keyset, now = Date.now()) {
|
|
306
|
+
if (record?.state !== 'released' || record.purpose !== 'task-command-once' ||
|
|
307
|
+
!Number.isSafeInteger(record.expiresAt) || record.expiresAt <= now ||
|
|
308
|
+
record.toolUseId !== expected.toolUseId || record.requestId !== expected.requestId ||
|
|
309
|
+
typeof record.execution?.toolName !== 'string' || expected.authority.daemonId !== expected.daemonId ||
|
|
310
|
+
canonicalToolInputDigest(record.binding?.runAuthority) !== canonicalToolInputDigest(expected.authority))
|
|
311
|
+
return false;
|
|
312
|
+
return verifySignedToolApproval(record.signedRelease, {
|
|
313
|
+
toolUseId: expected.toolUseId, toolName: record.execution.toolName,
|
|
314
|
+
toolInput: taskCommandAnswerReleaseSigningInput(record),
|
|
315
|
+
daemonId: expected.daemonId, sessionId: expected.authority.sessionId, now,
|
|
316
|
+
}, keyset).ok;
|
|
317
|
+
}
|
|
267
318
|
/** Server side: mint and sign a v2 attestation after a person approved THIS call. */
|
|
268
319
|
export function signToolApproval(args) {
|
|
269
320
|
const now = args.now ?? Date.now();
|