@skrr-ai/cli 0.1.231 → 0.1.233
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 +42 -4
- package/bin/dev.cjs +4 -1
- package/bin/run.js +0 -15
- package/dist/base-command.d.ts +6 -11
- package/dist/base-command.js +34 -43
- package/dist/commands/agenda/plan.d.ts +2 -1
- package/dist/commands/agenda/plan.js +18 -4
- 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 +4 -0
- package/dist/commands/agents/chat.js +79 -17
- package/dist/commands/agents/eval/list.d.ts +4 -0
- package/dist/commands/agents/eval/list.js +33 -0
- 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/agents/permissions/policy.js +25 -2
- package/dist/commands/agents/spawn.js +61 -24
- package/dist/commands/agents/triggers/fire.js +1 -1
- package/dist/commands/agents/triggers/runs.js +3 -0
- 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/approve.d.ts +1 -11
- package/dist/commands/code/jobs/approve.js +3 -15
- package/dist/commands/code/jobs/cancel.js +3 -2
- package/dist/commands/code/jobs/index.js +1 -1
- package/dist/commands/code/jobs/list.js +4 -11
- package/dist/commands/code/jobs/run.js +13 -7
- package/dist/commands/code/jobs/show.js +52 -6
- package/dist/commands/code/run.js +1 -1
- package/dist/commands/commands.d.ts +1 -0
- package/dist/commands/commands.js +5 -1
- package/dist/commands/context.d.ts +1 -0
- package/dist/commands/context.js +1 -0
- package/dist/commands/duties/catalog/add.d.ts +18 -0
- package/dist/commands/duties/catalog/add.js +52 -0
- package/dist/commands/duties/catalog/index.d.ts +18 -0
- package/dist/commands/duties/catalog/index.js +88 -0
- package/dist/commands/duties/receipt.js +56 -1
- package/dist/commands/goals/plan-now.d.ts +5 -3
- package/dist/commands/goals/plan-now.js +21 -16
- package/dist/commands/goals/planner-compare.js +5 -3
- package/dist/commands/instructions/discovery.d.ts +10 -0
- package/dist/commands/instructions/discovery.js +74 -0
- package/dist/commands/runs/admission.d.ts +12 -0
- package/dist/commands/runs/admission.js +66 -0
- package/dist/commands/runs/events.d.ts +16 -0
- package/dist/commands/runs/events.js +89 -0
- package/dist/commands/runs/list.d.ts +27 -0
- package/dist/commands/runs/list.js +151 -0
- package/dist/commands/runs/show.d.ts +14 -0
- package/dist/commands/runs/show.js +273 -0
- package/dist/commands/runs/stop.d.ts +15 -0
- package/dist/commands/runs/stop.js +105 -0
- package/dist/commands/runs/transcript.d.ts +19 -0
- package/dist/commands/runs/transcript.js +178 -0
- package/dist/commands/tasks/attachments/download.d.ts +1 -0
- package/dist/commands/tasks/attachments/download.js +6 -4
- package/dist/commands/tasks/attachments/source.d.ts +6 -0
- package/dist/commands/tasks/attachments/source.js +18 -0
- package/dist/commands/tasks/chat/exchange.d.ts +0 -14
- package/dist/commands/tasks/chat/exchange.js +8 -39
- package/dist/commands/tasks/chat/reply-run.d.ts +15 -0
- package/dist/commands/tasks/chat/reply-run.js +69 -0
- package/dist/commands/tasks/complete.js +1 -1
- package/dist/commands/tasks/lifecycle/transition.d.ts +1 -0
- package/dist/commands/tasks/lifecycle/transition.js +51 -13
- package/dist/commands/tasks/operations/show.js +5 -0
- package/dist/commands/tasks/result/submit.js +4 -2
- package/dist/commands/tasks/retry.js +25 -16
- 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/commands/triggers/audit.js +3 -1
- package/dist/commands/triggers/fire-detail.js +4 -1
- package/dist/commands/triggers/fire.js +1 -1
- package/dist/commands/usage.d.ts +1 -0
- package/dist/commands/usage.js +1 -0
- package/dist/generated/agent-guides.json +350 -777
- package/dist/help.d.ts +2 -7
- package/dist/help.js +13 -7
- package/dist/hooks/init.js +10 -0
- package/dist/lib/agent-chat-queue.d.ts +2 -1
- package/dist/lib/agent-chat-queue.js +26 -21
- package/dist/lib/agent-evals.d.ts +1 -1
- package/dist/lib/agent-evals.js +13 -3
- package/dist/lib/agent-guides.d.ts +3 -5
- package/dist/lib/agent-guides.js +12 -13
- package/dist/lib/agent-runs.d.ts +101 -0
- package/dist/lib/agent-runs.js +350 -0
- package/dist/lib/agentic-stream.d.ts +13 -1
- package/dist/lib/agentic-stream.js +165 -81
- package/dist/lib/api-fetch.d.ts +4 -2
- package/dist/lib/api-fetch.js +11 -5
- package/dist/lib/code-handover.d.ts +2 -3
- package/dist/lib/code-handover.js +4 -6
- package/dist/lib/command-manifest.d.ts +1 -6
- package/dist/lib/command-manifest.js +86 -13
- package/dist/lib/communication-history.d.ts +27 -0
- package/dist/lib/communication-history.js +45 -0
- package/dist/lib/config.d.ts +2 -3
- package/dist/lib/config.js +2 -3
- package/dist/lib/duties.d.ts +5 -1
- package/dist/lib/duties.js +4 -0
- package/dist/lib/execution-history.d.ts +34 -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/format.d.ts +1 -0
- package/dist/lib/format.js +18 -0
- package/dist/lib/guide-pointer.d.ts +5 -1
- package/dist/lib/guide-pointer.js +21 -2
- package/dist/lib/hosted-job-status.d.ts +4 -0
- package/dist/lib/hosted-job-status.js +19 -0
- package/dist/lib/inbound-messages.d.ts +2 -0
- package/dist/lib/inbound-messages.js +5 -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/roles.d.ts +2 -2
- package/dist/lib/schedule.d.ts +4 -0
- package/dist/lib/schedule.js +4 -3
- package/dist/lib/task-agent-run.d.ts +4 -0
- package/dist/lib/task-agent-run.js +15 -0
- package/dist/lib/task-execution.d.ts +1 -1
- package/dist/lib/task-execution.js +3 -19
- package/dist/lib/task-extras.d.ts +11 -1
- package/dist/lib/task-extras.js +15 -1
- package/dist/lib/task-transcript.js +3 -8
- package/dist/lib/triggers.d.ts +5 -36
- package/dist/lib/triggers.js +48 -33
- 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 +40 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessCommand.d.ts +37 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessCommand.js +59 -0
- 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 +34 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessCommand.d.ts +37 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessCommand.js +57 -0
- 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/auth-core/package.json +10 -0
- package/dist/node_modules/@skrr-ai/data-provider/index.js +12259 -12160
- package/docs/v1/quickstart.md +18 -0
- package/oclif.manifest.json +3405 -2112
- package/package.json +6 -2
- package/skills/skrr/SKILL.md +14 -0
- package/dist/commands/triggers/runs.d.ts +0 -22
- package/dist/commands/triggers/runs.js +0 -58
|
@@ -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
|
// ---------------------------------------------------------------------------
|
|
@@ -153,7 +162,7 @@ const RPC_ENVELOPE = [
|
|
|
153
162
|
delivery: 'acked',
|
|
154
163
|
answeredBy: 'rpc:response',
|
|
155
164
|
}),
|
|
156
|
-
entry('rpc:response', 'bidirectional', 'The answer to `rpc:request`, `{id, ok, result | error}`.'),
|
|
165
|
+
entry('rpc:response', 'bidirectional', 'The answer to `rpc:request`, `{id, ok, result | error}`. A bound local proposal may send progress with `progress: true` before its final answer.'),
|
|
157
166
|
toServer('rpc:cancel', 'Abandon an in-flight `rpc:request` by id.', {
|
|
158
167
|
dormant: 'The API handles it (`websocket/rpc.js`); no daemon sends it, and a daemon-side call is bounded by its own timeout instead.',
|
|
159
168
|
}),
|
|
@@ -214,7 +223,23 @@ 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 }),
|
|
239
|
+
toDaemon('daemon.inference.stopProposal', 'Stop the exact bounded, no-tool proposal Attempt; acknowledgement is separate from its native terminal evidence.', {
|
|
240
|
+
delivery: 'acked',
|
|
241
|
+
carriers: RPC,
|
|
242
|
+
}),
|
|
218
243
|
toDaemon('daemon.session.spawn', 'Start a daemon session under the daemon-session registry.', {
|
|
219
244
|
delivery: 'acked',
|
|
220
245
|
carriers: RPC,
|
|
@@ -391,7 +416,7 @@ const LOCAL_SESSION = [
|
|
|
391
416
|
stability: 'experimental',
|
|
392
417
|
capability: 'local_session_claude_native_turn_v1',
|
|
393
418
|
}),
|
|
394
|
-
toDaemon('daemon:local-session-stop:v1', 'Ask the running native turn this daemon claimed to stop.
|
|
419
|
+
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
420
|
delivery: 'acked',
|
|
396
421
|
carriers: RPC,
|
|
397
422
|
stability: 'experimental',
|
|
@@ -409,7 +434,13 @@ const LOCAL_SESSION = [
|
|
|
409
434
|
stability: 'experimental',
|
|
410
435
|
capability: 'local_session_fork_v1',
|
|
411
436
|
}),
|
|
412
|
-
toDaemon(
|
|
437
|
+
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.', {
|
|
438
|
+
delivery: 'acked',
|
|
439
|
+
carriers: RPC,
|
|
440
|
+
stability: 'experimental',
|
|
441
|
+
capability: 'local_session_pending_start_v1',
|
|
442
|
+
}),
|
|
443
|
+
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
444
|
delivery: 'acked',
|
|
414
445
|
carriers: RPC,
|
|
415
446
|
stability: 'experimental',
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A slash command the person typed, carried to the harness as itself (OSK-33999).
|
|
3
|
+
*
|
|
4
|
+
* A daemon turn's prompt is never the person's words alone. The server puts its lookback facts
|
|
5
|
+
* and the owner communication block in front of them, and the daemon puts the turn's `## This
|
|
6
|
+
* Turn` context in front of that. Codex reads a command only from a message that starts with `/`
|
|
7
|
+
* and has no line break, and Claude Code only from a message that is the command, so no command a
|
|
8
|
+
* person typed in the app (`/compact`, `/review`, `/goal …`) ever ran as one: each reached the
|
|
9
|
+
* model as text.
|
|
10
|
+
*
|
|
11
|
+
* So the server sends the command beside the prompt, as `harnessCommand`, read from the person's
|
|
12
|
+
* own words before any context was added, and only to a daemon announcing
|
|
13
|
+
* `HARNESS_COMMAND_CAPABILITY`. That daemon hands the harness the command text alone, with no
|
|
14
|
+
* context in front of it, so the harness's own command parser sees exactly what was typed. Which
|
|
15
|
+
* commands exist is the harness's business; this module only carries one.
|
|
16
|
+
*
|
|
17
|
+
* Shared by the API (which writes the field and re-reads it at dispatch) and the daemon (which
|
|
18
|
+
* reads it), so both read the same shape.
|
|
19
|
+
*/
|
|
20
|
+
/** A daemon that announces this reads `harnessCommand` on a session request and runs it. */
|
|
21
|
+
export declare const HARNESS_COMMAND_CAPABILITY = "session_harness_command_v1";
|
|
22
|
+
/** The longest command text carried: a `/goal` objective is the long one (4,000 characters). */
|
|
23
|
+
export declare const HARNESS_COMMAND_MAX_CHARS = 4200;
|
|
24
|
+
export interface HarnessCommandV1 {
|
|
25
|
+
version: 1;
|
|
26
|
+
/** The command's name, without the `/`. */
|
|
27
|
+
name: string;
|
|
28
|
+
/** What the person typed, trimmed: `/` + name, then any arguments. */
|
|
29
|
+
text: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A strict read of the wire field. Anything it does not understand is no command at all, and the
|
|
33
|
+
* turn then runs as an ordinary message: that is what it did before this field existed.
|
|
34
|
+
*/
|
|
35
|
+
export declare function readHarnessCommand(value: unknown): HarnessCommandV1 | null;
|
|
36
|
+
/** The command's arguments: what follows the name, trimmed. Empty when there are none. */
|
|
37
|
+
export declare function harnessCommandArgs(command: Pick<HarnessCommandV1, 'name' | 'text'>): string;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A slash command the person typed, carried to the harness as itself (OSK-33999).
|
|
3
|
+
*
|
|
4
|
+
* A daemon turn's prompt is never the person's words alone. The server puts its lookback facts
|
|
5
|
+
* and the owner communication block in front of them, and the daemon puts the turn's `## This
|
|
6
|
+
* Turn` context in front of that. Codex reads a command only from a message that starts with `/`
|
|
7
|
+
* and has no line break, and Claude Code only from a message that is the command, so no command a
|
|
8
|
+
* person typed in the app (`/compact`, `/review`, `/goal …`) ever ran as one: each reached the
|
|
9
|
+
* model as text.
|
|
10
|
+
*
|
|
11
|
+
* So the server sends the command beside the prompt, as `harnessCommand`, read from the person's
|
|
12
|
+
* own words before any context was added, and only to a daemon announcing
|
|
13
|
+
* `HARNESS_COMMAND_CAPABILITY`. That daemon hands the harness the command text alone, with no
|
|
14
|
+
* context in front of it, so the harness's own command parser sees exactly what was typed. Which
|
|
15
|
+
* commands exist is the harness's business; this module only carries one.
|
|
16
|
+
*
|
|
17
|
+
* Shared by the API (which writes the field and re-reads it at dispatch) and the daemon (which
|
|
18
|
+
* reads it), so both read the same shape.
|
|
19
|
+
*/
|
|
20
|
+
/** A daemon that announces this reads `harnessCommand` on a session request and runs it. */
|
|
21
|
+
export const HARNESS_COMMAND_CAPABILITY = 'session_harness_command_v1';
|
|
22
|
+
/** The longest command text carried: a `/goal` objective is the long one (4,000 characters). */
|
|
23
|
+
export const HARNESS_COMMAND_MAX_CHARS = 4_200;
|
|
24
|
+
/**
|
|
25
|
+
* A command name: what follows the `/`, as the harnesses spell theirs (`compact`, `skill:x`,
|
|
26
|
+
* `plugin:command`). The server's reader (`forwardedSlashCommand.js`) accepts the same characters.
|
|
27
|
+
*/
|
|
28
|
+
const COMMAND_NAME = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/;
|
|
29
|
+
/**
|
|
30
|
+
* A strict read of the wire field. Anything it does not understand is no command at all, and the
|
|
31
|
+
* turn then runs as an ordinary message: that is what it did before this field existed.
|
|
32
|
+
*/
|
|
33
|
+
export function readHarnessCommand(value) {
|
|
34
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
35
|
+
return null;
|
|
36
|
+
const record = value;
|
|
37
|
+
if (Object.keys(record).some((key) => key !== 'version' && key !== 'name' && key !== 'text')) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const { version, name, text } = record;
|
|
41
|
+
if (version !== 1 || typeof name !== 'string' || typeof text !== 'string')
|
|
42
|
+
return null;
|
|
43
|
+
if (!COMMAND_NAME.test(name) || text.length > HARNESS_COMMAND_MAX_CHARS)
|
|
44
|
+
return null;
|
|
45
|
+
if (text !== text.trim())
|
|
46
|
+
return null;
|
|
47
|
+
// The text is the command it names: `/name` alone, or followed by whitespace and arguments.
|
|
48
|
+
const head = `/${name}`;
|
|
49
|
+
if (text !== head && !(text.startsWith(head) && /\s/.test(text.charAt(head.length)))) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
return { version: 1, name, text };
|
|
53
|
+
}
|
|
54
|
+
/** The command's arguments: what follows the name, trimmed. Empty when there are none. */
|
|
55
|
+
export function harnessCommandArgs(command) {
|
|
56
|
+
return command.text.slice(command.name.length + 1).trim();
|
|
57
|
+
}
|
|
@@ -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();
|
|
@@ -407,6 +407,16 @@
|
|
|
407
407
|
"default": "./dist/cjs/turnPacing.js"
|
|
408
408
|
}
|
|
409
409
|
},
|
|
410
|
+
"./harness-command": {
|
|
411
|
+
"import": {
|
|
412
|
+
"types": "./dist/esm/harnessCommand.d.ts",
|
|
413
|
+
"default": "./dist/esm/harnessCommand.js"
|
|
414
|
+
},
|
|
415
|
+
"require": {
|
|
416
|
+
"types": "./dist/cjs/harnessCommand.d.ts",
|
|
417
|
+
"default": "./dist/cjs/harnessCommand.js"
|
|
418
|
+
}
|
|
419
|
+
},
|
|
410
420
|
"./person-ask-window": {
|
|
411
421
|
"import": {
|
|
412
422
|
"types": "./dist/esm/personAskWindow.d.ts",
|