@skrr-ai/cli 0.1.41 → 0.1.43

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 (79) hide show
  1. package/dist/commands/balance/overage.js +4 -3
  2. package/dist/commands/balance/plan.js +10 -6
  3. package/dist/commands/balance/usage/events.js +3 -2
  4. package/dist/commands/balance/usage.js +2 -1
  5. package/dist/commands/browser/install.js +3 -2
  6. package/dist/commands/browser/uninstall.js +3 -2
  7. package/dist/commands/code/install.js +6 -6
  8. package/dist/commands/followups/remind.js +4 -0
  9. package/dist/commands/harnesses/install.d.ts +29 -0
  10. package/dist/commands/harnesses/install.js +153 -25
  11. package/dist/commands/harnesses/installers.d.ts +10 -0
  12. package/dist/commands/harnesses/installers.js +31 -0
  13. package/dist/commands/harnesses/list.js +3 -2
  14. package/dist/commands/skills/import-as-actions.js +6 -15
  15. package/dist/commands/tasks/attachments/set-role.d.ts +24 -0
  16. package/dist/commands/tasks/attachments/set-role.js +60 -0
  17. package/dist/commands/tasks/attachments/upload.d.ts +1 -0
  18. package/dist/commands/tasks/attachments/upload.js +18 -52
  19. package/dist/commands/tasks/comments/add.d.ts +1 -0
  20. package/dist/commands/tasks/comments/add.js +67 -2
  21. package/dist/commands/tasks/complete.d.ts +1 -0
  22. package/dist/commands/tasks/complete.js +69 -1
  23. package/dist/commands/tasks/result/submit.d.ts +3 -0
  24. package/dist/commands/tasks/result/submit.js +78 -5
  25. package/dist/commands/tasks/update.js +4 -2
  26. package/dist/commands/tasks/updates/add.d.ts +1 -0
  27. package/dist/commands/tasks/updates/add.js +63 -0
  28. package/dist/lib/api-fetch.js +7 -2
  29. package/dist/lib/cli-installers.d.ts +63 -4
  30. package/dist/lib/cli-installers.js +98 -8
  31. package/dist/lib/dedicated-machines.js +4 -2
  32. package/dist/lib/file-mime.js +1 -1
  33. package/dist/lib/first-party-harness-agent.js +6 -5
  34. package/dist/lib/first-party-harness-doctor.js +15 -32
  35. package/dist/lib/first-party-harness-managed.d.ts +9 -4
  36. package/dist/lib/first-party-harness-managed.js +13 -10
  37. package/dist/lib/first-party-harness.d.ts +25 -21
  38. package/dist/lib/first-party-harness.js +40 -27
  39. package/dist/lib/followups.d.ts +2 -0
  40. package/dist/lib/harness-provider-input.d.ts +18 -12
  41. package/dist/lib/harness-provider-input.js +18 -12
  42. package/dist/lib/harness-tiers.d.ts +4 -3
  43. package/dist/lib/harness-tiers.js +4 -3
  44. package/dist/lib/html-text.js +25 -0
  45. package/dist/lib/local-skills.d.ts +27 -0
  46. package/dist/lib/local-skills.js +38 -0
  47. package/dist/lib/session-task-endpoints.d.ts +1 -1
  48. package/dist/lib/session-task-endpoints.js +3 -0
  49. package/dist/lib/task-asset-upload.d.ts +84 -0
  50. package/dist/lib/task-asset-upload.js +374 -0
  51. package/dist/lib/task-closure.d.ts +28 -0
  52. package/dist/lib/task-closure.js +37 -0
  53. package/dist/lib/tasks.d.ts +8 -0
  54. package/dist/lib/tasks.js +16 -0
  55. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarness.d.ts +113 -39
  56. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarness.js +148 -71
  57. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessChannels.d.ts +21 -33
  58. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessChannels.js +24 -50
  59. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessHome.d.ts +19 -7
  60. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessHome.js +26 -10
  61. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessTrust.d.ts +9 -5
  62. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessTrust.js +9 -5
  63. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.d.ts +1 -1
  64. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.js +1 -13
  65. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarness.d.ts +113 -39
  66. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarness.js +146 -70
  67. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessChannels.d.ts +21 -33
  68. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessChannels.js +24 -49
  69. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessHome.d.ts +19 -7
  70. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessHome.js +27 -11
  71. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessTrust.d.ts +9 -5
  72. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessTrust.js +9 -5
  73. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.d.ts +1 -1
  74. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.js +1 -4
  75. package/dist/node_modules/@skrr-ai/auth-core/package.json +1 -1
  76. package/dist/node_modules/@skrr-ai/data-provider/index.js +4025 -3938
  77. package/dist/node_modules/@skrr-ai/data-provider/package.json +1 -1
  78. package/oclif.manifest.json +12853 -12721
  79. package/package.json +2 -2
@@ -0,0 +1,60 @@
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
+ /**
7
+ * `skrr tasks attachments set-role <task> <attachment> --role …`
8
+ *
9
+ * The one way to change what an existing asset IS on a Task. Its real use is
10
+ * promotion: an agent may only upload `evidence` or `deliverable`, because an
11
+ * `input` is forwarded into every future Run of the Task — so when an agent's
12
+ * screenshot should become an input, a person promotes it here. The server
13
+ * refuses the call from an agent, whatever credential it holds, and moves the
14
+ * asset's ledger link with the role.
15
+ */
16
+ class TasksAttachmentsSetRole extends base_command_1.BaseCommand {
17
+ static description = "Change an attachment's role (input, evidence, or deliverable). Making an asset an input " +
18
+ 'sends it into every future Run of the task, so only a person can change a role.';
19
+ static examples = [
20
+ '<%= config.bin %> tasks attachments set-role <task-id> <attachment-id> --role input',
21
+ '<%= config.bin %> tasks attachments set-role <task-id> <attachment-id> --role evidence --json',
22
+ ];
23
+ static args = {
24
+ id: core_1.Args.string({ description: 'Task ID', required: true, ignoreStdin: true }),
25
+ attachmentId: core_1.Args.string({ description: 'Attachment ID', required: true, ignoreStdin: true }),
26
+ };
27
+ static flags = {
28
+ role: core_1.Flags.string({
29
+ required: true,
30
+ options: ['input', 'evidence', 'deliverable'],
31
+ description: 'input (forwarded into every future Run), evidence (supports an Update or Result), or deliverable (the media is the product)',
32
+ }),
33
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
34
+ };
35
+ async run() {
36
+ this.requireAuth();
37
+ const { args, flags } = await this.parse(TasksAttachmentsSetRole);
38
+ let attachment;
39
+ try {
40
+ attachment = await data_provider_1.dataService.setTaskAttachmentRole({
41
+ taskId: args.id,
42
+ attachmentId: args.attachmentId,
43
+ role: flags.role,
44
+ });
45
+ }
46
+ catch (err) {
47
+ this.handleApiError(err);
48
+ }
49
+ if (flags.json) {
50
+ this.log(JSON.stringify(attachment, null, 2));
51
+ return;
52
+ }
53
+ const name = attachment.originalName || attachment.id;
54
+ const effect = attachment.role === 'input'
55
+ ? ' It will be sent into every future Run of this task.'
56
+ : ' It is no longer sent into Runs.';
57
+ this.log(`${name} is now ${attachment.role}.${effect}`);
58
+ }
59
+ }
60
+ exports.default = TasksAttachmentsSetRole;
@@ -8,6 +8,7 @@ export default class TasksAttachmentsUpload extends BaseCommand {
8
8
  static flags: {
9
9
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
10
  file: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
11
+ role: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
11
12
  };
12
13
  run(): Promise<void>;
13
14
  }
@@ -1,50 +1,14 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  Object.defineProperty(exports, "__esModule", { value: true });
36
- const fs = __importStar(require("node:fs"));
37
- const path = __importStar(require("node:path"));
38
- const node_buffer_1 = require("node:buffer");
39
3
  const core_1 = require("@oclif/core");
40
- const data_provider_1 = require("@skrr-ai/data-provider");
41
4
  const base_command_1 = require("../../../base-command");
42
- const file_mime_1 = require("../../../lib/file-mime");
5
+ const task_asset_upload_1 = require("../../../lib/task-asset-upload");
43
6
  class TasksAttachmentsUpload extends base_command_1.BaseCommand {
44
7
  static description = 'Upload a file attachment to a task';
45
8
  static examples = [
46
9
  '<%= config.bin %> tasks attachments upload <task-id> --file ./report.pdf',
47
10
  '<%= config.bin %> tasks attachments upload <task-id> --file ./screenshot.png --json',
11
+ '<%= config.bin %> tasks attachments upload <task-id> --file ./demo.mp4 --role deliverable',
48
12
  ];
49
13
  static args = {
50
14
  id: core_1.Args.string({ description: 'Task ID', required: true, ignoreStdin: true }),
@@ -52,32 +16,34 @@ class TasksAttachmentsUpload extends base_command_1.BaseCommand {
52
16
  static flags = {
53
17
  json: core_1.Flags.boolean({ description: 'Output as JSON' }),
54
18
  file: core_1.Flags.string({ description: 'Path to the file to upload', required: true }),
19
+ role: core_1.Flags.string({
20
+ description: 'Asset role: evidence (supports an Update/Result), deliverable (the media is the product), or input (forwarded into every future Run — only a person may add one; a person promotes an agent upload with `attachments set-role`). Defaults to evidence when an agent uploads, input when a person does.',
21
+ options: ['input', 'evidence', 'deliverable'],
22
+ }),
55
23
  };
56
24
  async run() {
57
25
  this.requireAuth();
58
26
  const { args, flags } = await this.parse(TasksAttachmentsUpload);
59
- const filePath = flags.file;
60
- if (!fs.existsSync(filePath)) {
61
- this.error(`File not found: ${filePath}`, { exit: 1 });
62
- }
63
- const buf = fs.readFileSync(filePath);
64
- const filename = path.basename(filePath);
65
- const fd = new FormData();
66
- const mimeType = (0, file_mime_1.mimeTypeForFilename)(filename);
67
- fd.append('file', new node_buffer_1.Blob([buf], { type: mimeType }), filename);
68
- let result;
27
+ // The pipeline — buffered vs direct, session vs generic — lives in
28
+ // task-asset-upload.ts so `--attach` on updates/result/complete/comments
29
+ // makes the same routing decisions byte for byte (OSK-9863).
30
+ let asset;
69
31
  try {
70
- result = await data_provider_1.dataService.uploadTaskAttachment({ taskId: args.id, formData: fd });
32
+ asset = await (0, task_asset_upload_1.uploadTaskAssetFile)({
33
+ taskId: args.id,
34
+ filePath: flags.file,
35
+ role: flags.role,
36
+ });
71
37
  }
72
38
  catch (err) {
73
39
  this.handleApiError(err);
74
40
  }
75
41
  if (flags.json) {
76
- this.log(JSON.stringify(result, null, 2));
42
+ this.log(JSON.stringify(asset, null, 2));
77
43
  return;
78
44
  }
79
- const a = result;
80
- this.log(`Uploaded ${filename} (${buf.byteLength} bytes) → attachment ${a.id ?? a._id ?? '?'}`);
45
+ const dedup = asset.deduplicated ? ' (deduplicated — already on the task)' : '';
46
+ this.log(`Uploaded ${asset.filename} → attachment ${asset.id}${dedup}`);
81
47
  }
82
48
  }
83
49
  exports.default = TasksAttachmentsUpload;
@@ -16,6 +16,7 @@ export default class TasksCommentsAdd extends BaseCommand {
16
16
  'parent-comment': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
17
17
  'anchor-mark-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
18
18
  'anchor-quote': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
19
+ attach: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
19
20
  };
20
21
  run(): Promise<void>;
21
22
  /**
@@ -1,4 +1,37 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  const node_crypto_1 = require("node:crypto");
4
37
  const core_1 = require("@oclif/core");
@@ -55,6 +88,11 @@ class TasksCommentsAdd extends base_command_1.BaseCommand {
55
88
  'anchor-quote': core_1.Flags.string({
56
89
  description: 'Captured quote for the anchor (≤1000 chars; truncated to 500 to match the editor). Enables inline-comment mode when used without --anchor-mark-id.',
57
90
  }),
91
+ attach: core_1.Flags.string({
92
+ multiple: true,
93
+ description: 'Upload a file as a Task asset and reference it in the comment body ' +
94
+ '(`![name](task-asset:<id>)`, resolved to a signed URL at read time). Repeatable.',
95
+ }),
58
96
  };
59
97
  async run() {
60
98
  this.requireAuth();
@@ -107,9 +145,36 @@ class TasksCommentsAdd extends base_command_1.BaseCommand {
107
145
  // mentionedAgentIds, reopen, and interrupt are preserved. Boolean flags
108
146
  // default to false; only pass them through when actually set so they
109
147
  // don't clobber a `true` value from the JSON file.
148
+ // --attach: upload first, then append `task-asset:` references to the
149
+ // body — comments store stable asset ids, not URLs (OSK-9856/9863).
150
+ let attachSuffix = '';
151
+ if (flags.attach?.length) {
152
+ const { uploadTaskAssetFile, taskAssetMarkdownRef } = await Promise.resolve().then(() => __importStar(require('../../../lib/task-asset-upload')));
153
+ const refs = [];
154
+ for (const filePath of flags.attach) {
155
+ try {
156
+ const asset = await uploadTaskAssetFile({
157
+ taskId: task.id,
158
+ filePath,
159
+ role: 'evidence',
160
+ });
161
+ refs.push(taskAssetMarkdownRef(asset));
162
+ }
163
+ catch (err) {
164
+ this.error(`--attach failed: ${err.message}`, { exit: 1 });
165
+ }
166
+ }
167
+ if (refs.length)
168
+ attachSuffix = `\n\n${refs.join('\n')}`;
169
+ }
110
170
  const mentionedFromFlag = flags['mention-agent'];
171
+ const baseBody = flags.body ?? (typeof commentBody.body === 'string' ? commentBody.body : undefined);
111
172
  const data = (0, prompt_1.mergeDefined)(commentBody, {
112
- body: flags.body,
173
+ body: baseBody
174
+ ? `${baseBody}${attachSuffix}`
175
+ : attachSuffix
176
+ ? attachSuffix.trimStart()
177
+ : undefined,
113
178
  mentionedAgentIds: Array.isArray(mentionedFromFlag) && mentionedFromFlag.length > 0
114
179
  ? mentionedFromFlag
115
180
  : undefined,
@@ -163,7 +228,7 @@ class TasksCommentsAdd extends base_command_1.BaseCommand {
163
228
  ? await (0, api_fetch_1.apiFetch)(sessionPath, {
164
229
  method: 'POST',
165
230
  body: {
166
- body: flags.body ?? commentBody.body,
231
+ body: data.body,
167
232
  ...(mentioned ? { mentionedAgentIds: mentioned } : {}),
168
233
  },
169
234
  headers: { 'X-Idempotency-Key': idempotencyKey },
@@ -26,6 +26,7 @@ export default class TasksComplete extends BaseCommand {
26
26
  'structured-json': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
27
27
  deliverable: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
28
28
  evidence: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
29
+ attach: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
29
30
  remaining: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
30
31
  'source-run': import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
31
32
  'run-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
@@ -1,4 +1,37 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.describePendingReview = describePendingReview;
4
37
  const core_1 = require("@oclif/core");
@@ -97,6 +130,11 @@ class TasksComplete extends base_command_1.BaseCommand {
97
130
  description: 'Exact Task Resource link id produced by `tasks deliverable add`',
98
131
  }),
99
132
  evidence: core_1.Flags.string({ multiple: true, description: 'Evidence as <kind>:<id-or-uri>' }),
133
+ attach: core_1.Flags.string({
134
+ multiple: true,
135
+ description: 'Upload a file as a Task asset (role: evidence) and cite it in evidenceRefs. ' +
136
+ 'Repeatable. Re-attaching identical bytes dedupes on the server.',
137
+ }),
100
138
  remaining: core_1.Flags.string({ multiple: true, description: 'Remaining work item' }),
101
139
  'source-run': core_1.Flags.string({ multiple: true, description: 'Contributing Task Run id' }),
102
140
  'run-id': core_1.Flags.string({ description: 'Expected current Task Run id' }),
@@ -214,6 +252,23 @@ class TasksComplete extends base_command_1.BaseCommand {
214
252
  retryable: false,
215
253
  });
216
254
  }
255
+ // --attach: upload once the input is known to be valid — a closeout the CLI
256
+ // is about to refuse must not leave stored bytes behind — and before the
257
+ // idempotency key is derived, so a retry sees the same refs.
258
+ const evidenceRefs = Array.isArray(input.evidenceRefs) ? [...input.evidenceRefs] : [];
259
+ if (flags.attach?.length) {
260
+ const { attachTaskAssetFiles } = await Promise.resolve().then(() => __importStar(require('../../lib/task-asset-upload')));
261
+ try {
262
+ evidenceRefs.push(...(await attachTaskAssetFiles({
263
+ taskId: identity.id,
264
+ files: flags.attach,
265
+ role: 'evidence',
266
+ })));
267
+ }
268
+ catch (err) {
269
+ this.error(`--attach failed: ${err.message}`, { exit: 1 });
270
+ }
271
+ }
217
272
  const payload = {
218
273
  status,
219
274
  summary,
@@ -223,7 +278,7 @@ class TasksComplete extends base_command_1.BaseCommand {
223
278
  resourceLinkIds: Array.isArray(input.resourceLinkIds)
224
279
  ? stringArray(input.resourceLinkIds)
225
280
  : [],
226
- evidenceRefs: Array.isArray(input.evidenceRefs) ? input.evidenceRefs : [],
281
+ evidenceRefs,
227
282
  remainingWork: Array.isArray(input.remainingWork) ? input.remainingWork : [],
228
283
  contributors: Array.isArray(input.contributors)
229
284
  ? input.contributors
@@ -255,6 +310,19 @@ class TasksComplete extends base_command_1.BaseCommand {
255
310
  });
256
311
  }
257
312
  catch (error) {
313
+ // Completing records a Result, so a closed Task refuses it the same way
314
+ // `tasks result submit` is refused, with the same way forward.
315
+ const refusal = (0, base_command_1.apiRefusal)(error);
316
+ if (refusal.code === 'TASK_REOPEN_REQUIRED') {
317
+ this.error([
318
+ refusal.message ?? 'This Task is closed.',
319
+ ...(0, task_closure_1.reopenRequiredLines)({
320
+ bin: this.config.bin,
321
+ task: identity.id,
322
+ command: 'complete',
323
+ }),
324
+ ].join('\n'), { exit: 1, code: 'TASK_REOPEN_REQUIRED' });
325
+ }
258
326
  this.handleApiError(error);
259
327
  }
260
328
  const url = (0, web_url_1.taskUrlFrom)(this.cliConfig.baseURL, { id: taskId });
@@ -15,6 +15,7 @@ export default class TasksResultSubmit extends BaseCommand {
15
15
  'structured-json': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
16
16
  deliverable: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
17
17
  evidence: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
18
+ attach: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
18
19
  remaining: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
19
20
  'run-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
20
21
  'source-run': import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
@@ -23,4 +24,6 @@ export default class TasksResultSubmit extends BaseCommand {
23
24
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
24
25
  };
25
26
  run(): Promise<void>;
27
+ /** The two ways forward from a closed Task, named where the commands are known. */
28
+ private reopenRequired;
26
29
  }
@@ -1,4 +1,37 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  const core_1 = require("@oclif/core");
4
37
  const data_provider_1 = require("@skrr-ai/data-provider");
@@ -43,6 +76,11 @@ class TasksResultSubmit extends base_command_1.BaseCommand {
43
76
  multiple: true,
44
77
  description: 'Evidence reference as <kind>:<id-or-uri>',
45
78
  }),
79
+ attach: core_1.Flags.string({
80
+ multiple: true,
81
+ description: 'Upload a file as a Task asset (role: evidence) and cite it in evidenceRefs. ' +
82
+ 'Repeatable. Re-attaching identical bytes dedupes on the server.',
83
+ }),
46
84
  remaining: core_1.Flags.string({ multiple: true, description: 'Remaining work item (repeatable)' }),
47
85
  'run-id': core_1.Flags.string({ description: 'Canonical Task Run that produced this Result' }),
48
86
  'source-run': core_1.Flags.string({ multiple: true, description: 'Contributing Run id (repeatable)' }),
@@ -85,6 +123,36 @@ class TasksResultSubmit extends base_command_1.BaseCommand {
85
123
  const value = raw.slice(split + 1);
86
124
  return /^https?:|^file:/.test(value) ? { kind, uri: value } : { kind, id: value };
87
125
  });
126
+ // --attach: upload first so the Result cites real asset ids. Uploads land
127
+ // before the idempotency key is derived, so a retry sees the same refs.
128
+ if (flags.attach?.length) {
129
+ const { attachTaskAssetFiles, readTaskForUpload } = await Promise.resolve().then(() => __importStar(require('../../../lib/task-asset-upload')));
130
+ // A closed Task refuses the Result, and the files would already be
131
+ // stored — indexed as unreferenced uploads nobody asked for. Ask first.
132
+ // The server's refusal below stays the authority; this only keeps a
133
+ // refusal we can already see from costing an upload.
134
+ let target;
135
+ try {
136
+ target = await readTaskForUpload(task.id);
137
+ }
138
+ catch (err) {
139
+ this.error(`--attach failed: ${err.message}`, { exit: 1 });
140
+ }
141
+ if ((0, task_closure_1.taskIsSettled)(target)) {
142
+ this.reopenRequired(task.id, 'This Task is closed, and a Result can only be submitted while it is open. ' +
143
+ 'Nothing was uploaded.');
144
+ }
145
+ try {
146
+ evidenceRefs.push(...(await attachTaskAssetFiles({
147
+ taskId: task.id,
148
+ files: flags.attach,
149
+ role: 'evidence',
150
+ })));
151
+ }
152
+ catch (err) {
153
+ this.error(`--attach failed: ${err.message}`, { exit: 1 });
154
+ }
155
+ }
88
156
  const payload = {
89
157
  summary: flags.summary,
90
158
  body: flags.body,
@@ -122,14 +190,12 @@ class TasksResultSubmit extends base_command_1.BaseCommand {
122
190
  : await data_provider_1.dataService.submitTaskResult({ taskId: task.id, data });
123
191
  }
124
192
  catch (error) {
125
- // A closed Task refuses a Result. Name the two ways forward here, where
126
- // the commands are known: the API's own message stays surface-neutral
193
+ // A closed Task refuses a Result. Name the way forward here, where the
194
+ // commands are known: the API's own message stays surface-neutral
127
195
  // (OSK-10031).
128
196
  const refusal = (0, base_command_1.apiRefusal)(error);
129
197
  if (refusal.code === 'TASK_REOPEN_REQUIRED') {
130
- this.error(`${refusal.message ?? 'This Task is closed.'}\n` +
131
- `→ Reopen it and submit again: ${this.config.bin} tasks move ${task.id} --status in_progress\n` +
132
- `→ Or record the Result and close it in one step: ${this.config.bin} tasks complete ${task.id} --summary "…"`, { exit: 1, code: 'TASK_REOPEN_REQUIRED' });
198
+ this.reopenRequired(task.id, refusal.message ?? 'This Task is closed.');
133
199
  }
134
200
  this.handleApiError(error);
135
201
  }
@@ -149,5 +215,12 @@ class TasksResultSubmit extends base_command_1.BaseCommand {
149
215
  if (url)
150
216
  this.log(`Task: ${url}`);
151
217
  }
218
+ /** The two ways forward from a closed Task, named where the commands are known. */
219
+ reopenRequired(taskId, message) {
220
+ this.error([
221
+ message,
222
+ ...(0, task_closure_1.reopenRequiredLines)({ bin: this.config.bin, task: taskId, command: 'result submit' }),
223
+ ].join('\n'), { exit: 1, code: 'TASK_REOPEN_REQUIRED' });
224
+ }
152
225
  }
153
226
  exports.default = TasksResultSubmit;
@@ -97,7 +97,9 @@ class TasksUpdate extends base_command_1.BaseCommand {
97
97
  // set of "move this task somewhere" options — which is how a reader
98
98
  // concludes the CLI cannot change a task's project at all (dogfood
99
99
  // OSK-4652). It can: `tasks move <id> --project <id|none>`.
100
- goal: core_1.Flags.string({ description: 'Move task to a different goal' }),
100
+ goal: core_1.Flags.string({
101
+ description: 'Move task to a different goal (goal id), or "none" to detach it from its goal',
102
+ }),
101
103
  cycle: core_1.Flags.string({
102
104
  description: 'Set planning cycle by ID, or "current" / "next" in the task Space',
103
105
  }),
@@ -324,7 +326,7 @@ class TasksUpdate extends base_command_1.BaseCommand {
324
326
  // sees it and answers with the sentence that names `tasks move`.
325
327
  status: flags.status,
326
328
  duplicateOfId: flags['duplicate-of'],
327
- goalId: flags.goal,
329
+ goalId: (0, tasks_2.resolveTaskGoalFlag)(flags.goal),
328
330
  cycleId: flags.cycle,
329
331
  spaceId: flags.space,
330
332
  assigneeAgentIds: flags['assignee-agent'],
@@ -15,6 +15,7 @@ export default class TasksUpdatesAdd extends BaseCommand {
15
15
  'spec-version': import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
16
16
  supersedes: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
17
17
  reference: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
18
+ attach: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
18
19
  'idempotency-key': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
19
20
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
20
21
  };
@@ -1,4 +1,37 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  const core_1 = require("@oclif/core");
4
37
  const data_provider_1 = require("@skrr-ai/data-provider");
@@ -64,6 +97,12 @@ class TasksUpdatesAdd extends base_command_1.BaseCommand {
64
97
  }),
65
98
  supersedes: core_1.Flags.string({ description: 'Update id this correction supersedes' }),
66
99
  reference: core_1.Flags.string({ multiple: true, description: 'Reference as <kind>:<id-or-uri>' }),
100
+ attach: core_1.Flags.string({
101
+ multiple: true,
102
+ description: 'Upload a file as a Task asset (role: evidence) and cite it in this Update — appended to ' +
103
+ 'data.evidenceRefs for finding/verification payloads, to the Update references otherwise. ' +
104
+ 'Repeatable. Re-attaching identical bytes dedupes on the server.',
105
+ }),
67
106
  'idempotency-key': core_1.Flags.string({ description: 'Stable retry key for this exact Update' }),
68
107
  json: core_1.Flags.boolean({ description: 'Output JSON' }),
69
108
  };
@@ -88,6 +127,30 @@ class TasksUpdatesAdd extends base_command_1.BaseCommand {
88
127
  const value = raw.slice(split + 1);
89
128
  return /^https?:|^file:/.test(value) ? { kind, uri: value } : { kind, id: value };
90
129
  });
130
+ // --attach: upload first so the Update can cite the asset ids. For
131
+ // finding/verification the citation lands in data.evidenceRefs where the
132
+ // evidence renderer reads it; for the other Update kinds it becomes a
133
+ // task_attachment reference on the Update itself.
134
+ if (flags.attach?.length) {
135
+ const { attachTaskAssetFiles } = await Promise.resolve().then(() => __importStar(require('../../../lib/task-asset-upload')));
136
+ let refs;
137
+ try {
138
+ refs = await attachTaskAssetFiles({
139
+ taskId: task.id,
140
+ files: flags.attach,
141
+ role: 'evidence',
142
+ });
143
+ }
144
+ catch (err) {
145
+ this.error(`--attach failed: ${err.message}`, { exit: 1 });
146
+ }
147
+ if (Array.isArray(data.evidenceRefs)) {
148
+ data = { ...data, evidenceRefs: [...data.evidenceRefs, ...refs] };
149
+ }
150
+ else {
151
+ references.push(...refs);
152
+ }
153
+ }
91
154
  const idempotencyKey = flags['idempotency-key'] ||
92
155
  (0, outbox_1.idempotencyKeyFor)('task-update', task.id, JSON.stringify({ type: flags.type, summary: flags.summary, data, resume }));
93
156
  let result;