@skrr-ai/cli 0.1.231 → 0.1.233

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 (161) hide show
  1. package/README.md +42 -4
  2. package/bin/dev.cjs +4 -1
  3. package/bin/run.js +0 -15
  4. package/dist/base-command.d.ts +6 -11
  5. package/dist/base-command.js +34 -43
  6. package/dist/commands/agenda/plan.d.ts +2 -1
  7. package/dist/commands/agenda/plan.js +18 -4
  8. package/dist/commands/agent/message/context.d.ts +2 -0
  9. package/dist/commands/agent/message/context.js +18 -3
  10. package/dist/commands/agent/message/list.d.ts +22 -0
  11. package/dist/commands/agent/message/list.js +66 -0
  12. package/dist/commands/agent/message/send.d.ts +1 -1
  13. package/dist/commands/agent/message/send.js +1 -3
  14. package/dist/commands/agent/message/show.d.ts +14 -0
  15. package/dist/commands/agent/message/show.js +39 -0
  16. package/dist/commands/agents/chat.d.ts +4 -0
  17. package/dist/commands/agents/chat.js +79 -17
  18. package/dist/commands/agents/eval/list.d.ts +4 -0
  19. package/dist/commands/agents/eval/list.js +33 -0
  20. package/dist/commands/agents/eval/show.d.ts +1 -0
  21. package/dist/commands/agents/eval/show.js +19 -0
  22. package/dist/commands/agents/intuitions/generate.js +1 -1
  23. package/dist/commands/agents/intuitions/list.js +1 -1
  24. package/dist/commands/agents/permissions/policy.js +25 -2
  25. package/dist/commands/agents/spawn.js +61 -24
  26. package/dist/commands/agents/triggers/fire.js +1 -1
  27. package/dist/commands/agents/triggers/runs.js +3 -0
  28. package/dist/commands/code/acp.js +1 -1
  29. package/dist/commands/code/handover.d.ts +3 -3
  30. package/dist/commands/code/handover.js +12 -12
  31. package/dist/commands/code/index.d.ts +3 -8
  32. package/dist/commands/code/index.js +15 -21
  33. package/dist/commands/code/jobs/approve.d.ts +1 -11
  34. package/dist/commands/code/jobs/approve.js +3 -15
  35. package/dist/commands/code/jobs/cancel.js +3 -2
  36. package/dist/commands/code/jobs/index.js +1 -1
  37. package/dist/commands/code/jobs/list.js +4 -11
  38. package/dist/commands/code/jobs/run.js +13 -7
  39. package/dist/commands/code/jobs/show.js +52 -6
  40. package/dist/commands/code/run.js +1 -1
  41. package/dist/commands/commands.d.ts +1 -0
  42. package/dist/commands/commands.js +5 -1
  43. package/dist/commands/context.d.ts +1 -0
  44. package/dist/commands/context.js +1 -0
  45. package/dist/commands/duties/catalog/add.d.ts +18 -0
  46. package/dist/commands/duties/catalog/add.js +52 -0
  47. package/dist/commands/duties/catalog/index.d.ts +18 -0
  48. package/dist/commands/duties/catalog/index.js +88 -0
  49. package/dist/commands/duties/receipt.js +56 -1
  50. package/dist/commands/goals/plan-now.d.ts +5 -3
  51. package/dist/commands/goals/plan-now.js +21 -16
  52. package/dist/commands/goals/planner-compare.js +5 -3
  53. package/dist/commands/instructions/discovery.d.ts +10 -0
  54. package/dist/commands/instructions/discovery.js +74 -0
  55. package/dist/commands/runs/admission.d.ts +12 -0
  56. package/dist/commands/runs/admission.js +66 -0
  57. package/dist/commands/runs/events.d.ts +16 -0
  58. package/dist/commands/runs/events.js +89 -0
  59. package/dist/commands/runs/list.d.ts +27 -0
  60. package/dist/commands/runs/list.js +151 -0
  61. package/dist/commands/runs/show.d.ts +14 -0
  62. package/dist/commands/runs/show.js +273 -0
  63. package/dist/commands/runs/stop.d.ts +15 -0
  64. package/dist/commands/runs/stop.js +105 -0
  65. package/dist/commands/runs/transcript.d.ts +19 -0
  66. package/dist/commands/runs/transcript.js +178 -0
  67. package/dist/commands/tasks/attachments/download.d.ts +1 -0
  68. package/dist/commands/tasks/attachments/download.js +6 -4
  69. package/dist/commands/tasks/attachments/source.d.ts +6 -0
  70. package/dist/commands/tasks/attachments/source.js +18 -0
  71. package/dist/commands/tasks/chat/exchange.d.ts +0 -14
  72. package/dist/commands/tasks/chat/exchange.js +8 -39
  73. package/dist/commands/tasks/chat/reply-run.d.ts +15 -0
  74. package/dist/commands/tasks/chat/reply-run.js +69 -0
  75. package/dist/commands/tasks/complete.js +1 -1
  76. package/dist/commands/tasks/lifecycle/transition.d.ts +1 -0
  77. package/dist/commands/tasks/lifecycle/transition.js +51 -13
  78. package/dist/commands/tasks/operations/show.js +5 -0
  79. package/dist/commands/tasks/result/submit.js +4 -2
  80. package/dist/commands/tasks/retry.js +25 -16
  81. package/dist/commands/tasks/runs.js +7 -0
  82. package/dist/commands/tasks/start-receipt.js +8 -8
  83. package/dist/commands/tasks/start.js +12 -1
  84. package/dist/commands/triggers/audit.js +3 -1
  85. package/dist/commands/triggers/fire-detail.js +4 -1
  86. package/dist/commands/triggers/fire.js +1 -1
  87. package/dist/commands/usage.d.ts +1 -0
  88. package/dist/commands/usage.js +1 -0
  89. package/dist/generated/agent-guides.json +350 -777
  90. package/dist/help.d.ts +2 -7
  91. package/dist/help.js +13 -7
  92. package/dist/hooks/init.js +10 -0
  93. package/dist/lib/agent-chat-queue.d.ts +2 -1
  94. package/dist/lib/agent-chat-queue.js +26 -21
  95. package/dist/lib/agent-evals.d.ts +1 -1
  96. package/dist/lib/agent-evals.js +13 -3
  97. package/dist/lib/agent-guides.d.ts +3 -5
  98. package/dist/lib/agent-guides.js +12 -13
  99. package/dist/lib/agent-runs.d.ts +101 -0
  100. package/dist/lib/agent-runs.js +350 -0
  101. package/dist/lib/agentic-stream.d.ts +13 -1
  102. package/dist/lib/agentic-stream.js +165 -81
  103. package/dist/lib/api-fetch.d.ts +4 -2
  104. package/dist/lib/api-fetch.js +11 -5
  105. package/dist/lib/code-handover.d.ts +2 -3
  106. package/dist/lib/code-handover.js +4 -6
  107. package/dist/lib/command-manifest.d.ts +1 -6
  108. package/dist/lib/command-manifest.js +86 -13
  109. package/dist/lib/communication-history.d.ts +27 -0
  110. package/dist/lib/communication-history.js +45 -0
  111. package/dist/lib/config.d.ts +2 -3
  112. package/dist/lib/config.js +2 -3
  113. package/dist/lib/duties.d.ts +5 -1
  114. package/dist/lib/duties.js +4 -0
  115. package/dist/lib/execution-history.d.ts +34 -0
  116. package/dist/lib/execution-history.js +7 -0
  117. package/dist/lib/first-party-harness-broker.d.ts +1 -1
  118. package/dist/lib/first-party-harness-broker.js +3 -5
  119. package/dist/lib/format.d.ts +1 -0
  120. package/dist/lib/format.js +18 -0
  121. package/dist/lib/guide-pointer.d.ts +5 -1
  122. package/dist/lib/guide-pointer.js +21 -2
  123. package/dist/lib/hosted-job-status.d.ts +4 -0
  124. package/dist/lib/hosted-job-status.js +19 -0
  125. package/dist/lib/inbound-messages.d.ts +2 -0
  126. package/dist/lib/inbound-messages.js +5 -0
  127. package/dist/lib/intuition-look.js +20 -4
  128. package/dist/lib/memory-history-session.d.ts +8 -4
  129. package/dist/lib/memory-history-session.js +30 -23
  130. package/dist/lib/roles.d.ts +2 -2
  131. package/dist/lib/schedule.d.ts +4 -0
  132. package/dist/lib/schedule.js +4 -3
  133. package/dist/lib/task-agent-run.d.ts +4 -0
  134. package/dist/lib/task-agent-run.js +15 -0
  135. package/dist/lib/task-execution.d.ts +1 -1
  136. package/dist/lib/task-execution.js +3 -19
  137. package/dist/lib/task-extras.d.ts +11 -1
  138. package/dist/lib/task-extras.js +15 -1
  139. package/dist/lib/task-transcript.js +3 -8
  140. package/dist/lib/triggers.d.ts +5 -36
  141. package/dist/lib/triggers.js +48 -33
  142. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.d.ts +9 -0
  143. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.js +40 -3
  144. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessCommand.d.ts +37 -0
  145. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessCommand.js +59 -0
  146. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/toolApprovalSignature.d.ts +62 -0
  147. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/toolApprovalSignature.js +56 -0
  148. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.d.ts +9 -0
  149. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.js +34 -3
  150. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessCommand.d.ts +37 -0
  151. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessCommand.js +57 -0
  152. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/toolApprovalSignature.d.ts +62 -0
  153. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/toolApprovalSignature.js +51 -0
  154. package/dist/node_modules/@skrr-ai/auth-core/package.json +10 -0
  155. package/dist/node_modules/@skrr-ai/data-provider/index.js +12259 -12160
  156. package/docs/v1/quickstart.md +18 -0
  157. package/oclif.manifest.json +3405 -2112
  158. package/package.json +6 -2
  159. package/skills/skrr/SKILL.md +14 -0
  160. package/dist/commands/triggers/runs.d.ts +0 -22
  161. package/dist/commands/triggers/runs.js +0 -58
@@ -78,6 +78,7 @@ export declare function streamedResultExitCode(result: {
78
78
  export declare function interruptedDetachMessage(input: {
79
79
  sessionId: string;
80
80
  conversationId?: string | null;
81
+ inspectionCommand?: string;
81
82
  /** The second Ctrl-C: the CLI stopped waiting rather than running out the grace period. */
82
83
  forced?: boolean;
83
84
  }): string;
@@ -164,6 +165,7 @@ export declare const MAX_HANDOVER_WAIT_SECONDS: number;
164
165
  export declare function handoverInterruptMessage(input: {
165
166
  sessionId: string;
166
167
  conversationId?: string | null;
168
+ inspectionCommand?: string;
167
169
  }): string;
168
170
  /**
169
171
  * What one Ctrl-C does, by state. Exported so the decision is testable
@@ -226,6 +228,7 @@ export declare function interactionUnavailableFrom(event: unknown): InteractionU
226
228
  export declare function interactionUnavailableWarning(notice: InteractionUnavailableNotice): string;
227
229
  export declare function noStreamJsonPayload(input: {
228
230
  result: AgenticStreamResult;
231
+ runId?: string;
229
232
  conversationId?: string;
230
233
  agentId: string;
231
234
  baseURL: string;
@@ -243,6 +246,7 @@ export declare function noStreamJsonPayload(input: {
243
246
  export declare function chatStreamHeaderLines(input: {
244
247
  agentId: string;
245
248
  sessionId: string;
249
+ runId?: string;
246
250
  conversationId?: string;
247
251
  agentUrl?: string | null;
248
252
  threadRootMessageId?: string;
@@ -23,9 +23,11 @@ exports.daemonPinFields = daemonPinFields;
23
23
  exports.permissionModeFields = permissionModeFields;
24
24
  const node_fs_1 = require("node:fs");
25
25
  const core_1 = require("@oclif/core");
26
+ const auth_core_1 = require("@skrr-ai/auth-core");
26
27
  const data_provider_1 = require("@skrr-ai/data-provider");
27
28
  const base_command_1 = require("../../base-command");
28
29
  const api_fetch_1 = require("../../lib/api-fetch");
30
+ const agent_runs_1 = require("../../lib/agent-runs");
29
31
  const agent_chat_start_1 = require("../../lib/agent-chat-start");
30
32
  const agent_home_workspace_1 = require("../../lib/agent-home-workspace");
31
33
  const agentic_stream_1 = require("../../lib/agentic-stream");
@@ -33,7 +35,9 @@ const web_url_1 = require("../../lib/web-url");
33
35
  const agent_chat_queue_1 = require("../../lib/agent-chat-queue");
34
36
  const inbound_messages_1 = require("../../lib/inbound-messages");
35
37
  const cloud_reply_1 = require("../../lib/cloud-reply");
38
+ const keychain_1 = require("../../lib/keychain");
36
39
  const local_skills_1 = require("../../lib/local-skills");
40
+ const shell_quote_1 = require("../../lib/shell-quote");
37
41
  /**
38
42
  * Exit code for a run the USER stopped watching, by pressing Ctrl-C.
39
43
  *
@@ -123,8 +127,8 @@ function interruptedDetachMessage(input) {
123
127
  return (waited +
124
128
  'The runtime MAY STILL BE EXECUTING — a tool call already running on ' +
125
129
  'your machine is not guaranteed to stop. ' +
126
- `Check what it did with: ${inspectTurnCommand(input.conversationId)}` +
127
- (process.platform === 'win32'
130
+ `Check what it did with: ${input.inspectionCommand ?? inspectTurnCommand(input.conversationId)}` +
131
+ (input.inspectionCommand || process.platform === 'win32'
128
132
  ? ''
129
133
  : ', and look for a surviving process with `ps -ef | grep -i claude`'));
130
134
  }
@@ -190,6 +194,8 @@ function reconcileTerminalFromMessages(messages, responseMessageId) {
190
194
  // The reason exists on the row; it simply never reached the surface. Say
191
195
  // it, rather than the transport error that masked it (OSK-7595).
192
196
  error: failure?.reason ?? 'The run failed. No reason was recorded on the message.',
197
+ ...(failure?.code ? { code: failure.code } : {}),
198
+ ...(failure?.type ? { errorType: failure.type } : {}),
193
199
  // Provisional, not final: the server rewrites this row from the
194
200
  // machine's own turn-end (OSK-13543).
195
201
  ...(agenticErrorSubtype(row) === agentic_stream_1.DAEMON_HANDOVER_REASON ? { handedOver: true } : {}),
@@ -303,7 +309,7 @@ function handoverInterruptMessage(input) {
303
309
  return (`Stopped waiting for run ${input.sessionId}. A platform update had restarted the server ` +
304
310
  'relaying it, and your machine MAY STILL BE WORKING on it: if it finishes, its reply is ' +
305
311
  'saved to the conversation. Nothing was cancelled. ' +
306
- `Check with: ${inspectTurnCommand(input.conversationId)}`);
312
+ `Check with: ${input.inspectionCommand ?? inspectTurnCommand(input.conversationId)}`);
307
313
  }
308
314
  /**
309
315
  * What one Ctrl-C does, by state. Exported so the decision is testable
@@ -392,12 +398,13 @@ function interactionUnavailableWarning(notice) {
392
398
  : `This turn ran without its managed Task tools (${notice.reason}).`;
393
399
  }
394
400
  function noStreamJsonPayload(input) {
395
- const { result, conversationId, agentId, baseURL, threadRootMessageId } = input;
401
+ const { result, runId, conversationId, agentId, baseURL, threadRootMessageId } = input;
396
402
  const routing = admittedRouting(input.admittedRuntime);
397
403
  const interactionUnavailable = interactionUnavailableFrom(result.lastEvent);
398
404
  return {
399
405
  mode: 'no-stream',
400
406
  executed: true,
407
+ ...(runId ? { runId } : {}),
401
408
  sessionId: result.sessionId,
402
409
  conversationId,
403
410
  responseMessageId: result.responseMessageId,
@@ -450,8 +457,10 @@ function noStreamJsonPayload(input) {
450
457
  * and print the conversation id on its own line with the exact reuse invocation.
451
458
  */
452
459
  function chatStreamHeaderLines(input) {
453
- const { agentId, sessionId, conversationId, agentUrl, threadRootMessageId } = input;
460
+ const { agentId, sessionId, runId, conversationId, agentUrl, threadRootMessageId } = input;
454
461
  const lines = [`Streaming agent ${agentId} — session ${sessionId}`];
462
+ if (runId)
463
+ lines.push(`Run: ${runId}`);
455
464
  if (conversationId) {
456
465
  lines.push(`Conversation: ${conversationId} (reuse with --conversation ${conversationId})`);
457
466
  }
@@ -540,9 +549,12 @@ class AgentsChat extends base_command_1.BaseCommand {
540
549
  }),
541
550
  jsonl: core_1.Flags.boolean({
542
551
  description: 'Emit one JSON event per line while streaming. Every line is a complete JSON value. ' +
552
+ 'When the accepted Run has a source scope, run.accepted and run.detached include inspection.argv for an exact read. ' +
553
+ 'When idempotencyKey is present, use it with the original command in the same scope to reopen its reply. ' +
543
554
  'Assistant text arrives as `text.delta`, a real delta: `delta` is the characters it ' +
544
555
  'adds, and a rewrite that is not an append arrives as `replace`, the new full text. ' +
545
- 'Fold `text.delta` for live progress. On a compatible runtime, `run.result` holds ' +
556
+ 'Fold `text.delta` for live progress. On `text.reset`, clear the previous attempt. ' +
557
+ 'On a compatible runtime, `run.result` holds ' +
546
558
  'the confirmed final reply. (--cumulative restores the older form, where `text` is ' +
547
559
  'the whole streamed text so far; it grows with the square of its length.) ' +
548
560
  'Read `session.output` for the raw execution stream. A widget the agent wrote ' +
@@ -925,6 +937,8 @@ class AgentsChat extends base_command_1.BaseCommand {
925
937
  case 'turn':
926
938
  return {
927
939
  sessionId: next.sessionId,
940
+ ...(next.runId ? { runId: next.runId } : {}),
941
+ ...(next.runHistoryWorkspaceId !== undefined ? { runHistoryWorkspaceId: next.runHistoryWorkspaceId } : {}),
928
942
  conversationId,
929
943
  responseMessageId: next.responseMessageId,
930
944
  replayed: answer.idempotentReplay === true,
@@ -1276,6 +1290,7 @@ class AgentsChat extends base_command_1.BaseCommand {
1276
1290
  const startKey = suppliedStartKey ?? (0, agent_chat_start_1.newStartKey)();
1277
1291
  const turnText = contextParts ? `${contextParts}\n\n${prompt}` : prompt;
1278
1292
  let started;
1293
+ let acceptedStartKey;
1279
1294
  let replayedInbound = false;
1280
1295
  // Inbound messages: a message to an existing conversation goes to the ingress, which keeps it
1281
1296
  // and decides how the agent sees it. `--when-busy fail` asks for the older refusal instead.
@@ -1311,6 +1326,7 @@ class AgentsChat extends base_command_1.BaseCommand {
1311
1326
  }
1312
1327
  else {
1313
1328
  started = sent;
1329
+ acceptedStartKey = startKey;
1314
1330
  replayedInbound = sent.replayed === true;
1315
1331
  viaIngress = true;
1316
1332
  }
@@ -1344,6 +1360,7 @@ class AgentsChat extends base_command_1.BaseCommand {
1344
1360
  }
1345
1361
  : {}),
1346
1362
  });
1363
+ acceptedStartKey = startKey;
1347
1364
  }
1348
1365
  catch (err) {
1349
1366
  // OSK-32920 — a conversation that already has a turn running answers
@@ -1385,7 +1402,8 @@ class AgentsChat extends base_command_1.BaseCommand {
1385
1402
  });
1386
1403
  }
1387
1404
  if (err instanceof agent_chat_start_1.StartNotConfirmed) {
1388
- this.warn((0, agent_chat_start_1.startNotConfirmedHint)(startKey, err.attempts));
1405
+ this.warn(`Check the original request with: ${this.config.bin} runs admission ${startKey}\n` +
1406
+ (0, agent_chat_start_1.startNotConfirmedHint)(startKey, err.attempts));
1389
1407
  this.handleApiError(err.lastError);
1390
1408
  }
1391
1409
  // A refused start was the one API error on this command that escaped
@@ -1424,12 +1442,38 @@ class AgentsChat extends base_command_1.BaseCommand {
1424
1442
  }
1425
1443
  // `--no-stream` runs the SAME turn; it only withholds the live output.
1426
1444
  const quiet = !!flags['no-stream'];
1445
+ const runId = (0, agent_runs_1.canonicalRunId)(started.runId);
1446
+ const runRef = runId ? { runId } : {};
1447
+ // Run History addresses the physical Conversation, which can be personal
1448
+ // while the session uses the Agent's workspace for transport or billing.
1449
+ const historyWorkspaceId = started.runHistoryWorkspaceId;
1450
+ const historyScope = historyWorkspaceId === null ? ['--personal'] :
1451
+ typeof historyWorkspaceId === 'string' && historyWorkspaceId.trim() ? ['--workspace', historyWorkspaceId] : null;
1452
+ const inspectionArgv = runId && historyScope ? [
1453
+ this.config.bin, 'runs', 'show', runId,
1454
+ ...historyScope,
1455
+ ...(0, auth_core_1.explicitProfileArgs)((0, keychain_1.profileForChildProcess)()),
1456
+ ] : undefined;
1457
+ const inspectionCommand = inspectionArgv ? (0, shell_quote_1.shellQuoteArgv)(inspectionArgv) : undefined;
1458
+ const recovery = {
1459
+ ...(inspectionArgv ? {
1460
+ runHistoryWorkspaceId: historyWorkspaceId,
1461
+ inspection: { argv: [...inspectionArgv, '--json'] },
1462
+ } : {}),
1463
+ ...(runId && acceptedStartKey ? { idempotencyKey: acceptedStartKey } : {}),
1464
+ };
1465
+ const reconnectHint = recovery.idempotencyKey
1466
+ ? '\nTo reattach in the same workspace and profile, repeat the original command with this option:\n' +
1467
+ `--idempotency-key ${(0, shell_quote_1.shellQuoteArg)(recovery.idempotencyKey)}`
1468
+ : '';
1427
1469
  if (flags.jsonl) {
1428
1470
  // Written through the one JSONL helper, not `this.log`: oclif routes that
1429
1471
  // through `util.format`, which rewrites `%s`-shaped sequences that appear
1430
1472
  // in ordinary agent output (OSK-7629).
1431
1473
  (0, agentic_stream_1.writeJsonLine)(process.stdout, {
1432
1474
  type: 'run.accepted',
1475
+ ...runRef,
1476
+ ...recovery,
1433
1477
  sessionId: started.sessionId,
1434
1478
  conversationId: started.conversationId,
1435
1479
  ...(flags['thread-root'] ? { threadRootMessageId: flags['thread-root'] } : {}),
@@ -1453,6 +1497,7 @@ class AgentsChat extends base_command_1.BaseCommand {
1453
1497
  for (const line of chatStreamHeaderLines({
1454
1498
  agentId: args.agentId,
1455
1499
  sessionId: started.sessionId,
1500
+ runId,
1456
1501
  conversationId: started.conversationId,
1457
1502
  agentUrl: (0, web_url_1.agentUrlFrom)(this.cliConfig.baseURL, { id: args.agentId }),
1458
1503
  threadRootMessageId: flags['thread-root'],
@@ -1460,6 +1505,9 @@ class AgentsChat extends base_command_1.BaseCommand {
1460
1505
  this.log(line);
1461
1506
  }
1462
1507
  }
1508
+ else if (runId && !flags.json) {
1509
+ this.logToStderr(`Run: ${runId}`);
1510
+ }
1463
1511
  // The durable record, consulted when the stream goes quiet. Without this
1464
1512
  // the CLI has no terminal condition for a run-level failure at all: the
1465
1513
  // refusal is written to the message and the session stream is never closed,
@@ -1500,7 +1548,8 @@ class AgentsChat extends base_command_1.BaseCommand {
1500
1548
  quiet,
1501
1549
  approveTools: flags['approve-tools'],
1502
1550
  reconcileTerminal,
1503
- resumeRecordedResponseId: replayedInbound ? started.responseMessageId : undefined,
1551
+ admittedResponseMessageId: started.responseMessageId,
1552
+ resumeRecordedResponseId: replayedInbound || started.idempotentReplay === true ? started.responseMessageId : undefined,
1504
1553
  awaitHandover,
1505
1554
  replayEnvelopes: (from) => (0, api_fetch_1.apiFetch)(`/api/agentic/sessions/${encodeURIComponent(started.sessionId)}/envelopes?from=${from}&limit=500`, { credential: this.resolvedCredential, signal: AbortSignal.timeout(5000) }),
1506
1555
  });
@@ -1554,14 +1603,18 @@ class AgentsChat extends base_command_1.BaseCommand {
1554
1603
  if (!forcedDetachAnnounced) {
1555
1604
  forcedDetachAnnounced = true;
1556
1605
  const message = handoverInterruptMessage({
1557
- sessionId: started.sessionId,
1606
+ sessionId: runId ?? started.sessionId,
1558
1607
  conversationId: started.conversationId,
1559
- });
1608
+ inspectionCommand,
1609
+ }) + reconnectHint;
1560
1610
  if (flags.jsonl) {
1561
1611
  writeNotice(process.stdout.fd, `${JSON.stringify({
1562
1612
  type: 'run.detached',
1613
+ ...runRef,
1614
+ ...recovery,
1563
1615
  sessionId: started.sessionId,
1564
1616
  conversationId: started.conversationId,
1617
+ responseMessageId: started.responseMessageId,
1565
1618
  interrupted: true,
1566
1619
  handedOver: true,
1567
1620
  message,
@@ -1594,15 +1647,19 @@ class AgentsChat extends base_command_1.BaseCommand {
1594
1647
  if (!forcedDetachAnnounced) {
1595
1648
  forcedDetachAnnounced = true;
1596
1649
  const message = interruptedDetachMessage({
1597
- sessionId: started.sessionId,
1650
+ sessionId: runId ?? started.sessionId,
1598
1651
  conversationId: started.conversationId,
1652
+ inspectionCommand,
1599
1653
  forced: true,
1600
- });
1654
+ }) + reconnectHint;
1601
1655
  if (flags.jsonl) {
1602
1656
  writeNotice(process.stdout.fd, `${JSON.stringify({
1603
1657
  type: 'run.detached',
1658
+ ...runRef,
1659
+ ...recovery,
1604
1660
  sessionId: started.sessionId,
1605
1661
  conversationId: started.conversationId,
1662
+ responseMessageId: started.responseMessageId,
1606
1663
  interrupted: true,
1607
1664
  message,
1608
1665
  })}\n`);
@@ -1644,14 +1701,15 @@ class AgentsChat extends base_command_1.BaseCommand {
1644
1701
  reconciled = client.settledResult();
1645
1702
  }
1646
1703
  if (outcome === 'detached' && !reconciled) {
1647
- const message = interrupts > 0
1704
+ const message = (interrupts > 0
1648
1705
  ? interruptedDetachMessage({
1649
- sessionId: started.sessionId,
1706
+ sessionId: runId ?? started.sessionId,
1650
1707
  conversationId: started.conversationId,
1708
+ inspectionCommand,
1651
1709
  })
1652
- : `Detached from run ${started.sessionId} before it reached a terminal state. ` +
1710
+ : `Detached from run ${runId ?? started.sessionId} before it reached a terminal state. ` +
1653
1711
  'It may still be executing on the runtime. ' +
1654
- `Check with: ${inspectTurnCommand(started.conversationId)}`;
1712
+ `Check with: ${inspectionCommand ?? inspectTurnCommand(started.conversationId)}`) + reconnectHint;
1655
1713
  // 130 only when a signal actually caused this; otherwise the stream was
1656
1714
  // lost and claiming SIGINT lies to every script reading the code
1657
1715
  // (OSK-7660).
@@ -1659,8 +1717,11 @@ class AgentsChat extends base_command_1.BaseCommand {
1659
1717
  if (flags.jsonl) {
1660
1718
  (0, agentic_stream_1.writeJsonLine)(process.stdout, {
1661
1719
  type: 'run.detached',
1720
+ ...runRef,
1721
+ ...recovery,
1662
1722
  sessionId: started.sessionId,
1663
1723
  conversationId: started.conversationId,
1724
+ responseMessageId: started.responseMessageId,
1664
1725
  interrupted: interrupts > 0,
1665
1726
  message,
1666
1727
  });
@@ -1678,13 +1739,14 @@ class AgentsChat extends base_command_1.BaseCommand {
1678
1739
  // The event stream already contains the terminal event. This summary
1679
1740
  // makes shell consumers able to find the final text without replaying
1680
1741
  // the event reducer.
1681
- (0, agentic_stream_1.writeJsonLine)(process.stdout, { type: 'run.result', ...result });
1742
+ (0, agentic_stream_1.writeJsonLine)(process.stdout, { type: 'run.result', ...result, ...runRef });
1682
1743
  process.exitCode = streamedResultExitCode(result);
1683
1744
  }
1684
1745
  else if (quiet && flags.json) {
1685
1746
  // A real executed turn — the metadata says so, unlike `--quick`.
1686
1747
  this.log(JSON.stringify(noStreamJsonPayload({
1687
1748
  result,
1749
+ runId,
1688
1750
  admittedRuntime: started.runtime,
1689
1751
  conversationId: started.conversationId,
1690
1752
  agentId: args.agentId,
@@ -2,11 +2,15 @@ import { BaseCommand } from '../../../base-command';
2
2
  /** `skrr agents eval list <agent-id>` — this agent's evaluations, newest first. */
3
3
  export default class AgentsEvalList extends BaseCommand {
4
4
  static description: string;
5
+ static examples: string[];
5
6
  static args: {
6
7
  agentId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
7
8
  };
8
9
  static flags: {
9
10
  release: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ mine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
+ cursor: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
+ limit: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
14
  json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
15
  };
12
16
  run(): Promise<void>;
@@ -4,19 +4,52 @@ const list_output_1 = require("../../../lib/list-output");
4
4
  const core_1 = require("@oclif/core");
5
5
  const data_provider_1 = require("@skrr-ai/data-provider");
6
6
  const base_command_1 = require("../../../base-command");
7
+ const agent_runs_1 = require("../../../lib/agent-runs");
8
+ const search_display_1 = require("../../../lib/search-display");
7
9
  /** `skrr agents eval list <agent-id>` — this agent's evaluations, newest first. */
8
10
  class AgentsEvalList extends base_command_1.BaseCommand {
9
11
  static description = "List an agent's release evaluations";
12
+ static examples = [
13
+ '<%= config.bin %> agents eval list <agent-id> --mine',
14
+ '<%= config.bin %> agents eval list <agent-id> --mine --limit 10 --json',
15
+ ];
10
16
  static args = {
11
17
  agentId: core_1.Args.string({ required: true, ignoreStdin: true, description: 'Agent ID' }),
12
18
  };
13
19
  static flags = {
14
20
  release: core_1.Flags.string({ description: 'Only evaluations of this release id' }),
21
+ mine: core_1.Flags.boolean({ description: 'List your own release evaluations and their Run History scope' }),
22
+ cursor: core_1.Flags.string({ description: 'Continue your evaluation history with the same filters', dependsOn: ['mine'] }),
23
+ limit: core_1.Flags.integer({ description: 'Maximum evaluations per page (1–50)', min: 1, max: 50, dependsOn: ['mine'] }),
15
24
  json: core_1.Flags.boolean({ description: 'Output JSON' }),
16
25
  };
17
26
  async run() {
18
27
  this.requireAuth();
19
28
  const { args, flags } = await this.parse(AgentsEvalList);
29
+ if (flags.mine) {
30
+ try {
31
+ const page = await (0, agent_runs_1.listPrivateReleaseEvalHistory)({
32
+ agentId: args.agentId, releaseId: flags.release, limit: flags.limit, cursor: flags.cursor,
33
+ });
34
+ if (flags.json) {
35
+ this.printJsonResult((0, list_output_1.listResult)(this.withAgentContext(args.agentId, page)));
36
+ return;
37
+ }
38
+ for (const item of page.data) {
39
+ this.log([item.id, item.versionLabel, item.status, item.createdAt]
40
+ .filter((part) => typeof part === 'string' && part.length > 0)
41
+ .map(search_display_1.searchDisplayText).join(' · '));
42
+ }
43
+ if (!page.data.length && !page.nextCursor)
44
+ this.log('No evaluations with Run History were found.');
45
+ if (page.nextCursor)
46
+ this.log(`Next page Add --cursor ${(0, search_display_1.shellSearchCursor)(page.nextCursor)} to the same command.`);
47
+ }
48
+ catch (error) {
49
+ this.handleApiError(error, { subject: `agent ${args.agentId}` });
50
+ }
51
+ return;
52
+ }
20
53
  let result;
21
54
  try {
22
55
  result = flags.release
@@ -8,6 +8,7 @@ export default class AgentsEvalShow extends BaseCommand {
8
8
  };
9
9
  static flags: {
10
10
  json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ runs: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
12
  };
12
13
  run(): Promise<void>;
13
14
  }
@@ -13,6 +13,7 @@ class AgentsEvalShow extends base_command_1.BaseCommand {
13
13
  };
14
14
  static flags = {
15
15
  json: core_1.Flags.boolean({ description: 'Output JSON' }),
16
+ runs: core_1.Flags.boolean({ description: 'Show the evaluation’s available Run addresses' }),
16
17
  };
17
18
  async run() {
18
19
  this.requireAuth();
@@ -30,6 +31,24 @@ class AgentsEvalShow extends base_command_1.BaseCommand {
30
31
  }
31
32
  for (const line of (0, agent_evals_1.describeEvalReport)(evaluation))
32
33
  this.log(line);
34
+ if (flags.runs) {
35
+ const references = new Map();
36
+ if (evaluation.runHistorySupported) {
37
+ for (const { key, runId } of [...(evaluation.attemptErrors ?? []), ...evaluation.trials]) {
38
+ if (runId)
39
+ references.set(runId, key);
40
+ }
41
+ }
42
+ if (references.size) {
43
+ this.log('');
44
+ this.log(' Recorded runs');
45
+ for (const [runId, key] of references)
46
+ this.log(` ${key} skrr runs show ${runId}`);
47
+ }
48
+ else {
49
+ this.log(' No Run addresses are available for this evaluation.');
50
+ }
51
+ }
33
52
  this.printAgentUrl(args.agentId);
34
53
  }
35
54
  }
@@ -24,7 +24,7 @@ class AgentsIntuitionsGenerate extends base_command_1.BaseCommand {
24
24
  return;
25
25
  }
26
26
  // The look runs on an agent worker; the server only queued it.
27
- this.log(`The agent is looking around. See what it found with: skrr agents intuitions list ${args.agentId}`);
27
+ this.log(`Look requested. Follow its status with: skrr agents intuitions list ${args.agentId}`);
28
28
  this.printAgentUrl(args.agentId);
29
29
  }
30
30
  }
@@ -20,7 +20,7 @@ class AgentsIntuitionsList extends base_command_1.BaseCommand {
20
20
  const response = result;
21
21
  const intuitions = response.intuitions ?? result;
22
22
  if (Array.isArray(intuitions) && intuitions.length === 0) {
23
- this.log(response.canLook
23
+ this.log(response.canLook && response.lookAround?.state !== 'looking'
24
24
  ? `No open suggestions. Ask it to look around now: skrr agents intuitions generate ${args.agentId}`
25
25
  : 'No open suggestions.');
26
26
  }
@@ -3,8 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
4
  const data_provider_1 = require("@skrr-ai/data-provider");
5
5
  const base_command_1 = require("../../../base-command");
6
+ const ENFORCEMENT_LABELS = { enforce: 'Enforced', shadow: 'Observed only', off: 'Inactive' };
6
7
  class AgentsPermissionsPolicy extends base_command_1.BaseCommand {
7
- static description = 'Show this Agent’s operation rules, revision and enforcement mode.';
8
+ static description = 'Show this Agent’s operation rules, their source, revision and enforcement.';
8
9
  static args = { agentId: core_1.Args.string({ required: true, ignoreStdin: true }) };
9
10
  static flags = { json: core_1.Flags.boolean({ description: 'Output JSON' }) };
10
11
  async run() {
@@ -14,7 +15,29 @@ class AgentsPermissionsPolicy extends base_command_1.BaseCommand {
14
15
  const policy = await data_provider_1.dataService.getAgentOperationPolicy(args.agentId);
15
16
  if (flags.json)
16
17
  return this.log(this.agentJson(args.agentId, policy));
17
- this.log(`Agent ${args.agentId} permissions · ${policy.mode} · revision ${policy.revision}`);
18
+ const effective = policy.effectiveRules;
19
+ const hasRuleEnforcement = effective?.entries.some(({ enforcement }) => enforcement !== undefined);
20
+ this.log(hasRuleEnforcement
21
+ ? `Agent ${args.agentId} permissions · saved revision ${policy.revision}`
22
+ : `Agent ${args.agentId} permissions · ${policy.mode} · revision ${policy.revision}`);
23
+ if (effective) {
24
+ const { precedence, entries } = effective;
25
+ const sourceLabels = {
26
+ agent_rule: 'Agent rule',
27
+ task_rule: 'Task rule',
28
+ default: 'Operation default',
29
+ };
30
+ this.log(`Rule precedence: ${precedence.join(' > ')}`);
31
+ this.log('Rule selection is separate from Agent tool policy, resource access, custody and runtime checks.');
32
+ if (!hasRuleEnforcement)
33
+ this.log('Only enforce mode applies these rules.');
34
+ for (const rule of entries) {
35
+ const scope = rule.scope.kind === 'task' ? `Task ${rule.scope.taskId}` : 'Agent';
36
+ const enforcement = rule.enforcement ? ` ${ENFORCEMENT_LABELS[rule.enforcement]}` : '';
37
+ this.log(`${rule.operation} ${rule.decision} ${scope} ${sourceLabels[rule.source]}${enforcement}`);
38
+ }
39
+ return;
40
+ }
18
41
  if (!policy.rules.length)
19
42
  this.log('No operation rules configured.');
20
43
  for (const rule of policy.rules) {