@skrr-ai/cli 0.1.232 → 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 (118) hide show
  1. package/README.md +29 -13
  2. package/bin/dev.cjs +0 -1
  3. package/bin/run.js +0 -15
  4. package/dist/base-command.d.ts +6 -1
  5. package/dist/base-command.js +24 -4
  6. package/dist/commands/agenda/plan.d.ts +2 -1
  7. package/dist/commands/agenda/plan.js +18 -4
  8. package/dist/commands/agents/chat.d.ts +2 -0
  9. package/dist/commands/agents/chat.js +59 -13
  10. package/dist/commands/agents/eval/list.d.ts +4 -0
  11. package/dist/commands/agents/eval/list.js +33 -0
  12. package/dist/commands/agents/permissions/policy.js +25 -2
  13. package/dist/commands/agents/spawn.js +61 -24
  14. package/dist/commands/agents/triggers/fire.js +1 -1
  15. package/dist/commands/agents/triggers/runs.js +3 -0
  16. package/dist/commands/code/jobs/approve.d.ts +1 -11
  17. package/dist/commands/code/jobs/approve.js +3 -15
  18. package/dist/commands/code/jobs/cancel.js +3 -2
  19. package/dist/commands/code/jobs/index.js +1 -1
  20. package/dist/commands/code/jobs/list.js +4 -11
  21. package/dist/commands/code/jobs/run.js +13 -7
  22. package/dist/commands/code/jobs/show.js +51 -6
  23. package/dist/commands/commands.d.ts +1 -0
  24. package/dist/commands/commands.js +5 -1
  25. package/dist/commands/context.d.ts +1 -0
  26. package/dist/commands/context.js +1 -0
  27. package/dist/commands/duties/catalog/add.d.ts +18 -0
  28. package/dist/commands/duties/catalog/add.js +52 -0
  29. package/dist/commands/duties/catalog/index.d.ts +18 -0
  30. package/dist/commands/duties/catalog/index.js +88 -0
  31. package/dist/commands/duties/receipt.js +56 -1
  32. package/dist/commands/goals/planner-compare.js +5 -3
  33. package/dist/commands/instructions/discovery.d.ts +10 -0
  34. package/dist/commands/instructions/discovery.js +74 -0
  35. package/dist/commands/runs/admission.d.ts +12 -0
  36. package/dist/commands/runs/admission.js +66 -0
  37. package/dist/commands/runs/events.d.ts +2 -0
  38. package/dist/commands/runs/events.js +40 -10
  39. package/dist/commands/runs/list.d.ts +7 -1
  40. package/dist/commands/runs/list.js +81 -17
  41. package/dist/commands/runs/show.d.ts +1 -0
  42. package/dist/commands/runs/show.js +225 -15
  43. package/dist/commands/runs/stop.d.ts +1 -0
  44. package/dist/commands/runs/stop.js +34 -7
  45. package/dist/commands/runs/transcript.d.ts +2 -0
  46. package/dist/commands/runs/transcript.js +102 -17
  47. package/dist/commands/tasks/attachments/download.d.ts +1 -0
  48. package/dist/commands/tasks/attachments/download.js +6 -4
  49. package/dist/commands/tasks/attachments/source.d.ts +6 -0
  50. package/dist/commands/tasks/attachments/source.js +18 -0
  51. package/dist/commands/tasks/chat/exchange.d.ts +0 -14
  52. package/dist/commands/tasks/chat/exchange.js +8 -39
  53. package/dist/commands/tasks/chat/reply-run.d.ts +15 -0
  54. package/dist/commands/tasks/chat/reply-run.js +69 -0
  55. package/dist/commands/tasks/complete.js +1 -1
  56. package/dist/commands/tasks/lifecycle/transition.d.ts +1 -0
  57. package/dist/commands/tasks/lifecycle/transition.js +51 -13
  58. package/dist/commands/tasks/operations/show.js +5 -0
  59. package/dist/commands/tasks/result/submit.js +4 -2
  60. package/dist/commands/tasks/retry.js +25 -16
  61. package/dist/commands/triggers/audit.js +3 -1
  62. package/dist/commands/triggers/fire-detail.js +4 -1
  63. package/dist/commands/triggers/fire.js +1 -1
  64. package/dist/commands/usage.d.ts +1 -0
  65. package/dist/commands/usage.js +1 -0
  66. package/dist/generated/agent-guides.json +64 -712
  67. package/dist/help.d.ts +2 -7
  68. package/dist/help.js +13 -7
  69. package/dist/hooks/init.js +10 -0
  70. package/dist/lib/agent-evals.d.ts +1 -1
  71. package/dist/lib/agent-evals.js +13 -3
  72. package/dist/lib/agent-guides.d.ts +3 -5
  73. package/dist/lib/agent-guides.js +12 -13
  74. package/dist/lib/agent-runs.d.ts +69 -9
  75. package/dist/lib/agent-runs.js +208 -35
  76. package/dist/lib/agentic-stream.d.ts +12 -0
  77. package/dist/lib/agentic-stream.js +163 -79
  78. package/dist/lib/api-fetch.d.ts +2 -0
  79. package/dist/lib/api-fetch.js +6 -1
  80. package/dist/lib/command-manifest.d.ts +1 -6
  81. package/dist/lib/command-manifest.js +86 -13
  82. package/dist/lib/config.d.ts +2 -3
  83. package/dist/lib/config.js +2 -3
  84. package/dist/lib/duties.d.ts +5 -1
  85. package/dist/lib/duties.js +4 -0
  86. package/dist/lib/execution-history.d.ts +3 -0
  87. package/dist/lib/format.d.ts +1 -0
  88. package/dist/lib/format.js +18 -0
  89. package/dist/lib/guide-pointer.d.ts +5 -1
  90. package/dist/lib/guide-pointer.js +21 -2
  91. package/dist/lib/hosted-job-status.d.ts +4 -0
  92. package/dist/lib/hosted-job-status.js +19 -0
  93. package/dist/lib/inbound-messages.d.ts +1 -0
  94. package/dist/lib/inbound-messages.js +2 -0
  95. package/dist/lib/roles.d.ts +2 -2
  96. package/dist/lib/schedule.d.ts +4 -0
  97. package/dist/lib/schedule.js +4 -3
  98. package/dist/lib/task-execution.d.ts +1 -1
  99. package/dist/lib/task-execution.js +3 -19
  100. package/dist/lib/task-extras.d.ts +11 -1
  101. package/dist/lib/task-extras.js +15 -1
  102. package/dist/lib/task-transcript.js +3 -8
  103. package/dist/lib/triggers.d.ts +5 -36
  104. package/dist/lib/triggers.js +48 -33
  105. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.js +5 -1
  106. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessCommand.d.ts +37 -0
  107. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessCommand.js +59 -0
  108. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.js +5 -1
  109. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessCommand.d.ts +37 -0
  110. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessCommand.js +57 -0
  111. package/dist/node_modules/@skrr-ai/auth-core/package.json +10 -0
  112. package/dist/node_modules/@skrr-ai/data-provider/index.js +12261 -12172
  113. package/docs/v1/quickstart.md +18 -0
  114. package/oclif.manifest.json +2505 -629
  115. package/package.json +3 -2
  116. package/skills/skrr/SKILL.md +14 -0
  117. package/dist/commands/triggers/runs.d.ts +0 -22
  118. package/dist/commands/triggers/runs.js +0 -58
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const auth_core_1 = require("@skrr-ai/auth-core");
3
4
  const core_1 = require("@oclif/core");
4
5
  const data_provider_1 = require("@skrr-ai/data-provider");
5
6
  const base_command_1 = require("../../base-command");
@@ -8,58 +9,108 @@ const communication_history_1 = require("../../lib/communication-history");
8
9
  const execution_history_1 = require("../../lib/execution-history");
9
10
  const format_1 = require("../../lib/format");
10
11
  const http_error_1 = require("../../lib/http-error");
12
+ const keychain_1 = require("../../lib/keychain");
11
13
  const search_display_1 = require("../../lib/search-display");
14
+ const shell_quote_1 = require("../../lib/shell-quote");
12
15
  class RunsList extends base_command_1.BaseCommand {
13
16
  static autonomousCredentialPolicy = 'bound-session';
14
- static description = 'List Agent Runs you can discover in Run History';
17
+ static description = 'List Agent Runs you can discover in Run History.\n\n' +
18
+ 'When signed in, select an Agent, a Goal, a Chat or native conversation you own, or Hosted Jobs. ' +
19
+ 'Use --from and --to for an absolute date range.\n\n' +
20
+ 'In a bound Agent session, the session supplies the scope and supports relative ranges with --since.';
15
21
  static examples = [
16
22
  '<%= config.bin %> runs list --agent <agent-id>',
17
23
  '<%= config.bin %> runs list --agent <agent-id> --source duty --json',
18
- '<%= config.bin %> runs list --agent <agent-id> --status failed',
24
+ '<%= config.bin %> runs list --agent <agent-id> --from 2026-12-01T00:00:00Z --status failed',
25
+ '<%= config.bin %> runs list --goal <goal-id>',
26
+ {
27
+ description: 'List Runs from a Chat you own.',
28
+ command: '<%= config.bin %> runs list --source chat --conversation <conversation-id>',
29
+ },
19
30
  '<%= config.bin %> runs list --source native --conversation <conversation-id>',
20
31
  '<%= config.bin %> runs list --source hosted_job',
21
- '<%= config.bin %> runs list --since 7d --status failed --json',
32
+ '<%= config.bin %> runs list --agent <agent-id> --source store_trial',
33
+ '<%= config.bin %> runs list --agent <agent-id> --source release_evaluation --evaluation <evaluation-id>',
34
+ {
35
+ description: 'Find recent failures from inside a bound Agent session.',
36
+ command: '<%= config.bin %> runs list --since 7d --status failed --json',
37
+ },
22
38
  ];
23
39
  static flags = {
24
40
  agent: core_1.Flags.string({ description: 'Agent ID for an Agent-scoped list', exclusive: ['conversation'] }),
41
+ goal: core_1.Flags.string({ description: 'Goal ID for Goal Planner Run History' }),
25
42
  conversation: core_1.Flags.string({ description: 'Conversation ID for source chat or native' }),
26
43
  source: core_1.Flags.string({ description: 'Limit the list to one Run History source' }),
27
- status: core_1.Flags.string({ description: 'Limit the list to one Run History status', options: data_provider_1.AGENT_RUN_HISTORY_STATUSES }),
44
+ evaluation: core_1.Flags.string({ description: 'Evaluation ID for source release_evaluation' }),
45
+ status: core_1.Flags.string({ description: 'Filter by the status shown in the list', options: data_provider_1.AGENT_RUN_HISTORY_STATUSES }),
28
46
  ...communication_history_1.historyTimeFlags,
29
47
  task: core_1.Flags.string({ description: 'Exact Task reference for a bound Agent session' }),
30
48
  cursor: core_1.Flags.string({ description: 'Continue with the cursor from the previous page and the same filters' }),
31
49
  limit: core_1.Flags.integer({ description: 'Maximum runs per page (1–50 for people, 1–8 for Agent sessions, default 3 for sessions)', min: 1, max: 50 }),
32
- json: core_1.Flags.boolean({ description: 'Output as JSON' }),
50
+ json: core_1.Flags.boolean({ description: 'Output the page and any continuation argv as JSON' }),
51
+ personal: core_1.Flags.boolean({
52
+ description: 'List only in personal scope, ignoring the saved workspace.',
53
+ exclusive: ['workspace'],
54
+ }),
33
55
  };
34
56
  async run() {
35
57
  const { flags } = await this.parse(RunsList);
36
58
  const session = (0, communication_history_1.resolveHistorySession)(() => this.requireAuth());
37
- const { agent, conversation, source, from, to, status, cursor, limit, since, timezone, task } = flags;
59
+ const { agent, conversation, goal, evaluation, from, to, status, cursor, limit, since, timezone, task, personal } = flags;
60
+ const goalScope = goal !== undefined;
61
+ const source = flags.source ?? (goalScope ? 'goal_planner' : undefined);
38
62
  const conversationScope = source === 'native' || (source === 'chat' && conversation);
39
- const validScope = conversationScope ? conversation && !agent :
40
- source === 'hosted_job' ? !conversation && !agent : agent && !conversation;
41
- if ((session && (agent || conversation)) || (!session && (!validScope || since || timezone || task))) {
63
+ const validScope = goalScope ? Boolean(goal) && source === 'goal_planner' && !agent && !conversation :
64
+ conversationScope ? conversation && !agent :
65
+ source === 'hosted_job' ? !conversation && !agent : agent && !conversation;
66
+ const privateSource = source === 'store_trial' || source === 'release_evaluation';
67
+ const validEvaluation = source === 'release_evaluation' ? Boolean(evaluation) : evaluation === undefined;
68
+ if ((session && (agent || conversation || goalScope || evaluation || privateSource || personal)) ||
69
+ (!session && (!validScope || !validEvaluation || since || timezone || task))) {
42
70
  this.failWithCliError({
43
71
  code: 'INVALID_RUN_HISTORY_SCOPE',
44
- message: session ? 'The session selects the Agent and conversation automatically.' :
45
- 'Use --agent for Agent history, --conversation with --source chat or native, or --source hosted_job for Hosted Jobs. --since, --timezone, and --task require an Agent session.',
72
+ message: session && personal
73
+ ? 'A bound Agent session uses its own workspace scope.'
74
+ : session
75
+ ? 'The session selects the Agent and conversation automatically. Goal and private product history require a signed-in person.'
76
+ : 'Use --agent for Agent history, --goal for Goal Planner history, --conversation with --source chat or native, or --source hosted_job for Hosted Jobs. Use --evaluation with --agent and --source release_evaluation. --since, --timezone, and --task require an Agent session.',
46
77
  exit: 1,
47
78
  retryable: false,
48
79
  });
49
80
  }
81
+ const listArgv = (workspaceId, pageCursor) => [
82
+ this.config.bin, 'runs', 'list',
83
+ ...Object.entries({ agent, conversation, goal, source: flags.source, evaluation, from, to, status, limit })
84
+ .flatMap(([name, value]) => value === undefined ? [] : [`--${name}`, String(value)]),
85
+ ...(pageCursor === undefined ? [] : [`--cursor=${pageCursor}`]),
86
+ ...(0, agent_runs_1.runReadScopeArgs)(workspaceId),
87
+ ...(0, auth_core_1.explicitProfileArgs)((0, keychain_1.profileForChildProcess)()),
88
+ ];
50
89
  try {
51
- const page = session ? await (0, execution_history_1.readExecutionHistory)(session.sessionId, 'list', {
52
- source, from, to, status, cursor, limit, since, timezone, taskId: task,
53
- }) : await (0, agent_runs_1.listAgentRuns)({ agentId: agent, conversationId: conversation, source, from, to, status, cursor, limit });
90
+ const { page, workspaceId } = session ? {
91
+ page: await (0, execution_history_1.readExecutionHistory)(session.sessionId, 'list', {
92
+ source, from, to, status, cursor, limit, since, timezone, taskId: task,
93
+ }),
94
+ workspaceId: undefined,
95
+ } : await (0, agent_runs_1.listAgentRuns)({
96
+ agentId: agent, conversationId: conversation, goalId: goal,
97
+ source, evaluationId: evaluation, from, to, status, cursor, limit, personal,
98
+ });
99
+ const continuation = !session && page.nextCursor ? listArgv(workspaceId, page.nextCursor) : undefined;
54
100
  if (flags.json) {
55
- this.log(JSON.stringify(page, null, 2));
101
+ this.log(JSON.stringify(continuation
102
+ ? { ...page, continuation: { argv: [...continuation, '--json'] } }
103
+ : page, null, 2));
56
104
  return;
57
105
  }
58
106
  for (const run of page.items) {
59
107
  const title = (0, search_display_1.searchDisplayText)(run.title ?? '');
60
108
  const acceptedAt = (0, search_display_1.searchDisplayText)((0, format_1.localTime)(run.acceptedAt));
109
+ const status = (0, data_provider_1.agentRunHistoryStatus)(run.status);
110
+ const label = status === 'timed_out' && 'endReason' in run &&
111
+ run.endReason === 'preparation_deadline_before_attempt' ? 'Preparation timed out' : status;
61
112
  this.log([
62
- run.id, (0, search_display_1.searchDisplayText)(run.source), (0, search_display_1.searchDisplayText)(run.status), acceptedAt, title,
113
+ run.id, (0, search_display_1.searchDisplayText)(run.source), label, acceptedAt, title,
63
114
  ].filter(Boolean).join(' · '));
64
115
  }
65
116
  if (!page.items.length) {
@@ -67,10 +118,23 @@ class RunsList extends base_command_1.BaseCommand {
67
118
  }
68
119
  if (page.coverage === 'partial')
69
120
  this.log('History coverage is partial. Some runs may be missing.');
70
- if (page.nextCursor)
121
+ if (continuation)
122
+ this.log(`Next page ${(0, shell_quote_1.shellQuoteArgv)(continuation)}`);
123
+ else if (page.nextCursor)
71
124
  this.log(`Next page Add --cursor ${(0, search_display_1.shellSearchCursor)(page.nextCursor)} to the same command.`);
72
125
  }
73
126
  catch (error) {
127
+ if (error instanceof agent_runs_1.RunListCursorInvalidError) {
128
+ const command = (0, shell_quote_1.shellQuoteArgv)([...listArgv(error.workspaceId), ...(flags.json ? ['--json'] : [])]);
129
+ this.failWithCliError({
130
+ code: 'INVALID_RUN_HISTORY_CURSOR',
131
+ message: `The Run History cursor expired or is no longer valid.\n → ${command}`,
132
+ status: 400,
133
+ exit: 1,
134
+ retryable: false,
135
+ details: { command, ...(error.workspaceId ? { workspaceId: error.workspaceId } : {}) },
136
+ });
137
+ }
74
138
  if ((0, http_error_1.httpStatusOf)(error) === 400 && error.code === 'INVALID_RUN_HISTORY_CURSOR') {
75
139
  this.failWithCliError({
76
140
  code: 'INVALID_RUN_HISTORY_CURSOR',
@@ -8,6 +8,7 @@ export default class RunsShow extends BaseCommand {
8
8
  };
9
9
  static flags: {
10
10
  json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ personal: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
12
  };
12
13
  run(): Promise<void>;
13
14
  }
@@ -1,17 +1,204 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const auth_core_1 = require("@skrr-ai/auth-core");
3
4
  const core_1 = require("@oclif/core");
4
5
  const base_command_1 = require("../../base-command");
5
6
  const agent_runs_1 = require("../../lib/agent-runs");
6
7
  const communication_history_1 = require("../../lib/communication-history");
7
8
  const execution_history_1 = require("../../lib/execution-history");
8
9
  const format_1 = require("../../lib/format");
10
+ const keychain_1 = require("../../lib/keychain");
11
+ const search_display_1 = require("../../lib/search-display");
12
+ const shell_quote_1 = require("../../lib/shell-quote");
13
+ function lifecycleText(lifecycle) {
14
+ if (!lifecycle)
15
+ return '';
16
+ const { status, startedAt, finishedAt } = lifecycle;
17
+ return [
18
+ '', status.replaceAll('_', ' '),
19
+ ...(startedAt ? [`started ${(0, format_1.localTime)(startedAt)}`] : []),
20
+ ...(finishedAt ? [`${status === 'not_started' ? 'confirmed' : 'finished'} ${(0, format_1.localTime)(finishedAt)}`] : []),
21
+ ].join(' · ');
22
+ }
23
+ const runtimeWaitLabel = {
24
+ offline: 'The runtime is offline.',
25
+ unavailable: 'Waiting for an available runtime.',
26
+ unbound: 'Waiting for a runtime to be assigned.',
27
+ capability_missing: 'Waiting for a runtime with the required capability.',
28
+ admission_failed: 'Waiting for an available runtime.',
29
+ lookup_failed: 'Waiting for an available runtime.',
30
+ waiting_for_machine: 'Waiting for the runtime to start.',
31
+ maintenance: 'New work is paused on this runtime.',
32
+ placement_unconfirmed: 'Hosted machine provisioning is unconfirmed.',
33
+ daemon_readiness_unconfirmed: 'The hosted machine was created. Daemon readiness is unconfirmed.',
34
+ dispatch_unconfirmed: 'The queue has not confirmed receipt of this run.',
35
+ capacity: 'Waiting for execution capacity.',
36
+ };
37
+ function runtimeWaitText(wait) {
38
+ if (!wait)
39
+ return [];
40
+ const lines = [];
41
+ if (wait.remedy === 'update_daemon')
42
+ lines.push('Update the skrr daemon on the selected machine so this run can start.');
43
+ else if (wait.missingCapability === 'session_managed_attempt_v1') {
44
+ lines.push('Waiting for a daemon that supports managed execution.');
45
+ }
46
+ else if (wait.missingCapability === 'duty_execution_contract_v3_ephemeral') {
47
+ lines.push('Waiting for a worker that supports Duty sandboxes.');
48
+ }
49
+ else {
50
+ const label = runtimeWaitLabel[wait.reason];
51
+ if (typeof label === 'string')
52
+ lines.push(label);
53
+ }
54
+ if (wait.deadlineAt)
55
+ lines.push(`Wait deadline: ${(0, format_1.localTime)(wait.deadlineAt)}`);
56
+ return lines;
57
+ }
58
+ function continuityText(attempt) {
59
+ const lines = [];
60
+ if (attempt.sessionContext === 'resumed')
61
+ lines.push('Session context resumed.');
62
+ else if (attempt.sessionContext === 'fresh')
63
+ lines.push('New session context.');
64
+ if (attempt.workspaceVolume === 'restored_snapshot_mounted') {
65
+ lines.push('The host mounted its workspace volume from a verified snapshot.');
66
+ lines.push('Working files and original-process continuity are unverified.');
67
+ }
68
+ else if (attempt.sessionContext === 'resumed') {
69
+ lines.push('Workspace restore and original-process continuity are unverified.');
70
+ }
71
+ return lines;
72
+ }
73
+ const placementLabel = { auto: 'Automatic placement', cloud: 'Cloud', local: 'Local' };
74
+ const modelLabel = { auto: 'Automatic model', configured: 'Configured model', harness_default: 'Harness default model' };
75
+ const backendLabel = {
76
+ server_sdk: 'Cloud SDK',
77
+ server_direct: 'Direct API',
78
+ hosted_codex: 'Cloud Codex',
79
+ hosted_first_party: 'Cloud Skrr Code',
80
+ hosted_pi: 'Cloud Pi',
81
+ };
82
+ function configurationText(configuration) {
83
+ if (!configuration)
84
+ return '';
85
+ const { definition, releaseNumber, executionEnvironment, modelMode, configuredModel, fallbackUsed } = configuration;
86
+ const definitionLabel = definition === 'agent_release'
87
+ ? typeof releaseNumber === 'number' && Number.isSafeInteger(releaseNumber) && releaseNumber > 0
88
+ ? `Agent release ${releaseNumber}`
89
+ : 'Agent release'
90
+ : definition === 'live_agent' ? 'Live Agent settings'
91
+ : definition === 'harness_profile' ? 'Harness profile' : undefined;
92
+ return [
93
+ definitionLabel,
94
+ executionEnvironment && placementLabel[executionEnvironment],
95
+ configuredModel && modelMode === 'configured'
96
+ ? 'Configured model: ' + (0, search_display_1.searchDisplayText)(configuredModel)
97
+ : modelMode && modelLabel[modelMode],
98
+ fallbackUsed === true && 'Fallback used',
99
+ ].filter(Boolean).join(' · ');
100
+ }
101
+ function timestampLines(timestamps) {
102
+ return timestamps.flatMap(([label, value]) => value && Number.isFinite(Date.parse(value)) ? [`${label}: ${(0, format_1.localTime)(value)}`] : []);
103
+ }
104
+ function timingText(timing) {
105
+ if (!timing)
106
+ return [];
107
+ const lines = timestampLines([
108
+ ['Queued', timing.queuedAt],
109
+ ['Queue deadline', timing.queueDeadlineAt],
110
+ ['Queue expired before claim', timing.queueExpiredAt],
111
+ ['First observed start', timing.startedAt],
112
+ ['Finished', timing.finishedAt === timing.queueExpiredAt ? undefined : timing.finishedAt],
113
+ ['Run deadline', timing.runDeadlineAt],
114
+ ]);
115
+ const { activeElapsedMs, activeTimeCoverage, wallTimeLimitMs } = timing;
116
+ if (typeof wallTimeLimitMs === 'number' && Number.isSafeInteger(wallTimeLimitMs) && wallTimeLimitMs > 0) {
117
+ lines.push(`Wall-clock limit from first claim: ${(0, format_1.formatDurationMs)(wallTimeLimitMs)}`);
118
+ }
119
+ if (typeof activeElapsedMs === 'number' && Number.isFinite(activeElapsedMs) && activeElapsedMs >= 0) {
120
+ const partial = activeTimeCoverage === 'partial' ? ' (partial evidence)' : '';
121
+ lines.push(`Recorded active time: ${(0, format_1.formatDurationMs)(activeElapsedMs)}${partial}`);
122
+ }
123
+ return lines;
124
+ }
125
+ function executionText(attempt) {
126
+ const lines = timestampLines([
127
+ ['Start authorization expires', attempt.timing?.startBy],
128
+ ['Attempt deadline', attempt.timing?.deadlineAt],
129
+ ]);
130
+ const dispatch = configurationText(attempt.configuration);
131
+ if (dispatch)
132
+ lines.push(`Dispatch configuration: ${dispatch}`);
133
+ const backend = attempt.observedRuntimeFamily && backendLabel[attempt.observedRuntimeFamily];
134
+ if (backend)
135
+ lines.push(`Observed backend: ${backend}`);
136
+ for (const execution of attempt.executions ?? []) {
137
+ const { executionEnvironment, machineProduct, fallbackUsed, observedModels } = execution;
138
+ const environment = placementLabel[executionEnvironment];
139
+ if (!environment)
140
+ continue;
141
+ const machine = machineProduct ? (0, search_display_1.searchDisplayText)(machineProduct) : '';
142
+ const placement = machine && executionEnvironment === 'auto'
143
+ ? `${machine} · Cloud inference`
144
+ : [environment, machine].filter(Boolean).join(' · ');
145
+ const models = (observedModels ?? []).filter((model) => typeof model === 'string')
146
+ .map(search_display_1.searchDisplayText).filter(Boolean);
147
+ lines.push(`Observed placement: ${placement}${fallbackUsed ? ' · Fallback used' : ''}`);
148
+ lines.push(models.length ? `Reported models: ${models.join(', ')}` : 'Reported models: unknown');
149
+ }
150
+ return lines;
151
+ }
152
+ const channelDeliveryLabel = {
153
+ silent: 'no reply sent',
154
+ accepted: 'accepted by provider',
155
+ delivered: 'delivered',
156
+ failed: 'failed',
157
+ pending: 'pending',
158
+ unconfirmed: 'unconfirmed',
159
+ };
160
+ function outcomeText(run) {
161
+ const lines = [];
162
+ if (run.source === 'channel' && run.delivery && Object.hasOwn(channelDeliveryLabel, run.delivery)) {
163
+ lines.push(`Channel delivery: ${channelDeliveryLabel[run.delivery]}`);
164
+ if (run.delivery === 'unconfirmed')
165
+ lines.push('Check the channel for the reply.');
166
+ }
167
+ if (run.businessResult) {
168
+ const { application, notifications } = run.businessResult;
169
+ lines.push(`Result application: ${application.replaceAll('_', ' ')}`);
170
+ const counts = ['delivered', 'pending', 'not_delivered', 'unconfirmed'].flatMap((state) => {
171
+ const count = notifications?.[state];
172
+ return typeof count === 'number' && Number.isSafeInteger(count) && count > 0
173
+ ? [`${count} ${state.replaceAll('_', ' ')}`]
174
+ : [];
175
+ });
176
+ if (counts.length)
177
+ lines.push(`Notification delivery: ${counts.join(' · ')}`);
178
+ }
179
+ const owed = run.humanInput?.items.filter(({ audience, state }) => audience === 'viewer' && state === 'pending') ?? [];
180
+ if (owed.length) {
181
+ const counts = ['approval', 'question', 'intervention'].flatMap((kind) => {
182
+ const count = owed.filter((item) => item.kind === kind).length;
183
+ return count ? [`${count} ${kind}${count === 1 ? '' : 's'}`] : [];
184
+ });
185
+ if (counts.length)
186
+ lines.push(`Your pending input: ${counts.join(' · ')}`);
187
+ }
188
+ return lines;
189
+ }
9
190
  class RunsShow extends base_command_1.BaseCommand {
10
191
  static autonomousCredentialPolicy = 'bound-session';
11
192
  static description = 'Show a canonical Agent Run and its execution attempts';
12
193
  static examples = ['<%= config.bin %> runs show <run-id>', '<%= config.bin %> runs show <run-id> --json'];
13
194
  static args = { runId: agent_runs_1.runIdArgument };
14
- static flags = { json: core_1.Flags.boolean({ description: 'Output as JSON' }) };
195
+ static flags = {
196
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
197
+ personal: core_1.Flags.boolean({
198
+ description: 'Inspect only in personal scope, ignoring the saved workspace.',
199
+ exclusive: ['workspace'],
200
+ }),
201
+ };
15
202
  async run() {
16
203
  const { args, flags } = await this.parse(RunsShow);
17
204
  const session = (0, communication_history_1.resolveHistorySession)(() => this.requireAuth());
@@ -22,14 +209,17 @@ class RunsShow extends base_command_1.BaseCommand {
22
209
  this.log(JSON.stringify(run, null, 2));
23
210
  else {
24
211
  this.log([run.id, run.source, run.status, (0, format_1.localTime)(run.acceptedAt)].join(' · '));
25
- for (const attempt of run.attempts)
26
- this.log(`Attempt ${attempt.number} ${attempt.id} (${attempt.executor})`);
212
+ for (const line of runtimeWaitText(run.runtimeWait))
213
+ this.log(line);
214
+ for (const attempt of run.attempts) {
215
+ this.log(`Attempt ${attempt.number} ${attempt.id} (${attempt.executor})${lifecycleText(attempt.lifecycle)}`);
216
+ }
27
217
  if (run.coverage === 'partial')
28
218
  this.log('Attempt history coverage is partial.');
29
219
  }
30
220
  return;
31
221
  }
32
- const run = await (0, agent_runs_1.readAgentRun)(args.runId);
222
+ const run = await (0, agent_runs_1.readAgentRun)(args.runId, { personal: flags.personal });
33
223
  const { snapshot } = run;
34
224
  if (flags.json) {
35
225
  this.log(JSON.stringify(run, null, 2));
@@ -37,22 +227,42 @@ class RunsShow extends base_command_1.BaseCommand {
37
227
  }
38
228
  this.log(`Run ${run.id}`);
39
229
  this.log(`Source: ${run.source}`);
40
- if (snapshot)
41
- this.log(`Status: ${snapshot.status}`);
42
- this.log(`Accepted: ${(0, format_1.localTime)(run.acceptedAt)}`);
43
- const wait = run.runtimeWait;
44
- if (wait?.remedy === 'update_daemon')
45
- this.log('Update the skrr daemon on the selected machine so this run can start.');
46
- else if (wait?.missingCapability === 'session_managed_attempt_v1') {
47
- this.log('Waiting for a daemon that supports managed execution.');
230
+ const origin = (0, agent_runs_1.chatCopyOrigin)(run);
231
+ if (origin) {
232
+ const scope = origin.workspaceId ? ['--workspace', origin.workspaceId] : ['--personal'];
233
+ const command = (0, shell_quote_1.shellQuoteArgv)([
234
+ this.config.bin, 'runs', 'transcript', origin.runId, '--attempt', origin.attemptId,
235
+ ...scope, ...(0, auth_core_1.explicitProfileArgs)((0, keychain_1.profileForChildProcess)()),
236
+ ]);
237
+ const label = origin.kind === 'fork' ? 'Fork source transcript' : 'Handover source transcript';
238
+ this.log(`${label} ${command}`);
48
239
  }
49
- else if (wait?.missingCapability === 'duty_execution_contract_v3_ephemeral') {
50
- this.log('Waiting for a worker that supports Duty sandboxes.');
240
+ const status = run.status ?? snapshot?.status;
241
+ if (status)
242
+ this.log(`Status: ${status}`);
243
+ if (run.snapshotAvailability === 'unavailable')
244
+ this.log('Live lifecycle snapshot is temporarily unavailable.');
245
+ if (status === 'timed_out' && run.endReason === 'preparation_deadline_before_attempt') {
246
+ this.log('Preparation timed out before execution began. No execution transcript was created.');
51
247
  }
248
+ this.log(`Accepted: ${(0, format_1.localTime)(run.acceptedAt)}`);
249
+ for (const line of runtimeWaitText(run.runtimeWait))
250
+ this.log(line);
251
+ for (const line of outcomeText(run))
252
+ this.log(line);
253
+ const configuration = configurationText(run.configuration);
254
+ if (configuration)
255
+ this.log(`Admitted configuration: ${configuration}`);
256
+ for (const line of timingText(run.timing))
257
+ this.log(line);
52
258
  if (snapshot?.activeAttemptId)
53
259
  this.log(`Active Attempt: ${snapshot.activeAttemptId}`);
54
260
  for (const attempt of run.attempts) {
55
- this.log(`Attempt ${attempt.number}: ${attempt.id} (${attempt.executor})`);
261
+ this.log(`Attempt ${attempt.number}: ${attempt.id} (${attempt.executor})${lifecycleText(attempt.lifecycle)}`);
262
+ for (const line of executionText(attempt))
263
+ this.log(` ${line}`);
264
+ for (const line of continuityText(attempt))
265
+ this.log(` ${line}`);
56
266
  }
57
267
  }
58
268
  catch (error) {
@@ -8,6 +8,7 @@ export default class RunsStop extends BaseCommand {
8
8
  static flags: {
9
9
  attempt: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
10
  queued: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ personal: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
12
  json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
13
  };
13
14
  run(): Promise<void>;
@@ -1,15 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const auth_core_1 = require("@skrr-ai/auth-core");
3
4
  const core_1 = require("@oclif/core");
4
5
  const base_command_1 = require("../../base-command");
5
6
  const agent_runs_1 = require("../../lib/agent-runs");
6
7
  const http_error_1 = require("../../lib/http-error");
8
+ const keychain_1 = require("../../lib/keychain");
9
+ const shell_quote_1 = require("../../lib/shell-quote");
7
10
  class RunsStop extends base_command_1.BaseCommand {
8
11
  static description = 'Request Stop for a canonical Agent Run or recover an exact Stop receipt';
9
12
  static examples = [
10
13
  '<%= config.bin %> runs stop <run-id>',
11
14
  '<%= config.bin %> runs stop <run-id> --attempt <attempt-id> --json',
12
15
  '<%= config.bin %> runs stop <run-id> --queued --json',
16
+ '<%= config.bin %> runs stop <run-id> --personal',
13
17
  ];
14
18
  static args = { runId: agent_runs_1.runIdArgument };
15
19
  static flags = {
@@ -22,13 +26,19 @@ class RunsStop extends base_command_1.BaseCommand {
22
26
  description: 'Stop before any Attempt has started or recover that queued Stop receipt',
23
27
  exclusive: ['attempt'],
24
28
  }),
29
+ personal: core_1.Flags.boolean({
30
+ description: 'Request or recover Stop in personal scope, ignoring the saved workspace.',
31
+ exclusive: ['workspace'],
32
+ }),
25
33
  json: core_1.Flags.boolean({ description: 'Output as JSON' }),
26
34
  };
27
35
  async run() {
28
36
  this.requireAuth();
29
37
  const { args, flags } = await this.parse(RunsStop);
38
+ const profile = (0, auth_core_1.explicitProfileArgs)((0, keychain_1.profileForChildProcess)());
30
39
  try {
31
- const result = await (0, agent_runs_1.stopAgentRun)(args.runId, flags.queued ? null : flags.attempt);
40
+ const { personal, queued, attempt } = flags;
41
+ const result = await (0, agent_runs_1.stopAgentRun)(args.runId, queued ? null : attempt, { personal });
32
42
  if (result.kind === 'already-ended') {
33
43
  if (flags.json) {
34
44
  this.log(JSON.stringify({ runId: result.runId, status: result.status, alreadyEnded: true }, null, 2));
@@ -51,24 +61,41 @@ class RunsStop extends base_command_1.BaseCommand {
51
61
  }
52
62
  catch (error) {
53
63
  if (error instanceof agent_runs_1.RunStopUnconfirmedError) {
54
- const target = error.expectedAttemptId === null ? '--queued' : `--attempt ${error.expectedAttemptId}`;
55
- const command = `${this.config.bin} runs stop ${args.runId} ${target}`;
64
+ const target = error.expectedAttemptId === null ? ['--queued'] : ['--attempt', error.expectedAttemptId];
65
+ const scope = error.workspaceId ? ['--workspace', error.workspaceId] : ['--personal'];
66
+ const command = (0, shell_quote_1.shellQuoteArgv)([this.config.bin, 'runs', 'stop', args.runId, ...target, ...scope, ...profile]);
56
67
  this.failWithCliError({
57
68
  code: 'AGENT_RUN_STOP_OUTCOME_UNKNOWN',
58
- message: `Stop was not confirmed. In the same workspace, retry with ${command}.`,
69
+ message: `Stop was not confirmed. Retry the same target with ${command}.`,
59
70
  status: (0, http_error_1.httpStatusOf)(error.cause),
60
71
  exit: 1,
61
72
  retryable: false,
62
- details: { expectedAttemptId: error.expectedAttemptId, command },
73
+ details: {
74
+ expectedAttemptId: error.expectedAttemptId,
75
+ ...(error.workspaceId ? { workspaceId: error.workspaceId } : {}),
76
+ command,
77
+ },
63
78
  });
64
79
  }
65
- if ((0, http_error_1.httpStatusOf)(error) === 409) {
80
+ if (error instanceof agent_runs_1.RunStopConflictError) {
81
+ const { expectedAttemptId, workspaceId } = error;
82
+ const scope = workspaceId ? ['--workspace', workspaceId] : ['--personal'];
83
+ const inspect = [this.config.bin, 'runs', 'show', args.runId, ...scope, ...profile];
84
+ const command = (0, shell_quote_1.shellQuoteArgv)(inspect);
85
+ const target = expectedAttemptId ? `Attempt ${expectedAttemptId}` : 'the queued Run';
66
86
  this.failWithCliError({
67
87
  code: 'AGENT_RUN_STOP_CONFLICT',
68
- message: `The Run changed before Stop was accepted. Check ${this.config.bin} runs show ${args.runId} before requesting Stop again.`,
88
+ message: `Stop was not accepted for ${target}. Check ${command} before requesting Stop again.`,
69
89
  status: 409,
70
90
  exit: 1,
71
91
  retryable: false,
92
+ details: {
93
+ runId: args.runId,
94
+ expectedAttemptId,
95
+ ...(workspaceId ? { workspaceId } : {}),
96
+ command,
97
+ inspection: { argv: [...inspect, '--json'] },
98
+ },
72
99
  });
73
100
  }
74
101
  this.handleApiError(error);
@@ -9,9 +9,11 @@ export default class RunsTranscript extends BaseCommand {
9
9
  static flags: {
10
10
  attempt: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
11
11
  offset: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ after: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
13
  cursor: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
14
  limit: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
15
  json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
+ personal: import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
17
  };
16
18
  run(): Promise<void>;
17
19
  }