@skrr-ai/cli 0.1.208 → 0.1.209

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/dist/commands/agent/message/no-reply.js +1 -1
  2. package/dist/commands/agent/message/react.d.ts +23 -0
  3. package/dist/commands/agent/message/react.js +125 -0
  4. package/dist/commands/agent/message/resolve.js +1 -1
  5. package/dist/commands/agent/message/retract.js +1 -1
  6. package/dist/commands/agent/message/send.d.ts +8 -1
  7. package/dist/commands/agent/message/send.js +58 -4
  8. package/dist/commands/agents/access/approve.js +1 -1
  9. package/dist/commands/agents/access/deny.js +1 -1
  10. package/dist/commands/agents/access/list.js +3 -1
  11. package/dist/commands/agents/access/reach.js +1 -1
  12. package/dist/commands/agents/access/revoke.js +1 -1
  13. package/dist/commands/agents/always-on/recovery-review.d.ts +5 -0
  14. package/dist/commands/agents/always-on/recovery-review.js +16 -0
  15. package/dist/commands/agents/chat.d.ts +8 -0
  16. package/dist/commands/agents/chat.js +369 -90
  17. package/dist/commands/agents/import.js +3 -3
  18. package/dist/commands/agents/manager/status.js +7 -6
  19. package/dist/commands/agents/not-for-task.d.ts +24 -0
  20. package/dist/commands/agents/not-for-task.js +60 -0
  21. package/dist/commands/agents/schedule-overview.d.ts +20 -0
  22. package/dist/commands/agents/schedule-overview.js +35 -2
  23. package/dist/commands/agents/shared-memory.js +1 -1
  24. package/dist/commands/agents/stop.d.ts +23 -0
  25. package/dist/commands/agents/stop.js +61 -0
  26. package/dist/commands/agents/update.d.ts +7 -0
  27. package/dist/commands/agents/update.js +45 -2
  28. package/dist/commands/convos/messages.js +5 -0
  29. package/dist/commands/convos/transcript.js +2 -2
  30. package/dist/commands/daemon/logs.d.ts +3 -1
  31. package/dist/commands/daemon/logs.js +6 -2
  32. package/dist/commands/duties/advance-next.js +1 -1
  33. package/dist/commands/duties/preflight.js +17 -13
  34. package/dist/commands/followups/watch-pr.js +2 -1
  35. package/dist/commands/harnesses/evaluations/evidence.js +2 -2
  36. package/dist/commands/harnesses/evaluations/grant.js +1 -1
  37. package/dist/commands/harnesses/evaluations/revoke.js +1 -1
  38. package/dist/commands/harnesses/evaluations/show.js +1 -1
  39. package/dist/commands/harnesses/rollouts/grant.js +1 -1
  40. package/dist/commands/harnesses/rollouts/revoke.js +1 -1
  41. package/dist/commands/machines/hosted/identity-evaluations/revoke.js +1 -1
  42. package/dist/commands/machines/hosted/identity-evaluations/show.js +1 -1
  43. package/dist/commands/memory/consolidation/undo.js +1 -0
  44. package/dist/commands/messages/list.js +9 -1
  45. package/dist/commands/slack/mutes.js +1 -1
  46. package/dist/commands/slack/unmute.js +1 -1
  47. package/dist/commands/tasks/actionability.js +1 -0
  48. package/dist/commands/tasks/ask.js +1 -1
  49. package/dist/commands/tasks/bulk-update.js +12 -0
  50. package/dist/commands/tasks/input/show.js +2 -2
  51. package/dist/commands/tasks/list.d.ts +8 -0
  52. package/dist/commands/tasks/list.js +50 -9
  53. package/dist/commands/tasks/move.d.ts +2 -10
  54. package/dist/commands/tasks/move.js +7 -18
  55. package/dist/commands/tasks/result/show.js +19 -7
  56. package/dist/commands/tasks/show.d.ts +4 -3
  57. package/dist/commands/tasks/show.js +20 -8
  58. package/dist/commands/tasks/start.js +35 -16
  59. package/dist/commands/tasks/update.js +3 -0
  60. package/dist/commands/tasks/wait.js +2 -2
  61. package/dist/generated/agent-guides.json +433 -133
  62. package/dist/lib/chat-stop.d.ts +17 -0
  63. package/dist/lib/chat-stop.js +70 -0
  64. package/dist/lib/cloud-reply.d.ts +21 -0
  65. package/dist/lib/cloud-reply.js +52 -0
  66. package/dist/lib/duties.js +24 -4
  67. package/dist/lib/duty-ledgers.js +19 -2
  68. package/dist/lib/file-mime.js +8 -0
  69. package/dist/lib/inbound-messages.d.ts +156 -0
  70. package/dist/lib/inbound-messages.js +375 -0
  71. package/dist/lib/message-intent.d.ts +18 -2
  72. package/dist/lib/message-intent.js +23 -1
  73. package/dist/lib/preflight-copy.d.ts +16 -1
  74. package/dist/lib/preflight-copy.js +33 -1
  75. package/dist/lib/task-operations.d.ts +2 -0
  76. package/dist/lib/task-operations.js +28 -4
  77. package/dist/lib/task-preflight.js +1 -0
  78. package/dist/lib/task-review-notice.d.ts +21 -0
  79. package/dist/lib/task-review-notice.js +46 -0
  80. package/dist/lib/task-version.d.ts +9 -0
  81. package/dist/lib/task-version.js +16 -0
  82. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelopeBridge.js +6 -1
  83. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelopeBridge.js +45 -15
  84. package/dist/node_modules/@skrr-ai/auth-core/package.json +1 -1
  85. package/dist/node_modules/@skrr-ai/data-provider/index.js +11969 -11728
  86. package/oclif.manifest.json +290 -12
  87. package/package.json +6 -2
@@ -10,7 +10,7 @@ class Show extends base_command_1.BaseCommand {
10
10
  this.requireAuth();
11
11
  const { args } = await this.parse(Show);
12
12
  try {
13
- this.log(JSON.stringify(await (0, hosted_identity_evaluations_1.readHostedIdentityEvaluation)(args.id), null, 2));
13
+ this.printJsonResult(await (0, hosted_identity_evaluations_1.readHostedIdentityEvaluation)(args.id));
14
14
  }
15
15
  catch (error) {
16
16
  this.handleApiError(error);
@@ -18,6 +18,7 @@ class MemoryConsolidationUndo extends base_command_1.BaseCommand {
18
18
  cycleId: core_1.Args.string({
19
19
  description: 'Tidy-up id, from `skrr memory consolidation`',
20
20
  required: true,
21
+ ignoreStdin: true,
21
22
  }),
22
23
  };
23
24
  static flags = {
@@ -9,6 +9,14 @@ const format_1 = require("../../lib/format");
9
9
  const task_transcript_1 = require("../../lib/task-transcript");
10
10
  const message_provenance_1 = require("../../lib/message-provenance");
11
11
  const RUN_RE = /\s+/g;
12
+ /** What caused the row: an unattended run, an answer from the cloud while the machine could not. */
13
+ function viaLabel(m, provenance) {
14
+ if (provenance)
15
+ return (0, message_provenance_1.provenanceLabel)(provenance);
16
+ if (!m.isCreatedByUser && (0, data_provider_1.messageCloudReply)(m.metadata))
17
+ return 'cloud';
18
+ return '-';
19
+ }
12
20
  /**
13
21
  * OSK-2058 — resolve the conversation id from either calling convention.
14
22
  *
@@ -128,7 +136,7 @@ class MessagesList extends base_command_1.BaseCommand {
128
136
  return {
129
137
  when: m.createdAt ? new Date(String(m.createdAt)).toISOString().slice(11, 19) : '-',
130
138
  role: String(m.sender ?? m.role ?? (m.isCreatedByUser ? 'user' : 'assistant')),
131
- via: provenance ? (0, message_provenance_1.provenanceLabel)(provenance) : '-',
139
+ via: viaLabel(m, provenance),
132
140
  text: String(m.text ?? m.content ?? '')
133
141
  .replace(RUN_RE, ' ')
134
142
  .trim(),
@@ -35,7 +35,7 @@ class SlackMutes extends base_command_1.BaseCommand {
35
35
  this.handleApiError(err);
36
36
  }
37
37
  if (flags.json) {
38
- this.log(JSON.stringify({ mutes: mutes }, null, 2));
38
+ this.printJsonResult({ mutes: mutes });
39
39
  return;
40
40
  }
41
41
  if (mutes.length === 0) {
@@ -35,7 +35,7 @@ class SlackUnmute extends base_command_1.BaseCommand {
35
35
  this.handleApiError(err);
36
36
  }
37
37
  if (flags.json) {
38
- this.log(JSON.stringify(result, null, 2));
38
+ this.printJsonResult(result);
39
39
  return;
40
40
  }
41
41
  this.log(`The agent follows thread ${flags['thread-ts']} in ${flags.channel} again. Nothing was posted.`);
@@ -81,6 +81,7 @@ class TasksActionability extends base_command_1.BaseCommand {
81
81
  for (const { action, targetId } of a.allowedActions) {
82
82
  const rows = (0, task_operations_1.taskActionRemedyRows)((0, task_operations_1.taskActionRemedies)(action, task, targetId, this.config.bin, {
83
83
  allowedActions: a.allowedActions,
84
+ reasonCode: a.reasonCode,
84
85
  }));
85
86
  if (rows.length === 0)
86
87
  this.log(` ${action.padEnd(width)}`);
@@ -163,7 +163,7 @@ class TasksAsk extends base_command_1.BaseCommand {
163
163
  this.handleApiError(err);
164
164
  }
165
165
  if (flags.json) {
166
- this.log(JSON.stringify(response, null, 2));
166
+ this.printJsonResult(response);
167
167
  return;
168
168
  }
169
169
  const request = response.data;
@@ -9,6 +9,7 @@ const dry_run_plans_1 = require("../../lib/dry-run-plans");
9
9
  const task_batch_1 = require("../../lib/task-batch");
10
10
  const space_write_policy_1 = require("../../lib/space-write-policy");
11
11
  const write_target_1 = require("../../lib/write-target");
12
+ const task_review_notice_1 = require("../../lib/task-review-notice");
12
13
  const tasks_1 = require("../../lib/tasks");
13
14
  class TasksBulkUpdate extends base_command_1.BaseCommand {
14
15
  static description = 'Apply partial updates to many tasks from JSON';
@@ -113,6 +114,8 @@ class TasksBulkUpdate extends base_command_1.BaseCommand {
113
114
  }
114
115
  const usedBatch = batchByRow.size > 0;
115
116
  let stopped = false;
117
+ // Rows whose status move landed them in review that nobody owes a Review (OSK-33194).
118
+ const parkedInReview = [];
116
119
  for (const [index, row] of rows.entries()) {
117
120
  try {
118
121
  let task = null;
@@ -181,6 +184,9 @@ class TasksBulkUpdate extends base_command_1.BaseCommand {
181
184
  });
182
185
  continue;
183
186
  }
187
+ if ((0, task_review_notice_1.waitsForUnowedReview)(task)) {
188
+ parkedInReview.push((0, tasks_1.taskRef)(task) || (0, tasks_1.taskId)(task) || row.id);
189
+ }
184
190
  }
185
191
  if (!task) {
186
192
  task = await data_provider_1.dataService.getTask(row.id, { enrich: false });
@@ -212,7 +218,11 @@ class TasksBulkUpdate extends base_command_1.BaseCommand {
212
218
  failed: errors.length,
213
219
  results,
214
220
  };
221
+ const reviewNotice = (0, task_review_notice_1.unowedReviewSummary)(parkedInReview, this.config.bin);
215
222
  if (flags.json) {
223
+ // stderr, so the JSON on stdout stays one document (as `tasks move` does).
224
+ if (reviewNotice)
225
+ this.logToStderr(reviewNotice);
216
226
  const base = this.cliConfig.baseURL;
217
227
  const enriched = {
218
228
  ...summary,
@@ -243,6 +253,8 @@ class TasksBulkUpdate extends base_command_1.BaseCommand {
243
253
  this.log(`- failed ${result.id}: ${result.error}`);
244
254
  }
245
255
  }
256
+ if (reviewNotice)
257
+ this.log(reviewNotice);
246
258
  }
247
259
  if (errors.length > 0) {
248
260
  this.exit(1);
@@ -123,7 +123,7 @@ class TasksInputShow extends base_command_1.BaseCommand {
123
123
  this.handleApiError(err);
124
124
  }
125
125
  if (flags.json) {
126
- this.log(JSON.stringify(response, null, 2));
126
+ this.printJsonResult(response);
127
127
  return;
128
128
  }
129
129
  if (!response.data) {
@@ -176,7 +176,7 @@ class TasksInputShow extends base_command_1.BaseCommand {
176
176
  const open = request.status === 'open';
177
177
  if (!flags.wait || !open) {
178
178
  if (flags.json)
179
- this.log(JSON.stringify({ data: request }, null, 2));
179
+ this.printJsonResult({ data: request }, { ok: !(flags.wait && request.status !== 'answered') });
180
180
  else {
181
181
  this.log(`Request: ${request.requestId} (${request.status})`);
182
182
  for (const line of humanInputAnswerLines(request))
@@ -32,6 +32,14 @@ export declare function agentSessionOpenDefault(flags: ListFlags, env?: NodeJS.P
32
32
  export declare function emptyTasksMessage(flags: ListFlags, bin?: string): string;
33
33
  /** An empty filtered page is evidence about this query, not an empty Space. */
34
34
  export declare function externalKeyPrefixWarnings(flags: ListFlags, rowCount: number): ListWarning[];
35
+ /**
36
+ * The server sets `spaceUnverified` when it could not confirm that `--space` names a Space this caller
37
+ * can VIEW (OSK-24327): the Space does not exist, the caller cannot see it, or the check itself failed.
38
+ * It deliberately does not say which, so neither can this, and the note names all three rather than
39
+ * calling the id wrong. The rows are still the caller's own grants in that id, so an empty list here
40
+ * is not "this Space has no tasks".
41
+ */
42
+ export declare function spaceScopeWarnings(flags: ListFlags, response: unknown, bin?: string): ListWarning[];
35
43
  /**
36
44
  * The NEXT column's text, computed once for the table and the `--json`
37
45
  * `nextAction` alias. `reason` is the sentence the server wrote for a person;
@@ -4,6 +4,7 @@ exports.resolveListWorkspace = exports.lookupDefaultWorkspace = void 0;
4
4
  exports.agentSessionOpenDefault = agentSessionOpenDefault;
5
5
  exports.emptyTasksMessage = emptyTasksMessage;
6
6
  exports.externalKeyPrefixWarnings = externalKeyPrefixWarnings;
7
+ exports.spaceScopeWarnings = spaceScopeWarnings;
7
8
  exports.nextActionText = nextActionText;
8
9
  exports.nextColumnWidth = nextColumnWidth;
9
10
  exports.taskRef = taskRef;
@@ -175,6 +176,29 @@ function externalKeyPrefixWarnings(flags, rowCount) {
175
176
  },
176
177
  ];
177
178
  }
179
+ /**
180
+ * The server sets `spaceUnverified` when it could not confirm that `--space` names a Space this caller
181
+ * can VIEW (OSK-24327): the Space does not exist, the caller cannot see it, or the check itself failed.
182
+ * It deliberately does not say which, so neither can this, and the note names all three rather than
183
+ * calling the id wrong. The rows are still the caller's own grants in that id, so an empty list here
184
+ * is not "this Space has no tasks".
185
+ */
186
+ function spaceScopeWarnings(flags, response, bin = 'skrr') {
187
+ const space = flags.space;
188
+ if (typeof space !== 'string' || !space)
189
+ return [];
190
+ if (!response || typeof response !== 'object')
191
+ return [];
192
+ if (response.spaceUnverified !== true)
193
+ return [];
194
+ return [
195
+ {
196
+ code: 'SPACE_UNVERIFIED',
197
+ value: { space },
198
+ hint: `Space ${space} could not be verified for you (it may not exist, you may not be able to see it, or the check failed), so these results may be incomplete. Confirm the id with \`${bin} spaces list\`, or retry.`,
199
+ },
200
+ ];
201
+ }
178
202
  /**
179
203
  * `--status` is repeatable, so the flag value is a list; callers that predate
180
204
  * that and tests that pass a bare string both normalize through here.
@@ -301,7 +325,8 @@ function taskPageSummary(items, hasMore) {
301
325
  (Array.isArray(t.assigneeUserIds) && t.assigneeUserIds.length > 0))
302
326
  return 'assigned';
303
327
  return Array.isArray(t.assigneeAgentIds) && Array.isArray(t.assigneeUserIds)
304
- ? 'unassigned' : 'unknown';
328
+ ? 'unassigned'
329
+ : 'unknown';
305
330
  };
306
331
  return {
307
332
  scope: 'fetched_page',
@@ -321,11 +346,16 @@ function taskPageSummary(items, hasMore) {
321
346
  function taskExecutionText(t) {
322
347
  const execution = taskExecution(t);
323
348
  switch (execution.state) {
324
- case 'run_active': return `Run ${String(execution.runStatus ?? 'active')}${execution.agentId ? ` (${String(execution.agentId)})` : ''}`;
325
- case 'checkout_held': return 'Checkout held; Run unverified';
326
- case 'terminal': return 'Terminal';
327
- case 'not_observed': return 'No active Run observed';
328
- default: return 'Unknown';
349
+ case 'run_active':
350
+ return `Run ${String(execution.runStatus ?? 'active')}${execution.agentId ? ` (${String(execution.agentId)})` : ''}`;
351
+ case 'checkout_held':
352
+ return 'Checkout held; Run unverified';
353
+ case 'terminal':
354
+ return 'Terminal';
355
+ case 'not_observed':
356
+ return 'No active Run observed';
357
+ default:
358
+ return 'Unknown';
329
359
  }
330
360
  }
331
361
  /**
@@ -697,6 +727,9 @@ class TasksList extends base_command_1.BaseCommand {
697
727
  `(your default). Every workspace you belong to: ${this.config.bin} tasks list --all-workspaces`);
698
728
  }
699
729
  }
730
+ // A refused `spaceId` (400 SPACE_ID_INVALID, OSK-24327) is read back as the flag that sent it.
731
+ if (flags.space)
732
+ this.requestFieldFlags = { spaceId: '--space' };
700
733
  let response;
701
734
  try {
702
735
  response = calendarRange
@@ -731,9 +764,10 @@ class TasksList extends base_command_1.BaseCommand {
731
764
  const list = response;
732
765
  const rowCount = Array.isArray(list?.data) ? list.data.length : 0;
733
766
  const prefixWarnings = calendarRange ? [] : externalKeyPrefixWarnings(flags, rowCount);
767
+ const spaceWarnings = calendarRange ? [] : spaceScopeWarnings(flags, response, this.config.bin);
734
768
  const statusWarnings = calendarRange
735
769
  ? []
736
- : [...statusFilterWarnings(flags, rowCount), ...prefixWarnings];
770
+ : [...statusFilterWarnings(flags, rowCount), ...prefixWarnings, ...spaceWarnings];
737
771
  if (flags.strict && statusWarnings.some((w) => w.code === 'STATUS_NOT_BUILTIN')) {
738
772
  const bad = statusWarnings.find((w) => w.code === 'STATUS_NOT_BUILTIN');
739
773
  this.failWithCliError({
@@ -837,7 +871,12 @@ class TasksList extends base_command_1.BaseCommand {
837
871
  }
838
872
  const r = response;
839
873
  const items = r?.data ?? [];
840
- if (flags.q && (r?.degraded || r?.incomplete || r?.truncated || r?.search?.candidates_may_be_truncated || r?.search?.comment_search_incomplete)) {
874
+ if (flags.q &&
875
+ (r?.degraded ||
876
+ r?.incomplete ||
877
+ r?.truncated ||
878
+ r?.search?.candidates_may_be_truncated ||
879
+ r?.search?.comment_search_incomplete)) {
841
880
  this.warn('Search may be incomplete. Inspect --json diagnostics.');
842
881
  }
843
882
  if (flags.q && r?.search?.semantics === 'case_insensitive_substring') {
@@ -845,7 +884,7 @@ class TasksList extends base_command_1.BaseCommand {
845
884
  }
846
885
  if (items.length === 0) {
847
886
  this.log(emptyTasksMessage(flags, this.config.bin));
848
- for (const line of (0, list_output_1.warningLines)(prefixWarnings))
887
+ for (const line of (0, list_output_1.warningLines)([...prefixWarnings, ...spaceWarnings]))
849
888
  this.log(line);
850
889
  if (r?.next_cursor)
851
890
  this.log(`Next page: --cursor ${r.next_cursor}`);
@@ -925,6 +964,8 @@ class TasksList extends base_command_1.BaseCommand {
925
964
  const note = (0, list_output_1.limitNote)(flags.limit, items.length, Boolean(r?.has_more));
926
965
  for (const line of (0, list_output_1.warningLines)(note.warning ? [note.warning] : []))
927
966
  this.log(line);
967
+ for (const line of (0, list_output_1.warningLines)(spaceWarnings))
968
+ this.log(line);
928
969
  for (const line of (0, list_output_1.textModeProjectionNotes)(flags))
929
970
  this.log(line);
930
971
  }
@@ -1,14 +1,6 @@
1
1
  import { BaseCommand } from '../../base-command';
2
- /**
3
- * The notice for a Task moved into review that no Review is owed for.
4
- *
5
- * Review is where a Review the Task's own `reviewPolicy` requires is waited
6
- * for. Under `none` (the default) nobody owes one, so a Task parked there
7
- * waits on a person who was never asked: thousands sat in review that way
8
- * (OSK-33196). The move still lands; this says what it means, at the moment
9
- * an agent made it.
10
- */
11
- export declare function unowedReviewNotice(task: unknown, bin: string): string | null;
2
+ import { unowedReviewNotice } from '../../lib/task-review-notice';
3
+ export { unowedReviewNotice };
12
4
  /**
13
5
  * `tasks move` is the documented way to change a task's status. The data
14
6
  * provider's `TaskUpdateParams` (used by `tasks update`) does not expose a
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.unowedReviewNotice = unowedReviewNotice;
3
+ exports.unowedReviewNotice = void 0;
4
4
  const core_1 = require("@oclif/core");
5
5
  const data_provider_1 = require("@skrr-ai/data-provider");
6
6
  const api_fetch_1 = require("../../lib/api-fetch");
@@ -14,22 +14,8 @@ const task_closure_1 = require("../../lib/task-closure");
14
14
  const web_url_1 = require("../../lib/web-url");
15
15
  const task_resolver_1 = require("../../lib/task-resolver");
16
16
  const projects_1 = require("../../lib/projects");
17
- /**
18
- * The notice for a Task moved into review that no Review is owed for.
19
- *
20
- * Review is where a Review the Task's own `reviewPolicy` requires is waited
21
- * for. Under `none` (the default) nobody owes one, so a Task parked there
22
- * waits on a person who was never asked: thousands sat in review that way
23
- * (OSK-33196). The move still lands; this says what it means, at the moment
24
- * an agent made it.
25
- */
26
- function unowedReviewNotice(task, bin) {
27
- const t = (task ?? {});
28
- if (t.statusType !== 'review' || t.reviewPolicy === 'required')
29
- return null;
30
- return ('Nobody owes this Task a Review: its reviewPolicy is not `required`, so it waits in review ' +
31
- `for a person who was never asked. Close finished work with \`${bin} tasks complete\`.`);
32
- }
17
+ const task_review_notice_1 = require("../../lib/task-review-notice");
18
+ Object.defineProperty(exports, "unowedReviewNotice", { enumerable: true, get: function () { return task_review_notice_1.unowedReviewNotice; } });
33
19
  /**
34
20
  * `tasks move` is the documented way to change a task's status. The data
35
21
  * provider's `TaskUpdateParams` (used by `tasks update`) does not expose a
@@ -224,7 +210,7 @@ class TasksMove extends base_command_1.BaseCommand {
224
210
  }
225
211
  this.handleApiError(err);
226
212
  }
227
- const reviewNotice = flags.status ? unowedReviewNotice(updated, this.config.bin) : null;
213
+ const reviewNotice = flags.status ? (0, task_review_notice_1.unowedReviewNotice)(updated, this.config.bin) : null;
228
214
  if (flags.json) {
229
215
  // stderr, so the JSON on stdout stays one document.
230
216
  if (reviewNotice)
@@ -247,6 +233,9 @@ class TasksMove extends base_command_1.BaseCommand {
247
233
  destinations.push(await this.describeProjectDestination(projectId, t));
248
234
  }
249
235
  this.log(`Moved task ${t.id ?? t._id ?? taskRef}${ref ? ` (${ref})` : ''} → ${destinations.join(', ')}`);
236
+ const versionLine = (0, task_version_1.writtenTaskVersionLine)(t);
237
+ if (versionLine)
238
+ this.log(` ${versionLine}`);
250
239
  /*
251
240
  * Closing is the actor's call — the server does not refuse outstanding
252
241
  * work, it records it on `resolution.closure`. If the close just written
@@ -65,7 +65,10 @@ class TasksResultShow extends base_command_1.BaseCommand {
65
65
  static flags = {
66
66
  task: core_1.Flags.string({ description: 'Task id; overrides runtime context' }),
67
67
  history: core_1.Flags.boolean({ description: 'Include superseded Result versions' }),
68
- result: core_1.Flags.string({ description: 'Read one immutable Result by id', exclusive: ['history'] }),
68
+ result: core_1.Flags.string({
69
+ description: 'Read one immutable Result by id',
70
+ exclusive: ['history'],
71
+ }),
69
72
  json: core_1.Flags.boolean({ description: 'Output JSON' }),
70
73
  };
71
74
  async run() {
@@ -73,8 +76,11 @@ class TasksResultShow extends base_command_1.BaseCommand {
73
76
  const { args, flags } = await this.parse(TasksResultShow);
74
77
  const task = (0, task_resolver_1.resolveTaskIdentity)({ positionalId: args.task, flagTask: flags.task });
75
78
  if (flags.result) {
76
- const scopeKey = process.env.OVERSKY_SPACE_REVIEW_WORK === '1' || process.env.OVERSKY_SPACE_GOAL_WORK === '1' ? 'reviewSpaceId'
77
- : process.env.OVERSKY_SPACE_NOTEBOOK_RESULT === '1' ? 'notebookSpaceId' : undefined;
79
+ const scopeKey = process.env.OVERSKY_SPACE_REVIEW_WORK === '1' || process.env.OVERSKY_SPACE_GOAL_WORK === '1'
80
+ ? 'reviewSpaceId'
81
+ : process.env.OVERSKY_SPACE_NOTEBOOK_RESULT === '1'
82
+ ? 'notebookSpaceId'
83
+ : undefined;
78
84
  const spaceId = process.env.OVERSKY_SESSION_SPACE_ID;
79
85
  if (scopeKey && !spaceId)
80
86
  this.error('This evidence read requires a bound Space.', { exit: 2 });
@@ -83,9 +89,15 @@ class TasksResultShow extends base_command_1.BaseCommand {
83
89
  try {
84
90
  const exact = await (0, api_fetch_1.apiFetch)(`${path}${query}`);
85
91
  if (flags.json)
86
- return this.log(JSON.stringify(exact));
87
- return this.log([`Result v${exact.version} ${exact.id}`, exact.summary, exact.body,
88
- ...describeResultDetail(exact)].filter(Boolean).join('\n'));
92
+ return this.printJsonResult(exact);
93
+ return this.log([
94
+ `Result v${exact.version} ${exact.id}`,
95
+ exact.summary,
96
+ exact.body,
97
+ ...describeResultDetail(exact),
98
+ ]
99
+ .filter(Boolean)
100
+ .join('\n'));
89
101
  }
90
102
  catch (error) {
91
103
  return this.handleApiError(error);
@@ -99,7 +111,7 @@ class TasksResultShow extends base_command_1.BaseCommand {
99
111
  this.handleApiError(error);
100
112
  }
101
113
  if (flags.json)
102
- return this.log(JSON.stringify(result, null, 2));
114
+ return this.printJsonResult(result);
103
115
  const current = result.results.find((row) => row.id === result.currentResultId);
104
116
  if (!current)
105
117
  return this.log(await (0, task_legacy_1.emptyCanonicalView)(task.id, 'Result'));
@@ -73,11 +73,12 @@ export declare function taskExecutorLabel(t: Record<string, unknown>, bin?: stri
73
73
  * The `Next step:` lines for a Task that nobody has been chosen to do.
74
74
  *
75
75
  * `Why:` said "Choose an executor and assignee before this Task can start" (or,
76
- * for a started Task, that it "has no assigned executor") and nothing said how
76
+ * for a started Task, that nobody is assigned) and nothing said how
77
77
  * to do that (OSK-24355). The commands come from the one action→command map
78
78
  * (`taskActionRemedies`), keyed by the actions the server declared, with the
79
- * Task's ref filled in. Only the assignment actions print here; the rest are
80
- * listed by `tasks actionability`.
79
+ * Task's ref filled in. Only the assignment actions print here (and closing, for a
80
+ * started Task nobody is assigned to that carries a Result); the rest are listed by
81
+ * `tasks actionability`.
81
82
  *
82
83
  * Pure and exported so the wording is testable without an oclif runtime.
83
84
  */
@@ -160,15 +160,21 @@ function taskExecutorLabel(t, bin = 'skrr') {
160
160
  }
161
161
  /** The server actions whose commands `tasks show` prints under `Why:`: who does the Task. */
162
162
  const ASSIGNMENT_ACTIONS = new Set(['assign_task', 'set_execution_mode']);
163
+ /**
164
+ * Reasons whose next step is an assignment: nobody has been chosen to do the Task, or it was
165
+ * started with nobody assigned (OSK-20258), where the assignment says who is doing it.
166
+ */
167
+ const ASSIGNMENT_REASONS = new Set(['assignment_required', 'started_without_assignee']);
163
168
  /**
164
169
  * The `Next step:` lines for a Task that nobody has been chosen to do.
165
170
  *
166
171
  * `Why:` said "Choose an executor and assignee before this Task can start" (or,
167
- * for a started Task, that it "has no assigned executor") and nothing said how
172
+ * for a started Task, that nobody is assigned) and nothing said how
168
173
  * to do that (OSK-24355). The commands come from the one action→command map
169
174
  * (`taskActionRemedies`), keyed by the actions the server declared, with the
170
- * Task's ref filled in. Only the assignment actions print here; the rest are
171
- * listed by `tasks actionability`.
175
+ * Task's ref filled in. Only the assignment actions print here (and closing, for a
176
+ * started Task nobody is assigned to that carries a Result); the rest are listed by
177
+ * `tasks actionability`.
172
178
  *
173
179
  * Pure and exported so the wording is testable without an oclif runtime.
174
180
  */
@@ -177,15 +183,22 @@ function nextStepLines(t, bin = 'skrr') {
177
183
  if (!actionability || actionability.state === 'terminal')
178
184
  return [];
179
185
  const allowed = (Array.isArray(actionability.allowedActions) ? actionability.allowedActions : []).filter((row) => Boolean(row) && typeof row.action === 'string');
180
- const actions = allowed.filter((row) => ASSIGNMENT_ACTIONS.has(row.action));
181
- if (actionability.reasonCode === 'assignment_required' &&
186
+ // A started Task nobody is assigned to that carries a Result may simply be done: the server
187
+ // offers closing it beside the assignment, and its reason names closing first (OSK-20258).
188
+ const closable = actionability.reasonCode === 'started_without_assignee';
189
+ const actions = allowed.filter((row) => ASSIGNMENT_ACTIONS.has(row.action) || (closable && row.action === 'complete_task'));
190
+ if (ASSIGNMENT_REASONS.has(String(actionability.reasonCode)) &&
182
191
  !actions.some((row) => row.action === 'assign_task')) {
183
192
  actions.unshift({ action: 'assign_task' });
184
193
  }
185
194
  const ref = (typeof t.identifier === 'string' && t.identifier) ||
186
195
  (typeof t.id === 'string' && t.id) ||
187
196
  '<task-id>';
188
- const rows = (0, task_operations_1.taskActionRemedyRows)(actions.flatMap((row) => (0, task_operations_1.taskActionRemedies)(row.action, ref, row.targetId, bin, { allowedActions: allowed, task: t })));
197
+ const rows = (0, task_operations_1.taskActionRemedyRows)(actions.flatMap((row) => (0, task_operations_1.taskActionRemedies)(row.action, ref, row.targetId, bin, {
198
+ allowedActions: allowed,
199
+ task: t,
200
+ reasonCode: actionability.reasonCode,
201
+ })));
189
202
  return rows.map((row, index) => `${index === 0 ? 'Next step:' : ''}`.padEnd(13) + row);
190
203
  }
191
204
  function resolverLabel(by, names) {
@@ -487,8 +500,7 @@ class TasksShow extends base_command_1.BaseCommand {
487
500
  this.log(`Status: ${t.status ?? '-'}`);
488
501
  // The read a version-checked write is fenced on. Printed with the flag that
489
502
  // uses it, because a number on its own does not say what it is for.
490
- const version = (0, task_version_1.taskVersionOf)(t);
491
- this.log(`Version: ${version} (update only from this read: --expected-version ${version})`);
503
+ this.log((0, task_version_1.taskVersionLine)((0, task_version_1.taskVersionOf)(t)));
492
504
  // Immediately under Status, because "failed" is the row that raises the
493
505
  // question and this is the answer to it.
494
506
  for (const line of taskFailureLines(t, this.config.bin))
@@ -13,8 +13,7 @@ const task_admission_1 = require("../../lib/task-admission");
13
13
  const http_error_1 = require("../../lib/http-error");
14
14
  const TASK_START_REQUEST_ID_PATTERN = /^[A-Za-z0-9._:/-]{1,200}$/;
15
15
  class TasksStart extends base_command_1.BaseCommand {
16
- static description = 'Request execution of a Task by its assigned Agent. ' +
17
- 'Alias: tasks execute';
16
+ static description = 'Request execution of a Task by its assigned Agent. ' + 'Alias: tasks execute';
18
17
  // `tasks execute` is the verb a first-time user reaches for, and it was
19
18
  // "not a command" (OSK-12128). One command, two names.
20
19
  static aliases = ['tasks:execute'];
@@ -38,7 +37,10 @@ class TasksStart extends base_command_1.BaseCommand {
38
37
  };
39
38
  static flags = {
40
39
  json: core_1.Flags.boolean({ description: 'Output as JSON' }),
41
- 'dry-run': core_1.Flags.boolean({ description: 'Preview effective unattended execution prerequisites without creating a Run or checking out a branch', exclusive: ['branch'] }),
40
+ 'dry-run': core_1.Flags.boolean({
41
+ description: 'Preview effective unattended execution prerequisites without creating a Run or checking out a branch',
42
+ exclusive: ['branch'],
43
+ }),
42
44
  task: core_1.Flags.string({
43
45
  description: 'Task ID; overrides daemon runtime context',
44
46
  }),
@@ -56,8 +58,15 @@ class TasksStart extends base_command_1.BaseCommand {
56
58
  description: 'Stable idempotency key for this logical start. Reuse it after a lost response; inspect it with tasks start-receipt.',
57
59
  }),
58
60
  'orchestration-version': core_1.Flags.integer({ hidden: true, min: 0 }),
59
- 'orchestration-assign-agent': core_1.Flags.string({ hidden: true, dependsOn: ['orchestration-version'] }),
60
- 'orchestration-failed-run': core_1.Flags.string({ hidden: true, dependsOn: ['orchestration-version'], exclusive: ['orchestration-assign-agent'] }),
61
+ 'orchestration-assign-agent': core_1.Flags.string({
62
+ hidden: true,
63
+ dependsOn: ['orchestration-version'],
64
+ }),
65
+ 'orchestration-failed-run': core_1.Flags.string({
66
+ hidden: true,
67
+ dependsOn: ['orchestration-version'],
68
+ exclusive: ['orchestration-assign-agent'],
69
+ }),
61
70
  };
62
71
  async run() {
63
72
  this.requireAuth();
@@ -65,8 +74,13 @@ class TasksStart extends base_command_1.BaseCommand {
65
74
  const orchestrationVersion = flags['orchestration-version'];
66
75
  const assignAgentId = flags['orchestration-assign-agent'];
67
76
  const failedRunId = flags['orchestration-failed-run'];
68
- if (orchestrationVersion !== undefined && (process.env.OVERSKY_SPACE_ORCHESTRATION_WORK !== '1' ||
69
- !flags['request-id'] || flags.branch || flags['dry-run'] || flags.skill || flags.capability?.length)) {
77
+ if (orchestrationVersion !== undefined &&
78
+ (process.env.OVERSKY_SPACE_ORCHESTRATION_WORK !== '1' ||
79
+ !flags['request-id'] ||
80
+ flags.branch ||
81
+ flags['dry-run'] ||
82
+ flags.skill ||
83
+ flags.capability?.length)) {
70
84
  this.error('A scoped orchestration start requires the Duty runtime, a Task version and a request id.', { exit: 2 });
71
85
  }
72
86
  let taskIdentity;
@@ -106,7 +120,9 @@ class TasksStart extends base_command_1.BaseCommand {
106
120
  if (!(0, task_admission_1.isAdmissionPreview)(preview)) {
107
121
  this.failWithCliError({
108
122
  message: 'The server did not return a confirmed execution preview. Update the server before using --dry-run.',
109
- code: 'TASK_START_PREVIEW_UNSUPPORTED', exit: 2, retryable: false,
123
+ code: 'TASK_START_PREVIEW_UNSUPPORTED',
124
+ exit: 2,
125
+ retryable: false,
110
126
  });
111
127
  }
112
128
  const blocked = (0, task_admission_1.isAdmissionBlocked)(preview.executionAdmission);
@@ -175,19 +191,20 @@ class TasksStart extends base_command_1.BaseCommand {
175
191
  : null;
176
192
  if (prior && prior.state !== 'unknown') {
177
193
  if (flags.json)
178
- this.log(JSON.stringify(prior, null, 2));
194
+ this.printJsonResult(prior);
179
195
  else
180
196
  this.log(`Start request ${requestId} is ${prior.state}. Inspect it with ${this.config.bin} tasks start-receipt ${taskId} --request-id ${requestId}.`);
181
197
  return;
182
198
  }
183
199
  const input = await data_provider_1.dataService.submitTaskConversationInput(taskId, {
184
- action: 'start', commandKey: requestId,
200
+ action: 'start',
201
+ commandKey: requestId,
185
202
  expectedWorkflowGeneration: chat.workflowGeneration,
186
203
  expectedAuthorizationGeneration: chat.authorizationGeneration,
187
204
  expectedSpecVersion: chat.startInput.specVersion,
188
205
  });
189
206
  if (flags.json) {
190
- this.log(JSON.stringify({ taskId, requestId, input, ...(branch ? { branch } : {}) }, null, 2));
207
+ this.printJsonResult({ taskId, requestId, input, ...(branch ? { branch } : {}) });
191
208
  }
192
209
  else {
193
210
  if (branch)
@@ -202,7 +219,9 @@ class TasksStart extends base_command_1.BaseCommand {
202
219
  result = await data_provider_1.dataService.startTask(taskId, {
203
220
  ...(flags.skill ? { skillId: flags.skill } : {}),
204
221
  ...(flags.capability?.length ? { requestedCapabilities: flags.capability } : {}),
205
- ...(orchestrationVersion !== undefined ? { orchestration: { expectedVersion: orchestrationVersion, assignAgentId, failedRunId } } : {}),
222
+ ...(orchestrationVersion !== undefined
223
+ ? { orchestration: { expectedVersion: orchestrationVersion, assignAgentId, failedRunId } }
224
+ : {}),
206
225
  requestId,
207
226
  });
208
227
  }
@@ -213,7 +232,7 @@ class TasksStart extends base_command_1.BaseCommand {
213
232
  const waiting = waitingForMachine(err);
214
233
  if (waiting) {
215
234
  if (flags.json) {
216
- this.log(JSON.stringify({
235
+ this.printJsonResult({
217
236
  waiting: true,
218
237
  code: 'TASK_WAITING_FOR_MACHINE',
219
238
  taskId,
@@ -221,7 +240,7 @@ class TasksStart extends base_command_1.BaseCommand {
221
240
  requestId,
222
241
  ...(branch ? { branch } : {}),
223
242
  ...waiting,
224
- }, null, 2));
243
+ });
225
244
  return;
226
245
  }
227
246
  if (branch) {
@@ -243,13 +262,13 @@ class TasksStart extends base_command_1.BaseCommand {
243
262
  }
244
263
  if (flags.json) {
245
264
  const receipt = result.receipt || { requestId, state: 'accepted' };
246
- this.log(JSON.stringify({
265
+ this.printJsonResult({
247
266
  ...result,
248
267
  receipt,
249
268
  taskId,
250
269
  task: { ...taskIdentity, id: taskId },
251
270
  ...(branch ? { branch } : {}),
252
- }, null, 2));
271
+ });
253
272
  return;
254
273
  }
255
274
  this.log(`Accepted start request for task ${taskId}${flags.skill ? ` with skill ${flags.skill}` : ''}`);
@@ -627,6 +627,9 @@ class TasksUpdate extends base_command_1.BaseCommand {
627
627
  return;
628
628
  }
629
629
  this.log(`Updated task ${label} — ${t.title ?? '(no title)'}`);
630
+ const versionLine = (0, task_version_1.writtenTaskVersionLine)(t);
631
+ if (versionLine)
632
+ this.log(versionLine);
630
633
  if (flags.unassigned)
631
634
  this.log(`Executor intent: ${(0, tasks_2.taskAssignmentPreview)(t).executor.mode || 'unspecified'}; assignment: unassigned. No Run requested.`);
632
635
  if (unchanged)