@skrr-ai/cli 0.1.144 → 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 +5 -0
- package/dist/commands/agenda/plan.d.ts +7 -0
- package/dist/commands/agenda/plan.js +17 -0
- package/dist/commands/agent/message/approve.js +2 -4
- package/dist/commands/agent/message/decline.js +2 -4
- package/dist/commands/agent/message/pending.js +1 -1
- package/dist/commands/agents/plan-day.d.ts +11 -0
- package/dist/commands/agents/plan-day.js +41 -2
- package/dist/commands/agents/schedule-overview.js +6 -0
- package/dist/commands/agents/schedule-trace.js +12 -2
- package/dist/commands/agents/spawn.d.ts +36 -1
- package/dist/commands/agents/spawn.js +172 -3
- package/dist/commands/agents/upcoming.d.ts +1 -0
- package/dist/commands/agents/upcoming.js +18 -7
- package/dist/commands/commitments/create.js +1 -1
- package/dist/commands/commitments/update.js +1 -1
- package/dist/commands/spaces/workflow-templates/insert.js +4 -0
- package/dist/commands/store/show.js +22 -0
- package/dist/generated/agent-guides.json +19 -19
- package/dist/lib/agentic-stream.d.ts +7 -0
- package/dist/lib/agentic-stream.js +22 -0
- package/dist/lib/commitments.js +13 -1
- package/dist/lib/compasses.js +1 -1
- package/dist/lib/dedicated-power.js +10 -3
- package/dist/lib/format.d.ts +15 -0
- package/dist/lib/format.js +31 -0
- package/dist/lib/planOutcome.d.ts +51 -0
- package/dist/lib/planOutcome.js +88 -0
- package/dist/lib/proactiveApi.d.ts +62 -0
- package/dist/lib/proactiveApi.js +10 -1
- package/dist/lib/schedule.d.ts +25 -1
- package/dist/lib/schedule.js +37 -2
- package/dist/lib/triggers.d.ts +5 -0
- package/dist/lib/triggers.js +13 -2
- package/dist/node_modules/@skrr-ai/data-provider/index.js +4664 -4661
- package/oclif.manifest.json +33 -4
- package/package.json +1 -1
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readPlanOutcome = readPlanOutcome;
|
|
4
|
+
exports.renderPlanOutcomeTraceDetails = renderPlanOutcomeTraceDetails;
|
|
5
|
+
exports.latestPlanOutcomeLine = latestPlanOutcomeLine;
|
|
6
|
+
exports.fireAuditPlanOutcomeSummary = fireAuditPlanOutcomeSummary;
|
|
7
|
+
exports.alwaysOnUpcomingNote = alwaysOnUpcomingNote;
|
|
8
|
+
/**
|
|
9
|
+
* planOutcome.ts — read a Smart Schedule planning fire's recorded outcome.
|
|
10
|
+
*
|
|
11
|
+
* A watcher or planning-run fire that "completed" may have drafted nothing: it was watch-only,
|
|
12
|
+
* nothing changed, One Voice held it, quiet hours lowered auto to review, the planner proposed no
|
|
13
|
+
* blocks or failed. The API records which one on the fire (`metadata.builtinAction.planOutcome`) and
|
|
14
|
+
* the schedule trace carries it on the event (`detail.planOutcome`). These helpers only read and
|
|
15
|
+
* word that record; the vocabulary is owned by `@skrr-ai/data-provider` and the sentence by the API.
|
|
16
|
+
*/
|
|
17
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
18
|
+
/** The recorded outcome in `value`, or null when it is absent or not a known outcome. */
|
|
19
|
+
function readPlanOutcome(value) {
|
|
20
|
+
if (!value || typeof value !== 'object')
|
|
21
|
+
return null;
|
|
22
|
+
const candidate = value;
|
|
23
|
+
if (!(0, data_provider_1.isSmartSchedulePlanOutcomeCode)(candidate.outcome))
|
|
24
|
+
return null;
|
|
25
|
+
if (typeof candidate.reason !== 'string' || !candidate.reason)
|
|
26
|
+
return null;
|
|
27
|
+
return candidate;
|
|
28
|
+
}
|
|
29
|
+
function eventOutcome(event) {
|
|
30
|
+
const detail = event.detail;
|
|
31
|
+
if (!detail || typeof detail !== 'object')
|
|
32
|
+
return null;
|
|
33
|
+
return readPlanOutcome(detail.planOutcome);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Under the trace table: for every planning fire, WHY it did or did not leave a plan. The table's
|
|
37
|
+
* summary column says what ran; this says what it decided.
|
|
38
|
+
*/
|
|
39
|
+
function renderPlanOutcomeTraceDetails(events, log,
|
|
40
|
+
// The caller's own clock, so these lines agree with the table above them.
|
|
41
|
+
formatWhen = (at) => at.slice(0, 19).replace('T', ' ')) {
|
|
42
|
+
const rows = events
|
|
43
|
+
.map((event) => ({ event, outcome: eventOutcome(event) }))
|
|
44
|
+
.filter((row) => Boolean(row.outcome));
|
|
45
|
+
if (rows.length === 0)
|
|
46
|
+
return;
|
|
47
|
+
log('');
|
|
48
|
+
log('Planning outcomes:');
|
|
49
|
+
for (const { event, outcome } of rows) {
|
|
50
|
+
const when = event.occurredAt ? formatWhen(String(event.occurredAt)) : '-';
|
|
51
|
+
log(` ${when} ${outcome.outcome}${outcome.reasonCode ? ` (${outcome.reasonCode})` : ''}`);
|
|
52
|
+
log(` ${outcome.reason}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The answer to "why no plan today?" from the newest planning fire in this trace, or null when no
|
|
57
|
+
* fire in it recorded an outcome. Events arrive newest first.
|
|
58
|
+
*/
|
|
59
|
+
function latestPlanOutcomeLine(events) {
|
|
60
|
+
for (const event of events) {
|
|
61
|
+
const outcome = eventOutcome(event);
|
|
62
|
+
if (outcome)
|
|
63
|
+
return outcome.reason;
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The REASON column of a fire-audit row: the planning outcome's sentence when the fire recorded
|
|
69
|
+
* one, else undefined so the caller falls back to the fire's own reason.
|
|
70
|
+
*/
|
|
71
|
+
function fireAuditPlanOutcomeSummary(fire) {
|
|
72
|
+
return readPlanOutcome(fire.metadata?.builtinAction?.planOutcome)?.reason;
|
|
73
|
+
}
|
|
74
|
+
const ALWAYS_ON_REASONS = new Set(['disabled', 'always_on_disabled']);
|
|
75
|
+
/**
|
|
76
|
+
* The line under "withheld" in the upcoming view when the cause is Always-On. A trigger that is
|
|
77
|
+
* listed under Upcoming has passed the same fence the withheld ones failed, so it is not gated by
|
|
78
|
+
* Always-On: it still fires. Without this the two lists sit side by side and read as one rule
|
|
79
|
+
* (OSK-22406). Null when nothing is withheld for Always-On or nothing is listed.
|
|
80
|
+
*/
|
|
81
|
+
function alwaysOnUpcomingNote(withheld, listedCount) {
|
|
82
|
+
if (listedCount === 0)
|
|
83
|
+
return null;
|
|
84
|
+
if (!withheld.some((trigger) => ALWAYS_ON_REASONS.has(String(trigger.reason ?? ''))))
|
|
85
|
+
return null;
|
|
86
|
+
return ('Always-On is off for this agent. The withheld triggers wait for it; the triggers listed under ' +
|
|
87
|
+
'Upcoming are not gated by Always-On, so they still fire.');
|
|
88
|
+
}
|
|
@@ -94,6 +94,30 @@ export interface PlanProactiveAgentResponse {
|
|
|
94
94
|
outputTokens: number;
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
|
+
/** One object a spec will install (`POST /api/initiatives/spawn/preview`). */
|
|
98
|
+
export interface InstallPlanItem {
|
|
99
|
+
kind: string;
|
|
100
|
+
name: string;
|
|
101
|
+
label: string;
|
|
102
|
+
/** `requested` = the spec names it; `default` = the platform adds it, and `why` says why. */
|
|
103
|
+
origin: 'requested' | 'default';
|
|
104
|
+
why: string;
|
|
105
|
+
status: 'install' | 'declined' | 'will_be_blocked';
|
|
106
|
+
reason?: string;
|
|
107
|
+
detail?: string;
|
|
108
|
+
}
|
|
109
|
+
export interface InstallPreviewResponse {
|
|
110
|
+
items: InstallPlanItem[];
|
|
111
|
+
options: {
|
|
112
|
+
minimal: boolean;
|
|
113
|
+
without: string[];
|
|
114
|
+
};
|
|
115
|
+
runtime: {
|
|
116
|
+
commitments: 'can_run' | 'cannot_run' | 'unknown';
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
/** The defaults `--without` can decline; the server refuses any other name. */
|
|
120
|
+
export declare const DECLINABLE_DEFAULTS: readonly ["memory_watcher", "task_goal_watcher", "initiative_follow_through", "relationship_loops"];
|
|
97
121
|
export interface ApplyWarning {
|
|
98
122
|
step: string;
|
|
99
123
|
code: string;
|
|
@@ -172,6 +196,22 @@ export interface ApplyProactiveAgentResponse {
|
|
|
172
196
|
/** The first attempt made this one; a retry reported it instead of creating it again. */
|
|
173
197
|
existing?: boolean;
|
|
174
198
|
}>;
|
|
199
|
+
/** Everything that exists on the Agent after the apply, read back; a list is null when unreadable. */
|
|
200
|
+
inventory?: {
|
|
201
|
+
triggers: Array<{
|
|
202
|
+
id: string;
|
|
203
|
+
label: string | null;
|
|
204
|
+
source: string | null;
|
|
205
|
+
enabled: boolean;
|
|
206
|
+
origin: 'requested' | 'default';
|
|
207
|
+
}> | null;
|
|
208
|
+
commitments: Array<{
|
|
209
|
+
id: string;
|
|
210
|
+
title: string | null;
|
|
211
|
+
status: string | null;
|
|
212
|
+
systemRole: string | null;
|
|
213
|
+
}> | null;
|
|
214
|
+
};
|
|
175
215
|
initialize?: {
|
|
176
216
|
goals: Array<{
|
|
177
217
|
id?: string;
|
|
@@ -195,6 +235,15 @@ export interface ApplyProactiveAgentResponse {
|
|
|
195
235
|
};
|
|
196
236
|
};
|
|
197
237
|
warnings: ApplyWarning[];
|
|
238
|
+
/**
|
|
239
|
+
* Present only when `--minimal` / `--without` were requested: the defaults the server declined.
|
|
240
|
+
* Its absence after such a request means the server ignored the options.
|
|
241
|
+
*/
|
|
242
|
+
installOptions?: {
|
|
243
|
+
minimal: boolean;
|
|
244
|
+
without: string[];
|
|
245
|
+
declined: string[];
|
|
246
|
+
};
|
|
198
247
|
}
|
|
199
248
|
export type ProactiveAgentRecommendationStatus = 'proposed' | 'approved' | 'applied' | 'dismissed' | 'expired' | 'failed' | 'superseded';
|
|
200
249
|
export type ProactiveAgentRecommendationSource = 'meta_agent' | 'onboarding' | 'manual' | 'system';
|
|
@@ -282,7 +331,20 @@ export declare const proactiveApi: {
|
|
|
282
331
|
fromReviewedSpec?: boolean;
|
|
283
332
|
recommendationId?: string;
|
|
284
333
|
approvedSpecHash?: string;
|
|
334
|
+
/** Decline every default the platform would add beyond what the spec asks for. */
|
|
335
|
+
minimal?: boolean;
|
|
336
|
+
/** Decline one default by name (see `DECLINABLE_DEFAULTS`). */
|
|
337
|
+
without?: string[];
|
|
285
338
|
}) => Promise<ApplyProactiveAgentResponse>;
|
|
339
|
+
/** Read-only: every object a spec will install, marked requested or default. Never writes. */
|
|
340
|
+
previewProactiveAgentSpec: (body: {
|
|
341
|
+
spec: ProactiveAgentSpec;
|
|
342
|
+
agentId?: string;
|
|
343
|
+
timezone?: string;
|
|
344
|
+
fromReviewedSpec?: boolean;
|
|
345
|
+
minimal?: boolean;
|
|
346
|
+
without?: string[];
|
|
347
|
+
}) => Promise<InstallPreviewResponse>;
|
|
286
348
|
/** Meta-agent path: plan and persist a reviewable recommendation. */
|
|
287
349
|
planProactiveAgentRecommendation: (body: {
|
|
288
350
|
name?: string;
|
package/dist/lib/proactiveApi.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.proactiveApi = void 0;
|
|
3
|
+
exports.proactiveApi = exports.DECLINABLE_DEFAULTS = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* proactiveApi.ts — request-based client for the "spawn a proactive agent"
|
|
6
6
|
* endpoints (`/api/initiatives/spawn/*`).
|
|
@@ -15,11 +15,20 @@ exports.proactiveApi = void 0;
|
|
|
15
15
|
* → review → `apply` (creates the agent + installs the chosen system[s]).
|
|
16
16
|
*/
|
|
17
17
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
18
|
+
/** The defaults `--without` can decline; the server refuses any other name. */
|
|
19
|
+
exports.DECLINABLE_DEFAULTS = [
|
|
20
|
+
'memory_watcher',
|
|
21
|
+
'task_goal_watcher',
|
|
22
|
+
'initiative_follow_through',
|
|
23
|
+
'relationship_loops',
|
|
24
|
+
];
|
|
18
25
|
exports.proactiveApi = {
|
|
19
26
|
/** Plan-only: turn a sentence into a spec draft. Never writes. */
|
|
20
27
|
planProactiveAgent: (body) => data_provider_1.request.post('/api/initiatives/spawn/plan', body),
|
|
21
28
|
/** Apply a (clamped, server-re-validated) spec: create + install. */
|
|
22
29
|
applyProactiveAgentSpec: (body) => data_provider_1.request.post('/api/initiatives/spawn/apply', body),
|
|
30
|
+
/** Read-only: every object a spec will install, marked requested or default. Never writes. */
|
|
31
|
+
previewProactiveAgentSpec: (body) => data_provider_1.request.post('/api/initiatives/spawn/preview', body),
|
|
23
32
|
/** Meta-agent path: plan and persist a reviewable recommendation. */
|
|
24
33
|
planProactiveAgentRecommendation: (body) => data_provider_1.request.post('/api/initiatives/recommendations/plan', body),
|
|
25
34
|
listProactiveAgentRecommendations: (params) => {
|
package/dist/lib/schedule.d.ts
CHANGED
|
@@ -152,6 +152,26 @@ export interface SmartSchedulePlanRequest {
|
|
|
152
152
|
message: string;
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* The `202` answer to a propose that sent `Prefer: respond-async`: the plan day was
|
|
157
|
+
* claimed and the planner keeps running on the server. NOT a plan. A plan takes
|
|
158
|
+
* 35-66 s and the edge gives up at 60 s, so a command that asks this way is handed
|
|
159
|
+
* the request to follow instead of a 502/504 for a plan that is still running.
|
|
160
|
+
*/
|
|
161
|
+
export interface SmartSchedulePlanAccepted {
|
|
162
|
+
accepted: true;
|
|
163
|
+
planRequest: SmartSchedulePlanRequest | null;
|
|
164
|
+
message?: string;
|
|
165
|
+
}
|
|
166
|
+
export declare function isPlanAccepted(value: unknown): value is SmartSchedulePlanAccepted;
|
|
167
|
+
/**
|
|
168
|
+
* Has the request a `202` named finished, judged from a read of the day's record?
|
|
169
|
+
*
|
|
170
|
+
* A read with no record, or with an older request than ours, predates the claim (a
|
|
171
|
+
* poll already in flight when the 202 arrived), so it settles nothing. The same id
|
|
172
|
+
* settles when it is no longer holding; a NEWER request means ours is over.
|
|
173
|
+
*/
|
|
174
|
+
export declare function acceptedPlanVerdict(record: SmartSchedulePlanRequest | null | undefined, accepted: SmartSchedulePlanRequest | null | undefined): 'waiting' | 'settled';
|
|
155
175
|
export interface ApproveTodoInput {
|
|
156
176
|
tempId?: string;
|
|
157
177
|
name: string;
|
|
@@ -235,7 +255,11 @@ export interface ScheduleTraceEvent {
|
|
|
235
255
|
status?: string;
|
|
236
256
|
summary?: string;
|
|
237
257
|
source?: string;
|
|
258
|
+
/** A sentence for a person. The machine code behind it is `detail.reasonCode` (OSK-22558). */
|
|
238
259
|
reason?: string;
|
|
260
|
+
detail?: {
|
|
261
|
+
reasonCode?: string;
|
|
262
|
+
};
|
|
239
263
|
}
|
|
240
264
|
export interface ScheduleTrace {
|
|
241
265
|
object?: string;
|
|
@@ -309,7 +333,7 @@ export declare const scheduleApi: {
|
|
|
309
333
|
workingHoursOverride?: WorkingHoursWindow;
|
|
310
334
|
timezone?: string;
|
|
311
335
|
regenerateHint?: string;
|
|
312
|
-
}) => Promise<SmartScheduleProposal>;
|
|
336
|
+
}) => Promise<SmartScheduleProposal | SmartSchedulePlanAccepted>;
|
|
313
337
|
pendingProposal: (agentId: string) => Promise<{
|
|
314
338
|
proposal: SmartScheduleProposal | null;
|
|
315
339
|
/** Absent from older servers; null when no request is on record. */
|
package/dist/lib/schedule.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.scheduleApi = void 0;
|
|
4
|
+
exports.isPlanAccepted = isPlanAccepted;
|
|
5
|
+
exports.acceptedPlanVerdict = acceptedPlanVerdict;
|
|
4
6
|
exports.scheduleTraceToday = scheduleTraceToday;
|
|
5
7
|
exports.machineTimeZone = machineTimeZone;
|
|
6
8
|
exports.isValidTimeZone = isValidTimeZone;
|
|
@@ -43,6 +45,31 @@ exports.formatStamp = formatStamp;
|
|
|
43
45
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
44
46
|
const format_1 = require("./format");
|
|
45
47
|
const triggers_1 = require("./triggers");
|
|
48
|
+
function isPlanAccepted(value) {
|
|
49
|
+
return (Boolean(value) &&
|
|
50
|
+
typeof value === 'object' &&
|
|
51
|
+
value.accepted === true);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Has the request a `202` named finished, judged from a read of the day's record?
|
|
55
|
+
*
|
|
56
|
+
* A read with no record, or with an older request than ours, predates the claim (a
|
|
57
|
+
* poll already in flight when the 202 arrived), so it settles nothing. The same id
|
|
58
|
+
* settles when it is no longer holding; a NEWER request means ours is over.
|
|
59
|
+
*/
|
|
60
|
+
function acceptedPlanVerdict(record, accepted) {
|
|
61
|
+
if (!record)
|
|
62
|
+
return 'waiting';
|
|
63
|
+
if (!accepted)
|
|
64
|
+
return record.holds ? 'waiting' : 'settled';
|
|
65
|
+
if (record.requestId === accepted.requestId)
|
|
66
|
+
return record.holds ? 'waiting' : 'settled';
|
|
67
|
+
const mine = Date.parse(accepted.startedAt ?? '');
|
|
68
|
+
const theirs = Date.parse(record.startedAt ?? '');
|
|
69
|
+
if (Number.isFinite(mine) && Number.isFinite(theirs) && theirs < mine)
|
|
70
|
+
return 'waiting';
|
|
71
|
+
return record.holds ? 'waiting' : 'settled';
|
|
72
|
+
}
|
|
46
73
|
/** Calendar day at an instant in the zone used for the schedule query. */
|
|
47
74
|
function scheduleTraceToday(now, timezone) {
|
|
48
75
|
const parts = new Intl.DateTimeFormat('en-CA', {
|
|
@@ -117,7 +144,13 @@ exports.scheduleApi = {
|
|
|
117
144
|
updateTodo: (todoId, patch) => data_provider_1.request.patch(`/api/todos/${encodeURIComponent(todoId)}`, patch),
|
|
118
145
|
/** Cancel a To-Do (DELETE soft-cancels pending; see todos.js). */
|
|
119
146
|
cancelTodo: (todoId) => data_provider_1.request.delete(`/api/todos/${encodeURIComponent(todoId)}`),
|
|
120
|
-
proposeSmartSchedule: (input) =>
|
|
147
|
+
proposeSmartSchedule: (input) =>
|
|
148
|
+
// `Prefer: respond-async` (RFC 7240): once the server has claimed the day it answers
|
|
149
|
+
// 202 with the request to follow and keeps planning, instead of holding the
|
|
150
|
+
// connection past the edge's 60 s. A server that predates it ignores the header.
|
|
151
|
+
data_provider_1.request.postWithOptions('/api/todos/smart-schedule/propose', input, {
|
|
152
|
+
headers: { Prefer: 'respond-async' },
|
|
153
|
+
}),
|
|
121
154
|
pendingProposal: (agentId) => data_provider_1.request.get(`/api/todos/smart-schedule/pending?agentId=${encodeURIComponent(agentId)}`),
|
|
122
155
|
approveSmartSchedule: (input) => data_provider_1.request.post('/api/todos/smart-schedule/approve', input),
|
|
123
156
|
dismissProposal: (proposalId, agentId) => data_provider_1.request.post(`/api/todos/smart-schedule/${encodeURIComponent(proposalId)}/dismiss`, {
|
|
@@ -213,7 +246,9 @@ function todoPolicyBlockMessage(reason) {
|
|
|
213
246
|
/** Print explanations alongside the trace rows that recorded policy blocks. */
|
|
214
247
|
function renderTodoPolicyTraceDetails(events, log) {
|
|
215
248
|
for (const event of events) {
|
|
216
|
-
const message = event.type === 'todo_execution_failed'
|
|
249
|
+
const message = event.type === 'todo_execution_failed'
|
|
250
|
+
? todoPolicyBlockMessage(event.detail?.reasonCode ?? event.reason)
|
|
251
|
+
: undefined;
|
|
217
252
|
if (message)
|
|
218
253
|
log(` ${event.id ?? event.summary ?? 'To-Do'}: ${message}`);
|
|
219
254
|
}
|
package/dist/lib/triggers.d.ts
CHANGED
|
@@ -206,6 +206,11 @@ export interface TriggerFireRecord {
|
|
|
206
206
|
permissionRefusalsUnread?: boolean;
|
|
207
207
|
/** What became of the inbox card a policy-skipped fire was supposed to leave (OSK-21911). */
|
|
208
208
|
policyCard?: TriggerPolicyCard;
|
|
209
|
+
/** A built-in action's result; Smart Schedule's carries why it did or did not leave a plan. */
|
|
210
|
+
builtinAction?: {
|
|
211
|
+
builtinType?: string;
|
|
212
|
+
planOutcome?: unknown;
|
|
213
|
+
};
|
|
209
214
|
/** The working / quiet window that skipped this fire, as the server judged it (OSK-22528). */
|
|
210
215
|
window?: SkippedWindowRecord;
|
|
211
216
|
};
|
package/dist/lib/triggers.js
CHANGED
|
@@ -69,6 +69,7 @@ exports.describeTriggerBudget = describeTriggerBudget;
|
|
|
69
69
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
70
70
|
const node_fs_1 = require("node:fs");
|
|
71
71
|
const format_1 = require("./format");
|
|
72
|
+
const planOutcome_1 = require("./planOutcome");
|
|
72
73
|
exports.TRIGGER_KINDS = [
|
|
73
74
|
'schedule',
|
|
74
75
|
'once',
|
|
@@ -883,8 +884,9 @@ function describeScheduledFire(result) {
|
|
|
883
884
|
const report = result.scheduledFire;
|
|
884
885
|
if (typeof report !== 'object' || report === null)
|
|
885
886
|
return undefined;
|
|
886
|
-
const { wouldRun, reason, bypassed } = report;
|
|
887
|
+
const { wouldRun, reason, reasonText, bypassed } = report;
|
|
887
888
|
const why = typeof reason === 'string' && reason ? ` (${reason})` : '';
|
|
889
|
+
const sentence = typeof reasonText === 'string' && reasonText.trim() ? reasonText.trim() : null;
|
|
888
890
|
if (Array.isArray(bypassed) && bypassed.length > 0) {
|
|
889
891
|
const gates = bypassed
|
|
890
892
|
.map((entry) => `${String(entry.gate)}${entry.reason ? ` (${String(entry.reason)})` : ''}`)
|
|
@@ -892,6 +894,9 @@ function describeScheduledFire(result) {
|
|
|
892
894
|
return `Note: this manual fire bypassed ${gates}; a scheduled fire would not run.`;
|
|
893
895
|
}
|
|
894
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
|
+
}
|
|
895
900
|
return `Note: a scheduled fire would not run${why}; a manual fire is exempt from that check.`;
|
|
896
901
|
}
|
|
897
902
|
if (wouldRun === null) {
|
|
@@ -1901,7 +1906,13 @@ function renderFireAudit(fires, log) {
|
|
|
1901
1906
|
source: fire.source ?? '-',
|
|
1902
1907
|
reason: fire.metadata?.recordKind === 'schedule_end_marker'
|
|
1903
1908
|
? 'Schedule ended after prior fire'
|
|
1904
|
-
: clockSkipAuditExplanation(fire)?.summary ??
|
|
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
|
+
'',
|
|
1905
1916
|
duration: fire.durationMs === undefined ? '-' : `${fire.durationMs}ms`,
|
|
1906
1917
|
replay: fire.metadata?.replayable === true || fire.metadata?.replayContext
|
|
1907
1918
|
? 'yes'
|