@skrr-ai/cli 0.1.143 → 0.1.145
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 +13 -0
- package/dist/commands/agenda/plan.d.ts +7 -0
- package/dist/commands/agenda/plan.js +17 -0
- package/dist/commands/agenda/trigger/create.js +4 -2
- package/dist/commands/agenda/trigger/list.js +7 -7
- package/dist/commands/agent/message/approve.d.ts +17 -0
- package/dist/commands/agent/message/approve.js +70 -0
- package/dist/commands/agent/message/decline.d.ts +17 -0
- package/dist/commands/agent/message/decline.js +70 -0
- package/dist/commands/agent/message/pending.d.ts +18 -0
- package/dist/commands/agent/message/pending.js +79 -0
- package/dist/commands/agents/delete.d.ts +45 -0
- package/dist/commands/agents/delete.js +139 -2
- package/dist/commands/agents/plan-day.d.ts +50 -7
- package/dist/commands/agents/plan-day.js +293 -65
- package/dist/commands/agents/proactive-audit.d.ts +22 -0
- package/dist/commands/agents/proactive-audit.js +86 -0
- package/dist/commands/agents/schedule-overview.d.ts +7 -0
- package/dist/commands/agents/schedule-overview.js +49 -5
- package/dist/commands/agents/schedule-trace.js +42 -21
- package/dist/commands/agents/spawn.d.ts +78 -1
- package/dist/commands/agents/spawn.js +262 -6
- package/dist/commands/agents/todos/list.d.ts +5 -0
- package/dist/commands/agents/todos/list.js +19 -5
- package/dist/commands/agents/triggers/create.js +1 -1
- package/dist/commands/agents/triggers/update.js +1 -1
- package/dist/commands/agents/upcoming.d.ts +1 -0
- package/dist/commands/agents/upcoming.js +18 -7
- package/dist/commands/commitments/create.js +14 -4
- package/dist/commands/commitments/preflight.js +14 -3
- package/dist/commands/commitments/update.js +1 -1
- package/dist/commands/initiatives/worker/deactivate.d.ts +23 -0
- package/dist/commands/initiatives/worker/deactivate.js +78 -0
- package/dist/commands/login.js +8 -2
- package/dist/commands/logout.d.ts +20 -0
- package/dist/commands/logout.js +110 -5
- package/dist/commands/memory/maintain.js +16 -2
- package/dist/commands/spaces/delete.js +6 -1
- package/dist/commands/spaces/workflow-templates/insert.js +4 -0
- package/dist/commands/spaces/workflows/archive.js +6 -1
- package/dist/commands/spaces/workflows/publish.js +3 -1
- package/dist/commands/spaces/workflows/run.d.ts +1 -0
- package/dist/commands/spaces/workflows/run.js +17 -1
- package/dist/commands/spaces/workflows/triggers/create.js +3 -1
- package/dist/commands/store/show.js +22 -0
- package/dist/commands/tasks/workflow-context.js +3 -1
- package/dist/commands/triggers/capabilities.js +17 -1
- package/dist/commands/triggers/create.d.ts +2 -0
- package/dist/commands/triggers/create.js +23 -7
- package/dist/commands/triggers/fire-detail.js +12 -3
- package/dist/commands/triggers/list.d.ts +1 -0
- package/dist/commands/triggers/list.js +13 -1
- package/dist/commands/triggers/preflight.js +18 -0
- package/dist/commands/triggers/prune.js +9 -5
- package/dist/commands/triggers/update.js +13 -4
- package/dist/generated/agent-guides.json +35 -35
- package/dist/lib/agent-proactive-baseline.js +7 -1
- package/dist/lib/agentic-stream.d.ts +7 -0
- package/dist/lib/agentic-stream.js +22 -0
- package/dist/lib/commitments.d.ts +16 -9
- package/dist/lib/commitments.js +78 -5
- package/dist/lib/compasses.js +1 -1
- package/dist/lib/daemon-setup.js +9 -3
- package/dist/lib/daemonBroker.d.ts +7 -0
- package/dist/lib/daemonBroker.js +5 -0
- package/dist/lib/daemonHandoff.d.ts +2 -0
- package/dist/lib/daemonHandoff.js +10 -1
- package/dist/lib/daemonIslandProfile.d.ts +19 -0
- package/dist/lib/daemonIslandProfile.js +41 -0
- package/dist/lib/dedicated-power.js +10 -3
- package/dist/lib/format.d.ts +47 -0
- package/dist/lib/format.js +136 -1
- package/dist/lib/initiatives-worker.d.ts +25 -0
- package/dist/lib/initiatives-worker.js +13 -0
- package/dist/lib/login.d.ts +7 -0
- package/dist/lib/login.js +5 -0
- package/dist/lib/planOutcome.d.ts +51 -0
- package/dist/lib/planOutcome.js +88 -0
- package/dist/lib/proactive-audit.d.ts +52 -0
- package/dist/lib/proactive-audit.js +67 -0
- package/dist/lib/proactiveApi.d.ts +71 -0
- package/dist/lib/proactiveApi.js +10 -1
- package/dist/lib/refresh.d.ts +20 -6
- package/dist/lib/refresh.js +27 -9
- package/dist/lib/roles.d.ts +1 -1
- package/dist/lib/schedule.d.ts +214 -10
- package/dist/lib/schedule.js +317 -21
- package/dist/lib/triggers.d.ts +139 -3
- package/dist/lib/triggers.js +382 -18
- package/dist/lib/workflow-node-control.js +8 -0
- package/dist/lib/workflow-run-view.js +9 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.d.ts +1 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.js +2 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refresh.d.ts +22 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refresh.js +15 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.d.ts +1 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.js +1 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refresh.d.ts +22 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refresh.js +22 -4
- package/dist/node_modules/@skrr-ai/data-provider/index.js +5252 -5211
- package/oclif.manifest.json +526 -29
- package/package.json +1 -1
package/dist/lib/triggers.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.triggerApi = exports.AgentTriggerScopeError = exports.TRIGGER_MODE_REQUIRED_FLAGS = exports.TRIGGER_CREATE_FIELD_FLAGS = exports.FLAG_OWNER_KINDS = exports.SCOPE_IMPLIED_REF_KEY = exports.TRIGGER_EVENT_CATALOG = exports.TRIGGER_EVENT_ENTITY_TYPES = exports.TRIGGER_CHAT_AUTH_MODES = exports.TRIGGER_CHAT_RESPONSE_MODES = exports.TRIGGER_CHAT_MODES = exports.TRIGGER_FORM_RESPONSE_MODES = exports.TRIGGER_CONCURRENCY_POLICIES = exports.TRIGGER_EVENT_FILTER_MODES = exports.TRIGGER_EXECUTOR_MODES = exports.TRIGGER_SCOPE_KINDS = exports.TRIGGER_KINDS = void 0;
|
|
3
|
+
exports.triggerApi = exports.TRIGGER_LIMIT_CEILING = exports.TRIGGER_MODE_FLAG_DESCRIPTION = exports.TRIGGER_WINDOW_FLAG_HELP = exports.AgentTriggerScopeError = exports.TRIGGER_MODE_REQUIRED_FLAGS = exports.TRIGGER_CREATE_FIELD_FLAGS = exports.FLAG_OWNER_KINDS = exports.SCOPE_IMPLIED_REF_KEY = exports.TRIGGER_EVENT_CATALOG = exports.TRIGGER_EVENT_ENTITY_TYPES = exports.TRIGGER_CHAT_AUTH_MODES = exports.TRIGGER_CHAT_RESPONSE_MODES = exports.TRIGGER_CHAT_MODES = exports.TRIGGER_FORM_RESPONSE_MODES = exports.TRIGGER_CONCURRENCY_POLICIES = exports.TRIGGER_EVENT_FILTER_MODES = exports.TRIGGER_EXECUTOR_MODES = exports.TRIGGER_SCOPE_KINDS = exports.TRIGGER_KINDS = void 0;
|
|
4
4
|
exports.validateEventReference = validateEventReference;
|
|
5
5
|
exports.validateEventFilter = validateEventFilter;
|
|
6
6
|
exports.serverEventCatalogIncludes = serverEventCatalogIncludes;
|
|
7
7
|
exports.parseKeyValueFlags = parseKeyValueFlags;
|
|
8
|
+
exports.refEntitiesFromRefFlags = refEntitiesFromRefFlags;
|
|
8
9
|
exports.parseJsonObject = parseJsonObject;
|
|
9
10
|
exports.parseJsonArray = parseJsonArray;
|
|
10
11
|
exports.buildBuiltinActionPayload = buildBuiltinActionPayload;
|
|
@@ -46,19 +47,29 @@ exports.degradedMarker = degradedMarker;
|
|
|
46
47
|
exports.sensorHealthLines = sensorHealthLines;
|
|
47
48
|
exports.renderTriggerList = renderTriggerList;
|
|
48
49
|
exports.formatDuplicateSubscriptionWarning = formatDuplicateSubscriptionWarning;
|
|
50
|
+
exports.windowAuthoringAdvice = windowAuthoringAdvice;
|
|
51
|
+
exports.schedulerLimitSentence = schedulerLimitSentence;
|
|
49
52
|
exports.armedStateLabel = armedStateLabel;
|
|
50
53
|
exports.writeModeLabel = writeModeLabel;
|
|
51
54
|
exports.webhookIngestUrl = webhookIngestUrl;
|
|
52
55
|
exports.toolsRefusedHintLines = toolsRefusedHintLines;
|
|
53
56
|
exports.fireRefusalLines = fireRefusalLines;
|
|
57
|
+
exports.executorModeEffect = executorModeEffect;
|
|
58
|
+
exports.debounceSummaryLine = debounceSummaryLine;
|
|
59
|
+
exports.scheduleSummaryLine = scheduleSummaryLine;
|
|
60
|
+
exports.builtinActionLine = builtinActionLine;
|
|
54
61
|
exports.renderTriggerSummary = renderTriggerSummary;
|
|
55
62
|
exports.renderLegacyRuns = renderLegacyRuns;
|
|
56
|
-
exports.
|
|
63
|
+
exports.clockSkipAuditExplanation = clockSkipAuditExplanation;
|
|
64
|
+
exports.coalescedAuditExplanation = coalescedAuditExplanation;
|
|
65
|
+
exports.policyCardSentence = policyCardSentence;
|
|
57
66
|
exports.policyAuditExplanation = policyAuditExplanation;
|
|
58
67
|
exports.renderFireAudit = renderFireAudit;
|
|
68
|
+
exports.describeTriggerBudget = describeTriggerBudget;
|
|
59
69
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
60
70
|
const node_fs_1 = require("node:fs");
|
|
61
71
|
const format_1 = require("./format");
|
|
72
|
+
const planOutcome_1 = require("./planOutcome");
|
|
62
73
|
exports.TRIGGER_KINDS = [
|
|
63
74
|
'schedule',
|
|
64
75
|
'once',
|
|
@@ -382,6 +393,30 @@ function parseKeyValueFlags(values, flagName, scopeKind) {
|
|
|
382
393
|
}
|
|
383
394
|
return refs;
|
|
384
395
|
}
|
|
396
|
+
/**
|
|
397
|
+
* The entity kind a `--ref <key>=<id>` names, for the filter a list takes. `triggers create` takes
|
|
398
|
+
* `--ref agentId=abc`; `triggers list` took only `--ref-entity agent:abc`, so the one spelling that
|
|
399
|
+
* created the trigger was refused by the command that finds it (OSK-22493).
|
|
400
|
+
*/
|
|
401
|
+
const REF_KEY_ENTITY_KIND = {
|
|
402
|
+
agentId: 'agent',
|
|
403
|
+
goalId: 'goal',
|
|
404
|
+
taskId: 'task',
|
|
405
|
+
spaceId: 'space',
|
|
406
|
+
groupChatId: 'groupChat',
|
|
407
|
+
};
|
|
408
|
+
/** `--ref agentId=abc` as the `agent:abc` the list filter takes. Throws for a key that filters nothing. */
|
|
409
|
+
function refEntitiesFromRefFlags(values) {
|
|
410
|
+
const refs = parseKeyValueFlags(values, '--ref');
|
|
411
|
+
return Object.entries(refs).map(([key, id]) => {
|
|
412
|
+
const kind = REF_KEY_ENTITY_KIND[key];
|
|
413
|
+
if (!kind) {
|
|
414
|
+
throw new Error(`--ref ${key}=... cannot filter a list. Use ${Object.keys(REF_KEY_ENTITY_KIND).join(', ')}, ` +
|
|
415
|
+
'or --ref-entity <kind>:<id>.');
|
|
416
|
+
}
|
|
417
|
+
return `${kind}:${id}`;
|
|
418
|
+
});
|
|
419
|
+
}
|
|
385
420
|
function parseJsonObject(raw, flagName) {
|
|
386
421
|
if (raw === undefined)
|
|
387
422
|
return undefined;
|
|
@@ -800,7 +835,15 @@ exports.TRIGGER_CREATE_FIELD_FLAGS = Object.freeze({
|
|
|
800
835
|
'execution.dispatch': '--dispatch',
|
|
801
836
|
'execution.references': '--reference',
|
|
802
837
|
'execution.workingHours': '--working-hours',
|
|
838
|
+
'execution.workingHours.enabled': '--working-hours',
|
|
839
|
+
'execution.workingHours.start': '--working-hours',
|
|
840
|
+
'execution.workingHours.end': '--working-hours',
|
|
841
|
+
'execution.workingHours.timezone': '--working-hours',
|
|
803
842
|
'execution.quietHours': '--quiet-hours',
|
|
843
|
+
'execution.quietHours.enabled': '--quiet-hours',
|
|
844
|
+
'execution.quietHours.start': '--quiet-hours',
|
|
845
|
+
'execution.quietHours.end': '--quiet-hours',
|
|
846
|
+
'execution.quietHours.timezone': '--quiet-hours',
|
|
804
847
|
});
|
|
805
848
|
/**
|
|
806
849
|
* Flags an execution mode cannot work without, refused before the request is sent. The inverse
|
|
@@ -841,8 +884,9 @@ function describeScheduledFire(result) {
|
|
|
841
884
|
const report = result.scheduledFire;
|
|
842
885
|
if (typeof report !== 'object' || report === null)
|
|
843
886
|
return undefined;
|
|
844
|
-
const { wouldRun, reason, bypassed } = report;
|
|
887
|
+
const { wouldRun, reason, reasonText, bypassed } = report;
|
|
845
888
|
const why = typeof reason === 'string' && reason ? ` (${reason})` : '';
|
|
889
|
+
const sentence = typeof reasonText === 'string' && reasonText.trim() ? reasonText.trim() : null;
|
|
846
890
|
if (Array.isArray(bypassed) && bypassed.length > 0) {
|
|
847
891
|
const gates = bypassed
|
|
848
892
|
.map((entry) => `${String(entry.gate)}${entry.reason ? ` (${String(entry.reason)})` : ''}`)
|
|
@@ -850,6 +894,9 @@ function describeScheduledFire(result) {
|
|
|
850
894
|
return `Note: this manual fire bypassed ${gates}; a scheduled fire would not run.`;
|
|
851
895
|
}
|
|
852
896
|
if (wouldRun === false) {
|
|
897
|
+
if (sentence) {
|
|
898
|
+
return `Note: a scheduled fire would not run. ${sentence} A manual fire is exempt from that check.`;
|
|
899
|
+
}
|
|
853
900
|
return `Note: a scheduled fire would not run${why}; a manual fire is exempt from that check.`;
|
|
854
901
|
}
|
|
855
902
|
if (wouldRun === null) {
|
|
@@ -1125,6 +1172,10 @@ function armedLabel(trigger) {
|
|
|
1125
1172
|
if (trigger.kind === 'once' && trigger.once && trigger.once.firedAt) {
|
|
1126
1173
|
return 'spent';
|
|
1127
1174
|
}
|
|
1175
|
+
// Enabled and synced, but the scheduler has used the run limit it was given: it drops every slot
|
|
1176
|
+
// (OSK-22526). Only a read that asked for the limits can say so; absent is unknown, not fine.
|
|
1177
|
+
if (trigger.schedulerLimits?.state === 'reached')
|
|
1178
|
+
return 'limit';
|
|
1128
1179
|
return 'yes';
|
|
1129
1180
|
}
|
|
1130
1181
|
/**
|
|
@@ -1194,7 +1245,7 @@ function renderTriggerList(triggers, log) {
|
|
|
1194
1245
|
{ key: 'enabled', header: 'ARMED' },
|
|
1195
1246
|
{ key: 'scope', header: 'SCOPE', maxWidth: 42 },
|
|
1196
1247
|
{ key: 'next', header: 'NEXT/LAST', maxWidth: 24 },
|
|
1197
|
-
{ key: 'label', header: 'LABEL', maxWidth:
|
|
1248
|
+
{ key: 'label', header: 'LABEL', maxWidth: 40, truncate: 'middle' },
|
|
1198
1249
|
], log);
|
|
1199
1250
|
const degraded = triggers.filter((t) => degradedMarker(t) === ' (degraded)');
|
|
1200
1251
|
if (degraded.length > 0) {
|
|
@@ -1246,6 +1297,42 @@ function formatDuplicateSubscriptionWarning(trigger) {
|
|
|
1246
1297
|
lines,
|
|
1247
1298
|
};
|
|
1248
1299
|
}
|
|
1300
|
+
/** The `warnings[]` codes a create or update answers about a working / quiet window it just saved. */
|
|
1301
|
+
const WINDOW_ADVICE_CODES = new Set(['window_timezone_defaulted', 'quiet_window_empty']);
|
|
1302
|
+
/**
|
|
1303
|
+
* Advice about a window the trigger was just saved with, one sentence each, or none. The window was
|
|
1304
|
+
* accepted; these say how it will be read (in UTC when it names no zone, as an empty quiet window that
|
|
1305
|
+
* suppresses nothing), so a person finds out now and not from the first skipped fire (OSK-22530).
|
|
1306
|
+
*/
|
|
1307
|
+
function windowAuthoringAdvice(trigger) {
|
|
1308
|
+
const warnings = trigger?.warnings;
|
|
1309
|
+
if (!Array.isArray(warnings))
|
|
1310
|
+
return [];
|
|
1311
|
+
return warnings.flatMap((warning) => {
|
|
1312
|
+
const { code, message } = (warning ?? {});
|
|
1313
|
+
return typeof code === 'string' && WINDOW_ADVICE_CODES.has(code) && typeof message === 'string'
|
|
1314
|
+
? [message]
|
|
1315
|
+
: [];
|
|
1316
|
+
});
|
|
1317
|
+
}
|
|
1318
|
+
/** What `--working-hours` / `--quiet-hours` take, for their `--help`. */
|
|
1319
|
+
exports.TRIGGER_WINDOW_FLAG_HELP = 'JSON object {"enabled":true,"start":"09:00","end":"17:00","timezone":"America/Vancouver"}. "enabled" is required for the window to apply, and with no "timezone" it is read in UTC, not in the trigger\'s own zone.';
|
|
1320
|
+
/**
|
|
1321
|
+
* Why a schedule whose own counters look healthy will not run, in the scheduler's numbers. The
|
|
1322
|
+
* scheduler charges a limit when it claims a slot, so it can hold more than the trigger counts; once
|
|
1323
|
+
* the limit is reached it drops every later slot without running or recording it (OSK-22526).
|
|
1324
|
+
*/
|
|
1325
|
+
function schedulerLimitSentence(limits) {
|
|
1326
|
+
const lifetime = limits.reason === 'max_runs_reached';
|
|
1327
|
+
const used = lifetime
|
|
1328
|
+
? `${limits.claimedTotal ?? '?'} of ${limits.maxRuns ?? '?'} runs (--max-runs)`
|
|
1329
|
+
: `${limits.claimedToday ?? '?'} of ${limits.maxPerDay ?? '?'} runs today (--max-fires-per-day)`;
|
|
1330
|
+
const counted = lifetime
|
|
1331
|
+
? `${limits.triggerFireCount ?? 0} succeeded`
|
|
1332
|
+
: `${limits.triggerFiresToday ?? 0} counted today`;
|
|
1333
|
+
return (`the scheduler has used ${used} (the trigger itself has ${counted}), so it skips every slot` +
|
|
1334
|
+
`${lifetime ? '' : ' until the day rolls over'}; see \`skrr triggers preflight\``);
|
|
1335
|
+
}
|
|
1249
1336
|
/**
|
|
1250
1337
|
* Human phrasing for a trigger's enabled state (OSK-4886).
|
|
1251
1338
|
*
|
|
@@ -1255,7 +1342,9 @@ function formatDuplicateSubscriptionWarning(trigger) {
|
|
|
1255
1342
|
*/
|
|
1256
1343
|
function armedStateLabel(enabled, lastResult,
|
|
1257
1344
|
/** Pass for a `once` trigger: how often its single fire ran. A spent one-shot is not waiting to be enabled (OSK-21509). */
|
|
1258
|
-
oneShot
|
|
1345
|
+
oneShot,
|
|
1346
|
+
/** The server's reading of the scheduler's run limits: a reached limit means no slot will run (OSK-22526). */
|
|
1347
|
+
schedulerLimits) {
|
|
1259
1348
|
if (enabled === false && oneShot && (oneShot.fires ?? 0) > 0) {
|
|
1260
1349
|
return 'no — already fired (a one-shot trigger is spent once it fires)';
|
|
1261
1350
|
}
|
|
@@ -1264,6 +1353,8 @@ oneShot) {
|
|
|
1264
1353
|
}
|
|
1265
1354
|
if (enabled === false)
|
|
1266
1355
|
return 'no — inert until enabled';
|
|
1356
|
+
if (schedulerLimits?.state === 'reached')
|
|
1357
|
+
return `no — ${schedulerLimitSentence(schedulerLimits)}`;
|
|
1267
1358
|
// "Will fire" is the row's intent. A platform-managed row whose owner is fenced (Always-On off) ticks on
|
|
1268
1359
|
// schedule and is skipped every time, and the same screen's `Fires:` line says so; the first line a reader
|
|
1269
1360
|
// meets must not say the opposite (dogfood df-261031-commitment-authoring, OSK-21103).
|
|
@@ -1365,12 +1456,147 @@ function fireRefusalLines(metadata) {
|
|
|
1365
1456
|
}
|
|
1366
1457
|
return lines;
|
|
1367
1458
|
}
|
|
1459
|
+
/**
|
|
1460
|
+
* What an executor mode DOES, in words. The name alone said nothing about side effects: `run_only`
|
|
1461
|
+
* read as if it ran nothing, so a person testing a disabled sensor trigger could not tell that firing
|
|
1462
|
+
* it starts an Agent turn (OSK-21766). Only the modes an author normally chooses are described; an
|
|
1463
|
+
* unlisted mode simply has no effect line rather than a guess.
|
|
1464
|
+
*/
|
|
1465
|
+
const EXECUTOR_MODE_EFFECTS = {
|
|
1466
|
+
send_message: 'runs an Agent turn and posts its reply to the destination chat',
|
|
1467
|
+
run_only: 'runs an Agent turn and posts nothing visible; it still uses the Agent’s model budget',
|
|
1468
|
+
builtin_action: 'runs a deterministic action with no Agent turn and no model cost; the Action line says which (types: `skrr triggers actions`)',
|
|
1469
|
+
};
|
|
1470
|
+
/** The `--mode` flag's help, shared so create and update never describe the modes differently. */
|
|
1471
|
+
exports.TRIGGER_MODE_FLAG_DESCRIPTION = 'Execution mode. send_message runs an Agent turn and posts its reply to the destination chat; run_only runs an Agent turn and posts nothing visible (it still uses the Agent’s model budget).';
|
|
1472
|
+
function executorModeEffect(mode) {
|
|
1473
|
+
return typeof mode === 'string' ? EXECUTOR_MODE_EFFECTS[mode] : undefined;
|
|
1474
|
+
}
|
|
1475
|
+
/** `30s`, `2m` — the window, short enough to sit in a one-line summary. */
|
|
1476
|
+
function debounceSpan(ms) {
|
|
1477
|
+
const seconds = Math.round(ms / 1000);
|
|
1478
|
+
if (seconds >= 60 && seconds % 60 === 0)
|
|
1479
|
+
return `${seconds / 60}m`;
|
|
1480
|
+
return `${seconds}s`;
|
|
1481
|
+
}
|
|
1482
|
+
/**
|
|
1483
|
+
* The text of the `Debounce:` line of `triggers show`. An event trigger carries a trigger-wide debounce (30s unless
|
|
1484
|
+
* set), and neither its size nor its meaning was shown anywhere but raw JSON: a person deciding whether
|
|
1485
|
+
* two close events both fire could not tell that the second is skipped, not queued, whatever its
|
|
1486
|
+
* subject (OSK-21756). Undefined when there is nothing to say.
|
|
1487
|
+
*/
|
|
1488
|
+
function debounceSummaryLine(trigger) {
|
|
1489
|
+
if (trigger.kind !== 'event')
|
|
1490
|
+
return undefined;
|
|
1491
|
+
// A Commitment wake coalesces in the wake ledger; TriggerEngine never debounces those fires.
|
|
1492
|
+
if (trigger.scope?.kind === 'commitment_watcher' || trigger.execution?.mode === 'commitment_reflection') {
|
|
1493
|
+
return undefined;
|
|
1494
|
+
}
|
|
1495
|
+
const ms = trigger.event?.debounceMs;
|
|
1496
|
+
if (typeof ms !== 'number' || !Number.isFinite(ms) || ms <= 0) {
|
|
1497
|
+
return 'none — every matching event can fire';
|
|
1498
|
+
}
|
|
1499
|
+
return `${debounceSpan(ms)}, trigger-wide — a matching event within ${debounceSpan(ms)} of the last fire is skipped, not queued`;
|
|
1500
|
+
}
|
|
1501
|
+
/** The machine's own IANA zone, or undefined where the runtime cannot say. */
|
|
1502
|
+
function machineTimeZone() {
|
|
1503
|
+
try {
|
|
1504
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone || undefined;
|
|
1505
|
+
}
|
|
1506
|
+
catch {
|
|
1507
|
+
return undefined;
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
/** `01:30 PST`: the wall clock of an instant in a zone, or undefined for a zone this runtime does not know. */
|
|
1511
|
+
function clockInZone(iso, timeZone) {
|
|
1512
|
+
const date = new Date(iso);
|
|
1513
|
+
if (Number.isNaN(date.getTime()))
|
|
1514
|
+
return undefined;
|
|
1515
|
+
try {
|
|
1516
|
+
return new Intl.DateTimeFormat('en-US', {
|
|
1517
|
+
timeZone,
|
|
1518
|
+
hour: '2-digit',
|
|
1519
|
+
minute: '2-digit',
|
|
1520
|
+
hourCycle: 'h23',
|
|
1521
|
+
timeZoneName: 'short',
|
|
1522
|
+
}).format(date);
|
|
1523
|
+
}
|
|
1524
|
+
catch {
|
|
1525
|
+
return undefined;
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
/**
|
|
1529
|
+
* When a schedule or one-shot trigger runs, in the zone it runs in (OSK-22487).
|
|
1530
|
+
*
|
|
1531
|
+
* `triggers create` and `triggers show` printed the kind, the mode and `Fires: 0 succeeded` and nothing
|
|
1532
|
+
* about WHEN, so a schedule made without `--timezone` (which stores UTC) looked the same as one made
|
|
1533
|
+
* for the person's own morning, eight hours apart. The zone is stated always, and the same instant is
|
|
1534
|
+
* restated on this machine's clock when the two differ, so "09:30" cannot be mistaken for local time.
|
|
1535
|
+
* A disabled trigger's next occurrence is labelled as conditional: nothing will run until it is enabled.
|
|
1536
|
+
*
|
|
1537
|
+
* Undefined for a kind with no clock (event, on_demand, ...). `machineZone` is a parameter so the text
|
|
1538
|
+
* is deterministic under test.
|
|
1539
|
+
*/
|
|
1540
|
+
function scheduleSummaryLine(trigger, machineZone = machineTimeZone()) {
|
|
1541
|
+
let cadence;
|
|
1542
|
+
let nextIso;
|
|
1543
|
+
let zone = 'UTC';
|
|
1544
|
+
if (trigger.kind === 'schedule') {
|
|
1545
|
+
const schedule = (trigger.schedule ?? {});
|
|
1546
|
+
if (typeof schedule.timezone === 'string' && schedule.timezone)
|
|
1547
|
+
zone = schedule.timezone;
|
|
1548
|
+
if (Array.isArray(schedule.times) && schedule.times.length > 0) {
|
|
1549
|
+
cadence = `daily at ${schedule.times.join(', ')} ${zone}`;
|
|
1550
|
+
}
|
|
1551
|
+
else if (typeof schedule.cronExpression === 'string' && schedule.cronExpression) {
|
|
1552
|
+
cadence = `cron "${schedule.cronExpression}" in ${zone}`;
|
|
1553
|
+
}
|
|
1554
|
+
else if (typeof schedule.intervalMs === 'number' && schedule.intervalMs > 0) {
|
|
1555
|
+
const minutes = Math.round(schedule.intervalMs / 60_000);
|
|
1556
|
+
cadence = `every ${minutes === 1 ? 'minute' : `${minutes} minutes`}`;
|
|
1557
|
+
}
|
|
1558
|
+
if (schedule.nextRunAt)
|
|
1559
|
+
nextIso = String(schedule.nextRunAt);
|
|
1560
|
+
}
|
|
1561
|
+
else if (trigger.kind === 'once') {
|
|
1562
|
+
const once = (trigger.once ?? {});
|
|
1563
|
+
const runAt = once.runAt ?? once.at;
|
|
1564
|
+
if (runAt) {
|
|
1565
|
+
nextIso = String(runAt);
|
|
1566
|
+
cadence = 'one-time run';
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
if (!cadence)
|
|
1570
|
+
return undefined;
|
|
1571
|
+
// An interval has no wall-clock time to be mistaken for local time.
|
|
1572
|
+
const hasClock = !cadence.startsWith('every ');
|
|
1573
|
+
const parts = [cadence];
|
|
1574
|
+
if (nextIso) {
|
|
1575
|
+
const there = hasClock && machineZone && machineZone !== zone ? clockInZone(nextIso, machineZone) : undefined;
|
|
1576
|
+
const when = trigger.enabled === false ? `next ${nextIso} if enabled` : `next ${nextIso}`;
|
|
1577
|
+
parts.push(there ? `${when} (${there} on this machine)` : when);
|
|
1578
|
+
}
|
|
1579
|
+
return parts.join('; ');
|
|
1580
|
+
}
|
|
1581
|
+
/** What a builtin_action trigger does, from its stored action: the type and its config. */
|
|
1582
|
+
function builtinActionLine(trigger) {
|
|
1583
|
+
if (trigger.execution?.mode !== 'builtin_action')
|
|
1584
|
+
return undefined;
|
|
1585
|
+
const action = trigger.execution.builtinAction;
|
|
1586
|
+
if (typeof action?.builtinType !== 'string')
|
|
1587
|
+
return undefined;
|
|
1588
|
+
const config = action.config && typeof action.config === 'object' && Object.keys(action.config).length > 0
|
|
1589
|
+
? JSON.stringify(action.config)
|
|
1590
|
+
: '';
|
|
1591
|
+
const shown = config.length > 160 ? `${config.slice(0, 160)}…` : config;
|
|
1592
|
+
return `${action.builtinType}${shown ? ` ${shown}` : ''}`;
|
|
1593
|
+
}
|
|
1368
1594
|
function renderTriggerSummary(trigger, log, options = {}) {
|
|
1369
1595
|
log(`ID: ${trigger.id ?? '-'}`);
|
|
1370
1596
|
log(`Kind: ${trigger.kind ?? '-'}`);
|
|
1371
1597
|
log(`Armed: ${armedStateLabel(trigger.enabled, trigger.audit?.lastResult, trigger.kind === 'once'
|
|
1372
1598
|
? { fires: trigger.audit?.fireCount, failures: trigger.audit?.failureCount }
|
|
1373
|
-
: undefined)}`);
|
|
1599
|
+
: undefined, trigger.schedulerLimits)}`);
|
|
1374
1600
|
log(`Scope: ${scopeLabel(trigger)}`);
|
|
1375
1601
|
/*
|
|
1376
1602
|
* Say when the row is not yours to change.
|
|
@@ -1396,6 +1622,18 @@ function renderTriggerSummary(trigger, log, options = {}) {
|
|
|
1396
1622
|
log(`Label: ${trigger.label}`);
|
|
1397
1623
|
if (trigger.execution?.mode)
|
|
1398
1624
|
log(`Mode: ${String(trigger.execution.mode)}`);
|
|
1625
|
+
const modeEffect = executorModeEffect(trigger.execution?.mode);
|
|
1626
|
+
if (modeEffect)
|
|
1627
|
+
log(`Effect: ${modeEffect}`);
|
|
1628
|
+
const action = builtinActionLine(trigger);
|
|
1629
|
+
if (action)
|
|
1630
|
+
log(`Action: ${action}`);
|
|
1631
|
+
const schedule = scheduleSummaryLine(trigger);
|
|
1632
|
+
if (schedule)
|
|
1633
|
+
log(`Schedule: ${schedule}`);
|
|
1634
|
+
const debounceText = debounceSummaryLine(trigger);
|
|
1635
|
+
if (debounceText)
|
|
1636
|
+
log(`Debounce: ${debounceText}`);
|
|
1399
1637
|
const sensor = trigger.execution?.mode === 'sensor_poll' ? trigger.execution.sensor : undefined;
|
|
1400
1638
|
if (sensor?.measureSink) {
|
|
1401
1639
|
log(`Measure: ${sensor.measureSink.measureId} — platform fetched, unconfirmed`);
|
|
@@ -1451,7 +1689,10 @@ function renderTriggerSummary(trigger, log, options = {}) {
|
|
|
1451
1689
|
if (next !== '-') {
|
|
1452
1690
|
// `nextRunLabel` falls back to the last fire when nothing is scheduled; say which it is.
|
|
1453
1691
|
const upcoming = Boolean(scheduledRunAt(trigger));
|
|
1454
|
-
|
|
1692
|
+
// A slot the scheduler will drop is not a run to wait for (OSK-22526).
|
|
1693
|
+
const dropped = upcoming && trigger.schedulerLimits?.state === 'reached';
|
|
1694
|
+
log(`${upcoming ? (dropped ? 'Next slot:' : 'Next run:') : 'Last run:'}${next.length > 0 ? ` ${next}` : ''}` +
|
|
1695
|
+
`${dropped ? ' (will be skipped: the scheduler\'s run limit is reached)' : ''}`);
|
|
1455
1696
|
}
|
|
1456
1697
|
/*
|
|
1457
1698
|
* What actually happened when it fired.
|
|
@@ -1526,28 +1767,131 @@ function renderLegacyRuns(runs, log) {
|
|
|
1526
1767
|
{ key: 'conversation', header: 'CONVO', maxWidth: 24 },
|
|
1527
1768
|
], log);
|
|
1528
1769
|
}
|
|
1529
|
-
/**
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1770
|
+
/**
|
|
1771
|
+
* What a window-skipped fire's record says about the window, as one clause, or null when the record
|
|
1772
|
+
* kept none (it predates the field, or the platform scheduler recorded the skip).
|
|
1773
|
+
*/
|
|
1774
|
+
function skippedWindowClause(window, kind) {
|
|
1775
|
+
if (!window || window.kind !== kind || !window.start || !window.end)
|
|
1533
1776
|
return null;
|
|
1534
|
-
|
|
1777
|
+
const zone = window.timezone || 'UTC';
|
|
1778
|
+
const label = kind === 'working_hours' ? 'working hours' : 'quiet hours';
|
|
1779
|
+
const judged = window.localTime
|
|
1780
|
+
? `It was judged at ${window.localTime} ${zone}`
|
|
1781
|
+
: `It was judged at ${window.evaluatedAt ?? 'the time it came due'}`;
|
|
1782
|
+
const relation = kind === 'working_hours' ? 'outside' : 'inside';
|
|
1783
|
+
const defaulted = window.timezoneDefaulted
|
|
1784
|
+
? ' The window sets no timezone, so it is read in UTC.'
|
|
1785
|
+
: '';
|
|
1786
|
+
return `${judged}, ${relation} the trigger's ${label} ${window.start}-${window.end} ${zone}.${defaulted}`;
|
|
1787
|
+
}
|
|
1788
|
+
/**
|
|
1789
|
+
* Why a fire was skipped by a working or quiet window, in words. Both trigger-level windows (Gate 5)
|
|
1790
|
+
* consume the occurrence: a one-shot is spent, a recurring schedule carries on to its next slot, and
|
|
1791
|
+
* nothing is retried. The Agent's own quiet hours (`initiative_policy_quiet_hours`) are a separate
|
|
1792
|
+
* policy that can hold a one-shot, so that wording stays hedged.
|
|
1793
|
+
*/
|
|
1794
|
+
function clockSkipAuditExplanation(fire) {
|
|
1795
|
+
const reason = fire.reason || fire.outcome;
|
|
1796
|
+
if (reason === 'initiative_policy_quiet_hours') {
|
|
1797
|
+
if (fire.source === 'once') {
|
|
1798
|
+
return {
|
|
1799
|
+
summary: 'One-shot skipped: quiet hours',
|
|
1800
|
+
detail: 'This skipped occurrence will not retry automatically. Check the trigger state; if the one-shot is spent, schedule a new one outside quiet hours.',
|
|
1801
|
+
};
|
|
1802
|
+
}
|
|
1535
1803
|
return {
|
|
1536
|
-
summary: '
|
|
1537
|
-
detail: '
|
|
1804
|
+
summary: 'Skipped: Agent quiet hours',
|
|
1805
|
+
detail: 'The Agent quiet hours covered this occurrence, so it did not run. It is not retried; a recurring schedule carries on to its next slot.',
|
|
1538
1806
|
};
|
|
1539
1807
|
}
|
|
1808
|
+
if (reason !== 'outside_working_hours' && reason !== 'inside_quiet_hours')
|
|
1809
|
+
return null;
|
|
1810
|
+
const working = reason === 'outside_working_hours';
|
|
1811
|
+
const kind = working ? 'working_hours' : 'quiet_hours';
|
|
1812
|
+
const oneShot = fire.source === 'once';
|
|
1813
|
+
const recurring = fire.source === 'schedule';
|
|
1814
|
+
const record = fire.metadata?.window;
|
|
1815
|
+
const window = skippedWindowClause(record, kind) ??
|
|
1816
|
+
`This occurrence landed ${working ? 'outside the working hours' : 'inside the quiet hours'} set on this trigger. The record did not keep the window; \`skrr triggers show <id> --json\` shows what it is now.`;
|
|
1817
|
+
const outcome = oneShot
|
|
1818
|
+
? `A one-shot has a single occurrence, so it is spent and will not retry. To run it, create a new one ${working ? 'inside the working hours' : 'outside the quiet hours'}.`
|
|
1819
|
+
: recurring
|
|
1820
|
+
? 'The schedule does not retry this slot; it carries on, and its next occurrence is checked against the window again.'
|
|
1821
|
+
: 'It was dropped, not queued, and will not retry automatically.';
|
|
1822
|
+
return {
|
|
1823
|
+
summary: `${oneShot ? 'One-shot skipped' : 'Skipped'}: ${working ? 'outside working hours' : 'quiet hours'}`,
|
|
1824
|
+
detail: `${window} ${outcome}`,
|
|
1825
|
+
};
|
|
1826
|
+
}
|
|
1827
|
+
/**
|
|
1828
|
+
* Why a coalesced occurrence did not run. `coalesced` with reason `in_flight` is the concurrency lane
|
|
1829
|
+
* (gate 7) finding an earlier fire still holding it: this occurrence was dropped, not queued, and an
|
|
1830
|
+
* occurrence that was dropped is consumed, so it is not retried (OSK-22509). The raw code alone read
|
|
1831
|
+
* as a fire that was still in progress.
|
|
1832
|
+
*/
|
|
1833
|
+
function coalescedAuditExplanation(fire) {
|
|
1834
|
+
if (fire.outcome !== 'coalesced')
|
|
1835
|
+
return null;
|
|
1540
1836
|
return {
|
|
1541
|
-
summary: '
|
|
1542
|
-
detail: '
|
|
1837
|
+
summary: 'Not run: lane already busy',
|
|
1838
|
+
detail: 'An earlier fire under the same concurrency lane was still running when this occurrence came due, so it was dropped, not queued, and will not retry automatically. `skrr triggers preflight <id> --json` shows the lane (concurrencyKey); a trigger that stores no key coalesces only against itself.',
|
|
1543
1839
|
};
|
|
1544
1840
|
}
|
|
1841
|
+
/** Why no new inbox card was written, by the code the server records. Unknown codes are shown as they are. */
|
|
1842
|
+
const POLICY_CARD_REASONS = {
|
|
1843
|
+
policy_mode_has_no_card: 'this autonomy mode does not make inbox suggestions',
|
|
1844
|
+
scope_not_agent: 'the trigger is not scoped to an Agent',
|
|
1845
|
+
agent_unresolved: 'the trigger names no Agent',
|
|
1846
|
+
creation_error: 'creating it failed',
|
|
1847
|
+
card_not_visible: 'it was saved but cannot be shown to its owner',
|
|
1848
|
+
not_recorded: 'the suggestion service did not say why',
|
|
1849
|
+
relevance_gate: 'the relevance check judged it not worth surfacing',
|
|
1850
|
+
payload_gate: 'it carried nothing to act on',
|
|
1851
|
+
dedupe: 'this occurrence already has one',
|
|
1852
|
+
initiative_policy_cooldown: 'an earlier suggestion from this trigger is still open',
|
|
1853
|
+
initiative_policy_source_cooldown: 'an earlier suggestion from this source is still open',
|
|
1854
|
+
initiative_policy_channel_cooldown: 'an earlier suggestion from this channel is still open',
|
|
1855
|
+
initiative_policy_cross_worker_duplicate: 'another Agent already raised the same thing',
|
|
1856
|
+
initiative_policy_hard_stop: 'the Agent hard stop is on',
|
|
1857
|
+
initiative_policy_off: 'the Agent initiative policy is off',
|
|
1858
|
+
initiative_policy_quiet_hours: 'it landed inside the Agent quiet hours',
|
|
1859
|
+
initiative_policy_outside_working_hours: 'it landed outside the Agent working hours',
|
|
1860
|
+
initiative_policy_daily_card_cap: 'the Agent daily limit on inbox suggestions was reached',
|
|
1861
|
+
initiative_policy_source_daily_card_cap: 'the daily limit for this source was reached',
|
|
1862
|
+
initiative_policy_channel_daily_card_cap: 'the daily limit for this channel was reached',
|
|
1863
|
+
initiative_policy_suppressed: 'a suppression rule on the Agent matches it',
|
|
1864
|
+
initiative_policy_dismiss_cooldown: 'a similar suggestion was dismissed recently',
|
|
1865
|
+
initiative_policy_source_off: 'this source is switched off for the Agent',
|
|
1866
|
+
initiative_policy_channel_off: 'this channel is switched off for the Agent',
|
|
1867
|
+
};
|
|
1868
|
+
/** One sentence saying whether the fire left an inbox card, or null for a fire that predates the record. */
|
|
1869
|
+
function policyCardSentence(policyCard) {
|
|
1870
|
+
if (!policyCard || typeof policyCard !== 'object' || Array.isArray(policyCard))
|
|
1871
|
+
return null;
|
|
1872
|
+
const card = policyCard;
|
|
1873
|
+
const id = typeof card.initiativeId === 'string' && card.initiativeId ? ` (${card.initiativeId})` : '';
|
|
1874
|
+
if (card.created === true)
|
|
1875
|
+
return `An inbox suggestion was created${id}.`;
|
|
1876
|
+
const why = typeof card.reason === 'string' && card.reason
|
|
1877
|
+
? (POLICY_CARD_REASONS[card.reason] ?? card.reason)
|
|
1878
|
+
: null;
|
|
1879
|
+
if (card.existing === true) {
|
|
1880
|
+
return `No new inbox suggestion: an earlier one${id} covers this${why ? ` (${why})` : ''}.`;
|
|
1881
|
+
}
|
|
1882
|
+
if (card.created === false)
|
|
1883
|
+
return `No inbox suggestion was created${why ? `: ${why}` : ''}.`;
|
|
1884
|
+
return null;
|
|
1885
|
+
}
|
|
1545
1886
|
function policyAuditExplanation(fire) {
|
|
1546
1887
|
if (fire.outcome !== 'skipped' || fire.reason !== 'initiative_policy_suggestions_only')
|
|
1547
1888
|
return null;
|
|
1889
|
+
const metadata = fire.metadata;
|
|
1890
|
+
// A fire from before the server recorded the card cannot say; the old hedge stays for those.
|
|
1891
|
+
const card = policyCardSentence(metadata?.policyCard) ?? 'An inbox suggestion is not guaranteed.';
|
|
1548
1892
|
return {
|
|
1549
1893
|
summary: 'Skipped: suggestions-only policy',
|
|
1550
|
-
detail:
|
|
1894
|
+
detail: `The Agent policy prevented autonomous execution. Review the trigger preflight and Agent policy. ${card}`,
|
|
1551
1895
|
};
|
|
1552
1896
|
}
|
|
1553
1897
|
function renderFireAudit(fires, log) {
|
|
@@ -1562,7 +1906,13 @@ function renderFireAudit(fires, log) {
|
|
|
1562
1906
|
source: fire.source ?? '-',
|
|
1563
1907
|
reason: fire.metadata?.recordKind === 'schedule_end_marker'
|
|
1564
1908
|
? 'Schedule ended after prior fire'
|
|
1565
|
-
:
|
|
1909
|
+
: clockSkipAuditExplanation(fire)?.summary ??
|
|
1910
|
+
policyAuditExplanation(fire)?.summary ??
|
|
1911
|
+
coalescedAuditExplanation(fire)?.summary ??
|
|
1912
|
+
(0, planOutcome_1.fireAuditPlanOutcomeSummary)(fire) ??
|
|
1913
|
+
fire.reason ??
|
|
1914
|
+
fire.errorMessage ??
|
|
1915
|
+
'',
|
|
1566
1916
|
duration: fire.durationMs === undefined ? '-' : `${fire.durationMs}ms`,
|
|
1567
1917
|
replay: fire.metadata?.replayable === true || fire.metadata?.replayContext
|
|
1568
1918
|
? 'yes'
|
|
@@ -1579,6 +1929,20 @@ function renderFireAudit(fires, log) {
|
|
|
1579
1929
|
{ key: 'reason', header: 'REASON', maxWidth: 40 },
|
|
1580
1930
|
], log);
|
|
1581
1931
|
}
|
|
1932
|
+
/**
|
|
1933
|
+
* The largest finite trigger limit the server accepts. An owner with no cap of
|
|
1934
|
+
* their own resolves to exactly this, so a limit at or above it means "no limit"
|
|
1935
|
+
* and printing it as a number reads as a budget (OSK-22402). A server new enough
|
|
1936
|
+
* to say `unlimited` is believed; an older one is judged by the value.
|
|
1937
|
+
*/
|
|
1938
|
+
exports.TRIGGER_LIMIT_CEILING = 100_000_000;
|
|
1939
|
+
/** `used / limit (free free)`, or `used / unlimited` when there is no cap. */
|
|
1940
|
+
function describeTriggerBudget(budget) {
|
|
1941
|
+
const unlimited = budget.unlimited ?? budget.limit >= exports.TRIGGER_LIMIT_CEILING;
|
|
1942
|
+
return unlimited
|
|
1943
|
+
? `${budget.used} / unlimited`
|
|
1944
|
+
: `${budget.used} / ${budget.limit} (${budget.free} free)`;
|
|
1945
|
+
}
|
|
1582
1946
|
exports.triggerApi = {
|
|
1583
1947
|
create: (body) => data_provider_1.request.post('/api/triggers', body),
|
|
1584
1948
|
list: (path) => data_provider_1.request.get(path),
|
|
@@ -16,6 +16,14 @@ function nodeCancellationFromSnapshot(spaceId, runId, nodeKey, snapshot, reason)
|
|
|
16
16
|
throw new Error('Use a saved canonical run snapshot for this exact Space and workflow run.');
|
|
17
17
|
}
|
|
18
18
|
const selected = snapshot.nodes.filter((node) => record(node) && node.nodeKey === nodeKey);
|
|
19
|
+
// A mistyped node key used to surface as "must contain one exact node attempt", which blames
|
|
20
|
+
// the file the user just saved (OSK-22460). Say the key is not in it, and which keys are.
|
|
21
|
+
if (selected.length === 0) {
|
|
22
|
+
const keys = snapshot.nodes
|
|
23
|
+
.filter((node) => record(node) && typeof node.nodeKey === 'string')
|
|
24
|
+
.map((node) => String(node.nodeKey));
|
|
25
|
+
throw new Error(`Node "${nodeKey}" is not in this run snapshot.${keys.length ? ` Its nodes are: ${keys.join(', ')}.` : ''}`);
|
|
26
|
+
}
|
|
19
27
|
const node = selected[0];
|
|
20
28
|
if (selected.length !== 1 || !record(node) || !id(node.id) || node.workflowRunId !== runId
|
|
21
29
|
|| !integer(node.iteration) || !integer(node.planGeneration) || !id(node.nodeType)) {
|
|
@@ -61,6 +61,15 @@ function describeNodeDetail(node, attention = '') {
|
|
|
61
61
|
const loop = describeLoopProgress(node);
|
|
62
62
|
if (loop)
|
|
63
63
|
parts.push(loop);
|
|
64
|
+
// The text view left a skipped step and a condition's chosen branch blank, so a run that ended
|
|
65
|
+
// `succeeded` with half its graph unrun looked unexplained; only --json said why (OSK-22461).
|
|
66
|
+
const extra = node;
|
|
67
|
+
if (node.status === 'skipped' && typeof extra.output?.reason === 'string') {
|
|
68
|
+
parts.push(`skipped: ${extra.output.reason.replace(/_/g, ' ')}`);
|
|
69
|
+
}
|
|
70
|
+
if (extra.nodeType === 'condition' && node.status === 'succeeded' && typeof extra.outcome === 'string') {
|
|
71
|
+
parts.push(`took "${extra.outcome}"`);
|
|
72
|
+
}
|
|
64
73
|
return printable(parts.join('; '));
|
|
65
74
|
}
|
|
66
75
|
/**
|
|
@@ -13,7 +13,7 @@ export { decodeJwtExpiry, decodeJwtPayload } from './jwtUtils.js';
|
|
|
13
13
|
export { isAuthExpiredSseEvent, handleMidStreamAuthExpiry, type ParsedSseLike, type AuthExpiredCallbacks, type HandleMidStreamAuthExpiryResult, } from './authExpiredDetector.js';
|
|
14
14
|
export { formatReauthMessage, reauthCommand, EXIT_NEEDS_REAUTH, type AuthFailureReason, } from './messages.js';
|
|
15
15
|
export { classifyRefreshResponse, type RefreshResponseShape, type ClassifiedRefreshResult, type ClassifiedRefreshSuccess, type ClassifiedRefreshFailure, } from './refreshClassification.js';
|
|
16
|
-
export { refreshDaemonToken, revokeDaemonRefreshSession, withAuthLock, persistReauthState, needsReauthState, clearReauthState, installLockExitHandlers, __refreshDiagnostics, __resetUnknown401StreaksForTest, UNKNOWN_401_BUDGET, } from './refresh.js';
|
|
16
|
+
export { refreshDaemonToken, revokeDaemonRefreshSession, revokeDaemonRefreshSessionReported, type RefreshRevokeResult, withAuthLock, persistReauthState, needsReauthState, clearReauthState, installLockExitHandlers, __refreshDiagnostics, __resetUnknown401StreaksForTest, UNKNOWN_401_BUDGET, } from './refresh.js';
|
|
17
17
|
export { createRefreshScheduler, type RefreshScheduler, type RefreshSchedulerOptions, } from './refreshScheduler.js';
|
|
18
18
|
export { readAuthFromFd, __setFdReaderForTest, type FdAuthPayload } from './fdToken.js';
|
|
19
19
|
export { CredentialResolver, CREDENTIAL_PRECEDENCE, __resetCredentialResolverForTest, invalidateAuthHelperCache, classifyTokenKind, CI_TOKEN_PREFIX, PERSONAL_ACCESS_TOKEN_PREFIX, isStaticTokenKind, AuthHelperUntrustedError, AuthHelperUnavailableError, type CredentialSource, type CredentialStoreMode, type CredentialResolverOptions, type ResolvedCredential, type TokenKind, type HelperTrustDecision, type AuthHelperBlockedInfo, type AuthHelperSentinelInfo, } from './credentialResolver.js';
|
|
@@ -329,6 +329,7 @@ __export(index_exports, {
|
|
|
329
329
|
resolveProfileStateFile: () => import_profileStateDir.resolveProfileStateFile,
|
|
330
330
|
rethrowIfLiveStateRefusal: () => import_liveState.rethrowIfLiveStateRefusal,
|
|
331
331
|
revokeDaemonRefreshSession: () => import_refresh.revokeDaemonRefreshSession,
|
|
332
|
+
revokeDaemonRefreshSessionReported: () => import_refresh.revokeDaemonRefreshSessionReported,
|
|
332
333
|
runHeadersHelper: () => import_headers_helper.runHeadersHelper,
|
|
333
334
|
safeEqual: () => import_pkce.safeEqual,
|
|
334
335
|
sanitizeSpawnEnv: () => import_spawnEnv.sanitizeSpawnEnv,
|
|
@@ -725,6 +726,7 @@ var import_independentMachineReservation = require("./independentMachineReservat
|
|
|
725
726
|
resolveProfileStateFile,
|
|
726
727
|
rethrowIfLiveStateRefusal,
|
|
727
728
|
revokeDaemonRefreshSession,
|
|
729
|
+
revokeDaemonRefreshSessionReported,
|
|
728
730
|
runHeadersHelper,
|
|
729
731
|
safeEqual,
|
|
730
732
|
sanitizeSpawnEnv,
|
|
@@ -270,6 +270,28 @@ export declare function refreshDaemonToken(serverUrl: string, currentRefreshToke
|
|
|
270
270
|
* replay attempt while keeping back-compat with un-upgraded servers.
|
|
271
271
|
*/
|
|
272
272
|
export declare function revokeDaemonRefreshSession(serverUrl: string, refreshToken: string): Promise<void>;
|
|
273
|
+
/**
|
|
274
|
+
* What became of a revoke request. The server never says whether the presented
|
|
275
|
+
* token existed, so `accepted` is the strongest claim available: the server
|
|
276
|
+
* took the request, and a live session behind that token is now revoked.
|
|
277
|
+
* `refused` and `unreachable` mean the session, if there is one, is still live.
|
|
278
|
+
*/
|
|
279
|
+
export type RefreshRevokeResult = {
|
|
280
|
+
outcome: 'accepted';
|
|
281
|
+
} | {
|
|
282
|
+
outcome: 'refused';
|
|
283
|
+
status: number;
|
|
284
|
+
} | {
|
|
285
|
+
outcome: 'unreachable';
|
|
286
|
+
detail: string;
|
|
287
|
+
};
|
|
288
|
+
/**
|
|
289
|
+
* `revokeDaemonRefreshSession` with its outcome reported instead of swallowed,
|
|
290
|
+
* for a caller that must not tell a person "signed out" when the server never
|
|
291
|
+
* heard (OSK-22307: `skrr logout` did exactly that). Same request, same body,
|
|
292
|
+
* same 5-second bound; it never throws.
|
|
293
|
+
*/
|
|
294
|
+
export declare function revokeDaemonRefreshSessionReported(serverUrl: string, refreshToken: string): Promise<RefreshRevokeResult>;
|
|
273
295
|
export declare function persistReauthState(state: ReauthState): void;
|
|
274
296
|
export declare function needsReauthState(): {
|
|
275
297
|
needed: boolean;
|