@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.
Files changed (97) hide show
  1. package/dist/base-command.js +0 -1
  2. package/dist/commands/activity/scan-older.d.ts +1 -1
  3. package/dist/commands/activity/scan-older.js +5 -4
  4. package/dist/commands/agent/message/approve.d.ts +1 -0
  5. package/dist/commands/agent/message/approve.js +6 -2
  6. package/dist/commands/agent/message/decline.d.ts +1 -0
  7. package/dist/commands/agent/message/decline.js +6 -2
  8. package/dist/commands/agent/message/pending.js +5 -2
  9. package/dist/commands/agent/message/review.d.ts +13 -0
  10. package/dist/commands/agent/message/review.js +68 -0
  11. package/dist/commands/agents/always-on/recovery-close.d.ts +28 -0
  12. package/dist/commands/agents/always-on/recovery-close.js +60 -0
  13. package/dist/commands/agents/always-on/recovery-review.d.ts +22 -0
  14. package/dist/commands/agents/always-on/recovery-review.js +190 -0
  15. package/dist/commands/apps/installations/compatibility.js +1 -1
  16. package/dist/commands/apps/installations/list.js +3 -0
  17. package/dist/commands/apps/installations/migrate/abort.d.ts +13 -0
  18. package/dist/commands/apps/installations/migrate/abort.js +45 -0
  19. package/dist/commands/apps/installations/migrate/cutover.d.ts +15 -0
  20. package/dist/commands/apps/installations/migrate/cutover.js +102 -0
  21. package/dist/commands/apps/installations/migrate/plan.d.ts +13 -0
  22. package/dist/commands/apps/installations/migrate/plan.js +51 -0
  23. package/dist/commands/apps/installations/migrate/rollback.d.ts +16 -0
  24. package/dist/commands/apps/installations/migrate/rollback.js +103 -0
  25. package/dist/commands/apps/installations/migrate/stage.d.ts +15 -0
  26. package/dist/commands/apps/installations/migrate/stage.js +96 -0
  27. package/dist/commands/apps/installations/migrate/status.d.ts +12 -0
  28. package/dist/commands/apps/installations/migrate/status.js +52 -0
  29. package/dist/commands/apps/installations/migrate/validate.d.ts +14 -0
  30. package/dist/commands/apps/installations/migrate/validate.js +58 -0
  31. package/dist/commands/apps/installations/show.js +8 -6
  32. package/dist/commands/apps/operations/check.js +1 -1
  33. package/dist/commands/apps/resume.js +1 -1
  34. package/dist/commands/apps/settings/set.js +22 -10
  35. package/dist/commands/duties/show.js +10 -0
  36. package/dist/commands/goals/key-results/assess.d.ts +2 -3
  37. package/dist/commands/goals/key-results/assess.js +5 -12
  38. package/dist/commands/harnesses/removal-references.d.ts +16 -0
  39. package/dist/commands/harnesses/removal-references.js +61 -0
  40. package/dist/commands/tasks/actionability.js +8 -3
  41. package/dist/commands/tasks/complete.js +35 -17
  42. package/dist/commands/tasks/expectations/assess.d.ts +1 -0
  43. package/dist/commands/tasks/expectations/assess.js +50 -21
  44. package/dist/commands/tasks/expectations.js +5 -2
  45. package/dist/commands/tasks/judge.d.ts +1 -0
  46. package/dist/commands/tasks/judge.js +17 -2
  47. package/dist/commands/tasks/result/submit.js +26 -17
  48. package/dist/commands/tasks/review-queue.js +2 -1
  49. package/dist/commands/tasks/review.d.ts +1 -0
  50. package/dist/commands/tasks/review.js +24 -3
  51. package/dist/commands/tasks/show.d.ts +13 -0
  52. package/dist/commands/tasks/show.js +41 -3
  53. package/dist/commands/tasks/updates/add.d.ts +1 -0
  54. package/dist/commands/tasks/updates/add.js +71 -21
  55. package/dist/commands/tasks/updates/list.d.ts +4 -0
  56. package/dist/commands/tasks/updates/list.js +3 -1
  57. package/dist/commands/tasks/waive.d.ts +1 -0
  58. package/dist/commands/tasks/waive.js +17 -2
  59. package/dist/generated/agent-guides.json +20 -20
  60. package/dist/lib/agent-activity.d.ts +3 -1
  61. package/dist/lib/agent-activity.js +50 -11
  62. package/dist/lib/api-fetch.js +32 -5
  63. package/dist/lib/appCompatibility.js +1 -1
  64. package/dist/lib/appData.d.ts +1 -1
  65. package/dist/lib/appData.js +6 -2
  66. package/dist/lib/appDataMigration.d.ts +204 -0
  67. package/dist/lib/appDataMigration.js +753 -0
  68. package/dist/lib/appDataMigrationCommand.d.ts +39 -0
  69. package/dist/lib/appDataMigrationCommand.js +90 -0
  70. package/dist/lib/appInstallations.d.ts +8 -0
  71. package/dist/lib/appInstallations.js +55 -2
  72. package/dist/lib/apps-command.js +17 -10
  73. package/dist/lib/harnesses.d.ts +24 -0
  74. package/dist/lib/harnesses.js +4 -0
  75. package/dist/lib/node-adapter.d.ts +0 -2
  76. package/dist/lib/node-adapter.js +46 -42
  77. package/dist/lib/rate-limit-retry.d.ts +4 -5
  78. package/dist/lib/rate-limit-retry.js +6 -10
  79. package/dist/lib/reference-syntax.d.ts +28 -0
  80. package/dist/lib/reference-syntax.js +91 -0
  81. package/dist/lib/refresh.d.ts +2 -0
  82. package/dist/lib/refresh.js +6 -0
  83. package/dist/lib/runtime-context.js +6 -0
  84. package/dist/lib/task-closure.d.ts +1 -1
  85. package/dist/lib/task-closure.js +1 -1
  86. package/dist/lib/task-operations.d.ts +28 -6
  87. package/dist/lib/task-operations.js +77 -4
  88. package/dist/lib/task-preflight.js +8 -3
  89. package/dist/lib/task-write-attribution.d.ts +183 -19
  90. package/dist/lib/task-write-attribution.js +270 -39
  91. package/dist/lib/write-outcome.d.ts +2 -0
  92. package/dist/lib/write-outcome.js +14 -0
  93. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.js +63 -0
  94. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.js +71 -0
  95. package/dist/node_modules/@skrr-ai/data-provider/index.js +11635 -11306
  96. package/oclif.manifest.json +1387 -412
  97. package/package.json +5 -2
@@ -36,14 +36,18 @@ class AppsSettingsSet extends apps_command_1.AppsCommand {
36
36
  ...(0, appSettings_1.formatAppSettings)(current.configuration, settings, current.timezone),
37
37
  ...(0, appSettings_1.formatInstallDefaults)(current.configuration, settings),
38
38
  ...(current.canEdit === false
39
- ? ['At the time of this read, the server says settings are not editable under the current access and approval state. This may change.']
39
+ ? [
40
+ 'At the time of this read, the server says settings are not editable under the current access and approval state. This may change.',
41
+ ]
40
42
  : current.canEdit !== true
41
43
  ? ['The server did not say whether settings are currently editable.']
42
44
  : []),
43
45
  ...(current.canEdit === false && current.canReviewBundleApproval === true
44
- ? [installationForDisplay === '<installation-id>'
46
+ ? [
47
+ installationForDisplay === '<installation-id>'
45
48
  ? 'To review the current version, first find a valid installation ID, then use apps reconsent without --yes.'
46
- : `To review the current version, run \`${this.config.bin} apps reconsent ${installationForDisplay}\` without --yes using the same account, deployment, profile and workspace.`]
49
+ : `To review the current version, run \`${this.config.bin} apps reconsent ${installationForDisplay}\` without --yes using the same account, deployment, profile and workspace.`,
50
+ ]
47
51
  : []),
48
52
  ];
49
53
  if (!flags.yes)
@@ -65,9 +69,11 @@ class AppsSettingsSet extends apps_command_1.AppsCommand {
65
69
  expectedGrantedAt: current.expectedGrantedAt,
66
70
  consent: { versionId: current.expectedVersionId, bundleHash: current.bundleHash, settings },
67
71
  });
68
- if (!result || !data_provider_1.AppSettingsSchema.safeParse(result.settings).success ||
72
+ if (!result ||
73
+ !data_provider_1.AppSettingsSchema.safeParse(result.settings).success ||
69
74
  !(0, data_provider_1.appSettingsEqual)(result.settings, settings) ||
70
- result.expectedVersionId !== current.expectedVersionId || result.bundleHash !== current.bundleHash ||
75
+ result.expectedVersionId !== current.expectedVersionId ||
76
+ result.bundleHash !== current.bundleHash ||
71
77
  typeof result.expectedGrantedAt !== 'string' ||
72
78
  !(Date.parse(result.expectedGrantedAt) > Date.parse(current.expectedGrantedAt)) ||
73
79
  !data_provider_1.AppSettingsManifestSchema.safeParse(result.configuration).success) {
@@ -79,13 +85,17 @@ class AppsSettingsSet extends apps_command_1.AppsCommand {
79
85
  this.log(`Saved settings for ${args.installation}. Schedule reconciliation was requested; use apps installations show to inspect job state.`);
80
86
  }
81
87
  catch (error) {
82
- if (error instanceof Error && ((0, base_command_1.isOclifExitError)(error) ||
83
- typeof error.oclif?.exit === 'number'))
88
+ if (error instanceof Error &&
89
+ ((0, base_command_1.isOclifExitError)(error) ||
90
+ typeof error.oclif?.exit === 'number'))
84
91
  throw error;
85
92
  if (responseValidated)
86
93
  return this.failConfirmedDataOutput();
87
94
  const refusal = (0, apps_1.readAppsRefusal)(error);
88
- if (refusal?.error === 'consent_mismatch' && writeStarted && refusal.status === 409 && refusal.reason === 'installation_reconsent_required') {
95
+ if (refusal?.error === 'consent_mismatch' &&
96
+ writeStarted &&
97
+ refusal.status === 409 &&
98
+ refusal.reason === 'installation_reconsent_required') {
89
99
  return this.failWithCliError({
90
100
  message: `This installation's current version needs approval again. Settings were not changed. Review it with \`${this.config.bin} apps reconsent ${installationForDisplay}\` (without --yes); after approving it, preview the settings again.`,
91
101
  code: 'APP_CONSENT_MISMATCH',
@@ -95,7 +105,9 @@ class AppsSettingsSet extends apps_command_1.AppsCommand {
95
105
  details: {
96
106
  reason: refusal.reason,
97
107
  ...(refusal.docCount === undefined ? {} : { docCount: refusal.docCount }),
98
- ...(refusal.installationId === undefined ? {} : { installationId: refusal.installationId }),
108
+ ...(refusal.installationId === undefined
109
+ ? {}
110
+ : { installationId: refusal.installationId }),
99
111
  ...(refusal.current ? { current: refusal.current } : {}),
100
112
  },
101
113
  });
@@ -124,7 +136,7 @@ class AppsSettingsSet extends apps_command_1.AppsCommand {
124
136
  retryable: false,
125
137
  });
126
138
  }
127
- this.failInstallation(error);
139
+ this.failInstallation(error, { subject: args.installation });
128
140
  }
129
141
  }
130
142
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SHOW_JSON_DESCRIPTION = void 0;
4
4
  const core_1 = require("@oclif/core");
5
+ const data_provider_1 = require("@skrr-ai/data-provider");
5
6
  const base_command_1 = require("../../base-command");
6
7
  const duties_1 = require("../../lib/duties");
7
8
  const web_url_1 = require("../../lib/web-url");
@@ -74,6 +75,15 @@ class DutiesShow extends base_command_1.BaseCommand {
74
75
  const autonomy = response.operatingState?.execution;
75
76
  for (const line of (0, duties_1.permissionLines)(autonomy?.permissions))
76
77
  this.log(line);
78
+ // A latest Run the claim admitted without a Check dispatch proof, through an allowance the owner
79
+ // accepted (2026-11-12), is held at its claim, or was ended by it before it started (OSK-24383).
80
+ // The server records each on the Run; this is where a person reads it.
81
+ for (const line of (0, data_provider_1.describeLatestRunClaim)(response.operatingState?.latestRun))
82
+ this.log(`Latest run: ${line}`);
83
+ // A Run queued under an earlier contract version that is still held (OSK-24386); `Latest run`
84
+ // reads the current version only.
85
+ for (const line of (0, data_provider_1.describeHeldRunsOnEarlierVersions)(response.operatingState))
86
+ this.log(`Earlier run: ${line}`);
77
87
  // `show` is the first surface a person reaches after linking something, and
78
88
  // it used to render only watchedSources — a freshly linked goal or task was
79
89
  // invisible until you knew to run `links list` (OSK-10963).
@@ -29,8 +29,7 @@ export default class GoalsKeyResultsAssess extends BaseCommand {
29
29
  run(): Promise<void>;
30
30
  }
31
31
  /**
32
- * `<kind>:<id-or-uri>` → a reference. A value that looks like a URL is a `uri`,
33
- * anything else an `id` — the same reading `tasks expectations assess` uses.
34
- * Exported for `assess.spec.ts`.
32
+ * `<kind>:<id-or-uri>` or a URL → a reference, read by the one parser every
33
+ * evidence flag uses (`lib/reference-syntax.ts`). Exported for `assess.spec.ts`.
35
34
  */
36
35
  export declare function parseEvidenceRef(raw: string): KeyResultEvidenceRef;
@@ -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>` → a reference. A value that looks like a URL is a `uri`,
100
- * anything else an `id` — the same reading `tasks expectations assess` uses.
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
- const split = raw.indexOf(':');
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 verb = (0, task_operations_1.taskActionCommand)(action, response.taskId, targetId, this.config.bin, {
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
- this.log(` ${action.padEnd(width)}${verb ? ` → ${verb}` : ''}`);
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 PARSE_REFERENCE_RE = /^[a-z][a-z0-9+.-]*:/i;
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({ multiple: true, description: 'Evidence as <kind>:<id-or-uri>' }),
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: flags.evidence?.map(parseReference),
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: { ...payload, idempotencyKey },
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
- this.log(`Submitted Result v${result.result.version}; Task is ${result.task.statusType || result.task.status || 'updated'}.`);
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
- const evidenceRefs = (flags.evidence || []).map((raw) => {
113
- const split = raw.indexOf(':');
114
- if (split < 1)
115
- this.error('--evidence must be <kind>:<id-or-uri>', { exit: 1 });
116
- const kind = raw.slice(0, split);
117
- const value = raw.slice(split + 1);
118
- return RUN_RE.test(value) ? { kind, uri: value } : { kind, id: value };
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({ taskId: task.id, expectationId: id, data });
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.taskWriteAttribution)(receipt, 'assessedBy') });
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
- this.log(`Recorded ${settled.length} Expectation(s) as ${flags.decision}: ${settled.join(', ')}`);
223
- for (const { id, attribution } of attributions) {
224
- for (const line of (0, task_write_attribution_1.attributionLines)(attribution))
225
- this.log(`${id}: ${line}`);
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 attribution = (0, task_write_attribution_1.taskWriteAttribution)(result, 'assessedBy');
241
- if (flags.json)
242
- return this.printJsonResult({ ...result, attribution });
243
- this.log(`Recorded ${expectationId} as ${flags.decision}.`);
244
- for (const line of (0, task_write_attribution_1.attributionLines)(attribution))
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
- return ` (${(0, task_closure_1.describeAssessor)(expectation.assessedByKind)})`;
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 ? ` by ${(0, task_closure_1.describeAssessor)(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
- this.log(`Recorded ${args.expectation} as ${flags.verdict}: ${flags.reason}`);
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;