@skrr-ai/cli 0.1.181 → 0.1.182
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/dist/commands/agents/always-on/recovery-review.d.ts +17 -0
- package/dist/commands/agents/always-on/recovery-review.js +81 -3
- package/dist/commands/agents/always-on/status.js +10 -1
- package/dist/commands/agents/delete.js +10 -0
- package/dist/commands/balance/statement.d.ts +6 -0
- package/dist/commands/balance/statement.js +49 -25
- package/dist/commands/duties/delete.js +9 -0
- package/dist/lib/balance.d.ts +10 -0
- package/dist/lib/duties.d.ts +5 -1
- package/dist/lib/duties.js +42 -13
- package/dist/lib/duty-loop-status.js +20 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/codex-model-catalog.json +1 -297
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/managedWorkRuntime.d.ts +40 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/managedWorkRuntime.js +94 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/telemetryRedaction.js +6 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/managedWorkRuntime.d.ts +40 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/managedWorkRuntime.js +56 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/telemetryRedaction.js +35 -12
- package/dist/node_modules/@skrr-ai/auth-core/package.json +5 -0
- package/dist/node_modules/@skrr-ai/data-provider/index.js +11247 -11173
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.d.ts +28 -1
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.js +40 -11
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.d.ts +28 -1
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.js +73 -17
- package/oclif.manifest.json +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,16 @@
|
|
|
1
|
+
import type { DutyRunRecoveryReview } from '@skrr-ai/data-provider';
|
|
1
2
|
import { BaseCommand } from '../../../base-command';
|
|
3
|
+
/**
|
|
4
|
+
* The codes this CLI has words for, per field (OSK-24685). A server can send a code newer than the CLI that reads it:
|
|
5
|
+
* `tool_calls_unrecorded` reached production before any released CLI knew it, and the Close line printed nothing at
|
|
6
|
+
* all. Every renderer below prints a code it does not know verbatim, with this hint, and never falls silent.
|
|
7
|
+
*/
|
|
8
|
+
export declare const RECOVERY_HOLD_CODES: ReadonlyArray<DutyRunRecoveryReview['hold']>;
|
|
9
|
+
export declare const RECOVERY_EXECUTOR_CODES: ReadonlyArray<DutyRunRecoveryReview['executor']>;
|
|
10
|
+
export declare const RECOVERY_CLOSE_CODES: ReadonlyArray<NonNullable<DutyRunRecoveryReview['close']>>;
|
|
11
|
+
export declare const UNKNOWN_CODE_HINT = "this CLI does not know it; update the CLI (`skrr update`) for details";
|
|
12
|
+
/** A code as this CLI prints it: verbatim, and marked when it is not one of `known`. */
|
|
13
|
+
export declare function recoveryCode(value: unknown, known: readonly string[]): string;
|
|
2
14
|
/**
|
|
3
15
|
* Read-only. The server independently verifies owner and source authorization.
|
|
4
16
|
*
|
|
@@ -20,3 +32,8 @@ export default class AgentsAlwaysOnRecoveryReview extends BaseCommand {
|
|
|
20
32
|
run(): Promise<void>;
|
|
21
33
|
private list;
|
|
22
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* What the owner can do about a held result (OSK-23548), in the server's own terms. Nothing for an unheld Run, an older
|
|
37
|
+
* server, or a hold this server cannot close: no command is offered that would be refused.
|
|
38
|
+
*/
|
|
39
|
+
export declare function closeLines(agentId: string, review: DutyRunRecoveryReview): string[];
|
|
@@ -1,10 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UNKNOWN_CODE_HINT = exports.RECOVERY_CLOSE_CODES = exports.RECOVERY_EXECUTOR_CODES = exports.RECOVERY_HOLD_CODES = void 0;
|
|
4
|
+
exports.recoveryCode = recoveryCode;
|
|
5
|
+
exports.closeLines = closeLines;
|
|
3
6
|
const core_1 = require("@oclif/core");
|
|
4
7
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
5
8
|
const base_command_1 = require("../../../base-command");
|
|
6
9
|
const http_error_1 = require("../../../lib/http-error");
|
|
7
10
|
const INTEGRITY_CAVEAT = 'Result integrity does not prove the executor stopped or that effects did not occur.';
|
|
11
|
+
/**
|
|
12
|
+
* The codes this CLI has words for, per field (OSK-24685). A server can send a code newer than the CLI that reads it:
|
|
13
|
+
* `tool_calls_unrecorded` reached production before any released CLI knew it, and the Close line printed nothing at
|
|
14
|
+
* all. Every renderer below prints a code it does not know verbatim, with this hint, and never falls silent.
|
|
15
|
+
*/
|
|
16
|
+
exports.RECOVERY_HOLD_CODES = [
|
|
17
|
+
'review_required',
|
|
18
|
+
'executor_stop_unconfirmed',
|
|
19
|
+
'recovery_pending',
|
|
20
|
+
];
|
|
21
|
+
exports.RECOVERY_EXECUTOR_CODES = [
|
|
22
|
+
'unknown',
|
|
23
|
+
'stop_unconfirmed',
|
|
24
|
+
'quiescent',
|
|
25
|
+
];
|
|
26
|
+
exports.RECOVERY_CLOSE_CODES = [
|
|
27
|
+
'available',
|
|
28
|
+
'executor_stop_unconfirmed',
|
|
29
|
+
'machine_call_unanswered',
|
|
30
|
+
'worker_stop_unconfirmed',
|
|
31
|
+
'tool_calls_unrecorded',
|
|
32
|
+
'effect_boundary',
|
|
33
|
+
];
|
|
34
|
+
exports.UNKNOWN_CODE_HINT = 'this CLI does not know it; update the CLI (`skrr update`) for details';
|
|
35
|
+
/** A code as this CLI prints it: verbatim, and marked when it is not one of `known`. */
|
|
36
|
+
function recoveryCode(value, known) {
|
|
37
|
+
if (typeof value !== 'string' || !value)
|
|
38
|
+
return 'not reported';
|
|
39
|
+
return known.includes(value) ? value : `${value} (${exports.UNKNOWN_CODE_HINT})`;
|
|
40
|
+
}
|
|
8
41
|
/**
|
|
9
42
|
* Read-only. The server independently verifies owner and source authorization.
|
|
10
43
|
*
|
|
@@ -63,8 +96,11 @@ class AgentsAlwaysOnRecoveryReview extends base_command_1.BaseCommand {
|
|
|
63
96
|
if (review.source === 'unverified')
|
|
64
97
|
this.log("Duty: not shown; this run's link to its Duty could not be verified");
|
|
65
98
|
this.log(`Status: ${review.status}; generation: ${review.generation ?? 'unknown'}; attempt: ${review.attempt ?? 'unknown'}`);
|
|
66
|
-
this.log(`Recovery: ${review.hold}; stored result: ${review.result}`);
|
|
67
|
-
this.log(`Executor: ${review.executor}; effects: ${review.effects}`);
|
|
99
|
+
this.log(`Recovery: ${recoveryCode(review.hold, exports.RECOVERY_HOLD_CODES)}; stored result: ${review.result}`);
|
|
100
|
+
this.log(`Executor: ${recoveryCode(review.executor, exports.RECOVERY_EXECUTOR_CODES)}; effects: ${review.effects}`);
|
|
101
|
+
const basis = stopBasisLine(review);
|
|
102
|
+
if (basis)
|
|
103
|
+
this.log(basis);
|
|
68
104
|
const receipts = receiptLine(review);
|
|
69
105
|
if (receipts)
|
|
70
106
|
this.log(receipts);
|
|
@@ -156,6 +192,22 @@ function closeLines(agentId, review) {
|
|
|
156
192
|
'Close: not yet. The machine that ran this turn has not confirmed it stopped; bring it online and read this again.',
|
|
157
193
|
];
|
|
158
194
|
}
|
|
195
|
+
// OSK-24681: a turn the cloud worker ran with a machine's tools. Only an unanswered call sends the owner to the machine.
|
|
196
|
+
if (review.close === 'machine_call_unanswered') {
|
|
197
|
+
return [
|
|
198
|
+
'Close: not yet. A tool call this turn sent to its machine has not been answered and may still be running there; bring that machine online so it can answer, then read this again. If it stays offline, the close becomes possible once that call is past its time limit, or once that machine is a Hosted Machine that has been terminated.',
|
|
199
|
+
];
|
|
200
|
+
}
|
|
201
|
+
if (review.close === 'worker_stop_unconfirmed') {
|
|
202
|
+
return [
|
|
203
|
+
'Close: not yet. The cloud worker that ran this turn has not been confirmed stopped; read this again later (usually within minutes of that worker being replaced).',
|
|
204
|
+
];
|
|
205
|
+
}
|
|
206
|
+
if (review.close === 'tool_calls_unrecorded') {
|
|
207
|
+
return [
|
|
208
|
+
'Close: not yet. This turn sent tool calls to a machine without keeping a record of them. If the release that ran it gave every call a time limit, recovery confirms that none is still running about an hour after the cloud worker that ran it stopped; read this again then. Otherwise it cannot be closed.',
|
|
209
|
+
];
|
|
210
|
+
}
|
|
159
211
|
if (review.close === 'effect_boundary') {
|
|
160
212
|
return [
|
|
161
213
|
boundary
|
|
@@ -163,8 +215,34 @@ function closeLines(agentId, review) {
|
|
|
163
215
|
: 'Close: not available. This Run started applying its result, and closing it would hide which effects happened.',
|
|
164
216
|
];
|
|
165
217
|
}
|
|
218
|
+
// A close the server offers without the ref it binds to cannot be run; say so rather than print nothing.
|
|
219
|
+
if (review.close === 'available') {
|
|
220
|
+
return [
|
|
221
|
+
'Close: available, but the server named no hold ref to close it with. Read this review again.',
|
|
222
|
+
];
|
|
223
|
+
}
|
|
224
|
+
// A code newer than this CLI (OSK-24685): verbatim, never silence.
|
|
225
|
+
const close = review.close;
|
|
226
|
+
if (typeof close === 'string' && close)
|
|
227
|
+
return [`Close: ${close} (${exports.UNKNOWN_CODE_HINT}).`];
|
|
166
228
|
return [];
|
|
167
229
|
}
|
|
230
|
+
/** Where a time bound came from: the claim recorded it, or the analysis of releases before claims recorded one. */
|
|
231
|
+
const BOUND_FROM_TEXT = {
|
|
232
|
+
claim: ', recorded by the claim',
|
|
233
|
+
legacy_unstamped: ', the bound for releases before claims recorded one',
|
|
234
|
+
};
|
|
235
|
+
/** What the executor's proven stop rests on, when not the record of its machine calls (OSK-24685); the close records it. */
|
|
236
|
+
function stopBasisLine(review) {
|
|
237
|
+
const basis = review.stopBasis;
|
|
238
|
+
if (basis?.basis === 'time_bound') {
|
|
239
|
+
const from = BOUND_FROM_TEXT[basis.boundFrom] ?? '';
|
|
240
|
+
return `Stop basis: time bound, ${Math.round(basis.boundMs / 60_000)} minutes${from}. The cloud worker stopped at ${basis.workerStoppedAt}; no tool call it sent could run past ${basis.closableAt}.`;
|
|
241
|
+
}
|
|
242
|
+
if (basis?.basis === 'machine_terminated')
|
|
243
|
+
return `Stop basis: machine terminated. Every tool call still unanswered went to Hosted Machine ${basis.machineId}, terminated at ${basis.terminatedAt}.`;
|
|
244
|
+
return undefined;
|
|
245
|
+
}
|
|
168
246
|
/** What the boundary's receipts settled, by class. Every class not named stays unknown, which the line says. */
|
|
169
247
|
function receiptLine(review) {
|
|
170
248
|
const receipts = review.effectReceipts;
|
|
@@ -191,7 +269,7 @@ function reviewLine(review) {
|
|
|
191
269
|
return [
|
|
192
270
|
review.runId,
|
|
193
271
|
review.source === 'unverified' ? 'duty unverified' : `duty ${review.dutyId ?? 'unknown'}`,
|
|
194
|
-
`recovery: ${review.hold}`,
|
|
272
|
+
`recovery: ${recoveryCode(review.hold, exports.RECOVERY_HOLD_CODES)}`,
|
|
195
273
|
`stored result: ${stored}`,
|
|
196
274
|
`run status: ${review.status}`,
|
|
197
275
|
`attempt: ${review.attempt ?? 'unknown'}`,
|
|
@@ -64,7 +64,11 @@ class AgentsAlwaysOnStatus extends base_command_1.BaseCommand {
|
|
|
64
64
|
}
|
|
65
65
|
: null;
|
|
66
66
|
if (flags.json) {
|
|
67
|
-
this.log(JSON.stringify({
|
|
67
|
+
this.log(JSON.stringify({
|
|
68
|
+
...status,
|
|
69
|
+
agentRuntime: runtime,
|
|
70
|
+
...(workspaceSelection ? { workspaceSelection } : {}),
|
|
71
|
+
}, null, 2));
|
|
68
72
|
return;
|
|
69
73
|
}
|
|
70
74
|
this.log(`Agent: ${args.id}`);
|
|
@@ -126,6 +130,11 @@ class AgentsAlwaysOnStatus extends base_command_1.BaseCommand {
|
|
|
126
130
|
const waitingOnClaim = (0, data_provider_1.describeRunClaimRefusalSummary)(cr?.claimRefusals);
|
|
127
131
|
if (waitingOnClaim)
|
|
128
132
|
this.log(`Waiting: ${waitingOnClaim}`);
|
|
133
|
+
// Which Runs, so the wait can be read (`skrr triggers fire-detail`) or, for one held by the stop check, released
|
|
134
|
+
// (OSK-24545). A server that does not name them prints nothing here.
|
|
135
|
+
for (const line of (0, data_provider_1.describeRunClaimHeldRuns)(cr?.claimRefusals, args.id)) {
|
|
136
|
+
this.log(`Held: ${line}`);
|
|
137
|
+
}
|
|
129
138
|
if (status.messaging?.degraded) {
|
|
130
139
|
const reasons = (status.messaging.degradedReasons || []).join(', ') || 'unknown';
|
|
131
140
|
this.log(`Messaging: degraded (${reasons})`);
|
|
@@ -283,6 +283,16 @@ class AgentsDelete extends base_command_1.BaseCommand {
|
|
|
283
283
|
response = await data_provider_1.dataService.deleteAgent({ agent_id: args.id });
|
|
284
284
|
}
|
|
285
285
|
catch (err) {
|
|
286
|
+
// A held Run refuses the delete until its owner reviews and closes it (OSK-24684). Name each Run and the
|
|
287
|
+
// commands that resolve it, not the generic conflict.
|
|
288
|
+
const held = (0, data_provider_1.readAgentDeleteHeldRuns)((0, http_error_1.httpBodyOf)(err));
|
|
289
|
+
if (held) {
|
|
290
|
+
if (flags.json) {
|
|
291
|
+
this.printJsonResult({ ...held, agentId: args.id, deleted: false }, { ok: false });
|
|
292
|
+
this.exit(1);
|
|
293
|
+
}
|
|
294
|
+
this.error((0, data_provider_1.agentDeleteHeldRunsLines)(held).join('\n'), { exit: 1 });
|
|
295
|
+
}
|
|
286
296
|
if (!isDeleteInProgressRefusal(err))
|
|
287
297
|
this.handleApiError(err);
|
|
288
298
|
alreadyRunning = true;
|
|
@@ -39,6 +39,12 @@ export default class BalanceStatement extends BaseCommand {
|
|
|
39
39
|
};
|
|
40
40
|
run(): Promise<void>;
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* The statement line for the Amazon Bedrock premium inside a charge (OSK-24650): it is part of
|
|
44
|
+
* the charge above it, not a second charge, so it says "incl." and carries the reason in place of
|
|
45
|
+
* a source.
|
|
46
|
+
*/
|
|
47
|
+
export declare function routePremiumRow(premium: NonNullable<BalanceStatementEntry['routePremium']>, currency: string): Record<string, string>;
|
|
42
48
|
/**
|
|
43
49
|
* OSK-7641 — the ledger's default page is the OLDEST one, and nothing said so.
|
|
44
50
|
*
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.routePremiumRow = routePremiumRow;
|
|
3
4
|
exports.statementWindowLine = statementWindowLine;
|
|
4
5
|
exports.statementMoreRowsHint = statementMoreRowsHint;
|
|
5
6
|
exports.statementAmount = statementAmount;
|
|
@@ -142,31 +143,36 @@ class BalanceStatement extends base_command_1.BaseCommand {
|
|
|
142
143
|
hasMore: Boolean(wantNewestFirst ? statement.nextBeforeEntryId : statement.nextAfterEntryId),
|
|
143
144
|
}));
|
|
144
145
|
this.log('');
|
|
145
|
-
(0, format_1.renderTable)(entries.
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
146
|
+
(0, format_1.renderTable)(entries.flatMap((entry) => [
|
|
147
|
+
{
|
|
148
|
+
when: entry.createdAt ? String(entry.createdAt).slice(0, 19).replace('T', ' ') : '-',
|
|
149
|
+
event: (0, format_1.formatCell)(entry.eventType),
|
|
150
|
+
service: (0, format_1.formatCell)(entry.service),
|
|
151
|
+
model: (0, balance_1.displayModel)(entry.model),
|
|
152
|
+
// Which skrr product/harness billed it (the first-party harness, hosted,
|
|
153
|
+
// …). It was in --json but never printed, so a human could not tell a code
|
|
154
|
+
// session from a hosted run (OSK-4825). Canonical spelling, so a ledger
|
|
155
|
+
// written on both sides of a rename does not show one harness as two.
|
|
156
|
+
provider: (0, format_1.formatCell)(typeof entry.provider === 'string'
|
|
157
|
+
? (0, harness_provider_input_1.canonicalHarnessInput)(entry.provider)
|
|
158
|
+
: entry.provider),
|
|
159
|
+
// OSK-7641 — the command promises "what incurred it", and a bare
|
|
160
|
+
// session UUID does not answer that for anyone running more than one
|
|
161
|
+
// agent. Blank rather than '-' when the producer did not record one, so
|
|
162
|
+
// an unattributed row does not look like an attributed one.
|
|
163
|
+
agent: entry.agentId ? String(entry.agentId) : '',
|
|
164
|
+
// The answer to "which session was this?" — the thing the legacy view
|
|
165
|
+
// could never name, and the reason that view read as unexplainable. The
|
|
166
|
+
// compound sourceId already encodes the source type in its first
|
|
167
|
+
// segment, so it is shown in FULL here: capping it at 34 chars cut the
|
|
168
|
+
// id off before it began, leaving every row an identical prefix.
|
|
169
|
+
source: entry.sourceId ? entry.sourceId : (0, format_1.formatCell)(entry.sourceType),
|
|
170
|
+
amount: statementAmount(entry, currency),
|
|
171
|
+
},
|
|
172
|
+
// A Bedrock premium the person paid is its own line, with why and until when, so it is
|
|
173
|
+
// never mistaken for the list price (OSK-24650).
|
|
174
|
+
...(entry.routePremium ? [routePremiumRow(entry.routePremium, currency)] : []),
|
|
175
|
+
]), [
|
|
170
176
|
{ key: 'when', header: 'WHEN' },
|
|
171
177
|
{ key: 'event', header: 'EVENT', maxWidth: 14 },
|
|
172
178
|
{ key: 'service', header: 'SERVICE', maxWidth: 20 },
|
|
@@ -198,6 +204,24 @@ class BalanceStatement extends base_command_1.BaseCommand {
|
|
|
198
204
|
}
|
|
199
205
|
}
|
|
200
206
|
exports.default = BalanceStatement;
|
|
207
|
+
/**
|
|
208
|
+
* The statement line for the Amazon Bedrock premium inside a charge (OSK-24650): it is part of
|
|
209
|
+
* the charge above it, not a second charge, so it says "incl." and carries the reason in place of
|
|
210
|
+
* a source.
|
|
211
|
+
*/
|
|
212
|
+
function routePremiumRow(premium, currency) {
|
|
213
|
+
const until = premium.until ? ` until ${String(premium.until).slice(0, 10)}` : '';
|
|
214
|
+
return {
|
|
215
|
+
when: '',
|
|
216
|
+
event: ' incl.',
|
|
217
|
+
service: 'Bedrock premium',
|
|
218
|
+
model: '',
|
|
219
|
+
provider: '',
|
|
220
|
+
agent: '',
|
|
221
|
+
source: `Amazon Bedrock was preferred${until}`,
|
|
222
|
+
amount: (0, balance_1.formatMicros)(premium.amountMicros, currency),
|
|
223
|
+
};
|
|
224
|
+
}
|
|
201
225
|
/**
|
|
202
226
|
* OSK-7641 — the ledger's default page is the OLDEST one, and nothing said so.
|
|
203
227
|
*
|
|
@@ -118,6 +118,15 @@ class DutiesDelete extends base_command_1.BaseCommand {
|
|
|
118
118
|
if (work.openTasksLeftRunning) {
|
|
119
119
|
this.log(` ${work.openTasksLeftRunning} open task(s) in your scope were not cancelled.`);
|
|
120
120
|
}
|
|
121
|
+
// A Run whose result is held for review is left as it was, kept result and hold included:
|
|
122
|
+
// only its Agent's owner ends a hold, and the delete does not (OSK-24681).
|
|
123
|
+
const held = (result.heldForReview ?? null);
|
|
124
|
+
if (held) {
|
|
125
|
+
const runId = typeof held.runId === 'string' ? held.runId : null;
|
|
126
|
+
const agentId = typeof held.agentId === 'string' ? held.agentId : null;
|
|
127
|
+
this.log(` A Run of this Duty${runId ? ` (${runId})` : ''} has a result held for review. The delete left it held.`);
|
|
128
|
+
this.log(` Review it with: skrr agents always-on recovery-review ${agentId ?? '<agent-id>'}${runId ? ` ${runId}` : ''}`);
|
|
129
|
+
}
|
|
121
130
|
this.log(' The work preview covered only your account and this Duty’s workspace; other related work may remain.');
|
|
122
131
|
this.log(` Restore it with: skrr duties restore ${String(duty.id ?? args.id)}`);
|
|
123
132
|
}
|
package/dist/lib/balance.d.ts
CHANGED
|
@@ -244,6 +244,16 @@ export interface BalanceStatementEntry {
|
|
|
244
244
|
sourceId?: string;
|
|
245
245
|
priceBookVersion: string | null;
|
|
246
246
|
createdAt: string;
|
|
247
|
+
/**
|
|
248
|
+
* The share of this charge that was Amazon Bedrock's reviewed premium (OSK-24650): present only
|
|
249
|
+
* when a declared, time-boxed preference for Bedrock was in force and a preferred Bedrock member
|
|
250
|
+
* served the request. `until` is when that preference ended. Absent on a list-price charge.
|
|
251
|
+
*/
|
|
252
|
+
routePremium?: {
|
|
253
|
+
amountMicros: number;
|
|
254
|
+
reason: 'bedrock_preferred';
|
|
255
|
+
until: string | null;
|
|
256
|
+
};
|
|
247
257
|
}
|
|
248
258
|
export interface BalanceStatement {
|
|
249
259
|
balance: {
|
package/dist/lib/duties.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ import { type DutyAuthoringSnapshot, type DutyAuthoringWarning, type DutyObserva
|
|
|
18
18
|
* "hold this state", derived from a Compass invariant — not authored here).
|
|
19
19
|
*/
|
|
20
20
|
import { DUTY_WATCHED_SOURCES, DUTY_TEMPLATE_IDS, DUTY_CADENCE_MODES, DUTY_CADENCE_TIME_PATTERN, DUTY_CADENCE_MAX_TIMES, DUTY_EXECUTION_ISOLATION_MODES, DUTY_STATUSES, DUTY_KIND_VALUES } from '@skrr-ai/data-provider';
|
|
21
|
-
import type { DutyCheck, DutyChecksResponse, Duty, DutyRevisionReceipt, DutyUpdateResponse, DutyActionProposal, DutyListResponse, DutyPlanResponse, DutyScheduleIssue, DutyStatusResponse, DutyWorkLink, DutyExecutionReceiptListResponse, DutyExecutionReceiptQuarterlyMetricsResponse, DutyCapabilitySource, DutyDeliveryPatchResponse, DutyDeliveryBundleResponse, DutyCyclesResponse, DutyExplanationResponse, DutyRunPermissions, DutyLoopStatus, DutyRoster } from '@skrr-ai/data-provider';
|
|
21
|
+
import type { DutyCheck, DutyChecksResponse, Duty, DutyRevisionReceipt, DutyUpdateResponse, DutyActionProposal, DutyListResponse, DutyPlanResponse, DutyScheduleIssue, DutyStatusResponse, DutyWorkLink, DutyExecutionReceiptListResponse, DutyExecutionReceiptQuarterlyMetricsResponse, DutyCapabilitySource, DutyDeliveryPatchResponse, DutyDeliveryBundleResponse, DutyCycle, DutyCyclesResponse, DutyExplanationResponse, DutyRunPermissions, DutyLoopStatus, DutyRoster } from '@skrr-ai/data-provider';
|
|
22
22
|
import { withQuery } from './triggers';
|
|
23
23
|
export { DUTY_WATCHED_SOURCES, DUTY_TEMPLATE_IDS, DUTY_CADENCE_MODES, DUTY_CADENCE_TIME_PATTERN, DUTY_CADENCE_MAX_TIMES, DUTY_STATUSES, DUTY_KIND_VALUES, };
|
|
24
24
|
export type { DutyCheck, DutyChecksResponse, Duty, DutyActionProposal, DutyListResponse, DutyPlanResponse, DutyStatusResponse, DutyWorkLink, };
|
|
@@ -1142,6 +1142,10 @@ type ReadModelRecord = Record<string, unknown>;
|
|
|
1142
1142
|
export declare function renderDutyLedger(ledger: ReadModelRecord, log: (line: string) => void): void;
|
|
1143
1143
|
export declare function renderDutyTrace(trace: ReadModelRecord, log: (line: string) => void): void;
|
|
1144
1144
|
export declare function renderProactivenessScorecard(scorecard: ReadModelRecord, log: (line: string) => void): void;
|
|
1145
|
+
/** A run the server marks as held for its owner's result recovery review (OSK-24685). */
|
|
1146
|
+
export declare function isHeldCycleRun(run: DutyCycle['runs'][number]): boolean;
|
|
1147
|
+
/** The review command for a held run, naming its Agent when the server did. */
|
|
1148
|
+
export declare function heldRunReviewCommand(run: DutyCycle['runs'][number]): string;
|
|
1145
1149
|
/**
|
|
1146
1150
|
* One line per Cycle:
|
|
1147
1151
|
* `09-22 12:04 ● stopped act duty_execution_budget_exhausted — Raise maxRunsPerDay…`
|
package/dist/lib/duties.js
CHANGED
|
@@ -45,6 +45,8 @@ exports.renderCheckList = renderCheckList;
|
|
|
45
45
|
exports.renderDutyLedger = renderDutyLedger;
|
|
46
46
|
exports.renderDutyTrace = renderDutyTrace;
|
|
47
47
|
exports.renderProactivenessScorecard = renderProactivenessScorecard;
|
|
48
|
+
exports.isHeldCycleRun = isHeldCycleRun;
|
|
49
|
+
exports.heldRunReviewCommand = heldRunReviewCommand;
|
|
48
50
|
exports.formatDutyCycles = formatDutyCycles;
|
|
49
51
|
exports.hypothesisRefusalLines = hypothesisRefusalLines;
|
|
50
52
|
exports.wakeOutcomeLines = wakeOutcomeLines;
|
|
@@ -1027,10 +1029,11 @@ function renderDutyList(duties, log) {
|
|
|
1027
1029
|
evidence: o.assessment?.evidence ?? 'unavailable',
|
|
1028
1030
|
// `blocked` + `operation_read_unavailable` is "no sweep has recorded an operation for this
|
|
1029
1031
|
// contract yet", which `show` then reads live as ready: the bare `blocked` here read as a
|
|
1030
|
-
// refusal and contradicted it (OSK-22586).
|
|
1032
|
+
// refusal and contradicted it (OSK-22586). A Duty that is not active reads as its own status
|
|
1033
|
+
// (`paused`), never `waiting` (OSK-24685).
|
|
1031
1034
|
operation: o.assessment?.operationReason === 'operation_read_unavailable'
|
|
1032
1035
|
? 'not read yet'
|
|
1033
|
-
: (o.assessment
|
|
1036
|
+
: (0, data_provider_2.dutyOperationLabel)(o.assessment),
|
|
1034
1037
|
cadence: cadenceLabel(o),
|
|
1035
1038
|
agent: o.agentId ?? '-',
|
|
1036
1039
|
})), [
|
|
@@ -1198,6 +1201,8 @@ function describeStoppedMachine(wake) {
|
|
|
1198
1201
|
*/
|
|
1199
1202
|
const OPERATION_REASON_WORDS = {
|
|
1200
1203
|
runtime_duty_contract_unavailable: 'the selected runtime cannot enforce this Duty; repository work needs a Hosted Machine or a capable local harness',
|
|
1204
|
+
// OSK-24685: every open Run is held for result recovery review, and only the Agent owner ends it.
|
|
1205
|
+
result_held_for_review: 'a run is held for result recovery review, and every Check stops until the Agent owner closes it (`skrr agents always-on recovery-review <agent-id>`)',
|
|
1201
1206
|
};
|
|
1202
1207
|
function operationReasonWords(reason) {
|
|
1203
1208
|
return typeof reason === 'string' ? OPERATION_REASON_WORDS[reason] : undefined;
|
|
@@ -2073,21 +2078,43 @@ function cycleSummary(cycle) {
|
|
|
2073
2078
|
: 'applied an agent result';
|
|
2074
2079
|
}
|
|
2075
2080
|
if (cycle.outcome === 'in_flight') {
|
|
2076
|
-
const
|
|
2077
|
-
if (!
|
|
2081
|
+
const all = cycle.runs ?? [];
|
|
2082
|
+
if (!all.length)
|
|
2078
2083
|
return 'check still running';
|
|
2079
|
-
// A run
|
|
2080
|
-
//
|
|
2081
|
-
const
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2084
|
+
// A run held for its owner's review is not "still going" either (OSK-24685): nothing will finish it. Its
|
|
2085
|
+
// own line below names the review command; the count here leaves it out.
|
|
2086
|
+
const held = all.filter(isHeldCycleRun);
|
|
2087
|
+
const runs = all.filter((run) => !isHeldCycleRun(run));
|
|
2088
|
+
const heldNote = held.length ? `${held.length} run(s) held for review` : '';
|
|
2089
|
+
if (!runs.length)
|
|
2090
|
+
return heldNote;
|
|
2091
|
+
const going = cycleRunsGoing(runs);
|
|
2092
|
+
return heldNote ? `${going}; ${heldNote}` : going;
|
|
2088
2093
|
}
|
|
2089
2094
|
return cycle.note || cycle.decision?.summary || cycle.decision?.posture || 'nothing to act on';
|
|
2090
2095
|
}
|
|
2096
|
+
/** A run the server marks as held for its owner's result recovery review (OSK-24685). */
|
|
2097
|
+
function isHeldCycleRun(run) {
|
|
2098
|
+
const held = run.heldForReview;
|
|
2099
|
+
return Boolean(held) && typeof held === 'object';
|
|
2100
|
+
}
|
|
2101
|
+
/** The review command for a held run, naming its Agent when the server did. */
|
|
2102
|
+
function heldRunReviewCommand(run) {
|
|
2103
|
+
const agentId = run.heldForReview?.agentId;
|
|
2104
|
+
return `skrr agents always-on recovery-review ${typeof agentId === 'string' && agentId ? agentId : '<agent-id>'} ${run.id}`;
|
|
2105
|
+
}
|
|
2106
|
+
/** Pending runs that are not held: running, or parked for a runtime with the reason named once. */
|
|
2107
|
+
function cycleRunsGoing(runs) {
|
|
2108
|
+
// A run parked for a runtime is not "still going" (OSK-23379): it has not started, and the server
|
|
2109
|
+
// says why (`waiting`), so the row says parked and names the reason once.
|
|
2110
|
+
const parked = runs.filter((run) => run.waiting);
|
|
2111
|
+
if (!parked.length)
|
|
2112
|
+
return `${runs.length} run(s) still going`;
|
|
2113
|
+
const why = [...new Set(parked.map((run) => run.waiting?.summary))].join('; ');
|
|
2114
|
+
return parked.length === runs.length
|
|
2115
|
+
? `${parked.length} run(s) parked — ${why}`
|
|
2116
|
+
: `${runs.length - parked.length} running, ${parked.length} parked — ${why}`;
|
|
2117
|
+
}
|
|
2091
2118
|
/** A record-only follow-through says what it is, and what it noted, instead of claiming progress. */
|
|
2092
2119
|
function recordOnlyEchoSummary(cycle) {
|
|
2093
2120
|
const noted = cycle.advancementKinds?.length
|
|
@@ -2159,6 +2186,8 @@ function formatDutyCycles(page) {
|
|
|
2159
2186
|
lines.push(` ${line}`);
|
|
2160
2187
|
for (const line of wakeOutcomeLines(run))
|
|
2161
2188
|
lines.push(` ${line}`);
|
|
2189
|
+
if (isHeldCycleRun(run))
|
|
2190
|
+
lines.push(` run ${run.id} held for review — review it with \`${heldRunReviewCommand(run)}\``);
|
|
2162
2191
|
if (!['machine', 'contract', 'work'].includes(run.failureClass))
|
|
2163
2192
|
continue;
|
|
2164
2193
|
const owner = run.failureOwner === 'model' ? 'model' : run.failureOwner || 'work';
|
|
@@ -252,9 +252,29 @@ function formatDutyLoopStatus(status) {
|
|
|
252
252
|
if (wait.fix)
|
|
253
253
|
lines.push(` Fix: ${wait.fix}`);
|
|
254
254
|
}
|
|
255
|
+
// Pending runs held for their owner's review (OSK-24685): counted above, never working, and each named with the
|
|
256
|
+
// command that reviews it. Read defensively: a server that predates the field sends none.
|
|
257
|
+
const held = heldRuns(status);
|
|
258
|
+
if (held.runs.length) {
|
|
259
|
+
lines.push(` Held: ${runCount(held.count)} held for result recovery review`);
|
|
260
|
+
for (const run of held.runs) {
|
|
261
|
+
lines.push(` ${run.runId}: skrr agents always-on recovery-review ${run.agentId || '<agent-id>'} ${run.runId}`);
|
|
262
|
+
}
|
|
263
|
+
if (held.count > held.runs.length)
|
|
264
|
+
lines.push(` ... and ${held.count - held.runs.length} more`);
|
|
265
|
+
}
|
|
255
266
|
lines.push(` Runs today: ${runs(status)} Spend today: ${spend(status)}`);
|
|
256
267
|
return lines;
|
|
257
268
|
}
|
|
269
|
+
/** The server's held runs, as many as it named, and how many there are. Empty from a server that sends none. */
|
|
270
|
+
function heldRuns(status) {
|
|
271
|
+
const pending = status.pendingWork;
|
|
272
|
+
const runs = (Array.isArray(pending?.heldForReview) ? pending.heldForReview : []).filter((run) => Boolean(run) && typeof run.runId === 'string');
|
|
273
|
+
const count = typeof pending?.heldForReviewCount === 'number' && pending.heldForReviewCount >= runs.length
|
|
274
|
+
? pending.heldForReviewCount
|
|
275
|
+
: runs.length;
|
|
276
|
+
return { runs, count };
|
|
277
|
+
}
|
|
258
278
|
/** The server's grouped reasons for runs that have not started. Empty from a server that sends none. */
|
|
259
279
|
function waitingRuns(status) {
|
|
260
280
|
const waiting = status.pendingWork?.waiting;
|