@skrr-ai/cli 0.1.151 → 0.1.152

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 (49) hide show
  1. package/dist/commands/agents/chat.d.ts +3 -0
  2. package/dist/commands/agents/chat.js +27 -0
  3. package/dist/commands/agents/plan-day.d.ts +3 -0
  4. package/dist/commands/agents/plan-day.js +31 -8
  5. package/dist/commands/agents/show.d.ts +3 -0
  6. package/dist/commands/agents/show.js +59 -3
  7. package/dist/commands/agents/triggers/list.js +2 -1
  8. package/dist/commands/balance/usage/breakdown.d.ts +1 -1
  9. package/dist/commands/balance/usage/breakdown.js +22 -6
  10. package/dist/commands/balance/usage/events.d.ts +3 -2
  11. package/dist/commands/balance/usage/events.js +34 -7
  12. package/dist/commands/duties/observation/summary.js +25 -3
  13. package/dist/commands/goals/plan-now.js +1 -0
  14. package/dist/commands/goals/planner-compare.js +11 -0
  15. package/dist/commands/harnesses/list.d.ts +2 -1
  16. package/dist/commands/harnesses/list.js +7 -5
  17. package/dist/commands/harnesses/models.js +1 -1
  18. package/dist/commands/harnesses/quota.d.ts +9 -11
  19. package/dist/commands/harnesses/quota.js +83 -18
  20. package/dist/commands/harnesses/show.js +1 -1
  21. package/dist/commands/harnesses/usage.d.ts +19 -0
  22. package/dist/commands/harnesses/usage.js +27 -7
  23. package/dist/commands/memory/topics/create.js +4 -1
  24. package/dist/commands/tokens/create.d.ts +3 -4
  25. package/dist/commands/tokens/create.js +20 -7
  26. package/dist/commands/triggers/preflight.js +9 -2
  27. package/dist/lib/agent-model-check.js +3 -1
  28. package/dist/lib/agentic-stream.js +6 -7
  29. package/dist/lib/balance.d.ts +5 -2
  30. package/dist/lib/balance.js +26 -0
  31. package/dist/lib/config.d.ts +1 -1
  32. package/dist/lib/config.js +1 -0
  33. package/dist/lib/harness-labels.d.ts +1 -0
  34. package/dist/lib/harness-labels.js +4 -0
  35. package/dist/lib/harnesses.d.ts +35 -0
  36. package/dist/lib/harnesses.js +8 -0
  37. package/dist/lib/machines.d.ts +2 -1
  38. package/dist/lib/machines.js +2 -2
  39. package/dist/lib/publicEndpoints.generated.d.ts +4 -0
  40. package/dist/lib/publicEndpoints.generated.js +4 -0
  41. package/dist/lib/schedule.d.ts +1 -0
  42. package/dist/lib/schedule.js +4 -4
  43. package/dist/lib/triggers.d.ts +2 -2
  44. package/dist/lib/triggers.js +14 -6
  45. package/dist/lib/update-check.d.ts +1 -1
  46. package/dist/lib/update-check.js +12 -8
  47. package/dist/node_modules/@skrr-ai/data-provider/index.js +7367 -7365
  48. package/oclif.manifest.json +39 -16
  49. package/package.json +1 -1
@@ -10,6 +10,7 @@ exports.getHarnessUsage = getHarnessUsage;
10
10
  exports.getAllHarnessUsage = getAllHarnessUsage;
11
11
  exports.getRuntimeMonthlySpend = getRuntimeMonthlySpend;
12
12
  exports.listQuotaAccounts = listQuotaAccounts;
13
+ exports.getCurrentQuota = getCurrentQuota;
13
14
  exports.getQuotaHistory = getQuotaHistory;
14
15
  exports.updateHarness = updateHarness;
15
16
  exports.forgetHarness = forgetHarness;
@@ -135,6 +136,13 @@ async function getRuntimeMonthlySpend() {
135
136
  async function listQuotaAccounts() {
136
137
  return (0, api_fetch_1.apiFetch)('/api/harnesses/quota/accounts');
137
138
  }
139
+ /** Recent, bounded observations; never falls back to the full history endpoint. */
140
+ async function getCurrentQuota(params) {
141
+ const query = new URLSearchParams({ provider: params.provider });
142
+ if (params.externalAccountId)
143
+ query.set('externalAccountId', params.externalAccountId);
144
+ return (0, api_fetch_1.apiFetch)('/api/harnesses/quota/current?' + query.toString());
145
+ }
138
146
  /**
139
147
  * One account's reading series plus the spend buckets over the same horizon.
140
148
  *
@@ -39,6 +39,7 @@ import type { DaemonContactState, DaemonMaintenanceSummary, MachineIcon, Machine
39
39
  */
40
40
  export type MachineIdentityKind = 'runtime-lease' | 'machine-uuid' | 'stable-daemon' | 'daemon' | 'virtual-product' | 'harness';
41
41
  export interface MachineHarnessRow {
42
+ presenceStatus?: 'connected' | 'unconfirmed' | 'unknown';
42
43
  id: string;
43
44
  name: string;
44
45
  provider: string;
@@ -218,7 +219,7 @@ export interface MachineDaemonSummary {
218
219
  * `stale` when some are recorded online but none has been heard from lately,
219
220
  * `offline` otherwise.
220
221
  */
221
- status: 'online' | 'reconnecting' | 'stale' | 'offline';
222
+ status: 'online' | 'reconnecting' | 'stale' | 'unconfirmed' | 'unknown' | 'offline';
222
223
  lastSeenAt: string | null;
223
224
  harnessCount: number;
224
225
  /** Of those, how many a newer registration of the same provider replaced. */
@@ -45,7 +45,7 @@ function machineStateLabel(machine) {
45
45
  // (OSK-16442).
46
46
  if (machine.status === 'degraded') {
47
47
  const contact = machine.contact?.state;
48
- if (contact === 'stale' || contact === 'reconnecting')
48
+ if (contact === 'stale' || contact === 'reconnecting' || contact === 'unconfirmed' || contact === 'unknown')
49
49
  return data_provider_1.DAEMON_CONTACT_WORDS[contact];
50
50
  }
51
51
  if (machine.status !== 'offline')
@@ -144,7 +144,7 @@ function newerStamp(a, b) {
144
144
  return a;
145
145
  return new Date(b).getTime() > new Date(a).getTime() ? b : a;
146
146
  }
147
- const RANK = { online: 0, reconnecting: 1, stale: 2, offline: 3 };
147
+ const RANK = { online: 0, reconnecting: 1, unconfirmed: 2, unknown: 3, stale: 4, offline: 5 };
148
148
  /** The profile a harness row belongs to: the server's field, else the one its legacy daemon id names. */
149
149
  function harnessProfileOf(row) {
150
150
  if (row.profile)
@@ -7,4 +7,8 @@ export declare const OVERSKY_ENVIRONMENT_ENDPOINTS: Readonly<{
7
7
  readonly appUrl: "https://oversky.dev";
8
8
  readonly realtimeUrl: "https://api.oversky.dev";
9
9
  }>;
10
+ readonly preprod: Readonly<{
11
+ readonly appUrl: "https://skrr.io";
12
+ readonly realtimeUrl: "https://api.skrr.io";
13
+ }>;
10
14
  }>;
@@ -12,4 +12,8 @@ exports.OVERSKY_ENVIRONMENT_ENDPOINTS = Object.freeze({
12
12
  "appUrl": "https://oversky.dev",
13
13
  "realtimeUrl": "https://api.oversky.dev"
14
14
  }),
15
+ preprod: Object.freeze({
16
+ "appUrl": "https://skrr.io",
17
+ "realtimeUrl": "https://api.skrr.io"
18
+ }),
15
19
  });
@@ -106,6 +106,7 @@ export interface SmartScheduleProposal {
106
106
  contextSummary: {
107
107
  spaceName?: string;
108
108
  taskScope?: 'lead_space' | 'no_lead_space' | 'unavailable';
109
+ taskScopeGuidance?: string;
109
110
  goalCount: number;
110
111
  openTaskCount: number;
111
112
  truncated: boolean;
@@ -390,13 +390,13 @@ function renderProposal(proposal, log) {
390
390
  const ctx = proposal.contextSummary;
391
391
  log(`Context: ${ctx.openTaskCount} open task(s), ${ctx.goalCount} goal(s)` +
392
392
  `${ctx.spaceName ? ` · ${ctx.spaceName}` : ''}${ctx.truncated ? ' (truncated)' : ''}`);
393
- const taskScope = ctx.taskScope === 'lead_space'
394
- ? 'Tasks were checked only in the lead Space; assigned tasks in other Spaces were not checked.'
393
+ const taskScope = ctx.taskScopeGuidance || (ctx.taskScope === 'lead_space'
394
+ ? 'Tasks were checked only in the selected lead Space; unscoped tasks and tasks in other Spaces were not checked.'
395
395
  : ctx.taskScope === 'no_lead_space'
396
- ? 'No lead Space was found; assigned tasks in other Spaces were not checked.'
396
+ ? 'No lead Space was found, so no tasks were checked, including tasks assigned to this Agent. Make the Agent the lead of a Space and place the tasks there before planning again.'
397
397
  : ctx.taskScope === 'unavailable'
398
398
  ? 'Task context was unavailable; the count may be incomplete.'
399
- : 'Task search scope was not recorded for this proposal.';
399
+ : 'Task search scope was not recorded for this proposal.');
400
400
  log(`Task scope: ${taskScope}`);
401
401
  if (proposal.expiresAt) {
402
402
  const expires = (0, format_1.zonedTime)(proposal.expiresAt, zone);
@@ -715,8 +715,8 @@ export declare function claimsAwaitingStartLine(limits?: SchedulerLimits | null)
715
715
  * Human phrasing for a trigger's enabled state (OSK-4886).
716
716
  *
717
717
  * `Enabled: yes` never used the vocabulary the create flow does — a trigger is
718
- * "armed" when it will fire and "inert" until enabled — so a freshly-created
719
- * trigger did not plainly confirm it is live.
718
+ * "armed" when enabled and "inert" until enabled. Execution still depends
719
+ * on live gates which this stored trigger summary cannot establish.
720
720
  */
721
721
  export declare function armedStateLabel(enabled: boolean | undefined, lastResult?: string | null,
722
722
  /**
@@ -1095,10 +1095,16 @@ function formatFireInZone(iso, timeZone) {
1095
1095
  }
1096
1096
  }
1097
1097
  function nextFireLines(schedule) {
1098
- if (!schedule?.nextFires?.length)
1098
+ if (!schedule)
1099
1099
  return [];
1100
+ const lines = [];
1101
+ if (schedule.nextFireAt) {
1102
+ lines.push(`Stored due time: ${formatFireInZone(schedule.nextFireAt, schedule.timezone)}`);
1103
+ }
1104
+ if (!schedule.nextFires?.length)
1105
+ return lines;
1100
1106
  const windows = new Map((schedule.nextFireWindows ?? []).map((entry) => [entry.at, entry]));
1101
- const lines = [`Next fires (${schedule.timezone}):`];
1107
+ lines.push(`Projected schedule slots (${schedule.timezone}):`);
1102
1108
  for (const at of schedule.nextFires) {
1103
1109
  const window = windows.get(at);
1104
1110
  const mark = window && !window.runs
@@ -1467,8 +1473,8 @@ function claimsAwaitingStartLine(limits) {
1467
1473
  * Human phrasing for a trigger's enabled state (OSK-4886).
1468
1474
  *
1469
1475
  * `Enabled: yes` never used the vocabulary the create flow does — a trigger is
1470
- * "armed" when it will fire and "inert" until enabled — so a freshly-created
1471
- * trigger did not plainly confirm it is live.
1476
+ * "armed" when enabled and "inert" until enabled. Execution still depends
1477
+ * on live gates which this stored trigger summary cannot establish.
1472
1478
  */
1473
1479
  function armedStateLabel(enabled, lastResult,
1474
1480
  /**
@@ -1503,6 +1509,8 @@ windowVerdict) {
1503
1509
  }
1504
1510
  if (enabled === false)
1505
1511
  return 'no — inert until enabled';
1512
+ if (enabled !== true)
1513
+ return 'unknown — enabled state was not reported (see `skrr triggers preflight <id>`)';
1506
1514
  if (schedulerLimits?.state === 'reached')
1507
1515
  return `no — ${schedulerLimitSentence(schedulerLimits)}`;
1508
1516
  if (windowVerdict?.state === 'blocks_all') {
@@ -1511,13 +1519,13 @@ windowVerdict) {
1511
1519
  if (windowVerdict?.state === 'blocks_next') {
1512
1520
  return `yes — but its next run falls ${windowVerdict.reason === 'outside_working_hours' ? 'outside its working hours' : 'inside its quiet hours'} and will be skipped`;
1513
1521
  }
1514
- // "Will fire" is the row's intent. A platform-managed row whose owner is fenced (Always-On off) ticks on
1522
+ // A platform-managed row whose owner is fenced (Always-On off) ticks on
1515
1523
  // schedule and is skipped every time, and the same screen's `Fires:` line says so; the first line a reader
1516
1524
  // meets must not say the opposite (dogfood df-261031-duty-authoring, OSK-21103).
1517
1525
  const skipped = typeof lastResult === 'string' ? ARMED_STATE_LABEL_RE.exec(lastResult) : null;
1518
1526
  return skipped
1519
1527
  ? `yes — but its last tick was skipped (${skipped[1]}), so it did not run`
1520
- : 'yes — will fire';
1528
+ : 'yes — enabled; execution depends on current gates (see `skrr triggers preflight <id>`)';
1521
1529
  }
1522
1530
  /**
1523
1531
  * Human phrasing for an effect trigger's write mode (OSK-4886).
@@ -81,7 +81,7 @@ export declare function resolveCliPackageDir(argv?: readonly string[]): string |
81
81
  * `dist` and no `src`.
82
82
  */
83
83
  export declare function classifyCliInstall(env: NodeJS.ProcessEnv, argv: readonly string[], npmGlobalRoot: string | null, probeWritable?: boolean): CliInstallDescriptor;
84
- export declare function cliUpdateCommand(owner: CliInstallKind, npmPrefix?: string): string;
84
+ export declare function cliUpdateCommand(owner: CliInstallKind, npmPrefix?: string, offeredVersion?: string | null): string;
85
85
  export declare function buildNudgeLine(currentVersion: string, latest: string | null, _npmPackage: string | null, installKind?: CliInstallKind, npmPrefix?: string): string | null;
86
86
  export type CliUpdateAction = {
87
87
  type: 'nudge';
@@ -287,12 +287,17 @@ async function resolveNpmGlobalRoot(env = process.env) {
287
287
  return null;
288
288
  }
289
289
  }
290
- function cliUpdateCommand(owner, npmPrefix) {
290
+ function cliUpdateCommand(owner, npmPrefix, offeredVersion) {
291
+ // The offered version comes from remote metadata or a local cache. Only put
292
+ // an exact, shell-safe npm version into an executable suggestion.
293
+ const version = offeredVersion && /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.test(offeredVersion)
294
+ ? offeredVersion
295
+ : 'latest';
291
296
  switch (owner) {
292
297
  case 'npm-global':
293
298
  return npmPrefix
294
- ? `npm install --global --prefix '${npmPrefix.replace(CLI_UPDATE_COMMAND_RE, "'\\''")}' ${CLI_PACKAGE}@latest`
295
- : `npm install -g ${CLI_PACKAGE}@latest`;
299
+ ? `npm install --global --prefix '${npmPrefix.replace(CLI_UPDATE_COMMAND_RE, "'\\''")}' ${CLI_PACKAGE}@${version}`
300
+ : `npm install -g ${CLI_PACKAGE}@${version}`;
296
301
  case 'npm-local':
297
302
  return `Use npm in the project that owns ${CLI_PACKAGE}`;
298
303
  case 'dev':
@@ -310,8 +315,7 @@ function cliUpdateCommand(owner, npmPrefix) {
310
315
  function buildNudgeLine(currentVersion, latest, _npmPackage, installKind = 'npm-global', npmPrefix) {
311
316
  if (!latest || !isOlderVersion(currentVersion, latest))
312
317
  return null;
313
- const command = installKind === 'npm-global' && !npmPrefix
314
- ? `npm update -g ${CLI_PACKAGE}` : cliUpdateCommand(installKind, npmPrefix);
318
+ const command = cliUpdateCommand(installKind, npmPrefix, latest);
315
319
  const context = installKind === 'dev'
316
320
  ? ' to rebuild your checkout'
317
321
  : '';
@@ -349,7 +353,7 @@ function decideCliUpdateAction(args) {
349
353
  if (attempt?.status === 'failed')
350
354
  return {
351
355
  type: 'nudge',
352
- line: `[skrr] CLI update to ${cache.latest} failed. Inspect \`skrr update --status\` or run \`${cliUpdateCommand(install.kind, install.npmPrefix)}\`.\n`,
356
+ line: `[skrr] CLI update to ${cache.latest} failed. Inspect \`skrr update --status\` or run \`${cliUpdateCommand(install.kind, install.npmPrefix, cache.latest)}\`.\n`,
353
357
  };
354
358
  }
355
359
  const line = buildNudgeLine(currentVersion, cache.latest, CLI_PACKAGE, install.kind, install.npmPrefix);
@@ -488,7 +492,7 @@ function readCliUpdateStatus(opts) {
488
492
  state,
489
493
  autoUpdateAllowed: autoUpdateReason === null,
490
494
  autoUpdateReason,
491
- command: cliUpdateCommand(install.kind, install.npmPrefix),
495
+ command: cliUpdateCommand(install.kind, install.npmPrefix, offeredVersion),
492
496
  lastCheckAt: matchingCache?.lastCheckAt ?? null,
493
497
  lastAttempt,
494
498
  logPath: path.join(directory, 'update.log'),
@@ -613,7 +617,7 @@ async function performCliUpdate(opts) {
613
617
  env.SKRR_CLI_UPDATE_SESSION_UNAVAILABLE === '1') {
614
618
  return {
615
619
  ...status,
616
- message: `This CLI is owned by ${install.kind}${install.kind === 'npm-global' ? ' in a shared or external prefix' : ''}. ${cliUpdateCommand(install.kind, install.npmPrefix)}.`,
620
+ message: `This CLI is owned by ${install.kind}${install.kind === 'npm-global' ? ' in a shared or external prefix' : ''}. ${cliUpdateCommand(install.kind, install.npmPrefix, status.offeredVersion)}.`,
617
621
  };
618
622
  }
619
623
  const recoverableAttempt = status.lastAttempt && ['queued', 'running'].includes(status.lastAttempt.status);