@skrr-ai/cli 0.1.22 → 0.1.23
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/README.md +83 -73
- package/bin/dev-fallback.js +221 -0
- package/bin/run.js +43 -0
- package/dist/base-command.d.ts +15 -0
- package/dist/base-command.js +71 -10
- package/dist/commands/agents/attach-harness.d.ts +37 -0
- package/dist/commands/agents/attach-harness.js +102 -3
- package/dist/commands/agents/chat.d.ts +69 -1
- package/dist/commands/agents/chat.js +202 -22
- package/dist/commands/agents/create.d.ts +38 -0
- package/dist/commands/agents/create.js +95 -2
- package/dist/commands/agents/schedule-trace.js +11 -0
- package/dist/commands/agents/show.js +29 -1
- package/dist/commands/api-keys/create.d.ts +24 -0
- package/dist/commands/api-keys/create.js +80 -0
- package/dist/commands/api-keys/list.d.ts +11 -0
- package/dist/commands/api-keys/list.js +42 -0
- package/dist/commands/api-keys/revoke.d.ts +14 -0
- package/dist/commands/api-keys/revoke.js +33 -0
- package/dist/commands/api-keys/rotate.d.ts +19 -0
- package/dist/commands/api-keys/rotate.js +42 -0
- package/dist/commands/balance/index.d.ts +18 -0
- package/dist/commands/balance/index.js +29 -0
- package/dist/commands/balance/show.d.ts +25 -0
- package/dist/commands/balance/show.js +60 -0
- package/dist/commands/balance/statement.d.ts +19 -0
- package/dist/commands/balance/statement.js +52 -0
- package/dist/commands/browser/doctor.d.ts +11 -0
- package/dist/commands/browser/doctor.js +11 -0
- package/dist/commands/code/jobs/approve.d.ts +25 -0
- package/dist/commands/code/jobs/approve.js +52 -0
- package/dist/commands/code/jobs/cancel.d.ts +12 -0
- package/dist/commands/code/jobs/cancel.js +39 -0
- package/dist/commands/code/jobs/index.d.ts +19 -0
- package/dist/commands/code/jobs/index.js +38 -0
- package/dist/commands/code/jobs/list.d.ts +12 -0
- package/dist/commands/code/jobs/list.js +87 -0
- package/dist/commands/code/jobs/run.d.ts +32 -0
- package/dist/commands/code/jobs/run.js +151 -0
- package/dist/commands/code/jobs/show.d.ts +12 -0
- package/dist/commands/code/jobs/show.js +86 -0
- package/dist/commands/commitments/preflight.js +18 -4
- package/dist/commands/commitments/receipt-metrics.d.ts +39 -0
- package/dist/commands/commitments/receipt-metrics.js +78 -0
- package/dist/commands/convos/search.js +5 -5
- package/dist/commands/harnesses/leases/list.d.ts +3 -0
- package/dist/commands/harnesses/leases/list.js +59 -12
- package/dist/commands/harnesses/leases/show.js +36 -0
- package/dist/commands/harnesses/list.d.ts +18 -0
- package/dist/commands/harnesses/list.js +30 -0
- package/dist/commands/harnesses/products.js +48 -3
- package/dist/commands/harnesses/quota.d.ts +16 -0
- package/dist/commands/harnesses/quota.js +26 -1
- package/dist/commands/harnesses/usage.js +17 -0
- package/dist/commands/inbox/index.d.ts +2 -1
- package/dist/commands/inbox/index.js +27 -4
- package/dist/commands/login.js +4 -1
- package/dist/commands/machines/list.d.ts +1 -0
- package/dist/commands/machines/list.js +33 -5
- package/dist/commands/memory/approvals/issue.d.ts +18 -0
- package/dist/commands/memory/approvals/issue.js +63 -0
- package/dist/commands/memory/commit.js +5 -2
- package/dist/commands/memory/context.d.ts +3 -2
- package/dist/commands/memory/context.js +9 -11
- package/dist/commands/memory/delete.d.ts +1 -1
- package/dist/commands/memory/list.d.ts +1 -1
- package/dist/commands/memory/list.js +1 -1
- package/dist/commands/memory/mounts/resolve.d.ts +10 -0
- package/dist/commands/memory/mounts/resolve.js +27 -0
- package/dist/commands/memory/proposals/commit.d.ts +18 -0
- package/dist/commands/memory/proposals/commit.js +32 -0
- package/dist/commands/memory/proposals/create.d.ts +18 -0
- package/dist/commands/memory/proposals/create.js +56 -0
- package/dist/commands/memory/proposals/list.d.ts +13 -0
- package/dist/commands/memory/proposals/list.js +31 -0
- package/dist/commands/memory/proposals/promote.d.ts +22 -0
- package/dist/commands/memory/proposals/promote.js +33 -0
- package/dist/commands/memory/proposals/reject.d.ts +16 -0
- package/dist/commands/memory/proposals/reject.js +28 -0
- package/dist/commands/memory/rebuild-index.d.ts +20 -0
- package/dist/commands/memory/rebuild-index.js +25 -0
- package/dist/commands/memory/save.d.ts +1 -1
- package/dist/commands/memory/save.js +1 -1
- package/dist/commands/memory/search.d.ts +6 -3
- package/dist/commands/memory/search.js +27 -3
- package/dist/commands/memory/show.d.ts +1 -1
- package/dist/commands/memory/stores/archive.d.ts +14 -0
- package/dist/commands/memory/stores/archive.js +31 -0
- package/dist/commands/memory/stores/create.d.ts +12 -0
- package/dist/commands/memory/stores/create.js +30 -0
- package/dist/commands/memory/stores/delete.d.ts +15 -0
- package/dist/commands/memory/stores/delete.js +38 -0
- package/dist/commands/memory/stores/list.d.ts +10 -0
- package/dist/commands/memory/stores/list.js +29 -0
- package/dist/commands/memory/stores/show.d.ts +12 -0
- package/dist/commands/memory/stores/show.js +14 -0
- package/dist/commands/memory/stores/update.d.ts +15 -0
- package/dist/commands/memory/stores/update.js +39 -0
- package/dist/commands/memory/sync/delete.d.ts +13 -0
- package/dist/commands/memory/sync/delete.js +35 -0
- package/dist/commands/memory/sync/pull.d.ts +19 -0
- package/dist/commands/memory/sync/pull.js +52 -0
- package/dist/commands/memory/sync/push.d.ts +18 -0
- package/dist/commands/memory/sync/push.js +115 -0
- package/dist/commands/memory/sync/resolve.d.ts +23 -0
- package/dist/commands/memory/sync/resolve.js +27 -0
- package/dist/commands/memory/sync/status.d.ts +9 -0
- package/dist/commands/memory/sync/status.js +22 -0
- package/dist/commands/memory/topics/archive.d.ts +20 -0
- package/dist/commands/memory/topics/archive.js +29 -0
- package/dist/commands/memory/topics/create.d.ts +23 -0
- package/dist/commands/memory/topics/create.js +46 -0
- package/dist/commands/memory/topics/delete.d.ts +22 -0
- package/dist/commands/memory/topics/delete.js +30 -0
- package/dist/commands/memory/topics/forget.d.ts +22 -0
- package/dist/commands/memory/topics/forget.js +29 -0
- package/dist/commands/memory/topics/list.d.ts +13 -0
- package/dist/commands/memory/topics/list.js +22 -0
- package/dist/commands/memory/topics/move.d.ts +22 -0
- package/dist/commands/memory/topics/move.js +26 -0
- package/dist/commands/memory/topics/show.d.ts +17 -0
- package/dist/commands/memory/topics/show.js +21 -0
- package/dist/commands/memory/topics/update.d.ts +23 -0
- package/dist/commands/memory/topics/update.js +27 -0
- package/dist/commands/memory/tree.d.ts +5 -2
- package/dist/commands/memory/tree.js +20 -2
- package/dist/commands/memory/update.d.ts +1 -1
- package/dist/commands/memory/versions/list.d.ts +16 -0
- package/dist/commands/memory/versions/list.js +22 -0
- package/dist/commands/memory/versions/redact.d.ts +21 -0
- package/dist/commands/memory/versions/redact.js +22 -0
- package/dist/commands/memory/versions/restore.d.ts +20 -0
- package/dist/commands/memory/versions/restore.js +16 -0
- package/dist/commands/memory/versions/show.d.ts +15 -0
- package/dist/commands/memory/versions/show.js +17 -0
- package/dist/commands/messages/list.js +25 -8
- package/dist/commands/messages/show.js +10 -0
- package/dist/commands/store/install.js +5 -1
- package/dist/commands/store/releases.js +1 -1
- package/dist/commands/store/update.js +5 -1
- package/dist/commands/subscriptions/cancel.js +5 -1
- package/dist/commands/subscriptions/health.js +5 -1
- package/dist/commands/subscriptions/status.js +5 -1
- package/dist/commands/subscriptions/subscribe.js +5 -1
- package/dist/commands/tasks/activity.d.ts +2 -3
- package/dist/commands/tasks/activity.js +15 -5
- package/dist/commands/tasks/complete.d.ts +18 -150
- package/dist/commands/tasks/complete.js +161 -600
- package/dist/commands/tasks/create.d.ts +5 -0
- package/dist/commands/tasks/create.js +107 -4
- package/dist/commands/tasks/deliverable/add.d.ts +8 -0
- package/dist/commands/tasks/deliverable/add.js +41 -8
- package/dist/commands/tasks/deliverable/confirm.d.ts +5 -5
- package/dist/commands/tasks/deliverable/confirm.js +9 -18
- package/dist/commands/tasks/deliverable/list.d.ts +12 -0
- package/dist/commands/tasks/deliverable/list.js +37 -0
- package/dist/commands/tasks/events/append.d.ts +2 -0
- package/dist/commands/tasks/events/append.js +11 -4
- package/dist/commands/tasks/events/list.d.ts +1 -0
- package/dist/commands/tasks/events/list.js +1 -0
- package/dist/commands/tasks/events/tail.d.ts +1 -0
- package/dist/commands/tasks/events/tail.js +1 -0
- package/dist/commands/tasks/expectations/assess.d.ts +21 -0
- package/dist/commands/tasks/expectations/assess.js +77 -0
- package/dist/commands/tasks/expectations.js +14 -18
- package/dist/commands/tasks/judge.d.ts +1 -0
- package/dist/commands/tasks/judge.js +2 -1
- package/dist/commands/tasks/output.d.ts +2 -11
- package/dist/commands/tasks/output.js +64 -145
- package/dist/commands/tasks/report.d.ts +3 -3
- package/dist/commands/tasks/report.js +64 -41
- package/dist/commands/tasks/resource/add.d.ts +23 -0
- package/dist/commands/tasks/resource/add.js +76 -0
- package/dist/commands/tasks/resource/list.d.ts +13 -0
- package/dist/commands/tasks/resource/list.js +41 -0
- package/dist/commands/tasks/result/show.d.ts +13 -0
- package/dist/commands/tasks/result/show.js +46 -0
- package/dist/commands/tasks/result/submit.d.ts +26 -0
- package/dist/commands/tasks/result/submit.js +134 -0
- package/dist/commands/tasks/resume/save.d.ts +16 -0
- package/dist/commands/tasks/resume/save.js +59 -0
- package/dist/commands/tasks/resume/show.d.ts +13 -0
- package/dist/commands/tasks/resume/show.js +35 -0
- package/dist/commands/tasks/review.d.ts +17 -0
- package/dist/commands/tasks/review.js +54 -0
- package/dist/commands/tasks/runs.js +5 -0
- package/dist/commands/tasks/timeline.d.ts +2 -2
- package/dist/commands/tasks/timeline.js +10 -23
- package/dist/commands/tasks/updates/add.d.ts +22 -0
- package/dist/commands/tasks/updates/add.js +101 -0
- package/dist/commands/tasks/updates/list.d.ts +15 -0
- package/dist/commands/tasks/updates/list.js +57 -0
- package/dist/commands/tasks/waive.d.ts +1 -0
- package/dist/commands/tasks/waive.js +2 -1
- package/dist/lib/agentic-stream.d.ts +257 -0
- package/dist/lib/agentic-stream.js +490 -33
- package/dist/lib/balance.d.ts +8 -0
- package/dist/lib/commitment-product.d.ts +10 -1
- package/dist/lib/commitment-product.js +66 -2
- package/dist/lib/commitments.d.ts +2 -1
- package/dist/lib/commitments.js +1 -0
- package/dist/lib/conversation-search.d.ts +3 -0
- package/dist/lib/conversation-search.js +75 -0
- package/dist/lib/execution-target.d.ts +21 -0
- package/dist/lib/execution-target.js +22 -6
- package/dist/lib/harnesses.d.ts +82 -6
- package/dist/lib/harnesses.js +30 -2
- package/dist/lib/hosted-machines.js +9 -0
- package/dist/lib/inbox.d.ts +2 -1
- package/dist/lib/machines.d.ts +17 -0
- package/dist/lib/machines.js +29 -0
- package/dist/lib/managed-agent-keys.d.ts +104 -0
- package/dist/lib/managed-agent-keys.js +50 -0
- package/dist/lib/memory-scope.d.ts +4 -3
- package/dist/lib/memory-scope.js +9 -9
- package/dist/lib/memory-sync.d.ts +114 -0
- package/dist/lib/memory-sync.js +730 -0
- package/dist/lib/message-provenance.d.ts +42 -0
- package/dist/lib/message-provenance.js +89 -0
- package/dist/lib/scoped-memory-command.d.ts +68 -0
- package/dist/lib/scoped-memory-command.js +183 -0
- package/dist/lib/session-task-endpoints.d.ts +1 -1
- package/dist/lib/session-task-endpoints.js +7 -0
- package/dist/lib/sky-code-broker.d.ts +47 -0
- package/dist/lib/sky-code-broker.js +50 -0
- package/dist/lib/sky-code-doctor.js +10 -1
- package/dist/lib/task-artifact-flags.d.ts +2 -0
- package/dist/lib/task-artifact-flags.js +7 -0
- package/dist/lib/task-execution.d.ts +4 -5
- package/dist/lib/task-execution.js +4 -5
- package/dist/lib/task-extras.d.ts +1 -5
- package/dist/lib/task-extras.js +1 -5
- package/dist/lib/task-transcript.d.ts +5 -7
- package/dist/lib/task-transcript.js +8 -16
- package/dist/lib/tasks.d.ts +7 -21
- package/dist/lib/tasks.js +17 -20
- package/dist/lib/triggers.d.ts +39 -1
- package/dist/lib/triggers.js +70 -2
- package/dist/lib/usage-discovery.d.ts +17 -1
- package/dist/lib/usage-discovery.js +17 -1
- package/dist/node_modules/@skrr-ai/data-provider/index.js +3733 -3618
- package/oclif.manifest.json +16201 -10377
- package/package.json +26 -5
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseCommand } from '../../base-command';
|
|
2
|
+
import { type TaskRecord } from '../../lib/tasks';
|
|
2
3
|
/**
|
|
3
4
|
* Whether the estimate we asked for survived the write. (S3 dogfood finding)
|
|
4
5
|
*
|
|
@@ -25,6 +26,9 @@ import { BaseCommand } from '../../base-command';
|
|
|
25
26
|
* silently-dropped assignee (OSK-4857).
|
|
26
27
|
*/
|
|
27
28
|
export declare function droppedEstimateWarning(requested: number | undefined, written: Record<string, unknown> | null | undefined, spaceId?: string | null): string | null;
|
|
29
|
+
/** A create may have committed before any of these response failures surfaced. */
|
|
30
|
+
export declare function taskCreateMayHaveCommitted(error: unknown): boolean;
|
|
31
|
+
export declare function taskMatchesCreateIdentity(task: TaskRecord, payload: TaskRecord): boolean;
|
|
28
32
|
export default class TasksCreate extends BaseCommand {
|
|
29
33
|
static description: string;
|
|
30
34
|
static examples: string[];
|
|
@@ -63,6 +67,7 @@ export default class TasksCreate extends BaseCommand {
|
|
|
63
67
|
worktree: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
64
68
|
};
|
|
65
69
|
run(): Promise<void>;
|
|
70
|
+
private createTaskOrRecover;
|
|
66
71
|
/**
|
|
67
72
|
* Predict the create route's `ASSIGNEE_NOT_IN_SPACE` degradation for a
|
|
68
73
|
* DEFAULTED assignee, so `--dry-run` does not report a payload the real
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.droppedEstimateWarning = droppedEstimateWarning;
|
|
4
|
+
exports.taskCreateMayHaveCommitted = taskCreateMayHaveCommitted;
|
|
5
|
+
exports.taskMatchesCreateIdentity = taskMatchesCreateIdentity;
|
|
4
6
|
const core_1 = require("@oclif/core");
|
|
5
7
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
6
8
|
const base_command_1 = require("../../base-command");
|
|
@@ -51,6 +53,53 @@ function droppedEstimateWarning(requested, written, spaceId) {
|
|
|
51
53
|
'estimate scale, so the value is discarded rather than rejected. ' +
|
|
52
54
|
'Set one with `spaces update <space> --estimate-scale <scale> --estimate-migration <clear|migrate>`.');
|
|
53
55
|
}
|
|
56
|
+
function taskCreateFailureCode(error) {
|
|
57
|
+
const failure = error;
|
|
58
|
+
if (typeof failure?.body === 'string') {
|
|
59
|
+
try {
|
|
60
|
+
const parsed = JSON.parse(failure.body);
|
|
61
|
+
if (typeof parsed.code === 'string')
|
|
62
|
+
return parsed.code;
|
|
63
|
+
if (typeof parsed.errorType === 'string')
|
|
64
|
+
return parsed.errorType;
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
// Non-JSON response bodies carry no typed code.
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return typeof failure?.code === 'string' ? failure.code : undefined;
|
|
71
|
+
}
|
|
72
|
+
/** A create may have committed before any of these response failures surfaced. */
|
|
73
|
+
function taskCreateMayHaveCommitted(error) {
|
|
74
|
+
const failure = error;
|
|
75
|
+
const status = failure?.status ?? failure?.response?.status;
|
|
76
|
+
if (typeof status === 'number' && status >= 500)
|
|
77
|
+
return true;
|
|
78
|
+
if (taskCreateFailureCode(error) === 'TASK_EXTERNAL_KEY_CONFLICT')
|
|
79
|
+
return true;
|
|
80
|
+
const code = failure?.code || '';
|
|
81
|
+
if (['ECONNRESET', 'ETIMEDOUT', 'EAI_AGAIN', 'ENOTFOUND'].includes(code))
|
|
82
|
+
return true;
|
|
83
|
+
return /fetch failed|socket hang up|timed? ?out/i.test(failure?.message || '');
|
|
84
|
+
}
|
|
85
|
+
function taskMatchesCreateIdentity(task, payload) {
|
|
86
|
+
for (const field of [
|
|
87
|
+
'externalKey',
|
|
88
|
+
'title',
|
|
89
|
+
'spaceId',
|
|
90
|
+
'goalId',
|
|
91
|
+
'projectId',
|
|
92
|
+
'parentId',
|
|
93
|
+
'commitmentId',
|
|
94
|
+
]) {
|
|
95
|
+
const requested = payload[field];
|
|
96
|
+
if (requested === undefined || requested === null || requested === '')
|
|
97
|
+
continue;
|
|
98
|
+
if (String(task[field] ?? '') !== String(requested))
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
54
103
|
class TasksCreate extends base_command_1.BaseCommand {
|
|
55
104
|
static description = 'Create a new task';
|
|
56
105
|
static examples = [
|
|
@@ -357,8 +406,11 @@ class TasksCreate extends base_command_1.BaseCommand {
|
|
|
357
406
|
});
|
|
358
407
|
}
|
|
359
408
|
let created;
|
|
409
|
+
let createRecovery;
|
|
360
410
|
try {
|
|
361
|
-
|
|
411
|
+
const result = await this.createTaskOrRecover(payload);
|
|
412
|
+
created = result.task;
|
|
413
|
+
createRecovery = result.recovery;
|
|
362
414
|
}
|
|
363
415
|
catch (err) {
|
|
364
416
|
// The CLI resolves the assignee default BEFORE sending, so by the time
|
|
@@ -405,7 +457,9 @@ class TasksCreate extends base_command_1.BaseCommand {
|
|
|
405
457
|
'Add it to the space, or pass an assignee explicitly.',
|
|
406
458
|
};
|
|
407
459
|
try {
|
|
408
|
-
|
|
460
|
+
const result = await this.createTaskOrRecover(payload);
|
|
461
|
+
created = result.task;
|
|
462
|
+
createRecovery = result.recovery;
|
|
409
463
|
}
|
|
410
464
|
catch (retryErr) {
|
|
411
465
|
this.handleApiError(retryErr);
|
|
@@ -423,10 +477,18 @@ class TasksCreate extends base_command_1.BaseCommand {
|
|
|
423
477
|
// bound". Surface the same decision plain mode prints under `assignment`
|
|
424
478
|
// — a scripted caller is exactly the audience that never sees the note.
|
|
425
479
|
// (OSK-4856)
|
|
426
|
-
this.log(JSON.stringify({
|
|
480
|
+
this.log(JSON.stringify({
|
|
481
|
+
...created,
|
|
482
|
+
url,
|
|
483
|
+
assignment: defaultAgentResolution,
|
|
484
|
+
...(createRecovery ? { recovery: createRecovery } : {}),
|
|
485
|
+
}, null, 2));
|
|
427
486
|
return;
|
|
428
487
|
}
|
|
429
|
-
this.log(
|
|
488
|
+
this.log(`${createRecovery ? 'Recovered' : 'Created'} task ${(0, tasks_1.formatTaskLabel)(created)}`);
|
|
489
|
+
if (createRecovery) {
|
|
490
|
+
this.log('The create response was uncertain, so skrr resolved the external key and returned the existing task instead of creating a duplicate.');
|
|
491
|
+
}
|
|
430
492
|
// Say so when nobody was assigned. The task exists either way — this is the
|
|
431
493
|
// line that stops "unassigned" from being a silent outcome.
|
|
432
494
|
if (defaultAgentResolution.note)
|
|
@@ -435,6 +497,47 @@ class TasksCreate extends base_command_1.BaseCommand {
|
|
|
435
497
|
this.log(`View it at ${url}`);
|
|
436
498
|
await (0, task_instruction_offer_1.maybeOfferTaskManagementInstructions)((message) => this.log(message));
|
|
437
499
|
}
|
|
500
|
+
async createTaskOrRecover(payload) {
|
|
501
|
+
try {
|
|
502
|
+
return {
|
|
503
|
+
task: await data_provider_1.dataService.createTask(payload),
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
catch (error) {
|
|
507
|
+
const externalKey = typeof payload.externalKey === 'string' ? payload.externalKey.trim() : '';
|
|
508
|
+
if (!externalKey || !taskCreateMayHaveCommitted(error))
|
|
509
|
+
throw error;
|
|
510
|
+
try {
|
|
511
|
+
const existing = await (0, tasks_1.findTaskByExternalKey)({
|
|
512
|
+
externalKey,
|
|
513
|
+
spaceId: payload.spaceId,
|
|
514
|
+
goalId: payload.goalId,
|
|
515
|
+
parentId: payload.parentId,
|
|
516
|
+
});
|
|
517
|
+
if (existing.task &&
|
|
518
|
+
existing.duplicates.length === 0 &&
|
|
519
|
+
taskMatchesCreateIdentity(existing.task, payload)) {
|
|
520
|
+
return {
|
|
521
|
+
task: existing.task,
|
|
522
|
+
recovery: {
|
|
523
|
+
kind: 'external_key_reconciliation',
|
|
524
|
+
externalKey,
|
|
525
|
+
originalFailureCode: taskCreateFailureCode(error) ?? null,
|
|
526
|
+
originalStatus: error?.status ??
|
|
527
|
+
error?.response?.status ??
|
|
528
|
+
null,
|
|
529
|
+
note: 'The original create response was uncertain; the existing matching task is the canonical result.',
|
|
530
|
+
},
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
catch {
|
|
535
|
+
// Preserve the original failure. A failed reconciliation is not proof
|
|
536
|
+
// that the write did or did not commit.
|
|
537
|
+
}
|
|
538
|
+
throw error;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
438
541
|
/**
|
|
439
542
|
* Predict the create route's `ASSIGNEE_NOT_IN_SPACE` degradation for a
|
|
440
543
|
* DEFAULTED assignee, so `--dry-run` does not report a payload the real
|
|
@@ -16,7 +16,15 @@ export default class TasksDeliverableAdd extends BaseCommand {
|
|
|
16
16
|
coordinate: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
17
17
|
};
|
|
18
18
|
static flags: {
|
|
19
|
+
status: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
19
20
|
lifecycle: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
21
|
+
title: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
22
|
+
provider: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
23
|
+
version: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
24
|
+
'content-digest': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
25
|
+
expectation: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
26
|
+
'run-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
27
|
+
'idempotency-key': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
20
28
|
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
21
29
|
};
|
|
22
30
|
run(): Promise<void>;
|
|
@@ -3,6 +3,9 @@ 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 outbox_1 = require("../../../lib/outbox");
|
|
7
|
+
const api_fetch_1 = require("../../../lib/api-fetch");
|
|
8
|
+
const session_task_endpoints_1 = require("../../../lib/session-task-endpoints");
|
|
6
9
|
const tasks_1 = require("../../../lib/tasks");
|
|
7
10
|
/**
|
|
8
11
|
* `skrr tasks deliverable add <task> <kind>:<identity>[@<location>]`
|
|
@@ -19,7 +22,7 @@ class TasksDeliverableAdd extends base_command_1.BaseCommand {
|
|
|
19
22
|
'<%= config.bin %> tasks deliverable add <task-id> code:a1b2c3d@origin/main',
|
|
20
23
|
'<%= config.bin %> tasks deliverable add <task-id> page:d_92@Engineering/deploy',
|
|
21
24
|
'<%= config.bin %> tasks deliverable add <task-id> file/pdf:f_71@Drive/Reports',
|
|
22
|
-
'<%= config.bin %> tasks deliverable add <task-id> code:a1b2c3d --
|
|
25
|
+
'<%= config.bin %> tasks deliverable add <task-id> code:a1b2c3d --status in_review',
|
|
23
26
|
];
|
|
24
27
|
static args = {
|
|
25
28
|
task: core_1.Args.string({ description: 'Task id or ref', required: true, ignoreStdin: true }),
|
|
@@ -31,11 +34,22 @@ class TasksDeliverableAdd extends base_command_1.BaseCommand {
|
|
|
31
34
|
}),
|
|
32
35
|
};
|
|
33
36
|
static flags = {
|
|
37
|
+
status: core_1.Flags.string({
|
|
38
|
+
options: ['local', 'in_review', 'available', 'unavailable', 'superseded'],
|
|
39
|
+
description: 'Observed availability. Defaults to `local`; evidence strength is recorded separately.',
|
|
40
|
+
}),
|
|
34
41
|
lifecycle: core_1.Flags.string({
|
|
35
|
-
options: ['local', 'in_review', '
|
|
36
|
-
description: '
|
|
37
|
-
|
|
42
|
+
options: ['local', 'in_review', 'available', 'unavailable', 'superseded'],
|
|
43
|
+
description: 'Deprecated compatibility alias for --status',
|
|
44
|
+
hidden: true,
|
|
38
45
|
}),
|
|
46
|
+
title: core_1.Flags.string({ description: 'Human-readable Deliverable name' }),
|
|
47
|
+
provider: core_1.Flags.string({ description: 'Provider, such as github or drive' }),
|
|
48
|
+
version: core_1.Flags.string({ description: 'Exact provider version, such as a full commit SHA' }),
|
|
49
|
+
'content-digest': core_1.Flags.string({ description: 'Integrity digest for this exact version' }),
|
|
50
|
+
expectation: core_1.Flags.string({ multiple: true, description: 'Expectation id this satisfies' }),
|
|
51
|
+
'run-id': core_1.Flags.string({ description: 'Run that produced it' }),
|
|
52
|
+
'idempotency-key': core_1.Flags.string({ description: 'Stable retry key' }),
|
|
39
53
|
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
40
54
|
};
|
|
41
55
|
async run() {
|
|
@@ -48,12 +62,31 @@ class TasksDeliverableAdd extends base_command_1.BaseCommand {
|
|
|
48
62
|
this.error(parsed.error, { exit: 1 });
|
|
49
63
|
return;
|
|
50
64
|
}
|
|
65
|
+
if (flags.status && flags.lifecycle && flags.status !== flags.lifecycle) {
|
|
66
|
+
this.error('--status and deprecated --lifecycle cannot disagree', { exit: 1 });
|
|
67
|
+
}
|
|
68
|
+
const status = flags.status || flags.lifecycle;
|
|
51
69
|
let result;
|
|
52
70
|
try {
|
|
53
|
-
|
|
71
|
+
const payload = {
|
|
54
72
|
...parsed.value,
|
|
55
|
-
...(
|
|
56
|
-
|
|
73
|
+
...(status ? { status } : {}),
|
|
74
|
+
title: flags.title,
|
|
75
|
+
provider: flags.provider,
|
|
76
|
+
version: flags.version,
|
|
77
|
+
contentDigest: flags['content-digest'],
|
|
78
|
+
expectationIds: flags.expectation,
|
|
79
|
+
runId: flags['run-id'],
|
|
80
|
+
idempotencyKey: flags['idempotency-key'] ||
|
|
81
|
+
(0, outbox_1.idempotencyKeyFor)('task-deliverable', args.task, JSON.stringify({ coordinate: parsed.value, status })),
|
|
82
|
+
};
|
|
83
|
+
const sessionPath = await (0, session_task_endpoints_1.sessionScopedTaskPath)('deliverable');
|
|
84
|
+
result = sessionPath
|
|
85
|
+
? await (0, api_fetch_1.apiFetch)(sessionPath, {
|
|
86
|
+
method: 'POST',
|
|
87
|
+
body: payload,
|
|
88
|
+
})
|
|
89
|
+
: await data_provider_1.dataService.addTaskDeliverable(args.task, payload);
|
|
57
90
|
}
|
|
58
91
|
catch (err) {
|
|
59
92
|
this.handleApiError(err);
|
|
@@ -64,7 +97,7 @@ class TasksDeliverableAdd extends base_command_1.BaseCommand {
|
|
|
64
97
|
return;
|
|
65
98
|
}
|
|
66
99
|
const where = parsed.value.location ? ` at ${parsed.value.location}` : '';
|
|
67
|
-
this.log(`Recorded ${parsed.value.kind}:${parsed.value.identity}${where} (${
|
|
100
|
+
this.log(`Recorded Deliverable ${result.link.id}: ${parsed.value.kind}:${parsed.value.identity}${where} (${status || 'local'}; self reported).`);
|
|
68
101
|
}
|
|
69
102
|
}
|
|
70
103
|
exports.default = TasksDeliverableAdd;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseCommand } from '../../../base-command';
|
|
2
2
|
/**
|
|
3
|
-
* `skrr tasks deliverable confirm <task> <
|
|
3
|
+
* `skrr tasks deliverable confirm <task> <resource-link-id> --reason "<what you checked>"`
|
|
4
4
|
*
|
|
5
5
|
* Somebody looked, and it is there.
|
|
6
6
|
*
|
|
@@ -16,16 +16,16 @@ import { BaseCommand } from '../../../base-command';
|
|
|
16
16
|
* are: the entire value of a confirmation is that a person actually looked, and
|
|
17
17
|
* a confirmation with nothing written down is indistinguishable from a click.
|
|
18
18
|
*
|
|
19
|
-
* It
|
|
20
|
-
*
|
|
21
|
-
*
|
|
19
|
+
* It confirms an exact linked Resource Version. A person never retypes identity
|
|
20
|
+
* or location during confirmation, because either may now name a different
|
|
21
|
+
* version than the one the Task actually delivered.
|
|
22
22
|
*/
|
|
23
23
|
export default class TasksDeliverableConfirm extends BaseCommand {
|
|
24
24
|
static description: string;
|
|
25
25
|
static examples: string[];
|
|
26
26
|
static args: {
|
|
27
27
|
task: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
28
|
-
|
|
28
|
+
link: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
29
29
|
};
|
|
30
30
|
static flags: {
|
|
31
31
|
reason: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
@@ -3,9 +3,8 @@ 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 tasks_1 = require("../../../lib/tasks");
|
|
7
6
|
/**
|
|
8
|
-
* `skrr tasks deliverable confirm <task> <
|
|
7
|
+
* `skrr tasks deliverable confirm <task> <resource-link-id> --reason "<what you checked>"`
|
|
9
8
|
*
|
|
10
9
|
* Somebody looked, and it is there.
|
|
11
10
|
*
|
|
@@ -21,20 +20,19 @@ const tasks_1 = require("../../../lib/tasks");
|
|
|
21
20
|
* are: the entire value of a confirmation is that a person actually looked, and
|
|
22
21
|
* a confirmation with nothing written down is indistinguishable from a click.
|
|
23
22
|
*
|
|
24
|
-
* It
|
|
25
|
-
*
|
|
26
|
-
*
|
|
23
|
+
* It confirms an exact linked Resource Version. A person never retypes identity
|
|
24
|
+
* or location during confirmation, because either may now name a different
|
|
25
|
+
* version than the one the Task actually delivered.
|
|
27
26
|
*/
|
|
28
27
|
class TasksDeliverableConfirm extends base_command_1.BaseCommand {
|
|
29
28
|
static description = 'Confirm you checked a deliverable and it is there — the evidence an expectation needs when nothing observes it automatically';
|
|
30
29
|
static examples = [
|
|
31
|
-
'<%= config.bin %> tasks deliverable confirm <task-id>
|
|
32
|
-
'<%= config.bin %> tasks deliverable confirm <task-id> message:m_51@#general --reason "Read the thread; it went out at 09:04."',
|
|
30
|
+
'<%= config.bin %> tasks deliverable confirm <task-id> <resource-link-id> --reason "Opened the exact version; all four sections are there."',
|
|
33
31
|
];
|
|
34
32
|
static args = {
|
|
35
33
|
task: core_1.Args.string({ description: 'Task id or ref', required: true, ignoreStdin: true }),
|
|
36
|
-
|
|
37
|
-
description: '
|
|
34
|
+
link: core_1.Args.string({
|
|
35
|
+
description: 'Task Resource link id for the exact version you checked',
|
|
38
36
|
required: true,
|
|
39
37
|
ignoreStdin: true,
|
|
40
38
|
}),
|
|
@@ -49,17 +47,10 @@ class TasksDeliverableConfirm extends base_command_1.BaseCommand {
|
|
|
49
47
|
async run() {
|
|
50
48
|
this.requireAuth();
|
|
51
49
|
const { args, flags } = await this.parse(TasksDeliverableConfirm);
|
|
52
|
-
const parsed = (0, tasks_1.parseDeliverableCoordinate)(args.coordinate);
|
|
53
|
-
if (!parsed.ok) {
|
|
54
|
-
// For an agent the refusal IS the documentation — it hits the error and
|
|
55
|
-
// corrects — so it carries the whole form and vocabulary.
|
|
56
|
-
this.error(parsed.error, { exit: 1 });
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
50
|
let result;
|
|
60
51
|
try {
|
|
61
52
|
result = await data_provider_1.dataService.confirmTaskDeliverable(args.task, {
|
|
62
|
-
|
|
53
|
+
linkId: args.link,
|
|
63
54
|
reason: flags.reason,
|
|
64
55
|
});
|
|
65
56
|
}
|
|
@@ -71,7 +62,7 @@ class TasksDeliverableConfirm extends base_command_1.BaseCommand {
|
|
|
71
62
|
this.log(JSON.stringify(result, null, 2));
|
|
72
63
|
return;
|
|
73
64
|
}
|
|
74
|
-
this.log(`Confirmed ${
|
|
65
|
+
this.log(`Confirmed Deliverable link ${args.link}: ${flags.reason}`);
|
|
75
66
|
}
|
|
76
67
|
}
|
|
77
68
|
exports.default = TasksDeliverableConfirm;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base-command';
|
|
2
|
+
export default class TasksDeliverableList extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
task: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static flags: {
|
|
8
|
+
task: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
5
|
+
const base_command_1 = require("../../../base-command");
|
|
6
|
+
const task_resolver_1 = require("../../../lib/task-resolver");
|
|
7
|
+
class TasksDeliverableList extends base_command_1.BaseCommand {
|
|
8
|
+
static description = 'List Deliverables with exact version, location, and evidence state';
|
|
9
|
+
static args = {
|
|
10
|
+
task: core_1.Args.string({ required: false, ignoreStdin: true, description: 'Task id or ref' }),
|
|
11
|
+
};
|
|
12
|
+
static flags = {
|
|
13
|
+
task: core_1.Flags.string({ description: 'Task id; overrides runtime context' }),
|
|
14
|
+
json: core_1.Flags.boolean({ description: 'Output JSON' }),
|
|
15
|
+
};
|
|
16
|
+
async run() {
|
|
17
|
+
this.requireAuth();
|
|
18
|
+
const { args, flags } = await this.parse(TasksDeliverableList);
|
|
19
|
+
const task = (0, task_resolver_1.resolveTaskIdentity)({ positionalId: args.task, flagTask: flags.task });
|
|
20
|
+
let result;
|
|
21
|
+
try {
|
|
22
|
+
result = await data_provider_1.dataService.listTaskDeliverables(task.id);
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
this.handleApiError(error);
|
|
26
|
+
}
|
|
27
|
+
if (flags.json)
|
|
28
|
+
return this.log(JSON.stringify(result, null, 2));
|
|
29
|
+
if (!result.data.length)
|
|
30
|
+
return this.log('No Deliverables recorded.');
|
|
31
|
+
for (const item of result.data) {
|
|
32
|
+
this.log(`${item.linkId} · ${item.title || item.identity || item.kind}\n` +
|
|
33
|
+
` ${item.location || 'no locator'} · ${item.versionFidelity} · ${item.status} · ${item.evidenceLevel}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.default = TasksDeliverableList;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BaseCommand } from '../../../base-command';
|
|
2
2
|
export default class TasksEventsAppend extends BaseCommand {
|
|
3
|
+
static hidden: boolean;
|
|
3
4
|
static summary: string;
|
|
4
5
|
static description: string;
|
|
5
6
|
static examples: string[];
|
|
@@ -16,6 +17,7 @@ export default class TasksEventsAppend extends BaseCommand {
|
|
|
16
17
|
next: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
17
18
|
evidence: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
18
19
|
deliverable: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
20
|
+
artifact: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
19
21
|
};
|
|
20
22
|
run(): Promise<void>;
|
|
21
23
|
}
|
|
@@ -6,12 +6,12 @@ const base_command_1 = require("../../../base-command");
|
|
|
6
6
|
const task_resolver_1 = require("../../../lib/task-resolver");
|
|
7
7
|
const api_fetch_1 = require("../../../lib/api-fetch");
|
|
8
8
|
const session_task_endpoints_1 = require("../../../lib/session-task-endpoints");
|
|
9
|
+
const task_artifact_flags_1 = require("../../../lib/task-artifact-flags");
|
|
9
10
|
const tasks_1 = require("../../../lib/tasks");
|
|
10
11
|
class TasksEventsAppend extends base_command_1.BaseCommand {
|
|
12
|
+
static hidden = true;
|
|
11
13
|
static summary = 'Append a typed, durable task event';
|
|
12
|
-
static description = '
|
|
13
|
-
'or a handoff — on the task you are executing. Not a log of tool calls: an event that is ' +
|
|
14
|
-
'worth reading six weeks from now. `skrr tasks timeline <id>` reads them back.';
|
|
14
|
+
static description = 'Compatibility adapter for historical Event vocabulary; use `tasks updates add`.';
|
|
15
15
|
static examples = [
|
|
16
16
|
'<%= config.bin %> tasks events append <task-id> --kind checkpoint --idempotency-key "<task-id>:first-pass" --summary "Parser handles nested fences"',
|
|
17
17
|
'<%= config.bin %> tasks events append <task-id> --kind decision --idempotency-key "<task-id>:storage-choice" --summary "Chose the CRDT path" --evidence "A direct contentHtml write is reverted by the next render tick"',
|
|
@@ -58,11 +58,16 @@ class TasksEventsAppend extends base_command_1.BaseCommand {
|
|
|
58
58
|
multiple: true,
|
|
59
59
|
description: 'Durable reference: a file path, commit sha, or URL. Repeatable. "in the conversation" is not a deliverable',
|
|
60
60
|
}),
|
|
61
|
+
artifact: core_1.Flags.string({
|
|
62
|
+
multiple: true,
|
|
63
|
+
description: 'Compatibility alias for --deliverable used by older managed instruction blocks',
|
|
64
|
+
}),
|
|
61
65
|
};
|
|
62
66
|
async run() {
|
|
63
67
|
this.requireAuth();
|
|
64
68
|
const { args, flags } = await this.parse(TasksEventsAppend);
|
|
65
69
|
const task = (0, task_resolver_1.resolveTaskIdentity)({ positionalId: args.id, flagTask: flags.task });
|
|
70
|
+
const deliverables = (0, task_artifact_flags_1.mergeTaskArtifactFlags)(flags.deliverable, flags.artifact);
|
|
66
71
|
const data = {
|
|
67
72
|
idempotencyKey: flags['idempotency-key'],
|
|
68
73
|
kind: flags.kind,
|
|
@@ -70,7 +75,9 @@ class TasksEventsAppend extends base_command_1.BaseCommand {
|
|
|
70
75
|
changed: flags.changed,
|
|
71
76
|
next: flags.next,
|
|
72
77
|
evidence: flags.evidence,
|
|
73
|
-
artifacts:
|
|
78
|
+
artifacts: deliverables.length
|
|
79
|
+
? deliverables.map((ref) => ({ label: 'deliverable', ref }))
|
|
80
|
+
: undefined,
|
|
74
81
|
};
|
|
75
82
|
const path = await (0, session_task_endpoints_1.sessionScopedTaskPath)('event');
|
|
76
83
|
let result;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BaseCommand } from '../../../base-command';
|
|
2
2
|
export default class TasksEventsList extends BaseCommand {
|
|
3
|
+
static hidden: boolean;
|
|
3
4
|
static description: string;
|
|
4
5
|
static args: {
|
|
5
6
|
id: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
@@ -7,6 +7,7 @@ const task_resolver_1 = require("../../../lib/task-resolver");
|
|
|
7
7
|
const format_1 = require("../../../lib/format");
|
|
8
8
|
const tasks_1 = require("../../../lib/tasks");
|
|
9
9
|
class TasksEventsList extends base_command_1.BaseCommand {
|
|
10
|
+
static hidden = true;
|
|
10
11
|
static description = 'List durable task events';
|
|
11
12
|
static args = {
|
|
12
13
|
id: core_1.Args.string({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BaseCommand } from '../../../base-command';
|
|
2
2
|
export default class TasksEventsTail extends BaseCommand {
|
|
3
|
+
static hidden: boolean;
|
|
3
4
|
static description: string;
|
|
4
5
|
static args: {
|
|
5
6
|
id: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
@@ -5,6 +5,7 @@ const data_provider_1 = require("@skrr-ai/data-provider");
|
|
|
5
5
|
const base_command_1 = require("../../../base-command");
|
|
6
6
|
const task_resolver_1 = require("../../../lib/task-resolver");
|
|
7
7
|
class TasksEventsTail extends base_command_1.BaseCommand {
|
|
8
|
+
static hidden = true;
|
|
8
9
|
static description = 'Follow new task events';
|
|
9
10
|
static args = { id: core_1.Args.string({ required: false, ignoreStdin: true }) };
|
|
10
11
|
static flags = {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base-command';
|
|
2
|
+
export default class TasksExpectationsAssess extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
task: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
6
|
+
expectation: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
static flags: {
|
|
9
|
+
task: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
decision: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
reason: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
+
'result-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
+
'run-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
14
|
+
'resource-link-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
15
|
+
evidence: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
16
|
+
'spec-version': import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
17
|
+
'idempotency-key': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
18
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
19
|
+
};
|
|
20
|
+
run(): Promise<void>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
5
|
+
const base_command_1 = require("../../../base-command");
|
|
6
|
+
const outbox_1 = require("../../../lib/outbox");
|
|
7
|
+
const task_resolver_1 = require("../../../lib/task-resolver");
|
|
8
|
+
const api_fetch_1 = require("../../../lib/api-fetch");
|
|
9
|
+
const session_task_endpoints_1 = require("../../../lib/session-task-endpoints");
|
|
10
|
+
class TasksExpectationsAssess extends base_command_1.BaseCommand {
|
|
11
|
+
static description = 'Assess one current Task Expectation with evidence and a reason';
|
|
12
|
+
static args = {
|
|
13
|
+
task: core_1.Args.string({ required: false, ignoreStdin: true, description: 'Task id or ref' }),
|
|
14
|
+
expectation: core_1.Args.string({ required: true, ignoreStdin: true, description: 'Expectation id' }),
|
|
15
|
+
};
|
|
16
|
+
static flags = {
|
|
17
|
+
task: core_1.Flags.string({ description: 'Task id; overrides runtime context' }),
|
|
18
|
+
decision: core_1.Flags.string({ required: true, options: ['met', 'unmet', 'waived'] }),
|
|
19
|
+
reason: core_1.Flags.string({ required: true, description: 'Why this assessment is justified' }),
|
|
20
|
+
'result-id': core_1.Flags.string({ description: 'Result this assessment concerns' }),
|
|
21
|
+
'run-id': core_1.Flags.string({ description: 'Canonical assessor Run for a generic API call' }),
|
|
22
|
+
'resource-link-id': core_1.Flags.string({ description: 'Deliverable Resource link supporting it' }),
|
|
23
|
+
evidence: core_1.Flags.string({
|
|
24
|
+
multiple: true,
|
|
25
|
+
description: 'Evidence reference as <kind>:<id-or-uri>',
|
|
26
|
+
}),
|
|
27
|
+
'spec-version': core_1.Flags.integer({ description: 'Task specification version being assessed' }),
|
|
28
|
+
'idempotency-key': core_1.Flags.string({ description: 'Stable retry key' }),
|
|
29
|
+
json: core_1.Flags.boolean({ description: 'Output JSON' }),
|
|
30
|
+
};
|
|
31
|
+
async run() {
|
|
32
|
+
this.requireAuth();
|
|
33
|
+
const { args, flags } = await this.parse(TasksExpectationsAssess);
|
|
34
|
+
const task = (0, task_resolver_1.resolveTaskIdentity)({ positionalId: args.task, flagTask: flags.task });
|
|
35
|
+
const evidenceRefs = (flags.evidence || []).map((raw) => {
|
|
36
|
+
const split = raw.indexOf(':');
|
|
37
|
+
if (split < 1)
|
|
38
|
+
this.error('--evidence must be <kind>:<id-or-uri>', { exit: 1 });
|
|
39
|
+
const kind = raw.slice(0, split);
|
|
40
|
+
const value = raw.slice(split + 1);
|
|
41
|
+
return /^https?:|^file:/.test(value) ? { kind, uri: value } : { kind, id: value };
|
|
42
|
+
});
|
|
43
|
+
const payload = {
|
|
44
|
+
decision: flags.decision,
|
|
45
|
+
runId: flags['run-id'],
|
|
46
|
+
reason: flags.reason,
|
|
47
|
+
resultId: flags['result-id'],
|
|
48
|
+
resourceLinkId: flags['resource-link-id'],
|
|
49
|
+
evidenceRefs,
|
|
50
|
+
expectedSpecVersion: flags['spec-version'],
|
|
51
|
+
};
|
|
52
|
+
let result;
|
|
53
|
+
try {
|
|
54
|
+
const data = {
|
|
55
|
+
...payload,
|
|
56
|
+
expectationId: args.expectation,
|
|
57
|
+
idempotencyKey: flags['idempotency-key'] ||
|
|
58
|
+
(0, outbox_1.idempotencyKeyFor)('task-expectation-assessment', task.id, JSON.stringify({ expectationId: args.expectation, ...payload })),
|
|
59
|
+
};
|
|
60
|
+
const sessionPath = await (0, session_task_endpoints_1.sessionScopedTaskPath)('assessment');
|
|
61
|
+
result = sessionPath
|
|
62
|
+
? await (0, api_fetch_1.apiFetch)(sessionPath, { method: 'POST', body: data })
|
|
63
|
+
: await data_provider_1.dataService.assessTaskExpectation({
|
|
64
|
+
taskId: task.id,
|
|
65
|
+
expectationId: args.expectation,
|
|
66
|
+
data,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
this.handleApiError(error);
|
|
71
|
+
}
|
|
72
|
+
if (flags.json)
|
|
73
|
+
return this.log(JSON.stringify(result, null, 2));
|
|
74
|
+
this.log(`Recorded ${args.expectation} as ${flags.decision}.`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.default = TasksExpectationsAssess;
|