@skrr-ai/cli 0.1.151 → 0.1.153

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 (76) hide show
  1. package/dist/commands/agent/message/send.d.ts +3 -1
  2. package/dist/commands/agent/message/send.js +52 -1
  3. package/dist/commands/agents/always-on/held-messages.d.ts +22 -0
  4. package/dist/commands/agents/always-on/held-messages.js +62 -0
  5. package/dist/commands/agents/always-on/release-run.d.ts +37 -0
  6. package/dist/commands/agents/always-on/release-run.js +92 -0
  7. package/dist/commands/agents/always-on/status.js +5 -0
  8. package/dist/commands/agents/chat.d.ts +3 -0
  9. package/dist/commands/agents/chat.js +27 -0
  10. package/dist/commands/agents/plan-day.d.ts +3 -0
  11. package/dist/commands/agents/plan-day.js +31 -8
  12. package/dist/commands/agents/show.d.ts +3 -0
  13. package/dist/commands/agents/show.js +59 -3
  14. package/dist/commands/agents/triggers/list.js +2 -1
  15. package/dist/commands/balance/usage/breakdown.d.ts +1 -1
  16. package/dist/commands/balance/usage/breakdown.js +22 -6
  17. package/dist/commands/balance/usage/events.d.ts +3 -2
  18. package/dist/commands/balance/usage/events.js +34 -7
  19. package/dist/commands/duties/create.js +24 -9
  20. package/dist/commands/duties/export.js +2 -1
  21. package/dist/commands/duties/observation/summary.js +25 -3
  22. package/dist/commands/duties/preflight.js +17 -0
  23. package/dist/commands/duties/update.d.ts +1 -0
  24. package/dist/commands/duties/update.js +87 -66
  25. package/dist/commands/goals/plan-now.js +1 -0
  26. package/dist/commands/goals/planner-compare.js +11 -0
  27. package/dist/commands/harnesses/list.d.ts +2 -1
  28. package/dist/commands/harnesses/list.js +7 -5
  29. package/dist/commands/harnesses/models.js +1 -1
  30. package/dist/commands/harnesses/quota.d.ts +9 -11
  31. package/dist/commands/harnesses/quota.js +83 -18
  32. package/dist/commands/harnesses/show.js +1 -1
  33. package/dist/commands/harnesses/usage.d.ts +19 -0
  34. package/dist/commands/harnesses/usage.js +27 -7
  35. package/dist/commands/memory/topics/create.js +4 -1
  36. package/dist/commands/tokens/create.d.ts +3 -4
  37. package/dist/commands/tokens/create.js +20 -7
  38. package/dist/commands/triggers/fire-detail.js +19 -0
  39. package/dist/commands/triggers/preflight.js +9 -2
  40. package/dist/generated/agent-guides.json +35 -35
  41. package/dist/lib/agent-model-check.js +3 -1
  42. package/dist/lib/agentic-stream.js +6 -7
  43. package/dist/lib/balance.d.ts +5 -2
  44. package/dist/lib/balance.js +26 -0
  45. package/dist/lib/config.d.ts +1 -1
  46. package/dist/lib/config.js +1 -0
  47. package/dist/lib/duties.d.ts +5 -0
  48. package/dist/lib/duties.js +75 -1
  49. package/dist/lib/duty-event-wakes.js +6 -3
  50. package/dist/lib/duty-loop-status.js +26 -2
  51. package/dist/lib/duty-product.js +4 -1
  52. package/dist/lib/harness-labels.d.ts +1 -0
  53. package/dist/lib/harness-labels.js +4 -0
  54. package/dist/lib/harnesses.d.ts +35 -0
  55. package/dist/lib/harnesses.js +8 -0
  56. package/dist/lib/held-messages.d.ts +11 -0
  57. package/dist/lib/held-messages.js +93 -0
  58. package/dist/lib/machines.d.ts +2 -1
  59. package/dist/lib/machines.js +2 -2
  60. package/dist/lib/message-intent.d.ts +15 -0
  61. package/dist/lib/publicEndpoints.generated.d.ts +4 -0
  62. package/dist/lib/publicEndpoints.generated.js +4 -0
  63. package/dist/lib/roles.d.ts +1 -1
  64. package/dist/lib/schedule.d.ts +1 -0
  65. package/dist/lib/schedule.js +4 -4
  66. package/dist/lib/triggers.d.ts +15 -3
  67. package/dist/lib/triggers.js +57 -6
  68. package/dist/lib/update-check.d.ts +1 -1
  69. package/dist/lib/update-check.js +21 -10
  70. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/dutyExecutionContract.d.ts +1 -1
  71. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/dutyExecutionContract.js +1 -1
  72. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/dutyExecutionContract.d.ts +1 -1
  73. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/dutyExecutionContract.js +1 -1
  74. package/dist/node_modules/@skrr-ai/data-provider/index.js +7609 -7567
  75. package/oclif.manifest.json +229 -17
  76. package/package.json +4 -3
@@ -1,4 +1,5 @@
1
1
  import { BaseCommand } from '../../base-command';
2
+ import { type CurrentQuotaReport } from '../../lib/harnesses';
2
3
  /**
3
4
  * Claude Code / Codex subscription quota, over time.
4
5
  *
@@ -24,17 +25,9 @@ import { BaseCommand } from '../../base-command';
24
25
  /**
25
26
  * WHY this window is empty — without asserting a cause we cannot know.
26
27
  *
27
- * OSK-7616 — this used to read "Runs started outside skrr still move the
28
- * provider meter above, but cannot be priced here", which names one
29
- * explanation as though it were the only one. In the reported case it was the
30
- * wrong one: three Codex turns were started THROUGH skrr, completed, and were
31
- * recorded at zero tokens because the harness reported an empty usage envelope.
32
- * The reader was told, by the one screen whose job is answering "what is my
33
- * agent costing me", that the cause was something they had not done.
34
- *
35
- * The second sentence is the one that was missing, and it is the actionable
36
- * half: a run skrr saw and could not price is a reportable defect, not a
37
- * property of the user's habits.
28
+ * The meter belongs to the provider account; our token ledger is per harness
29
+ * and may include several machines. An empty table does not identify the cause
30
+ * of missing usage, and recorded tokens do not imply a reported price.
38
31
  */
39
32
  export declare function unpricedWindowLines(): string[];
40
33
  export default class HarnessesQuota extends BaseCommand {
@@ -43,6 +36,7 @@ export default class HarnessesQuota extends BaseCommand {
43
36
  static flags: {
44
37
  provider: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
45
38
  account: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
39
+ current: import("@oclif/core/interfaces").BooleanFlag<boolean>;
46
40
  series: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
47
41
  windows: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
48
42
  days: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
@@ -61,3 +55,7 @@ export default class HarnessesQuota extends BaseCommand {
61
55
  private renderWindows;
62
56
  private renderDailySpend;
63
57
  }
58
+ /** Refuse an incompatible or malformed response rather than interpreting it as empty quota. */
59
+ export declare function isCurrentQuotaReport(value: unknown, provider: 'claude' | 'codex'): value is CurrentQuotaReport;
60
+ /** Describe only observed readings; none establishes current provider readiness. */
61
+ export declare function currentQuotaLines(report: CurrentQuotaReport): string[];
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.unpricedWindowLines = unpricedWindowLines;
4
+ exports.isCurrentQuotaReport = isCurrentQuotaReport;
5
+ exports.currentQuotaLines = currentQuotaLines;
4
6
  const core_1 = require("@oclif/core");
5
7
  const base_command_1 = require("../../base-command");
6
8
  const data_provider_1 = require("@skrr-ai/data-provider");
@@ -32,22 +34,15 @@ const quota_render_1 = require("../../lib/quota-render");
32
34
  /**
33
35
  * WHY this window is empty — without asserting a cause we cannot know.
34
36
  *
35
- * OSK-7616 — this used to read "Runs started outside skrr still move the
36
- * provider meter above, but cannot be priced here", which names one
37
- * explanation as though it were the only one. In the reported case it was the
38
- * wrong one: three Codex turns were started THROUGH skrr, completed, and were
39
- * recorded at zero tokens because the harness reported an empty usage envelope.
40
- * The reader was told, by the one screen whose job is answering "what is my
41
- * agent costing me", that the cause was something they had not done.
42
- *
43
- * The second sentence is the one that was missing, and it is the actionable
44
- * half: a run skrr saw and could not price is a reportable defect, not a
45
- * property of the user's habits.
37
+ * The meter belongs to the provider account; our token ledger is per harness
38
+ * and may include several machines. An empty table does not identify the cause
39
+ * of missing usage, and recorded tokens do not imply a reported price.
46
40
  */
47
41
  function unpricedWindowLines() {
48
42
  return [
49
- 'The provider meter above counts every run on this harness; this table counts only the runs skrr priced.',
50
- 'A run started outside skrr is never priced here. A run started THROUGH skrr should be — if one is missing, its harness reported no token usage, which is a bug worth reporting.',
43
+ 'The provider meter is for the account and may include activity outside skrr. Skrr usage is recorded per harness and is not tied to a provider account.',
44
+ 'A missing run may be outside the requested history or may not have reported token usage. Recorded tokens do not necessarily include a reported cost.',
45
+ 'Check --since-days for the history range, and inspect recorded runs below.',
51
46
  ' skrr harnesses usage # the runs skrr did see',
52
47
  ];
53
48
  }
@@ -58,7 +53,8 @@ class HarnessesQuota extends base_command_1.BaseCommand {
58
53
  '<%= config.bin %> harnesses quota --provider codex',
59
54
  '<%= config.bin %> harnesses quota --series weekly --windows 8',
60
55
  '<%= config.bin %> harnesses quota --days 30',
61
- '<%= config.bin %> harnesses quota --json',
56
+ '<%= config.bin %> harnesses quota --since-days 1 --json',
57
+ '<%= config.bin %> harnesses quota --current --json',
62
58
  ];
63
59
  static flags = {
64
60
  provider: core_1.Flags.string({
@@ -69,14 +65,18 @@ class HarnessesQuota extends base_command_1.BaseCommand {
69
65
  account: core_1.Flags.string({
70
66
  description: 'External account id, when several are reporting. Defaults to the newest.',
71
67
  }),
68
+ current: core_1.Flags.boolean({
69
+ description: 'Show recent observed quota only; no history or spend (requires a supporting server)',
70
+ exclusive: ['series', 'windows', 'days', 'since-days'],
71
+ }),
72
72
  series: core_1.Flags.string({
73
73
  description: 'Which limit window the detail sections describe',
74
74
  default: 'session',
75
75
  }),
76
- windows: core_1.Flags.integer({ description: 'How many recent windows to list', default: 8 }),
77
- days: core_1.Flags.integer({ description: 'How many days of spend to list', default: 14 }),
76
+ windows: core_1.Flags.integer({ description: 'How many recent windows to list in text output', default: 8 }),
77
+ days: core_1.Flags.integer({ description: 'How many days of spend to list in text output', default: 14 }),
78
78
  'since-days': core_1.Flags.integer({
79
- description: 'How much history to read. Clamped server-side to the 90-day retention.',
79
+ description: 'How much history to read (default 90 days). Controls JSON size; clamped to 90 days.',
80
80
  }),
81
81
  json: core_1.Flags.boolean({ description: 'Output as JSON' }),
82
82
  };
@@ -84,6 +84,27 @@ class HarnessesQuota extends base_command_1.BaseCommand {
84
84
  this.requireAuth();
85
85
  const { flags } = await this.parse(HarnessesQuota);
86
86
  const provider = flags.provider === 'codex' ? 'codex' : 'claude';
87
+ if (flags.current) {
88
+ let report;
89
+ try {
90
+ report = await (0, harnesses_1.getCurrentQuota)({ provider, externalAccountId: flags.account });
91
+ }
92
+ catch (err) {
93
+ if (typeof err === 'object' && err !== null && 'status' in err && err.status === 404) {
94
+ this.failWithCliError({ message: 'This server does not support --current. Use --since-days 1 for history.', code: 'QUOTA_CURRENT_UNSUPPORTED', status: 404, exit: 1, retryable: false });
95
+ }
96
+ this.handleApiError(err);
97
+ }
98
+ if (!isCurrentQuotaReport(report, provider)) {
99
+ this.failWithCliError({ message: 'This server returned an unsupported current quota response. Use --since-days 1 for history.', code: 'QUOTA_CURRENT_UNSUPPORTED', exit: 1, retryable: false });
100
+ }
101
+ if (flags.json)
102
+ this.log(JSON.stringify(report, null, 2));
103
+ else
104
+ for (const line of currentQuotaLines(report))
105
+ this.log(line);
106
+ return;
107
+ }
87
108
  let accounts;
88
109
  try {
89
110
  accounts = (await (0, harnesses_1.listQuotaAccounts)()).accounts ?? [];
@@ -202,7 +223,7 @@ class HarnessesQuota extends base_command_1.BaseCommand {
202
223
  // The meter can move with nothing in our ledger, so an empty table here
203
224
  // is a real and common state that must not read as "you spent nothing".
204
225
  this.log('');
205
- this.log('No skrr-recorded token spend in this window.');
226
+ this.log('No skrr-recorded token spend in the requested history.');
206
227
  for (const line of unpricedWindowLines()) {
207
228
  this.log(line);
208
229
  }
@@ -231,3 +252,47 @@ class HarnessesQuota extends base_command_1.BaseCommand {
231
252
  }
232
253
  }
233
254
  exports.default = HarnessesQuota;
255
+ /** Refuse an incompatible or malformed response rather than interpreting it as empty quota. */
256
+ function isCurrentQuotaReport(value, provider) {
257
+ if (!value || typeof value !== 'object')
258
+ return false;
259
+ const report = value;
260
+ if (report.version !== 1 || report.scope !== 'recent_quota_observations' || report.provider !== provider ||
261
+ !Number.isFinite(report.observedAt) || !Number.isFinite(report.sampleFrom) ||
262
+ report.sampleFrom > report.observedAt || !Number.isInteger(report.sampleLimit) || report.sampleLimit <= 0 || report.sampleLimit > 200 || typeof report.truncated !== 'boolean' ||
263
+ !Array.isArray(report.limitations) || !report.limitations.every((item) => typeof item === 'string') ||
264
+ !Array.isArray(report.readings) || report.readings.length > report.sampleLimit)
265
+ return false;
266
+ if (report.account === null && (report.readings.length > 0 || report.truncated))
267
+ return false;
268
+ if (report.account !== null && (!report.account || typeof report.account.externalAccountId !== 'string' ||
269
+ !Number.isFinite(report.account.lastSeenAt) ||
270
+ (report.account.accountLabel !== null && typeof report.account.accountLabel !== 'string')))
271
+ return false;
272
+ return report.readings.every((r) => r && typeof r.limitType === 'string' && typeof r.scopeKey === 'string' &&
273
+ Number.isFinite(r.capturedAt) && Number.isFinite(r.utilization) && r.utilization >= 0 && r.utilization <= 100 &&
274
+ (r.resetsAt === null || Number.isFinite(r.resetsAt)) && typeof r.stale === 'boolean' &&
275
+ typeof r.rateLimited === 'boolean' && ['unknown', 'elapsed', 'upcoming'].includes(r.resetState));
276
+ }
277
+ /** Describe only observed readings; none establishes current provider readiness. */
278
+ function currentQuotaLines(report) {
279
+ const text = (value) => value.replace(/[\u0000-\u001f\u007f-\u009f]/g, ' ').trim();
280
+ const lines = [
281
+ `Recent quota observations (${(0, format_1.localZone)()}); this is not a readiness check or a bill.`,
282
+ 'Only observations from the last 24 hours are shown; other limits may be missing.',
283
+ ];
284
+ if (!report.account)
285
+ return [...lines, 'No matching account was observed in the retained history.'];
286
+ lines.push(`Account: ${text(report.account.accountLabel ?? report.account.externalAccountId)} · ID ${text(report.account.externalAccountId)} · last seen ${(0, format_1.localStamp)(report.account.lastSeenAt)}`);
287
+ lines.push('The most recently reporting account may not be the one signed in on this machine; use --account to choose another.');
288
+ if (report.truncated)
289
+ lines.push(`Only the newest ${report.sampleLimit} samples were examined; other limits may be missing.`);
290
+ if (report.readings.length === 0)
291
+ return [...lines, 'No samples in the last 24 hours; current quota is unknown.'];
292
+ for (const reading of report.readings) {
293
+ const reset = reading.resetState === 'unknown' ? 'reset unknown' : reading.resetState === 'elapsed' ? `reset elapsed ${(0, format_1.localStamp)(reading.resetsAt)}` : `resets ${(0, format_1.localStamp)(reading.resetsAt)}`;
294
+ const notes = [reading.stale ? 'stale' : null, reading.rateLimited ? '429 observed near sample' : null].filter(Boolean);
295
+ lines.push(`${text(reading.limitType)}${reading.scopeKey ? ` (${text(reading.scopeKey)})` : ''}: ${reading.utilization}% observed ${(0, format_1.localStamp)(reading.capturedAt)} · ${reset}${notes.length ? ` · ${notes.join(', ')}` : ''}`);
296
+ }
297
+ return lines;
298
+ }
@@ -81,7 +81,7 @@ class HarnessesShow extends base_command_1.BaseCommand {
81
81
  // Asked of the daemon, so only for a live local row; best-effort.
82
82
  const readiness = harness.daemonId &&
83
83
  harness.harnessLocation === 'local' &&
84
- harness.status === 'online' &&
84
+ (0, harness_labels_1.harnessStatusLabel)(harness) === 'online' &&
85
85
  !harness.superseded
86
86
  ? await (0, cli_installers_1.readinessByProvider)(harness.daemonId, this.resolvedCredential)
87
87
  : null;
@@ -1,4 +1,13 @@
1
1
  import { BaseCommand } from '../../base-command';
2
+ /**
3
+ * Usage for one harness, or the rollup across all of them.
4
+ *
5
+ * ONE command over two endpoints, selected by whether an id was given, because
6
+ * "how much did this cost" is one question the caller asks at two scopes. The
7
+ * web makes the same pairing (`usage(id)` and `fleetUsage`).
8
+ */
9
+ /** Two decimals is how money is read; the API sends full float precision. */
10
+ export declare function usageCost(row: UsageRow): string;
2
11
  export type UsageRow = {
3
12
  /** Fleet rollup only — one row per harness. */
4
13
  harnessId?: string;
@@ -14,6 +23,8 @@ export type UsageRow = {
14
23
  provider?: string;
15
24
  sessions?: number;
16
25
  totalCostUsd?: number;
26
+ costReportedSessions?: number | null;
27
+ costCoverageVerified?: boolean | null;
17
28
  inputTokens?: number;
18
29
  outputTokens?: number;
19
30
  cachedInputTokens?: number;
@@ -47,6 +58,14 @@ export interface UsageTable {
47
58
  maxWidth?: number;
48
59
  }[];
49
60
  }
61
+ export declare const HARNESS_USAGE_COVERAGE: {
62
+ scope: string;
63
+ explanation: string;
64
+ };
65
+ /** Keep the server response intact and add a machine-readable CLI explanation. */
66
+ export declare function withUsageCoverage<T extends object>(report: T): T & {
67
+ cliCoverage: typeof HARNESS_USAGE_COVERAGE;
68
+ };
50
69
  /**
51
70
  * The rows differ as much as the two envelopes do.
52
71
  *
@@ -1,9 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HARNESS_USAGE_COVERAGE = void 0;
4
+ exports.usageCost = usageCost;
3
5
  exports.selectUsageRows = selectUsageRows;
4
6
  exports.usageRowHarnessCell = usageRowHarnessCell;
7
+ exports.withUsageCoverage = withUsageCoverage;
5
8
  exports.buildUsageTable = buildUsageTable;
6
9
  const core_1 = require("@oclif/core");
10
+ const data_provider_1 = require("@skrr-ai/data-provider");
7
11
  const base_command_1 = require("../../base-command");
8
12
  const format_1 = require("../../lib/format");
9
13
  const harnesses_1 = require("../../lib/harnesses");
@@ -15,9 +19,13 @@ const harnesses_1 = require("../../lib/harnesses");
15
19
  * web makes the same pairing (`usage(id)` and `fleetUsage`).
16
20
  */
17
21
  /** Two decimals is how money is read; the API sends full float precision. */
18
- function usd(value) {
19
- const n = Number(value);
20
- return Number.isFinite(n) ? `$${n.toFixed(2)}` : '-';
22
+ function usageCost(row) {
23
+ const status = (0, data_provider_1.harnessCostReporting)(row);
24
+ if (status === 'idle' || status === 'not_reported' || status === 'unknown' ||
25
+ typeof row.totalCostUsd !== 'number' || !Number.isFinite(row.totalCostUsd))
26
+ return '—';
27
+ const value = status === 'partial' ? Math.floor(row.totalCostUsd * 100) / 100 : row.totalCostUsd;
28
+ return `$${value.toFixed(2)}${status === 'partial' ? '+' : ''}`;
21
29
  }
22
30
  /** Thousands separators — these run to eight digits and are compared by eye. */
23
31
  function count(value) {
@@ -56,6 +64,14 @@ const SHARED_COLUMNS = [
56
64
  { key: 'cached', header: 'CACHED' },
57
65
  { key: 'cacheWrite', header: 'CACHE WRITE' },
58
66
  ];
67
+ exports.HARNESS_USAGE_COVERAGE = {
68
+ scope: 'skrr_recorded_harness_usage',
69
+ explanation: 'Only usage recorded by Skrr for these harnesses is shown. Other activity or unreported usage may be absent; this is not a provider bill.',
70
+ };
71
+ /** Keep the server response intact and add a machine-readable CLI explanation. */
72
+ function withUsageCoverage(report) {
73
+ return { cliCoverage: exports.HARNESS_USAGE_COVERAGE, ...report };
74
+ }
59
75
  /**
60
76
  * The rows differ as much as the two envelopes do.
61
77
  *
@@ -73,7 +89,7 @@ function buildUsageTable(rows, perHarness) {
73
89
  const shared = (r) => ({
74
90
  provider: (0, format_1.formatCell)(r.provider),
75
91
  sessions: count(r.sessions),
76
- cost: usd(r.totalCostUsd),
92
+ cost: usageCost(r),
77
93
  in: count(r.inputTokens),
78
94
  out: count(r.outputTokens),
79
95
  cached: count(r.cachedInputTokens),
@@ -100,7 +116,7 @@ function buildUsageTable(rows, perHarness) {
100
116
  };
101
117
  }
102
118
  class HarnessesUsage extends base_command_1.BaseCommand {
103
- static description = 'Usage for one harness, or the rollup across all of them';
119
+ static description = 'Skrr-recorded usage for one harness or the fleet; not a complete provider bill';
104
120
  static examples = [
105
121
  '<%= config.bin %> harnesses usage',
106
122
  '<%= config.bin %> harnesses usage <harness-id>',
@@ -124,7 +140,7 @@ class HarnessesUsage extends base_command_1.BaseCommand {
124
140
  this.handleApiError(err);
125
141
  }
126
142
  if (flags.json) {
127
- this.log(JSON.stringify(report, null, 2));
143
+ this.log(JSON.stringify(withUsageCoverage(report ?? {}), null, 2));
128
144
  return;
129
145
  }
130
146
  // The two endpoints answer in DIFFERENT shapes: the fleet rollup sends
@@ -136,6 +152,7 @@ class HarnessesUsage extends base_command_1.BaseCommand {
136
152
  const totals = payload?.grandTotals ?? payload?.totals;
137
153
  if (rows.length === 0) {
138
154
  this.log(args.harness ? 'No usage recorded for this harness.' : 'No usage recorded.');
155
+ this.log(exports.HARNESS_USAGE_COVERAGE.explanation);
139
156
  return;
140
157
  }
141
158
  if (args.harness) {
@@ -146,7 +163,7 @@ class HarnessesUsage extends base_command_1.BaseCommand {
146
163
  (0, format_1.renderTable)(table.rows, table.columns, (line) => this.log(line));
147
164
  if (totals) {
148
165
  this.log('');
149
- this.log(`Total: ${count(totals.sessions)} sessions · ${usd(totals.totalCostUsd)} · ` +
166
+ this.log(`Total: ${count(totals.sessions)} sessions · ${usageCost(totals)} · ` +
150
167
  `${count(totals.inputTokens)} in / ${count(totals.outputTokens)} out / ` +
151
168
  `${count(totals.cachedInputTokens)} cached / ${count(totals.cacheCreationInputTokens)} cache write`);
152
169
  // SAY WHICH PROVIDERS THAT TOTAL COVERS.
@@ -167,6 +184,9 @@ class HarnessesUsage extends base_command_1.BaseCommand {
167
184
  'This is NOT necessarily your whole account.');
168
185
  }
169
186
  }
187
+ this.log('');
188
+ this.log('Cost: — means unknown, not reported, or no activity; + means a lower bound.');
189
+ this.log(exports.HARNESS_USAGE_COVERAGE.explanation);
170
190
  }
171
191
  }
172
192
  exports.default = HarnessesUsage;
@@ -18,7 +18,10 @@ class MemoryTopicsCreate extends scoped_memory_command_1.ScopedMemoryCommand {
18
18
  static description = 'Create a versioned semantic Memory topic';
19
19
  static flags = {
20
20
  ...scoped_memory_command_1.mutationFlags,
21
- path: core_1.Flags.string({ required: true }),
21
+ path: core_1.Flags.string({
22
+ required: true,
23
+ description: 'Absolute Memory path beginning with /, for example /people/alex',
24
+ }),
22
25
  content: core_1.Flags.string({ required: true }),
23
26
  title: core_1.Flags.string(),
24
27
  kind: core_1.Flags.string({
@@ -3,10 +3,9 @@ import { BaseCommand } from '../../base-command';
3
3
  * `skrr tokens create` — mint a personal access token (`osk_pat_*`, OSK-13208)
4
4
  * for CI. The secret is printed EXACTLY ONCE.
5
5
  *
6
- * Creating one needs a sign-in session (a token cannot mint a token) and, for
7
- * an account with two-factor authentication, a fresh authenticator code from
8
- * that session. `--otp` / `--backup-code` supply it up front; at a terminal the
9
- * command asks for it when the server does.
6
+ * Creating one needs a sign-in session and a fresh proof for that session.
7
+ * Accounts with an authenticator use it; eligible accounts without one can
8
+ * request an email code interactively. The server decides which methods apply.
10
9
  */
11
10
  export default class TokensCreate extends BaseCommand {
12
11
  static description: string;
@@ -10,10 +10,9 @@ const prompt_1 = require("../../lib/prompt");
10
10
  * `skrr tokens create` — mint a personal access token (`osk_pat_*`, OSK-13208)
11
11
  * for CI. The secret is printed EXACTLY ONCE.
12
12
  *
13
- * Creating one needs a sign-in session (a token cannot mint a token) and, for
14
- * an account with two-factor authentication, a fresh authenticator code from
15
- * that session. `--otp` / `--backup-code` supply it up front; at a terminal the
16
- * command asks for it when the server does.
13
+ * Creating one needs a sign-in session and a fresh proof for that session.
14
+ * Accounts with an authenticator use it; eligible accounts without one can
15
+ * request an email code interactively. The server decides which methods apply.
17
16
  */
18
17
  class TokensCreate extends base_command_1.BaseCommand {
19
18
  static description = 'Create a personal access token for CI (use it as SKRR_TOKEN). The secret is shown once and never again.';
@@ -84,8 +83,20 @@ class TokensCreate extends base_command_1.BaseCommand {
84
83
  if (!process.stdin.isTTY) {
85
84
  return this.refuseStepUp(challenge);
86
85
  }
87
- const entered = (await (0, prompt_1.prompt)('Code from your authenticator app: ')).trim();
88
- code = { token: entered };
86
+ if (challenge.methods.includes('email_code')) {
87
+ try {
88
+ await data_provider_1.dataService.requestStepUpEmailCode({ purpose: data_provider_1.ACCESS_TOKEN_CREATE_STEP_UP_PURPOSE });
89
+ }
90
+ catch (sendErr) {
91
+ return this.handleApiError(sendErr);
92
+ }
93
+ const entered = (await (0, prompt_1.prompt)('Code emailed to your account: ', { hidden: true, output: process.stderr })).trim();
94
+ code = { emailCode: entered };
95
+ }
96
+ else {
97
+ const entered = (await (0, prompt_1.prompt)('Code from your authenticator app: ', { hidden: true, output: process.stderr })).trim();
98
+ code = { token: entered };
99
+ }
89
100
  await this.verify(code);
90
101
  try {
91
102
  created = await (0, access_tokens_1.createAccessToken)(input);
@@ -123,7 +134,9 @@ class TokensCreate extends base_command_1.BaseCommand {
123
134
  const messages = {
124
135
  credential_not_session_bound: `Creating an access token needs a sign-in session, and this credential is not one (an access token cannot create another). Run \`${bin} login\` and try again. Nothing changed.`,
125
136
  two_factor_not_enabled: 'Creating an access token needs two-factor authentication on this account. Turn it on in the web app, then try again. Nothing changed.',
126
- no_recent_step_up: 'Creating an access token needs a fresh code from your authenticator app. Run this command again with --otp <code> (or --backup-code <code>). Nothing changed.',
137
+ no_recent_step_up: challenge.methods.includes('email_code')
138
+ ? 'Creating an access token needs email verification. Run this command in an interactive terminal to request and enter the code. Nothing changed.'
139
+ : 'Creating an access token needs a fresh code from your authenticator app. Run this command again with --otp <code> (or --backup-code <code>). Nothing changed.',
127
140
  };
128
141
  this.error(messages[challenge.reason], { code: 'STEP_UP_REQUIRED', exit: 2 });
129
142
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.describeFireAuditDetail = describeFireAuditDetail;
4
4
  const core_1 = require("@oclif/core");
5
+ const data_provider_1 = require("@skrr-ai/data-provider");
5
6
  const base_command_1 = require("../../base-command");
6
7
  const triggers_1 = require("../../lib/triggers");
7
8
  /**
@@ -25,6 +26,19 @@ function describeFireAuditDetail(detail, fireId, triggerId) {
25
26
  lines.push(`Reason: ${reason}`);
26
27
  if (message && message !== reason)
27
28
  lines.push(`${reason ? 'Detail:' : 'Reason:'} ${message}`);
29
+ // The fire's durable Run is queued but a claim refusal is holding it back; the Run row and the fire
30
+ // say nothing else (OSK-22700).
31
+ const claimRefusal = (0, data_provider_1.describeRunClaimRefusal)(detail.claimRefusal);
32
+ if (claimRefusal) {
33
+ const runId = detail.claimRefusal.runId;
34
+ if (typeof runId === 'string' && runId.trim())
35
+ lines.push(`Run: ${runId.trim()}`);
36
+ lines.push(claimRefusal);
37
+ // The owner's way out of a Run held for an unconfirmed stop, with the generation to pass. Only for that reason (OSK-22700).
38
+ const release = (0, data_provider_1.describeRunClaimRefusalRelease)(detail.claimRefusal);
39
+ if (release)
40
+ lines.push(release);
41
+ }
28
42
  const clockSkip = (0, triggers_1.clockSkipAuditExplanation)(detail);
29
43
  if (clockSkip) {
30
44
  lines.push(`Explanation: ${clockSkip.summary}. ${clockSkip.detail}`);
@@ -44,6 +58,11 @@ function describeFireAuditDetail(detail, fireId, triggerId) {
44
58
  lines.push(`Inbox card: ${policyCard}`);
45
59
  if (detail.durationMs !== undefined)
46
60
  lines.push(`Duration: ${String(detail.durationMs)}ms`);
61
+ // A scheduled fire that started long after the scheduler claimed it says where that time went
62
+ // (OSK-22613); `--json` carries the whole breakdown as `metadata.startLag`.
63
+ const startLag = (0, triggers_1.scheduleStartLagSentence)(detail.metadata);
64
+ if (startLag)
65
+ lines.push(`Start lag: ${startLag}`);
47
66
  if (detail.conversationId)
48
67
  lines.push(`Conversation: ${String(detail.conversationId)}`);
49
68
  const metadata = detail.metadata;
@@ -149,8 +149,15 @@ class TriggersPreflight extends base_command_1.BaseCommand {
149
149
  for (const line of fireLines)
150
150
  this.log(line);
151
151
  }
152
- if (report.destination) {
153
- this.log(`\nDestination: ${(0, triggers_1.destinationLine)(report.destination)}`);
152
+ const dutyQueue = ['duty_check', 'duty_reflection', 'enqueue_duty_check', 'enqueue_duty_reflection']
153
+ .includes(report.executorMode ?? '');
154
+ if (dutyQueue) {
155
+ if (!report.notes?.some((note) => note.includes('this preflight does not resolve its model or harness')))
156
+ this.log('\nInference target: not evaluated by this trigger preflight.');
157
+ }
158
+ else if (report.destination) {
159
+ this.log(`\nConversation destination preview: ${(0, triggers_1.destinationLine)(report.destination)}`);
160
+ this.log(' This is an advisory conversation preview, not a model or harness selection.');
154
161
  }
155
162
  // Non-zero when the trigger would not autonomously run, so this is usable
156
163
  // in a script or a pre-deploy check. `2` for indeterminate keeps "blocked"