@skrr-ai/cli 0.1.165 → 0.1.167
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/base-command.js +0 -1
- package/dist/commands/activity/scan-older.d.ts +1 -1
- package/dist/commands/activity/scan-older.js +5 -4
- package/dist/commands/agent/message/approve.d.ts +1 -0
- package/dist/commands/agent/message/approve.js +6 -2
- package/dist/commands/agent/message/decline.d.ts +1 -0
- package/dist/commands/agent/message/decline.js +6 -2
- package/dist/commands/agent/message/pending.js +5 -2
- package/dist/commands/agent/message/review.d.ts +13 -0
- package/dist/commands/agent/message/review.js +68 -0
- package/dist/commands/agents/always-on/recovery-close.d.ts +28 -0
- package/dist/commands/agents/always-on/recovery-close.js +60 -0
- package/dist/commands/agents/always-on/recovery-review.d.ts +22 -0
- package/dist/commands/agents/always-on/recovery-review.js +190 -0
- package/dist/commands/apps/installations/compatibility.js +1 -1
- package/dist/commands/apps/installations/list.js +3 -0
- package/dist/commands/apps/installations/migrate/abort.d.ts +13 -0
- package/dist/commands/apps/installations/migrate/abort.js +45 -0
- package/dist/commands/apps/installations/migrate/cutover.d.ts +15 -0
- package/dist/commands/apps/installations/migrate/cutover.js +102 -0
- package/dist/commands/apps/installations/migrate/plan.d.ts +13 -0
- package/dist/commands/apps/installations/migrate/plan.js +51 -0
- package/dist/commands/apps/installations/migrate/rollback.d.ts +16 -0
- package/dist/commands/apps/installations/migrate/rollback.js +103 -0
- package/dist/commands/apps/installations/migrate/stage.d.ts +15 -0
- package/dist/commands/apps/installations/migrate/stage.js +96 -0
- package/dist/commands/apps/installations/migrate/status.d.ts +12 -0
- package/dist/commands/apps/installations/migrate/status.js +52 -0
- package/dist/commands/apps/installations/migrate/validate.d.ts +14 -0
- package/dist/commands/apps/installations/migrate/validate.js +58 -0
- package/dist/commands/apps/installations/show.js +8 -6
- package/dist/commands/apps/operations/check.js +1 -1
- package/dist/commands/apps/resume.js +1 -1
- package/dist/commands/apps/settings/set.js +22 -10
- package/dist/commands/duties/show.js +10 -0
- package/dist/commands/goals/key-results/assess.d.ts +2 -3
- package/dist/commands/goals/key-results/assess.js +5 -12
- package/dist/commands/harnesses/removal-references.d.ts +16 -0
- package/dist/commands/harnesses/removal-references.js +61 -0
- package/dist/commands/tasks/actionability.js +8 -3
- package/dist/commands/tasks/complete.js +35 -17
- package/dist/commands/tasks/expectations/assess.d.ts +1 -0
- package/dist/commands/tasks/expectations/assess.js +50 -21
- package/dist/commands/tasks/expectations.js +5 -2
- package/dist/commands/tasks/judge.d.ts +1 -0
- package/dist/commands/tasks/judge.js +17 -2
- package/dist/commands/tasks/result/submit.js +26 -17
- package/dist/commands/tasks/review-queue.js +2 -1
- package/dist/commands/tasks/review.d.ts +1 -0
- package/dist/commands/tasks/review.js +24 -3
- package/dist/commands/tasks/show.d.ts +13 -0
- package/dist/commands/tasks/show.js +41 -3
- package/dist/commands/tasks/updates/add.d.ts +1 -0
- package/dist/commands/tasks/updates/add.js +71 -21
- package/dist/commands/tasks/updates/list.d.ts +4 -0
- package/dist/commands/tasks/updates/list.js +3 -1
- package/dist/commands/tasks/waive.d.ts +1 -0
- package/dist/commands/tasks/waive.js +17 -2
- package/dist/generated/agent-guides.json +20 -20
- package/dist/lib/agent-activity.d.ts +3 -1
- package/dist/lib/agent-activity.js +50 -11
- package/dist/lib/api-fetch.js +32 -5
- package/dist/lib/appCompatibility.js +1 -1
- package/dist/lib/appData.d.ts +1 -1
- package/dist/lib/appData.js +6 -2
- package/dist/lib/appDataMigration.d.ts +204 -0
- package/dist/lib/appDataMigration.js +753 -0
- package/dist/lib/appDataMigrationCommand.d.ts +39 -0
- package/dist/lib/appDataMigrationCommand.js +90 -0
- package/dist/lib/appInstallations.d.ts +8 -0
- package/dist/lib/appInstallations.js +55 -2
- package/dist/lib/apps-command.js +17 -10
- package/dist/lib/harnesses.d.ts +24 -0
- package/dist/lib/harnesses.js +4 -0
- package/dist/lib/node-adapter.d.ts +0 -2
- package/dist/lib/node-adapter.js +46 -42
- package/dist/lib/rate-limit-retry.d.ts +4 -5
- package/dist/lib/rate-limit-retry.js +6 -10
- package/dist/lib/reference-syntax.d.ts +28 -0
- package/dist/lib/reference-syntax.js +91 -0
- package/dist/lib/refresh.d.ts +2 -0
- package/dist/lib/refresh.js +6 -0
- package/dist/lib/runtime-context.js +6 -0
- package/dist/lib/task-closure.d.ts +1 -1
- package/dist/lib/task-closure.js +1 -1
- package/dist/lib/task-operations.d.ts +28 -6
- package/dist/lib/task-operations.js +77 -4
- package/dist/lib/task-preflight.js +8 -3
- package/dist/lib/task-write-attribution.d.ts +183 -19
- package/dist/lib/task-write-attribution.js +270 -39
- package/dist/lib/write-outcome.d.ts +2 -0
- package/dist/lib/write-outcome.js +14 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.js +63 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.js +71 -0
- package/dist/node_modules/@skrr-ai/data-provider/index.js +11635 -11306
- package/oclif.manifest.json +1387 -412
- package/package.json +5 -2
|
@@ -4,13 +4,13 @@ const node_crypto_1 = require("node:crypto");
|
|
|
4
4
|
const core_1 = require("@oclif/core");
|
|
5
5
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
6
6
|
const base_command_1 = require("../../../base-command");
|
|
7
|
+
const reference_syntax_1 = require("../../../lib/reference-syntax");
|
|
7
8
|
const task_resolver_1 = require("../../../lib/task-resolver");
|
|
8
9
|
const web_url_1 = require("../../../lib/web-url");
|
|
9
10
|
const api_fetch_1 = require("../../../lib/api-fetch");
|
|
10
11
|
const task_closure_1 = require("../../../lib/task-closure");
|
|
11
12
|
const session_task_write_1 = require("../../../lib/session-task-write");
|
|
12
13
|
const task_write_attribution_1 = require("../../../lib/task-write-attribution");
|
|
13
|
-
const RUN_RE = /^https?:|^file:/;
|
|
14
14
|
function parseJson(value, label) {
|
|
15
15
|
if (!value)
|
|
16
16
|
return undefined;
|
|
@@ -38,15 +38,17 @@ class TasksResultSubmit extends base_command_1.BaseCommand {
|
|
|
38
38
|
'conclusion-json': core_1.Flags.string({ description: 'JSON value for the domain conclusion' }),
|
|
39
39
|
'structured-schema': core_1.Flags.string({ description: 'Schema name for --structured-json' }),
|
|
40
40
|
'structured-json': core_1.Flags.string({ description: 'Task-type-specific structured Result JSON' }),
|
|
41
|
-
'source-attachment': core_1.Flags.string({
|
|
42
|
-
|
|
41
|
+
'source-attachment': core_1.Flags.string({
|
|
42
|
+
multiple: true,
|
|
43
|
+
description: 'Exact Task JSON attachment ID; server records its literal declarations separately from this Result interpretation (up to four)',
|
|
44
|
+
}),
|
|
43
45
|
deliverable: core_1.Flags.string({
|
|
44
46
|
multiple: true,
|
|
45
47
|
description: 'Task Resource link id (repeatable)',
|
|
46
48
|
}),
|
|
47
49
|
evidence: core_1.Flags.string({
|
|
48
50
|
multiple: true,
|
|
49
|
-
description: 'Evidence reference as <kind>:<id-or-uri>',
|
|
51
|
+
description: 'Evidence reference as <kind>:<id-or-uri> or a URL (repeatable)',
|
|
50
52
|
}),
|
|
51
53
|
attach: core_1.Flags.string({
|
|
52
54
|
multiple: true,
|
|
@@ -88,14 +90,13 @@ class TasksResultSubmit extends base_command_1.BaseCommand {
|
|
|
88
90
|
(typeof structuredValue !== 'object' || Array.isArray(structuredValue))) {
|
|
89
91
|
this.error('--structured-json must contain a JSON object', { exit: 1 });
|
|
90
92
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
});
|
|
93
|
+
let evidenceRefs = [];
|
|
94
|
+
try {
|
|
95
|
+
evidenceRefs = (0, reference_syntax_1.parseReferences)(flags.evidence, '--evidence');
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
this.error(error.message, { exit: 1 });
|
|
99
|
+
}
|
|
99
100
|
// --attach: upload first so the Result cites real asset ids. Uploads land
|
|
100
101
|
// before the idempotency key is derived, so a retry sees the same refs.
|
|
101
102
|
if (flags.attach?.length) {
|
|
@@ -161,7 +162,12 @@ class TasksResultSubmit extends base_command_1.BaseCommand {
|
|
|
161
162
|
credential: sessionWrite.credential,
|
|
162
163
|
body: data,
|
|
163
164
|
})
|
|
164
|
-
: await data_provider_1.dataService.submitTaskResult({
|
|
165
|
+
: await data_provider_1.dataService.submitTaskResult({
|
|
166
|
+
taskId: task.id,
|
|
167
|
+
// A person's write names the coding agent this shell runs inside, when one was
|
|
168
|
+
// detected. Recorded as declared, never trusted (`declaredToolSource`).
|
|
169
|
+
data: { ...data, ...(0, task_write_attribution_1.declaredToolSource)() },
|
|
170
|
+
});
|
|
165
171
|
}
|
|
166
172
|
catch (error) {
|
|
167
173
|
// A closed Task refuses a Result. Name the way forward here, where the
|
|
@@ -174,9 +180,9 @@ class TasksResultSubmit extends base_command_1.BaseCommand {
|
|
|
174
180
|
this.handleApiError(error);
|
|
175
181
|
}
|
|
176
182
|
const url = (0, web_url_1.taskUrlFrom)(this.cliConfig.baseURL, { id: task.id });
|
|
177
|
-
const
|
|
183
|
+
const outcome = (0, task_write_attribution_1.taskWriteOutcome)(result, 'result');
|
|
178
184
|
if (flags.json)
|
|
179
|
-
return this.printJsonOperation({ ...result, url, attribution }, {
|
|
185
|
+
return this.printJsonOperation({ ...result, url, ...outcome, attribution: (0, task_write_attribution_1.receiptAttribution)(result, 'result') }, {
|
|
180
186
|
resource: { kind: 'task_result', id: result?.result?.id },
|
|
181
187
|
task: { id: result?.result?.taskId },
|
|
182
188
|
...(typeof result?.idempotent === 'boolean' ? { replayed: result.idempotent } : {}),
|
|
@@ -188,9 +194,12 @@ class TasksResultSubmit extends base_command_1.BaseCommand {
|
|
|
188
194
|
// managed instructions told the agent to read the status the call returns,
|
|
189
195
|
// which the call did not carry. Submitting a Result is not closing a Task;
|
|
190
196
|
// the response now reports where it stands and this prints exactly that.
|
|
191
|
-
|
|
192
|
-
|
|
197
|
+
for (const line of (0, task_write_attribution_1.taskWriteOutcomeLines)({
|
|
198
|
+
verb: 'Submitted',
|
|
199
|
+
what: `Result v${result.result.version} (${result.result.id}) for ${task.id}`,
|
|
200
|
+
}, outcome)) {
|
|
193
201
|
this.log(line);
|
|
202
|
+
}
|
|
194
203
|
for (const line of (0, task_closure_1.closureReport)(result.closure, { closing: false }))
|
|
195
204
|
this.log(line);
|
|
196
205
|
if (url)
|
|
@@ -256,7 +256,8 @@ class TasksReviewQueue extends base_command_1.BaseCommand {
|
|
|
256
256
|
? ` on ${String(expectation.assessedAt).slice(0, 10)}`
|
|
257
257
|
: '';
|
|
258
258
|
const why = expectation.reason ? `: ${expectation.reason}` : '';
|
|
259
|
-
|
|
259
|
+
const who = (0, task_closure_1.describeAssessor)(expectation.assessedByKind, expectation.assessedByVia, expectation.assessedByDeclaredTool);
|
|
260
|
+
this.log(` ${decision} by ${who}${when}${why}`);
|
|
260
261
|
}
|
|
261
262
|
if (expectation.evidenceLevel) {
|
|
262
263
|
this.log(` evidence: ${expectation.evidenceLevel}${expectation.requiredEvidence ? ` (asked for ${expectation.requiredEvidence})` : ''}`);
|
|
@@ -11,6 +11,7 @@ export default class TasksReview extends BaseCommand {
|
|
|
11
11
|
rationale: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
12
|
'run-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
13
|
'idempotency-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
'confirm-as-me': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
15
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
16
|
};
|
|
16
17
|
run(): Promise<void>;
|
|
@@ -7,6 +7,7 @@ const base_command_1 = require("../../base-command");
|
|
|
7
7
|
const task_resolver_1 = require("../../lib/task-resolver");
|
|
8
8
|
const api_fetch_1 = require("../../lib/api-fetch");
|
|
9
9
|
const session_task_write_1 = require("../../lib/session-task-write");
|
|
10
|
+
const task_write_attribution_1 = require("../../lib/task-write-attribution");
|
|
10
11
|
class TasksReview extends base_command_1.BaseCommand {
|
|
11
12
|
static description = 'Accept or request changes on one exact Task Result';
|
|
12
13
|
static args = {
|
|
@@ -19,6 +20,7 @@ class TasksReview extends base_command_1.BaseCommand {
|
|
|
19
20
|
rationale: core_1.Flags.string({ description: 'Why this Result was accepted or needs changes' }),
|
|
20
21
|
'run-id': core_1.Flags.string({ description: 'Canonical reviewer Run for a generic API call' }),
|
|
21
22
|
'idempotency-key': core_1.Flags.string({ description: 'Stable retry key' }),
|
|
23
|
+
'confirm-as-me': task_write_attribution_1.confirmAsMeFlag,
|
|
22
24
|
json: core_1.Flags.boolean({ description: 'Output JSON' }),
|
|
23
25
|
};
|
|
24
26
|
async run() {
|
|
@@ -26,6 +28,17 @@ class TasksReview extends base_command_1.BaseCommand {
|
|
|
26
28
|
this.requireAuth();
|
|
27
29
|
const { args, flags } = await this.parse(TasksReview);
|
|
28
30
|
const task = (0, task_resolver_1.resolveTaskIdentity)({ positionalId: args.task, flagTask: flags.task });
|
|
31
|
+
// A Review is a judgement. From a coding agent in the person's own terminal it would be
|
|
32
|
+
// recorded as the person's, so ask before writing it (see `lib/task-write-attribution.ts`).
|
|
33
|
+
const refusal = (0, task_write_attribution_1.personJudgementGate)(this, {
|
|
34
|
+
confirmed: flags['confirm-as-me'],
|
|
35
|
+
judgement: flags.decision === 'accepted'
|
|
36
|
+
? `accepting Result ${flags['result-id']}`
|
|
37
|
+
: `requesting changes on Result ${flags['result-id']}`,
|
|
38
|
+
task: task.id,
|
|
39
|
+
});
|
|
40
|
+
if (refusal)
|
|
41
|
+
this.failWithCliError({ ...refusal, exit: 1, retryable: false });
|
|
29
42
|
const payload = {
|
|
30
43
|
resultId: flags['result-id'],
|
|
31
44
|
runId: flags['run-id'],
|
|
@@ -41,18 +54,26 @@ class TasksReview extends base_command_1.BaseCommand {
|
|
|
41
54
|
const sessionWrite = await (0, session_task_write_1.sessionTaskWrite)('review', task.id);
|
|
42
55
|
result = sessionWrite
|
|
43
56
|
? await (0, api_fetch_1.apiFetch)(sessionWrite.path, { method: 'POST', body: data, credential: sessionWrite.credential })
|
|
44
|
-
: await data_provider_1.dataService.reviewTaskResult({
|
|
57
|
+
: await data_provider_1.dataService.reviewTaskResult({
|
|
58
|
+
taskId: task.id,
|
|
59
|
+
// A person's write names the coding agent this shell runs inside, when one was
|
|
60
|
+
// detected. Recorded as declared, never trusted (`declaredToolSource`).
|
|
61
|
+
data: { ...data, ...(0, task_write_attribution_1.declaredToolSource)() },
|
|
62
|
+
});
|
|
45
63
|
}
|
|
46
64
|
catch (error) {
|
|
47
65
|
this.handleApiError(error);
|
|
48
66
|
}
|
|
67
|
+
const outcome = (0, task_write_attribution_1.taskWriteOutcome)(result, 'review');
|
|
49
68
|
if (flags.json)
|
|
50
|
-
return this.printJsonOperation(result, {
|
|
69
|
+
return this.printJsonOperation({ ...result, ...outcome }, {
|
|
51
70
|
resource: { kind: 'task_review', id: result?.review?.id },
|
|
52
71
|
task: { id: result?.review?.taskId },
|
|
53
72
|
...(typeof result?.idempotent === 'boolean' ? { replayed: result.idempotent } : {}),
|
|
54
73
|
});
|
|
55
|
-
|
|
74
|
+
for (const line of (0, task_write_attribution_1.taskWriteOutcomeLines)({ verb: 'Recorded', what: `Review: ${flags.decision} for Result ${flags['result-id']}` }, outcome)) {
|
|
75
|
+
this.log(line);
|
|
76
|
+
}
|
|
56
77
|
}
|
|
57
78
|
}
|
|
58
79
|
exports.default = TasksReview;
|
|
@@ -69,6 +69,19 @@ export declare function labelsLine(labelIds?: string[], nameById?: Map<string, s
|
|
|
69
69
|
* reassigning the task changes only the implied kind.
|
|
70
70
|
*/
|
|
71
71
|
export declare function taskExecutorLabel(t: Record<string, unknown>, bin?: string): string;
|
|
72
|
+
/**
|
|
73
|
+
* The `Next step:` lines for a Task that nobody has been chosen to do.
|
|
74
|
+
*
|
|
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
|
|
77
|
+
* to do that (OSK-24355). The commands come from the one action→command map
|
|
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`.
|
|
81
|
+
*
|
|
82
|
+
* Pure and exported so the wording is testable without an oclif runtime.
|
|
83
|
+
*/
|
|
84
|
+
export declare function nextStepLines(t: Record<string, unknown>, bin?: string): string[];
|
|
72
85
|
/**
|
|
73
86
|
* The `Resolution:` lines for any resolved Task: how it ended, the reason the
|
|
74
87
|
* closer recorded, who closed it, and what the close stood on. The reason used to
|
|
@@ -6,6 +6,7 @@ exports.completionLines = completionLines;
|
|
|
6
6
|
exports.reviewPolicyLine = reviewPolicyLine;
|
|
7
7
|
exports.labelsLine = labelsLine;
|
|
8
8
|
exports.taskExecutorLabel = taskExecutorLabel;
|
|
9
|
+
exports.nextStepLines = nextStepLines;
|
|
9
10
|
exports.resolutionLines = resolutionLines;
|
|
10
11
|
exports.recurrenceArmFailureLines = recurrenceArmFailureLines;
|
|
11
12
|
exports.taskFailureLines = taskFailureLines;
|
|
@@ -24,6 +25,7 @@ const task_economics_line_1 = require("../../lib/task-economics-line");
|
|
|
24
25
|
const format_1 = require("../../lib/format");
|
|
25
26
|
const task_recurrence_outcome_1 = require("../../lib/task-recurrence-outcome");
|
|
26
27
|
const task_recurrence_summary_1 = require("../../lib/task-recurrence-summary");
|
|
28
|
+
const task_operations_1 = require("../../lib/task-operations");
|
|
27
29
|
const record_output_1 = require("../../lib/record-output");
|
|
28
30
|
/**
|
|
29
31
|
* Where to look next — as COMMANDS, not as facts about the task.
|
|
@@ -154,6 +156,36 @@ function taskExecutorLabel(t, bin = 'skrr') {
|
|
|
154
156
|
return '-';
|
|
155
157
|
}
|
|
156
158
|
}
|
|
159
|
+
/** The server actions whose commands `tasks show` prints under `Why:`: who does the Task. */
|
|
160
|
+
const ASSIGNMENT_ACTIONS = new Set(['assign_task', 'set_execution_mode']);
|
|
161
|
+
/**
|
|
162
|
+
* The `Next step:` lines for a Task that nobody has been chosen to do.
|
|
163
|
+
*
|
|
164
|
+
* `Why:` said "Choose an executor and assignee before this Task can start" (or,
|
|
165
|
+
* for a started Task, that it "has no assigned executor") and nothing said how
|
|
166
|
+
* to do that (OSK-24355). The commands come from the one action→command map
|
|
167
|
+
* (`taskActionRemedies`), keyed by the actions the server declared, with the
|
|
168
|
+
* Task's ref filled in. Only the assignment actions print here; the rest are
|
|
169
|
+
* listed by `tasks actionability`.
|
|
170
|
+
*
|
|
171
|
+
* Pure and exported so the wording is testable without an oclif runtime.
|
|
172
|
+
*/
|
|
173
|
+
function nextStepLines(t, bin = 'skrr') {
|
|
174
|
+
const actionability = t.actionability;
|
|
175
|
+
if (!actionability || actionability.state === 'terminal')
|
|
176
|
+
return [];
|
|
177
|
+
const allowed = (Array.isArray(actionability.allowedActions) ? actionability.allowedActions : []).filter((row) => Boolean(row) && typeof row.action === 'string');
|
|
178
|
+
const actions = allowed.filter((row) => ASSIGNMENT_ACTIONS.has(row.action));
|
|
179
|
+
if (actionability.reasonCode === 'assignment_required' &&
|
|
180
|
+
!actions.some((row) => row.action === 'assign_task')) {
|
|
181
|
+
actions.unshift({ action: 'assign_task' });
|
|
182
|
+
}
|
|
183
|
+
const ref = (typeof t.identifier === 'string' && t.identifier) ||
|
|
184
|
+
(typeof t.id === 'string' && t.id) ||
|
|
185
|
+
'<task-id>';
|
|
186
|
+
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 })));
|
|
187
|
+
return rows.map((row, index) => `${index === 0 ? 'Next step:' : ''}`.padEnd(13) + row);
|
|
188
|
+
}
|
|
157
189
|
function resolverLabel(by, names) {
|
|
158
190
|
if (!by || typeof by !== 'object' || !by.kind)
|
|
159
191
|
return null;
|
|
@@ -261,10 +293,14 @@ function taskFailureLines(t, bin = 'skrr') {
|
|
|
261
293
|
lines.push('Recorded error: none recorded on the task.');
|
|
262
294
|
}
|
|
263
295
|
const failure = t.executionFailure;
|
|
264
|
-
if (failure?.recovery &&
|
|
296
|
+
if (failure?.recovery &&
|
|
297
|
+
typeof failure.recovery === 'string' &&
|
|
298
|
+
!error.includes(failure.recovery)) {
|
|
265
299
|
lines.push(`Recovery: ${failure.recovery}`);
|
|
266
300
|
}
|
|
267
|
-
if (failure?.headline &&
|
|
301
|
+
if (failure?.headline &&
|
|
302
|
+
typeof failure.headline === 'string' &&
|
|
303
|
+
!error.includes(failure.headline)) {
|
|
268
304
|
lines.push(`Cause: ${failure.headline}`);
|
|
269
305
|
}
|
|
270
306
|
if (failure?.runId) {
|
|
@@ -490,7 +526,7 @@ class TasksShow extends base_command_1.BaseCommand {
|
|
|
490
526
|
const history = await data_provider_1.dataService.listTaskResults(taskIdentity.id);
|
|
491
527
|
const review = (history?.reviews || []).find((row) => row.resultId === String(t.currentResultId));
|
|
492
528
|
if (review) {
|
|
493
|
-
const who = (0, task_closure_1.describeAssessor)(review.reviewedBy?.kind);
|
|
529
|
+
const who = (0, task_closure_1.describeAssessor)(review.reviewedBy?.kind, review.reviewedBy?.via);
|
|
494
530
|
const when = review.reviewedAt ? ` on ${String(review.reviewedAt).slice(0, 10)}` : '';
|
|
495
531
|
const why = review.rationale ? `: ${review.rationale}` : '';
|
|
496
532
|
this.log(`Review: ${review.decision} by ${who}${when}${why}`);
|
|
@@ -618,6 +654,8 @@ class TasksShow extends base_command_1.BaseCommand {
|
|
|
618
654
|
? 'Workflow: ended · no next executor'
|
|
619
655
|
: `Next action: ${actionability.nextActor ?? '-'} · ${actionability.state ?? '-'} · ${actionability.reasonCode ?? '-'}`);
|
|
620
656
|
this.log(`Why: ${actionability.reason ?? '-'}`);
|
|
657
|
+
for (const line of nextStepLines(t, this.config.bin))
|
|
658
|
+
this.log(line);
|
|
621
659
|
await this.printBlockerDetail(t, actionability);
|
|
622
660
|
}
|
|
623
661
|
const delivery = t.delivery;
|
|
@@ -16,6 +16,7 @@ export default class TasksUpdatesAdd extends BaseCommand {
|
|
|
16
16
|
'spec-version': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
17
|
supersedes: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
18
|
reference: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
evidence: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
20
|
attach: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
21
|
'idempotency-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
22
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
@@ -7,7 +7,10 @@ const base_command_1 = require("../../../base-command");
|
|
|
7
7
|
const task_resolver_1 = require("../../../lib/task-resolver");
|
|
8
8
|
const api_fetch_1 = require("../../../lib/api-fetch");
|
|
9
9
|
const session_task_write_1 = require("../../../lib/session-task-write");
|
|
10
|
-
const
|
|
10
|
+
const task_write_attribution_1 = require("../../../lib/task-write-attribution");
|
|
11
|
+
const reference_syntax_1 = require("../../../lib/reference-syntax");
|
|
12
|
+
/** The Update types whose `data` carries `evidenceRefs` (TASK_UPDATE_DATA_SCHEMAS on the server). */
|
|
13
|
+
const EVIDENCE_TYPES = new Set(['finding', 'verification']);
|
|
11
14
|
function parseJsonObject(value, label) {
|
|
12
15
|
if (!value)
|
|
13
16
|
return undefined;
|
|
@@ -33,9 +36,10 @@ class TasksUpdatesAdd extends base_command_1.BaseCommand {
|
|
|
33
36
|
static examples = [
|
|
34
37
|
'<%= config.bin %> tasks updates add <task> --type progress --summary "Migration review complete" --data \'{"completedSinceLast":["Checked migrations 001-014"],"nextActions":["Review authorization"]}\'',
|
|
35
38
|
'<%= config.bin %> tasks updates add <task> --type decision --summary "Use a resource object" --data \'{"decision":"Use WorkResource","rationale":"Identity must survive URL changes"}\'',
|
|
36
|
-
'<%= config.bin %> tasks updates add <task> --type finding --summary "Cross-tenant leak" --data \'{"finding":"Space ACL is not applied on the list path","impact":"Any member can read another space","severity":"high","evidenceRefs":[]}\'',
|
|
39
|
+
'<%= config.bin %> tasks updates add <task> --type finding --summary "Cross-tenant leak" --data \'{"finding":"Space ACL is not applied on the list path","impact":"Any member can read another space","severity":"high","evidenceRefs":[{"kind":"pr","uri":"https://github.com/acme/app/pull/482","label":"repro test"}]}\'',
|
|
37
40
|
'<%= config.bin %> tasks updates add <task> --type blocker --summary "Needs a prod credential" --data \'{"cause":"No Atlas API key in this runtime","requiredAction":"Provision a read-only key","nextOwner":{"kind":"human","userId":"<user-id>"}}\'',
|
|
38
|
-
'<%= config.bin %> tasks updates add <task> --type verification --summary "Repro is gone" --data \'{"claim":"The 409 no longer reproduces","result":"passed","evidenceRefs":[]}\'',
|
|
41
|
+
'<%= config.bin %> tasks updates add <task> --type verification --summary "Repro is gone" --data \'{"claim":"The 409 no longer reproduces","result":"passed","evidenceRefs":["https://ci.example.com/runs/77"]}\'',
|
|
42
|
+
'<%= config.bin %> tasks updates add <task> --type verification --summary "Repro is gone" --data \'{"claim":"The 409 no longer reproduces","result":"passed"}\' --evidence pr:https://github.com/acme/app/pull/482 --evidence commit:3f9c2ab',
|
|
39
43
|
];
|
|
40
44
|
static args = {
|
|
41
45
|
task: core_1.Args.string({ required: false, ignoreStdin: true, description: 'Task id or ref' }),
|
|
@@ -53,10 +57,13 @@ class TasksUpdatesAdd extends base_command_1.BaseCommand {
|
|
|
53
57
|
description: 'Kind-specific JSON payload. The server enforces one shape per --type, and the array ' +
|
|
54
58
|
'fields are required even when empty. ' +
|
|
55
59
|
'progress {completedSinceLast:[],nextActions:[],currentFocus?} · ' +
|
|
56
|
-
'finding {finding,evidenceRefs:[],impact?,severity?} · ' +
|
|
60
|
+
'finding {finding,evidenceRefs:[{kind,id|uri,label?}],impact?,severity?} · ' +
|
|
57
61
|
'decision {decision,rationale,alternativesConsidered?:[]} · ' +
|
|
58
62
|
'blocker {cause,requiredAction,nextOwner} · ' +
|
|
59
|
-
'verification {claim,result:passed|failed|inconclusive,evidenceRefs:[]}. ' +
|
|
63
|
+
'verification {claim,result:passed|failed|inconclusive,evidenceRefs:[{kind,id|uri,label?}]}. ' +
|
|
64
|
+
'An evidenceRefs entry may also be written as a URL or a "<kind>:<id-or-uri>" string, ' +
|
|
65
|
+
`${reference_syntax_1.REFERENCE_SYNTAX_EXAMPLES}; it is sent as the object. --evidence adds entries ` +
|
|
66
|
+
'without writing JSON. ' +
|
|
60
67
|
'nextOwner is a principal object like {"kind":"human","userId":"..."}, not a name. ' +
|
|
61
68
|
"Note --reference sets the Update's own references, NOT data.evidenceRefs.",
|
|
62
69
|
}),
|
|
@@ -75,7 +82,16 @@ class TasksUpdatesAdd extends base_command_1.BaseCommand {
|
|
|
75
82
|
description: 'Task specification version this Update concerns',
|
|
76
83
|
}),
|
|
77
84
|
supersedes: core_1.Flags.string({ description: 'Update id this correction supersedes' }),
|
|
78
|
-
reference: core_1.Flags.string({
|
|
85
|
+
reference: core_1.Flags.string({
|
|
86
|
+
multiple: true,
|
|
87
|
+
description: "The Update's own reference as <kind>:<id-or-uri> or a URL (repeatable)",
|
|
88
|
+
}),
|
|
89
|
+
evidence: core_1.Flags.string({
|
|
90
|
+
multiple: true,
|
|
91
|
+
description: 'Evidence reference as <kind>:<id-or-uri> or a URL, appended to data.evidenceRefs ' +
|
|
92
|
+
'(repeatable; the array is created when --data has none). finding and verification ' +
|
|
93
|
+
'only: other types cite with --reference.',
|
|
94
|
+
}),
|
|
79
95
|
attach: core_1.Flags.string({
|
|
80
96
|
multiple: true,
|
|
81
97
|
description: 'Upload a file as a Task asset (role: evidence) and cite it in this Update — appended to ' +
|
|
@@ -99,14 +115,39 @@ class TasksUpdatesAdd extends base_command_1.BaseCommand {
|
|
|
99
115
|
catch (error) {
|
|
100
116
|
this.error(error.message, { exit: 1 });
|
|
101
117
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
118
|
+
// Every reference is read before --attach uploads anything, so a refusal the CLI can already
|
|
119
|
+
// see never leaves stored bytes behind.
|
|
120
|
+
const carriesEvidence = EVIDENCE_TYPES.has(flags.type);
|
|
121
|
+
let references = [];
|
|
122
|
+
try {
|
|
123
|
+
references = (0, reference_syntax_1.parseReferences)(flags.reference, '--reference');
|
|
124
|
+
if (flags.evidence?.length && !carriesEvidence) {
|
|
125
|
+
throw new Error('--evidence adds to data.evidenceRefs, which only finding and verification Updates ' +
|
|
126
|
+
`carry. To cite something on a ${flags.type} Update, use --reference ` +
|
|
127
|
+
'<kind>:<id-or-uri>.');
|
|
128
|
+
}
|
|
129
|
+
const evidence = (0, reference_syntax_1.parseReferences)(flags.evidence, '--evidence');
|
|
130
|
+
if (carriesEvidence) {
|
|
131
|
+
// A hand-written entry may be a URL or `<kind>:<id-or-uri>`: send the object the server
|
|
132
|
+
// takes, rather than letting the first attempt learn the shape from a 400.
|
|
133
|
+
if (Array.isArray(data.evidenceRefs)) {
|
|
134
|
+
data = {
|
|
135
|
+
...data,
|
|
136
|
+
evidenceRefs: (0, reference_syntax_1.liftReferenceEntries)(data.evidenceRefs, 'data.evidenceRefs'),
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
if (evidence.length || flags.attach?.length) {
|
|
140
|
+
if (data.evidenceRefs !== undefined && !Array.isArray(data.evidenceRefs)) {
|
|
141
|
+
throw new Error('data.evidenceRefs must be an array for --evidence or --attach to add to it.');
|
|
142
|
+
}
|
|
143
|
+
const written = data.evidenceRefs ?? [];
|
|
144
|
+
data = { ...data, evidenceRefs: [...written, ...evidence] };
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
this.error(error.message, { exit: 1 });
|
|
150
|
+
}
|
|
110
151
|
// --attach: upload first so the Update can cite the asset ids. For
|
|
111
152
|
// finding/verification the citation lands in data.evidenceRefs where the
|
|
112
153
|
// evidence renderer reads it; for the other Update kinds it becomes a
|
|
@@ -124,7 +165,7 @@ class TasksUpdatesAdd extends base_command_1.BaseCommand {
|
|
|
124
165
|
catch (err) {
|
|
125
166
|
this.error(`--attach failed: ${err.message}`, { exit: 1 });
|
|
126
167
|
}
|
|
127
|
-
if (
|
|
168
|
+
if (carriesEvidence) {
|
|
128
169
|
data = { ...data, evidenceRefs: [...data.evidenceRefs, ...refs] };
|
|
129
170
|
}
|
|
130
171
|
else {
|
|
@@ -152,22 +193,31 @@ class TasksUpdatesAdd extends base_command_1.BaseCommand {
|
|
|
152
193
|
credential: sessionWrite.credential,
|
|
153
194
|
body: payload,
|
|
154
195
|
})
|
|
155
|
-
: await data_provider_1.dataService.appendTaskUpdate({
|
|
196
|
+
: await data_provider_1.dataService.appendTaskUpdate({
|
|
197
|
+
taskId: task.id,
|
|
198
|
+
// A person's write names the coding agent this shell runs inside, when one was
|
|
199
|
+
// detected. Recorded as declared, never trusted (`declaredToolSource`).
|
|
200
|
+
data: { ...payload, ...(0, task_write_attribution_1.declaredToolSource)() },
|
|
201
|
+
});
|
|
156
202
|
}
|
|
157
203
|
catch (error) {
|
|
158
204
|
this.handleApiError(error);
|
|
159
205
|
}
|
|
206
|
+
const outcome = (0, task_write_attribution_1.taskWriteOutcome)(result, 'update');
|
|
160
207
|
if (flags.json)
|
|
161
|
-
return this.printJsonOperation(result, {
|
|
208
|
+
return this.printJsonOperation({ ...result, ...outcome }, {
|
|
162
209
|
resource: { kind: 'task_update', id: result?.update?.id },
|
|
163
210
|
task: { id: result?.update?.taskId },
|
|
164
211
|
...(typeof result?.idempotent === 'boolean' ? { replayed: result.idempotent } : {}),
|
|
165
212
|
});
|
|
166
|
-
// A replayed idempotency key answers the SAME stored record —
|
|
213
|
+
// A replayed idempotency key answers the SAME stored record — the outcome line says so,
|
|
167
214
|
// otherwise a retried write reads as a second write.
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
:
|
|
215
|
+
for (const line of (0, task_write_attribution_1.taskWriteOutcomeLines)({
|
|
216
|
+
verb: 'Recorded',
|
|
217
|
+
what: `${flags.type} Update on ${task.id}${result?.resumePoint ? ' with a Resume Point' : ''}`,
|
|
218
|
+
}, outcome)) {
|
|
219
|
+
this.log(line);
|
|
220
|
+
}
|
|
171
221
|
}
|
|
172
222
|
}
|
|
173
223
|
exports.default = TasksUpdatesAdd;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { BaseCommand } from '../../../base-command';
|
|
2
|
+
/** Exported for its spec. A person's credential channel is shown when the Update recorded one. */
|
|
3
|
+
export declare function authorLabel(update: {
|
|
4
|
+
authoredBy?: Record<string, unknown>;
|
|
5
|
+
}): string;
|
|
2
6
|
export default class TasksUpdatesList extends BaseCommand {
|
|
3
7
|
static description: string;
|
|
4
8
|
static args: {
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.authorLabel = authorLabel;
|
|
3
4
|
const list_output_1 = require("../../../lib/list-output");
|
|
4
5
|
const core_1 = require("@oclif/core");
|
|
5
6
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
6
7
|
const base_command_1 = require("../../../base-command");
|
|
7
8
|
const task_resolver_1 = require("../../../lib/task-resolver");
|
|
9
|
+
/** Exported for its spec. A person's credential channel is shown when the Update recorded one. */
|
|
8
10
|
function authorLabel(update) {
|
|
9
11
|
const actor = update.authoredBy || {};
|
|
10
12
|
if (actor.kind === 'agent')
|
|
11
13
|
return `Agent ${actor.agentId}`;
|
|
12
14
|
if (actor.kind === 'human')
|
|
13
|
-
return `Human ${actor.userId}`;
|
|
15
|
+
return `Human ${actor.userId}${(0, data_provider_1.principalChannelSuffix)(actor)}`;
|
|
14
16
|
if (actor.kind === 'integration')
|
|
15
17
|
return `Integration ${actor.provider}`;
|
|
16
18
|
return `System ${actor.service || ''}`.trim();
|
|
@@ -20,6 +20,7 @@ export default class TasksWaive extends BaseCommand {
|
|
|
20
20
|
};
|
|
21
21
|
static flags: {
|
|
22
22
|
reason: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
23
|
+
'confirm-as-me': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
23
24
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
24
25
|
};
|
|
25
26
|
run(): Promise<void>;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
4
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
5
5
|
const base_command_1 = require("../../base-command");
|
|
6
|
+
const task_write_attribution_1 = require("../../lib/task-write-attribution");
|
|
6
7
|
/**
|
|
7
8
|
* `skrr tasks waive <task> <expectation-id> --reason "<why>"`
|
|
8
9
|
*
|
|
@@ -33,27 +34,41 @@ class TasksWaive extends base_command_1.BaseCommand {
|
|
|
33
34
|
description: 'Why this is no longer required. Required — it is the record.',
|
|
34
35
|
required: true,
|
|
35
36
|
}),
|
|
37
|
+
'confirm-as-me': task_write_attribution_1.confirmAsMeFlag,
|
|
36
38
|
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
37
39
|
};
|
|
38
40
|
async run() {
|
|
39
41
|
this.requireAuth();
|
|
40
42
|
const { args, flags } = await this.parse(TasksWaive);
|
|
43
|
+
// The same question `tasks expectations assess` asks (see `lib/task-write-attribution.ts`).
|
|
44
|
+
const refusal = (0, task_write_attribution_1.personJudgementGate)(this, {
|
|
45
|
+
confirmed: flags['confirm-as-me'],
|
|
46
|
+
judgement: `waiving ${args.expectation}`,
|
|
47
|
+
task: args.task,
|
|
48
|
+
});
|
|
49
|
+
if (refusal)
|
|
50
|
+
this.failWithCliError({ ...refusal, exit: 1, retryable: false });
|
|
41
51
|
let result;
|
|
42
52
|
try {
|
|
43
53
|
result = await data_provider_1.dataService.waiveTaskExpectation(args.task, {
|
|
44
54
|
expectationId: args.expectation,
|
|
45
55
|
reason: flags.reason,
|
|
56
|
+
// Recorded as declared, never trusted (`declaredToolSource`).
|
|
57
|
+
...(0, task_write_attribution_1.declaredToolSource)(),
|
|
46
58
|
});
|
|
47
59
|
}
|
|
48
60
|
catch (err) {
|
|
49
61
|
this.handleApiError(err);
|
|
50
62
|
return;
|
|
51
63
|
}
|
|
64
|
+
const outcome = (0, task_write_attribution_1.taskWriteOutcome)(result, 'assessment');
|
|
52
65
|
if (flags.json) {
|
|
53
|
-
this.log(JSON.stringify(result, null, 2));
|
|
66
|
+
this.log(JSON.stringify({ ...result, ...outcome }, null, 2));
|
|
54
67
|
return;
|
|
55
68
|
}
|
|
56
|
-
|
|
69
|
+
for (const line of (0, task_write_attribution_1.taskWriteOutcomeLines)({ verb: 'Recorded', what: `${args.expectation} as waived` }, outcome)) {
|
|
70
|
+
this.log(line);
|
|
71
|
+
}
|
|
57
72
|
}
|
|
58
73
|
}
|
|
59
74
|
exports.default = TasksWaive;
|