@skrr-ai/cli 0.1.142 → 0.1.144
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 +8 -0
- package/dist/base-command.d.ts +4 -2
- package/dist/base-command.js +46 -13
- 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 +72 -0
- package/dist/commands/agent/message/decline.d.ts +17 -0
- package/dist/commands/agent/message/decline.js +72 -0
- package/dist/commands/agent/message/pending.d.ts +18 -0
- package/dist/commands/agent/message/pending.js +79 -0
- package/dist/commands/agents/always-on/disable.js +9 -1
- package/dist/commands/agents/always-on/enable.js +9 -1
- package/dist/commands/agents/always-on/status.js +14 -1
- package/dist/commands/agents/create.js +10 -1
- package/dist/commands/agents/delete.d.ts +51 -0
- package/dist/commands/agents/delete.js +163 -2
- package/dist/commands/agents/intuitions/list.js +1 -1
- package/dist/commands/agents/plan-day.d.ts +39 -7
- package/dist/commands/agents/plan-day.js +254 -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 +43 -5
- package/dist/commands/agents/schedule-trace.js +30 -19
- package/dist/commands/agents/spawn.d.ts +51 -0
- package/dist/commands/agents/spawn.js +212 -9
- package/dist/commands/agents/todos/cancel.js +3 -0
- package/dist/commands/agents/todos/edit.js +1 -1
- 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/policy.js +7 -0
- package/dist/commands/agents/triggers/update.js +1 -1
- package/dist/commands/commitments/create.js +13 -3
- package/dist/commands/commitments/preflight.js +31 -5
- package/dist/commands/daemon/index.js +1 -0
- package/dist/commands/daemon/logs.d.ts +8 -1
- package/dist/commands/daemon/logs.js +32 -22
- package/dist/commands/daemon/profile.d.ts +15 -0
- package/dist/commands/daemon/profile.js +51 -0
- package/dist/commands/goals/briefing/status.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/machines/profiles/disconnect.d.ts +23 -0
- package/dist/commands/machines/profiles/disconnect.js +102 -0
- package/dist/commands/machines/profiles/index.d.ts +15 -0
- package/dist/commands/machines/profiles/index.js +33 -0
- package/dist/commands/machines/profiles/label.d.ts +24 -0
- package/dist/commands/machines/profiles/label.js +85 -0
- package/dist/commands/machines/profiles/list.d.ts +16 -0
- package/dist/commands/machines/profiles/list.js +87 -0
- package/dist/commands/memory/maintain.js +16 -2
- package/dist/commands/profiles/list.js +17 -2
- package/dist/commands/spaces/delete.js +6 -1
- 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/tasks/workflow-context.js +3 -1
- package/dist/commands/triggers/authorization.js +1 -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-guides.js +1 -1
- package/dist/lib/agent-proactive-baseline.d.ts +6 -0
- package/dist/lib/agent-proactive-baseline.js +32 -3
- package/dist/lib/always-on-command-result.d.ts +18 -0
- package/dist/lib/always-on-command-result.js +52 -0
- package/dist/lib/always-on-runtime.d.ts +31 -0
- package/dist/lib/always-on-runtime.js +39 -0
- package/dist/lib/auth-diagnostics.d.ts +10 -1
- package/dist/lib/auth-diagnostics.js +16 -8
- package/dist/lib/commitments.d.ts +16 -9
- package/dist/lib/commitments.js +65 -4
- package/dist/lib/compasses.js +5 -0
- package/dist/lib/daemon-binding.js +6 -3
- package/dist/lib/daemon-command-hint.d.ts +10 -5
- package/dist/lib/daemon-command-hint.js +11 -6
- 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 +16 -3
- package/dist/lib/daemonIslandProfile.d.ts +19 -0
- package/dist/lib/daemonIslandProfile.js +41 -0
- package/dist/lib/drain-stdio.d.ts +22 -0
- package/dist/lib/drain-stdio.js +46 -0
- package/dist/lib/format.d.ts +32 -0
- package/dist/lib/format.js +105 -1
- package/dist/lib/initiatives-worker.d.ts +25 -0
- package/dist/lib/initiatives-worker.js +13 -0
- package/dist/lib/keychain.d.ts +22 -1
- package/dist/lib/keychain.js +40 -1
- package/dist/lib/local-daemon-readiness.js +4 -6
- package/dist/lib/local-skills.js +4 -1
- package/dist/lib/login.d.ts +7 -0
- package/dist/lib/login.js +5 -0
- package/dist/lib/machines.d.ts +68 -0
- package/dist/lib/machines.js +67 -0
- package/dist/lib/proactive-audit.d.ts +52 -0
- package/dist/lib/proactive-audit.js +67 -0
- package/dist/lib/proactiveApi.d.ts +23 -0
- 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/runtime-start-verification.js +3 -6
- package/dist/lib/schedule.d.ts +189 -9
- package/dist/lib/schedule.js +283 -22
- package/dist/lib/triggers.d.ts +134 -3
- package/dist/lib/triggers.js +370 -17
- 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/configRoot.d.ts +12 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/configRoot.js +10 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceIdentityBridge.d.ts +8 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceIdentityBridge.js +22 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/executorStopReceiptV2.d.ts +133 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/executorStopReceiptV2.js +180 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.d.ts +5 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.js +50 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profilePorts.d.ts +137 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profilePorts.js +328 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profileSelection.d.ts +63 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profileSelection.js +174 -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/configRoot.d.ts +12 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/configRoot.js +14 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceIdentityBridge.d.ts +8 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceIdentityBridge.js +27 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/executorStopReceiptV2.d.ts +133 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/executorStopReceiptV2.js +183 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.d.ts +5 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.js +11 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profilePorts.d.ts +137 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profilePorts.js +333 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profileSelection.d.ts +63 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profileSelection.js +212 -0
- 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/auth-core/package.json +11 -1
- package/dist/node_modules/@skrr-ai/data-provider/index.js +7446 -7378
- package/oclif.manifest.json +844 -47
- package/package.json +1 -1
package/dist/lib/schedule.js
CHANGED
|
@@ -2,15 +2,26 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.scheduleApi = void 0;
|
|
4
4
|
exports.scheduleTraceToday = scheduleTraceToday;
|
|
5
|
+
exports.machineTimeZone = machineTimeZone;
|
|
6
|
+
exports.isValidTimeZone = isValidTimeZone;
|
|
7
|
+
exports.describeTimeZone = describeTimeZone;
|
|
8
|
+
exports.resolveDayTimeZone = resolveDayTimeZone;
|
|
5
9
|
exports.scheduleTracePath = scheduleTracePath;
|
|
6
10
|
exports.isSmartScheduleProposal = isSmartScheduleProposal;
|
|
7
11
|
exports.describeNonProposal = describeNonProposal;
|
|
12
|
+
exports.describePlanRequest = describePlanRequest;
|
|
8
13
|
exports.todoPolicyBlockMessage = todoPolicyBlockMessage;
|
|
9
14
|
exports.renderTodoPolicyTraceDetails = renderTodoPolicyTraceDetails;
|
|
10
15
|
exports.renderTodoList = renderTodoList;
|
|
11
16
|
exports.renderCapacityWarning = renderCapacityWarning;
|
|
17
|
+
exports.renderReplacementPreview = renderReplacementPreview;
|
|
18
|
+
exports.liveProposedTodos = liveProposedTodos;
|
|
12
19
|
exports.renderProposal = renderProposal;
|
|
20
|
+
exports.proposalNextSteps = proposalNextSteps;
|
|
21
|
+
exports.approvalEffectLines = approvalEffectLines;
|
|
22
|
+
exports.dismissEffectLines = dismissEffectLines;
|
|
13
23
|
exports.proposalToApproveTodos = proposalToApproveTodos;
|
|
24
|
+
exports.formatStamp = formatStamp;
|
|
14
25
|
/**
|
|
15
26
|
* schedule.ts — request-based client for the agent To-Do + Smart Schedule
|
|
16
27
|
* subsystem (`/api/todos/*`).
|
|
@@ -43,6 +54,46 @@ function scheduleTraceToday(now, timezone) {
|
|
|
43
54
|
const part = (type) => parts.find((item) => item.type === type)?.value;
|
|
44
55
|
return `${part('year')}-${part('month')}-${part('day')}`;
|
|
45
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* This machine's IANA zone — the "viewer" zone the web client also sends
|
|
59
|
+
* (`browserTimeZone()` on propose, list and trace). `UTC` only when the runtime
|
|
60
|
+
* cannot say.
|
|
61
|
+
*/
|
|
62
|
+
function machineTimeZone() {
|
|
63
|
+
try {
|
|
64
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone || 'UTC';
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return 'UTC';
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function isValidTimeZone(timeZone) {
|
|
71
|
+
try {
|
|
72
|
+
new Intl.DateTimeFormat('en-US', { timeZone });
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/** `America/Vancouver (PST)` — a zone name plus what it is called right now. */
|
|
80
|
+
function describeTimeZone(timeZone, at = new Date()) {
|
|
81
|
+
const abbreviation = (0, format_1.zoneAbbreviation)(timeZone, at);
|
|
82
|
+
return abbreviation && abbreviation !== timeZone ? `${timeZone} (${abbreviation})` : timeZone;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* One zone for one agent-day, for every Smart Schedule command that names a
|
|
86
|
+
* "today": `--timezone` when given, otherwise this machine's. `plan-day`,
|
|
87
|
+
* `schedule-trace`, `schedule-overview` and `todos list` used to default to
|
|
88
|
+
* three different zones (the server's last-seen browser zone, this machine, and
|
|
89
|
+
* UTC), so the same minute was a different day depending on the command
|
|
90
|
+
* (OSK-22397, OSK-22398). Returns `null` for an invalid explicit zone so the
|
|
91
|
+
* caller can fail with its own message.
|
|
92
|
+
*/
|
|
93
|
+
function resolveDayTimeZone(flag) {
|
|
94
|
+
const zone = flag?.trim() || machineTimeZone();
|
|
95
|
+
return isValidTimeZone(zone) ? zone : null;
|
|
96
|
+
}
|
|
46
97
|
function scheduleTracePath(params) {
|
|
47
98
|
return (0, triggers_1.withQuery)('/api/todos/smart-schedule/trace', {
|
|
48
99
|
agentId: params.agentId,
|
|
@@ -108,6 +159,46 @@ function describeNonProposal(value) {
|
|
|
108
159
|
const keys = Object.keys(value);
|
|
109
160
|
return keys.length === 0 ? 'empty object' : `object with keys: ${keys.slice(0, 8).join(', ')}`;
|
|
110
161
|
}
|
|
162
|
+
function clockTime(iso) {
|
|
163
|
+
const parsed = iso ? new Date(iso) : null;
|
|
164
|
+
if (!parsed || Number.isNaN(parsed.getTime()))
|
|
165
|
+
return 'an unknown time';
|
|
166
|
+
return parsed.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
|
|
167
|
+
}
|
|
168
|
+
function minutesSince(iso, now) {
|
|
169
|
+
const parsed = iso ? new Date(iso) : null;
|
|
170
|
+
if (!parsed || Number.isNaN(parsed.getTime()))
|
|
171
|
+
return '';
|
|
172
|
+
const minutes = Math.max(0, Math.round((now.getTime() - parsed.getTime()) / 60_000));
|
|
173
|
+
return minutes < 1 ? ', under a minute ago' : `, ${minutes} min ago`;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* One sentence for a plan request a person should know about, or null when
|
|
177
|
+
* there is nothing to say (no record, or a plan that simply succeeded).
|
|
178
|
+
*
|
|
179
|
+
* The same four states the web panel shows, worded for a terminal. `unknown`
|
|
180
|
+
* says what is true — the request stopped reporting — and does not claim the
|
|
181
|
+
* planner stopped.
|
|
182
|
+
*/
|
|
183
|
+
function describePlanRequest(request, now = new Date()) {
|
|
184
|
+
if (!request)
|
|
185
|
+
return null;
|
|
186
|
+
const kind = request.origin === 'automatic' ? 'automatic planning run' : 'planning request';
|
|
187
|
+
switch (request.state) {
|
|
188
|
+
case 'running':
|
|
189
|
+
return (`A plan for ${request.planDate} is being generated (started ${clockTime(request.startedAt)}` +
|
|
190
|
+
`${minutesSince(request.startedAt, now)}). Approve, dismiss and regenerate are paused until it finishes.`);
|
|
191
|
+
case 'unknown':
|
|
192
|
+
return (`The last ${kind} for ${request.planDate} (started ${clockTime(request.startedAt)}) never reported a result ` +
|
|
193
|
+
'and may have been interrupted. You can plan again; if it was still running, a second draft may appear.');
|
|
194
|
+
case 'failed':
|
|
195
|
+
return (`The last ${kind} for ${request.planDate} failed` +
|
|
196
|
+
`${request.finishedAt ? ` at ${clockTime(request.finishedAt)}` : ''}: ` +
|
|
197
|
+
`${request.failure?.message ?? 'no reason was recorded'}`);
|
|
198
|
+
default:
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
111
202
|
/** Explain terminal policy outcomes without changing the machine-readable status. */
|
|
112
203
|
function todoPolicyBlockMessage(reason) {
|
|
113
204
|
switch (reason) {
|
|
@@ -122,28 +213,30 @@ function todoPolicyBlockMessage(reason) {
|
|
|
122
213
|
/** Print explanations alongside the trace rows that recorded policy blocks. */
|
|
123
214
|
function renderTodoPolicyTraceDetails(events, log) {
|
|
124
215
|
for (const event of events) {
|
|
125
|
-
const message = event.type === 'todo_execution_failed'
|
|
126
|
-
? todoPolicyBlockMessage(event.reason)
|
|
127
|
-
: undefined;
|
|
216
|
+
const message = event.type === 'todo_execution_failed' ? todoPolicyBlockMessage(event.reason) : undefined;
|
|
128
217
|
if (message)
|
|
129
218
|
log(` ${event.id ?? event.summary ?? 'To-Do'}: ${message}`);
|
|
130
219
|
}
|
|
131
220
|
}
|
|
132
|
-
/**
|
|
133
|
-
|
|
221
|
+
/**
|
|
222
|
+
* Render a To-Do list as a table. `timeZone` names the zone the WHEN column is
|
|
223
|
+
* shown in (and is labelled on every row); omitted, rows keep the raw UTC
|
|
224
|
+
* instant the older output printed.
|
|
225
|
+
*/
|
|
226
|
+
function renderTodoList(todos, log, timeZone) {
|
|
134
227
|
if (todos.length === 0) {
|
|
135
228
|
log('No to-dos.');
|
|
136
229
|
return;
|
|
137
230
|
}
|
|
138
231
|
(0, format_1.renderTable)(todos.map((t) => ({
|
|
139
|
-
when: formatStamp(t.runAt),
|
|
232
|
+
when: formatStamp(t.runAt, timeZone, { seconds: false }),
|
|
140
233
|
status: t.status,
|
|
141
234
|
name: t.name,
|
|
142
235
|
mins: String(t.durationMinutes ?? '-'),
|
|
143
236
|
source: t.source === 'smart_schedule' ? 'smart' : 'manual',
|
|
144
237
|
id: t.id,
|
|
145
238
|
})), [
|
|
146
|
-
{ key: 'when', header: 'WHEN', maxWidth:
|
|
239
|
+
{ key: 'when', header: 'WHEN', maxWidth: 28 },
|
|
147
240
|
{ key: 'status', header: 'STATUS', maxWidth: 10 },
|
|
148
241
|
{ key: 'name', header: 'NAME', maxWidth: 36 },
|
|
149
242
|
{ key: 'mins', header: 'MINS' },
|
|
@@ -162,28 +255,71 @@ function renderTodoList(todos, log) {
|
|
|
162
255
|
* Silent when there is comfortable headroom — a budget line on every plan is
|
|
163
256
|
* noise, and noise is how a real warning gets ignored. It speaks up only when
|
|
164
257
|
* the budget is exhausted or nearly so, and always names the remediation
|
|
165
|
-
* rather than just the number.
|
|
258
|
+
* rather than just the number. An owner with no cap of their own never sees it.
|
|
259
|
+
*
|
|
260
|
+
* `agentId` makes the remedy a command that can be pasted; without it the
|
|
261
|
+
* command keeps a placeholder, which is only right when the caller cannot know.
|
|
166
262
|
*/
|
|
167
|
-
function renderCapacityWarning(capacity, log) {
|
|
168
|
-
if (!capacity || capacity.remaining > 3)
|
|
263
|
+
function renderCapacityWarning(capacity, log, agentId, phase = 'review') {
|
|
264
|
+
if (!capacity || capacity.unlimited === true || capacity.remaining > 3)
|
|
169
265
|
return;
|
|
170
266
|
if (capacity.remaining === 0) {
|
|
171
267
|
log(`Capacity: FULL — ${capacity.active} of ${capacity.limit} agent triggers in use.`);
|
|
172
|
-
log(' Approving this plan will be refused until you free a slot.');
|
|
173
268
|
}
|
|
174
269
|
else {
|
|
175
270
|
log(`Capacity: ${capacity.remaining} of ${capacity.limit} agent trigger slot(s) left.`);
|
|
176
271
|
}
|
|
272
|
+
if (phase === 'review') {
|
|
273
|
+
log(' To-dos use no trigger slot. Approval registers the schedule-check watcher' +
|
|
274
|
+
`${capacity.deltaWatcherInstalled === true ? ' (already installed)' : ' (if none exists)'}` +
|
|
275
|
+
' and, if you approve it, the next planning run; those need free slots, and approval is' +
|
|
276
|
+
' refused before anything is created when they do not fit.');
|
|
277
|
+
}
|
|
177
278
|
if (capacity.reclaimable > 0) {
|
|
178
|
-
log(` ${capacity.reclaimable} disabled trigger(s) can be
|
|
279
|
+
log(` ${capacity.reclaimable} disabled trigger(s) can be removed: preview with \`skrr triggers prune --agent ${agentId ?? '<agent-id>'} --dry-run\``);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Name the earlier blocks approval will cancel BEFORE the reviewer approves.
|
|
284
|
+
* The draft lists only what it adds, so without this the cancellation is only
|
|
285
|
+
* discoverable afterwards in the schedule trace (OSK-22419).
|
|
286
|
+
*/
|
|
287
|
+
function renderReplacementPreview(preview, zone, log) {
|
|
288
|
+
if (!preview || preview.blocks.length === 0)
|
|
289
|
+
return;
|
|
290
|
+
const from = preview.fromVersion ? ` from the approved plan v${preview.fromVersion}` : '';
|
|
291
|
+
log(`Approving this plan will CANCEL ${preview.blocks.length} earlier pending block(s)${from} ` +
|
|
292
|
+
'that this draft does not list:');
|
|
293
|
+
for (const block of preview.blocks) {
|
|
294
|
+
const tasks = (block.taskRefs ?? []).map((ref) => ref.titleSnapshot || ref.taskId).join('; ');
|
|
295
|
+
log(` - ${(0, format_1.zonedTime)(block.runAt, zone, { seconds: false })} ${block.name}${tasks ? ` [${tasks}]` : ''} (${block.todoId})`);
|
|
179
296
|
}
|
|
297
|
+
log('To keep them untouched, dismiss this plan (--dismiss) instead of approving it.');
|
|
298
|
+
log('');
|
|
180
299
|
}
|
|
181
|
-
/**
|
|
300
|
+
/** The zone a proposal is about: the one it was planned in. */
|
|
301
|
+
function proposalZone(proposal) {
|
|
302
|
+
return proposal.timezone || proposal.workingHours?.timezone || 'UTC';
|
|
303
|
+
}
|
|
304
|
+
/** The proposed to-dos a person would be approving (dropped ones are not). */
|
|
305
|
+
function liveProposedTodos(proposal) {
|
|
306
|
+
return proposal.todos.filter((t) => !t.dropped);
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Render a Smart Schedule proposal: header + the proposed (non-dropped) to-dos.
|
|
310
|
+
*
|
|
311
|
+
* Every instant is shown in the PLAN's zone and says which: a draft that "stays
|
|
312
|
+
* until midnight" is only readable as `00:00 PST`, not as `08:00Z` (OSK-22397).
|
|
313
|
+
* `--json` keeps the raw UTC instants.
|
|
314
|
+
*/
|
|
182
315
|
function renderProposal(proposal, log) {
|
|
183
316
|
const wh = proposal.workingHours;
|
|
317
|
+
const zone = proposalZone(proposal);
|
|
184
318
|
log(`Proposal: ${proposal.proposalId}`);
|
|
185
319
|
log(`Status: ${proposal.status ?? 'pending'}`);
|
|
186
|
-
log(`Timezone: ${proposal.
|
|
320
|
+
log(`Timezone: ${describeTimeZone(zone, proposal.generatedAt ? new Date(proposal.generatedAt) : new Date())}`);
|
|
321
|
+
if (proposal.planDate)
|
|
322
|
+
log(`Plan day: ${proposal.planDate}`);
|
|
187
323
|
log(`Hours: ${wh?.start ?? '?'}–${wh?.end ?? '?'}`);
|
|
188
324
|
const ctx = proposal.contextSummary;
|
|
189
325
|
log(`Context: ${ctx.openTaskCount} open task(s), ${ctx.goalCount} goal(s)` +
|
|
@@ -196,32 +332,150 @@ function renderProposal(proposal, log) {
|
|
|
196
332
|
? 'Task context was unavailable; the count may be incomplete.'
|
|
197
333
|
: 'Task search scope was not recorded for this proposal.';
|
|
198
334
|
log(`Task scope: ${taskScope}`);
|
|
199
|
-
if (proposal.expiresAt)
|
|
200
|
-
|
|
201
|
-
|
|
335
|
+
if (proposal.expiresAt) {
|
|
336
|
+
const expires = (0, format_1.zonedTime)(proposal.expiresAt, zone);
|
|
337
|
+
log(`Expires: ${expires}${/ 00:00:00 /.test(expires) ? ' (midnight at the end of the plan day)' : ''}`);
|
|
338
|
+
}
|
|
339
|
+
renderCapacityWarning(proposal.capacity, log, proposal.agentId);
|
|
202
340
|
if (proposal.nextRunSuggestion) {
|
|
203
|
-
log(`Next run: ${
|
|
341
|
+
log(`Next run: ${(0, format_1.zonedTime)(proposal.nextRunSuggestion.runAt, zone)}${proposal.nextRunSuggestion.reason ? ` · ${proposal.nextRunSuggestion.reason}` : ''}`);
|
|
204
342
|
}
|
|
205
343
|
log('');
|
|
206
|
-
const live = proposal
|
|
344
|
+
const live = liveProposedTodos(proposal);
|
|
207
345
|
if (live.length === 0) {
|
|
208
346
|
log('No proposed to-dos.');
|
|
209
347
|
return;
|
|
210
348
|
}
|
|
349
|
+
renderReplacementPreview(proposal.replacementPreview, zone, log);
|
|
211
350
|
(0, format_1.renderTable)(live.map((t) => ({
|
|
212
|
-
when:
|
|
351
|
+
when: (0, format_1.zonedTime)(t.runAt, zone, { seconds: false }),
|
|
213
352
|
mins: String(t.durationMinutes ?? '-'),
|
|
214
353
|
conf: t.confidence ?? '-',
|
|
215
354
|
name: t.name,
|
|
216
355
|
why: t.rationale ?? '',
|
|
217
356
|
})), [
|
|
218
|
-
{ key: 'when', header: 'WHEN', maxWidth:
|
|
357
|
+
{ key: 'when', header: 'WHEN', maxWidth: 28 },
|
|
219
358
|
{ key: 'mins', header: 'MINS' },
|
|
220
359
|
{ key: 'conf', header: 'CONF' },
|
|
221
360
|
{ key: 'name', header: 'NAME', maxWidth: 32 },
|
|
222
361
|
{ key: 'why', header: 'RATIONALE', maxWidth: 40 },
|
|
223
362
|
], log);
|
|
224
363
|
}
|
|
364
|
+
/**
|
|
365
|
+
* The commands that can succeed for THIS draft, in the order a person would
|
|
366
|
+
* reach for them.
|
|
367
|
+
*
|
|
368
|
+
* The footer used to be one generic three-line block, so an EMPTY draft led with
|
|
369
|
+
* `--approve`, which the same command refuses ("no schedulable to-dos"): the
|
|
370
|
+
* very first suggestion failed (OSK-22396). An empty draft can only be accepted
|
|
371
|
+
* together with its suggested next run, so that is the one accept command it
|
|
372
|
+
* prints; with no next run to schedule there is nothing to accept and the only
|
|
373
|
+
* move left is to discard it.
|
|
374
|
+
*/
|
|
375
|
+
function proposalNextSteps(proposal, bin, agentId) {
|
|
376
|
+
const base = `${bin} agents plan-day ${agentId}`;
|
|
377
|
+
const empty = liveProposedTodos(proposal).length === 0;
|
|
378
|
+
const lines = [];
|
|
379
|
+
if (empty) {
|
|
380
|
+
lines.push('Nothing to schedule: the planner proposed no to-dos. This is a draft; nothing has changed yet.');
|
|
381
|
+
if (proposal.nextRunSuggestion) {
|
|
382
|
+
lines.push(` Accept, and schedule the suggested next run: ${base} --approve --approve-next-run`);
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
lines.push(' There is nothing to approve: no to-dos and no next run to schedule.');
|
|
386
|
+
}
|
|
387
|
+
lines.push(` Discard: ${base} --dismiss`);
|
|
388
|
+
}
|
|
389
|
+
else {
|
|
390
|
+
lines.push('This is a draft — nothing is scheduled yet.');
|
|
391
|
+
lines.push(` Approve: ${base} --approve`);
|
|
392
|
+
if (proposal.nextRunSuggestion) {
|
|
393
|
+
lines.push(` Include next run: ${base} --approve --approve-next-run`);
|
|
394
|
+
}
|
|
395
|
+
lines.push(` Discard: ${base} --dismiss`);
|
|
396
|
+
}
|
|
397
|
+
if (!empty || proposal.nextRunSuggestion) {
|
|
398
|
+
lines.push('Approving also keeps the recurring schedule watcher on (it re-checks the plan a few times a day), unless you switched it off.');
|
|
399
|
+
}
|
|
400
|
+
return lines;
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* What an approval left behind besides To-Dos: the next planning run and the
|
|
404
|
+
* recurring watcher. The server always did both; only the next run was ever
|
|
405
|
+
* printed, so `upcoming` was the one place a person found the watcher
|
|
406
|
+
* (OSK-22403). Wording follows the web's approval notice.
|
|
407
|
+
*/
|
|
408
|
+
function approvalEffectLines(result, options) {
|
|
409
|
+
const lines = [];
|
|
410
|
+
if (options.approvedNextRun) {
|
|
411
|
+
const next = result.scheduledNextRun;
|
|
412
|
+
if (next?.created) {
|
|
413
|
+
lines.push(`Next planning run scheduled${next.runAt ? ` for ${(0, format_1.zonedTime)(next.runAt, options.timeZone)}` : ''}` +
|
|
414
|
+
`${next.triggerId ? ` (${next.triggerId})` : ''}.`);
|
|
415
|
+
}
|
|
416
|
+
else if (next?.skippedReason === 'existing_future_next_run') {
|
|
417
|
+
lines.push(`A next planning run is already scheduled${next.runAt ? ` for ${(0, format_1.zonedTime)(next.runAt, options.timeZone)}` : ''}` +
|
|
418
|
+
`${next.triggerId ? ` (${next.triggerId})` : ''}; none was added.`);
|
|
419
|
+
}
|
|
420
|
+
else {
|
|
421
|
+
lines.push(`Next planning run was not created${next?.message || next?.skippedReason ? `: ${next.message || next.skippedReason}` : '.'}`);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
const watcher = result.scheduledDeltaWatcher;
|
|
425
|
+
if (watcher) {
|
|
426
|
+
const times = watcher.times?.length
|
|
427
|
+
? ` (${watcher.times.length}x/day: ${watcher.times.join(', ')}${watcher.timezone ? ` ${watcher.timezone}` : ''})`
|
|
428
|
+
: '';
|
|
429
|
+
const manage = `Manage it with \`${options.bin} agents triggers list ${options.agentId}\`.`;
|
|
430
|
+
if (watcher.created) {
|
|
431
|
+
lines.push(`Recurring schedule watcher armed${times}. ${manage}`);
|
|
432
|
+
}
|
|
433
|
+
else if (watcher.skippedReason === 'existing_delta_watcher') {
|
|
434
|
+
lines.push(watcher.cadenceUpdated
|
|
435
|
+
? `Recurring schedule watcher is on and its check times were moved by this approval${times}. ${manage}`
|
|
436
|
+
: `Recurring schedule watcher is on and was not changed${times}. ${manage}`);
|
|
437
|
+
}
|
|
438
|
+
else if (watcher.skippedReason === 'disabled_delta_watcher') {
|
|
439
|
+
lines.push(`Recurring schedule watcher is off and was left off${times}. ${manage}`);
|
|
440
|
+
}
|
|
441
|
+
else if (watcher.skippedReason === 'delta_watcher_workspace_mismatch') {
|
|
442
|
+
// The watcher exists, in a different workspace from the one this request
|
|
443
|
+
// was made in (the CLI sends none unless told). Approval neither
|
|
444
|
+
// confirmed nor changed it, which is not the same as "not enabled".
|
|
445
|
+
lines.push(`Recurring schedule watcher was left untouched: the existing one is in a different workspace than this request, so this approval could not confirm or change it. ${manage}`);
|
|
446
|
+
}
|
|
447
|
+
else {
|
|
448
|
+
lines.push(`Recurring schedule watcher was not confirmed${watcher.message ? `: ${watcher.message}` : ''}. ${manage}`);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
return lines;
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Dismissing is plan feedback, and feedback may move the watcher's check times.
|
|
455
|
+
* Say which happened, so "why did the watcher fire at 11:00 and not 02:00" is
|
|
456
|
+
* never answerable only by diffing triggers before and after (OSK-22407).
|
|
457
|
+
*/
|
|
458
|
+
function dismissEffectLines(result) {
|
|
459
|
+
const watcher = result.deltaWatcher;
|
|
460
|
+
if (!watcher)
|
|
461
|
+
return [];
|
|
462
|
+
if (watcher.updated && watcher.times?.length) {
|
|
463
|
+
const before = watcher.previousTimes?.length
|
|
464
|
+
? watcher.previousTimes.join(', ')
|
|
465
|
+
: 'earlier times';
|
|
466
|
+
return [
|
|
467
|
+
`Recurring schedule watcher re-timed because of this feedback: ${before} -> ${watcher.times.join(', ')}` +
|
|
468
|
+
`${watcher.timezone ? ` ${watcher.timezone}` : ''}.`,
|
|
469
|
+
];
|
|
470
|
+
}
|
|
471
|
+
// No watcher at all is not worth a line.
|
|
472
|
+
if (watcher.skippedReason === 'delta_watcher_missing')
|
|
473
|
+
return [];
|
|
474
|
+
const times = watcher.times?.length
|
|
475
|
+
? ` (${watcher.times.join(', ')}${watcher.timezone ? ` ${watcher.timezone}` : ''})`
|
|
476
|
+
: '';
|
|
477
|
+
return [`Recurring schedule watcher was not changed${times}.`];
|
|
478
|
+
}
|
|
225
479
|
/** Map a proposal's live todos into the approve-payload shape (approve all). */
|
|
226
480
|
function proposalToApproveTodos(proposal) {
|
|
227
481
|
return proposal.todos
|
|
@@ -233,13 +487,20 @@ function proposalToApproveTodos(proposal) {
|
|
|
233
487
|
runAt: t.runAt,
|
|
234
488
|
timezone: proposal.timezone,
|
|
235
489
|
durationMinutes: t.durationMinutes,
|
|
490
|
+
// The draft's references are part of what the reviewer approved. Leaving
|
|
491
|
+
// them out makes the server create an unlinked To-Do (OSK-22413).
|
|
492
|
+
...(t.taskRefs ? { taskRefs: t.taskRefs } : {}),
|
|
493
|
+
...(t.commitmentRefs ? { commitmentRefs: t.commitmentRefs } : {}),
|
|
236
494
|
rationale: t.rationale,
|
|
237
495
|
confidence: t.confidence,
|
|
238
496
|
}));
|
|
239
497
|
}
|
|
240
|
-
|
|
498
|
+
/** An instant for a person: in `timeZone` with the zone named; raw UTC when none is given. */
|
|
499
|
+
function formatStamp(value, timeZone, options = {}) {
|
|
241
500
|
if (!value)
|
|
242
501
|
return '-';
|
|
502
|
+
if (timeZone)
|
|
503
|
+
return (0, format_1.zonedTime)(value, timeZone, options);
|
|
243
504
|
const d = new Date(value);
|
|
244
505
|
return Number.isNaN(d.getTime()) ? value : d.toISOString();
|
|
245
506
|
}
|
package/dist/lib/triggers.d.ts
CHANGED
|
@@ -82,6 +82,17 @@ export declare function validateEventFilter(input: {
|
|
|
82
82
|
filterField?: string;
|
|
83
83
|
filterValues?: string[];
|
|
84
84
|
}): void;
|
|
85
|
+
export interface SchedulerLimits {
|
|
86
|
+
state: 'ok' | 'reached';
|
|
87
|
+
reason?: string;
|
|
88
|
+
claimedToday?: number;
|
|
89
|
+
maxPerDay?: number | null;
|
|
90
|
+
claimedTotal?: number;
|
|
91
|
+
maxRuns?: number | null;
|
|
92
|
+
triggerFireCount?: number;
|
|
93
|
+
triggerFiresToday?: number;
|
|
94
|
+
note?: string;
|
|
95
|
+
}
|
|
85
96
|
export interface TriggerDefinition {
|
|
86
97
|
id?: string;
|
|
87
98
|
kind?: string;
|
|
@@ -153,6 +164,14 @@ export interface TriggerDefinition {
|
|
|
153
164
|
*/
|
|
154
165
|
autonomy?: 'runs' | 'suggests_only';
|
|
155
166
|
autonomyNote?: string;
|
|
167
|
+
/**
|
|
168
|
+
* Server-DERIVED reading of the scheduler's own run limits (OSK-22526): present on `GET
|
|
169
|
+
* /api/triggers/:id`, and on a list read with `?include=limits`, only for a schedule that forwards
|
|
170
|
+
* `--max-runs` / `--max-fires-per-day`. `reached` means the scheduler will skip the next slot
|
|
171
|
+
* whatever the trigger's own counters say. Absent means UNKNOWN (an older server, a schedule with no
|
|
172
|
+
* limit, a read that failed), never "fine".
|
|
173
|
+
*/
|
|
174
|
+
schedulerLimits?: SchedulerLimits;
|
|
156
175
|
createdAt?: string;
|
|
157
176
|
updatedAt?: string;
|
|
158
177
|
}
|
|
@@ -185,8 +204,38 @@ export interface TriggerFireRecord {
|
|
|
185
204
|
};
|
|
186
205
|
/** The refusal record could not be read for this fire, which is not "none were refused". */
|
|
187
206
|
permissionRefusalsUnread?: boolean;
|
|
207
|
+
/** What became of the inbox card a policy-skipped fire was supposed to leave (OSK-21911). */
|
|
208
|
+
policyCard?: TriggerPolicyCard;
|
|
209
|
+
/** The working / quiet window that skipped this fire, as the server judged it (OSK-22528). */
|
|
210
|
+
window?: SkippedWindowRecord;
|
|
188
211
|
};
|
|
189
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* `metadata.window` on a fire the trigger's own working or quiet window skipped. Absent on a fire
|
|
215
|
+
* recorded before the server kept it, and on a skip the platform scheduler recorded.
|
|
216
|
+
*/
|
|
217
|
+
export interface SkippedWindowRecord {
|
|
218
|
+
kind?: string;
|
|
219
|
+
start?: string;
|
|
220
|
+
end?: string;
|
|
221
|
+
/** The zone the window was read in; UTC when the window sets none. */
|
|
222
|
+
timezone?: string;
|
|
223
|
+
timezoneDefaulted?: boolean;
|
|
224
|
+
/** The instant the window was judged at. */
|
|
225
|
+
evaluatedAt?: string;
|
|
226
|
+
/** That instant as a clock time in `timezone`; null when the zone could not be read. */
|
|
227
|
+
localTime?: string | null;
|
|
228
|
+
}
|
|
229
|
+
/** `metadata.policyCard` on a policy-skipped fire. `reason` is a closed code, absent when a card was written. */
|
|
230
|
+
export interface TriggerPolicyCard {
|
|
231
|
+
/** This occurrence wrote a new card. */
|
|
232
|
+
created?: boolean;
|
|
233
|
+
/** A card that was already there covers this occurrence. */
|
|
234
|
+
existing?: boolean;
|
|
235
|
+
initiativeId?: string;
|
|
236
|
+
mode?: string;
|
|
237
|
+
reason?: string;
|
|
238
|
+
}
|
|
190
239
|
export interface TriggerListResponse {
|
|
191
240
|
triggers: TriggerDefinition[];
|
|
192
241
|
}
|
|
@@ -269,6 +318,8 @@ export interface SpaceAssistantResponse {
|
|
|
269
318
|
*/
|
|
270
319
|
export declare const SCOPE_IMPLIED_REF_KEY: Partial<Record<TriggerScopeKind, string>>;
|
|
271
320
|
export declare function parseKeyValueFlags(values: string[] | undefined, flagName: string, scopeKind?: string): Record<string, string>;
|
|
321
|
+
/** `--ref agentId=abc` as the `agent:abc` the list filter takes. Throws for a key that filters nothing. */
|
|
322
|
+
export declare function refEntitiesFromRefFlags(values: string[] | undefined): string[];
|
|
272
323
|
export declare function parseJsonObject(raw: string | undefined, flagName: string): Record<string, unknown> | undefined;
|
|
273
324
|
/**
|
|
274
325
|
* A JSON-array flag value: inline JSON, `@path` (a file), or a bare path to an existing file. A
|
|
@@ -527,6 +578,20 @@ export declare function formatDuplicateSubscriptionWarning(trigger: unknown): {
|
|
|
527
578
|
warning: string;
|
|
528
579
|
lines: string[];
|
|
529
580
|
} | null;
|
|
581
|
+
/**
|
|
582
|
+
* Advice about a window the trigger was just saved with, one sentence each, or none. The window was
|
|
583
|
+
* accepted; these say how it will be read (in UTC when it names no zone, as an empty quiet window that
|
|
584
|
+
* suppresses nothing), so a person finds out now and not from the first skipped fire (OSK-22530).
|
|
585
|
+
*/
|
|
586
|
+
export declare function windowAuthoringAdvice(trigger: unknown): string[];
|
|
587
|
+
/** What `--working-hours` / `--quiet-hours` take, for their `--help`. */
|
|
588
|
+
export declare const 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.";
|
|
589
|
+
/**
|
|
590
|
+
* Why a schedule whose own counters look healthy will not run, in the scheduler's numbers. The
|
|
591
|
+
* scheduler charges a limit when it claims a slot, so it can hold more than the trigger counts; once
|
|
592
|
+
* the limit is reached it drops every later slot without running or recording it (OSK-22526).
|
|
593
|
+
*/
|
|
594
|
+
export declare function schedulerLimitSentence(limits: SchedulerLimits): string;
|
|
530
595
|
/**
|
|
531
596
|
* Human phrasing for a trigger's enabled state (OSK-4886).
|
|
532
597
|
*
|
|
@@ -539,7 +604,9 @@ export declare function armedStateLabel(enabled: boolean | undefined, lastResult
|
|
|
539
604
|
oneShot?: {
|
|
540
605
|
fires?: number;
|
|
541
606
|
failures?: number;
|
|
542
|
-
} | null
|
|
607
|
+
} | null,
|
|
608
|
+
/** The server's reading of the scheduler's run limits: a reached limit means no slot will run (OSK-22526). */
|
|
609
|
+
schedulerLimits?: SchedulerLimits | null): string;
|
|
543
610
|
/**
|
|
544
611
|
* Human phrasing for an effect trigger's write mode (OSK-4886).
|
|
545
612
|
*
|
|
@@ -579,22 +646,69 @@ export declare function toolsRefusedHintLines(trigger: TriggerDefinition, kinds:
|
|
|
579
646
|
* for one.
|
|
580
647
|
*/
|
|
581
648
|
export declare function fireRefusalLines(metadata: unknown): string[];
|
|
649
|
+
/** The `--mode` flag's help, shared so create and update never describe the modes differently. */
|
|
650
|
+
export declare const 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\u2019s model budget).";
|
|
651
|
+
export declare function executorModeEffect(mode: unknown): string | undefined;
|
|
652
|
+
/**
|
|
653
|
+
* The text of the `Debounce:` line of `triggers show`. An event trigger carries a trigger-wide debounce (30s unless
|
|
654
|
+
* set), and neither its size nor its meaning was shown anywhere but raw JSON: a person deciding whether
|
|
655
|
+
* two close events both fire could not tell that the second is skipped, not queued, whatever its
|
|
656
|
+
* subject (OSK-21756). Undefined when there is nothing to say.
|
|
657
|
+
*/
|
|
658
|
+
export declare function debounceSummaryLine(trigger: TriggerDefinition): string | undefined;
|
|
659
|
+
/**
|
|
660
|
+
* When a schedule or one-shot trigger runs, in the zone it runs in (OSK-22487).
|
|
661
|
+
*
|
|
662
|
+
* `triggers create` and `triggers show` printed the kind, the mode and `Fires: 0 succeeded` and nothing
|
|
663
|
+
* about WHEN, so a schedule made without `--timezone` (which stores UTC) looked the same as one made
|
|
664
|
+
* for the person's own morning, eight hours apart. The zone is stated always, and the same instant is
|
|
665
|
+
* restated on this machine's clock when the two differ, so "09:30" cannot be mistaken for local time.
|
|
666
|
+
* A disabled trigger's next occurrence is labelled as conditional: nothing will run until it is enabled.
|
|
667
|
+
*
|
|
668
|
+
* Undefined for a kind with no clock (event, on_demand, ...). `machineZone` is a parameter so the text
|
|
669
|
+
* is deterministic under test.
|
|
670
|
+
*/
|
|
671
|
+
export declare function scheduleSummaryLine(trigger: TriggerDefinition, machineZone?: string | undefined): string | undefined;
|
|
672
|
+
/** What a builtin_action trigger does, from its stored action: the type and its config. */
|
|
673
|
+
export declare function builtinActionLine(trigger: TriggerDefinition): string | undefined;
|
|
582
674
|
export declare function renderTriggerSummary(trigger: TriggerDefinition, log: (line: string) => void, options?: {
|
|
583
675
|
baseURL?: string;
|
|
584
676
|
}): void;
|
|
585
677
|
export declare function renderLegacyRuns(runs: LegacyTriggerRun[], log: (line: string) => void): void;
|
|
586
|
-
/**
|
|
587
|
-
|
|
678
|
+
/**
|
|
679
|
+
* Why a fire was skipped by a working or quiet window, in words. Both trigger-level windows (Gate 5)
|
|
680
|
+
* consume the occurrence: a one-shot is spent, a recurring schedule carries on to its next slot, and
|
|
681
|
+
* nothing is retried. The Agent's own quiet hours (`initiative_policy_quiet_hours`) are a separate
|
|
682
|
+
* policy that can hold a one-shot, so that wording stays hedged.
|
|
683
|
+
*/
|
|
684
|
+
export declare function clockSkipAuditExplanation(fire: {
|
|
588
685
|
source?: unknown;
|
|
589
686
|
reason?: unknown;
|
|
590
687
|
outcome?: unknown;
|
|
688
|
+
metadata?: unknown;
|
|
689
|
+
}): {
|
|
690
|
+
summary: string;
|
|
691
|
+
detail: string;
|
|
692
|
+
} | null;
|
|
693
|
+
/**
|
|
694
|
+
* Why a coalesced occurrence did not run. `coalesced` with reason `in_flight` is the concurrency lane
|
|
695
|
+
* (gate 7) finding an earlier fire still holding it: this occurrence was dropped, not queued, and an
|
|
696
|
+
* occurrence that was dropped is consumed, so it is not retried (OSK-22509). The raw code alone read
|
|
697
|
+
* as a fire that was still in progress.
|
|
698
|
+
*/
|
|
699
|
+
export declare function coalescedAuditExplanation(fire: {
|
|
700
|
+
outcome?: unknown;
|
|
701
|
+
reason?: unknown;
|
|
591
702
|
}): {
|
|
592
703
|
summary: string;
|
|
593
704
|
detail: string;
|
|
594
705
|
} | null;
|
|
706
|
+
/** One sentence saying whether the fire left an inbox card, or null for a fire that predates the record. */
|
|
707
|
+
export declare function policyCardSentence(policyCard: unknown): string | null;
|
|
595
708
|
export declare function policyAuditExplanation(fire: {
|
|
596
709
|
outcome?: unknown;
|
|
597
710
|
reason?: unknown;
|
|
711
|
+
metadata?: unknown;
|
|
598
712
|
}): {
|
|
599
713
|
summary: string;
|
|
600
714
|
detail: string;
|
|
@@ -610,10 +724,13 @@ export interface TriggerQuotaStatus {
|
|
|
610
724
|
scopeKind: string;
|
|
611
725
|
active: number;
|
|
612
726
|
limit: number;
|
|
727
|
+
/** True when the limit is the platform ceiling, i.e. the owner has no cap of their own. */
|
|
728
|
+
unlimited?: boolean;
|
|
613
729
|
remaining: number;
|
|
614
730
|
reclaimable: number;
|
|
615
731
|
perUser: number;
|
|
616
732
|
perUserLimit: number;
|
|
733
|
+
perUserUnlimited?: boolean;
|
|
617
734
|
perUserRemaining: number;
|
|
618
735
|
/** Workspace used by the admission counter; null means the unscoped counter. */
|
|
619
736
|
counterWorkspaceId?: string | null;
|
|
@@ -625,6 +742,20 @@ export interface TriggerQuotaStatus {
|
|
|
625
742
|
*/
|
|
626
743
|
perUserReclaimable: number;
|
|
627
744
|
}
|
|
745
|
+
/**
|
|
746
|
+
* The largest finite trigger limit the server accepts. An owner with no cap of
|
|
747
|
+
* their own resolves to exactly this, so a limit at or above it means "no limit"
|
|
748
|
+
* and printing it as a number reads as a budget (OSK-22402). A server new enough
|
|
749
|
+
* to say `unlimited` is believed; an older one is judged by the value.
|
|
750
|
+
*/
|
|
751
|
+
export declare const TRIGGER_LIMIT_CEILING = 100000000;
|
|
752
|
+
/** `used / limit (free free)`, or `used / unlimited` when there is no cap. */
|
|
753
|
+
export declare function describeTriggerBudget(budget: {
|
|
754
|
+
used: number;
|
|
755
|
+
limit: number;
|
|
756
|
+
free: number;
|
|
757
|
+
unlimited?: boolean;
|
|
758
|
+
}): string;
|
|
628
759
|
export declare const triggerApi: {
|
|
629
760
|
create: (body: Record<string, unknown>) => Promise<TriggerDefinition>;
|
|
630
761
|
list: (path: string) => Promise<TriggerListResponse>;
|