@skrr-ai/cli 0.1.147 → 0.1.148
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/triggers/policy.js +11 -1
- package/dist/commands/balance/show.js +11 -3
- package/dist/commands/commitments/preflight.js +5 -1
- package/dist/commands/commitments/wake-capabilities.d.ts +2 -0
- package/dist/commands/commitments/wake-capabilities.js +16 -0
- package/dist/lib/balance.d.ts +33 -3
- package/dist/lib/balance.js +33 -4
- package/dist/lib/commitments.d.ts +5 -0
- package/dist/lib/commitments.js +16 -5
- package/dist/lib/ingress.js +2 -1
- package/dist/lib/preflight-copy.js +31 -0
- package/dist/lib/triggers.d.ts +6 -0
- package/dist/lib/triggers.js +9 -0
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
|
@@ -126,9 +126,19 @@ class AgentsTriggersPolicy extends base_command_1.BaseCommand {
|
|
|
126
126
|
// row seeded at creation. The numbers below then read like a deliberate choice, and for an
|
|
127
127
|
// Agent with no stored policy they are NOT the seeded ones (24/day, 10/h against 2/day, 1/h)
|
|
128
128
|
// (OSK-22354).
|
|
129
|
-
|
|
129
|
+
// The hard stop is the kill switch: every fire of this Agent's triggers is blocked while it is on. The
|
|
130
|
+
// text view printed the policy's numbers and never said so, beside a note that nobody had set the
|
|
131
|
+
// policy, so an Agent that was stopped read as a default one (OSK-22659). It leads the output, and a
|
|
132
|
+
// stop somebody set means the policy is not 'nobody's choice'.
|
|
133
|
+
const hardStop = policy.hardStop;
|
|
134
|
+
const stopped = hardStop?.enabled === true;
|
|
135
|
+
if (stopped) {
|
|
136
|
+
this.log(`HARD STOP: ON${hardStop?.scope ? ` (${hardStop.scope})` : ''} — every fire of this Agent's triggers is blocked${hardStop?.reason ? `: ${hardStop.reason}` : ''}${hardStop?.activatedAt ? ` (since ${hardStop.activatedAt})` : ''}`);
|
|
137
|
+
}
|
|
138
|
+
if (policy.configured === false && !stopped) {
|
|
130
139
|
this.log('Note: nobody has set this policy: these are the platform defaults (or the quiet start seeded at creation), not a choice.');
|
|
131
140
|
}
|
|
141
|
+
this.log(`Hard stop: ${stopped ? 'on' : 'off'}`);
|
|
132
142
|
this.log(`Mode: ${String(policy.mode ?? '-')}`);
|
|
133
143
|
this.log(`Allowed kinds: ${Array.isArray(policy.allowedKinds) ? policy.allowedKinds.join(', ') : '-'}`);
|
|
134
144
|
this.log(`Max fires/day: ${String(policy.maxFiresPerDay ?? '-')}`);
|
|
@@ -75,6 +75,8 @@ function renderSessionBillingAccount(target, balance, log, bin = 'skrr') {
|
|
|
75
75
|
log(' Held is reserved for hosted sessions, including turns that ended without settling; ' +
|
|
76
76
|
`\`${bin} balance statement --workspace ${target.workspaceId}\` lists the \`hold\` and ` +
|
|
77
77
|
'`exception` entries.');
|
|
78
|
+
for (const line of (0, balance_1.heldBreakdownLines)(balance.heldBreakdown))
|
|
79
|
+
log(line);
|
|
78
80
|
}
|
|
79
81
|
if (balance.availableMicros <= 0) {
|
|
80
82
|
log(' WARNING: nothing available — managed sessions billed here are refused for credit, ' +
|
|
@@ -178,7 +180,7 @@ class BalanceShow extends base_command_1.BaseCommand {
|
|
|
178
180
|
}
|
|
179
181
|
let balance;
|
|
180
182
|
try {
|
|
181
|
-
balance = await (0, balance_1.getBalance)();
|
|
183
|
+
balance = await (0, balance_1.getBalance)({ holds: 'breakdown' });
|
|
182
184
|
}
|
|
183
185
|
catch (err) {
|
|
184
186
|
this.handleApiError(err);
|
|
@@ -189,7 +191,9 @@ class BalanceShow extends base_command_1.BaseCommand {
|
|
|
189
191
|
let sessionBalance = null;
|
|
190
192
|
if (sessionTarget) {
|
|
191
193
|
try {
|
|
192
|
-
sessionBalance = await (0, balance_1.getWorkspaceBalance)(sessionTarget.workspaceId
|
|
194
|
+
sessionBalance = await (0, balance_1.getWorkspaceBalance)(sessionTarget.workspaceId, {
|
|
195
|
+
holds: 'breakdown',
|
|
196
|
+
});
|
|
193
197
|
}
|
|
194
198
|
catch {
|
|
195
199
|
sessionBalance = null;
|
|
@@ -241,6 +245,8 @@ class BalanceShow extends base_command_1.BaseCommand {
|
|
|
241
245
|
this.log(' that ends without settling stays held until billing releases');
|
|
242
246
|
this.log(' it. See the `hold` and `exception` entries in');
|
|
243
247
|
this.log(' `skrr balance statement`)');
|
|
248
|
+
for (const line of (0, balance_1.heldBreakdownLines)(balance.heldBreakdown))
|
|
249
|
+
this.log(line);
|
|
244
250
|
}
|
|
245
251
|
if (balance.balanceSource === 'legacy') {
|
|
246
252
|
// The unified account is missing for this user, so the figure above is
|
|
@@ -396,7 +402,7 @@ class BalanceShow extends base_command_1.BaseCommand {
|
|
|
396
402
|
async showWorkspaceBalance(workspaceId, asJson) {
|
|
397
403
|
let balance;
|
|
398
404
|
try {
|
|
399
|
-
balance = await (0, balance_1.getWorkspaceBalance)(workspaceId);
|
|
405
|
+
balance = await (0, balance_1.getWorkspaceBalance)(workspaceId, { holds: 'breakdown' });
|
|
400
406
|
}
|
|
401
407
|
catch (err) {
|
|
402
408
|
// A 403 here is a real answer, not a glitch: membership is what grants
|
|
@@ -436,6 +442,8 @@ class BalanceShow extends base_command_1.BaseCommand {
|
|
|
436
442
|
for (const line of (0, balance_1.workspaceBalanceLines)(balance)) {
|
|
437
443
|
this.log(line);
|
|
438
444
|
}
|
|
445
|
+
for (const line of (0, balance_1.heldBreakdownLines)(balance.heldBreakdown))
|
|
446
|
+
this.log(line);
|
|
439
447
|
this.log('');
|
|
440
448
|
this.log('This is the account a session carrying this workspace bills against —');
|
|
441
449
|
this.log('the balance named by "this session needs more credit than this');
|
|
@@ -116,8 +116,12 @@ function preflightGateLines(gate, verbose = false, refusesActivation = false) {
|
|
|
116
116
|
// question.
|
|
117
117
|
const advisoryBlock = gate.verdict === 'block' && gate.admission === 'advisory' && !refusesActivation;
|
|
118
118
|
const stopsActivationOnly = gate.verdict === 'block' && gate.admission === 'advisory' && refusesActivation;
|
|
119
|
+
// A deleted Sensor is the one advisory block that must not read lower than a silent one (`warn`):
|
|
120
|
+
// it is the more serious state (OSK-22592).
|
|
119
121
|
const mark = advisoryBlock
|
|
120
|
-
? '
|
|
122
|
+
? gate.id === 'sensor_bindings'
|
|
123
|
+
? 'warn'
|
|
124
|
+
: 'info'
|
|
121
125
|
: gate.verdict === 'pass'
|
|
122
126
|
? 'ok'
|
|
123
127
|
: gate.verdict === 'block'
|
|
@@ -13,6 +13,8 @@ export declare function wakePolicyHeadline(_result?: unknown): string;
|
|
|
13
13
|
* on Always-On, the upstream installation and leftover rows, which only the facts carry.
|
|
14
14
|
*/
|
|
15
15
|
export declare function wakePolicyLines(result?: CommitmentWakeCapabilities): string[];
|
|
16
|
+
/** Why an eligible capability is not offered, in words a person can act on (OSK-22591). */
|
|
17
|
+
export declare function describeUnavailable(reason?: string): string;
|
|
16
18
|
/**
|
|
17
19
|
* `skrr commitments wake-capabilities <id>` — which wakes an Agent may pick.
|
|
18
20
|
*
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.wakePolicyHeadline = wakePolicyHeadline;
|
|
4
4
|
exports.wakePolicyLines = wakePolicyLines;
|
|
5
|
+
exports.describeUnavailable = describeUnavailable;
|
|
5
6
|
const core_1 = require("@oclif/core");
|
|
6
7
|
const base_command_1 = require("../../base-command");
|
|
7
8
|
const commitments_1 = require("../../lib/commitments");
|
|
@@ -44,6 +45,17 @@ function wakePolicyLines(result) {
|
|
|
44
45
|
}
|
|
45
46
|
return lines;
|
|
46
47
|
}
|
|
48
|
+
/** Why an eligible capability is not offered, in words a person can act on (OSK-22591). */
|
|
49
|
+
function describeUnavailable(reason) {
|
|
50
|
+
switch (reason) {
|
|
51
|
+
case 'sensor_not_found':
|
|
52
|
+
return 'the attached sensor no longer exists. Attach a working sensor or detach this one.';
|
|
53
|
+
case 'sensor_disabled':
|
|
54
|
+
return 'the attached sensor is disabled. Enable it or detach it.';
|
|
55
|
+
default:
|
|
56
|
+
return `the attached sensor cannot deliver (${reason ?? 'unknown reason'}).`;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
47
59
|
/**
|
|
48
60
|
* `skrr commitments wake-capabilities <id>` — which wakes an Agent may pick.
|
|
49
61
|
*
|
|
@@ -109,6 +121,10 @@ class CommitmentsWakeCapabilities extends base_command_1.BaseCommand {
|
|
|
109
121
|
{ key: 'source', header: 'SOURCE' },
|
|
110
122
|
{ key: 'offered', header: 'OFFERED' },
|
|
111
123
|
], (line) => this.log(line));
|
|
124
|
+
// A capability can be eligible (still attached) and not offered because what it needs is gone.
|
|
125
|
+
for (const item of result.unavailableCapabilities ?? []) {
|
|
126
|
+
this.log(`Not offered: ${item.id} — ${describeUnavailable(item.reason)}`);
|
|
127
|
+
}
|
|
112
128
|
}
|
|
113
129
|
}
|
|
114
130
|
exports.default = CommitmentsWakeCapabilities;
|
package/dist/lib/balance.d.ts
CHANGED
|
@@ -46,8 +46,11 @@ export interface BalanceStatus {
|
|
|
46
46
|
availableMicros?: number;
|
|
47
47
|
postedBalanceMicros?: number;
|
|
48
48
|
/** Committed to work in flight: the gap between "there is a balance" and
|
|
49
|
-
* "a new session can start".
|
|
49
|
+
* "a new session can start". Part of it may be FROZEN rather than in flight;
|
|
50
|
+
* see `heldBreakdown`. */
|
|
50
51
|
heldMicros?: number;
|
|
52
|
+
/** Only when asked for (`getBalance({ holds: 'breakdown' })`). */
|
|
53
|
+
heldBreakdown?: HeldBreakdown;
|
|
51
54
|
currency?: string;
|
|
52
55
|
autoRefillEnabled?: boolean;
|
|
53
56
|
refillIntervalValue?: number;
|
|
@@ -59,6 +62,22 @@ export interface BalanceStatus {
|
|
|
59
62
|
periodTokensUsed?: number;
|
|
60
63
|
periodStartDate?: string;
|
|
61
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* What `heldMicros` is made of, from `?holds=breakdown`. Held money is reserved for hosted
|
|
67
|
+
* turns. A turn that is running clears on its own; one that ended without settling is FROZEN: its
|
|
68
|
+
* hold expired into an exception, which billing keeps held until it is cleared
|
|
69
|
+
* (docs/runbooks/billing-exceptions.md). Both used to read as "sessions in flight" (OSK-22651).
|
|
70
|
+
*/
|
|
71
|
+
export interface HeldBreakdown {
|
|
72
|
+
inFlightMicros: number;
|
|
73
|
+
inFlightCount: number;
|
|
74
|
+
frozenMicros: number;
|
|
75
|
+
frozenCount: number;
|
|
76
|
+
/** When the oldest frozen hold froze, or null when none is. */
|
|
77
|
+
oldestFrozenAt: string | null;
|
|
78
|
+
/** Held in the counter but accounted for by no hold row. */
|
|
79
|
+
unattributedMicros: number;
|
|
80
|
+
}
|
|
62
81
|
export interface BalanceTransaction {
|
|
63
82
|
tokenType?: string;
|
|
64
83
|
context?: string;
|
|
@@ -77,7 +96,9 @@ export interface BalanceHistory {
|
|
|
77
96
|
hasNextPage: boolean;
|
|
78
97
|
}
|
|
79
98
|
/** The account's current credits, limit and period usage. */
|
|
80
|
-
export declare function getBalance(
|
|
99
|
+
export declare function getBalance(options?: {
|
|
100
|
+
holds?: 'breakdown';
|
|
101
|
+
}): Promise<BalanceStatus>;
|
|
81
102
|
export declare function getSkyCodeUsage(workspaceId?: string): Promise<TSkyCodeUsageSnapshot>;
|
|
82
103
|
/** The personal Sky Code subscription, distinct from published agent-service subscriptions. */
|
|
83
104
|
export declare function getSkyCodeSubscription(): Promise<TSubscription>;
|
|
@@ -126,8 +147,12 @@ export interface WorkspaceBalance {
|
|
|
126
147
|
availableMicros: number;
|
|
127
148
|
postedBalanceMicros: number;
|
|
128
149
|
heldMicros: number;
|
|
150
|
+
/** Only when asked for (`getWorkspaceBalance(id, { holds: 'breakdown' })`). */
|
|
151
|
+
heldBreakdown?: HeldBreakdown;
|
|
129
152
|
}
|
|
130
|
-
export declare function getWorkspaceBalance(workspaceId: string
|
|
153
|
+
export declare function getWorkspaceBalance(workspaceId: string, options?: {
|
|
154
|
+
holds?: 'breakdown';
|
|
155
|
+
}): Promise<WorkspaceBalance>;
|
|
131
156
|
/**
|
|
132
157
|
* The heading for a workspace balance, naming the workspace the reader is
|
|
133
158
|
* looking at. It printed the raw id alone — "workspace 038b2251-…" — even
|
|
@@ -147,6 +172,11 @@ export declare function workspaceBalanceHeading(workspaceId: string, name: strin
|
|
|
147
172
|
* surface exactly.
|
|
148
173
|
*/
|
|
149
174
|
export declare function workspaceBalanceLines(balance: Pick<WorkspaceBalance, 'availableMicros' | 'postedBalanceMicros' | 'heldMicros'>): string[];
|
|
175
|
+
/**
|
|
176
|
+
* The lines that say what a Held figure is made of, indented under it. Empty when the server did not
|
|
177
|
+
* send a breakdown (an older server ignores the request), so nothing is invented for it.
|
|
178
|
+
*/
|
|
179
|
+
export declare function heldBreakdownLines(held: HeldBreakdown | undefined): string[];
|
|
150
180
|
/**
|
|
151
181
|
* Render micros as currency. Micros are millionths of a unit, and the balance
|
|
152
182
|
* that refuses a session is compared against a price — so this rounds to cents
|
package/dist/lib/balance.js
CHANGED
|
@@ -12,6 +12,7 @@ exports.formatCredits = formatCredits;
|
|
|
12
12
|
exports.getWorkspaceBalance = getWorkspaceBalance;
|
|
13
13
|
exports.workspaceBalanceHeading = workspaceBalanceHeading;
|
|
14
14
|
exports.workspaceBalanceLines = workspaceBalanceLines;
|
|
15
|
+
exports.heldBreakdownLines = heldBreakdownLines;
|
|
15
16
|
exports.formatMicros = formatMicros;
|
|
16
17
|
exports.getBalanceStatement = getBalanceStatement;
|
|
17
18
|
exports.getWorkspaceBalanceStatement = getWorkspaceBalanceStatement;
|
|
@@ -25,8 +26,9 @@ const DESCRIBE_CHARGE_RE = /([a-z0-9])([A-Z])/g;
|
|
|
25
26
|
const DESCRIBE_CHARGE_RE_2 = /[_-]+/g;
|
|
26
27
|
const DESCRIBE_CHARGE_RE_3 = /^./;
|
|
27
28
|
/** The account's current credits, limit and period usage. */
|
|
28
|
-
async function getBalance() {
|
|
29
|
-
|
|
29
|
+
async function getBalance(options = {}) {
|
|
30
|
+
// Opt-in: the default call is the cheap one every other reader makes.
|
|
31
|
+
return (0, api_fetch_1.apiFetch)(options.holds === 'breakdown' ? '/api/balance?holds=breakdown' : '/api/balance');
|
|
30
32
|
}
|
|
31
33
|
async function getSkyCodeUsage(workspaceId) {
|
|
32
34
|
const path = workspaceId
|
|
@@ -96,8 +98,9 @@ function formatCredits(value) {
|
|
|
96
98
|
}
|
|
97
99
|
return Math.round(value).toLocaleString('en-US');
|
|
98
100
|
}
|
|
99
|
-
async function getWorkspaceBalance(workspaceId) {
|
|
100
|
-
|
|
101
|
+
async function getWorkspaceBalance(workspaceId, options = {}) {
|
|
102
|
+
const path = `/api/workspaces/${encodeURIComponent(workspaceId)}/billing/balance`;
|
|
103
|
+
return (0, api_fetch_1.apiFetch)(options.holds === 'breakdown' ? `${path}?holds=breakdown` : path);
|
|
101
104
|
}
|
|
102
105
|
/**
|
|
103
106
|
* The heading for a workspace balance, naming the workspace the reader is
|
|
@@ -130,6 +133,32 @@ function workspaceBalanceLines(balance) {
|
|
|
130
133
|
` Posted: ${formatCreditsWithUsd(balance.postedBalanceMicros)}`,
|
|
131
134
|
];
|
|
132
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* The lines that say what a Held figure is made of, indented under it. Empty when the server did not
|
|
138
|
+
* send a breakdown (an older server ignores the request), so nothing is invented for it.
|
|
139
|
+
*/
|
|
140
|
+
function heldBreakdownLines(held) {
|
|
141
|
+
if (!held)
|
|
142
|
+
return [];
|
|
143
|
+
const lines = [];
|
|
144
|
+
if (held.inFlightMicros > 0) {
|
|
145
|
+
lines.push(` in flight ${formatCreditsWithUsd(held.inFlightMicros)}` +
|
|
146
|
+
` (${held.inFlightCount} running or just ended; clears when they settle)`);
|
|
147
|
+
}
|
|
148
|
+
if (held.frozenMicros > 0) {
|
|
149
|
+
const since = held.oldestFrozenAt
|
|
150
|
+
? `, the oldest since ${held.oldestFrozenAt.slice(0, 10)}`
|
|
151
|
+
: '';
|
|
152
|
+
lines.push(` frozen ${formatCreditsWithUsd(held.frozenMicros)}` +
|
|
153
|
+
` (${held.frozenCount} turn${held.frozenCount === 1 ? '' : 's'} that ended without settling${since};` +
|
|
154
|
+
' held until billing clears them)');
|
|
155
|
+
}
|
|
156
|
+
if (held.unattributedMicros > 0) {
|
|
157
|
+
lines.push(` other ${formatCreditsWithUsd(held.unattributedMicros)}` +
|
|
158
|
+
' (in the held total, not tied to a hold)');
|
|
159
|
+
}
|
|
160
|
+
return lines;
|
|
161
|
+
}
|
|
133
162
|
/**
|
|
134
163
|
* Render micros as currency. Micros are millionths of a unit, and the balance
|
|
135
164
|
* that refuses a session is compared against a price — so this rounds to cents
|
|
@@ -753,6 +753,11 @@ export interface CommitmentWakeCapabilities {
|
|
|
753
753
|
kind?: string;
|
|
754
754
|
source?: string;
|
|
755
755
|
}>;
|
|
756
|
+
/** Eligible capabilities the server withheld, with why: an attached sensor that no longer exists (OSK-22591). */
|
|
757
|
+
unavailableCapabilities?: Array<{
|
|
758
|
+
id: string;
|
|
759
|
+
reason?: string;
|
|
760
|
+
}>;
|
|
756
761
|
/**
|
|
757
762
|
* The event-wake facts `trigger-status` reports, verbatim, plus the Agent's own enabled event
|
|
758
763
|
* waits. Absent from a server that predates it, or when the status could not be read: "no
|
package/dist/lib/commitments.js
CHANGED
|
@@ -1147,6 +1147,16 @@ function describeExecutorBlocked(commitment) {
|
|
|
1147
1147
|
: reason || 'blocked';
|
|
1148
1148
|
return `${label}${until ? ` until ${until}` : ''}`;
|
|
1149
1149
|
}
|
|
1150
|
+
/**
|
|
1151
|
+
* A Run waiting for a stopped machine cannot be checked for the one thing that
|
|
1152
|
+
* fails it after the start: its working directory must sit inside a Git
|
|
1153
|
+
* repository with a commit, or the daemon refuses the Run with
|
|
1154
|
+
* `EXECUTION_ISOLATION_UNAVAILABLE`. Activation Preflight asks a daemon that is
|
|
1155
|
+
* online and answers `indeterminate` for one that is stopped, so the person who
|
|
1156
|
+
* pays for the start learned of it only afterwards (OSK-22386). The sentence is
|
|
1157
|
+
* conditional on purpose: a runtime with its own sandbox workspace is fine.
|
|
1158
|
+
*/
|
|
1159
|
+
const STOPPED_MACHINE_ISOLATION_NOTE = ' If its working directory is not inside a git repository with a commit, each Run is refused (EXECUTION_ISOLATION_UNAVAILABLE); that cannot be checked while the machine is stopped.';
|
|
1150
1160
|
/**
|
|
1151
1161
|
* What happens next to a stopped Dedicated machine, said only as far as the
|
|
1152
1162
|
* server told us (OSK-22392). `wake: 'owner'` is a `manual` power policy:
|
|
@@ -1155,11 +1165,12 @@ function describeExecutorBlocked(commitment) {
|
|
|
1155
1165
|
* honest sentence makes no promise.
|
|
1156
1166
|
*/
|
|
1157
1167
|
function describeStoppedMachine(wake) {
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1168
|
+
const base = wake === 'owner'
|
|
1169
|
+
? 'executor machine is stopped and its power policy is manual, so it waits until you start it'
|
|
1170
|
+
: wake === 'automatic'
|
|
1171
|
+
? 'executor machine is stopped and will be started for the work'
|
|
1172
|
+
: 'executor machine is stopped';
|
|
1173
|
+
return `${base}.${STOPPED_MACHINE_ISOLATION_NOTE}`;
|
|
1163
1174
|
}
|
|
1164
1175
|
/**
|
|
1165
1176
|
* The Operation line's wording for a Commitment that is not running because of its lifecycle.
|
package/dist/lib/ingress.js
CHANGED
|
@@ -42,7 +42,8 @@ function renderIngressList(rows, log) {
|
|
|
42
42
|
rate: `${r.rateLimit.maxPerMinute}/min`,
|
|
43
43
|
state: r.enabled ? 'enabled' : 'disabled',
|
|
44
44
|
})), [
|
|
45
|
-
|
|
45
|
+
// Labels share a run tag and differ at the end, so clip the middle (OSK-22596).
|
|
46
|
+
{ key: 'label', header: 'LABEL', maxWidth: 26, truncate: 'middle' },
|
|
46
47
|
{ key: 'type', header: 'EVENT TYPE', maxWidth: 24 },
|
|
47
48
|
{ key: 'published', header: 'PUBLISHED', maxWidth: 10 },
|
|
48
49
|
{ key: 'rejected', header: 'REJECTED', maxWidth: 9 },
|
|
@@ -19,6 +19,28 @@ const SOURCE_REFUSAL_WORDS = {
|
|
|
19
19
|
source_access_revoked: 'access refused',
|
|
20
20
|
source_access_unavailable: 'access could not be checked just now',
|
|
21
21
|
};
|
|
22
|
+
/** What an attached Sensor's refusal means, in words (OSK-22592, OSK-22593). */
|
|
23
|
+
const SENSOR_REFUSAL_WORDS = {
|
|
24
|
+
sensor_not_found: 'no longer exists, so this Commitment cannot see events from it. Attach a working sensor or remove the reference',
|
|
25
|
+
sensor_disabled: 'is disabled, so it delivers nothing. Enable it or remove the reference',
|
|
26
|
+
sensor_not_observer: 'is not an observing sensor, so it cannot wake this Commitment',
|
|
27
|
+
sensor_workspace_scope_missing_or_mismatched: 'belongs to a different workspace than this Commitment',
|
|
28
|
+
};
|
|
29
|
+
/** One sentence per attached Sensor that is not delivering, or null when it is. */
|
|
30
|
+
function sensorLine(row) {
|
|
31
|
+
const name = `${row.kind ?? 'sensor'} ${row.refId ?? '(unnamed)'}`;
|
|
32
|
+
if (row.access && row.access !== 'authorized') {
|
|
33
|
+
const why = SENSOR_REFUSAL_WORDS[row.sourceReason ?? ''] ??
|
|
34
|
+
`cannot be read just now (${row.sourceReason ?? row.access})`;
|
|
35
|
+
return `${name} ${why}.`;
|
|
36
|
+
}
|
|
37
|
+
if (!row.observation?.id)
|
|
38
|
+
return `${name} is ready, but no signal has ever been received.`;
|
|
39
|
+
if (row.observation.freshness && row.observation.freshness !== 'fresh') {
|
|
40
|
+
return `${name}: its last signal (${row.observation.observedAt ?? 'time unknown'}) is stale.`;
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
22
44
|
/** The refusal as `code: words`, or the bare code when it is not one this knows. */
|
|
23
45
|
function sourceRefusalWords(code) {
|
|
24
46
|
const words = SOURCE_REFUSAL_WORDS[code];
|
|
@@ -68,6 +90,15 @@ function gateExplanationLines(gate) {
|
|
|
68
90
|
const rows = Array.isArray(gate.detail?.sources) ? gate.detail.sources : [];
|
|
69
91
|
return rows.filter((row) => row.access && row.access !== 'authorized').map(sourceRefusalLine);
|
|
70
92
|
}
|
|
93
|
+
// Its reason is a bare code, and the per-sensor facts (gone, disabled, never signalled) are in the
|
|
94
|
+
// detail: a deleted Sensor printed `info sensor_not_found` and a silent one printed nothing.
|
|
95
|
+
if (gate.id === 'sensor_bindings') {
|
|
96
|
+
const rows = Array.isArray(gate.detail?.sensors) ? gate.detail.sensors : [];
|
|
97
|
+
const lines = rows.map(sensorLine).filter((line) => Boolean(line));
|
|
98
|
+
if (gate.reason === 'sensor_wake_binding_missing')
|
|
99
|
+
lines.push('No wake binding exists for it yet.');
|
|
100
|
+
return lines;
|
|
101
|
+
}
|
|
71
102
|
if (gate.id === 'access' && gate.reason === 'capability_access_unverified') {
|
|
72
103
|
return [
|
|
73
104
|
'No access beyond an identity check is verified as available yet (see “Where access comes from” below).',
|
package/dist/lib/triggers.d.ts
CHANGED
|
@@ -158,6 +158,8 @@ export interface TriggerDefinition {
|
|
|
158
158
|
status?: string;
|
|
159
159
|
lastError?: string;
|
|
160
160
|
lastErrorAt?: string;
|
|
161
|
+
/** A process that cannot register schedules asked for this one; not a failure (OSK-22570). */
|
|
162
|
+
deferredAt?: string;
|
|
161
163
|
};
|
|
162
164
|
/**
|
|
163
165
|
* Server-DERIVED: maintained by a managed producer, so the mutation routes
|
|
@@ -645,6 +647,10 @@ export declare function nextRunLabel(trigger: TriggerDefinition): string;
|
|
|
645
647
|
* and nothing on the agent, trigger or schedule surfaces reported it — so
|
|
646
648
|
* an operator looking at an enabled trigger had no reason to doubt it
|
|
647
649
|
* (OSK-7727).
|
|
650
|
+
* `syncing` — `enabled: true`, `unscheduled`, with `deferredAt` and NO `lastError`. A process that
|
|
651
|
+
* cannot register a schedule (the worker that finishes a durable heartbeat) asked the scheduler
|
|
652
|
+
* leader to; nothing has failed. It reads as a state, not as `!unscheduled`, which tells an operator a
|
|
653
|
+
* healthy decision is a fault (OSK-22570). With a `lastError` it is a failure again.
|
|
648
654
|
* `spent` — a `once` trigger that has fired. It has no next occurrence, so
|
|
649
655
|
* `enabled` and "will fire again" diverge forever after the single fire; an
|
|
650
656
|
* agent that has been used for a while accumulates a growing list of
|
package/dist/lib/triggers.js
CHANGED
|
@@ -1254,6 +1254,10 @@ function nextRunLabel(trigger) {
|
|
|
1254
1254
|
* and nothing on the agent, trigger or schedule surfaces reported it — so
|
|
1255
1255
|
* an operator looking at an enabled trigger had no reason to doubt it
|
|
1256
1256
|
* (OSK-7727).
|
|
1257
|
+
* `syncing` — `enabled: true`, `unscheduled`, with `deferredAt` and NO `lastError`. A process that
|
|
1258
|
+
* cannot register a schedule (the worker that finishes a durable heartbeat) asked the scheduler
|
|
1259
|
+
* leader to; nothing has failed. It reads as a state, not as `!unscheduled`, which tells an operator a
|
|
1260
|
+
* healthy decision is a fault (OSK-22570). With a `lastError` it is a failure again.
|
|
1257
1261
|
* `spent` — a `once` trigger that has fired. It has no next occurrence, so
|
|
1258
1262
|
* `enabled` and "will fire again" diverge forever after the single fire; an
|
|
1259
1263
|
* agent that has been used for a while accumulates a growing list of
|
|
@@ -1264,6 +1268,11 @@ function armedLabel(trigger) {
|
|
|
1264
1268
|
if (trigger.enabled === false)
|
|
1265
1269
|
return 'no';
|
|
1266
1270
|
const sync = trigger.scheduleSync?.status;
|
|
1271
|
+
if (sync === 'unscheduled' &&
|
|
1272
|
+
trigger.scheduleSync?.deferredAt &&
|
|
1273
|
+
!trigger.scheduleSync.lastError) {
|
|
1274
|
+
return 'syncing';
|
|
1275
|
+
}
|
|
1267
1276
|
if (sync && sync !== 'ok')
|
|
1268
1277
|
return `!${sync}`;
|
|
1269
1278
|
if (trigger.kind === 'once' && trigger.once && trigger.once.firedAt) {
|
package/oclif.manifest.json
CHANGED
|
@@ -144381,5 +144381,5 @@
|
|
|
144381
144381
|
]
|
|
144382
144382
|
}
|
|
144383
144383
|
},
|
|
144384
|
-
"version": "0.1.
|
|
144384
|
+
"version": "0.1.148"
|
|
144385
144385
|
}
|