@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
package/README.md CHANGED
@@ -57,6 +57,13 @@ the local daemon's account, server and profile, then previews the real file path
57
57
  whether the agent can read them. Use `--provider codex --review` to inspect the exact content
58
58
  without installing. To choose a different machine explicitly, pass `--daemon <id>`.
59
59
 
60
+ After installing for a coding agent, run `skrr instructions discovery --provider codex`
61
+ from the project directory (also supports `claude` and `skrr-code`). Start a new
62
+ agent session there. The Skill helps the agent recognize requests about shared
63
+ Tasks and find the CLI guides. Setup works before sign-in. For Beta, the
64
+ [verified build's install summary](https://github.com/skrr-ai/OverSky/actions/workflows/npm-release-verify.yml?query=branch%3Abeta)
65
+ includes the project setup and identifies the exact source commit.
66
+
60
67
  Automation never prompts. For an explicit installation, use
61
68
  `skrr instructions setup --provider codex --update-policy latest --yes --json`.
62
69
  Use `--update-policy pinned` to keep the current version, or `--review --json` to get a
@@ -201,19 +208,26 @@ on the Run line, and `--jsonl` includes it in the `run.accepted` event.
201
208
  ```bash
202
209
  skrr runs show <run-id>
203
210
  skrr runs events <run-id> --json
204
- skrr runs events <run-id> --cursor <cursor> --json
211
+ skrr runs events <run-id> --attempt <attempt-id> --workspace <workspace-id>
212
+ skrr runs events <run-id> --attempt <attempt-id> --workspace <workspace-id> --cursor=<cursor> --json
205
213
  skrr runs stop <run-id>
206
214
  ```
207
215
 
208
- The first event read returns the current Run snapshot and a cursor. Pass that
209
- cursor on later reads to replay new events. By default, Stop targets the
210
- current snapshot. An accepted request reports `stop_requested` until the
211
- platform confirms cancellation.
216
+ The first event read returns the current Run snapshot and a cursor. Use
217
+ `--attempt` to replay events for an exact Attempt. Continue with the same
218
+ Run, Attempt selection and workspace. The human-readable output prints that
219
+ command. An exact Attempt page can be empty while more journal positions
220
+ remain. Pass its returned cursor to continue. For a personal Run, omit the
221
+ workspace flag.
222
+
223
+ By default, Stop targets the current snapshot. An accepted request reports
224
+ `stop_requested` until the platform confirms cancellation.
212
225
 
213
- If a Stop response is lost, repeat the exact request in the same workspace.
214
- Use `skrr runs stop <run-id> --attempt <attempt-id>` for the original Attempt or
215
- `skrr runs stop <run-id> --queued` if the Run was queued before any Attempt
216
- started. These forms can recover the retained receipt after the Run ends.
226
+ If a Stop response is lost, the CLI checks the journal from its original
227
+ snapshot in the same workspace. If the result is still unconfirmed, use the
228
+ printed command to retry the original target. Use `--attempt <attempt-id>`
229
+ for the original Attempt or `--queued` if the Run was queued before any
230
+ Attempt started. These forms can recover the retained receipt after the Run ends.
217
231
 
218
232
  ### Production CLI Contract
219
233
 
@@ -768,10 +782,10 @@ sky triggers list --scope agent
768
782
  sky triggers create --scope agent --ref agentId=<agent-id> --kind schedule --mode send_message --cron "0 9 * * *" --prompt "Prepare the daily brief"
769
783
  sky triggers update <trigger-id> --no-enabled
770
784
  sky triggers fire <trigger-id>
771
- sky triggers audit <trigger-id>
772
- sky triggers audit --agent <agent-id> --limit 50
773
- sky triggers fire-detail <trigger-id> <fire-id>
774
- sky triggers replay <trigger-id> <fire-id>
785
+ skrr triggers audit <trigger-id> --json
786
+ skrr triggers audit --scope agent --limit 50
787
+ skrr triggers fire-detail <trigger-id> <occurrence-id>
788
+ skrr runs show <run-id>
775
789
  sky triggers event-catalog
776
790
  sky triggers parse-intent --scope agent --ref agentId=<agent-id> --message "Every weekday at 9, review tasks"
777
791
  sky triggers capabilities space_subscriber
@@ -779,6 +793,8 @@ sky triggers capabilities space_subscriber
779
793
 
780
794
  Use `--from-json <file|->` on `create`, `update`, and `fire` for full request
781
795
  bodies. Scope refs are passed as repeatable `--ref key=value` flags.
796
+ Use the occurrence ID from the audit to open Fire detail, then follow its
797
+ `runs show` command when it includes a verified Agent Run.
782
798
 
783
799
  ### `sky duties ...`
784
800
 
package/bin/dev.cjs CHANGED
@@ -29,7 +29,6 @@ async function main(argv) {
29
29
  }),
30
30
  );
31
31
  require('../src/lib/command-manifest.ts').useSourceCommandManifest(root, source.manifest);
32
- require('../src/lib/config.ts').seedWorkspaceEnv();
33
32
  await run(argv, { root, plugins: [source, ...bundled] });
34
33
  }
35
34
 
package/bin/run.js CHANGED
@@ -148,21 +148,6 @@ if (missingBuildPath) {
148
148
 
149
149
  const oclif = require('@oclif/core');
150
150
 
151
- // The workspace this machine works in (`skrr workspaces use`) becomes
152
- // `OVERSKY_WORKSPACE_ID` before any command runs, so every reader of that
153
- // variable honours the selection without learning about a config file.
154
- //
155
- // Here rather than in `BaseCommand.init` because `skrr code` deliberately does
156
- // not extend BaseCommand, and it is the command that needed this most.
157
- //
158
- // Best-effort: a read-only home or a corrupt config means "no selection", and a
159
- // stored preference must never be the reason a command cannot start.
160
- try {
161
- require('../dist/lib/config').seedWorkspaceEnv();
162
- } catch {
163
- /* no selection */
164
- }
165
-
166
151
  oclif.execute({ dir: __dirname }).catch((err) => {
167
152
  if (err && typeof err.oclif === 'object' && typeof err.oclif.exit === 'number') {
168
153
  process.exit(err.oclif.exit);
@@ -127,6 +127,8 @@ export declare abstract class BaseCommand extends Command {
127
127
  */
128
128
  protected credentialProvenance: CredentialProvenance | null;
129
129
  protected bareMode: boolean;
130
+ static credentialMode: 'standard' | 'borrow-only' | 'local';
131
+ private parsedBeforeAuth?;
130
132
  /** Managed runtimes must never suggest a human's local credential store. */
131
133
  private authManagedRuntime;
132
134
  /**
@@ -233,7 +235,10 @@ export declare abstract class BaseCommand extends Command {
233
235
  protected resolveEntityRef(kind: 'task' | 'space' | 'project', value: string, opts?: {
234
236
  space?: string;
235
237
  }): Promise<string>;
236
- protected resolveTaskReference(value: string): Promise<string>;
238
+ protected resolveTaskReference(value: string, listCandidates?: (params: {
239
+ q: string;
240
+ limit: number;
241
+ }) => Promise<unknown>): Promise<string>;
237
242
  /**
238
243
  * Parse flags, then resolve any `--space` reference to an id.
239
244
  *
@@ -368,6 +368,8 @@ class BaseCommand extends core_1.Command {
368
368
  */
369
369
  credentialProvenance = null;
370
370
  bareMode = false;
371
+ static credentialMode = 'standard';
372
+ parsedBeforeAuth;
371
373
  /** Managed runtimes must never suggest a human's local credential store. */
372
374
  authManagedRuntime = false;
373
375
  /**
@@ -378,6 +380,9 @@ class BaseCommand extends core_1.Command {
378
380
  brokerRefusal = null;
379
381
  async init() {
380
382
  await super.init();
383
+ const ctor = this.constructor;
384
+ if (ctor.credentialMode === 'local')
385
+ return;
381
386
  // Task Agent Context compatibility is meaningful only when the API can
382
387
  // distinguish a real CLI build from a generic HTTP caller. This is still
383
388
  // telemetry/presentation metadata: the server must never treat it as an
@@ -586,6 +591,17 @@ class BaseCommand extends core_1.Command {
586
591
  !ignoredStoredCredential.bundle &&
587
592
  ignoredStoredCredential.ownerStatus !== 'foreign' &&
588
593
  (ignoredStoredCredential.originStatus ?? 'none') === 'none';
594
+ // Only a validated invocation may create a durable sign-in. Reuse the
595
+ // parser result because passing an argument on stdin consumes it.
596
+ // Commands with an opaque argument tail can borrow for this invocation.
597
+ const mayAdopt = nothingStored &&
598
+ !earlyAutoBroker &&
599
+ ctor.credentialMode === 'standard' &&
600
+ ctor.strict !== false &&
601
+ !this.argv.includes('--');
602
+ if (mayAdopt) {
603
+ this.parsedBeforeAuth = await super.parse();
604
+ }
589
605
  // Daemon-as-broker auto-mint. When the resolver came up empty AND
590
606
  // a local `oversky` daemon is already authenticated for this user,
591
607
  // silently mint a sibling cli-scope refresh family via the daemon's
@@ -613,7 +629,7 @@ class BaseCommand extends core_1.Command {
613
629
  cliConfig: this.cliConfig,
614
630
  bareMode: this.bareMode,
615
631
  commandId: this.id,
616
- adopt: nothingStored,
632
+ adopt: mayAdopt,
617
633
  }));
618
634
  if (autoResult.adoptedBySibling) {
619
635
  // Another `skrr` adopted this profile's session while this one waited
@@ -976,7 +992,7 @@ class BaseCommand extends core_1.Command {
976
992
  return this.resolveSpaceReference(value);
977
993
  return (await this.resolveProjectReference(value, opts.space)).projectRef;
978
994
  }
979
- async resolveTaskReference(value) {
995
+ async resolveTaskReference(value, listCandidates = data_provider_1.dataService.listTasks) {
980
996
  const direct = (0, task_ref_resolver_1.directTaskRef)(value);
981
997
  if (direct)
982
998
  return direct;
@@ -1006,7 +1022,7 @@ class BaseCommand extends core_1.Command {
1006
1022
  }
1007
1023
  let response;
1008
1024
  try {
1009
- response = await data_provider_1.dataService.listTasks({ q: query, limit: 50 });
1025
+ response = await listCandidates({ q: query, limit: 50 });
1010
1026
  }
1011
1027
  catch (err) {
1012
1028
  this.handleApiError(err);
@@ -1049,7 +1065,11 @@ class BaseCommand extends core_1.Command {
1049
1065
  * `--space` is repeatable on `spaces reorder`, so both shapes are handled.
1050
1066
  */
1051
1067
  async parse(options, argv) {
1052
- const parsed = await super.parse(options, argv);
1068
+ const cached = this.parsedBeforeAuth;
1069
+ const parsed = cached && (options === undefined || options === this.constructor) && argv === undefined
1070
+ ? cached
1071
+ : await super.parse(options, argv);
1072
+ this.parsedBeforeAuth = undefined;
1053
1073
  const ctor = this.constructor;
1054
1074
  const flags = parsed.flags;
1055
1075
  const raw = flags?.space;
@@ -1,3 +1,4 @@
1
+ import type { PlanAgendaResponse } from '@skrr-ai/data-provider';
1
2
  import { BaseCommand } from '../../base-command';
2
3
  /**
3
4
  * The first thing a following terminal says after the runtime line. The turn is
@@ -5,7 +6,7 @@ import { BaseCommand } from '../../base-command';
5
6
  * stream reports `run.started` nothing else prints, which reads as a hang
6
7
  * (OSK-22554). Names the cloud worker when that is where the turn is queued.
7
8
  */
8
- export declare function describeQueuedProgress(runtime: unknown): string;
9
+ export declare function describeQueuedProgress(runtime: unknown, phase?: PlanAgendaResponse['phase']): string;
9
10
  /**
10
11
  * Why a followed Agenda turn failed, in words.
11
12
  *
@@ -6,6 +6,7 @@ const core_1 = require("@oclif/core");
6
6
  const data_provider_1 = require("@skrr-ai/data-provider");
7
7
  const base_command_1 = require("../../base-command");
8
8
  const api_fetch_1 = require("../../lib/api-fetch");
9
+ const agent_runs_1 = require("../../lib/agent-runs");
9
10
  const agentic_stream_1 = require("../../lib/agentic-stream");
10
11
  const chat_1 = require("../agents/chat");
11
12
  /**
@@ -14,7 +15,9 @@ const chat_1 = require("../agents/chat");
14
15
  * stream reports `run.started` nothing else prints, which reads as a hang
15
16
  * (OSK-22554). Names the cloud worker when that is where the turn is queued.
16
17
  */
17
- function describeQueuedProgress(runtime) {
18
+ function describeQueuedProgress(runtime, phase) {
19
+ if (phase === 'request_recorded')
20
+ return 'Waiting for Run acceptance…';
18
21
  const plan = runtime && typeof runtime === 'object'
19
22
  ? runtime.executionPlan
20
23
  : null;
@@ -113,7 +116,13 @@ class AgendaPlan extends base_command_1.BaseCommand {
113
116
  this.log(JSON.stringify(response, null, 2));
114
117
  return;
115
118
  }
116
- this.log(`Agenda planning started for agent ${args.agentId}`);
119
+ const requestRecorded = response.phase === 'request_recorded';
120
+ this.log(requestRecorded
121
+ ? `Agenda planning request recorded for agent ${args.agentId}`
122
+ : `Agenda planning accepted for agent ${args.agentId}`);
123
+ const runId = (0, agent_runs_1.canonicalRunId)(response.runId);
124
+ if (runId)
125
+ this.log(`Run ID: ${runId}`);
117
126
  this.log(`Conversation ID: ${response.conversationId}`);
118
127
  this.log(`Session ID: ${response.sessionId}`);
119
128
  this.log(`New conversation: ${response.isNewConversation ? 'yes' : 'no'}`);
@@ -122,10 +131,15 @@ class AgendaPlan extends base_command_1.BaseCommand {
122
131
  this.log(`Runtime: ${runtimeDescription}`);
123
132
  this.log('');
124
133
  if (!follow) {
125
- this.log('The turn is running detached. It may wait for permission; inspect it in the app or conversation ' + response.conversationId + '.');
134
+ if (requestRecorded && response.clientRequestId) {
135
+ this.log(`Check Run acceptance with: ${this.config.bin} runs admission ${response.clientRequestId}`);
136
+ }
137
+ else {
138
+ this.log(`Follow progress in conversation ${response.conversationId}.`);
139
+ }
126
140
  return;
127
141
  }
128
- this.log(describeQueuedProgress(response.runtime));
142
+ this.log(describeQueuedProgress(response.runtime, response.phase));
129
143
  const readMessages = async () => {
130
144
  const messages = await data_provider_1.dataService.getMessagesByConvoId(response.conversationId);
131
145
  return Array.isArray(messages) ? messages : [];
@@ -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
@@ -23,6 +23,7 @@ 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");
@@ -34,7 +35,9 @@ const web_url_1 = require("../../lib/web-url");
34
35
  const agent_chat_queue_1 = require("../../lib/agent-chat-queue");
35
36
  const inbound_messages_1 = require("../../lib/inbound-messages");
36
37
  const cloud_reply_1 = require("../../lib/cloud-reply");
38
+ const keychain_1 = require("../../lib/keychain");
37
39
  const local_skills_1 = require("../../lib/local-skills");
40
+ const shell_quote_1 = require("../../lib/shell-quote");
38
41
  /**
39
42
  * Exit code for a run the USER stopped watching, by pressing Ctrl-C.
40
43
  *
@@ -124,8 +127,8 @@ function interruptedDetachMessage(input) {
124
127
  return (waited +
125
128
  'The runtime MAY STILL BE EXECUTING — a tool call already running on ' +
126
129
  'your machine is not guaranteed to stop. ' +
127
- `Check what it did with: ${inspectTurnCommand(input.conversationId)}` +
128
- (process.platform === 'win32'
130
+ `Check what it did with: ${input.inspectionCommand ?? inspectTurnCommand(input.conversationId)}` +
131
+ (input.inspectionCommand || process.platform === 'win32'
129
132
  ? ''
130
133
  : ', and look for a surviving process with `ps -ef | grep -i claude`'));
131
134
  }
@@ -191,6 +194,8 @@ function reconcileTerminalFromMessages(messages, responseMessageId) {
191
194
  // The reason exists on the row; it simply never reached the surface. Say
192
195
  // it, rather than the transport error that masked it (OSK-7595).
193
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 } : {}),
194
199
  // Provisional, not final: the server rewrites this row from the
195
200
  // machine's own turn-end (OSK-13543).
196
201
  ...(agenticErrorSubtype(row) === agentic_stream_1.DAEMON_HANDOVER_REASON ? { handedOver: true } : {}),
@@ -304,7 +309,7 @@ function handoverInterruptMessage(input) {
304
309
  return (`Stopped waiting for run ${input.sessionId}. A platform update had restarted the server ` +
305
310
  'relaying it, and your machine MAY STILL BE WORKING on it: if it finishes, its reply is ' +
306
311
  'saved to the conversation. Nothing was cancelled. ' +
307
- `Check with: ${inspectTurnCommand(input.conversationId)}`);
312
+ `Check with: ${input.inspectionCommand ?? inspectTurnCommand(input.conversationId)}`);
308
313
  }
309
314
  /**
310
315
  * What one Ctrl-C does, by state. Exported so the decision is testable
@@ -544,9 +549,12 @@ class AgentsChat extends base_command_1.BaseCommand {
544
549
  }),
545
550
  jsonl: core_1.Flags.boolean({
546
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. ' +
547
554
  'Assistant text arrives as `text.delta`, a real delta: `delta` is the characters it ' +
548
555
  'adds, and a rewrite that is not an append arrives as `replace`, the new full text. ' +
549
- '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 ' +
550
558
  'the confirmed final reply. (--cumulative restores the older form, where `text` is ' +
551
559
  'the whole streamed text so far; it grows with the square of its length.) ' +
552
560
  'Read `session.output` for the raw execution stream. A widget the agent wrote ' +
@@ -930,6 +938,7 @@ class AgentsChat extends base_command_1.BaseCommand {
930
938
  return {
931
939
  sessionId: next.sessionId,
932
940
  ...(next.runId ? { runId: next.runId } : {}),
941
+ ...(next.runHistoryWorkspaceId !== undefined ? { runHistoryWorkspaceId: next.runHistoryWorkspaceId } : {}),
933
942
  conversationId,
934
943
  responseMessageId: next.responseMessageId,
935
944
  replayed: answer.idempotentReplay === true,
@@ -1281,6 +1290,7 @@ class AgentsChat extends base_command_1.BaseCommand {
1281
1290
  const startKey = suppliedStartKey ?? (0, agent_chat_start_1.newStartKey)();
1282
1291
  const turnText = contextParts ? `${contextParts}\n\n${prompt}` : prompt;
1283
1292
  let started;
1293
+ let acceptedStartKey;
1284
1294
  let replayedInbound = false;
1285
1295
  // Inbound messages: a message to an existing conversation goes to the ingress, which keeps it
1286
1296
  // and decides how the agent sees it. `--when-busy fail` asks for the older refusal instead.
@@ -1316,6 +1326,7 @@ class AgentsChat extends base_command_1.BaseCommand {
1316
1326
  }
1317
1327
  else {
1318
1328
  started = sent;
1329
+ acceptedStartKey = startKey;
1319
1330
  replayedInbound = sent.replayed === true;
1320
1331
  viaIngress = true;
1321
1332
  }
@@ -1349,6 +1360,7 @@ class AgentsChat extends base_command_1.BaseCommand {
1349
1360
  }
1350
1361
  : {}),
1351
1362
  });
1363
+ acceptedStartKey = startKey;
1352
1364
  }
1353
1365
  catch (err) {
1354
1366
  // OSK-32920 — a conversation that already has a turn running answers
@@ -1390,7 +1402,8 @@ class AgentsChat extends base_command_1.BaseCommand {
1390
1402
  });
1391
1403
  }
1392
1404
  if (err instanceof agent_chat_start_1.StartNotConfirmed) {
1393
- 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));
1394
1407
  this.handleApiError(err.lastError);
1395
1408
  }
1396
1409
  // A refused start was the one API error on this command that escaped
@@ -1431,6 +1444,28 @@ class AgentsChat extends base_command_1.BaseCommand {
1431
1444
  const quiet = !!flags['no-stream'];
1432
1445
  const runId = (0, agent_runs_1.canonicalRunId)(started.runId);
1433
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
+ : '';
1434
1469
  if (flags.jsonl) {
1435
1470
  // Written through the one JSONL helper, not `this.log`: oclif routes that
1436
1471
  // through `util.format`, which rewrites `%s`-shaped sequences that appear
@@ -1438,6 +1473,7 @@ class AgentsChat extends base_command_1.BaseCommand {
1438
1473
  (0, agentic_stream_1.writeJsonLine)(process.stdout, {
1439
1474
  type: 'run.accepted',
1440
1475
  ...runRef,
1476
+ ...recovery,
1441
1477
  sessionId: started.sessionId,
1442
1478
  conversationId: started.conversationId,
1443
1479
  ...(flags['thread-root'] ? { threadRootMessageId: flags['thread-root'] } : {}),
@@ -1512,6 +1548,7 @@ class AgentsChat extends base_command_1.BaseCommand {
1512
1548
  quiet,
1513
1549
  approveTools: flags['approve-tools'],
1514
1550
  reconcileTerminal,
1551
+ admittedResponseMessageId: started.responseMessageId,
1515
1552
  resumeRecordedResponseId: replayedInbound || started.idempotentReplay === true ? started.responseMessageId : undefined,
1516
1553
  awaitHandover,
1517
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) }),
@@ -1566,15 +1603,18 @@ class AgentsChat extends base_command_1.BaseCommand {
1566
1603
  if (!forcedDetachAnnounced) {
1567
1604
  forcedDetachAnnounced = true;
1568
1605
  const message = handoverInterruptMessage({
1569
- sessionId: started.sessionId,
1606
+ sessionId: runId ?? started.sessionId,
1570
1607
  conversationId: started.conversationId,
1571
- });
1608
+ inspectionCommand,
1609
+ }) + reconnectHint;
1572
1610
  if (flags.jsonl) {
1573
1611
  writeNotice(process.stdout.fd, `${JSON.stringify({
1574
1612
  type: 'run.detached',
1575
1613
  ...runRef,
1614
+ ...recovery,
1576
1615
  sessionId: started.sessionId,
1577
1616
  conversationId: started.conversationId,
1617
+ responseMessageId: started.responseMessageId,
1578
1618
  interrupted: true,
1579
1619
  handedOver: true,
1580
1620
  message,
@@ -1607,16 +1647,19 @@ class AgentsChat extends base_command_1.BaseCommand {
1607
1647
  if (!forcedDetachAnnounced) {
1608
1648
  forcedDetachAnnounced = true;
1609
1649
  const message = interruptedDetachMessage({
1610
- sessionId: started.sessionId,
1650
+ sessionId: runId ?? started.sessionId,
1611
1651
  conversationId: started.conversationId,
1652
+ inspectionCommand,
1612
1653
  forced: true,
1613
- });
1654
+ }) + reconnectHint;
1614
1655
  if (flags.jsonl) {
1615
1656
  writeNotice(process.stdout.fd, `${JSON.stringify({
1616
1657
  type: 'run.detached',
1617
1658
  ...runRef,
1659
+ ...recovery,
1618
1660
  sessionId: started.sessionId,
1619
1661
  conversationId: started.conversationId,
1662
+ responseMessageId: started.responseMessageId,
1620
1663
  interrupted: true,
1621
1664
  message,
1622
1665
  })}\n`);
@@ -1658,14 +1701,15 @@ class AgentsChat extends base_command_1.BaseCommand {
1658
1701
  reconciled = client.settledResult();
1659
1702
  }
1660
1703
  if (outcome === 'detached' && !reconciled) {
1661
- const message = interrupts > 0
1704
+ const message = (interrupts > 0
1662
1705
  ? interruptedDetachMessage({
1663
- sessionId: started.sessionId,
1706
+ sessionId: runId ?? started.sessionId,
1664
1707
  conversationId: started.conversationId,
1708
+ inspectionCommand,
1665
1709
  })
1666
- : `Detached from run ${started.sessionId} before it reached a terminal state. ` +
1710
+ : `Detached from run ${runId ?? started.sessionId} before it reached a terminal state. ` +
1667
1711
  'It may still be executing on the runtime. ' +
1668
- `Check with: ${inspectTurnCommand(started.conversationId)}`;
1712
+ `Check with: ${inspectionCommand ?? inspectTurnCommand(started.conversationId)}`) + reconnectHint;
1669
1713
  // 130 only when a signal actually caused this; otherwise the stream was
1670
1714
  // lost and claiming SIGINT lies to every script reading the code
1671
1715
  // (OSK-7660).
@@ -1674,8 +1718,10 @@ class AgentsChat extends base_command_1.BaseCommand {
1674
1718
  (0, agentic_stream_1.writeJsonLine)(process.stdout, {
1675
1719
  type: 'run.detached',
1676
1720
  ...runRef,
1721
+ ...recovery,
1677
1722
  sessionId: started.sessionId,
1678
1723
  conversationId: started.conversationId,
1724
+ responseMessageId: started.responseMessageId,
1679
1725
  interrupted: interrupts > 0,
1680
1726
  message,
1681
1727
  });
@@ -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
@@ -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) {