@skrr-ai/cli 0.1.192 → 0.1.194
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/base-command.js +18 -0
- package/dist/commands/agents/always-on/recovery-review.js +2 -1
- package/dist/commands/duties/action-proposals/decide.js +29 -5
- package/dist/commands/duties/endpoints/health.d.ts +1 -7
- package/dist/commands/duties/endpoints/health.js +13 -21
- package/dist/commands/duties/pack/bind.d.ts +2 -1
- package/dist/commands/duties/pack/bind.js +36 -12
- package/dist/commands/duties/pack/plan.d.ts +2 -1
- package/dist/commands/duties/pack/plan.js +35 -14
- package/dist/commands/duties/pack/preflight.js +4 -4
- package/dist/commands/duties/preflight.d.ts +1 -1
- package/dist/commands/duties/preflight.js +3 -0
- package/dist/commands/duties/reports.d.ts +1 -0
- package/dist/commands/duties/reports.js +52 -15
- package/dist/commands/harnesses/evaluations/fixed-tool.js +5 -2
- package/dist/commands/machines/hosted/list.js +13 -1
- package/dist/commands/machines/hosted/status.js +3 -0
- package/dist/commands/tasks/start.js +3 -2
- package/dist/lib/duties.d.ts +9 -0
- package/dist/lib/duties.js +19 -4
- package/dist/lib/duty-endpoints.d.ts +1 -1
- package/dist/lib/duty-endpoints.js +1 -1
- package/dist/lib/duty-event-wakes.js +3 -2
- package/dist/lib/duty-loop-status.js +2 -2
- package/dist/lib/hosted-machines.d.ts +21 -0
- package/dist/lib/hosted-machines.js +112 -1
- package/dist/lib/task-admission.d.ts +1 -0
- package/dist/lib/task-admission.js +16 -1
- package/dist/lib/task-preflight.js +3 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessPermissionControls.d.ts +1 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessPermissionControls.js +7 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessPermissionControls.d.ts +1 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessPermissionControls.js +9 -1
- package/dist/node_modules/@skrr-ai/data-provider/index.js +10029 -9990
- package/oclif.manifest.json +59 -20
- package/package.json +2 -2
package/dist/lib/duties.d.ts
CHANGED
|
@@ -58,6 +58,10 @@ export type DutyListPage = {
|
|
|
58
58
|
};
|
|
59
59
|
};
|
|
60
60
|
export type DutyPreflightReport = {
|
|
61
|
+
sourcePolicy?: {
|
|
62
|
+
status: 'partial';
|
|
63
|
+
reason: 'current_contract_only';
|
|
64
|
+
};
|
|
61
65
|
verdict: 'ready' | 'needs_review' | 'blocked';
|
|
62
66
|
capabilities?: DutyCapabilitySource[];
|
|
63
67
|
gates: Array<{
|
|
@@ -1144,6 +1148,11 @@ export declare function renderDutyTrace(trace: ReadModelRecord, log: (line: stri
|
|
|
1144
1148
|
export declare function renderProactivenessScorecard(scorecard: ReadModelRecord, log: (line: string) => void): void;
|
|
1145
1149
|
/** A run the server marks as held for its owner's result recovery review (OSK-24685). */
|
|
1146
1150
|
export declare function isHeldCycleRun(run: DutyCycle['runs'][number]): boolean;
|
|
1151
|
+
/**
|
|
1152
|
+
* The code a held run's result failed with, when the server names it (OSK-24471). A held run stays
|
|
1153
|
+
* `running`, so its `failureCode` is null and this is the only place the code is said.
|
|
1154
|
+
*/
|
|
1155
|
+
export declare function heldRunFailureCode(run: DutyCycle['runs'][number]): string | null;
|
|
1147
1156
|
/** The review command for a held run, naming its Agent when the server did. */
|
|
1148
1157
|
export declare function heldRunReviewCommand(run: DutyCycle['runs'][number]): string;
|
|
1149
1158
|
/**
|
package/dist/lib/duties.js
CHANGED
|
@@ -46,6 +46,7 @@ exports.renderDutyLedger = renderDutyLedger;
|
|
|
46
46
|
exports.renderDutyTrace = renderDutyTrace;
|
|
47
47
|
exports.renderProactivenessScorecard = renderProactivenessScorecard;
|
|
48
48
|
exports.isHeldCycleRun = isHeldCycleRun;
|
|
49
|
+
exports.heldRunFailureCode = heldRunFailureCode;
|
|
49
50
|
exports.heldRunReviewCommand = heldRunReviewCommand;
|
|
50
51
|
exports.formatDutyCycles = formatDutyCycles;
|
|
51
52
|
exports.hypothesisRefusalLines = hypothesisRefusalLines;
|
|
@@ -1834,7 +1835,7 @@ function renderDutyLedger(ledger, log) {
|
|
|
1834
1835
|
turns: describeRunCount(record(item.usage), 'turns'),
|
|
1835
1836
|
tools: describeRunCount(record(item.usage), 'toolCallCount'),
|
|
1836
1837
|
reason: text(firstValue(item, ['reason', 'error']), ''),
|
|
1837
|
-
finished: text(firstValue(item, ['completedAt', 'updatedAt', 'startedAt'])),
|
|
1838
|
+
finished: text(firstValue(item, ['completedAt', 'updatedAt', 'claimedAt', 'queuedAt', 'reservedAt', 'startedAt'])),
|
|
1838
1839
|
})), [
|
|
1839
1840
|
{ key: 'id', header: 'RUN ID', verbatim: true },
|
|
1840
1841
|
{ key: 'status', header: 'STATUS', maxWidth: 12 },
|
|
@@ -2002,9 +2003,13 @@ function scorecardQualifier(coverage) {
|
|
|
2002
2003
|
}
|
|
2003
2004
|
function renderProactivenessScorecard(scorecard, log) {
|
|
2004
2005
|
const coverage = record(scorecard.coverage);
|
|
2006
|
+
log('');
|
|
2007
|
+
if (coverage?.reason === 'historical_duty_relationship_unverified') {
|
|
2008
|
+
log('Proactiveness unavailable. Historical links to this Duty could not be verified, so trace coverage is partial.');
|
|
2009
|
+
return;
|
|
2010
|
+
}
|
|
2005
2011
|
const metrics = record(scorecard.metrics) || {};
|
|
2006
2012
|
const metricCoverage = record(scorecard.metricCoverage) || {};
|
|
2007
|
-
log('');
|
|
2008
2013
|
log(coverage?.partialWindow === true || record(scorecard.window)?.partial === true
|
|
2009
2014
|
? 'Proactiveness (this page only — not the whole window)'
|
|
2010
2015
|
: 'Proactiveness');
|
|
@@ -2098,6 +2103,14 @@ function isHeldCycleRun(run) {
|
|
|
2098
2103
|
const held = run.heldForReview;
|
|
2099
2104
|
return Boolean(held) && typeof held === 'object';
|
|
2100
2105
|
}
|
|
2106
|
+
/**
|
|
2107
|
+
* The code a held run's result failed with, when the server names it (OSK-24471). A held run stays
|
|
2108
|
+
* `running`, so its `failureCode` is null and this is the only place the code is said.
|
|
2109
|
+
*/
|
|
2110
|
+
function heldRunFailureCode(run) {
|
|
2111
|
+
const code = run.heldForReview?.failureCode;
|
|
2112
|
+
return typeof code === 'string' && code ? code : null;
|
|
2113
|
+
}
|
|
2101
2114
|
/** The review command for a held run, naming its Agent when the server did. */
|
|
2102
2115
|
function heldRunReviewCommand(run) {
|
|
2103
2116
|
const agentId = run.heldForReview?.agentId;
|
|
@@ -2186,8 +2199,10 @@ function formatDutyCycles(page) {
|
|
|
2186
2199
|
lines.push(` ${line}`);
|
|
2187
2200
|
for (const line of wakeOutcomeLines(run))
|
|
2188
2201
|
lines.push(` ${line}`);
|
|
2189
|
-
if (isHeldCycleRun(run))
|
|
2190
|
-
|
|
2202
|
+
if (isHeldCycleRun(run)) {
|
|
2203
|
+
const heldCode = heldRunFailureCode(run);
|
|
2204
|
+
lines.push(` run ${run.id} held for review${heldCode ? ` (its turn failed: ${heldCode})` : ''} — review it with \`${heldRunReviewCommand(run)}\``);
|
|
2205
|
+
}
|
|
2191
2206
|
if (!['machine', 'contract', 'work'].includes(run.failureClass))
|
|
2192
2207
|
continue;
|
|
2193
2208
|
const owner = run.failureOwner === 'model' ? 'model' : run.failureOwner || 'work';
|
|
@@ -28,7 +28,7 @@ export declare const dutyEndpointApi: {
|
|
|
28
28
|
/** Legacy compatibility call; new native endpoints do not use OAuth. */
|
|
29
29
|
finalizeConnect: (id: string, body?: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
30
30
|
reconnect: (id: string, body?: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
31
|
-
health: (id: string
|
|
31
|
+
health: (id: string) => Promise<Record<string, unknown>>;
|
|
32
32
|
revoke: (id: string, body?: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
33
33
|
remove: (id: string) => Promise<Record<string, unknown>>;
|
|
34
34
|
};
|
|
@@ -33,7 +33,7 @@ exports.dutyEndpointApi = {
|
|
|
33
33
|
/** Legacy compatibility call; new native endpoints do not use OAuth. */
|
|
34
34
|
finalizeConnect: (id, body = {}) => data_provider_1.request.post(`${base(id)}/connect/finalize`, body),
|
|
35
35
|
reconnect: (id, body = {}) => data_provider_1.request.post(`${base(id)}/reconnect`, body),
|
|
36
|
-
health: (id
|
|
36
|
+
health: (id) => data_provider_1.request.post(`${base(id)}/health`, {}),
|
|
37
37
|
revoke: (id, body = {}) => data_provider_1.request.post(`${base(id)}/revoke`, body),
|
|
38
38
|
remove: (id) => data_provider_1.request.delete(base(id)),
|
|
39
39
|
};
|
|
@@ -12,7 +12,7 @@ function eventWakeLines(caps) {
|
|
|
12
12
|
lines.push('Event wakes:');
|
|
13
13
|
lines.push(` requested: ${caps.requested ? 'yes' : 'no'}`);
|
|
14
14
|
lines.push(` configured sources: ${(caps.configuredSources ?? []).join(', ') || 'none'}`);
|
|
15
|
-
lines.push(`
|
|
15
|
+
lines.push(` sources planned at the current status and cadence: ${(caps.eligibleSources ?? []).join(', ') || 'none'}`);
|
|
16
16
|
lines.push(` materialized sources: ${(caps.materializedSources ?? []).join(', ') || 'none'}`);
|
|
17
17
|
const wakeableWhenActive = caps.wakeableWhenActive ?? [];
|
|
18
18
|
const eventless = caps.eventlessSources ?? [];
|
|
@@ -20,7 +20,8 @@ function eventWakeLines(caps) {
|
|
|
20
20
|
// The server told the causes apart (OSK-22595): a source that would wake once it is active on an
|
|
21
21
|
// event_plus_interval cadence is not the same as one that produces no events.
|
|
22
22
|
if (wakeableWhenActive.length) {
|
|
23
|
-
lines.push(`
|
|
23
|
+
lines.push(` sources planned if active with event_plus_interval: ${wakeableWhenActive.join(', ')} ` +
|
|
24
|
+
'(`skrr duties preflight <id>` lists projected events and readiness; delivery is unverified)');
|
|
24
25
|
}
|
|
25
26
|
if (eventless.length) {
|
|
26
27
|
lines.push(` no event bindings for the current source configuration: ${eventless.join(', ')}` +
|
|
@@ -17,6 +17,7 @@ exports.formatDutyLoopStatus = formatDutyLoopStatus;
|
|
|
17
17
|
*/
|
|
18
18
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
19
19
|
const format_1 = require("./format");
|
|
20
|
+
const iso_instant_1 = require("./iso-instant");
|
|
20
21
|
/** One word per state, with a mark only `healthy` may use. */
|
|
21
22
|
const STATE_LABEL = {
|
|
22
23
|
healthy: '✓ healthy',
|
|
@@ -38,8 +39,7 @@ function when(value) {
|
|
|
38
39
|
const date = new Date(value);
|
|
39
40
|
if (Number.isNaN(date.getTime()))
|
|
40
41
|
return '-';
|
|
41
|
-
|
|
42
|
-
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}`;
|
|
42
|
+
return (0, iso_instant_1.formatUtcInstant)(date).replace('T', ' ').replace(/Z$/, ' UTC');
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
45
|
* Standing health is an optional contract field (added with OSK-17003); read
|
|
@@ -34,6 +34,12 @@ export interface HostedMachineSession {
|
|
|
34
34
|
lastActiveAt?: string | null;
|
|
35
35
|
pausedAt?: string | null;
|
|
36
36
|
retentionExpiresAt?: string | null;
|
|
37
|
+
/** When the machine ended (set on a terminated session the server recorded it for). */
|
|
38
|
+
terminatedAt?: string | null;
|
|
39
|
+
/** Why the PLATFORM ended it, when it did: the monthly cap, a lost plan (OSK-24471). */
|
|
40
|
+
terminationReason?: string | null;
|
|
41
|
+
/** When the monthly cap paused it, files kept and nothing billed (OSK-24471). */
|
|
42
|
+
spendCapPausedAt?: string | null;
|
|
37
43
|
createdAt?: string | null;
|
|
38
44
|
updatedAt?: string | null;
|
|
39
45
|
error?: {
|
|
@@ -86,6 +92,9 @@ export interface HostedMachineListJson {
|
|
|
86
92
|
lastActiveAt?: string;
|
|
87
93
|
pausedAt?: string;
|
|
88
94
|
retentionExpiresAt?: string;
|
|
95
|
+
terminatedAt?: string;
|
|
96
|
+
terminationReason?: string;
|
|
97
|
+
spendCapPausedAt?: string;
|
|
89
98
|
}>;
|
|
90
99
|
}
|
|
91
100
|
export declare function curateHostedMachineList(response: HostedMachineListResponse): HostedMachineListJson;
|
|
@@ -169,6 +178,18 @@ export declare function hostedMachineId(session: HostedMachineSession | undefine
|
|
|
169
178
|
export declare function hostedMachineStatus(session: HostedMachineSession | undefined | null): string;
|
|
170
179
|
export declare function hostedMachineDisplayName(session: HostedMachineSession | undefined | null): string;
|
|
171
180
|
export declare function hostedMachineRepoSummary(session: HostedMachineSession | undefined | null): string;
|
|
181
|
+
/**
|
|
182
|
+
* What a person should read about where a machine's files stand: until when a
|
|
183
|
+
* paused machine keeps them, or, for an ended one, that it ended, when, why
|
|
184
|
+
* when the platform ended it, and that its files went with it. One sentence per
|
|
185
|
+
* line, from the shared copy (`describeHostedMachineEnd`), so `status`, `list`
|
|
186
|
+
* and a refused `resume` say the same thing (OSK-24471). Empty for a live one.
|
|
187
|
+
*/
|
|
188
|
+
export declare function hostedMachineLifecycleLines(session: HostedMachineSession | undefined | null, context?: {
|
|
189
|
+
bin?: string;
|
|
190
|
+
}): string[];
|
|
191
|
+
/** Whether the monthly cap paused this machine and still holds it (OSK-24471). */
|
|
192
|
+
export declare function isSpendCapPaused(session: HostedMachineSession | undefined | null): boolean;
|
|
172
193
|
export declare function hostedMachineErrorSummary(session: HostedMachineSession | undefined | null): string;
|
|
173
194
|
/**
|
|
174
195
|
* Whether tenant code on this machine can read the daemon's credentials
|
|
@@ -7,6 +7,8 @@ exports.hostedMachineId = hostedMachineId;
|
|
|
7
7
|
exports.hostedMachineStatus = hostedMachineStatus;
|
|
8
8
|
exports.hostedMachineDisplayName = hostedMachineDisplayName;
|
|
9
9
|
exports.hostedMachineRepoSummary = hostedMachineRepoSummary;
|
|
10
|
+
exports.hostedMachineLifecycleLines = hostedMachineLifecycleLines;
|
|
11
|
+
exports.isSpendCapPaused = isSpendCapPaused;
|
|
10
12
|
exports.hostedMachineErrorSummary = hostedMachineErrorSummary;
|
|
11
13
|
exports.hostedMachineIsolationSummary = hostedMachineIsolationSummary;
|
|
12
14
|
exports.hostedMachineProgressSummary = hostedMachineProgressSummary;
|
|
@@ -26,6 +28,7 @@ exports.execHostedMachine = execHostedMachine;
|
|
|
26
28
|
exports.getHostedMachineOperation = getHostedMachineOperation;
|
|
27
29
|
exports.waitForHostedMachineReady = waitForHostedMachineReady;
|
|
28
30
|
exports.offlineForLabel = offlineForLabel;
|
|
31
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
29
32
|
const api_fetch_1 = require("./api-fetch");
|
|
30
33
|
const edge_error_page_1 = require("./edge-error-page");
|
|
31
34
|
const machine_spend_cap_1 = require("./machine-spend-cap");
|
|
@@ -54,7 +57,14 @@ function curateHostedMachineList(response) {
|
|
|
54
57
|
const phase = session.provisioning?.phase;
|
|
55
58
|
if (typeof phase === 'string' && phase)
|
|
56
59
|
row.provisioningPhase = phase;
|
|
57
|
-
for (const key of [
|
|
60
|
+
for (const key of [
|
|
61
|
+
'lastActiveAt',
|
|
62
|
+
'pausedAt',
|
|
63
|
+
'retentionExpiresAt',
|
|
64
|
+
'terminatedAt',
|
|
65
|
+
'terminationReason',
|
|
66
|
+
'spendCapPausedAt',
|
|
67
|
+
]) {
|
|
58
68
|
if (typeof session[key] === 'string' && session[key])
|
|
59
69
|
row[key] = session[key];
|
|
60
70
|
}
|
|
@@ -110,6 +120,50 @@ function hostedMachineRepoSummary(session) {
|
|
|
110
120
|
})
|
|
111
121
|
.join(', ');
|
|
112
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* What a person should read about where a machine's files stand: until when a
|
|
125
|
+
* paused machine keeps them, or, for an ended one, that it ended, when, why
|
|
126
|
+
* when the platform ended it, and that its files went with it. One sentence per
|
|
127
|
+
* line, from the shared copy (`describeHostedMachineEnd`), so `status`, `list`
|
|
128
|
+
* and a refused `resume` say the same thing (OSK-24471). Empty for a live one.
|
|
129
|
+
*/
|
|
130
|
+
function hostedMachineLifecycleLines(session, context = {}) {
|
|
131
|
+
const status = hostedMachineStatus(session);
|
|
132
|
+
if (status === 'paused' && isSpendCapPaused(session)) {
|
|
133
|
+
// Paused by the monthly cap: why, that nothing is billed, and how it comes
|
|
134
|
+
// back, with the real lease in the command (OSK-24471).
|
|
135
|
+
const lines = [`Paused by: the monthly spending cap, at ${session.spendCapPausedAt}`];
|
|
136
|
+
if (typeof session?.retentionExpiresAt === 'string') {
|
|
137
|
+
lines.push(`Files kept until: ${session.retentionExpiresAt}`);
|
|
138
|
+
}
|
|
139
|
+
lines.push(`Why: ${(0, data_provider_1.describeHostedMachineCapPause)({
|
|
140
|
+
retentionExpiresAt: session?.retentionExpiresAt ?? null,
|
|
141
|
+
machineLeaseId: typeof session?.machineLeaseId === 'string' ? session.machineLeaseId : null,
|
|
142
|
+
bin: context.bin || 'skrr',
|
|
143
|
+
})}`);
|
|
144
|
+
return lines;
|
|
145
|
+
}
|
|
146
|
+
if (status === 'paused' && typeof session?.retentionExpiresAt === 'string') {
|
|
147
|
+
return [`Files kept until: ${session.retentionExpiresAt}`];
|
|
148
|
+
}
|
|
149
|
+
if (status !== 'terminated')
|
|
150
|
+
return [];
|
|
151
|
+
const lines = [];
|
|
152
|
+
if (typeof session?.terminatedAt === 'string' && session.terminatedAt) {
|
|
153
|
+
lines.push(`Ended: ${session.terminatedAt}`);
|
|
154
|
+
}
|
|
155
|
+
const reason = session?.terminationReason;
|
|
156
|
+
if ((0, data_provider_1.isMachinePlatformEndReason)(reason)) {
|
|
157
|
+
lines.push(`Why: ${(0, data_provider_1.describeHostedMachineEnd)(reason)}`);
|
|
158
|
+
}
|
|
159
|
+
return lines;
|
|
160
|
+
}
|
|
161
|
+
/** Whether the monthly cap paused this machine and still holds it (OSK-24471). */
|
|
162
|
+
function isSpendCapPaused(session) {
|
|
163
|
+
return (hostedMachineStatus(session) === 'paused' &&
|
|
164
|
+
typeof session?.spendCapPausedAt === 'string' &&
|
|
165
|
+
session.spendCapPausedAt.length > 0);
|
|
166
|
+
}
|
|
113
167
|
function hostedMachineErrorSummary(session) {
|
|
114
168
|
const error = session?.error;
|
|
115
169
|
if (!error)
|
|
@@ -192,6 +246,15 @@ function formatHostedMachineApiError(err, context = {}) {
|
|
|
192
246
|
// A monthly-cap refusal carries its figures in `details`; print them, and say
|
|
193
247
|
// this is not the plan or the credits (OSK-11946). The dedicated CLI has done
|
|
194
248
|
// the figures since OSK-9552; the hosted one dropped them.
|
|
249
|
+
// A resume refused at the cap: the box is paused with its files kept, so say
|
|
250
|
+
// until when, and name ITS lease in the command (OSK-24471).
|
|
251
|
+
const capResume = message ? capResumeRefusalDetails(err.body) : null;
|
|
252
|
+
if (capResume) {
|
|
253
|
+
return [
|
|
254
|
+
(0, data_provider_1.describeHostedMachineCapResumeRefusal)({ ...capResume, bin: context.bin || 'skrr' }),
|
|
255
|
+
machine_spend_cap_1.MONTHLY_CAP_IS_SEPARATE,
|
|
256
|
+
].join(' ');
|
|
257
|
+
}
|
|
195
258
|
if (message && (0, machine_spend_cap_1.isMonthlyCapRefusal)(err.body)) {
|
|
196
259
|
const figures = (0, machine_spend_cap_1.describeMonthlyCapFigures)(err.body);
|
|
197
260
|
return [
|
|
@@ -204,9 +267,57 @@ function formatHostedMachineApiError(err, context = {}) {
|
|
|
204
267
|
.filter(Boolean)
|
|
205
268
|
.join(' ');
|
|
206
269
|
}
|
|
270
|
+
// A machine that has ended cannot be resumed at any cap: its files were
|
|
271
|
+
// deleted with it. The server's sentence says why and when; add the one
|
|
272
|
+
// command that does continue the work (OSK-24471).
|
|
273
|
+
if (message && hostedMachineEndedRefusal(err.body)) {
|
|
274
|
+
return (`${message} Start a new one with \`${context.bin || 'skrr'} machines hosted start\`` +
|
|
275
|
+
' (add --spending-limit-cents <n> for a higher monthly cap).');
|
|
276
|
+
}
|
|
207
277
|
const registration = describeRegistrationTimeoutDetails(err.body);
|
|
208
278
|
return message && registration ? `${message} ${registration}` : message;
|
|
209
279
|
}
|
|
280
|
+
/**
|
|
281
|
+
* The facts of a resume the monthly cap refused, or null for any other refusal.
|
|
282
|
+
* The server sends `retentionExpiresAt` with a cap refusal only from the resume
|
|
283
|
+
* of a paused machine, so a refused start keeps its own message.
|
|
284
|
+
*/
|
|
285
|
+
function capResumeRefusalDetails(body) {
|
|
286
|
+
if (!(0, machine_spend_cap_1.isMonthlyCapRefusal)(body))
|
|
287
|
+
return null;
|
|
288
|
+
let details;
|
|
289
|
+
try {
|
|
290
|
+
const parsed = JSON.parse(body);
|
|
291
|
+
details =
|
|
292
|
+
parsed.details && typeof parsed.details === 'object' && !Array.isArray(parsed.details)
|
|
293
|
+
? parsed.details
|
|
294
|
+
: undefined;
|
|
295
|
+
}
|
|
296
|
+
catch {
|
|
297
|
+
return null;
|
|
298
|
+
}
|
|
299
|
+
if (!details || typeof details.retentionExpiresAt !== 'string')
|
|
300
|
+
return null;
|
|
301
|
+
const cents = (key) => typeof details[key] === 'number' && Number.isFinite(details[key])
|
|
302
|
+
? details[key]
|
|
303
|
+
: null;
|
|
304
|
+
const text = (key) => typeof details[key] === 'string' ? details[key] : null;
|
|
305
|
+
return {
|
|
306
|
+
limitCents: cents('limitCents'),
|
|
307
|
+
spendCents: cents('projectedCents') ?? cents('currentSpendCents'),
|
|
308
|
+
retentionExpiresAt: text('retentionExpiresAt'),
|
|
309
|
+
monthResetsAt: text('monthResetsAt'),
|
|
310
|
+
machineLeaseId: text('machineLeaseId'),
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
function hostedMachineEndedRefusal(body) {
|
|
314
|
+
try {
|
|
315
|
+
return JSON.parse(body).code === 'MACHINE_ENDED';
|
|
316
|
+
}
|
|
317
|
+
catch {
|
|
318
|
+
return false;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
210
321
|
/**
|
|
211
322
|
* The predicate a Hosted daemon registration timeout names (OSK-24523). The
|
|
212
323
|
* server's vocabulary is closed (`daemonRegistrationDiagnosis.js`); an unknown
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** The server owns admission; this is a display projection, never a permission grant. */
|
|
2
2
|
import type { TaskExecutionAdmission } from '@skrr-ai/data-provider';
|
|
3
3
|
export type { TaskExecutionAdmission } from '@skrr-ai/data-provider';
|
|
4
|
+
export declare function isAdmissionBlocked(value: TaskExecutionAdmission): boolean;
|
|
4
5
|
export declare function admissionLines(value: TaskExecutionAdmission | null | undefined): string[];
|
|
5
6
|
export declare function isAdmissionPreview(value: unknown): value is {
|
|
6
7
|
dryRun: true;
|
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isAdmissionBlocked = isAdmissionBlocked;
|
|
3
4
|
exports.admissionLines = admissionLines;
|
|
4
5
|
exports.isAdmissionPreview = isAdmissionPreview;
|
|
6
|
+
function isAdmissionBlocked(value) {
|
|
7
|
+
return value.state === 'blocked' || value.ordinarySessionStartGate === 'disabled';
|
|
8
|
+
}
|
|
5
9
|
function admissionLines(value) {
|
|
6
10
|
if (!value)
|
|
7
11
|
return ['Execution admission: not reported by this server.'];
|
|
8
12
|
const lines = [`Approval prerequisites: ${value.state}.`];
|
|
9
13
|
const observation = value.runtimePolicyObservation;
|
|
14
|
+
if (value.ordinarySessionStartGate === 'disabled') {
|
|
15
|
+
lines.push('The selected daemon reported that ordinary session starts are disabled.', 'The daemon owner can enable session starts on that machine with skrr daemon config --profile <profile> --mode claude_session=auto. Use the selected profile, or choose another runtime.');
|
|
16
|
+
}
|
|
17
|
+
else if (value.ordinarySessionStartGate === 'enabled') {
|
|
18
|
+
lines.push('The selected daemon reported that ordinary session starts are enabled.');
|
|
19
|
+
}
|
|
20
|
+
else if (value.ordinarySessionStartGate === 'unknown') {
|
|
21
|
+
lines.push('The selected daemon did not report whether ordinary session starts are enabled.');
|
|
22
|
+
}
|
|
10
23
|
if (value.permission) {
|
|
11
24
|
lines.push(!value.permission.mode &&
|
|
12
25
|
value.permission.source === 'daemon' &&
|
|
@@ -53,5 +66,7 @@ function isAdmissionPreview(value) {
|
|
|
53
66
|
typeof row.taskId === 'string' &&
|
|
54
67
|
Boolean(admission &&
|
|
55
68
|
['ready', 'blocked', 'unknown'].includes(String(admission.state)) &&
|
|
56
|
-
admission.scope === 'approval_prerequisites'
|
|
69
|
+
admission.scope === 'approval_prerequisites' &&
|
|
70
|
+
(admission.ordinarySessionStartGate === undefined ||
|
|
71
|
+
['enabled', 'disabled', 'unknown'].includes(admission.ordinarySessionStartGate))));
|
|
57
72
|
}
|
|
@@ -107,12 +107,13 @@ async function readTaskPreflight(taskId, reads) {
|
|
|
107
107
|
// start-preview. Equal numbers would not prove the reads shared a snapshot.
|
|
108
108
|
const workflowBlocked = workflow.status === 'observed' &&
|
|
109
109
|
!workflow.value.actionability.allowedActions.some((action) => action.action === 'start_task');
|
|
110
|
-
const executionBlocked = execution.status === 'observed' && execution.value.executionAdmission
|
|
110
|
+
const executionBlocked = execution.status === 'observed' && (0, task_admission_1.isAdmissionBlocked)(execution.value.executionAdmission);
|
|
111
111
|
const summary = workflowBlocked || executionBlocked
|
|
112
112
|
? 'blocked'
|
|
113
113
|
: workflow.status === 'unavailable' ||
|
|
114
114
|
execution.status === 'unavailable' ||
|
|
115
|
-
execution.value.executionAdmission.state !== 'ready'
|
|
115
|
+
execution.value.executionAdmission.state !== 'ready' ||
|
|
116
|
+
execution.value.executionAdmission.ordinarySessionStartGate === 'unknown'
|
|
116
117
|
? 'unknown'
|
|
117
118
|
: 'eligible_to_attempt';
|
|
118
119
|
return {
|
|
@@ -33,6 +33,7 @@ export declare function parseHarnessPermissionControls(value: unknown): HarnessP
|
|
|
33
33
|
/** Last-reported local configuration and adapter protocol, never authority. */
|
|
34
34
|
export interface HarnessSessionPolicyReport {
|
|
35
35
|
version: 1;
|
|
36
|
+
ordinarySessionStarts?: 'enabled' | 'disabled';
|
|
36
37
|
configuredDefault: {
|
|
37
38
|
provider: 'claude';
|
|
38
39
|
engine: 'sdk' | 'cli';
|
|
@@ -90,7 +90,13 @@ function parseHarnessSessionPolicyReport(value) {
|
|
|
90
90
|
])
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
|
-
|
|
93
|
+
const ordinarySessionStarts = row.ordinarySessionStarts;
|
|
94
|
+
return Object.freeze({
|
|
95
|
+
version: 1,
|
|
96
|
+
configuredDefault,
|
|
97
|
+
taskCommandApproval,
|
|
98
|
+
...ordinarySessionStarts === "enabled" || ordinarySessionStarts === "disabled" ? { ordinarySessionStarts } : {}
|
|
99
|
+
});
|
|
94
100
|
} catch {
|
|
95
101
|
return null;
|
|
96
102
|
}
|
|
@@ -33,6 +33,7 @@ export declare function parseHarnessPermissionControls(value: unknown): HarnessP
|
|
|
33
33
|
/** Last-reported local configuration and adapter protocol, never authority. */
|
|
34
34
|
export interface HarnessSessionPolicyReport {
|
|
35
35
|
version: 1;
|
|
36
|
+
ordinarySessionStarts?: 'enabled' | 'disabled';
|
|
36
37
|
configuredDefault: {
|
|
37
38
|
provider: 'claude';
|
|
38
39
|
engine: 'sdk' | 'cli';
|
|
@@ -95,7 +95,15 @@ export function parseHarnessSessionPolicyReport(value) {
|
|
|
95
95
|
]),
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
|
-
|
|
98
|
+
const ordinarySessionStarts = row.ordinarySessionStarts;
|
|
99
|
+
return Object.freeze({
|
|
100
|
+
version: 1,
|
|
101
|
+
configuredDefault,
|
|
102
|
+
taskCommandApproval,
|
|
103
|
+
...(ordinarySessionStarts === 'enabled' || ordinarySessionStarts === 'disabled'
|
|
104
|
+
? { ordinarySessionStarts }
|
|
105
|
+
: {}),
|
|
106
|
+
});
|
|
99
107
|
}
|
|
100
108
|
catch {
|
|
101
109
|
return null;
|