@skrr-ai/cli 0.1.143 → 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.
Files changed (88) hide show
  1. package/README.md +8 -0
  2. package/dist/commands/agenda/trigger/create.js +4 -2
  3. package/dist/commands/agenda/trigger/list.js +7 -7
  4. package/dist/commands/agent/message/approve.d.ts +17 -0
  5. package/dist/commands/agent/message/approve.js +72 -0
  6. package/dist/commands/agent/message/decline.d.ts +17 -0
  7. package/dist/commands/agent/message/decline.js +72 -0
  8. package/dist/commands/agent/message/pending.d.ts +18 -0
  9. package/dist/commands/agent/message/pending.js +79 -0
  10. package/dist/commands/agents/delete.d.ts +45 -0
  11. package/dist/commands/agents/delete.js +139 -2
  12. package/dist/commands/agents/plan-day.d.ts +39 -7
  13. package/dist/commands/agents/plan-day.js +254 -65
  14. package/dist/commands/agents/proactive-audit.d.ts +22 -0
  15. package/dist/commands/agents/proactive-audit.js +86 -0
  16. package/dist/commands/agents/schedule-overview.d.ts +7 -0
  17. package/dist/commands/agents/schedule-overview.js +43 -5
  18. package/dist/commands/agents/schedule-trace.js +30 -19
  19. package/dist/commands/agents/spawn.d.ts +42 -0
  20. package/dist/commands/agents/spawn.js +91 -4
  21. package/dist/commands/agents/todos/list.d.ts +5 -0
  22. package/dist/commands/agents/todos/list.js +19 -5
  23. package/dist/commands/agents/triggers/create.js +1 -1
  24. package/dist/commands/agents/triggers/update.js +1 -1
  25. package/dist/commands/commitments/create.js +13 -3
  26. package/dist/commands/commitments/preflight.js +14 -3
  27. package/dist/commands/initiatives/worker/deactivate.d.ts +23 -0
  28. package/dist/commands/initiatives/worker/deactivate.js +78 -0
  29. package/dist/commands/login.js +8 -2
  30. package/dist/commands/logout.d.ts +20 -0
  31. package/dist/commands/logout.js +110 -5
  32. package/dist/commands/memory/maintain.js +16 -2
  33. package/dist/commands/spaces/delete.js +6 -1
  34. package/dist/commands/spaces/workflows/archive.js +6 -1
  35. package/dist/commands/spaces/workflows/publish.js +3 -1
  36. package/dist/commands/spaces/workflows/run.d.ts +1 -0
  37. package/dist/commands/spaces/workflows/run.js +17 -1
  38. package/dist/commands/spaces/workflows/triggers/create.js +3 -1
  39. package/dist/commands/tasks/workflow-context.js +3 -1
  40. package/dist/commands/triggers/capabilities.js +17 -1
  41. package/dist/commands/triggers/create.d.ts +2 -0
  42. package/dist/commands/triggers/create.js +23 -7
  43. package/dist/commands/triggers/fire-detail.js +12 -3
  44. package/dist/commands/triggers/list.d.ts +1 -0
  45. package/dist/commands/triggers/list.js +13 -1
  46. package/dist/commands/triggers/preflight.js +18 -0
  47. package/dist/commands/triggers/prune.js +9 -5
  48. package/dist/commands/triggers/update.js +13 -4
  49. package/dist/generated/agent-guides.json +35 -35
  50. package/dist/lib/agent-proactive-baseline.js +7 -1
  51. package/dist/lib/commitments.d.ts +16 -9
  52. package/dist/lib/commitments.js +65 -4
  53. package/dist/lib/daemon-setup.js +9 -3
  54. package/dist/lib/daemonBroker.d.ts +7 -0
  55. package/dist/lib/daemonBroker.js +5 -0
  56. package/dist/lib/daemonHandoff.d.ts +2 -0
  57. package/dist/lib/daemonHandoff.js +10 -1
  58. package/dist/lib/daemonIslandProfile.d.ts +19 -0
  59. package/dist/lib/daemonIslandProfile.js +41 -0
  60. package/dist/lib/format.d.ts +32 -0
  61. package/dist/lib/format.js +105 -1
  62. package/dist/lib/initiatives-worker.d.ts +25 -0
  63. package/dist/lib/initiatives-worker.js +13 -0
  64. package/dist/lib/login.d.ts +7 -0
  65. package/dist/lib/login.js +5 -0
  66. package/dist/lib/proactive-audit.d.ts +52 -0
  67. package/dist/lib/proactive-audit.js +67 -0
  68. package/dist/lib/proactiveApi.d.ts +9 -0
  69. package/dist/lib/refresh.d.ts +20 -6
  70. package/dist/lib/refresh.js +27 -9
  71. package/dist/lib/roles.d.ts +1 -1
  72. package/dist/lib/schedule.d.ts +189 -9
  73. package/dist/lib/schedule.js +283 -22
  74. package/dist/lib/triggers.d.ts +134 -3
  75. package/dist/lib/triggers.js +370 -17
  76. package/dist/lib/workflow-node-control.js +8 -0
  77. package/dist/lib/workflow-run-view.js +9 -0
  78. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.d.ts +1 -1
  79. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.js +2 -0
  80. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refresh.d.ts +22 -0
  81. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refresh.js +15 -4
  82. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.d.ts +1 -1
  83. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.js +1 -1
  84. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refresh.d.ts +22 -0
  85. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refresh.js +22 -4
  86. package/dist/node_modules/@skrr-ai/data-provider/index.js +4779 -4741
  87. package/oclif.manifest.json +494 -26
  88. package/package.json +1 -1
@@ -255,15 +255,33 @@ async function refreshCliToken() {
255
255
  });
256
256
  }
257
257
  /**
258
- * Best-effort revoke. Does NOT clear local backends — callers want to
259
- * stage the server revoke before nuking the local bundle so the server
260
- * accepts the request (revoke is authenticated by the refresh token
261
- * itself, which we're about to discard).
258
+ * Revoke this profile's CLI session on the server, and say what happened.
259
+ * Does NOT clear local backends: the revoke is authenticated by the refresh
260
+ * token itself, so the caller stages it before discarding the bundle.
261
+ *
262
+ * It used to return nothing and swallow every failure, so `skrr logout`
263
+ * printed "Signed out." over a session the server never heard about
264
+ * (OSK-22307). It never throws.
262
265
  */
263
266
  async function revokeCurrentRefreshToken() {
264
- const cfg = (0, config_1.loadConfig)();
265
- const read = (0, auth_storage_1.readFromBackend)(cfg.baseURL);
266
- if (!read.bundle?.refreshToken)
267
- return;
268
- await (0, auth_core_1.revokeDaemonRefreshSession)(cfg.baseURL, read.bundle.refreshToken);
267
+ let serverUrl;
268
+ let refreshToken;
269
+ try {
270
+ const cfg = (0, config_1.loadConfig)();
271
+ serverUrl = cfg.baseURL;
272
+ const read = (0, auth_storage_1.readFromBackend)(cfg.baseURL);
273
+ if (!read.bundle)
274
+ return { outcome: 'not_sent', reason: 'no_credential' };
275
+ refreshToken = read.bundle.refreshToken;
276
+ }
277
+ catch (err) {
278
+ return {
279
+ outcome: 'not_sent',
280
+ reason: 'read_failed',
281
+ detail: err instanceof Error ? err.message : String(err),
282
+ };
283
+ }
284
+ if (!refreshToken)
285
+ return { outcome: 'not_sent', reason: 'no_refresh_token' };
286
+ return (0, auth_core_1.revokeDaemonRefreshSessionReported)(serverUrl, refreshToken);
269
287
  }
@@ -53,7 +53,7 @@ export declare const roleApi: {
53
53
  config?: Record<string, unknown> | undefined;
54
54
  }[];
55
55
  sources: {
56
- source: "space" | "tasks" | "memory" | "daemon" | "email" | "goal" | "files" | "local" | "browser" | "conversations" | "slack" | "github" | "messages" | "calendar" | "docs" | "metrics" | "agent_run" | "agent_initiatives" | "documents" | "product_metrics" | "business_metrics" | "state_monitor" | "monitor";
56
+ source: "space" | "tasks" | "memory" | "daemon" | "email" | "goal" | "files" | "local" | "browser" | "conversations" | "slack" | "agent_initiatives" | "github" | "messages" | "calendar" | "docs" | "metrics" | "agent_run" | "documents" | "product_metrics" | "business_metrics" | "state_monitor" | "monitor";
57
57
  enabled: boolean;
58
58
  config?: Record<string, unknown> | undefined;
59
59
  }[];
@@ -6,6 +6,17 @@ export interface TodoTaskRef {
6
6
  titleSnapshot: string;
7
7
  statusSnapshot: string;
8
8
  }
9
+ /**
10
+ * A direct Commitment block (Smart Schedule only). The server revalidates it at
11
+ * approval, so the CLI carries the draft's reference through untouched.
12
+ */
13
+ export interface TodoCommitmentRef {
14
+ commitmentId: string;
15
+ titleSnapshot?: string;
16
+ kindSnapshot?: string;
17
+ versionSnapshot: number;
18
+ actionReason?: string;
19
+ }
9
20
  export interface Todo {
10
21
  id: string;
11
22
  agentId: string;
@@ -48,6 +59,24 @@ export interface ProposedTodo {
48
59
  confidence?: TodoConfidence;
49
60
  dropped?: boolean;
50
61
  taskRefs?: TodoTaskRef[];
62
+ commitmentRefs?: TodoCommitmentRef[];
63
+ }
64
+ /**
65
+ * A block from the previously approved plan that approving this draft cancels
66
+ * without the draft listing it (OSK-22419). Absent when approval retires nothing.
67
+ */
68
+ export interface ReplacementPreview {
69
+ fromVersion?: number;
70
+ blocks: Array<{
71
+ todoId: string;
72
+ name: string;
73
+ runAt: string;
74
+ durationMinutes?: number;
75
+ taskRefs?: Array<{
76
+ taskId: string;
77
+ titleSnapshot?: string;
78
+ }>;
79
+ }>;
51
80
  }
52
81
  export interface WorkingHoursWindow {
53
82
  start: string;
@@ -57,7 +86,10 @@ export interface WorkingHoursWindow {
57
86
  export interface SmartScheduleProposal {
58
87
  proposalId: string;
59
88
  agentId: string;
60
- status?: 'pending' | 'approved' | 'dismissed' | 'superseded' | 'expired';
89
+ status?: 'pending' | 'approving' | 'approved' | 'dismissed' | 'superseded' | 'expired';
90
+ /** The local calendar day (YYYY-MM-DD, in `timezone`) this plan covers. */
91
+ planDate?: string;
92
+ version?: number;
61
93
  generatedAt: string;
62
94
  expiresAt?: string;
63
95
  timezone: string;
@@ -70,6 +102,7 @@ export interface SmartScheduleProposal {
70
102
  truncated: boolean;
71
103
  };
72
104
  todos: ProposedTodo[];
105
+ replacementPreview?: ReplacementPreview;
73
106
  nextRunSuggestion?: {
74
107
  runAt: string;
75
108
  reason?: string;
@@ -87,8 +120,37 @@ export interface TriggerCapacity {
87
120
  scopeKind: string;
88
121
  active: number;
89
122
  limit: number;
123
+ /** True when the owner has no cap of their own; `limit` is then the platform ceiling. */
124
+ unlimited?: boolean;
90
125
  remaining: number;
91
126
  reclaimable: number;
127
+ /** Whether approving would find the schedule-check watcher already installed. */
128
+ deltaWatcherInstalled?: boolean | null;
129
+ }
130
+ /**
131
+ * The server's record of whether a plan is being generated for one agent-day.
132
+ *
133
+ * `holds` is the single answer to "may I approve, dismiss or regenerate": it is
134
+ * true only while a request is `running` and inside its expiry. `unknown` is a
135
+ * `running` request that has gone quiet past the longest a planner may run — a
136
+ * statement about silence, not proof that anything stopped.
137
+ */
138
+ export type PlanRequestState = 'running' | 'unknown' | 'succeeded' | 'failed';
139
+ export interface SmartSchedulePlanRequest {
140
+ requestId: string;
141
+ agentId: string;
142
+ planDate: string;
143
+ state: PlanRequestState;
144
+ holds: boolean;
145
+ origin?: 'requested' | 'automatic';
146
+ startedAt?: string;
147
+ expiresAt?: string;
148
+ finishedAt?: string;
149
+ proposalId?: string;
150
+ failure?: {
151
+ code: string;
152
+ message: string;
153
+ };
92
154
  }
93
155
  export interface ApproveTodoInput {
94
156
  tempId?: string;
@@ -97,6 +159,8 @@ export interface ApproveTodoInput {
97
159
  runAt: string;
98
160
  timezone?: string;
99
161
  durationMinutes?: number;
162
+ taskRefs?: TodoTaskRef[];
163
+ commitmentRefs?: TodoCommitmentRef[];
100
164
  rationale?: string;
101
165
  confidence?: TodoConfidence;
102
166
  }
@@ -115,9 +179,40 @@ export interface ApproveSmartScheduleResponse {
115
179
  scheduledNextRun?: {
116
180
  created?: boolean;
117
181
  triggerId?: string;
182
+ runAt?: string;
118
183
  skippedReason?: string;
119
184
  message?: string;
120
185
  } | null;
186
+ /** Blocks of the previously approved plan this approval cancelled or kept. */
187
+ replaced?: {
188
+ cancelled?: string[];
189
+ kept?: string[];
190
+ };
191
+ /**
192
+ * The recurring schedule watcher an approval keeps on. `created` when this
193
+ * approval armed it, `skippedReason` when it was already there, switched off
194
+ * (`disabled_delta_watcher`), or could not be made. Absent on older servers
195
+ * and when an approval was only partly applied.
196
+ */
197
+ scheduledDeltaWatcher?: DeltaWatcherOutcome | null;
198
+ }
199
+ export interface DeltaWatcherOutcome {
200
+ created?: boolean;
201
+ updated?: boolean;
202
+ triggerId?: string;
203
+ skippedReason?: string;
204
+ /** Wall-clock fire times (HH:MM) in `timezone`. */
205
+ times?: string[];
206
+ previousTimes?: string[];
207
+ timezone?: string;
208
+ message?: string;
209
+ /** Set when feedback from this very approval moved `times` after the watcher was ensured. */
210
+ cadenceUpdated?: boolean;
211
+ }
212
+ export interface DismissSmartScheduleResponse {
213
+ proposal: SmartScheduleProposal;
214
+ /** Present when dismissing the plan also moved the watcher's check times. */
215
+ deltaWatcher?: DeltaWatcherOutcome;
121
216
  }
122
217
  /**
123
218
  * The self-schedule TRACE — why the agent's day looks the way it does.
@@ -155,11 +250,32 @@ export interface ScheduleTrace {
155
250
  };
156
251
  sourcePolicy?: Record<string, string>;
157
252
  events?: ScheduleTraceEvent[];
253
+ /** Whether a plan is being generated for this day, failed, or went quiet. */
254
+ planRequest?: SmartSchedulePlanRequest | null;
158
255
  has_more?: boolean;
159
256
  next_cursor?: string | null;
160
257
  }
161
258
  /** Calendar day at an instant in the zone used for the schedule query. */
162
259
  export declare function scheduleTraceToday(now: Date, timezone: string): string;
260
+ /**
261
+ * This machine's IANA zone — the "viewer" zone the web client also sends
262
+ * (`browserTimeZone()` on propose, list and trace). `UTC` only when the runtime
263
+ * cannot say.
264
+ */
265
+ export declare function machineTimeZone(): string;
266
+ export declare function isValidTimeZone(timeZone: string): boolean;
267
+ /** `America/Vancouver (PST)` — a zone name plus what it is called right now. */
268
+ export declare function describeTimeZone(timeZone: string, at?: Date): string;
269
+ /**
270
+ * One zone for one agent-day, for every Smart Schedule command that names a
271
+ * "today": `--timezone` when given, otherwise this machine's. `plan-day`,
272
+ * `schedule-trace`, `schedule-overview` and `todos list` used to default to
273
+ * three different zones (the server's last-seen browser zone, this machine, and
274
+ * UTC), so the same minute was a different day depending on the command
275
+ * (OSK-22397, OSK-22398). Returns `null` for an invalid explicit zone so the
276
+ * caller can fail with its own message.
277
+ */
278
+ export declare function resolveDayTimeZone(flag?: string): string | null;
163
279
  export declare function scheduleTracePath(params: {
164
280
  agentId: string;
165
281
  date: string;
@@ -196,6 +312,8 @@ export declare const scheduleApi: {
196
312
  }) => Promise<SmartScheduleProposal>;
197
313
  pendingProposal: (agentId: string) => Promise<{
198
314
  proposal: SmartScheduleProposal | null;
315
+ /** Absent from older servers; null when no request is on record. */
316
+ planRequest?: SmartSchedulePlanRequest | null;
199
317
  }>;
200
318
  approveSmartSchedule: (input: {
201
319
  agentId: string;
@@ -205,9 +323,7 @@ export declare const scheduleApi: {
205
323
  saveHoursAsDefault?: boolean;
206
324
  workingHours?: WorkingHoursWindow;
207
325
  }) => Promise<ApproveSmartScheduleResponse>;
208
- dismissProposal: (proposalId: string, agentId?: string) => Promise<{
209
- proposal: SmartScheduleProposal;
210
- }>;
326
+ dismissProposal: (proposalId: string, agentId?: string) => Promise<DismissSmartScheduleResponse>;
211
327
  };
212
328
  /**
213
329
  * Is this actually a proposal?
@@ -228,22 +344,86 @@ export declare function isSmartScheduleProposal(value: unknown): value is SmartS
228
344
  * HTML error page, and dumping it into the user's terminal helps nobody.
229
345
  */
230
346
  export declare function describeNonProposal(value: unknown): string;
347
+ /**
348
+ * One sentence for a plan request a person should know about, or null when
349
+ * there is nothing to say (no record, or a plan that simply succeeded).
350
+ *
351
+ * The same four states the web panel shows, worded for a terminal. `unknown`
352
+ * says what is true — the request stopped reporting — and does not claim the
353
+ * planner stopped.
354
+ */
355
+ export declare function describePlanRequest(request: SmartSchedulePlanRequest | null | undefined, now?: Date): string | null;
231
356
  /** Explain terminal policy outcomes without changing the machine-readable status. */
232
357
  export declare function todoPolicyBlockMessage(reason?: string): string | undefined;
233
358
  /** Print explanations alongside the trace rows that recorded policy blocks. */
234
359
  export declare function renderTodoPolicyTraceDetails(events: ScheduleTraceEvent[], log: (line: string) => void): void;
235
- /** Render a To-Do list as a table. */
236
- export declare function renderTodoList(todos: Todo[], log: (line: string) => void): void;
360
+ /**
361
+ * Render a To-Do list as a table. `timeZone` names the zone the WHEN column is
362
+ * shown in (and is labelled on every row); omitted, rows keep the raw UTC
363
+ * instant the older output printed.
364
+ */
365
+ export declare function renderTodoList(todos: Todo[], log: (line: string) => void, timeZone?: string): void;
237
366
  /**
238
367
  * Warn at REVIEW time when approving this plan is likely to hit the wall.
239
368
  *
240
369
  * Silent when there is comfortable headroom — a budget line on every plan is
241
370
  * noise, and noise is how a real warning gets ignored. It speaks up only when
242
371
  * the budget is exhausted or nearly so, and always names the remediation
243
- * rather than just the number.
372
+ * rather than just the number. An owner with no cap of their own never sees it.
373
+ *
374
+ * `agentId` makes the remedy a command that can be pasted; without it the
375
+ * command keeps a placeholder, which is only right when the caller cannot know.
376
+ */
377
+ export declare function renderCapacityWarning(capacity: TriggerCapacity | undefined, log: (line: string) => void, agentId?: string, phase?: 'review' | 'approved'): void;
378
+ /**
379
+ * Name the earlier blocks approval will cancel BEFORE the reviewer approves.
380
+ * The draft lists only what it adds, so without this the cancellation is only
381
+ * discoverable afterwards in the schedule trace (OSK-22419).
382
+ */
383
+ export declare function renderReplacementPreview(preview: ReplacementPreview | undefined, zone: string, log: (line: string) => void): void;
384
+ /** The proposed to-dos a person would be approving (dropped ones are not). */
385
+ export declare function liveProposedTodos(proposal: SmartScheduleProposal): ProposedTodo[];
386
+ /**
387
+ * Render a Smart Schedule proposal: header + the proposed (non-dropped) to-dos.
388
+ *
389
+ * Every instant is shown in the PLAN's zone and says which: a draft that "stays
390
+ * until midnight" is only readable as `00:00 PST`, not as `08:00Z` (OSK-22397).
391
+ * `--json` keeps the raw UTC instants.
244
392
  */
245
- export declare function renderCapacityWarning(capacity: TriggerCapacity | undefined, log: (line: string) => void): void;
246
- /** Render a Smart Schedule proposal: header + the proposed (non-dropped) to-dos. */
247
393
  export declare function renderProposal(proposal: SmartScheduleProposal, log: (line: string) => void): void;
394
+ /**
395
+ * The commands that can succeed for THIS draft, in the order a person would
396
+ * reach for them.
397
+ *
398
+ * The footer used to be one generic three-line block, so an EMPTY draft led with
399
+ * `--approve`, which the same command refuses ("no schedulable to-dos"): the
400
+ * very first suggestion failed (OSK-22396). An empty draft can only be accepted
401
+ * together with its suggested next run, so that is the one accept command it
402
+ * prints; with no next run to schedule there is nothing to accept and the only
403
+ * move left is to discard it.
404
+ */
405
+ export declare function proposalNextSteps(proposal: SmartScheduleProposal, bin: string, agentId: string): string[];
406
+ /**
407
+ * What an approval left behind besides To-Dos: the next planning run and the
408
+ * recurring watcher. The server always did both; only the next run was ever
409
+ * printed, so `upcoming` was the one place a person found the watcher
410
+ * (OSK-22403). Wording follows the web's approval notice.
411
+ */
412
+ export declare function approvalEffectLines(result: ApproveSmartScheduleResponse, options: {
413
+ approvedNextRun: boolean;
414
+ timeZone: string;
415
+ bin: string;
416
+ agentId: string;
417
+ }): string[];
418
+ /**
419
+ * Dismissing is plan feedback, and feedback may move the watcher's check times.
420
+ * Say which happened, so "why did the watcher fire at 11:00 and not 02:00" is
421
+ * never answerable only by diffing triggers before and after (OSK-22407).
422
+ */
423
+ export declare function dismissEffectLines(result: DismissSmartScheduleResponse): string[];
248
424
  /** Map a proposal's live todos into the approve-payload shape (approve all). */
249
425
  export declare function proposalToApproveTodos(proposal: SmartScheduleProposal): ApproveTodoInput[];
426
+ /** An instant for a person: in `timeZone` with the zone named; raw UTC when none is given. */
427
+ export declare function formatStamp(value: string | undefined, timeZone?: string, options?: {
428
+ seconds?: boolean;
429
+ }): string;