@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
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_command_1 = require("../../base-command");
|
|
5
|
+
const format_1 = require("../../lib/format");
|
|
6
|
+
const proactive_audit_1 = require("../../lib/proactive-audit");
|
|
7
|
+
const DOMAINS = [
|
|
8
|
+
'agent_compass',
|
|
9
|
+
'agent_initiatives',
|
|
10
|
+
'smart_schedule',
|
|
11
|
+
'goal_planner',
|
|
12
|
+
];
|
|
13
|
+
/**
|
|
14
|
+
* `skrr agents proactive-audit <agent-id>` — who changed this agent's proactivity boundary, when
|
|
15
|
+
* and why, across Compass, the worker (initiatives), Smart Schedule and the goal planner, plus the
|
|
16
|
+
* switches its task/goal watcher runs with and whether each is a setting or the platform default.
|
|
17
|
+
*
|
|
18
|
+
* `GET /api/todos/proactive-audit` had no CLI path; the only way to read it was devtools, and
|
|
19
|
+
* minting a token to curl it needs an authenticator code (OSK-22418).
|
|
20
|
+
*/
|
|
21
|
+
class AgentsProactiveAudit extends base_command_1.BaseCommand {
|
|
22
|
+
static description = "Who changed an agent's proactivity boundary (Compass, worker, Smart Schedule, goal planner), and the task/goal watcher's effective switches";
|
|
23
|
+
static examples = [
|
|
24
|
+
'<%= config.bin %> agents proactive-audit <agent-id>',
|
|
25
|
+
'<%= config.bin %> agents proactive-audit <agent-id> --domain smart_schedule --limit 20 --json',
|
|
26
|
+
];
|
|
27
|
+
static args = {
|
|
28
|
+
agent: core_1.Args.string({ ignoreStdin: true, description: 'Agent ID', required: true }),
|
|
29
|
+
};
|
|
30
|
+
static flags = {
|
|
31
|
+
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
32
|
+
domain: core_1.Flags.string({
|
|
33
|
+
description: `Only one domain's changes (${DOMAINS.join(', ')})`,
|
|
34
|
+
options: DOMAINS,
|
|
35
|
+
}),
|
|
36
|
+
limit: core_1.Flags.integer({ description: 'Events to return (1-200, newest first)', min: 1, max: 200 }),
|
|
37
|
+
};
|
|
38
|
+
async run() {
|
|
39
|
+
this.requireAuth();
|
|
40
|
+
const { args, flags } = await this.parse(AgentsProactiveAudit);
|
|
41
|
+
let audit;
|
|
42
|
+
try {
|
|
43
|
+
audit = await proactive_audit_1.proactiveAuditApi.read({
|
|
44
|
+
agentId: args.agent,
|
|
45
|
+
domain: flags.domain,
|
|
46
|
+
limit: flags.limit,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
this.handleApiError(err);
|
|
51
|
+
}
|
|
52
|
+
if (flags.json) {
|
|
53
|
+
this.printJsonResult(audit);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (!audit) {
|
|
57
|
+
this.error('No audit returned.', { exit: 1 });
|
|
58
|
+
}
|
|
59
|
+
const events = audit.events ?? [];
|
|
60
|
+
this.log(`Proactivity audit - ${args.agent}`);
|
|
61
|
+
this.log('');
|
|
62
|
+
if (events.length === 0) {
|
|
63
|
+
this.log(flags.domain
|
|
64
|
+
? `No boundary changes recorded for ${flags.domain}.`
|
|
65
|
+
: 'No boundary changes recorded: nobody has changed this agent\'s proactivity settings.');
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
(0, format_1.renderTable)(events.map((event) => ({
|
|
69
|
+
when: event.occurredAt ? String(event.occurredAt).slice(0, 19).replace('T', ' ') : '-',
|
|
70
|
+
domain: (0, format_1.formatCell)(event.domain),
|
|
71
|
+
change: (0, format_1.formatCell)(event.changeType),
|
|
72
|
+
by: (0, format_1.formatCell)(event.actorAgentId ?? event.actorUserId ?? event.actorType),
|
|
73
|
+
why: (0, format_1.formatCell)(event.summary ?? event.reason),
|
|
74
|
+
})), [
|
|
75
|
+
{ key: 'when', header: 'WHEN' },
|
|
76
|
+
{ key: 'domain', header: 'DOMAIN' },
|
|
77
|
+
{ key: 'change', header: 'CHANGE', maxWidth: 24 },
|
|
78
|
+
{ key: 'by', header: 'BY', maxWidth: 24 },
|
|
79
|
+
{ key: 'why', header: 'WHY', maxWidth: 56 },
|
|
80
|
+
], (line) => this.log(line));
|
|
81
|
+
}
|
|
82
|
+
this.log('');
|
|
83
|
+
(0, proactive_audit_1.renderTaskGoalWatcherSettings)(audit.taskGoalWatcher, (line) => this.log(line));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.default = AgentsProactiveAudit;
|
|
@@ -26,6 +26,13 @@ export default class AgentsScheduleOverview extends BaseCommand {
|
|
|
26
26
|
};
|
|
27
27
|
run(): Promise<void>;
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Disabled triggers the person (or an agent on their behalf) authored. Not the reflection loop, which has
|
|
31
|
+
* its own section, and not a row a platform producer maintains, which nobody paused on purpose.
|
|
32
|
+
*/
|
|
33
|
+
export declare function pausedTriggers(triggers: TriggerDefinition[], reflection?: TriggerDefinition): TriggerDefinition[];
|
|
34
|
+
/** The paused triggers as the text view prints them: newest first, capped, with where to see the rest. */
|
|
35
|
+
export declare function pausedTriggerLines(paused: TriggerDefinition[], agentId: string, bin: string): string[];
|
|
29
36
|
/** The reflection loop as `--json` reports it. A paused loop has no next run (`-`). */
|
|
30
37
|
export declare function reflectionSummary(reflection: TriggerDefinition): {
|
|
31
38
|
autonomy?: "runs" | "suggests_only";
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pausedTriggers = pausedTriggers;
|
|
4
|
+
exports.pausedTriggerLines = pausedTriggerLines;
|
|
3
5
|
exports.reflectionSummary = reflectionSummary;
|
|
4
6
|
exports.reflectionLine = reflectionLine;
|
|
5
7
|
exports.reflectionNoteLine = reflectionNoteLine;
|
|
@@ -10,6 +12,7 @@ const base_command_1 = require("../../base-command");
|
|
|
10
12
|
const format_1 = require("../../lib/format");
|
|
11
13
|
const triggers_1 = require("../../lib/triggers");
|
|
12
14
|
const schedule_1 = require("../../lib/schedule");
|
|
15
|
+
const planOutcome_1 = require("../../lib/planOutcome");
|
|
13
16
|
const reflection_1 = require("../../lib/reflection");
|
|
14
17
|
/** Board statuses that mean "still open / not done" for the tasks section. */
|
|
15
18
|
const OPEN_TASK_STATUSES = new Set(['backlog', 'todo', 'in_progress', 'in_review', 'blocked']);
|
|
@@ -44,6 +47,7 @@ class AgentsScheduleOverview extends base_command_1.BaseCommand {
|
|
|
44
47
|
this.requireAuth();
|
|
45
48
|
const { args, flags } = await this.parse(AgentsScheduleOverview);
|
|
46
49
|
const agentId = args.id;
|
|
50
|
+
const todayZone = (0, schedule_1.machineTimeZone)();
|
|
47
51
|
const [upcomingR, firesR, triggersR, tasksR, todosR] = await Promise.allSettled([
|
|
48
52
|
data_provider_1.dataService.getUpcoming({
|
|
49
53
|
agentId,
|
|
@@ -55,15 +59,18 @@ class AgentsScheduleOverview extends base_command_1.BaseCommand {
|
|
|
55
59
|
scope: 'agent',
|
|
56
60
|
refEntity: (0, triggers_1.agentRefEntity)(agentId),
|
|
57
61
|
limit: 200,
|
|
58
|
-
// Whether the reflection loop's fires run: its row carries the verdict (OSK-21606).
|
|
59
|
-
|
|
62
|
+
// Whether the reflection loop's fires run: its row carries the verdict (OSK-21606). And whether
|
|
63
|
+
// the scheduler would still claim a limited schedule's next slot (OSK-22526).
|
|
64
|
+
include: 'autonomy,limits',
|
|
60
65
|
})),
|
|
61
66
|
// Filter SERVER-side. Fetching an unfiltered page and filtering in memory
|
|
62
67
|
// silently truncates the section for any user with more tasks than
|
|
63
68
|
// --task-limit, and made this view disagree with its MCP mirror
|
|
64
69
|
// (`self_schedule_overview`), which queries by assignee.
|
|
65
70
|
data_provider_1.dataService.listTasks({ assigneeAgentId: agentId, limit: flags['task-limit'] }),
|
|
66
|
-
|
|
71
|
+
// "Today" is the reader's day, not UTC's: the same zone todos list,
|
|
72
|
+
// plan-day and schedule-trace use (OSK-22398).
|
|
73
|
+
schedule_1.scheduleApi.listTodos(agentId, (0, schedule_1.scheduleTraceToday)(new Date(), todayZone), todayZone),
|
|
67
74
|
]);
|
|
68
75
|
const upcoming = settledValue(upcomingR)?.items ?? [];
|
|
69
76
|
// Triggers the Always-On control fence refuses. The server withholds them
|
|
@@ -80,6 +87,7 @@ class AgentsScheduleOverview extends base_command_1.BaseCommand {
|
|
|
80
87
|
agentId,
|
|
81
88
|
reflection: reflection ? reflectionSummary(reflection) : null,
|
|
82
89
|
upcoming,
|
|
90
|
+
pausedTriggers: pausedTriggers(triggers, reflection),
|
|
83
91
|
recentFires: fires,
|
|
84
92
|
openTasks,
|
|
85
93
|
todos,
|
|
@@ -121,6 +129,15 @@ class AgentsScheduleOverview extends base_command_1.BaseCommand {
|
|
|
121
129
|
{ key: 'detail', header: 'DETAIL', maxWidth: 44 },
|
|
122
130
|
], (line) => this.log(line));
|
|
123
131
|
}
|
|
132
|
+
// A trigger made disabled (the safe way to author one) is not "upcoming", and used to appear
|
|
133
|
+
// nowhere in this view, so a person could not tell their create had worked (OSK-22493).
|
|
134
|
+
const paused = pausedTriggers(triggers, reflection);
|
|
135
|
+
if (paused.length > 0) {
|
|
136
|
+
this.log('');
|
|
137
|
+
this.log(`■ Paused triggers (${paused.length}, not in Upcoming until enabled)`);
|
|
138
|
+
for (const line of pausedTriggerLines(paused, agentId, this.config.bin))
|
|
139
|
+
this.log(line);
|
|
140
|
+
}
|
|
124
141
|
if (blockedUpcoming.length > 0) {
|
|
125
142
|
const definite = blockedUpcoming.filter((b) => !b.indeterminate);
|
|
126
143
|
const unknown = blockedUpcoming.length - definite.length;
|
|
@@ -135,6 +152,11 @@ class AgentsScheduleOverview extends base_command_1.BaseCommand {
|
|
|
135
152
|
if (unknown > 0) {
|
|
136
153
|
this.log(` ${unknown} of these could not be resolved and are withheld fail-closed.`);
|
|
137
154
|
}
|
|
155
|
+
// The rows under "Upcoming" passed the fence the withheld ones failed, so say so (OSK-22406).
|
|
156
|
+
const alwaysOnNote = (0, planOutcome_1.alwaysOnUpcomingNote)(blockedUpcoming, upcoming.length);
|
|
157
|
+
if (alwaysOnNote) {
|
|
158
|
+
this.log(` ${alwaysOnNote}`);
|
|
159
|
+
}
|
|
138
160
|
}
|
|
139
161
|
// PAST.
|
|
140
162
|
this.log('');
|
|
@@ -165,9 +187,9 @@ class AgentsScheduleOverview extends base_command_1.BaseCommand {
|
|
|
165
187
|
}
|
|
166
188
|
// Today's to-dos.
|
|
167
189
|
this.log('');
|
|
168
|
-
this.log(
|
|
190
|
+
this.log(`■ Today's to-dos (${(0, schedule_1.scheduleTraceToday)(new Date(), todayZone)} in ${(0, schedule_1.describeTimeZone)(todayZone)})`);
|
|
169
191
|
reportError(todosR, (line) => this.log(` ${line}`));
|
|
170
|
-
(0, schedule_1.renderTodoList)(todos, (line) => this.log(line));
|
|
192
|
+
(0, schedule_1.renderTodoList)(todos, (line) => this.log(line), todayZone);
|
|
171
193
|
}
|
|
172
194
|
}
|
|
173
195
|
exports.default = AgentsScheduleOverview;
|
|
@@ -188,6 +210,28 @@ function filterAgentOpenTasks(response, agentId) {
|
|
|
188
210
|
return av - bv;
|
|
189
211
|
});
|
|
190
212
|
}
|
|
213
|
+
/** How many paused triggers the overview lists before pointing at the full list. */
|
|
214
|
+
const PAUSED_TRIGGER_LIMIT = 10;
|
|
215
|
+
/**
|
|
216
|
+
* Disabled triggers the person (or an agent on their behalf) authored. Not the reflection loop, which has
|
|
217
|
+
* its own section, and not a row a platform producer maintains, which nobody paused on purpose.
|
|
218
|
+
*/
|
|
219
|
+
function pausedTriggers(triggers, reflection) {
|
|
220
|
+
return triggers
|
|
221
|
+
.filter((t) => t.enabled === false && t.producerOwned !== true && t.id !== reflection?.id)
|
|
222
|
+
.sort((a, b) => String(b.createdAt ?? '').localeCompare(String(a.createdAt ?? '')));
|
|
223
|
+
}
|
|
224
|
+
/** The paused triggers as the text view prints them: newest first, capped, with where to see the rest. */
|
|
225
|
+
function pausedTriggerLines(paused, agentId, bin) {
|
|
226
|
+
const lines = paused.slice(0, PAUSED_TRIGGER_LIMIT).map((t) => {
|
|
227
|
+
const when = (0, triggers_1.scheduleSummaryLine)(t);
|
|
228
|
+
return ` ${t.id ?? '-'} ${t.kind ?? '-'} ${t.label ?? '(unlabeled)'}${when ? ` — ${when}` : ''}`;
|
|
229
|
+
});
|
|
230
|
+
if (paused.length > PAUSED_TRIGGER_LIMIT) {
|
|
231
|
+
lines.push(` … and ${paused.length - PAUSED_TRIGGER_LIMIT} more: ${bin} agents triggers list ${agentId}`);
|
|
232
|
+
}
|
|
233
|
+
return lines;
|
|
234
|
+
}
|
|
191
235
|
function describeCadence(trigger) {
|
|
192
236
|
const minutes = (0, reflection_1.reflectionCadenceMinutes)(trigger);
|
|
193
237
|
return minutes ? (0, reflection_1.describeCadenceMinutes)(minutes) : 'unknown';
|
|
@@ -4,6 +4,7 @@ const core_1 = require("@oclif/core");
|
|
|
4
4
|
const base_command_1 = require("../../base-command");
|
|
5
5
|
const format_1 = require("../../lib/format");
|
|
6
6
|
const schedule_1 = require("../../lib/schedule");
|
|
7
|
+
const planOutcome_1 = require("../../lib/planOutcome");
|
|
7
8
|
/**
|
|
8
9
|
* `skrr agents schedule-trace <agent-id>` — WHY the agent's day looks like this.
|
|
9
10
|
*
|
|
@@ -25,27 +26,28 @@ class AgentsScheduleTrace extends base_command_1.BaseCommand {
|
|
|
25
26
|
};
|
|
26
27
|
static flags = {
|
|
27
28
|
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
28
|
-
date: core_1.Flags.string({
|
|
29
|
+
date: core_1.Flags.string({
|
|
30
|
+
description: 'Plan date (YYYY-MM-DD). Defaults to today in the plan timezone.',
|
|
31
|
+
}),
|
|
29
32
|
todo: core_1.Flags.string({ description: 'Scope the trace to one to-do' }),
|
|
30
|
-
timezone: core_1.Flags.string({
|
|
33
|
+
timezone: core_1.Flags.string({
|
|
34
|
+
description: "IANA timezone for the plan day and for the times shown (defaults to this machine's timezone, as in plan-day and todos list)",
|
|
35
|
+
}),
|
|
31
36
|
limit: core_1.Flags.integer({ description: 'Events to return (1-200)' }),
|
|
32
37
|
cursor: core_1.Flags.string({ description: 'Cursor from a previous page' }),
|
|
33
38
|
};
|
|
34
39
|
async run() {
|
|
35
40
|
this.requireAuth();
|
|
36
41
|
const { args, flags } = await this.parse(AgentsScheduleTrace);
|
|
37
|
-
//
|
|
38
|
-
// already be tomorrow while it is still evening for the reader
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
catch {
|
|
46
|
-
this.error(`Invalid IANA timezone: ${timezone}`, { exit: 1 });
|
|
47
|
-
}
|
|
42
|
+
// One zone chooses the day, queries its events and renders them. UTC can
|
|
43
|
+
// already be tomorrow while it is still evening for the reader, and a
|
|
44
|
+
// `--date` with no zone used to fall through to whatever zone the server
|
|
45
|
+
// last saw, which is not the one the plan-day command proposed in.
|
|
46
|
+
const timezone = (0, schedule_1.resolveDayTimeZone)(flags.timezone);
|
|
47
|
+
if (!timezone) {
|
|
48
|
+
this.error(`Invalid IANA timezone: ${flags.timezone}`, { exit: 1 });
|
|
48
49
|
}
|
|
50
|
+
const date = flags.date ?? (0, schedule_1.scheduleTraceToday)(new Date(), timezone);
|
|
49
51
|
let trace;
|
|
50
52
|
try {
|
|
51
53
|
trace = await schedule_1.scheduleApi.scheduleTrace({
|
|
@@ -67,21 +69,37 @@ class AgentsScheduleTrace extends base_command_1.BaseCommand {
|
|
|
67
69
|
if (!trace) {
|
|
68
70
|
this.error('No trace returned.', { exit: 1 });
|
|
69
71
|
}
|
|
72
|
+
// Every time below is shown in the trace's own zone, named once here and
|
|
73
|
+
// on each row: the WHEN column was unlabelled UTC under a header naming the
|
|
74
|
+
// local day, so an evening event read as tomorrow's (OSK-22397). `--json`
|
|
75
|
+
// keeps the raw UTC instants.
|
|
76
|
+
const zone = trace.timezone || timezone;
|
|
70
77
|
this.log(`Schedule trace — ${trace.agentId ?? args.agent} · ${trace.planDate ?? date}`);
|
|
71
|
-
|
|
72
|
-
this.log(` timezone ${trace.timezone}`);
|
|
73
|
-
}
|
|
78
|
+
this.log(` timezone ${(0, schedule_1.describeTimeZone)(zone)} — times below are in this zone`);
|
|
74
79
|
const summary = trace.summary;
|
|
75
80
|
if (summary) {
|
|
76
81
|
this.log(` changes ${summary.changeCount ?? 0}`);
|
|
77
82
|
if (summary.latestChangeAt) {
|
|
78
|
-
this.log(` last change ${summary.latestChangeAt}`);
|
|
83
|
+
this.log(` last change ${(0, format_1.zonedTime)(summary.latestChangeAt, zone)}`);
|
|
79
84
|
}
|
|
80
85
|
if (summary.latestChangeSummary) {
|
|
81
|
-
this.log(` latest ${summary.latestChangeSummary}`);
|
|
86
|
+
this.log(` latest ${(0, format_1.localizeIsoInstants)(summary.latestChangeSummary, zone)}`);
|
|
82
87
|
}
|
|
83
88
|
}
|
|
89
|
+
// Whether a plan is being generated for this day, or the last attempt failed
|
|
90
|
+
// or went quiet. Said before the events because it explains why the day may
|
|
91
|
+
// look unplanned, and nothing in the event stream would.
|
|
92
|
+
const planning = (0, schedule_1.describePlanRequest)(trace.planRequest);
|
|
93
|
+
if (planning) {
|
|
94
|
+
this.log(` planning ${planning}`);
|
|
95
|
+
}
|
|
84
96
|
const events = trace.events ?? [];
|
|
97
|
+
// "Why no plan?" first: the newest planning fire's recorded outcome, before the event table
|
|
98
|
+
// that only says a watcher "Completed" (OSK-22395).
|
|
99
|
+
const latestOutcome = (0, planOutcome_1.latestPlanOutcomeLine)(events);
|
|
100
|
+
if (latestOutcome) {
|
|
101
|
+
this.log(` plan outcome ${latestOutcome}`);
|
|
102
|
+
}
|
|
85
103
|
this.log('');
|
|
86
104
|
if (events.length === 0) {
|
|
87
105
|
// An empty trace is a real answer — nothing touched this day's schedule —
|
|
@@ -101,19 +119,22 @@ class AgentsScheduleTrace extends base_command_1.BaseCommand {
|
|
|
101
119
|
return;
|
|
102
120
|
}
|
|
103
121
|
(0, format_1.renderTable)(events.map((e) => ({
|
|
104
|
-
when:
|
|
122
|
+
when: (0, format_1.zonedTime)(e.occurredAt, zone),
|
|
105
123
|
source: (0, format_1.formatCell)(e.source),
|
|
106
124
|
type: (0, format_1.formatCell)(e.type),
|
|
107
125
|
status: (0, format_1.formatCell)(e.status),
|
|
108
|
-
|
|
126
|
+
// The server writes these sentences and some embed a UTC instant; the
|
|
127
|
+
// rest of the table is in the trace's zone (OSK-22588).
|
|
128
|
+
summary: (0, format_1.localizeIsoInstants)((0, format_1.formatCell)(e.summary ?? e.reason), zone),
|
|
109
129
|
})), [
|
|
110
130
|
{ key: 'when', header: 'WHEN' },
|
|
111
131
|
{ key: 'source', header: 'SOURCE' },
|
|
112
|
-
{ key: 'type', header: 'TYPE', maxWidth:
|
|
132
|
+
{ key: 'type', header: 'TYPE', maxWidth: 32 },
|
|
113
133
|
{ key: 'status', header: 'STATUS' },
|
|
114
134
|
{ key: 'summary', header: 'SUMMARY', maxWidth: 48 },
|
|
115
135
|
], (line) => this.log(line));
|
|
116
136
|
(0, schedule_1.renderTodoPolicyTraceDetails)(events, (line) => this.log(line));
|
|
137
|
+
(0, planOutcome_1.renderPlanOutcomeTraceDetails)(events, (line) => this.log(line), (at) => (0, format_1.zonedTime)(at, zone));
|
|
117
138
|
// Which collection each column came from — the trace reconciles four
|
|
118
139
|
// sources and the reader should be able to go check one.
|
|
119
140
|
if (trace.sourcePolicy) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseCommand } from '../../base-command';
|
|
2
|
-
import { type ProactiveAgentSpec, type ApplyProactiveAgentResponse } from '../../lib/proactiveApi';
|
|
2
|
+
import { type InstallPlanItem, type ProactiveAgentSpec, type ApplyProactiveAgentResponse } from '../../lib/proactiveApi';
|
|
3
3
|
export type ProactiveInstallReadiness = {
|
|
4
4
|
status: 'ready' | 'degraded';
|
|
5
5
|
message: string;
|
|
@@ -8,6 +8,57 @@ export type ProactiveInstallReadiness = {
|
|
|
8
8
|
export declare function workerPolicyWindowLines(policy: NonNullable<ProactiveAgentSpec['worker']>['policy']): string[];
|
|
9
9
|
/** JSON previews show the effective disabled state without mutating the input spec. */
|
|
10
10
|
export declare function specWithEffectiveWindowFlags(spec: ProactiveAgentSpec): ProactiveAgentSpec;
|
|
11
|
+
/**
|
|
12
|
+
* A spec that validates as it stands: what `--print-spec-template` prints and what `--from-spec`
|
|
13
|
+
* reads. The shape was discoverable only by running a plan-only spawn and copying the `spec` out of
|
|
14
|
+
* its JSON (OSK-22416). Every key here is one the server's strict schema accepts, and a key it does
|
|
15
|
+
* not know is refused, so the template stays minimal rather than listing every optional field.
|
|
16
|
+
*/
|
|
17
|
+
export declare const SPEC_TEMPLATE: {
|
|
18
|
+
readonly identity: {
|
|
19
|
+
readonly name: "Overdue-work watcher";
|
|
20
|
+
readonly description: "Flags overdue tasks and stalled goals, and asks before acting.";
|
|
21
|
+
readonly provider: "agentic";
|
|
22
|
+
readonly model: "default";
|
|
23
|
+
};
|
|
24
|
+
readonly systems: readonly ["worker", "orchestrator"];
|
|
25
|
+
readonly worker: {
|
|
26
|
+
readonly watchers: readonly [{
|
|
27
|
+
readonly source: "task_goal_watcher";
|
|
28
|
+
readonly intervalMinutes: 60;
|
|
29
|
+
}];
|
|
30
|
+
readonly policy: {
|
|
31
|
+
readonly mode: "ask_first";
|
|
32
|
+
readonly workingHours: {
|
|
33
|
+
readonly enabled: true;
|
|
34
|
+
readonly start: "09:00";
|
|
35
|
+
readonly end: "18:00";
|
|
36
|
+
readonly timezone: "America/Los_Angeles";
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
readonly orchestrator: {
|
|
41
|
+
readonly mode: "review";
|
|
42
|
+
readonly executePlan: false;
|
|
43
|
+
readonly workingHours: {
|
|
44
|
+
readonly start: "09:00";
|
|
45
|
+
readonly end: "18:00";
|
|
46
|
+
readonly timezone: "America/Los_Angeles";
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
/** What the template's fields mean and which values they take, for `agents spawn --help`. */
|
|
51
|
+
export declare const SPEC_FORMAT_HELP: string;
|
|
52
|
+
/**
|
|
53
|
+
* The install plan as lines: every object a spec will install, marked `requested` (the spec names
|
|
54
|
+
* it) or `default` (the platform adds it, and why). A spec for one watcher installed ten systems and
|
|
55
|
+
* the plan and the receipt named one (OSK-22417). A default the target runtime cannot run is marked
|
|
56
|
+
* `will be blocked` with the reason, and a declined one `declined`, so what is NOT installed is as
|
|
57
|
+
* visible as what is.
|
|
58
|
+
*/
|
|
59
|
+
export declare function installPlanLines(items: InstallPlanItem[], bin: string): string[];
|
|
60
|
+
/** What `--minimal` / `--without` say when the server cannot honour them. */
|
|
61
|
+
export declare const DECLINE_UNSUPPORTED_MESSAGE = "This server does not support --minimal/--without yet; nothing was opted out.";
|
|
11
62
|
/** A value as one POSIX shell word, so a printed command can be pasted as it is. */
|
|
12
63
|
export declare function shellQuote(value: string): string;
|
|
13
64
|
/**
|
|
@@ -53,12 +104,38 @@ export default class AgentsSpawn extends BaseCommand {
|
|
|
53
104
|
'apply-recommendation': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
54
105
|
'spec-hash': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
55
106
|
'from-spec': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
107
|
+
'print-spec-template': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
108
|
+
minimal: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
109
|
+
without: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
56
110
|
'agent-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
57
111
|
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
58
112
|
message: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
59
113
|
timezone: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
60
114
|
};
|
|
61
115
|
run(): Promise<void>;
|
|
116
|
+
/** `--minimal` / `--without`, as the request body carries them. */
|
|
117
|
+
private declineOptions;
|
|
118
|
+
/**
|
|
119
|
+
* The install plan for a spec, or null when this server cannot answer. The preview is a read; an
|
|
120
|
+
* older server has no such route, and the spec preview beside it still stands. A 400 is the
|
|
121
|
+
* answer (a refused option or spec), not a missing plan, so it is rethrown.
|
|
122
|
+
*/
|
|
123
|
+
private readInstallPlan;
|
|
124
|
+
private printInstallPlan;
|
|
125
|
+
/**
|
|
126
|
+
* Refuse BEFORE creating anything when `--minimal` / `--without` were asked for and this server
|
|
127
|
+
* cannot honour them. A server that predates the options ignores them, applies every default and
|
|
128
|
+
* answers 200, which looked exactly like a successful opt-out (OSK-22586). The preview route is
|
|
129
|
+
* read-only and arrived with the options, so a server that answers it also applies them; a 404
|
|
130
|
+
* means it does not. Any other failure is thrown as it is: the apply is not attempted either way.
|
|
131
|
+
*/
|
|
132
|
+
private assertServerDeclinesDefaults;
|
|
133
|
+
/**
|
|
134
|
+
* After the apply: the server must say it applied the options. Covers a rolling deploy where the
|
|
135
|
+
* preview was answered by a new instance and the apply by an old one. The Agent then exists with
|
|
136
|
+
* every default, so the error names it.
|
|
137
|
+
*/
|
|
138
|
+
private assertDeclinesApplied;
|
|
62
139
|
private runFromSpec;
|
|
63
140
|
private runFromSentence;
|
|
64
141
|
private runRecommendationAction;
|