@skrr-ai/cli 0.1.166 → 0.1.168
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/show.js +3 -0
- 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/appInstallations.js +1 -1
- package/dist/lib/harnesses.d.ts +24 -0
- package/dist/lib/harnesses.js +4 -0
- package/dist/lib/reference-syntax.d.ts +28 -0
- package/dist/lib/reference-syntax.js +91 -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/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 +11416 -11290
- package/oclif.manifest.json +395 -16
- package/package.json +2 -2
|
@@ -4,8 +4,8 @@ exports.parseEvidenceRef = parseEvidenceRef;
|
|
|
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 history_1 = require("./history");
|
|
8
|
-
const PARSE_EVIDENCE_REF_RE = /^https?:|^file:/;
|
|
9
9
|
/**
|
|
10
10
|
* `skrr goals key-results assess <goal-id> <kr-id>` — record a judgment of a
|
|
11
11
|
* key result (OSK-17987, decision D4). Wraps
|
|
@@ -40,7 +40,7 @@ class GoalsKeyResultsAssess extends base_command_1.BaseCommand {
|
|
|
40
40
|
required: true,
|
|
41
41
|
}),
|
|
42
42
|
evidence: core_1.Flags.string({
|
|
43
|
-
description: 'What it rests on, as <kind>:<id-or-uri> (repeatable)',
|
|
43
|
+
description: 'What it rests on, as <kind>:<id-or-uri> or a URL (repeatable)',
|
|
44
44
|
multiple: true,
|
|
45
45
|
}),
|
|
46
46
|
progress: core_1.Flags.integer({
|
|
@@ -96,16 +96,9 @@ class GoalsKeyResultsAssess extends base_command_1.BaseCommand {
|
|
|
96
96
|
}
|
|
97
97
|
exports.default = GoalsKeyResultsAssess;
|
|
98
98
|
/**
|
|
99
|
-
* `<kind>:<id-or-uri>`
|
|
100
|
-
*
|
|
101
|
-
* Exported for `assess.spec.ts`.
|
|
99
|
+
* `<kind>:<id-or-uri>` or a URL → a reference, read by the one parser every
|
|
100
|
+
* evidence flag uses (`lib/reference-syntax.ts`). Exported for `assess.spec.ts`.
|
|
102
101
|
*/
|
|
103
102
|
function parseEvidenceRef(raw) {
|
|
104
|
-
|
|
105
|
-
if (split < 1 || split === raw.length - 1) {
|
|
106
|
-
throw new Error(`--evidence must be <kind>:<id-or-uri> (got "${raw}")`);
|
|
107
|
-
}
|
|
108
|
-
const kind = raw.slice(0, split);
|
|
109
|
-
const value = raw.slice(split + 1);
|
|
110
|
-
return PARSE_EVIDENCE_REF_RE.test(value) ? { kind, uri: value } : { kind, id: value };
|
|
103
|
+
return (0, reference_syntax_1.parseReference)(raw, '--evidence');
|
|
111
104
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command';
|
|
2
|
+
import { type HarnessRemovalReferences } from '../../lib/harnesses';
|
|
3
|
+
/** The report as lines. Partial evidence, never a statement that removal is safe. */
|
|
4
|
+
export declare function describeRemovalReferences(report: HarnessRemovalReferences): string[];
|
|
5
|
+
/** What still points at a machine before it is forgotten. Read-only. */
|
|
6
|
+
export default class HarnessesRemovalReferences extends BaseCommand {
|
|
7
|
+
static description: string;
|
|
8
|
+
static examples: string[];
|
|
9
|
+
static args: {
|
|
10
|
+
harness: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
11
|
+
};
|
|
12
|
+
static flags: {
|
|
13
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
};
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.describeRemovalReferences = describeRemovalReferences;
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const base_command_1 = require("../../base-command");
|
|
6
|
+
const harnesses_1 = require("../../lib/harnesses");
|
|
7
|
+
/** The report as lines. Partial evidence, never a statement that removal is safe. */
|
|
8
|
+
function describeRemovalReferences(report) {
|
|
9
|
+
const { agents } = report;
|
|
10
|
+
const lines = [`Machine ${report.harnessId} · observed ${report.observedAt}`];
|
|
11
|
+
lines.push(`Agents that run on this machine: ${agents.total} (${agents.owned} yours, ${agents.other} someone else's).`);
|
|
12
|
+
for (const agent of agents.ownedListed) {
|
|
13
|
+
lines.push(` ${agent.name ?? '(unnamed)'} ${agent.id ?? '(no id)'}`);
|
|
14
|
+
}
|
|
15
|
+
if (agents.ownedTruncated) {
|
|
16
|
+
lines.push(` …and ${agents.owned - agents.ownedListed.length} more of yours.`);
|
|
17
|
+
}
|
|
18
|
+
if (report.ownInferencePolicyReferencesMachine === true) {
|
|
19
|
+
lines.push('Your inference policy routes work to this machine.');
|
|
20
|
+
}
|
|
21
|
+
else if (report.ownInferencePolicyReferencesMachine === false) {
|
|
22
|
+
lines.push('Your inference policy does not route work to this machine.');
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
lines.push('Your inference policy could not be read, so it may still route work to this machine.');
|
|
26
|
+
}
|
|
27
|
+
lines.push('This is partial evidence: other things can still depend on this machine. It is not a confirmation that removing it is safe.');
|
|
28
|
+
return lines;
|
|
29
|
+
}
|
|
30
|
+
/** What still points at a machine before it is forgotten. Read-only. */
|
|
31
|
+
class HarnessesRemovalReferences extends base_command_1.BaseCommand {
|
|
32
|
+
static description = 'Show what still references a machine before you remove it';
|
|
33
|
+
static examples = [
|
|
34
|
+
'<%= config.bin %> harnesses removal-references <harness-id>',
|
|
35
|
+
'<%= config.bin %> harnesses removal-references <harness-id> --json',
|
|
36
|
+
];
|
|
37
|
+
static args = {
|
|
38
|
+
harness: core_1.Args.string({ ignoreStdin: true, description: 'Harness ID', required: true }),
|
|
39
|
+
};
|
|
40
|
+
static flags = { json: core_1.Flags.boolean({ description: 'Output as JSON' }) };
|
|
41
|
+
async run() {
|
|
42
|
+
this.requireAuth();
|
|
43
|
+
const { args, flags } = await this.parse(HarnessesRemovalReferences);
|
|
44
|
+
let report;
|
|
45
|
+
try {
|
|
46
|
+
report = await (0, harnesses_1.getHarnessRemovalReferences)(args.harness);
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
this.handleApiError(err);
|
|
50
|
+
}
|
|
51
|
+
if (flags.json) {
|
|
52
|
+
this.printJsonResult(report);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (!report)
|
|
56
|
+
return;
|
|
57
|
+
for (const line of describeRemovalReferences(report))
|
|
58
|
+
this.log(line);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.default = HarnessesRemovalReferences;
|
|
@@ -66,12 +66,17 @@ class TasksActionability extends base_command_1.BaseCommand {
|
|
|
66
66
|
// Unmapped actions remain native action names. The shared display helper
|
|
67
67
|
// also carries exact dependency, input-request, and approval coordinates.
|
|
68
68
|
const width = Math.max(...a.allowedActions.map((action) => action.action.length));
|
|
69
|
+
// The ref, like the `Task:` line above: every command here resolves one.
|
|
70
|
+
const task = response.identifier || response.taskId;
|
|
69
71
|
this.log('Actions:');
|
|
70
72
|
for (const { action, targetId } of a.allowedActions) {
|
|
71
|
-
const
|
|
73
|
+
const rows = (0, task_operations_1.taskActionRemedyRows)((0, task_operations_1.taskActionRemedies)(action, task, targetId, this.config.bin, {
|
|
72
74
|
allowedActions: a.allowedActions,
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
+
}));
|
|
76
|
+
if (rows.length === 0)
|
|
77
|
+
this.log(` ${action.padEnd(width)}`);
|
|
78
|
+
// An action with more than one command (assign_task) lists each under the first.
|
|
79
|
+
rows.forEach((row, index) => this.log(` ${(index === 0 ? action : '').padEnd(width)} ${index === 0 ? '→' : ' '} ${row}`));
|
|
75
80
|
}
|
|
76
81
|
}
|
|
77
82
|
}
|
|
@@ -8,11 +8,12 @@ const task_closure_1 = require("../../lib/task-closure");
|
|
|
8
8
|
const api_fetch_1 = require("../../lib/api-fetch");
|
|
9
9
|
const task_recurrence_outcome_1 = require("../../lib/task-recurrence-outcome");
|
|
10
10
|
const prompt_1 = require("../../lib/prompt");
|
|
11
|
+
const reference_syntax_1 = require("../../lib/reference-syntax");
|
|
11
12
|
const session_task_write_1 = require("../../lib/session-task-write");
|
|
12
13
|
const task_resolver_1 = require("../../lib/task-resolver");
|
|
13
14
|
const task_extras_1 = require("../../lib/task-extras");
|
|
14
15
|
const web_url_1 = require("../../lib/web-url");
|
|
15
|
-
const
|
|
16
|
+
const task_write_attribution_1 = require("../../lib/task-write-attribution");
|
|
16
17
|
const DESCRIBE_PENDING_REVIEW_RE = /expectation/i;
|
|
17
18
|
function parseJson(value, label) {
|
|
18
19
|
if (!value)
|
|
@@ -24,17 +25,6 @@ function parseJson(value, label) {
|
|
|
24
25
|
throw new Error(`${label} must be valid JSON`);
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
|
-
function parseReference(raw) {
|
|
28
|
-
const split = raw.indexOf(':');
|
|
29
|
-
if (split < 1 || split === raw.length - 1) {
|
|
30
|
-
throw new Error('Evidence must use <kind>:<id-or-uri>.');
|
|
31
|
-
}
|
|
32
|
-
const kind = raw.slice(0, split);
|
|
33
|
-
const value = raw.slice(split + 1);
|
|
34
|
-
return PARSE_REFERENCE_RE.test(value) || value.startsWith('/')
|
|
35
|
-
? { kind, uri: value }
|
|
36
|
-
: { kind, id: value };
|
|
37
|
-
}
|
|
38
28
|
function stringValue(value, field) {
|
|
39
29
|
const text = typeof value === 'string' ? value.trim() : '';
|
|
40
30
|
if (!text)
|
|
@@ -100,7 +90,10 @@ class TasksComplete extends base_command_1.BaseCommand {
|
|
|
100
90
|
multiple: true,
|
|
101
91
|
description: 'Exact Task Resource link id produced by `tasks deliverable add`',
|
|
102
92
|
}),
|
|
103
|
-
evidence: core_1.Flags.string({
|
|
93
|
+
evidence: core_1.Flags.string({
|
|
94
|
+
multiple: true,
|
|
95
|
+
description: 'Evidence as <kind>:<id-or-uri> or a URL (repeatable)',
|
|
96
|
+
}),
|
|
104
97
|
attach: core_1.Flags.string({
|
|
105
98
|
multiple: true,
|
|
106
99
|
description: 'Upload a file as a Task asset (role: evidence) and cite it in evidenceRefs. ' +
|
|
@@ -184,6 +177,19 @@ class TasksComplete extends base_command_1.BaseCommand {
|
|
|
184
177
|
(typeof structuredValue !== 'object' || Array.isArray(structuredValue))) {
|
|
185
178
|
this.error('--structured-json must contain a JSON object', { exit: 1 });
|
|
186
179
|
}
|
|
180
|
+
// Absent stays absent, so a --from-json body's evidenceRefs survive the merge below.
|
|
181
|
+
let flagEvidence;
|
|
182
|
+
try {
|
|
183
|
+
flagEvidence = flags.evidence ? (0, reference_syntax_1.parseReferences)(flags.evidence, '--evidence') : undefined;
|
|
184
|
+
}
|
|
185
|
+
catch (error) {
|
|
186
|
+
this.failWithCliError({
|
|
187
|
+
message: error.message,
|
|
188
|
+
code: 'INVALID_TASK_RESULT',
|
|
189
|
+
exit: 1,
|
|
190
|
+
retryable: false,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
187
193
|
const input = (0, prompt_1.mergeDefined)(jsonBody, {
|
|
188
194
|
status: flags.status,
|
|
189
195
|
summary: flags.summary,
|
|
@@ -198,7 +204,7 @@ class TasksComplete extends base_command_1.BaseCommand {
|
|
|
198
204
|
}
|
|
199
205
|
: undefined,
|
|
200
206
|
resourceLinkIds: flags.deliverable,
|
|
201
|
-
evidenceRefs:
|
|
207
|
+
evidenceRefs: flagEvidence,
|
|
202
208
|
remainingWork: flags.remaining?.map((summary) => ({ summary })),
|
|
203
209
|
sourceRunIds: flags['source-run'],
|
|
204
210
|
expectedRunId: flags['run-id'],
|
|
@@ -299,7 +305,14 @@ class TasksComplete extends base_command_1.BaseCommand {
|
|
|
299
305
|
result = await (0, api_fetch_1.apiFetch)(sessionWrite?.path || (0, task_extras_1.taskCompletePath)(taskId), {
|
|
300
306
|
method: 'POST',
|
|
301
307
|
credential: sessionWrite?.credential,
|
|
302
|
-
body: {
|
|
308
|
+
body: {
|
|
309
|
+
...payload,
|
|
310
|
+
idempotencyKey,
|
|
311
|
+
// A person's write names the coding agent this shell runs inside, when one was
|
|
312
|
+
// detected. Recorded as declared, never trusted (`declaredToolSource`). A session write
|
|
313
|
+
// is its Agent's, proven by its Run, and sends none.
|
|
314
|
+
...(sessionWrite ? {} : (0, task_write_attribution_1.declaredToolSource)()),
|
|
315
|
+
},
|
|
303
316
|
headers: { 'X-Idempotency-Key': idempotencyKey },
|
|
304
317
|
});
|
|
305
318
|
}
|
|
@@ -320,14 +333,19 @@ class TasksComplete extends base_command_1.BaseCommand {
|
|
|
320
333
|
this.handleApiError(error);
|
|
321
334
|
}
|
|
322
335
|
const url = (0, web_url_1.taskUrlFrom)(this.cliConfig.baseURL, { id: taskId });
|
|
336
|
+
const outcome = (0, task_write_attribution_1.taskWriteOutcome)(result, 'result');
|
|
323
337
|
if (flags.json) {
|
|
324
|
-
this.printJsonOperation({ ...result, url }, {
|
|
338
|
+
this.printJsonOperation({ ...result, url, ...outcome }, {
|
|
325
339
|
resource: { kind: 'task_result', id: result.result.id },
|
|
326
340
|
task: { id: result.task.id },
|
|
327
341
|
});
|
|
328
342
|
return;
|
|
329
343
|
}
|
|
330
|
-
|
|
344
|
+
// Outcome first: what was recorded, whom it is attributed to, and where the Task now stands.
|
|
345
|
+
for (const line of (0, task_write_attribution_1.taskWriteOutcomeLines)({ verb: 'Submitted', what: `Result v${result.result.version}` }, outcome)) {
|
|
346
|
+
this.log(line);
|
|
347
|
+
}
|
|
348
|
+
this.log(`Task is ${result.task.statusType || result.task.status || 'updated'}.`);
|
|
331
349
|
const pending = describePendingReview({
|
|
332
350
|
statusType: result.task.statusType,
|
|
333
351
|
taskId,
|
|
@@ -15,6 +15,7 @@ export default class TasksExpectationsAssess extends BaseCommand {
|
|
|
15
15
|
evidence: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
16
|
'spec-version': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
17
|
'idempotency-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
'confirm-as-me': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
18
19
|
all: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
19
20
|
'include-unmet': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
20
21
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
@@ -4,11 +4,11 @@ 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 api_fetch_1 = require("../../../lib/api-fetch");
|
|
9
10
|
const session_task_write_1 = require("../../../lib/session-task-write");
|
|
10
11
|
const task_write_attribution_1 = require("../../../lib/task-write-attribution");
|
|
11
|
-
const RUN_RE = /^https?:|^file:/;
|
|
12
12
|
class TasksExpectationsAssess extends base_command_1.BaseCommand {
|
|
13
13
|
static description = 'Assess one current Task Expectation with evidence and a reason';
|
|
14
14
|
// Both positionals are declared optional because oclif REJECTS an args table
|
|
@@ -39,10 +39,11 @@ class TasksExpectationsAssess extends base_command_1.BaseCommand {
|
|
|
39
39
|
'resource-link-id': core_1.Flags.string({ description: 'Deliverable Resource link supporting it' }),
|
|
40
40
|
evidence: core_1.Flags.string({
|
|
41
41
|
multiple: true,
|
|
42
|
-
description: 'Evidence reference as <kind>:<id-or-uri>',
|
|
42
|
+
description: 'Evidence reference as <kind>:<id-or-uri> or a URL (repeatable)',
|
|
43
43
|
}),
|
|
44
44
|
'spec-version': core_1.Flags.integer({ description: 'Task specification version being assessed' }),
|
|
45
45
|
'idempotency-key': core_1.Flags.string({ description: 'Stable retry key' }),
|
|
46
|
+
'confirm-as-me': task_write_attribution_1.confirmAsMeFlag,
|
|
46
47
|
all: core_1.Flags.boolean({
|
|
47
48
|
description: 'Assess every Expectation still awaiting one on this Task, with the same decision ' +
|
|
48
49
|
'and reason. Already-settled Expectations are left alone, and ones already judged ' +
|
|
@@ -109,14 +110,13 @@ class TasksExpectationsAssess extends base_command_1.BaseCommand {
|
|
|
109
110
|
positionalId: taskPositional,
|
|
110
111
|
flagTask: flags.task,
|
|
111
112
|
});
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
});
|
|
113
|
+
let evidenceRefs = [];
|
|
114
|
+
try {
|
|
115
|
+
evidenceRefs = (0, reference_syntax_1.parseReferences)(flags.evidence, '--evidence');
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
this.error(error.message, { exit: 1 });
|
|
119
|
+
}
|
|
120
120
|
const payload = {
|
|
121
121
|
decision: flags.decision,
|
|
122
122
|
runId: flags['run-id'],
|
|
@@ -126,6 +126,17 @@ class TasksExpectationsAssess extends base_command_1.BaseCommand {
|
|
|
126
126
|
evidenceRefs,
|
|
127
127
|
expectedSpecVersion: flags['spec-version'],
|
|
128
128
|
};
|
|
129
|
+
// A judgement from a coding agent in the person's own terminal would be recorded as the
|
|
130
|
+
// person's. Ask before writing it, not after (see `lib/task-write-attribution.ts`).
|
|
131
|
+
const refusal = (0, task_write_attribution_1.personJudgementGate)(this, {
|
|
132
|
+
confirmed: flags['confirm-as-me'],
|
|
133
|
+
judgement: flags.all
|
|
134
|
+
? `assessing every Expectation still awaiting one as ${flags.decision}`
|
|
135
|
+
: `assessing ${expectationId} as ${flags.decision}`,
|
|
136
|
+
task: task.id,
|
|
137
|
+
});
|
|
138
|
+
if (refusal)
|
|
139
|
+
this.failWithCliError({ ...refusal, exit: 1, retryable: false });
|
|
129
140
|
const reuseCallerKey = Boolean(flags['idempotency-key']) && !flags.all;
|
|
130
141
|
const submit = async (id) => {
|
|
131
142
|
const data = {
|
|
@@ -145,7 +156,13 @@ class TasksExpectationsAssess extends base_command_1.BaseCommand {
|
|
|
145
156
|
body: data,
|
|
146
157
|
credential: sessionWrite.credential,
|
|
147
158
|
})
|
|
148
|
-
: await data_provider_1.dataService.assessTaskExpectation({
|
|
159
|
+
: await data_provider_1.dataService.assessTaskExpectation({
|
|
160
|
+
taskId: task.id,
|
|
161
|
+
expectationId: id,
|
|
162
|
+
// A person's write names the coding agent this shell runs inside, when one was
|
|
163
|
+
// detected. Recorded as declared, never trusted (`declaredToolSource`).
|
|
164
|
+
data: { ...data, ...(0, task_write_attribution_1.declaredToolSource)() },
|
|
165
|
+
});
|
|
149
166
|
};
|
|
150
167
|
if (flags.all) {
|
|
151
168
|
let ids;
|
|
@@ -169,6 +186,7 @@ class TasksExpectationsAssess extends base_command_1.BaseCommand {
|
|
|
169
186
|
failed: [],
|
|
170
187
|
skippedUnmet: skippedRejections,
|
|
171
188
|
attributions: [],
|
|
189
|
+
outcomes: [],
|
|
172
190
|
});
|
|
173
191
|
return;
|
|
174
192
|
}
|
|
@@ -195,12 +213,14 @@ class TasksExpectationsAssess extends base_command_1.BaseCommand {
|
|
|
195
213
|
// make that impossible to work out.
|
|
196
214
|
const settled = [];
|
|
197
215
|
const attributions = [];
|
|
216
|
+
const outcomes = [];
|
|
198
217
|
const failed = [];
|
|
199
218
|
for (const id of ids) {
|
|
200
219
|
try {
|
|
201
220
|
const receipt = await submit(id);
|
|
202
221
|
settled.push(id);
|
|
203
|
-
attributions.push({ id, attribution: (0, task_write_attribution_1.
|
|
222
|
+
attributions.push({ id, attribution: (0, task_write_attribution_1.receiptAttribution)(receipt, 'assessment') });
|
|
223
|
+
outcomes.push({ id, ...(0, task_write_attribution_1.taskWriteOutcome)(receipt, 'assessment') });
|
|
204
224
|
}
|
|
205
225
|
catch (error) {
|
|
206
226
|
failed.push({ id, message: error?.message || 'unknown error' });
|
|
@@ -214,16 +234,20 @@ class TasksExpectationsAssess extends base_command_1.BaseCommand {
|
|
|
214
234
|
failed,
|
|
215
235
|
skippedUnmet: skippedRejections,
|
|
216
236
|
attributions,
|
|
237
|
+
outcomes,
|
|
217
238
|
});
|
|
218
239
|
if (failed.length > 0)
|
|
219
240
|
this.exit(1);
|
|
220
241
|
return;
|
|
221
242
|
}
|
|
222
|
-
|
|
223
|
-
for (const { id,
|
|
224
|
-
for (const line of (0, task_write_attribution_1.
|
|
225
|
-
this.log(
|
|
243
|
+
// One line per Expectation, outcome first: what was recorded, and whom it is attributed to.
|
|
244
|
+
for (const { id, ...outcome } of outcomes) {
|
|
245
|
+
for (const line of (0, task_write_attribution_1.taskWriteOutcomeLines)({ verb: 'Recorded', what: `${id} as ${flags.decision}` }, outcome)) {
|
|
246
|
+
this.log(line);
|
|
247
|
+
}
|
|
226
248
|
}
|
|
249
|
+
if (settled.length === 0)
|
|
250
|
+
this.log(`Recorded no Expectation as ${flags.decision}.`);
|
|
227
251
|
for (const failure of failed)
|
|
228
252
|
this.log(` FAILED ${failure.id}: ${failure.message}`);
|
|
229
253
|
if (failed.length > 0)
|
|
@@ -237,12 +261,17 @@ class TasksExpectationsAssess extends base_command_1.BaseCommand {
|
|
|
237
261
|
catch (error) {
|
|
238
262
|
this.handleApiError(error);
|
|
239
263
|
}
|
|
240
|
-
const
|
|
241
|
-
if (flags.json)
|
|
242
|
-
return this.printJsonResult({
|
|
243
|
-
|
|
244
|
-
|
|
264
|
+
const outcome = (0, task_write_attribution_1.taskWriteOutcome)(result, 'assessment');
|
|
265
|
+
if (flags.json) {
|
|
266
|
+
return this.printJsonResult({
|
|
267
|
+
...result,
|
|
268
|
+
...outcome,
|
|
269
|
+
attribution: (0, task_write_attribution_1.receiptAttribution)(result, 'assessment'),
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
for (const line of (0, task_write_attribution_1.taskWriteOutcomeLines)({ verb: 'Recorded', what: `${expectationId} as ${flags.decision}` }, outcome)) {
|
|
245
273
|
this.log(line);
|
|
274
|
+
}
|
|
246
275
|
}
|
|
247
276
|
}
|
|
248
277
|
exports.default = TasksExpectationsAssess;
|
|
@@ -90,7 +90,8 @@ function assessorSuffix(expectation) {
|
|
|
90
90
|
// least as much as whose `met` it was.
|
|
91
91
|
if (!['met', 'waived', 'unmet'].includes(expectation.state))
|
|
92
92
|
return '';
|
|
93
|
-
|
|
93
|
+
// A person's judgement names its channel, then any tool their CLI declared, marked as declared.
|
|
94
|
+
return ` (${(0, task_closure_1.describeAssessor)(expectation.assessedByKind, expectation.assessedByVia, expectation.assessedByDeclaredTool)})`;
|
|
94
95
|
}
|
|
95
96
|
/**
|
|
96
97
|
* A judgement made about a Result that is no longer the current one (OSK-15431).
|
|
@@ -224,7 +225,9 @@ class TasksExpectations extends base_command_1.BaseCommand {
|
|
|
224
225
|
this.log(`${rejectedRows.length} judged unmet — fix the work and re-assess, or waive ` +
|
|
225
226
|
`${rejectedRows.length === 1 ? 'it' : 'them'}:`);
|
|
226
227
|
for (const row of rejectedRows) {
|
|
227
|
-
const who = row.assessedByKind
|
|
228
|
+
const who = row.assessedByKind
|
|
229
|
+
? ` by ${(0, task_closure_1.describeAssessor)(row.assessedByKind, row.assessedByVia, row.assessedByDeclaredTool)}`
|
|
230
|
+
: '';
|
|
228
231
|
const when = row.assessedAt ? ` on ${String(row.assessedAt).slice(0, 10)}` : '';
|
|
229
232
|
this.log(` ${row.id}${who}${when}${row.reason ? `: ${row.reason}` : ''}`);
|
|
230
233
|
}
|
|
@@ -24,6 +24,7 @@ export default class TasksJudge extends BaseCommand {
|
|
|
24
24
|
static flags: {
|
|
25
25
|
verdict: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
26
26
|
reason: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
27
|
+
'confirm-as-me': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
27
28
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
28
29
|
};
|
|
29
30
|
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 judge <task> <expectation-id> --verdict met --reason "<why>"`
|
|
8
9
|
*
|
|
@@ -42,28 +43,42 @@ class TasksJudge extends base_command_1.BaseCommand {
|
|
|
42
43
|
required: true,
|
|
43
44
|
description: 'What you looked at. A verdict without one is not a judgement.',
|
|
44
45
|
}),
|
|
46
|
+
'confirm-as-me': task_write_attribution_1.confirmAsMeFlag,
|
|
45
47
|
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
46
48
|
};
|
|
47
49
|
async run() {
|
|
48
50
|
this.requireAuth();
|
|
49
51
|
const { args, flags } = await this.parse(TasksJudge);
|
|
52
|
+
// The same question `tasks expectations assess` asks (see `lib/task-write-attribution.ts`).
|
|
53
|
+
const refusal = (0, task_write_attribution_1.personJudgementGate)(this, {
|
|
54
|
+
confirmed: flags['confirm-as-me'],
|
|
55
|
+
judgement: `assessing ${args.expectation} as ${flags.verdict}`,
|
|
56
|
+
task: args.task,
|
|
57
|
+
});
|
|
58
|
+
if (refusal)
|
|
59
|
+
this.failWithCliError({ ...refusal, exit: 1, retryable: false });
|
|
50
60
|
let result;
|
|
51
61
|
try {
|
|
52
62
|
result = await data_provider_1.dataService.judgeTaskExpectation(args.task, {
|
|
53
63
|
expectationId: args.expectation,
|
|
54
64
|
verdict: flags.verdict,
|
|
55
65
|
reason: flags.reason,
|
|
66
|
+
// Recorded as declared, never trusted (`declaredToolSource`).
|
|
67
|
+
...(0, task_write_attribution_1.declaredToolSource)(),
|
|
56
68
|
});
|
|
57
69
|
}
|
|
58
70
|
catch (err) {
|
|
59
71
|
this.handleApiError(err);
|
|
60
72
|
return;
|
|
61
73
|
}
|
|
74
|
+
const outcome = (0, task_write_attribution_1.taskWriteOutcome)(result, 'assessment');
|
|
62
75
|
if (flags.json) {
|
|
63
|
-
this.log(JSON.stringify(result, null, 2));
|
|
76
|
+
this.log(JSON.stringify({ ...result, ...outcome }, null, 2));
|
|
64
77
|
return;
|
|
65
78
|
}
|
|
66
|
-
|
|
79
|
+
for (const line of (0, task_write_attribution_1.taskWriteOutcomeLines)({ verb: 'Recorded', what: `${args.expectation} as ${flags.verdict}` }, outcome)) {
|
|
80
|
+
this.log(line);
|
|
81
|
+
}
|
|
67
82
|
}
|
|
68
83
|
}
|
|
69
84
|
exports.default = TasksJudge;
|
|
@@ -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>;
|