@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
package/dist/lib/harnesses.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.getHarnessModels = getHarnessModels;
|
|
|
7
7
|
exports.listHarnessProducts = listHarnessProducts;
|
|
8
8
|
exports.getHarnessUsage = getHarnessUsage;
|
|
9
9
|
exports.getAllHarnessUsage = getAllHarnessUsage;
|
|
10
|
+
exports.getRuntimeMonthlySpend = getRuntimeMonthlySpend;
|
|
10
11
|
exports.listQuotaAccounts = listQuotaAccounts;
|
|
11
12
|
exports.getQuotaHistory = getQuotaHistory;
|
|
12
13
|
exports.updateHarness = updateHarness;
|
|
@@ -71,6 +72,18 @@ async function getAllHarnessUsage() {
|
|
|
71
72
|
const ownerWide = '?scope=all';
|
|
72
73
|
return (0, api_fetch_1.apiFetch)('/api/harnesses/usage/aggregate' + ownerWide);
|
|
73
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* The monthly runtime spend cap, read before it refuses anything.
|
|
77
|
+
*
|
|
78
|
+
* Distinct from the balance's own spend cap, which is a per-period RATE LIMIT
|
|
79
|
+
* on credits. A user can have headroom on that one and still be refused by
|
|
80
|
+
* this one, which is exactly what happened: every number on `balance show`
|
|
81
|
+
* said there was room while a monthly hosted-runtime cap turned every turn
|
|
82
|
+
* away (OSK-7920).
|
|
83
|
+
*/
|
|
84
|
+
async function getRuntimeMonthlySpend() {
|
|
85
|
+
return (0, api_fetch_1.apiFetch)('/api/harnesses/spend');
|
|
86
|
+
}
|
|
74
87
|
/** The CLI subscription accounts this user's daemons have reported readings for. */
|
|
75
88
|
async function listQuotaAccounts() {
|
|
76
89
|
return (0, api_fetch_1.apiFetch)('/api/harnesses/quota/accounts');
|
|
@@ -149,7 +162,25 @@ async function readHarnessPing(id, pingId) {
|
|
|
149
162
|
return (0, api_fetch_1.apiFetch)(`/api/harnesses/${encodeURIComponent(id)}/ping/${encodeURIComponent(pingId)}`);
|
|
150
163
|
}
|
|
151
164
|
// ── Leases (hosted billing plane) ──────────────────────────────────────────
|
|
152
|
-
|
|
165
|
+
/**
|
|
166
|
+
* List leases. The server answers newest-first and caps at 50 unless asked
|
|
167
|
+
* otherwise (`Math.min(Math.max(Number(limit) || 50, 1), 100)`), so an account
|
|
168
|
+
* with more than fifty leases could not see past the newest fifty from here —
|
|
169
|
+
* including `lost` ones, which are terminal, invisible, and still billed for
|
|
170
|
+
* the whole window the platform had lost track of them.
|
|
171
|
+
*/
|
|
172
|
+
async function listHarnessLeases(options = {}) {
|
|
173
|
+
const query = new URLSearchParams();
|
|
174
|
+
if (options.limit)
|
|
175
|
+
query.set('limit', String(options.limit));
|
|
176
|
+
if (options.state)
|
|
177
|
+
query.set('state', options.state);
|
|
178
|
+
if (options.machineProduct)
|
|
179
|
+
query.set('machineProduct', options.machineProduct);
|
|
180
|
+
const encoded = query.toString();
|
|
181
|
+
if (encoded) {
|
|
182
|
+
return (0, api_fetch_1.apiFetch)(`/api/machines/leases?${encoded}`);
|
|
183
|
+
}
|
|
153
184
|
return (0, api_fetch_1.apiFetch)('/api/machines/leases');
|
|
154
185
|
}
|
|
155
186
|
async function getHarnessLease(leaseId) {
|
|
@@ -237,6 +237,15 @@ async function waitForHostedMachineReady(id, options) {
|
|
|
237
237
|
const detail = hostedMachineErrorSummary(session);
|
|
238
238
|
throw new Error(`Hosted Machine ${id} reached ${status}${detail ? `: ${detail}` : ''}`);
|
|
239
239
|
}
|
|
240
|
+
// Async resume deliberately rolls a recoverable failure back to `paused`
|
|
241
|
+
// so the retained workspace remains resumable. That is terminal for THIS
|
|
242
|
+
// wait operation even though it is not terminal for the machine. The
|
|
243
|
+
// resuming transition clears old error state, so an error-bearing paused
|
|
244
|
+
// row here belongs to the attempt we just started.
|
|
245
|
+
if (status === 'paused') {
|
|
246
|
+
const detail = hostedMachineErrorSummary(session);
|
|
247
|
+
throw new Error(`Hosted Machine ${id} returned to paused before it became ready${detail ? `: ${detail}` : ''}`);
|
|
248
|
+
}
|
|
240
249
|
if (options.timeoutMs && Date.now() - startedAt >= options.timeoutMs) {
|
|
241
250
|
throw new HostedMachineReadyTimeoutError(id, hostedMachineProgressSummary(session));
|
|
242
251
|
}
|
package/dist/lib/inbox.d.ts
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* Gap analysis §3.3 (b): *"50 个命令组中没有 `skrr inbox` / `listen` / `tail` /
|
|
5
5
|
* `notify`,CLI 全是 pull"*. The audit's third use case wants an agent that
|
|
6
6
|
* *"像真人一样时不时发两三条消息"* — and the reply half of that loop already
|
|
7
|
-
* works (`skrr agents chat --conversation <id
|
|
7
|
+
* works (`skrr agents chat <agent-id> --conversation <id> --prompt "…"` stamps
|
|
8
|
+
* `Message.intentId` and
|
|
8
9
|
* wakes the originating run). What was missing is the other direction: nothing
|
|
9
10
|
* in the CLI ever told you the agent had said something.
|
|
10
11
|
*
|
package/dist/lib/machines.d.ts
CHANGED
|
@@ -87,6 +87,23 @@ export interface Machine {
|
|
|
87
87
|
canTerminate: boolean;
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* What a machine's state actually is, when `offline` is doing two jobs.
|
|
92
|
+
*
|
|
93
|
+
* A TERMINATED ephemeral sandbox — destroyed, unrecoverable, `canResume:
|
|
94
|
+
* false`, no lease — rendered `offline`, identically to a machine that is
|
|
95
|
+
* merely not connected right now. Those are opposite situations: one can come
|
|
96
|
+
* back and one never will, and the board's original target turned out to be the
|
|
97
|
+
* second while every surface said the first. The only way to learn the
|
|
98
|
+
* difference was to run `skrr machines hosted list` separately and match
|
|
99
|
+
* sandbox ids by hand (OSK-7639).
|
|
100
|
+
*
|
|
101
|
+
* `canResume` is the discriminator the payload already carries: a machine that
|
|
102
|
+
* could come back says so, and a destroyed one cannot.
|
|
103
|
+
*/
|
|
104
|
+
export declare function machineStateLabel(machine: Machine): string;
|
|
105
|
+
/** Is this a machine a user could still use, or bring back? */
|
|
106
|
+
export declare function isReachableMachine(machine: Machine): boolean;
|
|
90
107
|
/** The user-editable slice. Identities, capabilities and lifecycle are not. */
|
|
91
108
|
export interface MachinePreferencesPatch {
|
|
92
109
|
name?: string;
|
package/dist/lib/machines.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.machineStateLabel = machineStateLabel;
|
|
4
|
+
exports.isReachableMachine = isReachableMachine;
|
|
3
5
|
exports.liveHarnessCount = liveHarnessCount;
|
|
4
6
|
exports.listMachines = listMachines;
|
|
5
7
|
exports.getMachine = getMachine;
|
|
@@ -7,6 +9,33 @@ exports.updateMachine = updateMachine;
|
|
|
7
9
|
exports.disconnectMachine = disconnectMachine;
|
|
8
10
|
exports.resolveMachineRef = resolveMachineRef;
|
|
9
11
|
const api_fetch_1 = require("./api-fetch");
|
|
12
|
+
/**
|
|
13
|
+
* What a machine's state actually is, when `offline` is doing two jobs.
|
|
14
|
+
*
|
|
15
|
+
* A TERMINATED ephemeral sandbox — destroyed, unrecoverable, `canResume:
|
|
16
|
+
* false`, no lease — rendered `offline`, identically to a machine that is
|
|
17
|
+
* merely not connected right now. Those are opposite situations: one can come
|
|
18
|
+
* back and one never will, and the board's original target turned out to be the
|
|
19
|
+
* second while every surface said the first. The only way to learn the
|
|
20
|
+
* difference was to run `skrr machines hosted list` separately and match
|
|
21
|
+
* sandbox ids by hand (OSK-7639).
|
|
22
|
+
*
|
|
23
|
+
* `canResume` is the discriminator the payload already carries: a machine that
|
|
24
|
+
* could come back says so, and a destroyed one cannot.
|
|
25
|
+
*/
|
|
26
|
+
function machineStateLabel(machine) {
|
|
27
|
+
if (machine.status !== 'offline')
|
|
28
|
+
return machine.status;
|
|
29
|
+
const controls = machine.controls;
|
|
30
|
+
if (controls && controls.canResume === false && controls.canTerminate === false) {
|
|
31
|
+
return 'terminated';
|
|
32
|
+
}
|
|
33
|
+
return 'offline';
|
|
34
|
+
}
|
|
35
|
+
/** Is this a machine a user could still use, or bring back? */
|
|
36
|
+
function isReachableMachine(machine) {
|
|
37
|
+
return machineStateLabel(machine) !== 'terminated' && machine.status !== 'offline';
|
|
38
|
+
}
|
|
10
39
|
/**
|
|
11
40
|
* How many of a machine's harnesses still represent a capability it has.
|
|
12
41
|
*
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* managed-agent-keys.ts — request client for `/api/admin/mgmt-keys`.
|
|
3
|
+
*
|
|
4
|
+
* ## Why this file exists
|
|
5
|
+
*
|
|
6
|
+
* The Managed Agents API (`/api/v1/*` — environments, agent releases, sessions,
|
|
7
|
+
* events, vaults) authenticates with an `osk_<live|test>_<secret>` key, and the
|
|
8
|
+
* only route that mints one is `POST /api/admin/mgmt-keys`. Nothing in the CLI
|
|
9
|
+
* reached it: a search of every command directory found no reference to
|
|
10
|
+
* `mgmt-keys` or `/api/v1` at all.
|
|
11
|
+
*
|
|
12
|
+
* So a headless operator, or a coding agent running locally, could be told by
|
|
13
|
+
* `/v1` that its credential was missing and had no command to mint one. The
|
|
14
|
+
* documented path was the dashboard, which a machine cannot open. That gap was
|
|
15
|
+
* recorded as the secondary half of OSK-7932, whose primary half was that the
|
|
16
|
+
* server-side pepper had never been configured in any environment — the API
|
|
17
|
+
* could not issue a key, and there was also no way to ask it to.
|
|
18
|
+
*
|
|
19
|
+
* ## Not the same thing as `skrr token`
|
|
20
|
+
*
|
|
21
|
+
* `skrr token` / `skrr create-token` mint a long-lived CLI token for
|
|
22
|
+
* bootstrapping a daemon on a headless machine — that is this CLI's own auth.
|
|
23
|
+
* These are API keys for a different surface, held by a Space, and presented by
|
|
24
|
+
* whatever calls `/api/v1`. The CLI already keeps `balance` and
|
|
25
|
+
* `payments wallet` apart for the same reason: two things called "credit" that
|
|
26
|
+
* are unrelated, where reading one for the other tells you something false.
|
|
27
|
+
*
|
|
28
|
+
* ## Inline path literals
|
|
29
|
+
*
|
|
30
|
+
* `domain-api-parity` resolves a command to an endpoint by reading these
|
|
31
|
+
* strings. A helper that assembles the URL is opaque to it, so the endpoint
|
|
32
|
+
* would read as unreachable and get allow-listed — a check going green on an
|
|
33
|
+
* assertion it never made.
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* A key as the API returns it, in the API's OWN field names.
|
|
37
|
+
*
|
|
38
|
+
* snake_case, and mirrored rather than translated. `toPublic` in
|
|
39
|
+
* `routes/adminMgmtKeys.js` is the contract; a camelCase interface here would
|
|
40
|
+
* silently produce `undefined` for every field, which is precisely what the
|
|
41
|
+
* first version of this file did — it invented `createdAt`/`revokedAt` and an
|
|
42
|
+
* `env` that does not exist, and the list command printed nothing while the API
|
|
43
|
+
* was returning rows.
|
|
44
|
+
*
|
|
45
|
+
* There is no `env` field. The environment is encoded in `prefix`
|
|
46
|
+
* (`osk_live_…` / `osk_test_…`), which is also all a listing ever reveals of a
|
|
47
|
+
* secret.
|
|
48
|
+
*/
|
|
49
|
+
export interface ManagedAgentKey {
|
|
50
|
+
id: string;
|
|
51
|
+
name: string;
|
|
52
|
+
prefix?: string;
|
|
53
|
+
last_four?: string;
|
|
54
|
+
scopes: string[];
|
|
55
|
+
space_id?: string;
|
|
56
|
+
created_at?: string;
|
|
57
|
+
last_used_at?: string | null;
|
|
58
|
+
revoked_at?: string | null;
|
|
59
|
+
expires_at?: string | null;
|
|
60
|
+
rate_limit_override?: unknown;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The mint response: the public projection, FLAT, plus the secret.
|
|
64
|
+
*
|
|
65
|
+
* `secret` is returned exactly once — there is no endpoint that reveals it
|
|
66
|
+
* again — so a caller that discards this field has lost the credential and must
|
|
67
|
+
* rotate. The command layer says so where the value is printed rather than in a
|
|
68
|
+
* footnote.
|
|
69
|
+
*/
|
|
70
|
+
export type ManagedAgentKeyMint = ManagedAgentKey & {
|
|
71
|
+
secret: string;
|
|
72
|
+
secret_warning?: string;
|
|
73
|
+
/** Present on a rotate: the id of the key this one replaces. */
|
|
74
|
+
rotated_from?: string;
|
|
75
|
+
};
|
|
76
|
+
export interface CreateManagedAgentKeyInput {
|
|
77
|
+
spaceId: string;
|
|
78
|
+
name: string;
|
|
79
|
+
env?: 'live' | 'test';
|
|
80
|
+
scopes?: string[];
|
|
81
|
+
/** ISO 8601. The route refuses a value in the past. */
|
|
82
|
+
expiresAt?: string;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Mint a key for a Space.
|
|
86
|
+
*
|
|
87
|
+
* Space-owner only, enforced server-side — a member cannot mint against a Space
|
|
88
|
+
* they do not own, and the CLI does not pre-check that: a client-side guess at
|
|
89
|
+
* an authorization answer is one more place for the two to disagree.
|
|
90
|
+
*/
|
|
91
|
+
export declare function createManagedAgentKey(input: CreateManagedAgentKeyInput): Promise<ManagedAgentKeyMint>;
|
|
92
|
+
/** Every key on a Space. Revoked rows are included, with `revokedAt` set. */
|
|
93
|
+
export declare function listManagedAgentKeys(spaceId: string): Promise<ManagedAgentKey[]>;
|
|
94
|
+
/** Revoke a key. Irreversible — a revoked key is never re-enabled, only replaced. */
|
|
95
|
+
export declare function revokeManagedAgentKey(id: string, spaceId: string): Promise<{
|
|
96
|
+
id?: string;
|
|
97
|
+
revoked?: boolean;
|
|
98
|
+
}>;
|
|
99
|
+
/**
|
|
100
|
+
* Rotate a key: mint a replacement secret for the same row.
|
|
101
|
+
*
|
|
102
|
+
* Returns a secret under the same once-only rule as `create`.
|
|
103
|
+
*/
|
|
104
|
+
export declare function rotateManagedAgentKey(id: string, spaceId: string): Promise<ManagedAgentKeyMint>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createManagedAgentKey = createManagedAgentKey;
|
|
4
|
+
exports.listManagedAgentKeys = listManagedAgentKeys;
|
|
5
|
+
exports.revokeManagedAgentKey = revokeManagedAgentKey;
|
|
6
|
+
exports.rotateManagedAgentKey = rotateManagedAgentKey;
|
|
7
|
+
const api_fetch_1 = require("./api-fetch");
|
|
8
|
+
/**
|
|
9
|
+
* Mint a key for a Space.
|
|
10
|
+
*
|
|
11
|
+
* Space-owner only, enforced server-side — a member cannot mint against a Space
|
|
12
|
+
* they do not own, and the CLI does not pre-check that: a client-side guess at
|
|
13
|
+
* an authorization answer is one more place for the two to disagree.
|
|
14
|
+
*/
|
|
15
|
+
async function createManagedAgentKey(input) {
|
|
16
|
+
return (0, api_fetch_1.apiFetch)('/api/admin/mgmt-keys', {
|
|
17
|
+
method: 'POST',
|
|
18
|
+
body: {
|
|
19
|
+
space_id: input.spaceId,
|
|
20
|
+
name: input.name,
|
|
21
|
+
...(input.env ? { env: input.env } : {}),
|
|
22
|
+
...(input.scopes ? { scopes: input.scopes } : {}),
|
|
23
|
+
...(input.expiresAt ? { expires_at: input.expiresAt } : {}),
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/** Every key on a Space. Revoked rows are included, with `revokedAt` set. */
|
|
28
|
+
async function listManagedAgentKeys(spaceId) {
|
|
29
|
+
// `{ data: [...] }` — the route's envelope. Guessed as `{ keys }` first, which
|
|
30
|
+
// returned an empty list against a space that had a key, and reported "No API
|
|
31
|
+
// keys on this space." That is the failure shape worth noting: a wrong
|
|
32
|
+
// envelope does not error, it reports absence.
|
|
33
|
+
const res = await (0, api_fetch_1.apiFetch)(`/api/admin/mgmt-keys?space_id=${encodeURIComponent(spaceId)}`);
|
|
34
|
+
return res?.data || [];
|
|
35
|
+
}
|
|
36
|
+
/** Revoke a key. Irreversible — a revoked key is never re-enabled, only replaced. */
|
|
37
|
+
async function revokeManagedAgentKey(id, spaceId) {
|
|
38
|
+
return (0, api_fetch_1.apiFetch)(`/api/admin/mgmt-keys/${encodeURIComponent(id)}?space_id=${encodeURIComponent(spaceId)}`, { method: 'DELETE' });
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Rotate a key: mint a replacement secret for the same row.
|
|
42
|
+
*
|
|
43
|
+
* Returns a secret under the same once-only rule as `create`.
|
|
44
|
+
*/
|
|
45
|
+
async function rotateManagedAgentKey(id, spaceId) {
|
|
46
|
+
return (0, api_fetch_1.apiFetch)(`/api/admin/mgmt-keys/${encodeURIComponent(id)}/rotate`, {
|
|
47
|
+
method: 'POST',
|
|
48
|
+
body: { space_id: spaceId },
|
|
49
|
+
});
|
|
50
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { MemoryScope } from '@skrr-ai/data-provider';
|
|
2
2
|
/**
|
|
3
|
-
* Shared `--agent` / `--tier` / `--workspace` flags for
|
|
3
|
+
* Shared `--agent` / `--tier` / `--pool-workspace` flags for compatibility Memory commands.
|
|
4
4
|
*
|
|
5
5
|
* A memory record lives in exactly one pool. These flags select which:
|
|
6
6
|
* - (default) owner pool → /api/memories
|
|
7
7
|
* - --agent <id> a specific agent → /api/agents/:id/memories
|
|
8
8
|
* - --tier user cross-agent user → /api/users/me/memories
|
|
9
9
|
* - --tier workspace a workspace pool → /api/workspaces/:id/memories
|
|
10
|
-
* (requires --workspace <id>)
|
|
10
|
+
* (requires --pool-workspace <id>)
|
|
11
11
|
*
|
|
12
12
|
* Spread into a command's `flags` alongside its own. Resolve with
|
|
13
13
|
* `resolveMemoryScope(flags)` into the `MemoryScope` the data-service accepts.
|
|
@@ -15,11 +15,12 @@ import type { MemoryScope } from '@skrr-ai/data-provider';
|
|
|
15
15
|
export declare const memoryScopeFlags: {
|
|
16
16
|
agent: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
17
17
|
tier: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
18
|
-
workspace: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
18
|
+
'pool-workspace': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
19
19
|
};
|
|
20
20
|
export interface MemoryScopeFlagValues {
|
|
21
21
|
agent?: string;
|
|
22
22
|
tier?: string;
|
|
23
|
+
'pool-workspace'?: string;
|
|
23
24
|
workspace?: string;
|
|
24
25
|
}
|
|
25
26
|
/**
|
package/dist/lib/memory-scope.js
CHANGED
|
@@ -6,14 +6,14 @@ exports.resolveMemoryScopeOrFail = resolveMemoryScopeOrFail;
|
|
|
6
6
|
exports.describeMemoryScope = describeMemoryScope;
|
|
7
7
|
const core_1 = require("@oclif/core");
|
|
8
8
|
/**
|
|
9
|
-
* Shared `--agent` / `--tier` / `--workspace` flags for
|
|
9
|
+
* Shared `--agent` / `--tier` / `--pool-workspace` flags for compatibility Memory commands.
|
|
10
10
|
*
|
|
11
11
|
* A memory record lives in exactly one pool. These flags select which:
|
|
12
12
|
* - (default) owner pool → /api/memories
|
|
13
13
|
* - --agent <id> a specific agent → /api/agents/:id/memories
|
|
14
14
|
* - --tier user cross-agent user → /api/users/me/memories
|
|
15
15
|
* - --tier workspace a workspace pool → /api/workspaces/:id/memories
|
|
16
|
-
* (requires --workspace <id>)
|
|
16
|
+
* (requires --pool-workspace <id>)
|
|
17
17
|
*
|
|
18
18
|
* Spread into a command's `flags` alongside its own. Resolve with
|
|
19
19
|
* `resolveMemoryScope(flags)` into the `MemoryScope` the data-service accepts.
|
|
@@ -26,8 +26,8 @@ exports.memoryScopeFlags = {
|
|
|
26
26
|
description: 'Memory pool tier to target (default: owner)',
|
|
27
27
|
options: ['owner', 'user', 'workspace'],
|
|
28
28
|
}),
|
|
29
|
-
workspace: core_1.Flags.string({
|
|
30
|
-
description: '
|
|
29
|
+
'pool-workspace': core_1.Flags.string({
|
|
30
|
+
description: 'Compatibility Memory pool workspace id (required with --tier workspace; distinct from global --workspace request context)',
|
|
31
31
|
}),
|
|
32
32
|
};
|
|
33
33
|
/**
|
|
@@ -40,14 +40,14 @@ function resolveMemoryScope(flags) {
|
|
|
40
40
|
if (flags.agent && tier !== 'owner') {
|
|
41
41
|
throw new Error('--agent cannot be combined with --tier user|workspace.');
|
|
42
42
|
}
|
|
43
|
-
if (flags
|
|
44
|
-
throw new Error('--workspace is only valid with --tier workspace.');
|
|
43
|
+
if (flags['pool-workspace'] && tier !== 'workspace') {
|
|
44
|
+
throw new Error('--pool-workspace is only valid with --tier workspace.');
|
|
45
45
|
}
|
|
46
46
|
if (tier === 'workspace') {
|
|
47
|
-
if (!flags
|
|
48
|
-
throw new Error('--workspace <id> is required when --tier workspace.');
|
|
47
|
+
if (!flags['pool-workspace']) {
|
|
48
|
+
throw new Error('--pool-workspace <id> is required when --tier workspace. Global --workspace selects request context and cannot select a Memory pool.');
|
|
49
49
|
}
|
|
50
|
-
return { tier: 'workspace', workspaceId: flags
|
|
50
|
+
return { tier: 'workspace', workspaceId: flags['pool-workspace'] };
|
|
51
51
|
}
|
|
52
52
|
if (tier === 'user') {
|
|
53
53
|
return { tier: 'user' };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
export declare const MEMORY_SYNC_MANIFEST = ".memory-sync";
|
|
2
|
+
export declare const MEMORY_SYNC_BASIS = ".memory-sync-basis";
|
|
3
|
+
export declare const MEMORY_SYNC_CONFLICTS = ".memory-conflicts";
|
|
4
|
+
export declare const MEMORY_SYNC_TOMBSTONES = ".memory-tombstones";
|
|
5
|
+
export interface RemoteMemoryEntry {
|
|
6
|
+
memoryId: string;
|
|
7
|
+
path: string;
|
|
8
|
+
versionId: string;
|
|
9
|
+
revision: number;
|
|
10
|
+
contentHash: string | null;
|
|
11
|
+
document: string;
|
|
12
|
+
}
|
|
13
|
+
export interface MemorySyncSnapshot {
|
|
14
|
+
contractVersion: 1;
|
|
15
|
+
storeId: string;
|
|
16
|
+
owner: {
|
|
17
|
+
kind: 'agent' | 'space';
|
|
18
|
+
id: string;
|
|
19
|
+
};
|
|
20
|
+
access: 'read_only' | 'read_write';
|
|
21
|
+
authorizationGeneration: number;
|
|
22
|
+
cursor: string;
|
|
23
|
+
storeRevision: number;
|
|
24
|
+
index: string;
|
|
25
|
+
entries: RemoteMemoryEntry[];
|
|
26
|
+
}
|
|
27
|
+
export interface MemorySyncManifest {
|
|
28
|
+
contractVersion: 1;
|
|
29
|
+
storeId: string;
|
|
30
|
+
ownerUri: string;
|
|
31
|
+
access: 'read_only' | 'read_write' | 'revoked';
|
|
32
|
+
authorizationGeneration: number;
|
|
33
|
+
cursor: string;
|
|
34
|
+
updatedAt: string;
|
|
35
|
+
}
|
|
36
|
+
export interface MemorySyncChange {
|
|
37
|
+
cursor: string;
|
|
38
|
+
storeId: string;
|
|
39
|
+
memoryId?: string;
|
|
40
|
+
operation: 'upsert' | 'remove' | 'redact' | 'scope_reset';
|
|
41
|
+
authorizationGeneration: number;
|
|
42
|
+
}
|
|
43
|
+
export interface MemorySyncChanges {
|
|
44
|
+
contractVersion: 1;
|
|
45
|
+
storeId: string;
|
|
46
|
+
authorizationGeneration: number;
|
|
47
|
+
storeRevision?: number;
|
|
48
|
+
after: string;
|
|
49
|
+
cursor: string;
|
|
50
|
+
hasMore?: boolean;
|
|
51
|
+
index?: string;
|
|
52
|
+
resetRequired?: boolean;
|
|
53
|
+
reason?: string;
|
|
54
|
+
entries?: Array<{
|
|
55
|
+
change: MemorySyncChange;
|
|
56
|
+
head?: RemoteMemoryEntry | null;
|
|
57
|
+
}>;
|
|
58
|
+
}
|
|
59
|
+
export interface LocalMutation {
|
|
60
|
+
operation: 'encode' | 'reconsolidate' | 'delete';
|
|
61
|
+
input: Record<string, unknown>;
|
|
62
|
+
file: string;
|
|
63
|
+
}
|
|
64
|
+
export declare function fileForMemoryPath(memoryPath: string): string;
|
|
65
|
+
export declare function readMaterializationBinding(rootInput: string): Promise<{
|
|
66
|
+
manifest: MemorySyncManifest | null;
|
|
67
|
+
cursor: string | null;
|
|
68
|
+
}>;
|
|
69
|
+
export declare function assertMaterializationSpaceContext(manifest: MemorySyncManifest | null, spaceId?: string): void;
|
|
70
|
+
export declare function assertMaterializationStore(manifest: MemorySyncManifest | null, storeId: string): void;
|
|
71
|
+
export declare function pullSnapshot(rootInput: string, snapshot: MemorySyncSnapshot, { dryRun }?: {
|
|
72
|
+
dryRun?: boolean | undefined;
|
|
73
|
+
}): Promise<{
|
|
74
|
+
changed: number;
|
|
75
|
+
conflicts: number;
|
|
76
|
+
cursor: string;
|
|
77
|
+
dryRun: boolean;
|
|
78
|
+
}>;
|
|
79
|
+
export declare function pullChanges(rootInput: string, delta: MemorySyncChanges, { dryRun }?: {
|
|
80
|
+
dryRun?: boolean | undefined;
|
|
81
|
+
}): Promise<{
|
|
82
|
+
changed: number;
|
|
83
|
+
conflicts: number;
|
|
84
|
+
cursor: string;
|
|
85
|
+
dryRun: boolean;
|
|
86
|
+
}>;
|
|
87
|
+
export declare function planPush(rootInput: string, { recordConflicts }?: {
|
|
88
|
+
recordConflicts?: boolean;
|
|
89
|
+
}): Promise<{
|
|
90
|
+
manifest: MemorySyncManifest;
|
|
91
|
+
mutations: LocalMutation[];
|
|
92
|
+
conflicts: number;
|
|
93
|
+
unrecognizedFiles: string[];
|
|
94
|
+
nextActions: string[];
|
|
95
|
+
}>;
|
|
96
|
+
export declare function syncStatus(rootInput: string): Promise<Record<string, unknown>>;
|
|
97
|
+
export declare function stageLocalDelete(rootInput: string, memoryId: string): Promise<{
|
|
98
|
+
memoryId: string;
|
|
99
|
+
file: string;
|
|
100
|
+
expectedVersionId: string;
|
|
101
|
+
tombstoneFile: string;
|
|
102
|
+
}>;
|
|
103
|
+
export declare function resolveConflict(rootInput: string, conflictId: string, strategy: string, manualContent?: string): Promise<{
|
|
104
|
+
resolved: boolean;
|
|
105
|
+
strategy: string;
|
|
106
|
+
}>;
|
|
107
|
+
export declare function revokeMaterialization(rootInput: string, generation: number): Promise<{
|
|
108
|
+
removed: number;
|
|
109
|
+
}>;
|
|
110
|
+
export declare function boundedFinalFlush<T>(flush: () => Promise<T>, timeoutMs?: number): Promise<{
|
|
111
|
+
flushed: boolean;
|
|
112
|
+
result?: T;
|
|
113
|
+
unsynced?: true;
|
|
114
|
+
}>;
|