@skrr-ai/cli 0.1.207 → 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 (168) 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.d.ts +31 -0
  5. package/dist/commands/agent/message/resolve.js +111 -0
  6. package/dist/commands/agent/message/retract.js +1 -1
  7. package/dist/commands/agent/message/send.d.ts +25 -6
  8. package/dist/commands/agent/message/send.js +135 -30
  9. package/dist/commands/agent/request/list.d.ts +15 -0
  10. package/dist/commands/agent/request/list.js +82 -0
  11. package/dist/commands/agent/request/send.d.ts +18 -0
  12. package/dist/commands/agent/request/send.js +56 -0
  13. package/dist/commands/agents/access/approve.d.ts +17 -0
  14. package/dist/commands/agents/access/approve.js +94 -0
  15. package/dist/commands/agents/access/deny.d.ts +10 -0
  16. package/dist/commands/agents/access/deny.js +36 -0
  17. package/dist/commands/agents/access/list.d.ts +10 -0
  18. package/dist/commands/agents/access/list.js +55 -0
  19. package/dist/commands/agents/access/reach.d.ts +13 -0
  20. package/dist/commands/agents/access/reach.js +53 -0
  21. package/dist/commands/agents/access/revoke.d.ts +13 -0
  22. package/dist/commands/agents/access/revoke.js +50 -0
  23. package/dist/commands/agents/always-on/recovery-review.d.ts +5 -0
  24. package/dist/commands/agents/always-on/recovery-review.js +16 -0
  25. package/dist/commands/agents/chat.d.ts +8 -0
  26. package/dist/commands/agents/chat.js +369 -90
  27. package/dist/commands/agents/import.d.ts +15 -1
  28. package/dist/commands/agents/import.js +212 -24
  29. package/dist/commands/agents/intuitions/accept.d.ts +0 -1
  30. package/dist/commands/agents/intuitions/accept.js +22 -7
  31. package/dist/commands/agents/intuitions/generate.d.ts +0 -1
  32. package/dist/commands/agents/intuitions/generate.js +4 -16
  33. package/dist/commands/agents/intuitions/list.js +9 -3
  34. package/dist/commands/agents/intuitions/resume.d.ts +11 -0
  35. package/dist/commands/agents/intuitions/resume.js +37 -0
  36. package/dist/commands/agents/manager/status.js +7 -6
  37. package/dist/commands/agents/not-for-task.d.ts +24 -0
  38. package/dist/commands/agents/not-for-task.js +60 -0
  39. package/dist/commands/agents/schedule-overview.d.ts +20 -0
  40. package/dist/commands/agents/schedule-overview.js +35 -2
  41. package/dist/commands/agents/shared-memory.d.ts +24 -0
  42. package/dist/commands/agents/shared-memory.js +67 -0
  43. package/dist/commands/agents/stop.d.ts +23 -0
  44. package/dist/commands/agents/stop.js +61 -0
  45. package/dist/commands/agents/update.d.ts +7 -0
  46. package/dist/commands/agents/update.js +45 -2
  47. package/dist/commands/agents/visibility.d.ts +1 -0
  48. package/dist/commands/agents/visibility.js +14 -0
  49. package/dist/commands/code/migrate.js +3 -1
  50. package/dist/commands/convos/messages.js +5 -0
  51. package/dist/commands/convos/transcript.js +2 -2
  52. package/dist/commands/daemon/logs.d.ts +3 -1
  53. package/dist/commands/daemon/logs.js +6 -2
  54. package/dist/commands/duties/advance-next.js +16 -7
  55. package/dist/commands/duties/preflight.js +17 -13
  56. package/dist/commands/followups/show.js +9 -0
  57. package/dist/commands/followups/watch-pr.d.ts +27 -0
  58. package/dist/commands/followups/watch-pr.js +124 -0
  59. package/dist/commands/harnesses/evaluations/evidence.js +2 -2
  60. package/dist/commands/harnesses/evaluations/grant.js +1 -1
  61. package/dist/commands/harnesses/evaluations/revoke.js +1 -1
  62. package/dist/commands/harnesses/evaluations/show.js +1 -1
  63. package/dist/commands/harnesses/rollouts/grant.js +1 -1
  64. package/dist/commands/harnesses/rollouts/revoke.js +1 -1
  65. package/dist/commands/machines/hosted/identity-evaluations/revoke.js +1 -1
  66. package/dist/commands/machines/hosted/identity-evaluations/show.js +1 -1
  67. package/dist/commands/memory/consolidation/index.d.ts +20 -0
  68. package/dist/commands/memory/consolidation/index.js +78 -0
  69. package/dist/commands/memory/consolidation/resume.d.ts +14 -0
  70. package/dist/commands/memory/consolidation/resume.js +46 -0
  71. package/dist/commands/memory/consolidation/undo.d.ts +18 -0
  72. package/dist/commands/memory/consolidation/undo.js +61 -0
  73. package/dist/commands/messages/list.js +9 -1
  74. package/dist/commands/slack/mutes.d.ts +10 -0
  75. package/dist/commands/slack/mutes.js +62 -0
  76. package/dist/commands/slack/unmute.d.ts +12 -0
  77. package/dist/commands/slack/unmute.js +44 -0
  78. package/dist/commands/tasks/actionability.js +10 -0
  79. package/dist/commands/tasks/ask.d.ts +50 -0
  80. package/dist/commands/tasks/ask.js +190 -0
  81. package/dist/commands/tasks/bulk-update.js +12 -0
  82. package/dist/commands/tasks/handover.js +14 -0
  83. package/dist/commands/tasks/input/answer.js +8 -2
  84. package/dist/commands/tasks/input/show.d.ts +26 -0
  85. package/dist/commands/tasks/input/show.js +185 -17
  86. package/dist/commands/tasks/list.d.ts +8 -0
  87. package/dist/commands/tasks/list.js +50 -9
  88. package/dist/commands/tasks/move.d.ts +3 -0
  89. package/dist/commands/tasks/move.js +71 -1
  90. package/dist/commands/tasks/result/show.js +19 -7
  91. package/dist/commands/tasks/result/submit.js +3 -0
  92. package/dist/commands/tasks/runs.d.ts +4 -1
  93. package/dist/commands/tasks/runs.js +22 -3
  94. package/dist/commands/tasks/show.d.ts +4 -3
  95. package/dist/commands/tasks/show.js +40 -7
  96. package/dist/commands/tasks/start.js +35 -16
  97. package/dist/commands/tasks/update.d.ts +1 -0
  98. package/dist/commands/tasks/update.js +55 -1
  99. package/dist/commands/tasks/updates/add.js +3 -0
  100. package/dist/commands/tasks/wait.d.ts +20 -0
  101. package/dist/commands/tasks/wait.js +103 -2
  102. package/dist/generated/agent-guides.json +892 -183
  103. package/dist/generated/managed-instruction-guides.json +1 -1
  104. package/dist/lib/agent-access-command.d.ts +19 -0
  105. package/dist/lib/agent-access-command.js +44 -0
  106. package/dist/lib/agent-access.d.ts +18 -0
  107. package/dist/lib/agent-access.js +48 -0
  108. package/dist/lib/agent-import/apply.d.ts +50 -0
  109. package/dist/lib/agent-import/apply.js +85 -0
  110. package/dist/lib/agent-import/plan.d.ts +132 -0
  111. package/dist/lib/agent-import/plan.js +504 -0
  112. package/dist/lib/agent-import/reader.d.ts +94 -0
  113. package/dist/lib/agent-import/reader.js +326 -0
  114. package/dist/lib/agent-import/schedule.d.ts +46 -0
  115. package/dist/lib/agent-import/schedule.js +220 -0
  116. package/dist/lib/agent-import/sources.d.ts +124 -0
  117. package/dist/lib/agent-import/sources.js +797 -0
  118. package/dist/lib/chat-stop.d.ts +17 -0
  119. package/dist/lib/chat-stop.js +70 -0
  120. package/dist/lib/cloud-reply.d.ts +21 -0
  121. package/dist/lib/cloud-reply.js +52 -0
  122. package/dist/lib/duties.js +24 -4
  123. package/dist/lib/duty-ledgers.js +19 -2
  124. package/dist/lib/file-mime.js +8 -0
  125. package/dist/lib/followups.d.ts +61 -0
  126. package/dist/lib/followups.js +39 -0
  127. package/dist/lib/handover-interview.d.ts +18 -0
  128. package/dist/lib/handover-interview.js +53 -0
  129. package/dist/lib/inbound-messages.d.ts +156 -0
  130. package/dist/lib/inbound-messages.js +375 -0
  131. package/dist/lib/input-queue.js +2 -1
  132. package/dist/lib/intuition-look.d.ts +10 -0
  133. package/dist/lib/intuition-look.js +64 -0
  134. package/dist/lib/message-intent.d.ts +18 -2
  135. package/dist/lib/message-intent.js +23 -1
  136. package/dist/lib/preflight-copy.d.ts +16 -1
  137. package/dist/lib/preflight-copy.js +33 -1
  138. package/dist/lib/record-output.d.ts +1 -1
  139. package/dist/lib/record-output.js +2 -0
  140. package/dist/lib/skill-import.d.ts +19 -0
  141. package/dist/lib/skill-import.js +34 -0
  142. package/dist/lib/slack-thread-mutes.d.ts +25 -0
  143. package/dist/lib/slack-thread-mutes.js +12 -0
  144. package/dist/lib/task-carriers.d.ts +18 -0
  145. package/dist/lib/task-carriers.js +43 -0
  146. package/dist/lib/task-extras.d.ts +5 -0
  147. package/dist/lib/task-extras.js +5 -0
  148. package/dist/lib/task-operations.d.ts +2 -0
  149. package/dist/lib/task-operations.js +28 -4
  150. package/dist/lib/task-preflight.js +1 -0
  151. package/dist/lib/task-recurrence-summary.d.ts +15 -0
  152. package/dist/lib/task-recurrence-summary.js +22 -0
  153. package/dist/lib/task-review-notice.d.ts +21 -0
  154. package/dist/lib/task-review-notice.js +46 -0
  155. package/dist/lib/task-version.d.ts +53 -0
  156. package/dist/lib/task-version.js +89 -0
  157. package/dist/lib/task-write-attribution.d.ts +7 -0
  158. package/dist/lib/task-write-attribution.js +14 -0
  159. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelopeBridge.js +6 -1
  160. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/turnPacing.d.ts +75 -0
  161. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/turnPacing.js +124 -0
  162. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelopeBridge.js +45 -15
  163. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/turnPacing.d.ts +75 -0
  164. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/turnPacing.js +141 -0
  165. package/dist/node_modules/@skrr-ai/auth-core/package.json +11 -1
  166. package/dist/node_modules/@skrr-ai/data-provider/index.js +13492 -12505
  167. package/oclif.manifest.json +2090 -132
  168. package/package.json +9 -2
@@ -1,38 +1,206 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.humanInputOptionsLine = humanInputOptionsLine;
4
+ exports.humanInputContextLines = humanInputContextLines;
5
+ exports.humanInputOptionDescriptionLines = humanInputOptionDescriptionLines;
6
+ exports.parseWaitTimeoutMs = parseWaitTimeoutMs;
7
+ exports.humanInputAnswerLines = humanInputAnswerLines;
3
8
  const core_1 = require("@oclif/core");
4
9
  const data_provider_1 = require("@skrr-ai/data-provider");
5
10
  const base_command_1 = require("../../../base-command");
11
+ const task_execution_1 = require("../../../lib/task-execution");
12
+ const WAIT_DURATION_RE = /^(\d+)\s*(s|m|h)?$/i;
13
+ /**
14
+ * A question's options as one line, the asker's recommendation marked. Marked,
15
+ * never chosen: the person (or the agent answering for them) still picks.
16
+ */
17
+ function humanInputOptionsLine(question) {
18
+ if (!question.options?.length)
19
+ return null;
20
+ return question.options
21
+ .map((option, position) => position === question.recommendedIndex ? `${option} (recommended)` : option)
22
+ .join(', ');
23
+ }
24
+ /**
25
+ * A question's background, under the question it explains: each of its lines
26
+ * indented by `indent`, so a context of several lines stays one block.
27
+ */
28
+ function humanInputContextLines(question, indent) {
29
+ if (!question.context?.trim())
30
+ return [];
31
+ return question.context
32
+ .trim()
33
+ .split(/\r?\n/)
34
+ .map((line) => `${indent}${line}`);
35
+ }
36
+ /**
37
+ * What each option means, one line per described option, under the options
38
+ * line and indented by `indent`: `Annual: billed once a year`. An option with
39
+ * no description gets no line.
40
+ */
41
+ function humanInputOptionDescriptionLines(question, indent) {
42
+ if (!question.options?.length || !question.optionDescriptions?.length)
43
+ return [];
44
+ return question.options.flatMap((option, position) => {
45
+ const description = question.optionDescriptions?.[position]?.replace(/\s+/g, ' ').trim();
46
+ return description ? [`${indent}${option}: ${description}`] : [];
47
+ });
48
+ }
49
+ /** `--timeout` for `--wait`: 90s, 10m, 2h (a bare number is seconds). */
50
+ function parseWaitTimeoutMs(value) {
51
+ if (value === undefined)
52
+ return null;
53
+ const match = value.trim().match(WAIT_DURATION_RE);
54
+ if (!match)
55
+ throw new Error(`--timeout takes a length such as 90s, 10m, 2h: ${value}`);
56
+ const unit = (match[2] || 's').toLowerCase();
57
+ return Number(match[1]) * (unit === 'h' ? 3_600_000 : unit === 'm' ? 60_000 : 1000);
58
+ }
59
+ /** Each answer as the asker reads it, beside the question it answers. */
60
+ function humanInputAnswerLines(request) {
61
+ const lines = [];
62
+ for (const [index, question] of request.questions.entries()) {
63
+ lines.push(`${index + 1}. ${question.header ? `${question.header}: ` : ''}${question.prompt}`);
64
+ lines.push(...humanInputContextLines(question, ' '));
65
+ const options = humanInputOptionsLine(question);
66
+ if (options)
67
+ lines.push(` Options: ${options}`);
68
+ lines.push(...humanInputOptionDescriptionLines(question, ' '));
69
+ const answer = request.answers?.find((a) => a.questionId === question.questionId);
70
+ if (answer) {
71
+ const value = [
72
+ ...(answer.selectedOptions || []),
73
+ ...(answer.freeText ? [answer.freeText] : []),
74
+ ]
75
+ .filter(Boolean)
76
+ .join(', ');
77
+ lines.push(` Answer: ${value}`);
78
+ }
79
+ }
80
+ return lines;
81
+ }
82
+ /** Seconds between reads while `--wait` polls the request. */
83
+ const DEFAULT_WAIT_INTERVAL_SECONDS = 5;
6
84
  class TasksInputShow extends base_command_1.BaseCommand {
7
- static description = 'Show the open Human-input request for a task';
85
+ static description = 'Show a Human-input request for a task: the open one, or one by id in any state with its answer (--request), waiting for it to be answered (--wait)';
86
+ static examples = [
87
+ '<%= config.bin %> tasks input show OSK-42',
88
+ '<%= config.bin %> tasks input show OSK-42 --request thi_... --wait --timeout 30m',
89
+ ];
8
90
  static args = {
9
91
  id: core_1.Args.string({ description: 'Task ID/ref', required: true, ignoreStdin: true }),
10
92
  };
11
- static flags = { json: core_1.Flags.boolean({ description: 'Output as JSON' }) };
93
+ static flags = {
94
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
95
+ request: core_1.Flags.string({
96
+ description: 'A request by id, in any state, with its answer once there is one',
97
+ }),
98
+ wait: core_1.Flags.boolean({
99
+ description: 'Wait until the request is no longer open (answered, expired or dismissed); with no --request, the current open one',
100
+ }),
101
+ timeout: core_1.Flags.string({
102
+ description: 'With --wait, stop waiting after 90s, 10m, 2h (default: until it closes)',
103
+ dependsOn: ['wait'],
104
+ }),
105
+ // No `default:` here. oclif fills a flag's default in BEFORE it checks `dependsOn`,
106
+ // so a defaulted `--interval` always "depends on --wait" and refused every plain
107
+ // read (`tasks input show <task> --json` exited 2). The default lives in run().
108
+ interval: core_1.Flags.integer({
109
+ description: `With --wait, seconds between reads (default: ${DEFAULT_WAIT_INTERVAL_SECONDS})`,
110
+ dependsOn: ['wait'],
111
+ }),
112
+ };
12
113
  async run() {
13
114
  this.requireAuth();
14
115
  const { args, flags } = await this.parse(TasksInputShow);
15
116
  const taskId = await this.resolveTaskReference(args.id);
16
- let response;
117
+ if (!flags.request && !flags.wait) {
118
+ let response;
119
+ try {
120
+ response = await data_provider_1.dataService.getTaskHumanInput(taskId);
121
+ }
122
+ catch (err) {
123
+ this.handleApiError(err);
124
+ }
125
+ if (flags.json) {
126
+ this.printJsonResult(response);
127
+ return;
128
+ }
129
+ if (!response.data) {
130
+ this.log('No open Human-input request.');
131
+ return;
132
+ }
133
+ this.log(`Request: ${response.data.requestId}`);
134
+ for (const line of humanInputAnswerLines(response.data))
135
+ this.log(line);
136
+ return;
137
+ }
138
+ let timeoutMs = null;
17
139
  try {
18
- response = await data_provider_1.dataService.getTaskHumanInput(taskId);
140
+ timeoutMs = parseWaitTimeoutMs(flags.timeout);
19
141
  }
20
142
  catch (err) {
21
- this.handleApiError(err);
143
+ this.failWithCliError({
144
+ message: err.message,
145
+ code: 'TASK_HUMAN_INPUT_WAIT_TIMEOUT_INVALID',
146
+ exit: 2,
147
+ retryable: false,
148
+ });
22
149
  }
23
- if (flags.json) {
24
- this.log(JSON.stringify(response, null, 2));
25
- return;
26
- }
27
- if (!response.data) {
28
- this.log('No open Human-input request.');
29
- return;
150
+ let requestId = flags.request;
151
+ if (!requestId) {
152
+ // --wait on the current question: take its id now, so the answer can be
153
+ // read after it stops being the open one.
154
+ try {
155
+ requestId = (await data_provider_1.dataService.getTaskHumanInput(taskId)).data?.requestId;
156
+ }
157
+ catch (err) {
158
+ this.handleApiError(err);
159
+ }
160
+ if (!requestId)
161
+ this.error('No open Human-input request exists for this task', { exit: 4 });
30
162
  }
31
- this.log(`Request: ${response.data.requestId}`);
32
- for (const [index, question] of response.data.questions.entries()) {
33
- this.log(`${index + 1}. ${question.header ? `${question.header}: ` : ''}${question.prompt}`);
34
- if (question.options?.length)
35
- this.log(` Options: ${question.options.join(', ')}`);
163
+ const startedAt = Date.now();
164
+ const intervalMs = Math.max(1, flags.interval ?? DEFAULT_WAIT_INTERVAL_SECONDS) * 1000;
165
+ let announced = false;
166
+ while (true) {
167
+ let request;
168
+ try {
169
+ request = (await data_provider_1.dataService.getTaskHumanInputRequest(taskId, requestId)).data;
170
+ }
171
+ catch (err) {
172
+ this.handleApiError(err);
173
+ }
174
+ if (!request)
175
+ this.error(`No Human-input request ${requestId} on this task`, { exit: 4 });
176
+ const open = request.status === 'open';
177
+ if (!flags.wait || !open) {
178
+ if (flags.json)
179
+ this.printJsonResult({ data: request }, { ok: !(flags.wait && request.status !== 'answered') });
180
+ else {
181
+ this.log(`Request: ${request.requestId} (${request.status})`);
182
+ for (const line of humanInputAnswerLines(request))
183
+ this.log(line);
184
+ }
185
+ // Waiting ends in one of three ways, and only an answer is the one
186
+ // the waiter asked for.
187
+ if (flags.wait && request.status !== 'answered')
188
+ this.exit(1);
189
+ return;
190
+ }
191
+ if (timeoutMs !== null && Date.now() - startedAt >= timeoutMs) {
192
+ this.failWithCliError({
193
+ message: `Request ${requestId} is still open after ${flags.timeout}.`,
194
+ code: 'TASK_HUMAN_INPUT_WAIT_TIMEOUT',
195
+ exit: 124,
196
+ retryable: true,
197
+ });
198
+ }
199
+ if (!announced && !flags.json) {
200
+ this.log(`Waiting for an answer to ${requestId}...`);
201
+ announced = true;
202
+ }
203
+ await (0, task_execution_1.sleep)(intervalMs);
36
204
  }
37
205
  }
38
206
  }
@@ -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,4 +1,6 @@
1
1
  import { BaseCommand } from '../../base-command';
2
+ import { unowedReviewNotice } from '../../lib/task-review-notice';
3
+ export { unowedReviewNotice };
2
4
  /**
3
5
  * `tasks move` is the documented way to change a task's status. The data
4
6
  * provider's `TaskUpdateParams` (used by `tasks update`) does not expose a
@@ -22,6 +24,7 @@ export default class TasksMove extends BaseCommand {
22
24
  reason: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
23
25
  'resolution-actor': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
24
26
  force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
27
+ 'expected-version': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
25
28
  };
26
29
  run(): Promise<void>;
27
30
  /**
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.unowedReviewNotice = void 0;
3
4
  const core_1 = require("@oclif/core");
4
5
  const data_provider_1 = require("@skrr-ai/data-provider");
5
6
  const api_fetch_1 = require("../../lib/api-fetch");
@@ -8,10 +9,13 @@ const workflow_state_hint_1 = require("../../lib/workflow-state-hint");
8
9
  const unsupported_managed_task_write_1 = require("../../lib/unsupported-managed-task-write");
9
10
  const session_task_write_1 = require("../../lib/session-task-write");
10
11
  const base_command_1 = require("../../base-command");
12
+ const task_version_1 = require("../../lib/task-version");
11
13
  const task_closure_1 = require("../../lib/task-closure");
12
14
  const web_url_1 = require("../../lib/web-url");
13
15
  const task_resolver_1 = require("../../lib/task-resolver");
14
16
  const projects_1 = require("../../lib/projects");
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; } });
15
19
  /**
16
20
  * `tasks move` is the documented way to change a task's status. The data
17
21
  * provider's `TaskUpdateParams` (used by `tasks update`) does not expose a
@@ -32,6 +36,7 @@ class TasksMove extends base_command_1.BaseCommand {
32
36
  '<%= config.bin %> tasks move <task-id> --status cancelled --json',
33
37
  '<%= config.bin %> tasks move <task-id> --project <project-id>',
34
38
  '<%= config.bin %> tasks move <task-id> --project none',
39
+ '<%= config.bin %> tasks move <task-id> --status done --expected-version 4',
35
40
  ];
36
41
  static args = {
37
42
  id: core_1.Args.string({
@@ -59,6 +64,10 @@ class TasksMove extends base_command_1.BaseCommand {
59
64
  force: core_1.Flags.boolean({
60
65
  description: "Close past an owner-declared required Review as a non-owner; the override is recorded on the task's resolution",
61
66
  }),
67
+ 'expected-version': core_1.Flags.integer({
68
+ min: 0,
69
+ description: task_version_1.EXPECTED_VERSION_FLAG_HELP,
70
+ }),
62
71
  };
63
72
  async run() {
64
73
  this.requireAuth();
@@ -97,6 +106,19 @@ class TasksMove extends base_command_1.BaseCommand {
97
106
  retryable: false,
98
107
  });
99
108
  }
109
+ const expectedVersion = flags['expected-version'];
110
+ // The fence covers the status move. A project change is a second write
111
+ // that the version-checked path cannot carry, and fencing half of one
112
+ // command would leave the other half unchecked without saying so.
113
+ if (expectedVersion !== undefined && projectId !== undefined) {
114
+ this.failWithCliError({
115
+ message: '--expected-version checks a status move, not a project change. Move the status with ' +
116
+ '--expected-version, then change the project in its own `tasks move --project` command.',
117
+ code: task_version_1.TASK_VERSION_FENCE_UNSUPPORTED,
118
+ exit: 2,
119
+ retryable: false,
120
+ });
121
+ }
100
122
  if (typeof projectId === 'string') {
101
123
  const placement = { projectId };
102
124
  await this.resolveTaskResourceReferences(placement, { taskId: taskRef });
@@ -106,6 +128,9 @@ class TasksMove extends base_command_1.BaseCommand {
106
128
  // server validates and applies these optional hold details after resolving
107
129
  // the state; a client must not guess from a display name.
108
130
  let updated;
131
+ // The server's tip when the move parked the Task with nothing to bring it back (REST answers it
132
+ // on the task as `_carrierGuidance`, the session door beside it as `carrierGuidance`).
133
+ let carrierGuidance;
109
134
  try {
110
135
  if (flags.status) {
111
136
  const sessionWrite = await (0, session_task_write_1.sessionTaskWrite)('move', taskRef);
@@ -118,9 +143,11 @@ class TasksMove extends base_command_1.BaseCommand {
118
143
  ...(flags.reason ? { reason: flags.reason } : {}),
119
144
  ...(flags['resolution-actor'] ? { resolutionActor: flags['resolution-actor'] } : {}),
120
145
  ...(flags.force ? { force: true } : {}),
146
+ ...(expectedVersion !== undefined ? { expectedVersion } : {}),
121
147
  },
122
148
  }));
123
149
  updated = res.task;
150
+ carrierGuidance = res.carrierGuidance;
124
151
  }
125
152
  else {
126
153
  updated = await data_provider_1.dataService.moveTask({
@@ -129,7 +156,10 @@ class TasksMove extends base_command_1.BaseCommand {
129
156
  reason: flags.reason,
130
157
  resolutionActor: flags['resolution-actor'],
131
158
  force: flags.force === true ? true : undefined,
159
+ expectedVersion,
132
160
  });
161
+ carrierGuidance = updated
162
+ ?._carrierGuidance;
133
163
  }
134
164
  // Held for approval by the Space write policy: nothing moved, and the
135
165
  // project change below is not sent on top of a held move.
@@ -148,6 +178,27 @@ class TasksMove extends base_command_1.BaseCommand {
148
178
  }
149
179
  }
150
180
  catch (err) {
181
+ const conflict = (0, task_version_1.taskVersionConflictOf)(err);
182
+ if (conflict) {
183
+ this.failWithCliError({
184
+ message: (0, task_version_1.describeTaskVersionConflict)({
185
+ // What the person typed, so the command they are told to run is
186
+ // the one they would have written.
187
+ taskRef: taskIdentity.id,
188
+ expectedVersion: conflict.expectedVersion ?? expectedVersion,
189
+ currentVersion: conflict.currentVersion,
190
+ bin: this.config.bin,
191
+ }),
192
+ code: task_version_1.TASK_VERSION_CONFLICT_CODE,
193
+ status: 409,
194
+ exit: 1,
195
+ retryable: false,
196
+ details: {
197
+ expectedVersion: conflict.expectedVersion ?? expectedVersion,
198
+ currentVersion: conflict.currentVersion,
199
+ },
200
+ });
201
+ }
151
202
  const unknownState = (0, workflow_state_hint_1.describeUnknownWorkflowState)((0, http_error_1.httpBodyOf)(err), this.config.bin);
152
203
  if (unknownState) {
153
204
  this.failWithCliError({
@@ -159,8 +210,15 @@ class TasksMove extends base_command_1.BaseCommand {
159
210
  }
160
211
  this.handleApiError(err);
161
212
  }
213
+ const reviewNotice = flags.status ? (0, task_review_notice_1.unowedReviewNotice)(updated, this.config.bin) : null;
162
214
  if (flags.json) {
163
- this.printJsonOperation((0, web_url_1.withTaskUrl)(this.cliConfig.baseURL, updated), {
215
+ // stderr, so the JSON on stdout stays one document.
216
+ if (reviewNotice)
217
+ this.logToStderr(reviewNotice);
218
+ this.printJsonOperation((0, web_url_1.withTaskUrl)(this.cliConfig.baseURL, {
219
+ ...updated,
220
+ ...(carrierGuidance ? { _carrierGuidance: carrierGuidance } : {}),
221
+ }), {
164
222
  resource: { kind: 'task', id: updated?.id },
165
223
  task: { id: updated?.id },
166
224
  });
@@ -175,6 +233,9 @@ class TasksMove extends base_command_1.BaseCommand {
175
233
  destinations.push(await this.describeProjectDestination(projectId, t));
176
234
  }
177
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}`);
178
239
  /*
179
240
  * Closing is the actor's call — the server does not refuse outstanding
180
241
  * work, it records it on `resolution.closure`. If the close just written
@@ -198,6 +259,15 @@ class TasksMove extends base_command_1.BaseCommand {
198
259
  for (const sentence of (0, task_closure_1.closureSnapshotLines)(resolutionClosure)) {
199
260
  this.log(` ${sentence}`);
200
261
  }
262
+ if (reviewNotice)
263
+ this.log(` ${reviewNotice}`);
264
+ // Advisory only: the move above committed. Printed so a person or an Agent that parked the Task
265
+ // sees, before it walks away, that nothing will bring it back, and how to arm something that will.
266
+ if (carrierGuidance?.code === 'no_carrier') {
267
+ this.log(` ${carrierGuidance.message}`);
268
+ for (const command of carrierGuidance.commands)
269
+ this.log(` ${command}`);
270
+ }
201
271
  }
202
272
  /**
203
273
  * Name the project the receipt lands in, resolving its title from the task's
@@ -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'));
@@ -202,6 +202,9 @@ class TasksResultSubmit extends base_command_1.BaseCommand {
202
202
  }, outcome)) {
203
203
  this.log(line);
204
204
  }
205
+ const started = (0, task_write_attribution_1.taskStartedLine)(result, task.id);
206
+ if (started)
207
+ this.log(started);
205
208
  for (const line of (0, task_closure_1.closureReport)(result.closure, { closing: false }))
206
209
  this.log(line);
207
210
  if (url)
@@ -48,7 +48,10 @@ export declare function runNeedsFailureReason(run: Record<string, unknown>): boo
48
48
  * `actedRunId` means the offer was taken and names the
49
49
  * continuation run.
50
50
  *
51
- * Both are absent on a server that predates them, so this returns null and the
51
+ * `handoverInterview` — on a continuation, the previous owner's handover notes
52
+ * or why there are none (§4.8); appended to the marker.
53
+ *
54
+ * All are absent on a server that predates them, so this returns null and the
52
55
  * column below is rendered only when at least one row carries a marker — a
53
56
  * healthy list against an older deployment pays and shows nothing.
54
57
  */