@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
@@ -0,0 +1,17 @@
1
+ import { type ChatStopPreview, type ChatStopReceipt, type StopScope, type ChatStopTaskOutcome } from '@skrr-ai/data-provider';
2
+ /**
3
+ * Stop in an Agent's chat from a terminal (inbound messages, decision D9): what Stop all would
4
+ * stop, the stop itself, and the CLI's words for its receipt. A plain Stop stops the
5
+ * conversation's own work and never a Task; `--all` also stops the Tasks it launched.
6
+ */
7
+ /** What became of a Task Stop all looked at, after its name. One entry per outcome. */
8
+ export declare const STOP_TASK_OUTCOME_WORDS: Record<ChatStopTaskOutcome, string>;
9
+ export declare function readStopPreview(conversationId: string): Promise<ChatStopPreview>;
10
+ export declare function requestStop(conversationId: string, scope: StopScope, stopId: string): Promise<ChatStopReceipt>;
11
+ /** The receipt as lines: what stopped, what keeps running, and that nothing is undone. */
12
+ export declare function describeStopReceipt(receipt: ChatStopReceipt, hint: {
13
+ bin: string;
14
+ conversationId: string;
15
+ }): string[];
16
+ /** The preview as lines, for `--dry-run`. */
17
+ export declare function describeStopPreview(preview: ChatStopPreview): string[];
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.STOP_TASK_OUTCOME_WORDS = void 0;
4
+ exports.readStopPreview = readStopPreview;
5
+ exports.requestStop = requestStop;
6
+ exports.describeStopReceipt = describeStopReceipt;
7
+ exports.describeStopPreview = describeStopPreview;
8
+ const data_provider_1 = require("@skrr-ai/data-provider");
9
+ /**
10
+ * Stop in an Agent's chat from a terminal (inbound messages, decision D9): what Stop all would
11
+ * stop, the stop itself, and the CLI's words for its receipt. A plain Stop stops the
12
+ * conversation's own work and never a Task; `--all` also stops the Tasks it launched.
13
+ */
14
+ /** What became of a Task Stop all looked at, after its name. One entry per outcome. */
15
+ exports.STOP_TASK_OUTCOME_WORDS = {
16
+ stopped: 'stopped',
17
+ not_running: 'had already finished',
18
+ not_allowed: 'not stopped: you can no longer change it',
19
+ unconfirmed: 'may still be running; stop it from its own card',
20
+ };
21
+ function readStopPreview(conversationId) {
22
+ return data_provider_1.dataService.getConversationStopPreview(conversationId);
23
+ }
24
+ function requestStop(conversationId, scope, stopId) {
25
+ return data_provider_1.dataService.stopConversationWork(conversationId, { scope, stopId });
26
+ }
27
+ function names(tasks) {
28
+ return tasks.map(data_provider_1.chatStopTaskName).join(', ');
29
+ }
30
+ const tasksWord = (count) => (count === 1 ? 'Task' : 'Tasks');
31
+ /** The receipt as lines: what stopped, what keeps running, and that nothing is undone. */
32
+ function describeStopReceipt(receipt, hint) {
33
+ const lines = [];
34
+ const stopped = receipt.tasks.filter((task) => task.outcome === 'stopped');
35
+ if (receipt.workStopped)
36
+ lines.push('Stopped what your agent was doing in this conversation.');
37
+ else
38
+ lines.push('Your agent was not working in this conversation.');
39
+ for (const task of receipt.tasks) {
40
+ lines.push(` ${(0, data_provider_1.chatStopTaskName)(task)}: ${exports.STOP_TASK_OUTCOME_WORDS[task.outcome]}`);
41
+ }
42
+ const still = receipt.stillRunning;
43
+ if (still && still.length > 0) {
44
+ const count = still.length;
45
+ lines.push(receipt.scope === 'all'
46
+ ? `${count} ${tasksWord(count)} it started may still be running: ${names(still)}.`
47
+ : `${count} ${tasksWord(count)} it started from here ${count === 1 ? 'keeps' : 'keep'} running: ${names(still)}. ` +
48
+ `Stop them too with \`${hint.bin} agents stop --conversation ${hint.conversationId} --all\`.`);
49
+ }
50
+ if (receipt.workStopped || stopped.length > 0) {
51
+ lines.push('What was already done is not undone.');
52
+ }
53
+ return lines;
54
+ }
55
+ /** The preview as lines, for `--dry-run`. */
56
+ function describeStopPreview(preview) {
57
+ const lines = [
58
+ preview.workRunning
59
+ ? 'Your agent is working in this conversation; Stop stops that.'
60
+ : 'Your agent is not working in this conversation.',
61
+ ];
62
+ if (preview.tasks.length === 0) {
63
+ lines.push('No Task it started from here is running.');
64
+ }
65
+ else {
66
+ const count = preview.tasks.length;
67
+ lines.push(`--all also stops ${count} ${tasksWord(count)} it started from here: ${names(preview.tasks)}.`);
68
+ }
69
+ return lines;
70
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * An agent that answered from the cloud while its machine could not (inbound messages, decision
3
+ * D4). The sentences match the web's (`client/src/components/Chat/Messages/Delivery/
4
+ * cloudReplyCopy.ts`), and each table is a `Record` over the contract's closed list, so a new
5
+ * reason does not compile without words here.
6
+ */
7
+ import { type CloudReplyReason, type CloudReplySettingRefusal, type MessageCloudReply } from '@skrr-ai/data-provider';
8
+ type Named = (machine?: string) => string;
9
+ /** The label on the agent message, and what became of the person's message. */
10
+ export declare const CLOUD_REPLY_COPY: Record<CloudReplyReason, {
11
+ label: Named;
12
+ deferred: Named;
13
+ notCarriedOut: Named;
14
+ }>;
15
+ /** The label for an agent message's metadata, or null when it was not written from the cloud. */
16
+ export declare function cloudReplyLine(metadata: unknown): string | null;
17
+ /** What a handling written from the cloud says, for the decisions whose words differ. */
18
+ export declare function cloudHandlingSentence(cloud: MessageCloudReply, kind: 'deferred' | 'not_carried_out'): string;
19
+ /** Why the setting could not be turned on. */
20
+ export declare const CLOUD_REPLY_SETTING_REFUSAL_COPY: Record<CloudReplySettingRefusal, string>;
21
+ export {};
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CLOUD_REPLY_SETTING_REFUSAL_COPY = exports.CLOUD_REPLY_COPY = void 0;
4
+ exports.cloudReplyLine = cloudReplyLine;
5
+ exports.cloudHandlingSentence = cloudHandlingSentence;
6
+ /**
7
+ * An agent that answered from the cloud while its machine could not (inbound messages, decision
8
+ * D4). The sentences match the web's (`client/src/components/Chat/Messages/Delivery/
9
+ * cloudReplyCopy.ts`), and each table is a `Record` over the contract's closed list, so a new
10
+ * reason does not compile without words here.
11
+ */
12
+ const data_provider_1 = require("@skrr-ai/data-provider");
13
+ const UNTIL_WORK_ENDS = "It will take it up when it finishes what it's doing.";
14
+ /** The label on the agent message, and what became of the person's message. */
15
+ exports.CLOUD_REPLY_COPY = {
16
+ machine_offline: {
17
+ label: (m) => m
18
+ ? `From the cloud: ${m} was offline, so your agent couldn't see its files.`
19
+ : "From the cloud: your agent's machine was offline, so it couldn't see its files.",
20
+ deferred: (m) => m
21
+ ? `Your agent will take this up on ${m} when it's back.`
22
+ : 'Your agent will take this up when its machine is back.',
23
+ notCarriedOut: (m) => m
24
+ ? `Your agent couldn't do this from the cloud. It will take it up on ${m} when it's back.`
25
+ : "Your agent couldn't do this from the cloud. It will take it up when its machine is back.",
26
+ },
27
+ machine_busy: {
28
+ label: (m) => m
29
+ ? `From the cloud: ${m} was busy, so your agent couldn't see its files.`
30
+ : "From the cloud: your agent's machine was busy, so it couldn't see its files.",
31
+ // A busy machine still runs the work: what waits there waits for that work.
32
+ deferred: () => "Your agent will take this up when it finishes what it's doing.",
33
+ notCarriedOut: () => `Your agent couldn't do this from the cloud. ${UNTIL_WORK_ENDS}`,
34
+ },
35
+ };
36
+ /** The label for an agent message's metadata, or null when it was not written from the cloud. */
37
+ function cloudReplyLine(metadata) {
38
+ const cloud = (0, data_provider_1.messageCloudReply)(metadata);
39
+ return cloud ? exports.CLOUD_REPLY_COPY[cloud.reason].label(cloud.machineName) : null;
40
+ }
41
+ /** What a handling written from the cloud says, for the decisions whose words differ. */
42
+ function cloudHandlingSentence(cloud, kind) {
43
+ const copy = exports.CLOUD_REPLY_COPY[cloud.reason];
44
+ return kind === 'deferred'
45
+ ? copy.deferred(cloud.machineName)
46
+ : copy.notCarriedOut(cloud.machineName);
47
+ }
48
+ /** Why the setting could not be turned on. */
49
+ exports.CLOUD_REPLY_SETTING_REFUSAL_COPY = {
50
+ cloud_reply_needs_cloud_target: "Answering from the cloud needs a cloud runtime in this agent's runtime order. Add an Agent " +
51
+ 'Worker or a Hosted Machine to it, then turn this on.',
52
+ };
@@ -225,7 +225,8 @@ exports.dutyApi = {
225
225
  livenessSweep: () => data_provider_2.request.get('/api/duties/liveness/sweep'),
226
226
  /** One agent's Duties, system roles included, each with its loop status. */
227
227
  roster: (agentId) => data_provider_2.request.get((0, triggers_1.withQuery)('/api/duties/roster', {
228
- agentId, coverage: 'current-agent',
228
+ agentId,
229
+ coverage: 'current-agent',
229
230
  })),
230
231
  /** Is this Duty's loop installed and working. */
231
232
  loopStatus: (id, currentContractFallback = false) => data_provider_2.request.get((0, triggers_1.withQuery)(`${base(id)}/loop-status`, {
@@ -1277,9 +1278,17 @@ function describeOperationFix(duty, operation) {
1277
1278
  // its remedy are facts about that Run and stay true. Dropping them was
1278
1279
  // exactly the case being fixed: paused after a refusal, contract edited since.
1279
1280
  // The label says which Run the sentence is about instead.
1281
+ //
1282
+ // That holds only for a remedy of a failure code. A fix without a code
1283
+ // describes a condition the sweep saw (a run held for review, an owner
1284
+ // blocker), and a superseded verdict means the read no longer sees it:
1285
+ // printing "review and close it" for a hold already closed sent the owner
1286
+ // to a review that no longer existed (OSK-33237).
1280
1287
  const liveness = duty.state?.liveness;
1281
1288
  const lastRunFix = liveness && typeof liveness.diagnosisFix === 'string' ? liveness.diagnosisFix.trim() : '';
1282
- if (lastRunFix && lastRunFix !== remediation) {
1289
+ const conditionGone = liveness?.current === false &&
1290
+ !(typeof liveness.diagnosisCode === 'string' && liveness.diagnosisCode);
1291
+ if (lastRunFix && lastRunFix !== remediation && !conditionGone) {
1283
1292
  lines.push({ label: lastRunLabel(liveness, lines.length > 0), text: lastRunFix });
1284
1293
  }
1285
1294
  return lines;
@@ -1838,7 +1847,14 @@ function renderDutyLedger(ledger, log) {
1838
1847
  turns: describeRunCount(record(item.usage), 'turns'),
1839
1848
  tools: describeRunCount(record(item.usage), 'toolCallCount'),
1840
1849
  reason: text(firstValue(item, ['reason', 'error']), ''),
1841
- finished: text(firstValue(item, ['completedAt', 'updatedAt', 'claimedAt', 'queuedAt', 'reservedAt', 'startedAt'])),
1850
+ finished: text(firstValue(item, [
1851
+ 'completedAt',
1852
+ 'updatedAt',
1853
+ 'claimedAt',
1854
+ 'queuedAt',
1855
+ 'reservedAt',
1856
+ 'startedAt',
1857
+ ])),
1842
1858
  })), [
1843
1859
  { key: 'id', header: 'RUN ID', verbatim: true },
1844
1860
  { key: 'status', header: 'STATUS', maxWidth: 12 },
@@ -2294,7 +2310,11 @@ function wakeOutcomeLines(run) {
2294
2310
  function formatDutyExplanation(explanation) {
2295
2311
  const cycle = explanation.cycle;
2296
2312
  const wakeSaved = isRecordedDutyWake(cycle);
2297
- const outcomeWord = wakeSaved ? 'wake saved' : cycle?.confirmedDelivery ? 'delivered' : cycle?.outcome;
2313
+ const outcomeWord = wakeSaved
2314
+ ? 'wake saved'
2315
+ : cycle?.confirmedDelivery
2316
+ ? 'delivered'
2317
+ : cycle?.outcome;
2298
2318
  const lines = [
2299
2319
  cycle
2300
2320
  ? `Latest cycle: ${cycleTime(cycle.startedAt)} ${outcomeWord} (${cycle.id})`
@@ -106,20 +106,35 @@ function renderReflection(review, log) {
106
106
  { key: 'check', header: 'CHECK' },
107
107
  ], log);
108
108
  }
109
+ /**
110
+ * What a row says about a refuted step (OSK-33241): how many times it was refuted, and when it may
111
+ * be tried again, or, on a re-apply after the wait, when that wait ended. Empty for any other row.
112
+ */
113
+ function refutation(row) {
114
+ const count = typeof row.refutedCount === 'number' ? `${row.refutedCount}×` : '';
115
+ const until = text(row.retryAfter, '');
116
+ const decided = Date.parse(text(row.decidedAt, ''));
117
+ const waitEnded = Boolean(until) && Number.isFinite(decided) && Date.parse(until) <= decided;
118
+ const wait = until ? `${waitEnded ? 'wait ended' : 'retry after'} ${until}` : '';
119
+ return [count, wait].filter(Boolean).join(' · ');
120
+ }
109
121
  function renderCadenceDecisions(list, log) {
110
122
  const rows = (Array.isArray(list?.data) ? list.data : []);
111
123
  if (rows.length === 0) {
112
124
  log('No cadence decisions recorded.');
113
125
  return;
114
126
  }
115
- (0, format_1.renderTable)(rows.map((row) => ({
127
+ const refuted = rows.map(refutation);
128
+ (0, format_1.renderTable)(rows.map((row, index) => ({
116
129
  when: text(row.decidedAt),
117
130
  mode: text(row.mode),
118
131
  disposition: text(row.disposition),
119
132
  direction: text(row.direction),
120
133
  interval: `${minutes(row.currentIntervalMs)} → ${minutes(row.candidateIntervalMs)}`,
121
134
  confidence: typeof row.confidence === 'number' ? row.confidence.toFixed(2) : '-',
122
- reason: brief(row.reason, 70),
135
+ // A `recently_refuted` hold names the signal it set aside.
136
+ reason: brief(row.signalReason ? `${text(row.reason)} (${text(row.signalReason)})` : row.reason, 70),
137
+ refuted: refuted[index] || '-',
123
138
  })), [
124
139
  { key: 'when', header: 'DECIDED' },
125
140
  { key: 'mode', header: 'MODE' },
@@ -128,5 +143,7 @@ function renderCadenceDecisions(list, log) {
128
143
  { key: 'interval', header: 'INTERVAL' },
129
144
  { key: 'confidence', header: 'CONFIDENCE' },
130
145
  { key: 'reason', header: 'REASON', maxWidth: 70 },
146
+ // Only when a row has something to say, so a ledger with no refutation reads as before.
147
+ ...(refuted.some(Boolean) ? [{ key: 'refuted', header: 'REFUTED' }] : []),
131
148
  ], log);
132
149
  }
@@ -35,6 +35,10 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.mimeTypeForFilename = mimeTypeForFilename;
37
37
  const path = __importStar(require("node:path"));
38
+ // JavaScript and TypeScript source keeps the labels the generic file endpoint
39
+ // accepts (`text/javascript`, `application/typescript`). A Task stores it as
40
+ // plain text under its own name and only ever serves it as a download
41
+ // (OSK-20289), so the label is a declaration, not how the file is served.
38
42
  const MIME_TYPES = {
39
43
  '.3gp': 'video/3gp',
40
44
  '.aac': 'audio/aac',
@@ -43,6 +47,7 @@ const MIME_TYPES = {
43
47
  '.cjs': 'text/javascript',
44
48
  '.cpp': 'text/x-c++',
45
49
  '.cs': 'text/x-csharp',
50
+ '.cts': 'application/typescript',
46
51
  '.css': 'text/css',
47
52
  '.csv': 'text/csv',
48
53
  '.cxx': 'text/x-c++',
@@ -63,6 +68,7 @@ const MIME_TYPES = {
63
68
  '.jpg': 'image/jpeg',
64
69
  '.js': 'text/javascript',
65
70
  '.json': 'application/json',
71
+ '.jsx': 'text/javascript',
66
72
  // A stream of JSON values is text evidence, not one JSON document.
67
73
  // Preserve the original bytes and filename rather than forcing an array.
68
74
  '.jsonl': 'text/plain',
@@ -74,6 +80,7 @@ const MIME_TYPES = {
74
80
  '.mjs': 'text/javascript',
75
81
  '.mkv': 'video/mkv',
76
82
  '.mov': 'video/quicktime',
83
+ '.mts': 'application/typescript',
77
84
  '.mp3': 'audio/mpeg',
78
85
  '.mp4': 'video/mp4',
79
86
  '.ogv': 'video/ogv',
@@ -92,6 +99,7 @@ const MIME_TYPES = {
92
99
  '.tex': 'text/x-tex',
93
100
  '.txt': 'text/plain',
94
101
  '.ts': 'application/typescript',
102
+ '.tsx': 'application/typescript',
95
103
  '.tsv': 'text/tab-separated-values',
96
104
  '.vtt': 'text/vtt',
97
105
  '.wav': 'audio/wav',
@@ -1,3 +1,4 @@
1
+ import { type FollowUpStopReason, type PullRequestWakeKind } from '@skrr-ai/data-provider';
1
2
  import { withQuery } from './triggers';
2
3
  type Query = Parameters<typeof withQuery>[1];
3
4
  type Json = Record<string, unknown>;
@@ -90,9 +91,68 @@ export interface FollowUpRow {
90
91
  capsule?: unknown;
91
92
  nextRunAt?: string | null;
92
93
  deadlineAt?: string | null;
94
+ /** A one-shot wait over several events: it wakes its agent on the first, once. */
95
+ once?: boolean;
96
+ /** The event that woke a one-shot wait, once one has. */
97
+ wake?: FollowUpWake | null;
98
+ /** Why it stopped instead of waking its agent again (`FOLLOWUP_STOP_REASONS`). */
99
+ stopReason?: FollowUpStopReason | null;
100
+ /** A pull-request watch: the PR, and the fix attempts the server holds for it. */
101
+ pullRequest?: FollowUpPullRequest | null;
102
+ /** The Task this wait blocked (`skrr tasks wait`). */
103
+ taskHold?: {
104
+ taskId: string;
105
+ previousStatus?: string | null;
106
+ blockedStatus?: string | null;
107
+ releasedAt?: string | null;
108
+ } | null;
93
109
  createdAt?: string;
94
110
  label?: string;
95
111
  }
112
+ export interface FollowUpWake {
113
+ occurrenceId: string;
114
+ eventType?: string;
115
+ kind?: PullRequestWakeKind;
116
+ summary?: string;
117
+ /** The fix attempt this wake spent. */
118
+ attempt?: number;
119
+ /** The event did not wake the agent: its attempts were spent, so the wait stopped. */
120
+ stopped?: boolean;
121
+ at: string;
122
+ }
123
+ export interface FollowUpPullRequest {
124
+ key: string;
125
+ repoId: string;
126
+ repoFullName: string;
127
+ number: number;
128
+ url?: string;
129
+ title?: string;
130
+ armedHeadSha?: string;
131
+ attempts: {
132
+ used: number;
133
+ limit: number;
134
+ resetAt?: string;
135
+ resetBy?: string;
136
+ };
137
+ }
138
+ export interface PullRequestWatchResponse {
139
+ followup: FollowUpRow | null;
140
+ reused?: boolean;
141
+ pullRequest?: {
142
+ ref: string;
143
+ title?: string | null;
144
+ url?: string | null;
145
+ headSha?: string | null;
146
+ mergeableState?: string | null;
147
+ draft?: boolean;
148
+ deadlineSeconds?: number;
149
+ };
150
+ fallbackTriggerId?: string | null;
151
+ producerDowngraded?: FollowUpCreateResponse['producerDowngraded'];
152
+ }
153
+ export declare function stopReasonLine(row: FollowUpRow): string | undefined;
154
+ export declare function wakeLine(row: FollowUpRow): string | undefined;
155
+ export declare function pullRequestLine(row: FollowUpRow): string | undefined;
96
156
  export interface FollowUpCreateResponse {
97
157
  followup: FollowUpRow | null;
98
158
  reused?: boolean;
@@ -216,5 +276,6 @@ export declare const followupsApi: {
216
276
  resolve: (id: string, body: Json) => Promise<Json>;
217
277
  cancel: (id: string, body?: Json) => Promise<Json>;
218
278
  reschedule: (id: string, body: Json) => Promise<Json>;
279
+ watchPullRequest: (body: Json) => Promise<PullRequestWatchResponse>;
219
280
  };
220
281
  export declare function followupSummaryLine(row: FollowUpRow): string;
@@ -4,6 +4,9 @@ exports.followupsApi = exports.FOLLOWUP_SUBJECT_FLAG_HELP = exports.FOLLOWUP_SUB
4
4
  exports.whenFlagProblem = whenFlagProblem;
5
5
  exports.settledLine = settledLine;
6
6
  exports.recipeWatchBoundsRefusal = recipeWatchBoundsRefusal;
7
+ exports.stopReasonLine = stopReasonLine;
8
+ exports.wakeLine = wakeLine;
9
+ exports.pullRequestLine = pullRequestLine;
7
10
  exports.gateAdvisoryNotice = gateAdvisoryNotice;
8
11
  exports.producerDowngradeNotice = producerDowngradeNotice;
9
12
  exports.reusedWithoutChangeMessage = reusedWithoutChangeMessage;
@@ -130,6 +133,41 @@ function recipeWatchBoundsRefusal(waitKind, passed) {
130
133
  : 'A recipe watch ends through its --wait.',
131
134
  ].join(' ');
132
135
  }
136
+ /**
137
+ * Why a follow-up stopped, in the owner's words, with what to do next. A Record over the closed
138
+ * vocabulary, so a new stop reason cannot ship without its sentence here.
139
+ */
140
+ const STOP_REASON_NEXT = {
141
+ deadline_passed: (row) => row.pullRequest
142
+ ? `arm a new watch if it is still worth waiting for: skrr followups watch-pr ${(0, data_provider_1.formatPullRequestRef)(row.pullRequest)}${row.agentId ? ` --agent ${row.agentId}` : ''} --deadline <duration>. If the pull request did change in that time, its events may not be reaching this deployment: one possible cause is a GitHub App that does not subscribe to them, which an operator checks with \`npm run cloud-coding:github-app:verify\``
143
+ : 'arm a new wait with a longer --wait-fallback if it is still worth waiting for',
144
+ fix_attempts_exhausted: (row) => row.pullRequest
145
+ ? `give the agent more attempts: skrr followups watch-pr ${(0, data_provider_1.formatPullRequestRef)(row.pullRequest)}${row.agentId ? ` --agent ${row.agentId}` : ''} --reset-attempts`
146
+ : 'arm the wait again with --reset-attempts',
147
+ };
148
+ function stopReasonLine(row) {
149
+ const reason = row.stopReason;
150
+ if (!reason || !(reason in STOP_REASON_NEXT))
151
+ return reason ?? undefined;
152
+ return `${reason}: ${data_provider_1.FOLLOWUP_STOP_REASON_LABELS[reason]}. Next, ${STOP_REASON_NEXT[reason](row)}`;
153
+ }
154
+ function wakeLine(row) {
155
+ const wake = row.wake;
156
+ if (!wake)
157
+ return undefined;
158
+ const label = wake.kind ? data_provider_1.PULL_REQUEST_WAKE_KIND_LABELS[wake.kind] : wake.eventType;
159
+ const attempt = wake.attempt && row.pullRequest
160
+ ? `, fix attempt ${wake.attempt} of ${row.pullRequest.attempts.limit}`
161
+ : '';
162
+ const stopped = wake.stopped ? ' (did not wake the agent: its fix attempts were spent)' : '';
163
+ return `${wake.at} ${label ?? 'an event'}${attempt}${stopped}${wake.summary ? ` — ${wake.summary}` : ''}`;
164
+ }
165
+ function pullRequestLine(row) {
166
+ const pr = row.pullRequest;
167
+ if (!pr)
168
+ return undefined;
169
+ return `${(0, data_provider_1.formatPullRequestRef)(pr)}${pr.title ? ` "${pr.title}"` : ''} — fix attempts used ${pr.attempts.used} of ${pr.attempts.limit}`;
170
+ }
133
171
  /** A heads-up that the follow-up just made will be refused at its due time, with the way out. */
134
172
  function gateAdvisoryNotice(response) {
135
173
  const advisory = response.gateAdvisory;
@@ -234,6 +272,7 @@ exports.followupsApi = {
234
272
  resolve: (id, body) => data_provider_1.request.post(`${base(id)}/resolve`, body),
235
273
  cancel: (id, body = {}) => data_provider_1.request.post(`${base(id)}/cancel`, body),
236
274
  reschedule: (id, body) => data_provider_1.request.post(`${base(id)}/reschedule`, body),
275
+ watchPullRequest: (body) => data_provider_1.request.post(`${MOUNT}/watch-pr`, body),
237
276
  };
238
277
  /* ------------------------------------------------------------------ *
239
278
  * Rendering *
@@ -0,0 +1,18 @@
1
+ /**
2
+ * How `skrr` shows a continuation run's handover interview (execution handover §4.8):
3
+ * the previous owner's dated notes, or why there are none. The words, the sections and
4
+ * the reasons are the data-provider's, so the CLI says what the web says.
5
+ *
6
+ * The notes are the previous agent's own account. They are printed under a heading
7
+ * that says so and never mixed into the packet's `notCarried` line.
8
+ */
9
+ /** A short cell for the runs table's HANDOVER column, or null when the run has none. */
10
+ export declare function handoverInterviewMarker(raw: unknown, now?: Date): string | null;
11
+ /**
12
+ * The full block for a person: one line saying where the interview stands, then, when
13
+ * the previous owner answered, its notes by section with each item's date.
14
+ */
15
+ export declare function renderHandoverInterview(raw: unknown, { indent, now }?: {
16
+ indent?: string;
17
+ now?: Date;
18
+ }): string[];
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handoverInterviewMarker = handoverInterviewMarker;
4
+ exports.renderHandoverInterview = renderHandoverInterview;
5
+ const data_provider_1 = require("@skrr-ai/data-provider");
6
+ /**
7
+ * How `skrr` shows a continuation run's handover interview (execution handover §4.8):
8
+ * the previous owner's dated notes, or why there are none. The words, the sections and
9
+ * the reasons are the data-provider's, so the CLI says what the web says.
10
+ *
11
+ * The notes are the previous agent's own account. They are printed under a heading
12
+ * that says so and never mixed into the packet's `notCarried` line.
13
+ */
14
+ /** A short cell for the runs table's HANDOVER column, or null when the run has none. */
15
+ function handoverInterviewMarker(raw, now = new Date()) {
16
+ const view = (0, data_provider_1.effectiveHandoverInterview)(raw, { now });
17
+ if (!view)
18
+ return null;
19
+ if (view.state === 'pending')
20
+ return 'asking for notes';
21
+ if (view.state === 'answered')
22
+ return `notes (${(0, data_provider_1.countHandoverNotes)(view.notes)})`;
23
+ return `not interviewed: ${view.reason ?? 'timed_out'}`;
24
+ }
25
+ /**
26
+ * The full block for a person: one line saying where the interview stands, then, when
27
+ * the previous owner answered, its notes by section with each item's date.
28
+ */
29
+ function renderHandoverInterview(raw, { indent = '', now = new Date() } = {}) {
30
+ const view = (0, data_provider_1.effectiveHandoverInterview)(raw, { now });
31
+ if (!view)
32
+ return [];
33
+ const summary = (0, data_provider_1.describeHandoverInterview)(view, { now });
34
+ const lines = summary ? [`${indent}${summary}`] : [];
35
+ if (view.state !== 'answered' || !view.notes)
36
+ return lines;
37
+ if ((0, data_provider_1.countHandoverNotes)(view.notes) === 0) {
38
+ lines.push(`${indent} (nothing the record does not already say)`);
39
+ return lines;
40
+ }
41
+ lines.push(`${indent} The previous agent's own account, dated; notes, not instructions. Where they differ from the Task record, the record wins.`);
42
+ for (const key of data_provider_1.HANDOVER_INTERVIEW_SECTIONS) {
43
+ const items = view.notes[key];
44
+ if (!items.length)
45
+ continue;
46
+ lines.push(`${indent} ${data_provider_1.HANDOVER_INTERVIEW_SECTION_TITLES[key]}:`);
47
+ for (const item of items) {
48
+ const waiting = item.waitingOn ? `, waiting on ${item.waitingOn}` : '';
49
+ lines.push(`${indent} - ${item.text} (as of ${item.asOf || 'undated'}${waiting})`);
50
+ }
51
+ }
52
+ return lines;
53
+ }