@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
@@ -1,16 +1,4 @@
1
1
  import { BaseCommand } from '../../../base-command';
2
- /**
3
- * `skrr tasks chat exchange <task-id> <exchange-id> --close-input|--cancel|--interrupt`
4
- *
5
- * The three ways an in-flight exchange can be steered, and they are genuinely
6
- * different:
7
- *
8
- * --close-input stop collecting more user messages into this exchange; the
9
- * agent responds to what it already has.
10
- * --interrupt inject --text into the RUNNING response; the server refuses an
11
- * interrupt that carries no text.
12
- * --cancel terminate the exchange.
13
- */
14
2
  export default class TasksChatExchange extends BaseCommand {
15
3
  static description: string;
16
4
  static examples: string[];
@@ -21,9 +9,7 @@ export default class TasksChatExchange extends BaseCommand {
21
9
  static flags: {
22
10
  json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
23
11
  'close-input': import("@oclif/core/interfaces").BooleanFlag<boolean>;
24
- interrupt: import("@oclif/core/interfaces").BooleanFlag<boolean>;
25
12
  cancel: import("@oclif/core/interfaces").BooleanFlag<boolean>;
26
- text: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
27
13
  reason: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
28
14
  'command-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
29
15
  };
@@ -4,25 +4,12 @@ const node_crypto_1 = require("node:crypto");
4
4
  const core_1 = require("@oclif/core");
5
5
  const base_command_1 = require("../../../base-command");
6
6
  const task_extras_1 = require("../../../lib/task-extras");
7
- /**
8
- * `skrr tasks chat exchange <task-id> <exchange-id> --close-input|--cancel|--interrupt`
9
- *
10
- * The three ways an in-flight exchange can be steered, and they are genuinely
11
- * different:
12
- *
13
- * --close-input stop collecting more user messages into this exchange; the
14
- * agent responds to what it already has.
15
- * --interrupt inject --text into the RUNNING response; the server refuses an
16
- * interrupt that carries no text.
17
- * --cancel terminate the exchange.
18
- */
19
7
  class TasksChatExchange extends base_command_1.BaseCommand {
20
- static description = 'Close input on, interrupt, or cancel a task chat exchange';
8
+ static description = 'Close input on or cancel a task chat exchange. ' +
9
+ 'Send new text with `tasks chat send` or `tasks continue`. Stop the current run with `tasks interrupt`.';
21
10
  static examples = [
22
11
  '<%= config.bin %> tasks chat exchange task_abc ex_123 --close-input',
23
- '<%= config.bin %> tasks chat exchange task_abc ex_123 --interrupt --text "stop, wrong file; use src/a.ts"',
24
12
  '<%= config.bin %> tasks chat exchange task_abc ex_123 --cancel --reason "wrong file"',
25
- '<%= config.bin %> tasks chat exchange task_abc ex_123 --cancel',
26
13
  ];
27
14
  static args = {
28
15
  id: core_1.Args.string({ ignoreStdin: true, description: 'Task ID', required: true }),
@@ -32,22 +19,14 @@ class TasksChatExchange extends base_command_1.BaseCommand {
32
19
  json: core_1.Flags.boolean({ description: 'Output as JSON' }),
33
20
  'close-input': core_1.Flags.boolean({
34
21
  description: 'Stop collecting input; respond to what is already there',
35
- exclusive: ['cancel', 'interrupt'],
36
- }),
37
- interrupt: core_1.Flags.boolean({
38
- description: 'Inject --text into the running response',
39
- exclusive: ['cancel', 'close-input'],
22
+ exclusive: ['cancel'],
40
23
  }),
41
24
  cancel: core_1.Flags.boolean({
42
25
  description: 'Terminate the exchange',
43
- exclusive: ['interrupt', 'close-input'],
44
- }),
45
- text: core_1.Flags.string({
46
- description: 'What to tell the running response (required with --interrupt)',
47
- dependsOn: ['interrupt'],
26
+ exclusive: ['close-input'],
48
27
  }),
49
28
  reason: core_1.Flags.string({
50
- description: 'Why the exchange is cancelled (--cancel only; the other two record none)',
29
+ description: 'Why the exchange is cancelled (--cancel only)',
51
30
  dependsOn: ['cancel'],
52
31
  }),
53
32
  'command-id': core_1.Flags.string({
@@ -57,11 +36,8 @@ class TasksChatExchange extends base_command_1.BaseCommand {
57
36
  async run() {
58
37
  this.requireAuth();
59
38
  const { args, flags } = await this.parse(TasksChatExchange);
60
- if (!flags['close-input'] && !flags.interrupt && !flags.cancel) {
61
- this.error('Pass --close-input, --interrupt, or --cancel.');
62
- }
63
- if (flags.interrupt && !flags.text?.trim()) {
64
- this.error('--interrupt needs --text: the server injects it into the running response.');
39
+ if (!flags['close-input'] && !flags.cancel) {
40
+ this.error('Pass --close-input or --cancel.');
65
41
  }
66
42
  const taskId = await this.resolveTaskReference(args.id);
67
43
  // Every mutation on this surface requires an actor-scoped command id; the
@@ -70,15 +46,12 @@ class TasksChatExchange extends base_command_1.BaseCommand {
70
46
  const commandId = flags['command-id'] ?? `cli-${(0, node_crypto_1.randomUUID)()}`;
71
47
  const body = {
72
48
  commandId,
73
- ...(flags.interrupt ? { text: flags.text } : {}),
74
49
  ...(flags.cancel && flags.reason ? { reason: flags.reason } : {}),
75
50
  };
76
51
  let result;
77
52
  try {
78
53
  if (flags['close-input'])
79
54
  result = await task_extras_1.taskChatApi.closeInput(taskId, args.exchangeId, body);
80
- else if (flags.interrupt)
81
- result = await task_extras_1.taskChatApi.interruptExchange(taskId, args.exchangeId, body);
82
55
  else
83
56
  result = await task_extras_1.taskChatApi.cancelExchange(taskId, args.exchangeId, body);
84
57
  }
@@ -89,11 +62,7 @@ class TasksChatExchange extends base_command_1.BaseCommand {
89
62
  this.log(JSON.stringify(result, null, 2));
90
63
  return;
91
64
  }
92
- const verb = flags['close-input']
93
- ? 'input closed'
94
- : flags.interrupt
95
- ? 'interrupted'
96
- : 'cancelled';
65
+ const verb = flags['close-input'] ? 'input closed' : 'cancelled';
97
66
  this.log(`${args.exchangeId} ${verb}.`);
98
67
  }
99
68
  }
@@ -0,0 +1,15 @@
1
+ import { BaseCommand } from '../../../base-command';
2
+ export default class TasksChatReplyRun extends BaseCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static args: {
6
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
7
+ conversationId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
8
+ messageId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
9
+ };
10
+ static flags: {
11
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
+ personal: import("@oclif/core/interfaces").BooleanFlag<boolean>;
13
+ };
14
+ run(): Promise<void>;
15
+ }
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const auth_core_1 = require("@skrr-ai/auth-core");
5
+ const base_command_1 = require("../../../base-command");
6
+ const agent_runs_1 = require("../../../lib/agent-runs");
7
+ const keychain_1 = require("../../../lib/keychain");
8
+ const shell_quote_1 = require("../../../lib/shell-quote");
9
+ const task_extras_1 = require("../../../lib/task-extras");
10
+ class TasksChatReplyRun extends base_command_1.BaseCommand {
11
+ static description = 'Find the exact Run and Attempt that produced a Task Chat reply';
12
+ static examples = [
13
+ '<%= config.bin %> tasks chat reply-run <task-id> <conversation-id> <reply-message-id>',
14
+ '<%= config.bin %> tasks chat reply-run <task-id> <conversation-id> <reply-message-id> --personal --json',
15
+ ];
16
+ static args = {
17
+ id: core_1.Args.string({ description: 'Task ID', required: true, ignoreStdin: true }),
18
+ conversationId: core_1.Args.string({ description: 'Task Chat conversation ID', required: true, ignoreStdin: true }),
19
+ messageId: core_1.Args.string({ description: 'Assistant reply message ID', required: true, ignoreStdin: true }),
20
+ };
21
+ static flags = {
22
+ json: core_1.Flags.boolean({ description: 'Output as JSON with an inspection argument array' }),
23
+ personal: core_1.Flags.boolean({
24
+ description: 'Read a personal Task reply, ignoring the saved workspace.',
25
+ exclusive: ['workspace'],
26
+ }),
27
+ };
28
+ async run() {
29
+ const { args, flags } = await this.parse(TasksChatReplyRun);
30
+ this.requireAuth();
31
+ const taskId = await this.resolveTaskReference(args.id, flags.personal ? task_extras_1.listPersonalTaskTitleCandidates : undefined);
32
+ try {
33
+ const reference = await task_extras_1.taskChatApi.replyRun(taskId, args.conversationId, args.messageId, flags.personal ? { workspaceScope: 'personal' } : undefined);
34
+ const runId = (0, agent_runs_1.canonicalRunId)(reference?.id);
35
+ if (!runId || typeof reference.attemptId !== 'string') {
36
+ throw new Error('The server did not provide a canonical Task Chat reply Run and Attempt.');
37
+ }
38
+ const attemptId = (0, agent_runs_1.exactAttemptId)(reference.attemptId);
39
+ const workspaceId = reference.runHistoryWorkspaceId;
40
+ if (flags.personal && workspaceId !== null) {
41
+ throw new Error('The server did not confirm that this Task Chat reply belongs to personal scope.');
42
+ }
43
+ const scope = workspaceId === null ? ['--personal'] :
44
+ typeof workspaceId === 'string' && workspaceId.trim() ? ['--workspace', workspaceId] : null;
45
+ const inspection = scope && [
46
+ this.config.bin, 'runs', 'show', runId, ...scope, ...(0, auth_core_1.explicitProfileArgs)((0, keychain_1.profileForChildProcess)()),
47
+ ];
48
+ if (flags.json) {
49
+ this.printJsonResult({
50
+ id: runId,
51
+ attemptId,
52
+ ...(inspection ? {
53
+ runHistoryWorkspaceId: workspaceId,
54
+ inspection: { argv: [...inspection, '--json'] },
55
+ } : {}),
56
+ });
57
+ return;
58
+ }
59
+ this.log(`Run ${runId}`);
60
+ this.log(`Attempt ${attemptId}`);
61
+ if (inspection)
62
+ this.log(`Run History ${(0, shell_quote_1.shellQuoteArgv)(inspection)}`);
63
+ }
64
+ catch (error) {
65
+ this.handleApiError(error);
66
+ }
67
+ }
68
+ }
69
+ exports.default = TasksChatReplyRun;
@@ -60,7 +60,7 @@ function describePendingReview({ statusType, taskId, resultId, bin, advisories,
60
60
  }
61
61
  class TasksComplete extends base_command_1.BaseCommand {
62
62
  static autonomousCredentialPolicy = 'bound-session';
63
- static description = 'Submit one versioned Result and advance the Task workflow';
63
+ static description = 'Submit a versioned Result and advance the Task workflow, including required independent review';
64
64
  static examples = [
65
65
  '<%= config.bin %> tasks complete <task> --summary "Implemented and verified the fix" --deliverable <resource-link-id>',
66
66
  '<%= config.bin %> tasks complete <task> --summary "Do not ship" --conclusion-type release_recommendation --conclusion-json \'{"posture":"no_ship"}\'',
@@ -1,5 +1,6 @@
1
1
  import { BaseCommand } from '../../../base-command';
2
2
  export default class TasksLifecycleTransition extends BaseCommand {
3
+ static autonomousCredentialPolicy: "scoped-task-operation";
3
4
  static description: string;
4
5
  static args: {
5
6
  id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
@@ -3,9 +3,14 @@ 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 api_fetch_1 = require("../../../lib/api-fetch");
7
+ const credential_resolver_1 = require("../../../lib/credential-resolver");
6
8
  const task_lifecycle_output_1 = require("../../../lib/task-lifecycle-output");
9
+ const task_ref_resolver_1 = require("../../../lib/task-ref-resolver");
7
10
  const prompt_1 = require("../../../lib/prompt");
11
+ const session_task_endpoints_1 = require("../../../lib/session-task-endpoints");
8
12
  class TasksLifecycleTransition extends base_command_1.BaseCommand {
13
+ static autonomousCredentialPolicy = 'scoped-task-operation';
9
14
  static description = 'Apply a declared lifecycle transition — records effects and advances the stage';
10
15
  static args = {
11
16
  id: core_1.Args.string({ required: true, ignoreStdin: true, description: 'Task ID' }),
@@ -30,7 +35,6 @@ class TasksLifecycleTransition extends base_command_1.BaseCommand {
30
35
  async run() {
31
36
  this.requireAuth();
32
37
  const { args, flags } = await this.parse(TasksLifecycleTransition);
33
- const taskId = await this.resolveTaskReference(args.id);
34
38
  let payload;
35
39
  if (flags.payload) {
36
40
  try {
@@ -45,6 +49,31 @@ class TasksLifecycleTransition extends base_command_1.BaseCommand {
45
49
  this.error('--payload must be a JSON object.', { exit: 2 });
46
50
  }
47
51
  }
52
+ const credential = process.env.OVERSKY_SCOPED_TASK_OPERATIONS === '1'
53
+ ? (0, credential_resolver_1.resolveTrustedAutonomousCredential)()
54
+ : null;
55
+ const sessionId = process.env.OVERSKY_SESSION_ID?.trim();
56
+ if (credential && (!credential.token?.startsWith('agst_') || !sessionId)) {
57
+ this.failWithCliError({
58
+ message: 'Lifecycle transitions require this runtime’s bound Task session credential.',
59
+ code: 'SESSION_TASK_CREDENTIAL_MISSING',
60
+ exit: 2,
61
+ retryable: false,
62
+ });
63
+ }
64
+ const scoped = credential && sessionId ? { credential, sessionId } : null;
65
+ const boundTask = scoped
66
+ ? await (0, api_fetch_1.apiFetch)(`/api/agentic/sessions/${encodeURIComponent(scoped.sessionId)}/task`, { credential: scoped.credential }).catch((error) => this.handleApiError(error))
67
+ : null;
68
+ if (scoped && (!boundTask?.id || !(0, session_task_endpoints_1.requestMatchesBoundTask)(boundTask, args.id))) {
69
+ this.failWithCliError({
70
+ message: `This session cannot transition the requested Task ${args.id}.`,
71
+ code: 'SESSION_SCOPE_TASK_MISMATCH',
72
+ exit: 2,
73
+ retryable: false,
74
+ });
75
+ }
76
+ const taskId = boundTask?.id ?? await this.resolveTaskReference(args.id);
48
77
  /*
49
78
  * The fence only protects the interval it is given.
50
79
  *
@@ -64,32 +93,41 @@ class TasksLifecycleTransition extends base_command_1.BaseCommand {
64
93
  */
65
94
  let expectedRevision = flags['expected-revision'];
66
95
  if (expectedRevision === undefined) {
67
- let current;
96
+ let lifecycle;
68
97
  try {
69
- current = await data_provider_1.dataService.getTaskLifecycle(taskId);
98
+ lifecycle = scoped ? boundTask?.lifecycle : (await data_provider_1.dataService.getTaskLifecycle(taskId)).lifecycle;
70
99
  }
71
100
  catch (error) {
72
101
  this.handleApiError(error);
73
102
  }
74
- if (!current.lifecycle) {
103
+ if (!lifecycle) {
75
104
  this.error('No lifecycle is attached to this Task.', { exit: 2 });
76
105
  }
77
- expectedRevision = current.lifecycle.revision;
106
+ expectedRevision = lifecycle.revision;
78
107
  if (!flags.json) {
79
108
  this.log(`Fencing on revision ${expectedRevision}, read just now — not the revision you saw. ` +
80
109
  'Pass --expected-revision <n> to fence on the state you decided against.');
81
110
  }
82
111
  }
83
- const idempotencyKey = flags['idempotency-key'] ?? `cli-lifecycle:${taskId}:${args.transition}:r${expectedRevision}`;
112
+ // A reference keeps its original receipt key when a retry uses a scoped credential.
113
+ const receiptTaskRef = scoped ? ((0, task_ref_resolver_1.directTaskRef)(args.id) ?? taskId) : taskId;
114
+ const idempotencyKey = flags['idempotency-key'] ?? `cli-lifecycle:${receiptTaskRef}:${args.transition}:r${expectedRevision}`;
115
+ const body = {
116
+ transitionId: args.transition,
117
+ idempotencyKey,
118
+ expectedRevision,
119
+ ...(payload ? { payload } : {}),
120
+ };
84
121
  let response;
85
122
  try {
86
- response = await data_provider_1.dataService.transitionTaskLifecycle({
87
- taskId,
88
- transitionId: args.transition,
89
- idempotencyKey,
90
- expectedRevision,
91
- ...(payload ? { payload } : {}),
92
- });
123
+ response = scoped
124
+ ? await (0, api_fetch_1.apiFetch)(`/api/tasks/${encodeURIComponent(taskId)}/lifecycle/transitions`, {
125
+ credential: scoped.credential,
126
+ method: 'POST',
127
+ headers: { 'X-Oversky-Session-Id': scoped.sessionId },
128
+ body,
129
+ })
130
+ : await data_provider_1.dataService.transitionTaskLifecycle({ taskId, ...body });
93
131
  }
94
132
  catch (error) {
95
133
  this.handleApiError(error);
@@ -89,6 +89,11 @@ class TasksOperationsShow extends base_command_1.BaseCommand {
89
89
  }
90
90
  if (operation.provenance.code)
91
91
  this.log(`Observation: ${operation.provenance.code}`);
92
+ if (operation.intent === 'retry' && operation.state === 'refused' && operation.terminal &&
93
+ operation.provenance.code === 'TASK_RETRY_HANDOFF_CHANGED') {
94
+ this.log('The status transition was saved. The Task changed before dispatch, so no Run was admitted for this retry. Use execution-state for the current Task.');
95
+ return;
96
+ }
92
97
  this.log(operation.recovery.disposition === 'do_not_resend'
93
98
  ? 'This operation is not confirmed. Do not resend it; inspect the same operation or execution state.'
94
99
  : 'This is inspect-only. Use execution-state for current execution authority.');
@@ -23,7 +23,7 @@ function parseJson(value, label) {
23
23
  }
24
24
  class TasksResultSubmit extends base_command_1.BaseCommand {
25
25
  static autonomousCredentialPolicy = 'bound-session';
26
- static description = 'Submit the Task Result; this does not self-accept it or turn a domain conclusion into a Review';
26
+ static description = 'Record a Task Result. To finish work and advance the Task into any required Review, use tasks complete';
27
27
  static examples = [
28
28
  '<%= config.bin %> tasks result submit <task> --summary "NO-SHIP until Gates A-D pass" --conclusion-type release_recommendation --conclusion-json \'{"posture":"no_ship"}\'',
29
29
  ];
@@ -33,7 +33,9 @@ class TasksResultSubmit extends base_command_1.BaseCommand {
33
33
  static flags = {
34
34
  task: core_1.Flags.string({ description: 'Task id; overrides runtime context' }),
35
35
  summary: core_1.Flags.string({ required: true, description: 'The answer in one readable paragraph' }),
36
- 'request-completion': core_1.Flags.boolean({ description: 'Request workflow completion after the active Task Run ends' }),
36
+ 'request-completion': core_1.Flags.boolean({
37
+ description: 'Request workflow completion after the Run ends. Use from the current Agent work Run once the full Task is finished.',
38
+ }),
37
39
  body: core_1.Flags.string({ description: 'Long-form Result body' }),
38
40
  'conclusion-type': core_1.Flags.string({ description: 'Domain conclusion type' }),
39
41
  'conclusion-json': core_1.Flags.string({ description: 'JSON value for the domain conclusion' }),
@@ -81,29 +81,38 @@ class TasksRetry extends base_command_1.BaseCommand {
81
81
  `${taskRef} --request-id ${requestId}; do not issue a new retry id by guesswork.`,
82
82
  });
83
83
  }
84
+ const refused = result.state === 'transition_committed' &&
85
+ result.statusTransition?.state === 'committed' &&
86
+ result.dispatch?.state === 'not_started' &&
87
+ result.dispatch.code === 'TASK_RETRY_HANDOFF_CHANGED' &&
88
+ result.dispatch.retryable === false;
84
89
  if (flags.json) {
85
90
  this.log(JSON.stringify({ ...result, taskId: taskRef, requestId }, null, 2));
86
- return;
87
91
  }
88
- if (!result.started) {
89
- this.log(`Retry request ${requestId} is ${result.state}; dispatch is not confirmed.`);
92
+ else if (!result.started) {
93
+ this.log(refused
94
+ ? `The status transition for retry request ${requestId} was saved. The Task changed before dispatch, so no Run was admitted.`
95
+ : `Retry request ${requestId} is ${result.state}; dispatch is not confirmed.`);
90
96
  if (result.dispatch?.code)
91
97
  this.log(`Dispatch code: ${result.dispatch.code}`);
92
98
  this.log(`Inspect only: ${this.config.bin} tasks retry-receipt ${taskRef} --request-id ${requestId}`);
93
- return;
94
99
  }
95
- this.log(`Retried task ${taskRef}`);
96
- this.log(`Retry receipt: ${requestId}`);
97
- if (result.runId)
98
- this.log(`Run: ${result.runId}`);
99
- if (result.autonomousRunId)
100
- this.log(`Autonomous Run: ${result.autonomousRunId}`);
101
- if (result.conversationId)
102
- this.log(`Conversation: ${result.conversationId}`);
103
- if (result.sessionId)
104
- this.log(`Session: ${result.sessionId}`);
105
- if (result.responseMessageId)
106
- this.log(`Response message: ${result.responseMessageId}`);
100
+ else {
101
+ this.log(`Retried task ${taskRef}`);
102
+ this.log(`Retry receipt: ${requestId}`);
103
+ if (result.runId)
104
+ this.log(`Run: ${result.runId}`);
105
+ if (result.autonomousRunId)
106
+ this.log(`Autonomous Run: ${result.autonomousRunId}`);
107
+ if (result.conversationId)
108
+ this.log(`Conversation: ${result.conversationId}`);
109
+ if (result.sessionId)
110
+ this.log(`Session: ${result.sessionId}`);
111
+ if (result.responseMessageId)
112
+ this.log(`Response message: ${result.responseMessageId}`);
113
+ }
114
+ if (refused)
115
+ this.exit(1);
107
116
  }
108
117
  }
109
118
  exports.default = TasksRetry;
@@ -15,6 +15,7 @@ const data_provider_1 = require("@skrr-ai/data-provider");
15
15
  const base_command_1 = require("../../base-command");
16
16
  const format_1 = require("../../lib/format");
17
17
  const handover_interview_1 = require("../../lib/handover-interview");
18
+ const task_agent_run_1 = require("../../lib/task-agent-run");
18
19
  const activity_1 = require("./activity");
19
20
  /**
20
21
  * OSK-4836 — say WHERE a run executed. A named daemon wins over the environment
@@ -288,8 +289,11 @@ class TasksRuns extends base_command_1.BaseCommand {
288
289
  const showAttempt = attempts.some(Boolean);
289
290
  const showSettlement = settlements.some(Boolean);
290
291
  const showCleanup = cleanups.some(Boolean);
292
+ const runCommands = items.map(({ agentRunId, agentRunWorkspaceId }) => (0, task_agent_run_1.taskAgentRunCommand)({ agentRunId, agentRunWorkspaceId }, this.config.bin));
293
+ const inspectRun = runCommands.find(Boolean);
291
294
  const rows = items.map((run, i) => ({
292
295
  runId: String(run.runId ?? run.id ?? run._id ?? '-'),
296
+ agentRunId: runCommands[i] ? String(run.agentRunId) : '-',
293
297
  status: String(run.status ?? '-'),
294
298
  executor: formatRunExecutor(run),
295
299
  started: run.startedAt ? (0, format_1.localTime)(run.startedAt) : '-',
@@ -304,6 +308,7 @@ class TasksRuns extends base_command_1.BaseCommand {
304
308
  }));
305
309
  (0, format_1.renderTable)(rows, [
306
310
  { key: 'runId', header: 'RUN ID' },
311
+ ...(inspectRun ? [{ key: 'agentRunId', header: 'AGENT RUN ID' }] : []),
307
312
  { key: 'status', header: 'STATUS' },
308
313
  { key: 'executor', header: 'EXECUTOR' },
309
314
  { key: 'started', header: 'STARTED' },
@@ -316,6 +321,8 @@ class TasksRuns extends base_command_1.BaseCommand {
316
321
  ...(showCleanup ? [{ key: 'cleanup', header: 'CLEANUP', maxWidth: 42 }] : []),
317
322
  ...(showHandover ? [{ key: 'handover', header: 'HANDOVER' }] : []),
318
323
  ], (line) => this.log(line));
324
+ if (inspectRun)
325
+ this.log(`Inspect an Agent Run with ${inspectRun}`);
319
326
  // The previous owner's notes on each continuation, under the table: the column
320
327
  // says where each interview stands, this says what the previous agent said.
321
328
  for (const run of items) {
@@ -4,6 +4,7 @@ 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
6
  const task_resolver_1 = require("../../lib/task-resolver");
7
+ const task_agent_run_1 = require("../../lib/task-agent-run");
7
8
  /** Read-only recovery for one caller-owned task-start request. */
8
9
  class TasksStartReceipt extends base_command_1.BaseCommand {
9
10
  static description = 'Read the durable receipt for one task-start request without starting another run.';
@@ -47,14 +48,9 @@ class TasksStartReceipt extends base_command_1.BaseCommand {
47
48
  // turns whatever it picked into something the API can resolve — a UUID and
48
49
  // an OSK-2423 ref pass through untouched, a title is searched.
49
50
  const taskId = await this.resolveTaskReference(taskIdentity.id);
50
- // The CLI may compile against a published data-provider declaration that
51
- // predates this additive reader; use the runtime surface just as `start`
52
- // does for its newer options.
53
- const getTaskStartReceipt = data_provider_1.dataService
54
- .getTaskStartReceipt;
55
51
  let receipt;
56
52
  try {
57
- receipt = await getTaskStartReceipt(taskId, flags['request-id']);
53
+ receipt = await data_provider_1.dataService.getTaskStartReceipt(taskId, flags['request-id']);
58
54
  }
59
55
  catch (err) {
60
56
  this.handleApiError(err, { subject: `Task ${taskId} start receipt` });
@@ -72,8 +68,12 @@ class TasksStartReceipt extends base_command_1.BaseCommand {
72
68
  if (receipt.input.exchangeId)
73
69
  this.log(`Exchange: ${receipt.input.exchangeId}`);
74
70
  }
75
- if (receipt.run?.runId)
76
- this.log(`Run: ${receipt.run.runId}`);
71
+ const physicalRunId = receipt.input?.runId ?? receipt.run?.runId;
72
+ if (physicalRunId)
73
+ this.log(`Task run: ${physicalRunId}`);
74
+ const run = (0, task_agent_run_1.taskAgentRunCommand)(receipt.input ?? receipt.run, this.config.bin);
75
+ if (run)
76
+ this.log(`Inspect Agent Run with ${run}`);
77
77
  if (receipt.run?.autonomousRunId)
78
78
  this.log(`Autonomous Run: ${receipt.run.autonomousRunId}`);
79
79
  if (receipt.run?.conversationId)
@@ -11,6 +11,7 @@ const task_resolver_1 = require("../../lib/task-resolver");
11
11
  const git_task_1 = require("../../lib/git-task");
12
12
  const task_admission_1 = require("../../lib/task-admission");
13
13
  const http_error_1 = require("../../lib/http-error");
14
+ const task_agent_run_1 = require("../../lib/task-agent-run");
14
15
  const TASK_START_REQUEST_ID_PATTERN = /^[A-Za-z0-9._:/-]{1,200}$/;
15
16
  class TasksStart extends base_command_1.BaseCommand {
16
17
  static description = 'Request execution of a Task by its assigned Agent. ' + 'Alias: tasks execute';
@@ -192,8 +193,12 @@ class TasksStart extends base_command_1.BaseCommand {
192
193
  if (prior && prior.state !== 'unknown') {
193
194
  if (flags.json)
194
195
  this.printJsonResult(prior);
195
- else
196
+ else {
196
197
  this.log(`Start request ${requestId} is ${prior.state}. Inspect it with ${this.config.bin} tasks start-receipt ${taskId} --request-id ${requestId}.`);
198
+ const run = (0, task_agent_run_1.taskAgentRunCommand)(prior.input ?? prior.run, this.config.bin);
199
+ if (run)
200
+ this.log(`Inspect Agent Run with ${run}`);
201
+ }
197
202
  return;
198
203
  }
199
204
  const input = await data_provider_1.dataService.submitTaskConversationInput(taskId, {
@@ -211,6 +216,9 @@ class TasksStart extends base_command_1.BaseCommand {
211
216
  this.log(`${branch.created ? 'Created' : 'Checked out'} branch: ${branch.branch}`);
212
217
  this.log(`Task ${taskId} start input: ${input.phase}.`);
213
218
  this.log(`Start request: ${requestId}`);
219
+ const run = (0, task_agent_run_1.taskAgentRunCommand)(input, this.config.bin);
220
+ if (run)
221
+ this.log(`Inspect Agent Run with ${run}`);
214
222
  this.log(`Inspect execution: ${this.config.bin} tasks execution-state ${taskId}`);
215
223
  }
216
224
  return;
@@ -281,6 +289,9 @@ class TasksStart extends base_command_1.BaseCommand {
281
289
  this.log(`Run: ${result.runId}`);
282
290
  if (result.autonomousRunId)
283
291
  this.log(`Autonomous Run: ${result.autonomousRunId}`);
292
+ const run = (0, task_agent_run_1.taskAgentRunCommand)(result, this.config.bin);
293
+ if (run)
294
+ this.log(`Inspect Agent Run with ${run}`);
284
295
  this.log(`Conversation: ${result.conversationId}`);
285
296
  this.log(`Session: ${result.sessionId}`);
286
297
  if (result.responseMessageId)
@@ -4,9 +4,11 @@ const core_1 = require("@oclif/core");
4
4
  const base_command_1 = require("../../base-command");
5
5
  const triggers_1 = require("../../lib/triggers");
6
6
  class TriggersAudit extends base_command_1.BaseCommand {
7
- static description = 'List fire audit records for a trigger, or owner-wide fire history with filters';
7
+ static description = 'List fire audit records for a trigger, or owner-wide fire history with filters. ' +
8
+ 'Use --json to get the full occurrence ID for triggers fire-detail.';
8
9
  static examples = [
9
10
  '<%= config.bin %> triggers audit <trigger-id>',
11
+ '<%= config.bin %> triggers audit <trigger-id> --json',
10
12
  '<%= config.bin %> triggers audit --scope agent --outcome failed --json',
11
13
  '<%= config.bin %> triggers audit <trigger-id> --limit 50 --json',
12
14
  ];
@@ -100,7 +100,7 @@ function describeFireAuditDetail(detail, fireId, triggerId) {
100
100
  return lines;
101
101
  }
102
102
  class TriggersFireDetail extends base_command_1.BaseCommand {
103
- static description = 'Show the authorized restricted summary for one trigger fire';
103
+ static description = 'Show one trigger fire. When the server can verify its Agent Run, follow the runs show link.';
104
104
  static examples = [
105
105
  '<%= config.bin %> triggers fire-detail <trigger-id> <fire-id>',
106
106
  '<%= config.bin %> triggers fire-detail <trigger-id> <fire-id> --json',
@@ -132,6 +132,9 @@ class TriggersFireDetail extends base_command_1.BaseCommand {
132
132
  }
133
133
  for (const line of describeFireAuditDetail(detail, args.fireId, args.id))
134
134
  this.log(line);
135
+ const runCommand = (0, triggers_1.fireRunHistoryCommand)(detail.agentRun, this.config.bin);
136
+ if (runCommand)
137
+ this.log(`Run History: ${runCommand}`);
135
138
  }
136
139
  }
137
140
  exports.default = TriggersFireDetail;
@@ -79,7 +79,7 @@ class TriggersFire extends base_command_1.BaseCommand {
79
79
  return;
80
80
  }
81
81
  this.log(`Fire requested: outcome=${String(result.outcome ?? '-')} reason=${String(result.reason ?? '-')}`);
82
- for (const line of (0, triggers_1.describeFireDetail)(result))
82
+ for (const line of (0, triggers_1.describeFireDetail)(result, this.config.bin))
83
83
  this.log(line);
84
84
  const note = (0, triggers_1.describeScheduledFire)(result);
85
85
  if (note)
@@ -1,5 +1,6 @@
1
1
  import { BaseCommand } from '../base-command';
2
2
  export default class Usage extends BaseCommand {
3
+ static credentialMode: "local";
3
4
  static description: string;
4
5
  static examples: string[];
5
6
  static args: {
@@ -5,6 +5,7 @@ const base_command_1 = require("../base-command");
5
5
  const command_manifest_1 = require("../lib/command-manifest");
6
6
  const usage_discovery_1 = require("../lib/usage-discovery");
7
7
  class Usage extends base_command_1.BaseCommand {
8
+ static credentialMode = 'local';
8
9
  static description = 'Progressively discover skrr commands from the manifest, one token-budgeted domain at a time.';
9
10
  static examples = [
10
11
  '<%= config.bin %> usage',