@skrr-ai/cli 0.1.22 → 0.1.24
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 +83 -73
- package/bin/dev-fallback.js +221 -0
- package/bin/run.js +96 -0
- package/dist/base-command.d.ts +15 -0
- package/dist/base-command.js +145 -11
- package/dist/commands/agents/attach-harness.d.ts +37 -0
- package/dist/commands/agents/attach-harness.js +102 -3
- package/dist/commands/agents/chat.d.ts +69 -1
- package/dist/commands/agents/chat.js +202 -22
- package/dist/commands/agents/create.d.ts +38 -0
- package/dist/commands/agents/create.js +95 -2
- package/dist/commands/agents/schedule-trace.js +11 -0
- package/dist/commands/agents/show.js +29 -1
- package/dist/commands/api-keys/create.d.ts +24 -0
- package/dist/commands/api-keys/create.js +80 -0
- package/dist/commands/api-keys/list.d.ts +11 -0
- package/dist/commands/api-keys/list.js +42 -0
- package/dist/commands/api-keys/revoke.d.ts +14 -0
- package/dist/commands/api-keys/revoke.js +33 -0
- package/dist/commands/api-keys/rotate.d.ts +19 -0
- package/dist/commands/api-keys/rotate.js +42 -0
- package/dist/commands/balance/index.d.ts +18 -0
- package/dist/commands/balance/index.js +29 -0
- package/dist/commands/balance/show.d.ts +25 -0
- package/dist/commands/balance/show.js +60 -0
- package/dist/commands/balance/statement.d.ts +19 -0
- package/dist/commands/balance/statement.js +52 -0
- package/dist/commands/browser/doctor.d.ts +11 -0
- package/dist/commands/browser/doctor.js +11 -0
- package/dist/commands/code/jobs/approve.d.ts +25 -0
- package/dist/commands/code/jobs/approve.js +52 -0
- package/dist/commands/code/jobs/cancel.d.ts +12 -0
- package/dist/commands/code/jobs/cancel.js +39 -0
- package/dist/commands/code/jobs/index.d.ts +19 -0
- package/dist/commands/code/jobs/index.js +38 -0
- package/dist/commands/code/jobs/list.d.ts +12 -0
- package/dist/commands/code/jobs/list.js +87 -0
- package/dist/commands/code/jobs/run.d.ts +32 -0
- package/dist/commands/code/jobs/run.js +151 -0
- package/dist/commands/code/jobs/show.d.ts +12 -0
- package/dist/commands/code/jobs/show.js +86 -0
- package/dist/commands/commitments/preflight.js +18 -4
- package/dist/commands/commitments/receipt-metrics.d.ts +39 -0
- package/dist/commands/commitments/receipt-metrics.js +78 -0
- package/dist/commands/convos/search.js +5 -5
- package/dist/commands/harnesses/leases/list.d.ts +3 -0
- package/dist/commands/harnesses/leases/list.js +59 -12
- package/dist/commands/harnesses/leases/show.js +36 -0
- package/dist/commands/harnesses/list.d.ts +18 -0
- package/dist/commands/harnesses/list.js +30 -0
- package/dist/commands/harnesses/products.js +49 -3
- package/dist/commands/harnesses/quota.d.ts +16 -0
- package/dist/commands/harnesses/quota.js +26 -1
- package/dist/commands/harnesses/usage.js +17 -0
- package/dist/commands/inbox/index.d.ts +2 -1
- package/dist/commands/inbox/index.js +27 -4
- package/dist/commands/login.js +4 -1
- package/dist/commands/machines/dedicated/create.d.ts +18 -0
- package/dist/commands/machines/dedicated/create.js +90 -0
- package/dist/commands/machines/dedicated/destroy.d.ts +14 -0
- package/dist/commands/machines/dedicated/destroy.js +56 -0
- package/dist/commands/machines/dedicated/grow.d.ts +13 -0
- package/dist/commands/machines/dedicated/grow.js +46 -0
- package/dist/commands/machines/dedicated/health-check.d.ts +12 -0
- package/dist/commands/machines/dedicated/health-check.js +42 -0
- package/dist/commands/machines/dedicated/incident-close.d.ts +12 -0
- package/dist/commands/machines/dedicated/incident-close.js +42 -0
- package/dist/commands/machines/dedicated/index.d.ts +6 -0
- package/dist/commands/machines/dedicated/index.js +39 -0
- package/dist/commands/machines/dedicated/list.d.ts +11 -0
- package/dist/commands/machines/dedicated/list.js +58 -0
- package/dist/commands/machines/dedicated/restart.d.ts +12 -0
- package/dist/commands/machines/dedicated/restart.js +42 -0
- package/dist/commands/machines/dedicated/show.d.ts +12 -0
- package/dist/commands/machines/dedicated/show.js +58 -0
- package/dist/commands/machines/dedicated/snapshot.d.ts +12 -0
- package/dist/commands/machines/dedicated/snapshot.js +42 -0
- package/dist/commands/machines/dedicated/start.d.ts +12 -0
- package/dist/commands/machines/dedicated/start.js +42 -0
- package/dist/commands/machines/dedicated/stop.d.ts +12 -0
- package/dist/commands/machines/dedicated/stop.js +42 -0
- package/dist/commands/machines/hosted/index.js +4 -1
- package/dist/commands/machines/list.d.ts +1 -0
- package/dist/commands/machines/list.js +33 -5
- package/dist/commands/memory/approvals/issue.d.ts +18 -0
- package/dist/commands/memory/approvals/issue.js +63 -0
- package/dist/commands/memory/commit.js +5 -2
- package/dist/commands/memory/context.d.ts +3 -2
- package/dist/commands/memory/context.js +9 -11
- package/dist/commands/memory/delete.d.ts +1 -1
- package/dist/commands/memory/list.d.ts +1 -1
- package/dist/commands/memory/list.js +1 -1
- package/dist/commands/memory/mounts/resolve.d.ts +10 -0
- package/dist/commands/memory/mounts/resolve.js +27 -0
- package/dist/commands/memory/proposals/commit.d.ts +18 -0
- package/dist/commands/memory/proposals/commit.js +32 -0
- package/dist/commands/memory/proposals/create.d.ts +18 -0
- package/dist/commands/memory/proposals/create.js +56 -0
- package/dist/commands/memory/proposals/list.d.ts +13 -0
- package/dist/commands/memory/proposals/list.js +31 -0
- package/dist/commands/memory/proposals/promote.d.ts +22 -0
- package/dist/commands/memory/proposals/promote.js +33 -0
- package/dist/commands/memory/proposals/reject.d.ts +16 -0
- package/dist/commands/memory/proposals/reject.js +28 -0
- package/dist/commands/memory/rebuild-index.d.ts +20 -0
- package/dist/commands/memory/rebuild-index.js +25 -0
- package/dist/commands/memory/save.d.ts +1 -1
- package/dist/commands/memory/save.js +1 -1
- package/dist/commands/memory/search.d.ts +6 -3
- package/dist/commands/memory/search.js +27 -3
- package/dist/commands/memory/show.d.ts +1 -1
- package/dist/commands/memory/stores/archive.d.ts +14 -0
- package/dist/commands/memory/stores/archive.js +31 -0
- package/dist/commands/memory/stores/create.d.ts +12 -0
- package/dist/commands/memory/stores/create.js +30 -0
- package/dist/commands/memory/stores/delete.d.ts +15 -0
- package/dist/commands/memory/stores/delete.js +38 -0
- package/dist/commands/memory/stores/list.d.ts +10 -0
- package/dist/commands/memory/stores/list.js +29 -0
- package/dist/commands/memory/stores/show.d.ts +12 -0
- package/dist/commands/memory/stores/show.js +14 -0
- package/dist/commands/memory/stores/update.d.ts +15 -0
- package/dist/commands/memory/stores/update.js +39 -0
- package/dist/commands/memory/sync/delete.d.ts +13 -0
- package/dist/commands/memory/sync/delete.js +35 -0
- package/dist/commands/memory/sync/pull.d.ts +19 -0
- package/dist/commands/memory/sync/pull.js +52 -0
- package/dist/commands/memory/sync/push.d.ts +18 -0
- package/dist/commands/memory/sync/push.js +115 -0
- package/dist/commands/memory/sync/resolve.d.ts +23 -0
- package/dist/commands/memory/sync/resolve.js +27 -0
- package/dist/commands/memory/sync/status.d.ts +9 -0
- package/dist/commands/memory/sync/status.js +22 -0
- package/dist/commands/memory/topics/archive.d.ts +20 -0
- package/dist/commands/memory/topics/archive.js +29 -0
- package/dist/commands/memory/topics/create.d.ts +23 -0
- package/dist/commands/memory/topics/create.js +46 -0
- package/dist/commands/memory/topics/delete.d.ts +22 -0
- package/dist/commands/memory/topics/delete.js +30 -0
- package/dist/commands/memory/topics/forget.d.ts +22 -0
- package/dist/commands/memory/topics/forget.js +29 -0
- package/dist/commands/memory/topics/list.d.ts +13 -0
- package/dist/commands/memory/topics/list.js +22 -0
- package/dist/commands/memory/topics/move.d.ts +22 -0
- package/dist/commands/memory/topics/move.js +26 -0
- package/dist/commands/memory/topics/show.d.ts +17 -0
- package/dist/commands/memory/topics/show.js +21 -0
- package/dist/commands/memory/topics/update.d.ts +23 -0
- package/dist/commands/memory/topics/update.js +27 -0
- package/dist/commands/memory/tree.d.ts +5 -2
- package/dist/commands/memory/tree.js +20 -2
- package/dist/commands/memory/update.d.ts +1 -1
- package/dist/commands/memory/versions/list.d.ts +16 -0
- package/dist/commands/memory/versions/list.js +22 -0
- package/dist/commands/memory/versions/redact.d.ts +21 -0
- package/dist/commands/memory/versions/redact.js +22 -0
- package/dist/commands/memory/versions/restore.d.ts +20 -0
- package/dist/commands/memory/versions/restore.js +16 -0
- package/dist/commands/memory/versions/show.d.ts +15 -0
- package/dist/commands/memory/versions/show.js +17 -0
- package/dist/commands/messages/list.js +25 -8
- package/dist/commands/messages/show.js +10 -0
- package/dist/commands/spaces/update.js +16 -12
- package/dist/commands/spaces/work-sync/reconcile.d.ts +38 -0
- package/dist/commands/spaces/work-sync/reconcile.js +90 -0
- package/dist/commands/spaces/work-sync/telemetry.d.ts +29 -0
- package/dist/commands/spaces/work-sync/telemetry.js +96 -0
- package/dist/commands/store/install.js +5 -1
- package/dist/commands/store/releases.js +1 -1
- package/dist/commands/store/update.js +5 -1
- package/dist/commands/subscriptions/cancel.js +5 -1
- package/dist/commands/subscriptions/health.js +5 -1
- package/dist/commands/subscriptions/status.js +5 -1
- package/dist/commands/subscriptions/subscribe.js +5 -1
- package/dist/commands/tasks/activity.d.ts +2 -3
- package/dist/commands/tasks/activity.js +20 -6
- package/dist/commands/tasks/complete.d.ts +22 -150
- package/dist/commands/tasks/complete.js +174 -599
- package/dist/commands/tasks/create.d.ts +6 -0
- package/dist/commands/tasks/create.js +114 -4
- package/dist/commands/tasks/deliverable/add.d.ts +8 -0
- package/dist/commands/tasks/deliverable/add.js +62 -11
- package/dist/commands/tasks/deliverable/confirm.d.ts +5 -5
- package/dist/commands/tasks/deliverable/confirm.js +9 -18
- package/dist/commands/tasks/deliverable/list.d.ts +12 -0
- package/dist/commands/tasks/deliverable/list.js +58 -0
- package/dist/commands/tasks/events/append.d.ts +2 -0
- package/dist/commands/tasks/events/append.js +41 -6
- package/dist/commands/tasks/events/list.d.ts +1 -0
- package/dist/commands/tasks/events/list.js +1 -0
- package/dist/commands/tasks/events/tail.d.ts +1 -0
- package/dist/commands/tasks/events/tail.js +1 -0
- package/dist/commands/tasks/expectations/assess.d.ts +21 -0
- package/dist/commands/tasks/expectations/assess.js +103 -0
- package/dist/commands/tasks/expectations.js +121 -25
- package/dist/commands/tasks/judge.d.ts +1 -0
- package/dist/commands/tasks/judge.js +2 -1
- package/dist/commands/tasks/output.d.ts +1 -11
- package/dist/commands/tasks/output.js +80 -141
- package/dist/commands/tasks/report.d.ts +3 -3
- package/dist/commands/tasks/report.js +66 -41
- package/dist/commands/tasks/resource/add.d.ts +23 -0
- package/dist/commands/tasks/resource/add.js +76 -0
- package/dist/commands/tasks/resource/list.d.ts +13 -0
- package/dist/commands/tasks/resource/list.js +41 -0
- package/dist/commands/tasks/result/show.d.ts +13 -0
- package/dist/commands/tasks/result/show.js +64 -0
- package/dist/commands/tasks/result/submit.d.ts +26 -0
- package/dist/commands/tasks/result/submit.js +134 -0
- package/dist/commands/tasks/resume/save.d.ts +16 -0
- package/dist/commands/tasks/resume/save.js +69 -0
- package/dist/commands/tasks/resume/show.d.ts +13 -0
- package/dist/commands/tasks/resume/show.js +35 -0
- package/dist/commands/tasks/review.d.ts +17 -0
- package/dist/commands/tasks/review.js +54 -0
- package/dist/commands/tasks/runs.js +5 -0
- package/dist/commands/tasks/self-schedule.js +7 -4
- package/dist/commands/tasks/show.js +19 -0
- package/dist/commands/tasks/timeline.d.ts +2 -2
- package/dist/commands/tasks/timeline.js +19 -24
- package/dist/commands/tasks/updates/add.d.ts +22 -0
- package/dist/commands/tasks/updates/add.js +122 -0
- package/dist/commands/tasks/updates/list.d.ts +15 -0
- package/dist/commands/tasks/updates/list.js +57 -0
- package/dist/commands/tasks/waive.d.ts +1 -0
- package/dist/commands/tasks/waive.js +2 -1
- package/dist/lib/agentic-stream.d.ts +257 -0
- package/dist/lib/agentic-stream.js +490 -33
- package/dist/lib/balance.d.ts +8 -0
- package/dist/lib/commitment-product.d.ts +10 -1
- package/dist/lib/commitment-product.js +66 -2
- package/dist/lib/commitments.d.ts +2 -1
- package/dist/lib/commitments.js +1 -0
- package/dist/lib/conversation-search.d.ts +3 -0
- package/dist/lib/conversation-search.js +75 -0
- package/dist/lib/dedicated-machines.d.ts +66 -0
- package/dist/lib/dedicated-machines.js +161 -0
- package/dist/lib/execution-target.d.ts +21 -0
- package/dist/lib/execution-target.js +22 -6
- package/dist/lib/harnesses.d.ts +87 -6
- package/dist/lib/harnesses.js +32 -1
- package/dist/lib/hosted-machines.js +9 -0
- package/dist/lib/inbox.d.ts +2 -1
- package/dist/lib/machines.d.ts +17 -0
- package/dist/lib/machines.js +29 -0
- package/dist/lib/managed-agent-keys.d.ts +104 -0
- package/dist/lib/managed-agent-keys.js +50 -0
- package/dist/lib/memory-scope.d.ts +4 -3
- package/dist/lib/memory-scope.js +9 -9
- package/dist/lib/memory-sync.d.ts +114 -0
- package/dist/lib/memory-sync.js +730 -0
- package/dist/lib/message-provenance.d.ts +42 -0
- package/dist/lib/message-provenance.js +89 -0
- package/dist/lib/scoped-memory-command.d.ts +68 -0
- package/dist/lib/scoped-memory-command.js +183 -0
- package/dist/lib/session-task-endpoints.d.ts +1 -1
- package/dist/lib/session-task-endpoints.js +7 -0
- package/dist/lib/sky-code-broker.d.ts +47 -0
- package/dist/lib/sky-code-broker.js +50 -0
- package/dist/lib/sky-code-doctor.js +10 -1
- package/dist/lib/task-artifact-flags.d.ts +2 -0
- package/dist/lib/task-artifact-flags.js +7 -0
- package/dist/lib/task-execution.d.ts +4 -5
- package/dist/lib/task-execution.js +4 -5
- package/dist/lib/task-extras.d.ts +1 -5
- package/dist/lib/task-extras.js +1 -5
- package/dist/lib/task-legacy.d.ts +24 -0
- package/dist/lib/task-legacy.js +48 -0
- package/dist/lib/task-transcript.d.ts +5 -7
- package/dist/lib/task-transcript.js +8 -16
- package/dist/lib/tasks.d.ts +39 -21
- package/dist/lib/tasks.js +64 -21
- package/dist/lib/triggers.d.ts +39 -1
- package/dist/lib/triggers.js +70 -2
- package/dist/lib/usage-discovery.d.ts +17 -1
- package/dist/lib/usage-discovery.js +17 -1
- package/dist/lib/work-sync.d.ts +70 -0
- package/dist/lib/work-sync.js +29 -0
- package/dist/node_modules/@skrr-ai/data-provider/index.js +3760 -3621
- package/oclif.manifest.json +14653 -7813
- package/package.json +26 -5
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WHAT ASKED FOR THIS MESSAGE.
|
|
3
|
+
*
|
|
4
|
+
* OSK-7682/OSK-7708 — an unattended run's answer lands in the agent's
|
|
5
|
+
* conversation with nothing preceding it. The Conversation entry point
|
|
6
|
+
* persists the user's prompt as a message and the Task entry point persists
|
|
7
|
+
* the brief; the Autonomous entry point is session-detached by design and
|
|
8
|
+
* writes only the answer. Read cold, the thread shows five replies and zero
|
|
9
|
+
* questions, and there is no path from the mystery message to its cause.
|
|
10
|
+
*
|
|
11
|
+
* The server now carries the run's prompt on the ONE row the delivery already
|
|
12
|
+
* writes (`metadata.proactiveDelivery`). This reads it back. Everything here is
|
|
13
|
+
* defensive: an older row has no such metadata, and a newer server may add
|
|
14
|
+
* fields this build has never heard of.
|
|
15
|
+
*/
|
|
16
|
+
export interface DeliveryPrompt {
|
|
17
|
+
text: string;
|
|
18
|
+
truncated: boolean;
|
|
19
|
+
originalLength: number;
|
|
20
|
+
}
|
|
21
|
+
export interface MessageProvenance {
|
|
22
|
+
/** How this message came to exist, in one word, for a ROLE column. */
|
|
23
|
+
kind: 'scheduled' | 'heartbeat' | 'proactive';
|
|
24
|
+
triggerId?: string;
|
|
25
|
+
occurrenceId?: string;
|
|
26
|
+
jobId?: string;
|
|
27
|
+
reason?: string;
|
|
28
|
+
prompt?: DeliveryPrompt;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @returns the provenance of an unattended delivery, or null for an ordinary
|
|
32
|
+
* interactive message (which needs no attribution — its question is the row
|
|
33
|
+
* above it).
|
|
34
|
+
*/
|
|
35
|
+
export declare function messageProvenance(message: unknown): MessageProvenance | null;
|
|
36
|
+
/** One-line attribution for a listing row. */
|
|
37
|
+
export declare function provenanceLabel(provenance: MessageProvenance): string;
|
|
38
|
+
/**
|
|
39
|
+
* The block `messages show` prints above the answer, so the reader learns what
|
|
40
|
+
* was asked before reading what came back.
|
|
41
|
+
*/
|
|
42
|
+
export declare function provenanceLines(provenance: MessageProvenance): string[];
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* WHAT ASKED FOR THIS MESSAGE.
|
|
4
|
+
*
|
|
5
|
+
* OSK-7682/OSK-7708 — an unattended run's answer lands in the agent's
|
|
6
|
+
* conversation with nothing preceding it. The Conversation entry point
|
|
7
|
+
* persists the user's prompt as a message and the Task entry point persists
|
|
8
|
+
* the brief; the Autonomous entry point is session-detached by design and
|
|
9
|
+
* writes only the answer. Read cold, the thread shows five replies and zero
|
|
10
|
+
* questions, and there is no path from the mystery message to its cause.
|
|
11
|
+
*
|
|
12
|
+
* The server now carries the run's prompt on the ONE row the delivery already
|
|
13
|
+
* writes (`metadata.proactiveDelivery`). This reads it back. Everything here is
|
|
14
|
+
* defensive: an older row has no such metadata, and a newer server may add
|
|
15
|
+
* fields this build has never heard of.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.messageProvenance = messageProvenance;
|
|
19
|
+
exports.provenanceLabel = provenanceLabel;
|
|
20
|
+
exports.provenanceLines = provenanceLines;
|
|
21
|
+
function record(value) {
|
|
22
|
+
return value && typeof value === 'object' && !Array.isArray(value)
|
|
23
|
+
? value
|
|
24
|
+
: null;
|
|
25
|
+
}
|
|
26
|
+
function str(value) {
|
|
27
|
+
return typeof value === 'string' && value.trim() ? value : undefined;
|
|
28
|
+
}
|
|
29
|
+
function readPrompt(value) {
|
|
30
|
+
const raw = record(value);
|
|
31
|
+
const text = str(raw?.text);
|
|
32
|
+
if (!text)
|
|
33
|
+
return undefined;
|
|
34
|
+
const originalLength = Number(raw?.originalLength);
|
|
35
|
+
return {
|
|
36
|
+
text,
|
|
37
|
+
truncated: raw?.truncated === true,
|
|
38
|
+
originalLength: Number.isFinite(originalLength) ? originalLength : text.length,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @returns the provenance of an unattended delivery, or null for an ordinary
|
|
43
|
+
* interactive message (which needs no attribution — its question is the row
|
|
44
|
+
* above it).
|
|
45
|
+
*/
|
|
46
|
+
function messageProvenance(message) {
|
|
47
|
+
const delivery = record(record(record(message)?.metadata)?.proactiveDelivery);
|
|
48
|
+
if (!delivery)
|
|
49
|
+
return null;
|
|
50
|
+
const triggerId = str(delivery.triggerId);
|
|
51
|
+
return {
|
|
52
|
+
kind: delivery.isHeartbeat === true ? 'heartbeat' : triggerId ? 'scheduled' : 'proactive',
|
|
53
|
+
triggerId,
|
|
54
|
+
occurrenceId: str(delivery.occurrenceId),
|
|
55
|
+
jobId: str(delivery.jobId),
|
|
56
|
+
reason: str(delivery.reason),
|
|
57
|
+
prompt: readPrompt(delivery.prompt),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/** One-line attribution for a listing row. */
|
|
61
|
+
function provenanceLabel(provenance) {
|
|
62
|
+
return provenance.kind;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The block `messages show` prints above the answer, so the reader learns what
|
|
66
|
+
* was asked before reading what came back.
|
|
67
|
+
*/
|
|
68
|
+
function provenanceLines(provenance) {
|
|
69
|
+
const lines = [];
|
|
70
|
+
lines.push(`Asked by: ${provenance.kind} run`);
|
|
71
|
+
if (provenance.triggerId)
|
|
72
|
+
lines.push(`Trigger: ${provenance.triggerId}`);
|
|
73
|
+
if (provenance.occurrenceId)
|
|
74
|
+
lines.push(`Occurrence: ${provenance.occurrenceId}`);
|
|
75
|
+
if (provenance.jobId)
|
|
76
|
+
lines.push(`Job: ${provenance.jobId}`);
|
|
77
|
+
if (provenance.reason)
|
|
78
|
+
lines.push(`Reason: ${provenance.reason}`);
|
|
79
|
+
if (provenance.prompt) {
|
|
80
|
+
lines.push('');
|
|
81
|
+
lines.push('Prompt:');
|
|
82
|
+
lines.push(provenance.prompt.text);
|
|
83
|
+
if (provenance.prompt.truncated) {
|
|
84
|
+
// Never let a preview read as the whole instruction.
|
|
85
|
+
lines.push(`(preview of ${provenance.prompt.originalLength} characters — the whole prompt is on the fire record: skrr agents schedule-overview <agent-id>)`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return lines;
|
|
89
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type MemoryMount as SharedMemoryMount, type MemoryStore as SharedMemoryStore } from '@skrr-ai/data-schemas';
|
|
2
|
+
import { BaseCommand } from '../base-command';
|
|
3
|
+
import { ApiFetchError, type ApiFetchOptions } from './api-fetch';
|
|
4
|
+
export type MemoryMount = SharedMemoryMount;
|
|
5
|
+
export type MemoryStore = SharedMemoryStore & {
|
|
6
|
+
mount?: SharedMemoryMount;
|
|
7
|
+
};
|
|
8
|
+
export declare const scopedMemoryFlags: {
|
|
9
|
+
agent: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
space: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
store: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
+
scope: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
};
|
|
15
|
+
export declare const mutationFlags: {
|
|
16
|
+
'authorization-generation': import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
17
|
+
'expected-version': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
18
|
+
'idempotency-key': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
19
|
+
'privacy-approval': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
20
|
+
'dry-run': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
21
|
+
agent: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
22
|
+
space: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
23
|
+
store: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
24
|
+
scope: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
25
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
26
|
+
};
|
|
27
|
+
export declare const versionedMutationFlags: {
|
|
28
|
+
'expected-version': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
29
|
+
'authorization-generation': import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
30
|
+
'idempotency-key': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
31
|
+
'privacy-approval': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
32
|
+
'dry-run': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
33
|
+
agent: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
34
|
+
space: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
35
|
+
store: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
36
|
+
scope: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
37
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
38
|
+
};
|
|
39
|
+
type ScopedFlags = {
|
|
40
|
+
agent: string;
|
|
41
|
+
space?: string;
|
|
42
|
+
store?: string;
|
|
43
|
+
scope?: string;
|
|
44
|
+
json?: boolean;
|
|
45
|
+
'authorization-generation'?: number;
|
|
46
|
+
'expected-version'?: string;
|
|
47
|
+
'idempotency-key'?: string;
|
|
48
|
+
'privacy-approval'?: string;
|
|
49
|
+
'consent-approval'?: string;
|
|
50
|
+
'dry-run'?: boolean;
|
|
51
|
+
};
|
|
52
|
+
export declare function parseMemoryApiError(error: ApiFetchError): {
|
|
53
|
+
code: string;
|
|
54
|
+
message: string;
|
|
55
|
+
retryable: boolean;
|
|
56
|
+
details?: Record<string, unknown>;
|
|
57
|
+
};
|
|
58
|
+
export declare abstract class ScopedMemoryCommand extends BaseCommand {
|
|
59
|
+
protected endpoint(agentId: string, suffix?: string): string;
|
|
60
|
+
protected memoryApi<T>(agentId: string, suffix: string, options?: ApiFetchOptions): Promise<T>;
|
|
61
|
+
protected query(flags: ScopedFlags, extra?: Record<string, unknown>): string;
|
|
62
|
+
protected resolveStore(flags: ScopedFlags, { write }?: {
|
|
63
|
+
write?: boolean | undefined;
|
|
64
|
+
}): Promise<MemoryStore>;
|
|
65
|
+
protected mutation(operation: string, flags: ScopedFlags, input: Record<string, unknown>): Promise<unknown>;
|
|
66
|
+
protected print(value: unknown, json: boolean | undefined, line: string): void;
|
|
67
|
+
}
|
|
68
|
+
export {};
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ScopedMemoryCommand = exports.versionedMutationFlags = exports.mutationFlags = exports.scopedMemoryFlags = void 0;
|
|
4
|
+
exports.parseMemoryApiError = parseMemoryApiError;
|
|
5
|
+
const core_1 = require("@oclif/core");
|
|
6
|
+
const data_schemas_1 = require("@skrr-ai/data-schemas");
|
|
7
|
+
const node_crypto_1 = require("node:crypto");
|
|
8
|
+
const base_command_1 = require("../base-command");
|
|
9
|
+
const api_fetch_1 = require("./api-fetch");
|
|
10
|
+
exports.scopedMemoryFlags = {
|
|
11
|
+
agent: core_1.Flags.string({ description: 'Act through this Agent', required: true }),
|
|
12
|
+
space: core_1.Flags.string({ description: 'Current Space context (required for Space scopes)' }),
|
|
13
|
+
store: core_1.Flags.string({
|
|
14
|
+
description: 'Exact Memory Store ID (exactly one of --store or --scope is required)',
|
|
15
|
+
exactlyOne: ['store', 'scope'],
|
|
16
|
+
}),
|
|
17
|
+
scope: core_1.Flags.string({
|
|
18
|
+
description: 'Store owner scope: agent:<id> or space:<id> (exactly one of --store or --scope is required)',
|
|
19
|
+
exactlyOne: ['store', 'scope'],
|
|
20
|
+
}),
|
|
21
|
+
json: core_1.Flags.boolean({ description: 'Output stable JSON' }),
|
|
22
|
+
};
|
|
23
|
+
exports.mutationFlags = {
|
|
24
|
+
...exports.scopedMemoryFlags,
|
|
25
|
+
'authorization-generation': core_1.Flags.integer({
|
|
26
|
+
description: 'Expected Store authorization generation (defaults to mounted value)',
|
|
27
|
+
}),
|
|
28
|
+
'expected-version': core_1.Flags.string({ description: 'Expected current MemoryVersion ID' }),
|
|
29
|
+
'idempotency-key': core_1.Flags.string({ description: 'Stable retry key for this mutation' }),
|
|
30
|
+
'privacy-approval': core_1.Flags.string({
|
|
31
|
+
description: 'One-time Space PII approval ID from `memory approvals issue`',
|
|
32
|
+
}),
|
|
33
|
+
'dry-run': core_1.Flags.boolean({
|
|
34
|
+
description: 'Run server validation, roll back the transaction, and report the would-be result',
|
|
35
|
+
}),
|
|
36
|
+
};
|
|
37
|
+
exports.versionedMutationFlags = {
|
|
38
|
+
...exports.mutationFlags,
|
|
39
|
+
'expected-version': core_1.Flags.string({
|
|
40
|
+
required: true,
|
|
41
|
+
description: 'Current MemoryVersion ID from memory topics show --json; required for optimistic CAS',
|
|
42
|
+
}),
|
|
43
|
+
};
|
|
44
|
+
const ERROR_EXITS = {
|
|
45
|
+
MEMORY_NOT_FOUND: 4,
|
|
46
|
+
MEMORY_VERSION_NOT_FOUND: 4,
|
|
47
|
+
MEMORY_STORE_NOT_FOUND: 4,
|
|
48
|
+
MEMORY_NOT_MOUNTED: 5,
|
|
49
|
+
MEMORY_STORE_READ_ONLY: 5,
|
|
50
|
+
MEMORY_PROMOTION_CONSENT_REQUIRED: 5,
|
|
51
|
+
MEMORY_APPROVAL_REQUIRED: 5,
|
|
52
|
+
MEMORY_APPROVAL_INVALID: 5,
|
|
53
|
+
MEMORY_SPACE_PROPOSAL_REQUIRED: 5,
|
|
54
|
+
MEMORY_ROLLOUT_DISABLED: 5,
|
|
55
|
+
MEMORY_VERSION_CONFLICT: 6,
|
|
56
|
+
MEMORY_STORE_CONFLICT: 6,
|
|
57
|
+
MEMORY_IDEMPOTENCY_CONFLICT: 6,
|
|
58
|
+
MEMORY_CURSOR_AHEAD: 6,
|
|
59
|
+
MEMORY_CURSOR_EXPIRED: 6,
|
|
60
|
+
MEMORY_AUTHORIZATION_STALE: 8,
|
|
61
|
+
};
|
|
62
|
+
function parseMemoryApiError(error) {
|
|
63
|
+
try {
|
|
64
|
+
const body = JSON.parse(error.body || '{}');
|
|
65
|
+
const details = {
|
|
66
|
+
...(body.expectedVersionId ? { expectedVersionId: body.expectedVersionId } : {}),
|
|
67
|
+
...(body.currentVersionId ? { currentVersionId: body.currentVersionId } : {}),
|
|
68
|
+
...(body.expectedAuthorizationGeneration != null
|
|
69
|
+
? { expectedAuthorizationGeneration: body.expectedAuthorizationGeneration }
|
|
70
|
+
: {}),
|
|
71
|
+
...(body.currentAuthorizationGeneration != null
|
|
72
|
+
? { currentAuthorizationGeneration: body.currentAuthorizationGeneration }
|
|
73
|
+
: {}),
|
|
74
|
+
...(body.retryAfterRefresh === true ? { retryAfterRefresh: true } : {}),
|
|
75
|
+
...(body.remedy ? { remedy: body.remedy } : {}),
|
|
76
|
+
};
|
|
77
|
+
return {
|
|
78
|
+
code: String(body.code || body.error || error.code || 'MEMORY_API_ERROR').toUpperCase(),
|
|
79
|
+
message: [body.message || error.message, body.remedy].filter(Boolean).join(' '),
|
|
80
|
+
retryable: body.retryable === true,
|
|
81
|
+
...(Object.keys(details).length ? { details } : {}),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
return {
|
|
86
|
+
code: error.code || 'MEMORY_API_ERROR',
|
|
87
|
+
message: error.message,
|
|
88
|
+
retryable: false,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
class ScopedMemoryCommand extends base_command_1.BaseCommand {
|
|
93
|
+
endpoint(agentId, suffix = '') {
|
|
94
|
+
return `/api/agents/${encodeURIComponent(agentId)}/memories/workspace${suffix}`;
|
|
95
|
+
}
|
|
96
|
+
async memoryApi(agentId, suffix, options = {}) {
|
|
97
|
+
try {
|
|
98
|
+
return await (0, api_fetch_1.apiFetch)(this.endpoint(agentId, suffix), options);
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
if (error instanceof api_fetch_1.ApiFetchError) {
|
|
102
|
+
const parsed = parseMemoryApiError(error);
|
|
103
|
+
this.failWithCliError({
|
|
104
|
+
message: `${parsed.code}: ${parsed.message}`,
|
|
105
|
+
code: parsed.code,
|
|
106
|
+
status: error.status,
|
|
107
|
+
exit: ERROR_EXITS[parsed.code] || (error.status === 404 ? 4 : error.status === 403 ? 5 : 2),
|
|
108
|
+
retryable: parsed.retryable,
|
|
109
|
+
details: parsed.details,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
this.handleApiError(error);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
query(flags, extra = {}) {
|
|
116
|
+
const params = new URLSearchParams();
|
|
117
|
+
if (flags.space)
|
|
118
|
+
params.set('spaceId', flags.space);
|
|
119
|
+
for (const [key, value] of Object.entries(extra)) {
|
|
120
|
+
if (value !== undefined && value !== null)
|
|
121
|
+
params.set(key, String(value));
|
|
122
|
+
}
|
|
123
|
+
const query = params.toString();
|
|
124
|
+
return query ? `?${query}` : '';
|
|
125
|
+
}
|
|
126
|
+
async resolveStore(flags, { write = false } = {}) {
|
|
127
|
+
if (flags.store) {
|
|
128
|
+
const rawStore = await this.memoryApi(flags.agent, `/stores/${encodeURIComponent(flags.store)}${this.query(flags)}`);
|
|
129
|
+
const store = data_schemas_1.MountedMemoryStoreSchema.parse(rawStore);
|
|
130
|
+
if (write && store.mount?.access !== 'read_write') {
|
|
131
|
+
this.error('MEMORY_STORE_READ_ONLY: selected Store is read-only', { exit: 5 });
|
|
132
|
+
}
|
|
133
|
+
return store;
|
|
134
|
+
}
|
|
135
|
+
if (!flags.scope) {
|
|
136
|
+
this.error('Pass exactly one of --store <id> or --scope agent:<id>|space:<id>.', { exit: 2 });
|
|
137
|
+
}
|
|
138
|
+
if (!/^(agent|space):[^:]+$/.test(flags.scope)) {
|
|
139
|
+
this.error('--scope must be agent:<id> or space:<id>.', { exit: 2 });
|
|
140
|
+
}
|
|
141
|
+
const [kind, id] = flags.scope.split(':', 2);
|
|
142
|
+
if (kind === 'space' && !flags.space) {
|
|
143
|
+
this.error(`MEMORY_SPACE_CONTEXT_REQUIRED: --space ${id} is required when selecting ${flags.scope}.`, { exit: 2, code: 'MEMORY_SPACE_CONTEXT_REQUIRED' });
|
|
144
|
+
}
|
|
145
|
+
const response = await this.memoryApi(flags.agent, `/stores${this.query(flags)}`);
|
|
146
|
+
const stores = response.stores.map((store) => data_schemas_1.MountedMemoryStoreSchema.parse(store));
|
|
147
|
+
const store = stores.find((candidate) => candidate.owner.kind === kind && candidate.owner.id === id);
|
|
148
|
+
if (!store)
|
|
149
|
+
this.error(`MEMORY_NOT_MOUNTED: ${flags.scope}`, { exit: 5 });
|
|
150
|
+
if (write && store.mount?.access !== 'read_write') {
|
|
151
|
+
this.error('MEMORY_STORE_READ_ONLY: selected Store is read-only', { exit: 5 });
|
|
152
|
+
}
|
|
153
|
+
return store;
|
|
154
|
+
}
|
|
155
|
+
async mutation(operation, flags, input) {
|
|
156
|
+
const store = await this.resolveStore(flags, { write: true });
|
|
157
|
+
const body = {
|
|
158
|
+
...input,
|
|
159
|
+
...(flags.space ? { spaceId: flags.space } : {}),
|
|
160
|
+
targetStoreId: store.id,
|
|
161
|
+
authorizationGeneration: flags['authorization-generation'] ??
|
|
162
|
+
store.mount?.authorizationGeneration ??
|
|
163
|
+
store.authorizationGeneration,
|
|
164
|
+
...(flags['expected-version'] ? { expectedVersionId: flags['expected-version'] } : {}),
|
|
165
|
+
...(flags['privacy-approval'] ? { privacyApprovalId: flags['privacy-approval'] } : {}),
|
|
166
|
+
...(flags['consent-approval'] ? { consentApprovalId: flags['consent-approval'] } : {}),
|
|
167
|
+
idempotencyKey: flags['idempotency-key'] ||
|
|
168
|
+
(typeof input.idempotencyKey === 'string' ? input.idempotencyKey : undefined) ||
|
|
169
|
+
`cli:${operation}:${(0, node_crypto_1.randomUUID)()}`,
|
|
170
|
+
};
|
|
171
|
+
return this.memoryApi(flags.agent, `/mutations/${operation}`, {
|
|
172
|
+
method: 'POST',
|
|
173
|
+
body: flags['dry-run'] ? { ...body, dryRun: true } : body,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
print(value, json, line) {
|
|
177
|
+
if (json)
|
|
178
|
+
this.log(JSON.stringify(value, null, 2));
|
|
179
|
+
else
|
|
180
|
+
this.log(line);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
exports.ScopedMemoryCommand = ScopedMemoryCommand;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* is no `task-read` and adding one to make the table tidy would name a resource
|
|
8
8
|
* after an access mode.
|
|
9
9
|
*/
|
|
10
|
-
export type SessionTaskOperation = 'completion' | 'move' | 'comment' | 'event' | 'read';
|
|
10
|
+
export type SessionTaskOperation = 'completion' | 'move' | 'comment' | 'event' | 'update' | 'result' | 'resume' | 'resumeRead' | 'deliverable' | 'review' | 'assessment' | 'read';
|
|
11
11
|
/** Path suffix per operation. Exported for the parity test, not for callers. */
|
|
12
12
|
export declare const SESSION_TASK_PATH_SUFFIX: Record<SessionTaskOperation, string>;
|
|
13
13
|
/**
|
|
@@ -40,6 +40,13 @@ exports.SESSION_TASK_PATH_SUFFIX = {
|
|
|
40
40
|
move: 'task-move',
|
|
41
41
|
comment: 'task-comment',
|
|
42
42
|
event: 'task-events',
|
|
43
|
+
update: 'task-updates',
|
|
44
|
+
result: 'task-result',
|
|
45
|
+
resume: 'task-resume-point',
|
|
46
|
+
resumeRead: 'task-resume-context',
|
|
47
|
+
deliverable: 'task-deliverables',
|
|
48
|
+
review: 'task-review',
|
|
49
|
+
assessment: 'task-expectation-assessment',
|
|
43
50
|
read: 'task',
|
|
44
51
|
};
|
|
45
52
|
/**
|
|
@@ -90,6 +90,23 @@ export interface ManagedSessionHandle {
|
|
|
90
90
|
clientModelId?: string;
|
|
91
91
|
authorizedUsd: number;
|
|
92
92
|
leaseExpiresInMs: number;
|
|
93
|
+
/**
|
|
94
|
+
* The other TWO clocks (OSK-7729).
|
|
95
|
+
*
|
|
96
|
+
* `docs/architecture/managed-inference-execution-shapes-2026-08-12.md` reports
|
|
97
|
+
* three and is explicit about why: none is derivable from the others. The
|
|
98
|
+
* admission window is not the renewal window, and neither tells you the
|
|
99
|
+
* ceiling. This module already HELD all three and exposed one, so no surface
|
|
100
|
+
* could show the human whose session they bound when it gets cut off — the
|
|
101
|
+
* first time the ceiling was learnable was when it fired.
|
|
102
|
+
*
|
|
103
|
+
* Both optional because both are: a server that predates OSK-3924/OSK-3937
|
|
104
|
+
* reports neither, and an absent clock must read as absent rather than as
|
|
105
|
+
* zero.
|
|
106
|
+
*/
|
|
107
|
+
renewalWindowMs?: number;
|
|
108
|
+
/** The immutable ceiling as an ABSOLUTE instant — it decays while it waits. */
|
|
109
|
+
ceilingAtMs?: number;
|
|
93
110
|
/**
|
|
94
111
|
* Stop the broker AND hand the lease back.
|
|
95
112
|
*
|
|
@@ -154,6 +171,36 @@ export declare function acquireManagedSession(input?: AcquireManagedSessionInput
|
|
|
154
171
|
* effects.
|
|
155
172
|
*/
|
|
156
173
|
export declare function hasLocalCredential(): boolean;
|
|
174
|
+
/**
|
|
175
|
+
* The three clocks a supervised session runs on, said once, before the first turn.
|
|
176
|
+
*
|
|
177
|
+
* OSK-7729 — the supervised shape's defining property is that a human is
|
|
178
|
+
* present and steering, and the human was given no way to see the deadline they
|
|
179
|
+
* were steering against. `skrr code --help`, `skrr code run --help`,
|
|
180
|
+
* `skrr code doctor` and `skrr daemon status` mention no lease, no renewal and
|
|
181
|
+
* no ceiling; the first moment the ceiling was learnable was when it fired.
|
|
182
|
+
*
|
|
183
|
+
* There are three because none is derivable from the others
|
|
184
|
+
* (`docs/architecture/managed-inference-execution-shapes-2026-08-12.md`):
|
|
185
|
+
*
|
|
186
|
+
* - the CURRENT lease window, which is the admission window and is short,
|
|
187
|
+
* - the RENEWAL window every subsequent lease gets while the human is present,
|
|
188
|
+
* - the IMMUTABLE ceiling fixed at admission, which no amount of renewing moves.
|
|
189
|
+
*
|
|
190
|
+
* Reported as durations rather than instants for the OSK-3914 reason — the
|
|
191
|
+
* server's clock is the authority — with the ceiling ALSO given as a local time,
|
|
192
|
+
* because "in 3h" is what you plan around and "at 12:41" is what you recognize
|
|
193
|
+
* when it happens.
|
|
194
|
+
*
|
|
195
|
+
* An unreported clock is stated as unreported. A server predating OSK-3924 /
|
|
196
|
+
* OSK-3937 sends neither, and printing a silent 0 or omitting the clause would
|
|
197
|
+
* both read as "there is no ceiling", which is a claim this CLI cannot make.
|
|
198
|
+
*/
|
|
199
|
+
export declare function managedLeaseClockLine(clocks: {
|
|
200
|
+
leaseExpiresInMs: number;
|
|
201
|
+
renewalWindowMs?: number;
|
|
202
|
+
ceilingAtMs?: number;
|
|
203
|
+
}, now?: number): string;
|
|
157
204
|
export interface ManagedEngineHooks {
|
|
158
205
|
/** `execEngine`'s `prepare`: the broker env, or `{}` when this run is BYOK. */
|
|
159
206
|
prepare: () => Promise<Record<string, string>>;
|
|
@@ -56,6 +56,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
56
56
|
exports.ManagedAcquisitionError = void 0;
|
|
57
57
|
exports.acquireManagedSession = acquireManagedSession;
|
|
58
58
|
exports.hasLocalCredential = hasLocalCredential;
|
|
59
|
+
exports.managedLeaseClockLine = managedLeaseClockLine;
|
|
59
60
|
exports.createManagedEngineHooks = createManagedEngineHooks;
|
|
60
61
|
exports.managedRenewalStoppedLine = managedRenewalStoppedLine;
|
|
61
62
|
exports.managedFallbackLine = managedFallbackLine;
|
|
@@ -71,6 +72,7 @@ const device_id_1 = require("./device-id");
|
|
|
71
72
|
const sky_code_1 = require("./sky-code");
|
|
72
73
|
const sky_code_agent_1 = require("./sky-code-agent");
|
|
73
74
|
const sky_code_managed_1 = require("./sky-code-managed");
|
|
75
|
+
const task_execution_1 = require("./task-execution");
|
|
74
76
|
/**
|
|
75
77
|
* Harness selections the POLICY resolves, mirroring the server's own set.
|
|
76
78
|
*
|
|
@@ -430,6 +432,8 @@ async function acquireManagedSession(input = {}, deps = {}) {
|
|
|
430
432
|
...(session.clientModelId ? { clientModelId: session.clientModelId } : {}),
|
|
431
433
|
authorizedUsd: lease.authorizedUsd,
|
|
432
434
|
leaseExpiresInMs: lease.leaseExpiresInMs,
|
|
435
|
+
...(lease.renewalWindowMs !== undefined ? { renewalWindowMs: lease.renewalWindowMs } : {}),
|
|
436
|
+
...(lease.ceilingAtMs !== undefined ? { ceilingAtMs: lease.ceilingAtMs } : {}),
|
|
433
437
|
stop: async (reason = 'cli_session_ended') => {
|
|
434
438
|
try {
|
|
435
439
|
// The broker FIRST, because `stop()` stops the renewal loop: releasing
|
|
@@ -874,6 +878,51 @@ function describe(err) {
|
|
|
874
878
|
const text = err instanceof Error ? err.message : String(err);
|
|
875
879
|
return text.trim() || 'unknown error';
|
|
876
880
|
}
|
|
881
|
+
/**
|
|
882
|
+
* The three clocks a supervised session runs on, said once, before the first turn.
|
|
883
|
+
*
|
|
884
|
+
* OSK-7729 — the supervised shape's defining property is that a human is
|
|
885
|
+
* present and steering, and the human was given no way to see the deadline they
|
|
886
|
+
* were steering against. `skrr code --help`, `skrr code run --help`,
|
|
887
|
+
* `skrr code doctor` and `skrr daemon status` mention no lease, no renewal and
|
|
888
|
+
* no ceiling; the first moment the ceiling was learnable was when it fired.
|
|
889
|
+
*
|
|
890
|
+
* There are three because none is derivable from the others
|
|
891
|
+
* (`docs/architecture/managed-inference-execution-shapes-2026-08-12.md`):
|
|
892
|
+
*
|
|
893
|
+
* - the CURRENT lease window, which is the admission window and is short,
|
|
894
|
+
* - the RENEWAL window every subsequent lease gets while the human is present,
|
|
895
|
+
* - the IMMUTABLE ceiling fixed at admission, which no amount of renewing moves.
|
|
896
|
+
*
|
|
897
|
+
* Reported as durations rather than instants for the OSK-3914 reason — the
|
|
898
|
+
* server's clock is the authority — with the ceiling ALSO given as a local time,
|
|
899
|
+
* because "in 3h" is what you plan around and "at 12:41" is what you recognize
|
|
900
|
+
* when it happens.
|
|
901
|
+
*
|
|
902
|
+
* An unreported clock is stated as unreported. A server predating OSK-3924 /
|
|
903
|
+
* OSK-3937 sends neither, and printing a silent 0 or omitting the clause would
|
|
904
|
+
* both read as "there is no ceiling", which is a claim this CLI cannot make.
|
|
905
|
+
*/
|
|
906
|
+
function managedLeaseClockLine(clocks, now = Date.now()) {
|
|
907
|
+
const parts = [`this lease runs ${(0, task_execution_1.formatDurationMs)(clocks.leaseExpiresInMs)}`];
|
|
908
|
+
parts.push(clocks.renewalWindowMs !== undefined
|
|
909
|
+
? `renews every ${(0, task_execution_1.formatDurationMs)(clocks.renewalWindowMs)} while you are here`
|
|
910
|
+
: 'renews on a heartbeat while you are here');
|
|
911
|
+
if (clocks.ceilingAtMs !== undefined) {
|
|
912
|
+
const remainingMs = Math.max(0, clocks.ceilingAtMs - now);
|
|
913
|
+
parts.push(`ends for good in ${(0, task_execution_1.formatDurationMs)(remainingMs)} (${localClock(clocks.ceilingAtMs)})`);
|
|
914
|
+
}
|
|
915
|
+
else {
|
|
916
|
+
parts.push('this server reports no ceiling');
|
|
917
|
+
}
|
|
918
|
+
return `Managed session: ${parts.join(' \u00b7 ')}.`;
|
|
919
|
+
}
|
|
920
|
+
function localClock(atMs) {
|
|
921
|
+
const at = new Date(atMs);
|
|
922
|
+
const hh = String(at.getHours()).padStart(2, '0');
|
|
923
|
+
const mm = String(at.getMinutes()).padStart(2, '0');
|
|
924
|
+
return `${hh}:${mm} local`;
|
|
925
|
+
}
|
|
877
926
|
/**
|
|
878
927
|
* What is ACTUALLY about to happen instead — which is not always BYOK.
|
|
879
928
|
*
|
|
@@ -990,6 +1039,7 @@ function createManagedEngineHooks(input) {
|
|
|
990
1039
|
log(line);
|
|
991
1040
|
},
|
|
992
1041
|
});
|
|
1042
|
+
log(managedLeaseClockLine(handle));
|
|
993
1043
|
return handle.env;
|
|
994
1044
|
}
|
|
995
1045
|
catch (err) {
|
|
@@ -509,7 +509,16 @@ function managedInferenceCheck(env) {
|
|
|
509
509
|
return {
|
|
510
510
|
name: 'managed-inference',
|
|
511
511
|
status: posture.status,
|
|
512
|
-
detail: posture.
|
|
512
|
+
detail: posture.status === 'ok'
|
|
513
|
+
? // OSK-7729 — a supervised session is bounded by three clocks and this
|
|
514
|
+
// line used to imply none. `doctor` is structural by design and cannot
|
|
515
|
+
// know their VALUES (they are fixed at admission, and it makes no API
|
|
516
|
+
// call), but it can stop the absence of any mention reading as the
|
|
517
|
+
// absence of a deadline, and say where the numbers appear.
|
|
518
|
+
`${posture.detail}. A session reports three clocks when it starts — the current ` +
|
|
519
|
+
'lease, the renewal window, and the immutable ceiling — and none is derivable ' +
|
|
520
|
+
'from the others'
|
|
521
|
+
: posture.detail,
|
|
513
522
|
...(posture.remedy ? { remedy: posture.remedy } : {}),
|
|
514
523
|
};
|
|
515
524
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mergeTaskArtifactFlags = mergeTaskArtifactFlags;
|
|
4
|
+
/** Merge the current spelling with the compatibility alias without duplicating a reference. */
|
|
5
|
+
function mergeTaskArtifactFlags(deliverables, artifacts) {
|
|
6
|
+
return [...new Set([...(deliverables ?? []), ...(artifacts ?? [])])];
|
|
7
|
+
}
|
|
@@ -3,9 +3,8 @@ import { type TaskRecord } from './tasks';
|
|
|
3
3
|
* Statuses at which an execution is OVER — nothing further will move the task
|
|
4
4
|
* without new input.
|
|
5
5
|
*
|
|
6
|
-
* `in_review` is one of them
|
|
7
|
-
*
|
|
8
|
-
* TASK_OUTPUT at `in_review` and releases the checkout: the run is finished and
|
|
6
|
+
* `in_review` is one of them. The platform parks a Run whose Result still
|
|
7
|
+
* needs independent Review at `in_review` and releases the checkout: the Run is finished and
|
|
9
8
|
* a human has to close the loop. It was in neither set, so `skrr tasks wait`
|
|
10
9
|
* (default `--until done`, default `--fail-on failed,blocked,cancelled`) polled
|
|
11
10
|
* a task that could never satisfy either condition and never returned — the
|
|
@@ -14,8 +13,8 @@ import { type TaskRecord } from './tasks';
|
|
|
14
13
|
export declare const TERMINAL_STATUSES: Set<string>;
|
|
15
14
|
/**
|
|
16
15
|
* Terminal statuses that are NOT a success, i.e. the wait ends non-zero.
|
|
17
|
-
* `in_review` belongs here for the same reason: a parked
|
|
18
|
-
* the
|
|
16
|
+
* `in_review` belongs here for the same reason: a parked Run has not satisfied
|
|
17
|
+
* the Task's close policy, and a caller waiting for `done` needs to be told so rather
|
|
19
18
|
* than told nothing. Overridable per command via `--fail-on`.
|
|
20
19
|
*/
|
|
21
20
|
export declare const DEFAULT_FAIL_STATUSES: Set<string>;
|
|
@@ -32,9 +32,8 @@ const html_text_1 = require("./html-text");
|
|
|
32
32
|
* Statuses at which an execution is OVER — nothing further will move the task
|
|
33
33
|
* without new input.
|
|
34
34
|
*
|
|
35
|
-
* `in_review` is one of them
|
|
36
|
-
*
|
|
37
|
-
* TASK_OUTPUT at `in_review` and releases the checkout: the run is finished and
|
|
35
|
+
* `in_review` is one of them. The platform parks a Run whose Result still
|
|
36
|
+
* needs independent Review at `in_review` and releases the checkout: the Run is finished and
|
|
38
37
|
* a human has to close the loop. It was in neither set, so `skrr tasks wait`
|
|
39
38
|
* (default `--until done`, default `--fail-on failed,blocked,cancelled`) polled
|
|
40
39
|
* a task that could never satisfy either condition and never returned — the
|
|
@@ -50,8 +49,8 @@ exports.TERMINAL_STATUSES = new Set([
|
|
|
50
49
|
]);
|
|
51
50
|
/**
|
|
52
51
|
* Terminal statuses that are NOT a success, i.e. the wait ends non-zero.
|
|
53
|
-
* `in_review` belongs here for the same reason: a parked
|
|
54
|
-
* the
|
|
52
|
+
* `in_review` belongs here for the same reason: a parked Run has not satisfied
|
|
53
|
+
* the Task's close policy, and a caller waiting for `done` needs to be told so rather
|
|
55
54
|
* than told nothing. Overridable per command via `--fail-on`.
|
|
56
55
|
*/
|
|
57
56
|
exports.DEFAULT_FAIL_STATUSES = new Set(['failed', 'blocked', 'cancelled', 'in_review']);
|
|
@@ -23,11 +23,7 @@ export declare const taskLookupApi: {
|
|
|
23
23
|
*/
|
|
24
24
|
followUp: (id: string, body: Json) => Promise<Json>;
|
|
25
25
|
cancelFollowUp: (id: string) => Promise<Json>;
|
|
26
|
-
/**
|
|
27
|
-
* Atomic completion: moves the task AND writes the TASK_OUTPUT comment in one
|
|
28
|
-
* request, so a crash between the two cannot leave a done task with no record
|
|
29
|
-
* of what it produced.
|
|
30
|
-
*/
|
|
26
|
+
/** Result-first closeout: submit one immutable Result, then project status. */
|
|
31
27
|
complete: (id: string, body: Json) => Promise<Json>;
|
|
32
28
|
treePosition: (id: string, body: Json) => Promise<Json>;
|
|
33
29
|
createAndStart: (body: Json) => Promise<Json>;
|