@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.
- package/dist/commands/agent/message/no-reply.js +1 -1
- package/dist/commands/agent/message/react.d.ts +23 -0
- package/dist/commands/agent/message/react.js +125 -0
- package/dist/commands/agent/message/resolve.d.ts +31 -0
- package/dist/commands/agent/message/resolve.js +111 -0
- package/dist/commands/agent/message/retract.js +1 -1
- package/dist/commands/agent/message/send.d.ts +25 -6
- package/dist/commands/agent/message/send.js +135 -30
- package/dist/commands/agent/request/list.d.ts +15 -0
- package/dist/commands/agent/request/list.js +82 -0
- package/dist/commands/agent/request/send.d.ts +18 -0
- package/dist/commands/agent/request/send.js +56 -0
- package/dist/commands/agents/access/approve.d.ts +17 -0
- package/dist/commands/agents/access/approve.js +94 -0
- package/dist/commands/agents/access/deny.d.ts +10 -0
- package/dist/commands/agents/access/deny.js +36 -0
- package/dist/commands/agents/access/list.d.ts +10 -0
- package/dist/commands/agents/access/list.js +55 -0
- package/dist/commands/agents/access/reach.d.ts +13 -0
- package/dist/commands/agents/access/reach.js +53 -0
- package/dist/commands/agents/access/revoke.d.ts +13 -0
- package/dist/commands/agents/access/revoke.js +50 -0
- package/dist/commands/agents/always-on/recovery-review.d.ts +5 -0
- package/dist/commands/agents/always-on/recovery-review.js +16 -0
- package/dist/commands/agents/chat.d.ts +8 -0
- package/dist/commands/agents/chat.js +369 -90
- package/dist/commands/agents/import.d.ts +15 -1
- package/dist/commands/agents/import.js +212 -24
- package/dist/commands/agents/intuitions/accept.d.ts +0 -1
- package/dist/commands/agents/intuitions/accept.js +22 -7
- package/dist/commands/agents/intuitions/generate.d.ts +0 -1
- package/dist/commands/agents/intuitions/generate.js +4 -16
- package/dist/commands/agents/intuitions/list.js +9 -3
- package/dist/commands/agents/intuitions/resume.d.ts +11 -0
- package/dist/commands/agents/intuitions/resume.js +37 -0
- package/dist/commands/agents/manager/status.js +7 -6
- package/dist/commands/agents/not-for-task.d.ts +24 -0
- package/dist/commands/agents/not-for-task.js +60 -0
- package/dist/commands/agents/schedule-overview.d.ts +20 -0
- package/dist/commands/agents/schedule-overview.js +35 -2
- package/dist/commands/agents/shared-memory.d.ts +24 -0
- package/dist/commands/agents/shared-memory.js +67 -0
- package/dist/commands/agents/stop.d.ts +23 -0
- package/dist/commands/agents/stop.js +61 -0
- package/dist/commands/agents/update.d.ts +7 -0
- package/dist/commands/agents/update.js +45 -2
- package/dist/commands/agents/visibility.d.ts +1 -0
- package/dist/commands/agents/visibility.js +14 -0
- package/dist/commands/code/migrate.js +3 -1
- package/dist/commands/convos/messages.js +5 -0
- package/dist/commands/convos/transcript.js +2 -2
- package/dist/commands/daemon/logs.d.ts +3 -1
- package/dist/commands/daemon/logs.js +6 -2
- package/dist/commands/duties/advance-next.js +16 -7
- package/dist/commands/duties/preflight.js +17 -13
- package/dist/commands/followups/show.js +9 -0
- package/dist/commands/followups/watch-pr.d.ts +27 -0
- package/dist/commands/followups/watch-pr.js +124 -0
- package/dist/commands/harnesses/evaluations/evidence.js +2 -2
- package/dist/commands/harnesses/evaluations/grant.js +1 -1
- package/dist/commands/harnesses/evaluations/revoke.js +1 -1
- package/dist/commands/harnesses/evaluations/show.js +1 -1
- package/dist/commands/harnesses/rollouts/grant.js +1 -1
- package/dist/commands/harnesses/rollouts/revoke.js +1 -1
- package/dist/commands/machines/hosted/identity-evaluations/revoke.js +1 -1
- package/dist/commands/machines/hosted/identity-evaluations/show.js +1 -1
- package/dist/commands/memory/consolidation/index.d.ts +20 -0
- package/dist/commands/memory/consolidation/index.js +78 -0
- package/dist/commands/memory/consolidation/resume.d.ts +14 -0
- package/dist/commands/memory/consolidation/resume.js +46 -0
- package/dist/commands/memory/consolidation/undo.d.ts +18 -0
- package/dist/commands/memory/consolidation/undo.js +61 -0
- package/dist/commands/messages/list.js +9 -1
- package/dist/commands/slack/mutes.d.ts +10 -0
- package/dist/commands/slack/mutes.js +62 -0
- package/dist/commands/slack/unmute.d.ts +12 -0
- package/dist/commands/slack/unmute.js +44 -0
- package/dist/commands/tasks/actionability.js +10 -0
- package/dist/commands/tasks/ask.d.ts +50 -0
- package/dist/commands/tasks/ask.js +190 -0
- package/dist/commands/tasks/bulk-update.js +12 -0
- package/dist/commands/tasks/handover.js +14 -0
- package/dist/commands/tasks/input/answer.js +8 -2
- package/dist/commands/tasks/input/show.d.ts +26 -0
- package/dist/commands/tasks/input/show.js +185 -17
- package/dist/commands/tasks/list.d.ts +8 -0
- package/dist/commands/tasks/list.js +50 -9
- package/dist/commands/tasks/move.d.ts +3 -0
- package/dist/commands/tasks/move.js +71 -1
- package/dist/commands/tasks/result/show.js +19 -7
- package/dist/commands/tasks/result/submit.js +3 -0
- package/dist/commands/tasks/runs.d.ts +4 -1
- package/dist/commands/tasks/runs.js +22 -3
- package/dist/commands/tasks/show.d.ts +4 -3
- package/dist/commands/tasks/show.js +40 -7
- package/dist/commands/tasks/start.js +35 -16
- package/dist/commands/tasks/update.d.ts +1 -0
- package/dist/commands/tasks/update.js +55 -1
- package/dist/commands/tasks/updates/add.js +3 -0
- package/dist/commands/tasks/wait.d.ts +20 -0
- package/dist/commands/tasks/wait.js +103 -2
- package/dist/generated/agent-guides.json +892 -183
- package/dist/generated/managed-instruction-guides.json +1 -1
- package/dist/lib/agent-access-command.d.ts +19 -0
- package/dist/lib/agent-access-command.js +44 -0
- package/dist/lib/agent-access.d.ts +18 -0
- package/dist/lib/agent-access.js +48 -0
- package/dist/lib/agent-import/apply.d.ts +50 -0
- package/dist/lib/agent-import/apply.js +85 -0
- package/dist/lib/agent-import/plan.d.ts +132 -0
- package/dist/lib/agent-import/plan.js +504 -0
- package/dist/lib/agent-import/reader.d.ts +94 -0
- package/dist/lib/agent-import/reader.js +326 -0
- package/dist/lib/agent-import/schedule.d.ts +46 -0
- package/dist/lib/agent-import/schedule.js +220 -0
- package/dist/lib/agent-import/sources.d.ts +124 -0
- package/dist/lib/agent-import/sources.js +797 -0
- package/dist/lib/chat-stop.d.ts +17 -0
- package/dist/lib/chat-stop.js +70 -0
- package/dist/lib/cloud-reply.d.ts +21 -0
- package/dist/lib/cloud-reply.js +52 -0
- package/dist/lib/duties.js +24 -4
- package/dist/lib/duty-ledgers.js +19 -2
- package/dist/lib/file-mime.js +8 -0
- package/dist/lib/followups.d.ts +61 -0
- package/dist/lib/followups.js +39 -0
- package/dist/lib/handover-interview.d.ts +18 -0
- package/dist/lib/handover-interview.js +53 -0
- package/dist/lib/inbound-messages.d.ts +156 -0
- package/dist/lib/inbound-messages.js +375 -0
- package/dist/lib/input-queue.js +2 -1
- package/dist/lib/intuition-look.d.ts +10 -0
- package/dist/lib/intuition-look.js +64 -0
- package/dist/lib/message-intent.d.ts +18 -2
- package/dist/lib/message-intent.js +23 -1
- package/dist/lib/preflight-copy.d.ts +16 -1
- package/dist/lib/preflight-copy.js +33 -1
- package/dist/lib/record-output.d.ts +1 -1
- package/dist/lib/record-output.js +2 -0
- package/dist/lib/skill-import.d.ts +19 -0
- package/dist/lib/skill-import.js +34 -0
- package/dist/lib/slack-thread-mutes.d.ts +25 -0
- package/dist/lib/slack-thread-mutes.js +12 -0
- package/dist/lib/task-carriers.d.ts +18 -0
- package/dist/lib/task-carriers.js +43 -0
- package/dist/lib/task-extras.d.ts +5 -0
- package/dist/lib/task-extras.js +5 -0
- package/dist/lib/task-operations.d.ts +2 -0
- package/dist/lib/task-operations.js +28 -4
- package/dist/lib/task-preflight.js +1 -0
- package/dist/lib/task-recurrence-summary.d.ts +15 -0
- package/dist/lib/task-recurrence-summary.js +22 -0
- package/dist/lib/task-review-notice.d.ts +21 -0
- package/dist/lib/task-review-notice.js +46 -0
- package/dist/lib/task-version.d.ts +53 -0
- package/dist/lib/task-version.js +89 -0
- package/dist/lib/task-write-attribution.d.ts +7 -0
- package/dist/lib/task-write-attribution.js +14 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelopeBridge.js +6 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/turnPacing.d.ts +75 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/turnPacing.js +124 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelopeBridge.js +45 -15
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/turnPacing.d.ts +75 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/turnPacing.js +141 -0
- package/dist/node_modules/@skrr-ai/auth-core/package.json +11 -1
- package/dist/node_modules/@skrr-ai/data-provider/index.js +13492 -12505
- package/oclif.manifest.json +2090 -132
- package/package.json +9 -2
|
@@ -14,6 +14,7 @@ const auth_core_1 = require("@skrr-ai/auth-core");
|
|
|
14
14
|
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
|
+
const handover_interview_1 = require("../../lib/handover-interview");
|
|
17
18
|
const activity_1 = require("./activity");
|
|
18
19
|
/**
|
|
19
20
|
* OSK-4836 — say WHERE a run executed. A named daemon wins over the environment
|
|
@@ -60,7 +61,10 @@ function formatRunAttempt(ref) {
|
|
|
60
61
|
? String(attempt.generation)
|
|
61
62
|
: null;
|
|
62
63
|
const identity = [kind, runId].filter(Boolean).join(':');
|
|
63
|
-
const counters = [
|
|
64
|
+
const counters = [
|
|
65
|
+
number ? `attempt ${number}` : null,
|
|
66
|
+
generation ? `generation ${generation}` : null,
|
|
67
|
+
]
|
|
64
68
|
.filter(Boolean)
|
|
65
69
|
.join(', ');
|
|
66
70
|
return [identity || null, counters || null].filter(Boolean).join(' · ') || null;
|
|
@@ -139,7 +143,10 @@ function runNeedsFailureReason(run) {
|
|
|
139
143
|
* `actedRunId` means the offer was taken and names the
|
|
140
144
|
* continuation run.
|
|
141
145
|
*
|
|
142
|
-
*
|
|
146
|
+
* `handoverInterview` — on a continuation, the previous owner's handover notes
|
|
147
|
+
* or why there are none (§4.8); appended to the marker.
|
|
148
|
+
*
|
|
149
|
+
* All are absent on a server that predates them, so this returns null and the
|
|
143
150
|
* column below is rendered only when at least one row carries a marker — a
|
|
144
151
|
* healthy list against an older deployment pays and shows nothing.
|
|
145
152
|
*/
|
|
@@ -152,7 +159,8 @@ function runHandoverMarker(run) {
|
|
|
152
159
|
typeof from.runId === 'string'
|
|
153
160
|
? ` ← ${String(from.runId)}`
|
|
154
161
|
: '';
|
|
155
|
-
|
|
162
|
+
const interview = (0, handover_interview_1.handoverInterviewMarker)(run.handoverInterview);
|
|
163
|
+
return `handover${fromRun}${interview ? ` · ${interview}` : ''}`;
|
|
156
164
|
}
|
|
157
165
|
const offer = run.handoverOffer;
|
|
158
166
|
if (offer && typeof offer === 'object') {
|
|
@@ -308,6 +316,17 @@ class TasksRuns extends base_command_1.BaseCommand {
|
|
|
308
316
|
...(showCleanup ? [{ key: 'cleanup', header: 'CLEANUP', maxWidth: 42 }] : []),
|
|
309
317
|
...(showHandover ? [{ key: 'handover', header: 'HANDOVER' }] : []),
|
|
310
318
|
], (line) => this.log(line));
|
|
319
|
+
// The previous owner's notes on each continuation, under the table: the column
|
|
320
|
+
// says where each interview stands, this says what the previous agent said.
|
|
321
|
+
for (const run of items) {
|
|
322
|
+
const lines = (0, handover_interview_1.renderHandoverInterview)(run.handoverInterview, { indent: ' ' });
|
|
323
|
+
if (!lines.length)
|
|
324
|
+
continue;
|
|
325
|
+
this.log('');
|
|
326
|
+
this.log(`Handover notes for ${String(run.runId ?? run.id ?? run._id ?? '-')}:`);
|
|
327
|
+
for (const line of lines)
|
|
328
|
+
this.log(line);
|
|
329
|
+
}
|
|
311
330
|
// Only once something failed: a healthy list pays nothing for this.
|
|
312
331
|
if (!unexplained)
|
|
313
332
|
return;
|
|
@@ -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
|
|
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
|
|
80
|
-
* listed by
|
|
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
|
*/
|
|
@@ -12,6 +12,7 @@ exports.recurrenceArmFailureLines = recurrenceArmFailureLines;
|
|
|
12
12
|
exports.taskFailureLines = taskFailureLines;
|
|
13
13
|
const core_1 = require("@oclif/core");
|
|
14
14
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
15
|
+
const task_carriers_1 = require("../../lib/task-carriers");
|
|
15
16
|
const api_fetch_1 = require("../../lib/api-fetch");
|
|
16
17
|
const session_task_endpoints_1 = require("../../lib/session-task-endpoints");
|
|
17
18
|
const base_command_1 = require("../../base-command");
|
|
@@ -27,6 +28,7 @@ const task_recurrence_outcome_1 = require("../../lib/task-recurrence-outcome");
|
|
|
27
28
|
const task_recurrence_summary_1 = require("../../lib/task-recurrence-summary");
|
|
28
29
|
const task_operations_1 = require("../../lib/task-operations");
|
|
29
30
|
const record_output_1 = require("../../lib/record-output");
|
|
31
|
+
const task_version_1 = require("../../lib/task-version");
|
|
30
32
|
/**
|
|
31
33
|
* Where to look next — as COMMANDS, not as facts about the task.
|
|
32
34
|
*
|
|
@@ -158,15 +160,21 @@ function taskExecutorLabel(t, bin = 'skrr') {
|
|
|
158
160
|
}
|
|
159
161
|
/** The server actions whose commands `tasks show` prints under `Why:`: who does the Task. */
|
|
160
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']);
|
|
161
168
|
/**
|
|
162
169
|
* The `Next step:` lines for a Task that nobody has been chosen to do.
|
|
163
170
|
*
|
|
164
171
|
* `Why:` said "Choose an executor and assignee before this Task can start" (or,
|
|
165
|
-
* for a started Task, that
|
|
172
|
+
* for a started Task, that nobody is assigned) and nothing said how
|
|
166
173
|
* to do that (OSK-24355). The commands come from the one action→command map
|
|
167
174
|
* (`taskActionRemedies`), keyed by the actions the server declared, with the
|
|
168
|
-
* Task's ref filled in. Only the assignment actions print here
|
|
169
|
-
* listed by
|
|
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`.
|
|
170
178
|
*
|
|
171
179
|
* Pure and exported so the wording is testable without an oclif runtime.
|
|
172
180
|
*/
|
|
@@ -175,15 +183,22 @@ function nextStepLines(t, bin = 'skrr') {
|
|
|
175
183
|
if (!actionability || actionability.state === 'terminal')
|
|
176
184
|
return [];
|
|
177
185
|
const allowed = (Array.isArray(actionability.allowedActions) ? actionability.allowedActions : []).filter((row) => Boolean(row) && typeof row.action === 'string');
|
|
178
|
-
|
|
179
|
-
|
|
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)) &&
|
|
180
191
|
!actions.some((row) => row.action === 'assign_task')) {
|
|
181
192
|
actions.unshift({ action: 'assign_task' });
|
|
182
193
|
}
|
|
183
194
|
const ref = (typeof t.identifier === 'string' && t.identifier) ||
|
|
184
195
|
(typeof t.id === 'string' && t.id) ||
|
|
185
196
|
'<task-id>';
|
|
186
|
-
const rows = (0, task_operations_1.taskActionRemedyRows)(actions.flatMap((row) => (0, task_operations_1.taskActionRemedies)(row.action, ref, row.targetId, bin, {
|
|
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
|
+
})));
|
|
187
202
|
return rows.map((row, index) => `${index === 0 ? 'Next step:' : ''}`.padEnd(13) + row);
|
|
188
203
|
}
|
|
189
204
|
function resolverLabel(by, names) {
|
|
@@ -442,7 +457,15 @@ class TasksShow extends base_command_1.BaseCommand {
|
|
|
442
457
|
(typeof t.taskNumber === 'number' || typeof t.taskNumber === 'string'
|
|
443
458
|
? `#${t.taskNumber}`
|
|
444
459
|
: undefined);
|
|
445
|
-
this.printJsonResult((0, record_output_1.shapeRecordResponse)({
|
|
460
|
+
this.printJsonResult((0, record_output_1.shapeRecordResponse)({
|
|
461
|
+
...t,
|
|
462
|
+
...(ref ? { ref } : {}),
|
|
463
|
+
...(url ? { url } : {}),
|
|
464
|
+
// Absent means never version-checked, which the server reads as 0, so
|
|
465
|
+
// the value a caller passes back as --expected-version is always here.
|
|
466
|
+
version: (0, task_version_1.taskVersionOf)(t),
|
|
467
|
+
completion,
|
|
468
|
+
}, { resource: 'task', fields: flags.fields, compact: flags.compact }));
|
|
446
469
|
return;
|
|
447
470
|
}
|
|
448
471
|
for (const line of (0, record_output_1.textModeRecordProjectionNotes)(flags))
|
|
@@ -475,6 +498,9 @@ class TasksShow extends base_command_1.BaseCommand {
|
|
|
475
498
|
if (url)
|
|
476
499
|
this.log(`URL: ${url}`);
|
|
477
500
|
this.log(`Status: ${t.status ?? '-'}`);
|
|
501
|
+
// The read a version-checked write is fenced on. Printed with the flag that
|
|
502
|
+
// uses it, because a number on its own does not say what it is for.
|
|
503
|
+
this.log((0, task_version_1.taskVersionLine)((0, task_version_1.taskVersionOf)(t)));
|
|
478
504
|
// Immediately under Status, because "failed" is the row that raises the
|
|
479
505
|
// question and this is the answer to it.
|
|
480
506
|
for (const line of taskFailureLines(t, this.config.bin))
|
|
@@ -654,6 +680,13 @@ class TasksShow extends base_command_1.BaseCommand {
|
|
|
654
680
|
? 'Workflow: ended · no next executor'
|
|
655
681
|
: `Next action: ${actionability.nextActor ?? '-'} · ${actionability.state ?? '-'} · ${actionability.reasonCode ?? '-'}`);
|
|
656
682
|
this.log(`Why: ${actionability.reason ?? '-'}`);
|
|
683
|
+
for (const line of (0, task_carriers_1.taskCarrierLines)(actionability, {
|
|
684
|
+
taskRef: String(t.identifier || t.id || ''),
|
|
685
|
+
bin: this.config.bin,
|
|
686
|
+
width: 13,
|
|
687
|
+
})) {
|
|
688
|
+
this.log(line);
|
|
689
|
+
}
|
|
657
690
|
for (const line of nextStepLines(t, this.config.bin))
|
|
658
691
|
this.log(line);
|
|
659
692
|
await this.printBlockerDetail(t, actionability);
|
|
@@ -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({
|
|
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({
|
|
60
|
-
|
|
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 &&
|
|
69
|
-
|
|
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',
|
|
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.
|
|
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',
|
|
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.
|
|
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
|
|
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.
|
|
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
|
-
}
|
|
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.
|
|
265
|
+
this.printJsonResult({
|
|
247
266
|
...result,
|
|
248
267
|
receipt,
|
|
249
268
|
taskId,
|
|
250
269
|
task: { ...taskIdentity, id: taskId },
|
|
251
270
|
...(branch ? { branch } : {}),
|
|
252
|
-
}
|
|
271
|
+
});
|
|
253
272
|
return;
|
|
254
273
|
}
|
|
255
274
|
this.log(`Accepted start request for task ${taskId}${flags.skill ? ` with skill ${flags.skill}` : ''}`);
|
|
@@ -68,6 +68,7 @@ export default class TasksUpdate extends BaseCommand {
|
|
|
68
68
|
'label-id': import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
69
69
|
'repair-release-pins': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
70
70
|
'working-directory': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
71
|
+
'expected-version': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
71
72
|
worktree: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
72
73
|
};
|
|
73
74
|
run(): Promise<void>;
|
|
@@ -11,6 +11,7 @@ const task_resolver_1 = require("../../lib/task-resolver");
|
|
|
11
11
|
const tasks_2 = require("../../lib/tasks");
|
|
12
12
|
const create_1 = require("./create");
|
|
13
13
|
const label_ref_1 = require("../../lib/label-ref");
|
|
14
|
+
const task_version_1 = require("../../lib/task-version");
|
|
14
15
|
class TasksUpdate extends base_command_1.BaseCommand {
|
|
15
16
|
static description = 'Update an existing task (partial patch). Status and PROJECT changes go through ' +
|
|
16
17
|
'`tasks move` — see `--goal` / `--space` below.';
|
|
@@ -24,6 +25,7 @@ class TasksUpdate extends base_command_1.BaseCommand {
|
|
|
24
25
|
'<%= config.bin %> tasks update <task-id> --add-assignee-user "Frank Du"',
|
|
25
26
|
'<%= config.bin %> tasks update <task-id> --add-blocked-by <blocker-task-id>',
|
|
26
27
|
'<%= config.bin %> tasks update <task-id> --from-json patch.json',
|
|
28
|
+
'<%= config.bin %> tasks update <task-id> --title "New title" --expected-version 4',
|
|
27
29
|
];
|
|
28
30
|
static args = {
|
|
29
31
|
id: core_1.Args.string({
|
|
@@ -212,6 +214,10 @@ class TasksUpdate extends base_command_1.BaseCommand {
|
|
|
212
214
|
'the daemon\'s filesystem. Overrides the agent\'s default. Pass "none" to ' +
|
|
213
215
|
'clear back to inheriting the agent default.',
|
|
214
216
|
}),
|
|
217
|
+
'expected-version': core_1.Flags.integer({
|
|
218
|
+
min: 0,
|
|
219
|
+
description: task_version_1.EXPECTED_VERSION_FLAG_HELP,
|
|
220
|
+
}),
|
|
215
221
|
worktree: core_1.Flags.boolean({
|
|
216
222
|
allowNo: true,
|
|
217
223
|
description: "Isolate this task's autonomous runs in a git worktree (--worktree) or force " +
|
|
@@ -462,6 +468,10 @@ class TasksUpdate extends base_command_1.BaseCommand {
|
|
|
462
468
|
// A mutation option, not a field — `undefined` unless explicitly asked
|
|
463
469
|
// for, so it never counts toward the "nothing to update" check below.
|
|
464
470
|
repairReleasePins: flags['repair-release-pins'] ? true : undefined,
|
|
471
|
+
// The version fence. A number here (from the flag or --from-json) sends
|
|
472
|
+
// the update down the server's optimistic-lock path, which is checked
|
|
473
|
+
// below for what it can carry.
|
|
474
|
+
expectedVersion: flags['expected-version'],
|
|
465
475
|
});
|
|
466
476
|
(0, tasks_2.applyExplicitTaskUnassignment)(payload, flags.unassigned === true);
|
|
467
477
|
const payloadKeys = Object.keys(payload);
|
|
@@ -502,6 +512,26 @@ class TasksUpdate extends base_command_1.BaseCommand {
|
|
|
502
512
|
retryable: false,
|
|
503
513
|
});
|
|
504
514
|
}
|
|
515
|
+
const expectedVersion = typeof payload.expectedVersion === 'number' ? payload.expectedVersion : undefined;
|
|
516
|
+
if (expectedVersion !== undefined) {
|
|
517
|
+
if (Object.keys(payload).every((key) => key === 'expectedVersion')) {
|
|
518
|
+
this.failWithCliError({
|
|
519
|
+
message: 'Nothing to update. Pass at least one flag (e.g. --title) or --from-json.',
|
|
520
|
+
code: 'EMPTY_TASK_UPDATE',
|
|
521
|
+
exit: 1,
|
|
522
|
+
retryable: false,
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
const fenceRefusal = (0, task_version_1.taskVersionFenceRefusal)(payload);
|
|
526
|
+
if (fenceRefusal) {
|
|
527
|
+
this.failWithCliError({
|
|
528
|
+
message: fenceRefusal,
|
|
529
|
+
code: task_version_1.TASK_VERSION_FENCE_UNSUPPORTED,
|
|
530
|
+
exit: 2,
|
|
531
|
+
retryable: false,
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
}
|
|
505
535
|
// Names/emails resolve against the space the task will be in AFTER this
|
|
506
536
|
// update (`payload.spaceId` when the update also moves it), falling back
|
|
507
537
|
// to the task's current space. Fetching the task is skipped entirely when
|
|
@@ -529,6 +559,27 @@ class TasksUpdate extends base_command_1.BaseCommand {
|
|
|
529
559
|
});
|
|
530
560
|
}
|
|
531
561
|
catch (err) {
|
|
562
|
+
const conflict = (0, task_version_1.taskVersionConflictOf)(err);
|
|
563
|
+
if (conflict) {
|
|
564
|
+
this.failWithCliError({
|
|
565
|
+
message: (0, task_version_1.describeTaskVersionConflict)({
|
|
566
|
+
// What the person typed, so the command they are told to run is
|
|
567
|
+
// the one they would have written.
|
|
568
|
+
taskRef: taskIdentity.id,
|
|
569
|
+
expectedVersion: conflict.expectedVersion ?? expectedVersion,
|
|
570
|
+
currentVersion: conflict.currentVersion,
|
|
571
|
+
bin: this.config.bin,
|
|
572
|
+
}),
|
|
573
|
+
code: task_version_1.TASK_VERSION_CONFLICT_CODE,
|
|
574
|
+
status: 409,
|
|
575
|
+
exit: 1,
|
|
576
|
+
retryable: false,
|
|
577
|
+
details: {
|
|
578
|
+
expectedVersion: conflict.expectedVersion ?? expectedVersion,
|
|
579
|
+
currentVersion: conflict.currentVersion,
|
|
580
|
+
},
|
|
581
|
+
});
|
|
582
|
+
}
|
|
532
583
|
// The server's refusal says "detach the goal with goalId: null", which is
|
|
533
584
|
// not something a CLI user can type. Name the id sent and `--goal none`.
|
|
534
585
|
const goalId = payload.goalId;
|
|
@@ -570,12 +621,15 @@ class TasksUpdate extends base_command_1.BaseCommand {
|
|
|
570
621
|
const label = `${t.id ?? t._id ?? taskRef}${ref ? ` (${ref})` : ''}`;
|
|
571
622
|
// The server's own answer about the estimate (OSK-16476): a no-op says so, never "Updated".
|
|
572
623
|
const unchanged = (0, task_economics_1.estimateUnchangedLine)(payload.economics, t);
|
|
573
|
-
const onlyEstimate = payloadKeys.every((key) => key === 'economics' || payload[key] === undefined);
|
|
624
|
+
const onlyEstimate = payloadKeys.every((key) => key === 'economics' || key === 'expectedVersion' || payload[key] === undefined);
|
|
574
625
|
if (unchanged && onlyEstimate) {
|
|
575
626
|
this.log(`Task ${label}: ${unchanged}`);
|
|
576
627
|
return;
|
|
577
628
|
}
|
|
578
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);
|
|
579
633
|
if (flags.unassigned)
|
|
580
634
|
this.log(`Executor intent: ${(0, tasks_2.taskAssignmentPreview)(t).executor.mode || 'unspecified'}; assignment: unassigned. No Run requested.`);
|
|
581
635
|
if (unchanged)
|
|
@@ -218,6 +218,9 @@ class TasksUpdatesAdd extends base_command_1.BaseCommand {
|
|
|
218
218
|
}, outcome)) {
|
|
219
219
|
this.log(line);
|
|
220
220
|
}
|
|
221
|
+
const started = (0, task_write_attribution_1.taskStartedLine)(result, task.id);
|
|
222
|
+
if (started)
|
|
223
|
+
this.log(started);
|
|
221
224
|
}
|
|
222
225
|
}
|
|
223
226
|
exports.default = TasksUpdatesAdd;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { BaseCommand } from '../../base-command';
|
|
2
|
+
import { type FollowUpRow } from '../../lib/followups';
|
|
2
3
|
export default class TasksWait extends BaseCommand {
|
|
4
|
+
static summary: string;
|
|
3
5
|
static description: string;
|
|
4
6
|
static examples: string[];
|
|
5
7
|
static args: {
|
|
@@ -14,6 +16,24 @@ export default class TasksWait extends BaseCommand {
|
|
|
14
16
|
'fail-on': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
17
|
interval: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
18
|
timeout: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
on: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
where: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
deadline: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
|
+
agent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
23
|
+
why: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
24
|
+
'max-fix-attempts': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
25
|
+
'reset-attempts': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
17
26
|
};
|
|
18
27
|
run(): Promise<void>;
|
|
28
|
+
private armWait;
|
|
29
|
+
}
|
|
30
|
+
export interface TaskWaitResponse {
|
|
31
|
+
task?: {
|
|
32
|
+
id?: string;
|
|
33
|
+
identifier?: string;
|
|
34
|
+
status?: string;
|
|
35
|
+
};
|
|
36
|
+
followup?: FollowUpRow | null;
|
|
37
|
+
reused?: boolean;
|
|
38
|
+
alreadyBlocked?: boolean;
|
|
19
39
|
}
|
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
4
5
|
const base_command_1 = require("../../base-command");
|
|
5
6
|
const task_resolver_1 = require("../../lib/task-resolver");
|
|
7
|
+
const task_extras_1 = require("../../lib/task-extras");
|
|
8
|
+
const tasks_1 = require("../../lib/tasks");
|
|
9
|
+
const followups_1 = require("../../lib/followups");
|
|
6
10
|
const task_execution_1 = require("../../lib/task-execution");
|
|
7
11
|
const PARSE_DURATION_MS_RE = /^(\d+)(ms|s|m|h)?$/i;
|
|
8
12
|
class TasksWait extends base_command_1.BaseCommand {
|
|
9
|
-
static
|
|
13
|
+
static summary = 'Block a task on a pull request or events, or wait for tasks to reach a status';
|
|
14
|
+
static description = [
|
|
15
|
+
'With --on, this arms a wait and blocks the task on it in one call: the task moves to blocked with the wait recorded as what it waits on, and moves back when the wait wakes its agent. --on owner/repo#n watches that pull request to the end (CI on its head, a conflict, a review, the merge or a close; fix attempts held by the server, as `skrr followups watch-pr`). --on <entity.event> (repeatable) wakes on the first of those events, filtered with --where field=value.',
|
|
16
|
+
'Without --on, this polls until the tasks reach a target status (--until), for scripts.',
|
|
17
|
+
].join('\n\n');
|
|
10
18
|
static examples = [
|
|
11
19
|
'<%= config.bin %> tasks wait <task-id> --until done',
|
|
12
20
|
'<%= config.bin %> tasks wait --until done',
|
|
13
21
|
'<%= config.bin %> tasks wait <task-id> --task <other-task-id> --until terminal',
|
|
14
22
|
'<%= config.bin %> tasks wait <root-task-id> --descendants --timeout 30m',
|
|
23
|
+
'<%= config.bin %> tasks wait OSK-42 --on acme/api#17',
|
|
24
|
+
'<%= config.bin %> tasks wait OSK-42 --on github.pull_request_merged --on github.pull_request_closed --where prNumber=17 --deadline 2d',
|
|
15
25
|
];
|
|
16
26
|
static args = {
|
|
17
27
|
id: core_1.Args.string({
|
|
@@ -37,6 +47,26 @@ class TasksWait extends base_command_1.BaseCommand {
|
|
|
37
47
|
}),
|
|
38
48
|
interval: core_1.Flags.integer({ description: 'Polling interval in seconds', default: 5 }),
|
|
39
49
|
timeout: core_1.Flags.string({ description: 'Timeout such as 30s, 10m, 2h' }),
|
|
50
|
+
on: core_1.Flags.string({
|
|
51
|
+
description: 'Block the task until this happens: a pull request (owner/repo#n or its URL), or an event <entity.event> (repeatable; the first to arrive wakes the agent)',
|
|
52
|
+
multiple: true,
|
|
53
|
+
}),
|
|
54
|
+
where: core_1.Flags.string({
|
|
55
|
+
description: 'With --on <event>: the event field that must equal a value, field=value (such as prNumber=17)',
|
|
56
|
+
}),
|
|
57
|
+
deadline: core_1.Flags.string({
|
|
58
|
+
description: 'With --on: when the wait stops if nothing arrived, 10m to 7d (default 6h)',
|
|
59
|
+
}),
|
|
60
|
+
agent: core_1.Flags.string({
|
|
61
|
+
description: "With --on: the agent the wait wakes (default: the session's agent, else the task's assignee)",
|
|
62
|
+
}),
|
|
63
|
+
why: core_1.Flags.string({ description: 'With --on: why the task waits, in one line' }),
|
|
64
|
+
'max-fix-attempts': core_1.Flags.integer({
|
|
65
|
+
description: `With --on <pr>: set the fix-attempt budget (1-${data_provider_1.PULL_REQUEST_WATCH_MAX_FIX_ATTEMPTS}). The owner's to set`,
|
|
66
|
+
}),
|
|
67
|
+
'reset-attempts': core_1.Flags.boolean({
|
|
68
|
+
description: "With --on <pr>: start the fix-attempt count again. The owner's to set",
|
|
69
|
+
}),
|
|
40
70
|
};
|
|
41
71
|
async run() {
|
|
42
72
|
this.requireAuth();
|
|
@@ -56,6 +86,21 @@ class TasksWait extends base_command_1.BaseCommand {
|
|
|
56
86
|
});
|
|
57
87
|
}
|
|
58
88
|
const taskRef = await this.resolveEntityRef('task', taskIdentity.id);
|
|
89
|
+
// What the person typed, for the sentences; the resolved id for the request.
|
|
90
|
+
const shownRef = args.id || taskRef;
|
|
91
|
+
if (flags.on?.length) {
|
|
92
|
+
await this.armWait(taskRef, shownRef, flags);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const onlyWithOn = ['where', 'deadline', 'agent', 'why', 'max-fix-attempts', 'reset-attempts'].filter((name) => flags[name] !== undefined && flags[name] !== false);
|
|
96
|
+
if (onlyWithOn.length) {
|
|
97
|
+
this.failWithCliError({
|
|
98
|
+
message: `--${onlyWithOn[0]} belongs to a wait on something: add --on <owner/repo#n> or --on <entity.event>, for example \`skrr tasks wait ${shownRef} --on acme/api#17\`.`,
|
|
99
|
+
code: 'TASK_WAIT_ON_REQUIRED',
|
|
100
|
+
exit: 2,
|
|
101
|
+
retryable: false,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
59
104
|
const failOn = (0, task_execution_1.parseStatusSet)(flags['fail-on'], task_execution_1.DEFAULT_FAIL_STATUSES);
|
|
60
105
|
let timeoutMs = null;
|
|
61
106
|
try {
|
|
@@ -92,7 +137,7 @@ class TasksWait extends base_command_1.BaseCommand {
|
|
|
92
137
|
snapshot.tasks.every((task) => (0, task_execution_1.satisfiesWaitTarget)(task, flags.until));
|
|
93
138
|
if (failed || satisfied) {
|
|
94
139
|
if (flags.json) {
|
|
95
|
-
this.
|
|
140
|
+
this.printJsonResult(snapshot, { ok: !failed });
|
|
96
141
|
}
|
|
97
142
|
else {
|
|
98
143
|
this.log(formatProgress(snapshot));
|
|
@@ -118,8 +163,64 @@ class TasksWait extends base_command_1.BaseCommand {
|
|
|
118
163
|
await (0, task_execution_1.sleep)(intervalMs);
|
|
119
164
|
}
|
|
120
165
|
}
|
|
166
|
+
async armWait(taskRef, shownRef, flags) {
|
|
167
|
+
const polling = POLLING_FLAGS.find((flag) => this.argv.some((token) => token === flag || token.startsWith(`${flag}=`)));
|
|
168
|
+
if (polling) {
|
|
169
|
+
this.failWithCliError({
|
|
170
|
+
message: `${polling} polls for a status and cannot be combined with --on, which arms a wait and returns at once. Run \`skrr tasks wait ${shownRef} --on ${flags.on[0]}\` alone, or drop --on to poll.`,
|
|
171
|
+
code: 'TASK_WAIT_MIXED_FORMS',
|
|
172
|
+
exit: 2,
|
|
173
|
+
retryable: false,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
const sessionAgent = (0, tasks_1.boundSessionAgentId)();
|
|
177
|
+
let response;
|
|
178
|
+
try {
|
|
179
|
+
response = (await task_extras_1.taskLookupApi.waitOn(taskRef, {
|
|
180
|
+
on: flags.on,
|
|
181
|
+
producer: sessionAgent ? 'agent_in_turn' : 'user_explicit',
|
|
182
|
+
...(flags.agent || sessionAgent ? { agentId: flags.agent || sessionAgent } : {}),
|
|
183
|
+
...(flags.where ? { where: flags.where } : {}),
|
|
184
|
+
...(flags.deadline ? { deadline: flags.deadline } : {}),
|
|
185
|
+
...(flags.why ? { why: flags.why } : {}),
|
|
186
|
+
...(flags['max-fix-attempts'] !== undefined
|
|
187
|
+
? { maxFixAttempts: flags['max-fix-attempts'] }
|
|
188
|
+
: {}),
|
|
189
|
+
...(flags['reset-attempts'] ? { resetAttempts: true } : {}),
|
|
190
|
+
}));
|
|
191
|
+
}
|
|
192
|
+
catch (err) {
|
|
193
|
+
this.handleApiError(err);
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
if (flags.json) {
|
|
197
|
+
this.printJsonResult(response);
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
for (const line of armedWaitLines(shownRef, response))
|
|
201
|
+
this.log(line);
|
|
202
|
+
}
|
|
121
203
|
}
|
|
122
204
|
exports.default = TasksWait;
|
|
205
|
+
/** Polling flags that mean nothing to an armed wait, which returns at once. */
|
|
206
|
+
const POLLING_FLAGS = [
|
|
207
|
+
'--until',
|
|
208
|
+
'--fail-on',
|
|
209
|
+
'--interval',
|
|
210
|
+
'--timeout',
|
|
211
|
+
'--task',
|
|
212
|
+
'--descendants',
|
|
213
|
+
'--children-only',
|
|
214
|
+
];
|
|
215
|
+
function armedWaitLines(taskRef, response) {
|
|
216
|
+
const row = response.followup;
|
|
217
|
+
const what = row ? ((0, followups_1.pullRequestLine)(row) ?? row.why ?? 'the wait') : 'the wait';
|
|
218
|
+
return [
|
|
219
|
+
`${response.reused ? 'Already waiting' : 'Blocked'}: ${response.task?.identifier ?? taskRef} is ${response.task?.status ?? 'blocked'} until ${what}${row?.deadlineAt ? `, or until ${row.deadlineAt}` : ''}.`,
|
|
220
|
+
`Wait ${row?.id ?? '—'} wakes the agent once and moves the task back; \`skrr followups show ${row?.id ?? '<id>'}\` says what woke it, or why it stopped.`,
|
|
221
|
+
...(row && (0, followups_1.stopReasonLine)(row) ? [(0, followups_1.stopReasonLine)(row)] : []),
|
|
222
|
+
];
|
|
223
|
+
}
|
|
123
224
|
function formatProgress(snapshot) {
|
|
124
225
|
const statuses = Object.entries(snapshot.counts)
|
|
125
226
|
.sort(([a], [b]) => a.localeCompare(b))
|