@skrr-ai/cli 0.1.207 → 0.1.209

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 (168) hide show
  1. package/dist/commands/agent/message/no-reply.js +1 -1
  2. package/dist/commands/agent/message/react.d.ts +23 -0
  3. package/dist/commands/agent/message/react.js +125 -0
  4. package/dist/commands/agent/message/resolve.d.ts +31 -0
  5. package/dist/commands/agent/message/resolve.js +111 -0
  6. package/dist/commands/agent/message/retract.js +1 -1
  7. package/dist/commands/agent/message/send.d.ts +25 -6
  8. package/dist/commands/agent/message/send.js +135 -30
  9. package/dist/commands/agent/request/list.d.ts +15 -0
  10. package/dist/commands/agent/request/list.js +82 -0
  11. package/dist/commands/agent/request/send.d.ts +18 -0
  12. package/dist/commands/agent/request/send.js +56 -0
  13. package/dist/commands/agents/access/approve.d.ts +17 -0
  14. package/dist/commands/agents/access/approve.js +94 -0
  15. package/dist/commands/agents/access/deny.d.ts +10 -0
  16. package/dist/commands/agents/access/deny.js +36 -0
  17. package/dist/commands/agents/access/list.d.ts +10 -0
  18. package/dist/commands/agents/access/list.js +55 -0
  19. package/dist/commands/agents/access/reach.d.ts +13 -0
  20. package/dist/commands/agents/access/reach.js +53 -0
  21. package/dist/commands/agents/access/revoke.d.ts +13 -0
  22. package/dist/commands/agents/access/revoke.js +50 -0
  23. package/dist/commands/agents/always-on/recovery-review.d.ts +5 -0
  24. package/dist/commands/agents/always-on/recovery-review.js +16 -0
  25. package/dist/commands/agents/chat.d.ts +8 -0
  26. package/dist/commands/agents/chat.js +369 -90
  27. package/dist/commands/agents/import.d.ts +15 -1
  28. package/dist/commands/agents/import.js +212 -24
  29. package/dist/commands/agents/intuitions/accept.d.ts +0 -1
  30. package/dist/commands/agents/intuitions/accept.js +22 -7
  31. package/dist/commands/agents/intuitions/generate.d.ts +0 -1
  32. package/dist/commands/agents/intuitions/generate.js +4 -16
  33. package/dist/commands/agents/intuitions/list.js +9 -3
  34. package/dist/commands/agents/intuitions/resume.d.ts +11 -0
  35. package/dist/commands/agents/intuitions/resume.js +37 -0
  36. package/dist/commands/agents/manager/status.js +7 -6
  37. package/dist/commands/agents/not-for-task.d.ts +24 -0
  38. package/dist/commands/agents/not-for-task.js +60 -0
  39. package/dist/commands/agents/schedule-overview.d.ts +20 -0
  40. package/dist/commands/agents/schedule-overview.js +35 -2
  41. package/dist/commands/agents/shared-memory.d.ts +24 -0
  42. package/dist/commands/agents/shared-memory.js +67 -0
  43. package/dist/commands/agents/stop.d.ts +23 -0
  44. package/dist/commands/agents/stop.js +61 -0
  45. package/dist/commands/agents/update.d.ts +7 -0
  46. package/dist/commands/agents/update.js +45 -2
  47. package/dist/commands/agents/visibility.d.ts +1 -0
  48. package/dist/commands/agents/visibility.js +14 -0
  49. package/dist/commands/code/migrate.js +3 -1
  50. package/dist/commands/convos/messages.js +5 -0
  51. package/dist/commands/convos/transcript.js +2 -2
  52. package/dist/commands/daemon/logs.d.ts +3 -1
  53. package/dist/commands/daemon/logs.js +6 -2
  54. package/dist/commands/duties/advance-next.js +16 -7
  55. package/dist/commands/duties/preflight.js +17 -13
  56. package/dist/commands/followups/show.js +9 -0
  57. package/dist/commands/followups/watch-pr.d.ts +27 -0
  58. package/dist/commands/followups/watch-pr.js +124 -0
  59. package/dist/commands/harnesses/evaluations/evidence.js +2 -2
  60. package/dist/commands/harnesses/evaluations/grant.js +1 -1
  61. package/dist/commands/harnesses/evaluations/revoke.js +1 -1
  62. package/dist/commands/harnesses/evaluations/show.js +1 -1
  63. package/dist/commands/harnesses/rollouts/grant.js +1 -1
  64. package/dist/commands/harnesses/rollouts/revoke.js +1 -1
  65. package/dist/commands/machines/hosted/identity-evaluations/revoke.js +1 -1
  66. package/dist/commands/machines/hosted/identity-evaluations/show.js +1 -1
  67. package/dist/commands/memory/consolidation/index.d.ts +20 -0
  68. package/dist/commands/memory/consolidation/index.js +78 -0
  69. package/dist/commands/memory/consolidation/resume.d.ts +14 -0
  70. package/dist/commands/memory/consolidation/resume.js +46 -0
  71. package/dist/commands/memory/consolidation/undo.d.ts +18 -0
  72. package/dist/commands/memory/consolidation/undo.js +61 -0
  73. package/dist/commands/messages/list.js +9 -1
  74. package/dist/commands/slack/mutes.d.ts +10 -0
  75. package/dist/commands/slack/mutes.js +62 -0
  76. package/dist/commands/slack/unmute.d.ts +12 -0
  77. package/dist/commands/slack/unmute.js +44 -0
  78. package/dist/commands/tasks/actionability.js +10 -0
  79. package/dist/commands/tasks/ask.d.ts +50 -0
  80. package/dist/commands/tasks/ask.js +190 -0
  81. package/dist/commands/tasks/bulk-update.js +12 -0
  82. package/dist/commands/tasks/handover.js +14 -0
  83. package/dist/commands/tasks/input/answer.js +8 -2
  84. package/dist/commands/tasks/input/show.d.ts +26 -0
  85. package/dist/commands/tasks/input/show.js +185 -17
  86. package/dist/commands/tasks/list.d.ts +8 -0
  87. package/dist/commands/tasks/list.js +50 -9
  88. package/dist/commands/tasks/move.d.ts +3 -0
  89. package/dist/commands/tasks/move.js +71 -1
  90. package/dist/commands/tasks/result/show.js +19 -7
  91. package/dist/commands/tasks/result/submit.js +3 -0
  92. package/dist/commands/tasks/runs.d.ts +4 -1
  93. package/dist/commands/tasks/runs.js +22 -3
  94. package/dist/commands/tasks/show.d.ts +4 -3
  95. package/dist/commands/tasks/show.js +40 -7
  96. package/dist/commands/tasks/start.js +35 -16
  97. package/dist/commands/tasks/update.d.ts +1 -0
  98. package/dist/commands/tasks/update.js +55 -1
  99. package/dist/commands/tasks/updates/add.js +3 -0
  100. package/dist/commands/tasks/wait.d.ts +20 -0
  101. package/dist/commands/tasks/wait.js +103 -2
  102. package/dist/generated/agent-guides.json +892 -183
  103. package/dist/generated/managed-instruction-guides.json +1 -1
  104. package/dist/lib/agent-access-command.d.ts +19 -0
  105. package/dist/lib/agent-access-command.js +44 -0
  106. package/dist/lib/agent-access.d.ts +18 -0
  107. package/dist/lib/agent-access.js +48 -0
  108. package/dist/lib/agent-import/apply.d.ts +50 -0
  109. package/dist/lib/agent-import/apply.js +85 -0
  110. package/dist/lib/agent-import/plan.d.ts +132 -0
  111. package/dist/lib/agent-import/plan.js +504 -0
  112. package/dist/lib/agent-import/reader.d.ts +94 -0
  113. package/dist/lib/agent-import/reader.js +326 -0
  114. package/dist/lib/agent-import/schedule.d.ts +46 -0
  115. package/dist/lib/agent-import/schedule.js +220 -0
  116. package/dist/lib/agent-import/sources.d.ts +124 -0
  117. package/dist/lib/agent-import/sources.js +797 -0
  118. package/dist/lib/chat-stop.d.ts +17 -0
  119. package/dist/lib/chat-stop.js +70 -0
  120. package/dist/lib/cloud-reply.d.ts +21 -0
  121. package/dist/lib/cloud-reply.js +52 -0
  122. package/dist/lib/duties.js +24 -4
  123. package/dist/lib/duty-ledgers.js +19 -2
  124. package/dist/lib/file-mime.js +8 -0
  125. package/dist/lib/followups.d.ts +61 -0
  126. package/dist/lib/followups.js +39 -0
  127. package/dist/lib/handover-interview.d.ts +18 -0
  128. package/dist/lib/handover-interview.js +53 -0
  129. package/dist/lib/inbound-messages.d.ts +156 -0
  130. package/dist/lib/inbound-messages.js +375 -0
  131. package/dist/lib/input-queue.js +2 -1
  132. package/dist/lib/intuition-look.d.ts +10 -0
  133. package/dist/lib/intuition-look.js +64 -0
  134. package/dist/lib/message-intent.d.ts +18 -2
  135. package/dist/lib/message-intent.js +23 -1
  136. package/dist/lib/preflight-copy.d.ts +16 -1
  137. package/dist/lib/preflight-copy.js +33 -1
  138. package/dist/lib/record-output.d.ts +1 -1
  139. package/dist/lib/record-output.js +2 -0
  140. package/dist/lib/skill-import.d.ts +19 -0
  141. package/dist/lib/skill-import.js +34 -0
  142. package/dist/lib/slack-thread-mutes.d.ts +25 -0
  143. package/dist/lib/slack-thread-mutes.js +12 -0
  144. package/dist/lib/task-carriers.d.ts +18 -0
  145. package/dist/lib/task-carriers.js +43 -0
  146. package/dist/lib/task-extras.d.ts +5 -0
  147. package/dist/lib/task-extras.js +5 -0
  148. package/dist/lib/task-operations.d.ts +2 -0
  149. package/dist/lib/task-operations.js +28 -4
  150. package/dist/lib/task-preflight.js +1 -0
  151. package/dist/lib/task-recurrence-summary.d.ts +15 -0
  152. package/dist/lib/task-recurrence-summary.js +22 -0
  153. package/dist/lib/task-review-notice.d.ts +21 -0
  154. package/dist/lib/task-review-notice.js +46 -0
  155. package/dist/lib/task-version.d.ts +53 -0
  156. package/dist/lib/task-version.js +89 -0
  157. package/dist/lib/task-write-attribution.d.ts +7 -0
  158. package/dist/lib/task-write-attribution.js +14 -0
  159. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelopeBridge.js +6 -1
  160. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/turnPacing.d.ts +75 -0
  161. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/turnPacing.js +124 -0
  162. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelopeBridge.js +45 -15
  163. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/turnPacing.d.ts +75 -0
  164. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/turnPacing.js +141 -0
  165. package/dist/node_modules/@skrr-ai/auth-core/package.json +11 -1
  166. package/dist/node_modules/@skrr-ai/data-provider/index.js +13492 -12505
  167. package/oclif.manifest.json +2090 -132
  168. package/package.json +9 -2
@@ -107,6 +107,10 @@ function preflightHeadline(report, persisted) {
107
107
  const caveats = [];
108
108
  if (noActionRuns)
109
109
  caveats.push('its daily Run budget is 0, so no agent turn will start');
110
+ // Spent for today is a different fact from a budget of 0: it clears at 00:00 UTC (OSK-33248).
111
+ else if (gateById('run_budget')?.verdict === 'block') {
112
+ caveats.push('today\u2019s Run budget is spent, so no agent turn starts until it resets');
113
+ }
110
114
  if (gateById('endpoint')?.verdict === 'block') {
111
115
  caveats.push('no connected endpoint can deliver its reports');
112
116
  }
@@ -164,7 +168,13 @@ function preflightGateLines(gate, verbose = false, refusesActivation = false, un
164
168
  // answers 409 for it, so it is tagged BLOCK and says what it stops. `info (advisory: does not stop a
165
169
  // run)` beside an "Activation: would be refused" section naming the same gate was two answers to one
166
170
  // question.
167
- const advisoryBlock = gate.verdict === 'block' && gate.admission === 'advisory' && !refusesActivation;
171
+ // A spent run budget is advisory because it clears by itself and must not refuse activation, but
172
+ // it does refuse the next agent turn, so "does not stop a run" would be false (OSK-33248).
173
+ const spentRunBudget = gate.id === 'run_budget' && gate.verdict === 'block';
174
+ const advisoryBlock = gate.verdict === 'block' &&
175
+ gate.admission === 'advisory' &&
176
+ !refusesActivation &&
177
+ !spentRunBudget;
168
178
  const stopsActivationOnly = gate.verdict === 'block' && gate.admission === 'advisory' && refusesActivation;
169
179
  // A deleted Sensor is the one advisory block that must not read lower than a silent one (`warn`):
170
180
  // it is the more serious state (OSK-22592).
@@ -195,7 +205,10 @@ function preflightGateLines(gate, verbose = false, refusesActivation = false, un
195
205
  const lines = [
196
206
  ` ${mark.padEnd(5)} ${gate.label}${showReason && gate.reason ? ` — ${gate.reason}` : ''}` +
197
207
  (advisoryBlock ? ' (advisory: does not stop a run)' : '') +
198
- (stopsActivationOnly ? ' (stops activation, not a run that is already live)' : ''),
208
+ (stopsActivationOnly && !spentRunBudget
209
+ ? ' (stops activation, not a run that is already live)'
210
+ : '') +
211
+ (spentRunBudget ? ' (stops agent turns, not activation)' : ''),
199
212
  ];
200
213
  if (hasNote) {
201
214
  lines.push(` ${String(note).trim()}`);
@@ -396,18 +409,9 @@ class DutiesPreflight extends base_command_1.BaseCommand {
396
409
  }
397
410
  if (report.capabilities?.length) {
398
411
  this.log('\nWhere access comes from:');
399
- const sourceLabels = {
400
- event_payload: 'Event facts',
401
- platform_grant: 'Platform-attested access',
402
- local_harness: 'This machine’s tooling',
403
- cloud_runtime: 'Runtime-scoped access',
404
- };
405
412
  for (const capability of report.capabilities) {
406
- this.log(` ${sourceLabels[capability.source]} · ${capability.provider} · ${capability.capability}${capability.scope ? ` · ${capability.scope}` : ''}: ${(0, preflight_copy_1.capabilityStatusLabel)(capability)}`);
407
- if (capability.testedAt)
408
- this.log(` Tested: ${capability.testedAt}${capability.expiresAt ? ` · expires ${capability.expiresAt}` : ''}`);
409
- if (capability.attestation === 'machine')
410
- this.log(' Machine-attested; not platform-attested.');
413
+ for (const line of (0, preflight_copy_1.capabilityLines)(capability))
414
+ this.log(line);
411
415
  }
412
416
  }
413
417
  for (const line of nextRunsLines(report, activation === true))
@@ -57,6 +57,15 @@ class FollowupsShow extends base_command_1.BaseCommand {
57
57
  : undefined,
58
58
  ],
59
59
  ['deadline', row.deadlineAt],
60
+ ['pull request', (0, followups_1.pullRequestLine)(row)],
61
+ ['woke', (0, followups_1.wakeLine)(row)],
62
+ ['stopped', (0, followups_1.stopReasonLine)(row)],
63
+ [
64
+ 'blocks',
65
+ row.taskHold
66
+ ? `task ${row.taskHold.taskId}${row.taskHold.releasedAt ? ` (moved back to ${row.taskHold.previousStatus ?? 'its status'} at ${row.taskHold.releasedAt})` : ''}`
67
+ : undefined,
68
+ ],
60
69
  [
61
70
  'waiting',
62
71
  row.parkedAt && !row.terminal
@@ -0,0 +1,27 @@
1
+ import { BaseCommand } from '../../base-command';
2
+ /**
3
+ * `skrr followups watch-pr <pr>` — watch one pull request to the end.
4
+ *
5
+ * One command for what an agent driving a PR needs: wake me once, when CI settles on the PR's
6
+ * current head, when it conflicts, when a review lands, or when it is merged or closed, and tell me
7
+ * which. The server holds the fix-attempt budget; once it is spent, the next failure is handed to
8
+ * the owner instead of waking the agent.
9
+ */
10
+ export default class FollowupsWatchPr extends BaseCommand {
11
+ static summary: string;
12
+ static description: string;
13
+ static examples: string[];
14
+ static args: {
15
+ ref: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
16
+ };
17
+ static flags: {
18
+ agent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
+ subject: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
20
+ why: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
21
+ deadline: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
22
+ 'max-fix-attempts': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
23
+ 'reset-attempts': import("@oclif/core/interfaces").BooleanFlag<boolean>;
24
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
25
+ };
26
+ run(): Promise<void>;
27
+ }
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const data_provider_1 = require("@skrr-ai/data-provider");
5
+ const base_command_1 = require("../../base-command");
6
+ const followups_1 = require("../../lib/followups");
7
+ const agent_resolver_1 = require("../../lib/agent-resolver");
8
+ /**
9
+ * `skrr followups watch-pr <pr>` — watch one pull request to the end.
10
+ *
11
+ * One command for what an agent driving a PR needs: wake me once, when CI settles on the PR's
12
+ * current head, when it conflicts, when a review lands, or when it is merged or closed, and tell me
13
+ * which. The server holds the fix-attempt budget; once it is spent, the next failure is handed to
14
+ * the owner instead of waking the agent.
15
+ */
16
+ class FollowupsWatchPr extends base_command_1.BaseCommand {
17
+ static summary = 'Watch a pull request until it is merged or closed, with a fix budget';
18
+ static description = [
19
+ "Arms one wait that wakes the agent ONCE, on the first of: CI settled on the PR's current head (pass or fail; an older head is ignored, and a push starts the wait for CI again), a merge conflict, a submitted review, the merge, or a close without merge. The wake says which event it was.",
20
+ 'Each wake for a failed CI run or requested changes spends one fix attempt (default 2). When they are spent, the next failure does not wake the agent: the watch stops, and its owner gets a card and an Update on the task. A good-news wake (CI passed, approved) starts the count again. Only the owner resets it, with --reset-attempts or --max-fix-attempts.',
21
+ 'After acting on a wake, the agent arms the next watch with the same command; the attempt count carries over. The default deadline is 6h, the longest a GitHub Actions job can run.',
22
+ ].join('\n\n');
23
+ static examples = [
24
+ '<%= config.bin %> followups watch-pr acme/api#42',
25
+ '<%= config.bin %> followups watch-pr https://github.com/acme/api/pull/42 --subject task:OSK-42',
26
+ '<%= config.bin %> followups watch-pr acme/api#42 --deadline 2d',
27
+ '<%= config.bin %> followups watch-pr acme/api#42 --agent agent_abc --reset-attempts',
28
+ ];
29
+ static args = {
30
+ ref: core_1.Args.string({
31
+ description: 'The pull request: owner/repo#number or its github.com URL',
32
+ required: true,
33
+ ignoreStdin: true,
34
+ }),
35
+ };
36
+ static flags = {
37
+ agent: core_1.Flags.string({ description: 'Agent ID (default: bound session agent)' }),
38
+ subject: core_1.Flags.string({
39
+ description: 'What the watch is about, type:externalKey (task:OSK-42 posts its outcome on that task); default: the pull request itself',
40
+ }),
41
+ why: core_1.Flags.string({ description: 'Why this watch exists, in one line' }),
42
+ deadline: core_1.Flags.string({
43
+ description: 'When the watch stops if nothing happened: 10m to 7d, such as 6h or 2d (default 6h)',
44
+ }),
45
+ 'max-fix-attempts': core_1.Flags.integer({
46
+ description: `Set the fix-attempt budget (1-${data_provider_1.PULL_REQUEST_WATCH_MAX_FIX_ATTEMPTS}) and start the count again. The owner's to set: refused from an agent run`,
47
+ }),
48
+ 'reset-attempts': core_1.Flags.boolean({
49
+ description: "Start the fix-attempt count again. The owner's to set: refused from an agent run",
50
+ }),
51
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
52
+ };
53
+ async run() {
54
+ this.requireAuth();
55
+ const { args, flags } = await this.parse(FollowupsWatchPr);
56
+ if (!(0, data_provider_1.parsePullRequestRef)(args.ref)) {
57
+ this.failWithCliError({
58
+ message: `"${args.ref}" does not name a pull request. Use owner/repo#number or https://github.com/owner/repo/pull/number, for example: skrr followups watch-pr acme/api#42`,
59
+ code: 'FOLLOWUP_INVALID_FIELD',
60
+ exit: 2,
61
+ retryable: false,
62
+ });
63
+ }
64
+ let agent;
65
+ try {
66
+ agent = (0, followups_1.resolveFollowUpAgent)(flags.agent);
67
+ }
68
+ catch (err) {
69
+ const failure = (0, agent_resolver_1.agentResolutionFailure)(err);
70
+ this.failWithCliError({
71
+ message: failure.message,
72
+ code: failure.code,
73
+ exit: 2,
74
+ retryable: false,
75
+ details: { suggestion: failure.suggestion, context: failure.details },
76
+ });
77
+ }
78
+ let subject;
79
+ if (flags.subject) {
80
+ try {
81
+ subject = (0, followups_1.parseSubjectRef)(flags.subject);
82
+ }
83
+ catch (err) {
84
+ this.failWithCliError({
85
+ message: err.message,
86
+ code: 'FOLLOWUP_INVALID_FIELD',
87
+ exit: 2,
88
+ retryable: false,
89
+ });
90
+ }
91
+ }
92
+ let response;
93
+ try {
94
+ response = await followups_1.followupsApi.watchPullRequest({
95
+ ref: args.ref,
96
+ agentId: agent.id,
97
+ producer: agent.boundToSession ? 'agent_in_turn' : 'user_explicit',
98
+ ...(subject ? { subject } : {}),
99
+ ...(flags.why ? { why: flags.why } : {}),
100
+ ...(flags.deadline ? { deadline: flags.deadline } : {}),
101
+ ...(flags['max-fix-attempts'] !== undefined
102
+ ? { maxFixAttempts: flags['max-fix-attempts'] }
103
+ : {}),
104
+ ...(flags['reset-attempts'] ? { resetAttempts: true } : {}),
105
+ });
106
+ }
107
+ catch (err) {
108
+ this.handleApiError(err);
109
+ return;
110
+ }
111
+ if (flags.json) {
112
+ this.printJsonResult(response);
113
+ return;
114
+ }
115
+ const notice = (0, followups_1.producerDowngradeNotice)(response);
116
+ if (notice)
117
+ this.log(notice);
118
+ const row = response.followup;
119
+ const pr = row ? (0, followups_1.pullRequestLine)(row) : undefined;
120
+ this.log(`${response.reused ? 'Already watching' : 'Watching'} ${pr ?? response.pullRequest?.ref ?? args.ref}: ${row?.id ?? '—'}${row?.deadlineAt ? `, until ${row.deadlineAt}` : ''}.`);
121
+ this.log('It wakes the agent once, on CI settling, a conflict, a review, the merge or a close. Re-arm it with this command after acting on a wake.');
122
+ }
123
+ }
124
+ exports.default = FollowupsWatchPr;
@@ -40,7 +40,7 @@ class HarnessesEvaluationsEvidence extends base_command_1.BaseCommand {
40
40
  this.error('--financial requires --json and a standalone read', { exit: 2 });
41
41
  try {
42
42
  const result = await (0, harness_evaluations_1.harnessEvaluationFinancialEvidence)(args.grantId, flags['financial-workspace']);
43
- this.log(JSON.stringify(result, null, 2));
43
+ this.printJsonResult(result);
44
44
  }
45
45
  catch (err) {
46
46
  this.handleApiError(err);
@@ -59,7 +59,7 @@ class HarnessesEvaluationsEvidence extends base_command_1.BaseCommand {
59
59
  return;
60
60
  }
61
61
  if (flags.json) {
62
- this.log(JSON.stringify(result, null, 2));
62
+ this.printJsonResult(result);
63
63
  return;
64
64
  }
65
65
  this.log(`${result.grant.grantId}: ${result.turns.length} turns`);
@@ -91,7 +91,7 @@ class HarnessesEvaluationsGrant extends base_command_1.BaseCommand {
91
91
  }
92
92
  }
93
93
  if (flags.json) {
94
- this.log(JSON.stringify({ ...result, rescan }, null, 2));
94
+ this.printJsonResult({ ...result, rescan });
95
95
  return;
96
96
  }
97
97
  const { grant } = result;
@@ -36,7 +36,7 @@ class HarnessesEvaluationsRevoke extends base_command_1.BaseCommand {
36
36
  return;
37
37
  }
38
38
  if (flags.json) {
39
- this.log(JSON.stringify(result, null, 2));
39
+ this.printJsonResult(result);
40
40
  return;
41
41
  }
42
42
  this.log(`Withdrew ${result.grant.grantId} (${result.grant.harness} on daemon ${result.grant.daemonId}) after ${result.grant.admissions.length} turns.`);
@@ -26,7 +26,7 @@ class HarnessesEvaluationsShow extends base_command_1.BaseCommand {
26
26
  return;
27
27
  }
28
28
  if (flags.json) {
29
- this.log(JSON.stringify(result, null, 2));
29
+ this.printJsonResult(result);
30
30
  return;
31
31
  }
32
32
  const { grant } = result;
@@ -59,7 +59,7 @@ class HarnessesRolloutsGrant extends base_command_1.BaseCommand {
59
59
  return;
60
60
  }
61
61
  if (flags.json) {
62
- this.log(JSON.stringify(result, null, 2));
62
+ this.printJsonResult(result);
63
63
  return;
64
64
  }
65
65
  const { grant } = result;
@@ -60,7 +60,7 @@ class HarnessesRolloutsRevoke extends base_command_1.BaseCommand {
60
60
  return;
61
61
  }
62
62
  if (flags.json) {
63
- this.log(JSON.stringify(result, null, 2));
63
+ this.printJsonResult(result);
64
64
  return;
65
65
  }
66
66
  for (const grant of result.revoked) {
@@ -11,7 +11,7 @@ class Revoke extends base_command_1.BaseCommand {
11
11
  this.requireAuth();
12
12
  const { args, flags } = await this.parse(Revoke);
13
13
  try {
14
- this.log(JSON.stringify(await (0, hosted_identity_evaluations_1.revokeHostedIdentityEvaluation)(args.id, flags.reason), null, 2));
14
+ this.printJsonResult(await (0, hosted_identity_evaluations_1.revokeHostedIdentityEvaluation)(args.id, flags.reason));
15
15
  }
16
16
  catch (error) {
17
17
  this.handleApiError(error);
@@ -10,7 +10,7 @@ class Show extends base_command_1.BaseCommand {
10
10
  this.requireAuth();
11
11
  const { args } = await this.parse(Show);
12
12
  try {
13
- this.log(JSON.stringify(await (0, hosted_identity_evaluations_1.readHostedIdentityEvaluation)(args.id), null, 2));
13
+ this.printJsonResult(await (0, hosted_identity_evaluations_1.readHostedIdentityEvaluation)(args.id));
14
14
  }
15
15
  catch (error) {
16
16
  this.handleApiError(error);
@@ -0,0 +1,20 @@
1
+ import { type ConsolidationCycle } from '@skrr-ai/data-provider';
2
+ import { BaseCommand } from '../../../base-command';
3
+ /** `3 changed · 1 held back`, or the empty-cycle words. */
4
+ export declare function cycleSummary(cycle: ConsolidationCycle): string;
5
+ /**
6
+ * An Agent's nightly memory tidy-up (AutoDream): whether it is paused, and
7
+ * what each recent night proposed, changed and held back, with the reason for
8
+ * every held-back change. `skrr memory consolidation undo <cycle-id>` reverts
9
+ * one night; `skrr memory consolidation resume` lifts a pause.
10
+ */
11
+ export default class MemoryConsolidation extends BaseCommand {
12
+ static description: string;
13
+ static examples: string[];
14
+ static flags: {
15
+ agent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
16
+ limit: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
17
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
18
+ };
19
+ run(): Promise<void>;
20
+ }
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cycleSummary = cycleSummary;
4
+ const core_1 = require("@oclif/core");
5
+ const data_provider_1 = require("@skrr-ai/data-provider");
6
+ const base_command_1 = require("../../../base-command");
7
+ const agent_resolver_1 = require("../../../lib/agent-resolver");
8
+ /** `3 changed · 1 held back`, or the empty-cycle words. */
9
+ function cycleSummary(cycle) {
10
+ const parts = [`${cycle.changed} changed`];
11
+ if (cycle.refusals.length)
12
+ parts.push(`${cycle.refusals.length} held back`);
13
+ if (cycle.undoneAt)
14
+ parts.push(`undone ${cycle.undoneAt.slice(0, 10)}`);
15
+ return parts.join(' · ');
16
+ }
17
+ /**
18
+ * An Agent's nightly memory tidy-up (AutoDream): whether it is paused, and
19
+ * what each recent night proposed, changed and held back, with the reason for
20
+ * every held-back change. `skrr memory consolidation undo <cycle-id>` reverts
21
+ * one night; `skrr memory consolidation resume` lifts a pause.
22
+ */
23
+ class MemoryConsolidation extends base_command_1.BaseCommand {
24
+ static description = "Show an agent's nightly memory tidy-ups and what each one changed";
25
+ static examples = [
26
+ '<%= config.bin %> memory consolidation --agent <agent-id>',
27
+ '<%= config.bin %> memory consolidation --agent <agent-id> --limit 30 --json',
28
+ ];
29
+ static flags = {
30
+ agent: core_1.Flags.string({
31
+ description: 'Agent ID (falls back to OVERSKY_AGENT_ID, then your primary agent)',
32
+ }),
33
+ limit: core_1.Flags.integer({ description: 'How many recent tidy-ups to show (1-50)', default: 14 }),
34
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
35
+ };
36
+ async run() {
37
+ this.requireAuth();
38
+ const { flags } = await this.parse(MemoryConsolidation);
39
+ let agentId;
40
+ try {
41
+ agentId = await (0, agent_resolver_1.resolveAgentId)(flags.agent);
42
+ }
43
+ catch (err) {
44
+ this.error(err.message, { exit: 1 });
45
+ }
46
+ let overview;
47
+ try {
48
+ overview = await data_provider_1.dataService.getAgentMemoryConsolidation(agentId, { limit: flags.limit });
49
+ }
50
+ catch (err) {
51
+ this.handleApiError(err);
52
+ }
53
+ if (flags.json) {
54
+ this.log(this.agentJson(agentId, overview));
55
+ return;
56
+ }
57
+ const { state, cycles } = overview;
58
+ this.log(`Overnight memory tidy-up for agent ${agentId}`);
59
+ const pause = (0, data_provider_1.consolidationPauseCopy)(state);
60
+ this.log(pause
61
+ ? ` ${pause} Resume: skrr memory consolidation resume --agent ${agentId}`
62
+ : ` Running. Failed nights in a row: ${state.failureStreak} of ${state.limits.failureDaysToPause}.`);
63
+ this.log(` Limits: at most ${state.limits.maxNewFacts} new entries and ${Math.round(state.limits.maxChangeShare * 100)}% of memory changed per night.`);
64
+ this.log('');
65
+ if (!cycles.length) {
66
+ this.log('No tidy-ups recorded yet.');
67
+ return;
68
+ }
69
+ for (const cycle of cycles) {
70
+ this.log(`${cycle.startedAt.slice(0, 16).replace('T', ' ')} ${(0, data_provider_1.consolidationOutcomeCopy)(cycle.outcome)} (${cycleSummary(cycle)})`);
71
+ this.log(` id ${cycle.id}${cycle.undoable ? ' · undo available' : ''}`);
72
+ for (const refusal of cycle.refusals) {
73
+ this.log(` held back: ${(0, data_provider_1.consolidationRefusalCopy)(refusal.reason)}`);
74
+ }
75
+ }
76
+ }
77
+ }
78
+ exports.default = MemoryConsolidation;
@@ -0,0 +1,14 @@
1
+ import { BaseCommand } from '../../../base-command';
2
+ /**
3
+ * Resume a nightly memory tidy-up that paused after failing several nights in
4
+ * a row. The failure count starts again from zero. Requires EDIT on the agent.
5
+ */
6
+ export default class MemoryConsolidationResume extends BaseCommand {
7
+ static description: string;
8
+ static examples: string[];
9
+ static flags: {
10
+ agent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
+ };
13
+ run(): Promise<void>;
14
+ }
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const data_provider_1 = require("@skrr-ai/data-provider");
5
+ const base_command_1 = require("../../../base-command");
6
+ const agent_resolver_1 = require("../../../lib/agent-resolver");
7
+ /**
8
+ * Resume a nightly memory tidy-up that paused after failing several nights in
9
+ * a row. The failure count starts again from zero. Requires EDIT on the agent.
10
+ */
11
+ class MemoryConsolidationResume extends base_command_1.BaseCommand {
12
+ static description = 'Resume a paused nightly memory tidy-up (requires EDIT)';
13
+ static examples = ['<%= config.bin %> memory consolidation resume --agent <agent-id>'];
14
+ static flags = {
15
+ agent: core_1.Flags.string({
16
+ description: 'Agent ID (falls back to OVERSKY_AGENT_ID, then your primary agent)',
17
+ }),
18
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
19
+ };
20
+ async run() {
21
+ this.requireAuth();
22
+ const { flags } = await this.parse(MemoryConsolidationResume);
23
+ let agentId;
24
+ try {
25
+ agentId = await (0, agent_resolver_1.resolveAgentId)(flags.agent);
26
+ }
27
+ catch (err) {
28
+ this.error(err.message, { exit: 1 });
29
+ }
30
+ let response;
31
+ try {
32
+ response = await data_provider_1.dataService.resumeAgentMemoryConsolidation(agentId);
33
+ }
34
+ catch (err) {
35
+ this.handleApiError(err);
36
+ }
37
+ if (flags.json) {
38
+ this.log(this.agentJson(agentId, response));
39
+ return;
40
+ }
41
+ this.log(response.state.paused
42
+ ? 'The tidy-up is still paused.'
43
+ : 'Overnight memory tidy-up resumed. It runs again tonight.');
44
+ }
45
+ }
46
+ exports.default = MemoryConsolidationResume;
@@ -0,0 +1,18 @@
1
+ import { BaseCommand } from '../../../base-command';
2
+ /**
3
+ * Revert everything one nightly tidy-up wrote, as new versions (history is
4
+ * kept). An entry changed since that night is left as it is now, and the
5
+ * command says so for each one. Requires EDIT on the agent.
6
+ */
7
+ export default class MemoryConsolidationUndo extends BaseCommand {
8
+ static description: string;
9
+ static examples: string[];
10
+ static args: {
11
+ cycleId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
12
+ };
13
+ static flags: {
14
+ agent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
+ };
17
+ run(): Promise<void>;
18
+ }
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const data_provider_1 = require("@skrr-ai/data-provider");
5
+ const base_command_1 = require("../../../base-command");
6
+ const agent_resolver_1 = require("../../../lib/agent-resolver");
7
+ /**
8
+ * Revert everything one nightly tidy-up wrote, as new versions (history is
9
+ * kept). An entry changed since that night is left as it is now, and the
10
+ * command says so for each one. Requires EDIT on the agent.
11
+ */
12
+ class MemoryConsolidationUndo extends base_command_1.BaseCommand {
13
+ static description = 'Undo everything one nightly memory tidy-up changed (requires EDIT)';
14
+ static examples = [
15
+ '<%= config.bin %> memory consolidation undo <cycle-id> --agent <agent-id>',
16
+ ];
17
+ static args = {
18
+ cycleId: core_1.Args.string({
19
+ description: 'Tidy-up id, from `skrr memory consolidation`',
20
+ required: true,
21
+ ignoreStdin: true,
22
+ }),
23
+ };
24
+ static flags = {
25
+ agent: core_1.Flags.string({
26
+ description: 'Agent ID (falls back to OVERSKY_AGENT_ID, then your primary agent)',
27
+ }),
28
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
29
+ };
30
+ async run() {
31
+ this.requireAuth();
32
+ const { args, flags } = await this.parse(MemoryConsolidationUndo);
33
+ let agentId;
34
+ try {
35
+ agentId = await (0, agent_resolver_1.resolveAgentId)(flags.agent);
36
+ }
37
+ catch (err) {
38
+ this.error(err.message, { exit: 1 });
39
+ }
40
+ let response;
41
+ try {
42
+ response = await data_provider_1.dataService.undoAgentMemoryConsolidationCycle(agentId, args.cycleId);
43
+ }
44
+ catch (err) {
45
+ this.handleApiError(err);
46
+ }
47
+ if (flags.json) {
48
+ this.log(this.agentJson(agentId, response));
49
+ return;
50
+ }
51
+ const { result } = response;
52
+ this.log(`Restored ${result.restored.length} memory entries.`);
53
+ if (result.skipped.length) {
54
+ this.log(`Left ${result.skipped.length} as they are:`);
55
+ for (const skipped of result.skipped) {
56
+ this.log(` ${skipped.memoryId}: ${(0, data_provider_1.consolidationUndoSkipCopy)(skipped.reason)}`);
57
+ }
58
+ }
59
+ }
60
+ }
61
+ exports.default = MemoryConsolidationUndo;
@@ -9,6 +9,14 @@ const format_1 = require("../../lib/format");
9
9
  const task_transcript_1 = require("../../lib/task-transcript");
10
10
  const message_provenance_1 = require("../../lib/message-provenance");
11
11
  const RUN_RE = /\s+/g;
12
+ /** What caused the row: an unattended run, an answer from the cloud while the machine could not. */
13
+ function viaLabel(m, provenance) {
14
+ if (provenance)
15
+ return (0, message_provenance_1.provenanceLabel)(provenance);
16
+ if (!m.isCreatedByUser && (0, data_provider_1.messageCloudReply)(m.metadata))
17
+ return 'cloud';
18
+ return '-';
19
+ }
12
20
  /**
13
21
  * OSK-2058 — resolve the conversation id from either calling convention.
14
22
  *
@@ -128,7 +136,7 @@ class MessagesList extends base_command_1.BaseCommand {
128
136
  return {
129
137
  when: m.createdAt ? new Date(String(m.createdAt)).toISOString().slice(11, 19) : '-',
130
138
  role: String(m.sender ?? m.role ?? (m.isCreatedByUser ? 'user' : 'assistant')),
131
- via: provenance ? (0, message_provenance_1.provenanceLabel)(provenance) : '-',
139
+ via: viaLabel(m, provenance),
132
140
  text: String(m.text ?? m.content ?? '')
133
141
  .replace(RUN_RE, ' ')
134
142
  .trim(),
@@ -0,0 +1,10 @@
1
+ import { BaseCommand } from '../../base-command';
2
+ export default class SlackMutes extends BaseCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ agent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
+ };
9
+ run(): Promise<void>;
10
+ }