@skrr-ai/cli 0.1.206 → 0.1.207

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 (47) hide show
  1. package/dist/commands/agents/models.d.ts +11 -0
  2. package/dist/commands/agents/models.js +51 -0
  3. package/dist/commands/balance/route-premiums.d.ts +9 -0
  4. package/dist/commands/balance/route-premiums.js +33 -0
  5. package/dist/commands/convos/transcript.d.ts +0 -1
  6. package/dist/commands/convos/transcript.js +0 -1
  7. package/dist/commands/goals/create.d.ts +1 -0
  8. package/dist/commands/goals/create.js +8 -0
  9. package/dist/commands/goals/creation-receipt.d.ts +10 -0
  10. package/dist/commands/goals/creation-receipt.js +43 -0
  11. package/dist/commands/goals/key-results/create.d.ts +2 -0
  12. package/dist/commands/goals/key-results/create.js +14 -0
  13. package/dist/commands/goals/key-results/creation-receipt.d.ts +13 -0
  14. package/dist/commands/goals/key-results/creation-receipt.js +51 -0
  15. package/dist/commands/harnesses/forget.d.ts +2 -0
  16. package/dist/commands/harnesses/forget.js +31 -0
  17. package/dist/commands/harnesses/removal-receipt.d.ts +11 -0
  18. package/dist/commands/harnesses/removal-receipt.js +32 -0
  19. package/dist/commands/harnesses/removal-review.d.ts +11 -0
  20. package/dist/commands/harnesses/removal-review.js +28 -0
  21. package/dist/commands/spaces/loops/release-receipt.d.ts +14 -0
  22. package/dist/commands/spaces/loops/release-receipt.js +48 -0
  23. package/dist/commands/spaces/loops/release.js +1 -1
  24. package/dist/commands/spaces/workflow-templates/archive.d.ts +1 -0
  25. package/dist/commands/spaces/workflow-templates/archive.js +9 -1
  26. package/dist/commands/spaces/workflow-templates/show.js +2 -0
  27. package/dist/commands/spaces/workflow-templates/update.d.ts +1 -0
  28. package/dist/commands/spaces/workflow-templates/update.js +12 -1
  29. package/dist/commands/spaces/workflows/publish.d.ts +1 -0
  30. package/dist/commands/spaces/workflows/publish.js +41 -2
  31. package/dist/commands/tasks/create.d.ts +2 -0
  32. package/dist/commands/tasks/create.js +19 -6
  33. package/dist/commands/tasks/creation-receipt.d.ts +12 -0
  34. package/dist/commands/tasks/creation-receipt.js +53 -0
  35. package/dist/commands/tasks/delete.d.ts +1 -0
  36. package/dist/commands/tasks/delete.js +22 -4
  37. package/dist/commands/tasks/deletion-receipt.d.ts +12 -0
  38. package/dist/commands/tasks/deletion-receipt.js +37 -0
  39. package/dist/lib/execution-target.d.ts +1 -1
  40. package/dist/lib/execution-target.js +4 -0
  41. package/dist/lib/harnesses.d.ts +25 -0
  42. package/dist/lib/harnesses.js +15 -0
  43. package/dist/lib/request-uuid.d.ts +2 -0
  44. package/dist/lib/request-uuid.js +10 -0
  45. package/dist/node_modules/@skrr-ai/data-provider/index.js +10415 -10390
  46. package/oclif.manifest.json +906 -105
  47. package/package.json +2 -2
@@ -25,6 +25,11 @@ class SpacesWorkflowTemplatesUpdate extends base_command_1.BaseCommand {
25
25
  tags: core_1.Flags.string({ description: 'Comma list of tags (empty string clears them)' }),
26
26
  scope: core_1.Flags.string({ description: 'private, space, or workspace' }),
27
27
  body: core_1.Flags.string({ description: 'Path to replacement body JSON ("-" for stdin)' }),
28
+ 'expected-revision': core_1.Flags.integer({
29
+ min: 0,
30
+ max: Number.MAX_SAFE_INTEGER,
31
+ description: 'Apply the update only if the reviewed revision from `workflow-templates show` still matches',
32
+ }),
28
33
  };
29
34
  async run() {
30
35
  this.requireAuth();
@@ -51,7 +56,13 @@ class SpacesWorkflowTemplatesUpdate extends base_command_1.BaseCommand {
51
56
  this.failWithCliError({ ...plan.error, exit: 2, retryable: false });
52
57
  let template;
53
58
  try {
54
- template = await data_provider_1.dataService.updateSpaceWorkflowTemplate(args.spaceId, args.templateId, plan.payload);
59
+ const revision = flags['expected-revision'];
60
+ template = revision === undefined
61
+ ? await data_provider_1.dataService.updateSpaceWorkflowTemplate(args.spaceId, args.templateId, plan.payload)
62
+ : await data_provider_1.dataService.updateReviewedSpaceWorkflowTemplate(args.spaceId, args.templateId, {
63
+ ...plan.payload,
64
+ expectedRevision: revision,
65
+ });
55
66
  }
56
67
  catch (error) {
57
68
  this.handleApiError(error, { subject: `workflow template ${args.templateId}` });
@@ -8,6 +8,7 @@ export default class SpacesWorkflowsPublish extends BaseCommand {
8
8
  };
9
9
  static flags: {
10
10
  json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ 'reviewed-draft': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
12
  };
12
13
  run(): Promise<void>;
13
14
  }
@@ -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 prompt_1 = require("../../../lib/prompt");
6
7
  const space_output_1 = require("../../../lib/space-output");
7
8
  const workflow_issues_1 = require("../../../lib/workflow-issues");
8
9
  class SpacesWorkflowsPublish extends base_command_1.BaseCommand {
@@ -12,13 +13,48 @@ class SpacesWorkflowsPublish extends base_command_1.BaseCommand {
12
13
  spaceId: core_1.Args.string({ required: true, ignoreStdin: true }),
13
14
  workflowId: core_1.Args.string({ required: true, ignoreStdin: true }),
14
15
  };
15
- static flags = { json: core_1.Flags.boolean({ description: 'Output JSON' }) };
16
+ static flags = {
17
+ json: core_1.Flags.boolean({ description: 'Output JSON' }),
18
+ 'reviewed-draft': core_1.Flags.string({
19
+ description: 'Publish only the draft in a saved `workflows show --json` file ("-" for stdin)',
20
+ }),
21
+ };
16
22
  async run() {
17
23
  this.requireAuth();
18
24
  const { args, flags } = await this.parse(SpacesWorkflowsPublish);
25
+ let review;
26
+ if (flags['reviewed-draft'] !== undefined) {
27
+ try {
28
+ const snapshot = await (0, prompt_1.readJsonBody)(flags['reviewed-draft']);
29
+ if (snapshot.id !== args.workflowId || snapshot.spaceId !== args.spaceId) {
30
+ throw new Error('The reviewed draft must belong to this Space and workflow.');
31
+ }
32
+ const draft = snapshot.draft;
33
+ const semanticRevision = draft?.semanticRevision;
34
+ const presentationRevision = draft?.presentationRevision;
35
+ const { currentVersion } = snapshot;
36
+ const maxDurationMs = snapshot.maxDurationMs ?? null;
37
+ if (!isRevision(semanticRevision) || !isRevision(presentationRevision) ||
38
+ !isRevision(currentVersion) ||
39
+ (maxDurationMs !== null && (!isRevision(maxDurationMs) || maxDurationMs === 0))) {
40
+ throw new Error('The reviewed draft must include valid revisions, version, and run duration.');
41
+ }
42
+ review = { semanticRevision, presentationRevision, currentVersion, maxDurationMs };
43
+ }
44
+ catch (error) {
45
+ this.failWithCliError({
46
+ message: error.message,
47
+ code: 'WORKFLOW_REVIEWED_DRAFT_INVALID',
48
+ exit: 2,
49
+ retryable: false,
50
+ });
51
+ }
52
+ }
19
53
  let version;
20
54
  try {
21
- version = await data_provider_1.dataService.publishSpaceWorkflow(args.spaceId, args.workflowId);
55
+ version = review
56
+ ? await data_provider_1.dataService.publishReviewedSpaceWorkflow(args.spaceId, args.workflowId, review)
57
+ : await data_provider_1.dataService.publishSpaceWorkflow(args.spaceId, args.workflowId);
22
58
  }
23
59
  catch (error) {
24
60
  this.handleApiError(error);
@@ -44,3 +80,6 @@ class SpacesWorkflowsPublish extends base_command_1.BaseCommand {
44
80
  }
45
81
  }
46
82
  exports.default = SpacesWorkflowsPublish;
83
+ function isRevision(value) {
84
+ return typeof value === 'number' && Number.isSafeInteger(value) && value >= 0;
85
+ }
@@ -66,6 +66,7 @@ export default class TasksCreate extends BaseCommand {
66
66
  description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
67
67
  'description-format': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
68
68
  'external-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
69
+ 'request-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
69
70
  'default-agent': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
70
71
  priority: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
71
72
  parent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
@@ -109,6 +110,7 @@ export default class TasksCreate extends BaseCommand {
109
110
  * names API fields (OSK-10219); everything else is the uniform translation.
110
111
  */
111
112
  private failTaskCreate;
113
+ private sendCreateRequest;
112
114
  private createTaskOrRecover;
113
115
  /**
114
116
  * Predict the create route's `ASSIGNEE_NOT_IN_SPACE` degradation for a
@@ -11,6 +11,7 @@ const data_provider_1 = require("@skrr-ai/data-provider");
11
11
  const base_command_1 = require("../../base-command");
12
12
  const label_ref_1 = require("../../lib/label-ref");
13
13
  const prompt_1 = require("../../lib/prompt");
14
+ const request_uuid_1 = require("../../lib/request-uuid");
14
15
  const tasks_1 = require("../../lib/tasks");
15
16
  const task_instruction_offer_1 = require("../../lib/task-instruction-offer");
16
17
  const list_workspace_1 = require("../../lib/list-workspace");
@@ -187,6 +188,10 @@ class TasksCreate extends base_command_1.BaseCommand {
187
188
  'external-key': core_1.Flags.string({
188
189
  description: 'Stable caller-supplied idempotency key for create/upsert workflows',
189
190
  }),
191
+ 'request-id': core_1.Flags.string({
192
+ description: 'UUID for this exact create payload, recoverable with `tasks creation-receipt`',
193
+ parse: request_uuid_1.parseRequestUuid,
194
+ }),
190
195
  'default-agent': core_1.Flags.string({
191
196
  description: 'Override the automatic assignee with an Agent (it becomes the assignee that runs the task; ' +
192
197
  '--assignee-agent names one directly). Use "auto" to inherit the space lead ' +
@@ -467,7 +472,7 @@ class TasksCreate extends base_command_1.BaseCommand {
467
472
  }
468
473
  let instantiated;
469
474
  try {
470
- instantiated = (await data_provider_1.dataService.createTask(payload));
475
+ instantiated = (await this.sendCreateRequest(payload, flags['request-id']));
471
476
  }
472
477
  catch (err) {
473
478
  this.failTaskCreate(err, payload, flags.goal !== undefined);
@@ -595,7 +600,7 @@ class TasksCreate extends base_command_1.BaseCommand {
595
600
  let created;
596
601
  let createRecovery;
597
602
  try {
598
- const result = await this.createTaskOrRecover(payload);
603
+ const result = await this.createTaskOrRecover(payload, flags['request-id']);
599
604
  created = result.task;
600
605
  createRecovery = result.recovery;
601
606
  }
@@ -622,7 +627,9 @@ class TasksCreate extends base_command_1.BaseCommand {
622
627
  /* non-JSON body carries no code */
623
628
  }
624
629
  }
625
- if (!(defaultAgentResolution.applied && failureCode === 'ASSIGNEE_NOT_IN_SPACE')) {
630
+ // A caller who pins a request ID must be able to recover the exact original body.
631
+ if (flags['request-id'] ||
632
+ !(defaultAgentResolution.applied && failureCode === 'ASSIGNEE_NOT_IN_SPACE')) {
626
633
  this.failTaskCreate(err, payload, flags.goal !== undefined);
627
634
  }
628
635
  delete payload.assigneeAgentIds;
@@ -736,15 +743,21 @@ class TasksCreate extends base_command_1.BaseCommand {
736
743
  }
737
744
  this.handleApiError(err);
738
745
  }
739
- async createTaskOrRecover(payload) {
746
+ sendCreateRequest(payload, requestId) {
747
+ const data = payload;
748
+ return requestId
749
+ ? data_provider_1.dataService.createTask(data, { idempotencyKey: requestId })
750
+ : data_provider_1.dataService.createTask(data);
751
+ }
752
+ async createTaskOrRecover(payload, requestId) {
740
753
  try {
741
754
  return {
742
- task: await data_provider_1.dataService.createTask(payload),
755
+ task: await this.sendCreateRequest(payload, requestId),
743
756
  };
744
757
  }
745
758
  catch (error) {
746
759
  const externalKey = typeof payload.externalKey === 'string' ? payload.externalKey.trim() : '';
747
- if (!externalKey || !taskCreateMayHaveCommitted(error))
760
+ if (requestId || !externalKey || !taskCreateMayHaveCommitted(error))
748
761
  throw error;
749
762
  try {
750
763
  const existing = await (0, tasks_1.findTaskByExternalKey)({
@@ -0,0 +1,12 @@
1
+ import { BaseCommand } from '../../base-command';
2
+ export default class TasksCreationReceipt extends BaseCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ 'request-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
7
+ 'from-json': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
8
+ 'create-and-start': import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
+ };
11
+ run(): Promise<void>;
12
+ }
@@ -0,0 +1,53 @@
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 prompt_1 = require("../../lib/prompt");
7
+ const request_uuid_1 = require("../../lib/request-uuid");
8
+ class TasksCreationReceipt extends base_command_1.BaseCommand {
9
+ static description = 'Check whether the original Task creation request completed';
10
+ static examples = [
11
+ '<%= config.bin %> tasks creation-receipt --request-id <uuid> --from-json payload.json --workspace <workspace-id>',
12
+ ];
13
+ static flags = {
14
+ 'request-id': core_1.Flags.string({
15
+ description: 'UUID used for the original create request', required: true, parse: request_uuid_1.parseRequestUuid,
16
+ }),
17
+ 'from-json': core_1.Flags.string({
18
+ description: 'Original request body, such as .payload from `tasks create --dry-run --json` ("-" for stdin)',
19
+ required: true,
20
+ }),
21
+ 'create-and-start': core_1.Flags.boolean({ description: 'Look up a combined create-and-start request' }),
22
+ json: core_1.Flags.boolean({ description: 'Output the receipt as JSON' }),
23
+ };
24
+ async run() {
25
+ this.requireAuth();
26
+ const { flags } = await this.parse(TasksCreationReceipt);
27
+ let payload;
28
+ try {
29
+ payload = await (0, prompt_1.readJsonBody)(flags['from-json']);
30
+ }
31
+ catch (error) {
32
+ this.error(error.message, { exit: 2 });
33
+ }
34
+ try {
35
+ const receipt = await data_provider_1.dataService.getTaskCreationReceipt({
36
+ requestId: flags['request-id'],
37
+ payload,
38
+ ...(flags['create-and-start'] ? { action: 'create-and-start' } : {}),
39
+ });
40
+ if (flags.json)
41
+ return this.printJsonResult(receipt);
42
+ if (receipt.state === 'unknown')
43
+ return this.log('The server could not confirm that Task creation.');
44
+ this.log(`Created Task ${receipt.taskId}.`);
45
+ if (receipt.started !== undefined)
46
+ this.log(`Start accepted: ${receipt.started ? 'yes' : 'no'}`);
47
+ }
48
+ catch (error) {
49
+ this.handleApiError(error, { subject: 'Task creation receipt' });
50
+ }
51
+ }
52
+ }
53
+ exports.default = TasksCreationReceipt;
@@ -8,6 +8,7 @@ export default class TasksDelete extends BaseCommand {
8
8
  static flags: {
9
9
  yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
10
  json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ 'deletion-command-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
12
  };
12
13
  run(): Promise<void>;
13
14
  }
@@ -4,6 +4,7 @@ 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
6
  const prompt_1 = require("../../lib/prompt");
7
+ const request_uuid_1 = require("../../lib/request-uuid");
7
8
  class TasksDelete extends base_command_1.BaseCommand {
8
9
  static description = 'Delete a task (irreversible)';
9
10
  static examples = [
@@ -20,11 +21,15 @@ class TasksDelete extends base_command_1.BaseCommand {
20
21
  // CLI_PARSE_ERROR, so a loop that discarded output — the normal shape for a
21
22
  // cleanup loop — deleted nothing and reported nothing.
22
23
  json: core_1.Flags.boolean({ description: 'Output as JSON' }),
24
+ 'deletion-command-id': core_1.Flags.string({
25
+ description: 'UUID for this deletion, recoverable with `tasks deletion-receipt`',
26
+ parse: request_uuid_1.parseRequestUuid,
27
+ }),
23
28
  };
24
29
  async run() {
25
30
  this.requireAuth();
26
31
  const { args, flags } = await this.parse(TasksDelete);
27
- const taskId = await this.resolveEntityRef('task', args.id);
32
+ let taskId = await this.resolveEntityRef('task', args.id);
28
33
  let confirmed;
29
34
  try {
30
35
  confirmed = await (0, prompt_1.confirmDestructive)(`Delete task ${taskId === args.id ? taskId : `${args.id} (${taskId})`}? This cannot be undone.`, flags.yes);
@@ -41,14 +46,27 @@ class TasksDelete extends base_command_1.BaseCommand {
41
46
  this.log('Cancelled.');
42
47
  return;
43
48
  }
49
+ const deletionCommandId = flags['deletion-command-id'];
44
50
  try {
45
- await data_provider_1.dataService.deleteTask(taskId);
51
+ if (deletionCommandId) {
52
+ const task = await data_provider_1.dataService.getTask(taskId);
53
+ if (!task.id)
54
+ throw new Error('The Task lookup returned no canonical ID.');
55
+ taskId = task.id;
56
+ this.logToStderr(`Check the deletion in the same workspace with ${this.config.bin} tasks deletion-receipt ${taskId} --deletion-command-id ${deletionCommandId}`);
57
+ await data_provider_1.dataService.deleteTask(taskId, { deletionCommandId });
58
+ }
59
+ else {
60
+ await data_provider_1.dataService.deleteTask(taskId);
61
+ }
46
62
  }
47
63
  catch (err) {
48
64
  this.handleApiError(err);
49
65
  }
50
- if (flags.json)
51
- return this.log(JSON.stringify({ deleted: true, id: taskId }, null, 2));
66
+ if (flags.json) {
67
+ const result = { deleted: true, id: taskId, ...(deletionCommandId ? { deletionCommandId } : {}) };
68
+ return this.log(JSON.stringify(result, null, 2));
69
+ }
52
70
  this.log(`Deleted task ${args.id}`);
53
71
  }
54
72
  }
@@ -0,0 +1,12 @@
1
+ import { BaseCommand } from '../../base-command';
2
+ export default class TasksDeletionReceipt extends BaseCommand {
3
+ static description: string;
4
+ static args: {
5
+ canonicalTaskId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
6
+ };
7
+ static flags: {
8
+ 'deletion-command-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
9
+ json: import("@oclif/core/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 request_uuid_1 = require("../../lib/request-uuid");
7
+ class TasksDeletionReceipt extends base_command_1.BaseCommand {
8
+ static description = 'Check the durable receipt for one Task deletion';
9
+ static args = {
10
+ canonicalTaskId: core_1.Args.string({
11
+ description: 'Original canonical Task ID from `tasks delete`', required: true, ignoreStdin: true,
12
+ parse: request_uuid_1.parseRequestUuid,
13
+ }),
14
+ };
15
+ static flags = {
16
+ 'deletion-command-id': core_1.Flags.string({
17
+ description: 'Original deletion UUID', required: true, parse: request_uuid_1.parseRequestUuid,
18
+ }),
19
+ json: core_1.Flags.boolean({ description: 'Output the receipt as JSON' }),
20
+ };
21
+ async run() {
22
+ this.requireAuth();
23
+ const { args, flags } = await this.parse(TasksDeletionReceipt);
24
+ try {
25
+ const receipt = await data_provider_1.dataService.getTaskDeletionReceipt(args.canonicalTaskId, flags['deletion-command-id']);
26
+ if (flags.json)
27
+ return this.printJsonResult(receipt);
28
+ this.log(receipt.state === 'deleted'
29
+ ? `Deletion is recorded for Task ${args.canonicalTaskId}.`
30
+ : `The server could not confirm deletion of Task ${args.canonicalTaskId}.`);
31
+ }
32
+ catch (error) {
33
+ this.handleApiError(error, { subject: `Task ${args.canonicalTaskId} deletion receipt` });
34
+ }
35
+ }
36
+ }
37
+ exports.default = TasksDeletionReceipt;
@@ -1,4 +1,4 @@
1
- export declare const EXECUTION_TARGET_ADVANCE_REASONS: readonly ["offline", "unavailable", "entitlement", "capacity", "unsupported", "error"];
1
+ export declare const EXECUTION_TARGET_ADVANCE_REASONS: readonly ["offline", "unavailable", "quota", "entitlement", "capacity", "unsupported", "error"];
2
2
  export type ExecutionTargetAdvanceReason = (typeof EXECUTION_TARGET_ADVANCE_REASONS)[number];
3
3
  export interface AgentExecutionTarget {
4
4
  kind: 'harness' | 'hosted-machine' | 'agent-worker';
@@ -5,9 +5,13 @@ exports.normalizeExecutionTargetSelector = normalizeExecutionTargetSelector;
5
5
  exports.normalizeAdvanceReasons = normalizeAdvanceReasons;
6
6
  exports.executionTargetForSelector = executionTargetForSelector;
7
7
  exports.buildExecutionOrderPatch = buildExecutionOrderPatch;
8
+ // The server's `EXECUTION_FAILURE_CATEGORIES` (`api/server/services/Harness/executionPolicyRefs.js`)
9
+ // that an owner may name, in the web picker's order. `quota` was missing, so an exhausted
10
+ // subscription could not hand a turn to the next target from the CLI (OSK-33137).
8
11
  exports.EXECUTION_TARGET_ADVANCE_REASONS = [
9
12
  'offline',
10
13
  'unavailable',
14
+ 'quota',
11
15
  'entitlement',
12
16
  'capacity',
13
17
  'unsupported',
@@ -208,6 +208,30 @@ export interface HarnessRemovalReferences {
208
208
  ownInferencePolicyReferencesMachine: boolean | null;
209
209
  }
210
210
  export declare function getHarnessRemovalReferences(id: string): Promise<HarnessRemovalReferences>;
211
+ export type HarnessRemovalReview = {
212
+ version: 1;
213
+ coverage: 'personal-offline';
214
+ removable: true;
215
+ harnessId: string;
216
+ expiresAt: string;
217
+ reviewRef: string;
218
+ };
219
+ export type HarnessRemovalReceipt = {
220
+ version: 1;
221
+ outcome: 'removed';
222
+ scope: 'personal-harness-registration';
223
+ operationId: string;
224
+ harnessId: string;
225
+ requestDigest: string;
226
+ removedAt: string;
227
+ };
228
+ export declare function getHarnessRemovalReview(id: string): Promise<HarnessRemovalReview>;
229
+ export declare function getHarnessRemovalOperation(operationId: string): Promise<{
230
+ state: "unknown";
231
+ } | {
232
+ state: "committed";
233
+ receipt: HarnessRemovalReceipt;
234
+ }>;
211
235
  export declare function listHarnessProducts(): Promise<unknown>;
212
236
  export declare function getHarnessUsage(id: string): Promise<unknown>;
213
237
  /** The rollup across every harness. The web calls this key `fleetUsage`. */
@@ -298,6 +322,7 @@ export declare function updateHarness(id: string, patch: Record<string, unknown>
298
322
  harness?: Harness;
299
323
  }>;
300
324
  export declare function forgetHarness(id: string): Promise<unknown>;
325
+ export declare function forgetReviewedHarness(id: string, reviewRef: string, operationId: string): Promise<HarnessRemovalReceipt>;
301
326
  /**
302
327
  * Why a superseded-looking row is KEPT by `harnesses prune`. Declared by the
303
328
  * server (`pruneSupersededHarnesses.js`, `REASONS`) and worded once, in
@@ -6,6 +6,8 @@ exports.listHarnesses = listHarnesses;
6
6
  exports.getHarness = getHarness;
7
7
  exports.getHarnessModels = getHarnessModels;
8
8
  exports.getHarnessRemovalReferences = getHarnessRemovalReferences;
9
+ exports.getHarnessRemovalReview = getHarnessRemovalReview;
10
+ exports.getHarnessRemovalOperation = getHarnessRemovalOperation;
9
11
  exports.listHarnessProducts = listHarnessProducts;
10
12
  exports.getHarnessUsage = getHarnessUsage;
11
13
  exports.getAllHarnessUsage = getAllHarnessUsage;
@@ -15,6 +17,7 @@ exports.getCurrentQuota = getCurrentQuota;
15
17
  exports.getQuotaHistory = getQuotaHistory;
16
18
  exports.updateHarness = updateHarness;
17
19
  exports.forgetHarness = forgetHarness;
20
+ exports.forgetReviewedHarness = forgetReviewedHarness;
18
21
  exports.pruneHarnesses = pruneHarnesses;
19
22
  exports.parseHarnessPruneAge = parseHarnessPruneAge;
20
23
  exports.harnessPruneReasonSentence = harnessPruneReasonSentence;
@@ -101,6 +104,12 @@ async function getHarnessModels(id) {
101
104
  async function getHarnessRemovalReferences(id) {
102
105
  return (0, api_fetch_1.apiFetch)(`/api/harnesses/${encodeURIComponent(id)}/removal-references`);
103
106
  }
107
+ async function getHarnessRemovalReview(id) {
108
+ return (0, api_fetch_1.apiFetch)(`/api/harnesses/${encodeURIComponent(id)}/removal-review`);
109
+ }
110
+ async function getHarnessRemovalOperation(operationId) {
111
+ return (0, api_fetch_1.apiFetch)(`/api/harnesses/removal-operations/${encodeURIComponent(operationId)}`);
112
+ }
104
113
  async function listHarnessProducts() {
105
114
  return (0, api_fetch_1.apiFetch)('/api/machines/products');
106
115
  }
@@ -190,6 +199,12 @@ async function updateHarness(id, patch) {
190
199
  async function forgetHarness(id) {
191
200
  return (0, api_fetch_1.apiFetch)(`/api/harnesses/${encodeURIComponent(id)}`, { method: 'DELETE' });
192
201
  }
202
+ async function forgetReviewedHarness(id, reviewRef, operationId) {
203
+ return (0, api_fetch_1.apiFetch)(`/api/harnesses/${encodeURIComponent(id)}/remove-if-unreferenced`, {
204
+ method: 'POST',
205
+ body: { reviewRef, operationId },
206
+ });
207
+ }
193
208
  /**
194
209
  * Remove the caller's superseded harness rows - or, by default, say which would go.
195
210
  *
@@ -0,0 +1,2 @@
1
+ /** Request and command IDs accepted by the server's receipt schemas. */
2
+ export declare function parseRequestUuid(value: string): Promise<string>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseRequestUuid = parseRequestUuid;
4
+ /** Request and command IDs accepted by the server's receipt schemas. */
5
+ async function parseRequestUuid(value) {
6
+ if (!/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i.test(value)) {
7
+ throw new Error('Expected the UUID used for the original request.');
8
+ }
9
+ return value;
10
+ }