@skrr-ai/cli 0.1.108 → 0.1.110

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 (202) hide show
  1. package/README.md +10 -0
  2. package/dist/base-command.d.ts +74 -0
  3. package/dist/base-command.js +182 -24
  4. package/dist/commands/agents/triggers/create.js +1 -1
  5. package/dist/commands/agents/triggers/update.js +1 -1
  6. package/dist/commands/agents/update.d.ts +25 -0
  7. package/dist/commands/agents/update.js +98 -3
  8. package/dist/commands/commitments/accounting.js +7 -2
  9. package/dist/commands/commitments/cost.d.ts +11 -0
  10. package/dist/commands/commitments/cost.js +26 -3
  11. package/dist/commands/commitments/create.js +2 -1
  12. package/dist/commands/commitments/operating-review.d.ts +15 -0
  13. package/dist/commands/commitments/operating-review.js +103 -50
  14. package/dist/commands/commitments/update.js +12 -5
  15. package/dist/commands/daemon/install.js +17 -1
  16. package/dist/commands/daemon/login.js +14 -0
  17. package/dist/commands/doctor.js +9 -0
  18. package/dist/commands/goals/list.js +6 -1
  19. package/dist/commands/grants/rotate.js +4 -0
  20. package/dist/commands/harnesses/prune.d.ts +26 -0
  21. package/dist/commands/harnesses/prune.js +172 -0
  22. package/dist/commands/login.js +53 -14
  23. package/dist/commands/machines/list.js +28 -6
  24. package/dist/commands/projects/show.js +1 -1
  25. package/dist/commands/revoke-daemon.js +2 -1
  26. package/dist/commands/spaces/workflows/archive.d.ts +1 -0
  27. package/dist/commands/spaces/workflows/archive.js +1 -0
  28. package/dist/commands/spaces/workflows/artifact.d.ts +1 -0
  29. package/dist/commands/spaces/workflows/artifact.js +1 -0
  30. package/dist/commands/spaces/workflows/cancel-node.d.ts +1 -0
  31. package/dist/commands/spaces/workflows/cancel-node.js +1 -0
  32. package/dist/commands/spaces/workflows/cancel.d.ts +1 -0
  33. package/dist/commands/spaces/workflows/cancel.js +6 -2
  34. package/dist/commands/spaces/workflows/create.d.ts +1 -0
  35. package/dist/commands/spaces/workflows/create.js +7 -1
  36. package/dist/commands/spaces/workflows/events.d.ts +1 -0
  37. package/dist/commands/spaces/workflows/events.js +1 -0
  38. package/dist/commands/spaces/workflows/fixtures/create.d.ts +1 -0
  39. package/dist/commands/spaces/workflows/fixtures/create.js +1 -0
  40. package/dist/commands/spaces/workflows/fixtures/list.d.ts +1 -0
  41. package/dist/commands/spaces/workflows/fixtures/list.js +1 -0
  42. package/dist/commands/spaces/workflows/lifecycle-diagnostics.d.ts +1 -0
  43. package/dist/commands/spaces/workflows/lifecycle-diagnostics.js +1 -0
  44. package/dist/commands/spaces/workflows/list.d.ts +1 -0
  45. package/dist/commands/spaces/workflows/list.js +1 -0
  46. package/dist/commands/spaces/workflows/node-types.d.ts +2 -0
  47. package/dist/commands/spaces/workflows/node-types.js +24 -6
  48. package/dist/commands/spaces/workflows/pause.d.ts +1 -0
  49. package/dist/commands/spaces/workflows/pause.js +1 -0
  50. package/dist/commands/spaces/workflows/plan/show.d.ts +1 -0
  51. package/dist/commands/spaces/workflows/plan/show.js +1 -0
  52. package/dist/commands/spaces/workflows/plan/update.d.ts +1 -0
  53. package/dist/commands/spaces/workflows/plan/update.js +1 -0
  54. package/dist/commands/spaces/workflows/proposals/apply.d.ts +1 -0
  55. package/dist/commands/spaces/workflows/proposals/apply.js +1 -0
  56. package/dist/commands/spaces/workflows/proposals/confirm.d.ts +1 -0
  57. package/dist/commands/spaces/workflows/proposals/confirm.js +1 -0
  58. package/dist/commands/spaces/workflows/proposals/create.d.ts +1 -0
  59. package/dist/commands/spaces/workflows/proposals/create.js +1 -0
  60. package/dist/commands/spaces/workflows/proposals/dismiss.d.ts +1 -0
  61. package/dist/commands/spaces/workflows/proposals/dismiss.js +1 -0
  62. package/dist/commands/spaces/workflows/proposals/list.d.ts +1 -0
  63. package/dist/commands/spaces/workflows/proposals/list.js +1 -0
  64. package/dist/commands/spaces/workflows/publish.d.ts +1 -0
  65. package/dist/commands/spaces/workflows/publish.js +9 -0
  66. package/dist/commands/spaces/workflows/reconcile.d.ts +1 -0
  67. package/dist/commands/spaces/workflows/reconcile.js +1 -0
  68. package/dist/commands/spaces/workflows/resume.d.ts +1 -0
  69. package/dist/commands/spaces/workflows/resume.js +1 -0
  70. package/dist/commands/spaces/workflows/retry.d.ts +1 -0
  71. package/dist/commands/spaces/workflows/retry.js +1 -0
  72. package/dist/commands/spaces/workflows/run.d.ts +1 -0
  73. package/dist/commands/spaces/workflows/run.js +14 -7
  74. package/dist/commands/spaces/workflows/runs.d.ts +1 -0
  75. package/dist/commands/spaces/workflows/runs.js +1 -0
  76. package/dist/commands/spaces/workflows/show.d.ts +25 -0
  77. package/dist/commands/spaces/workflows/show.js +42 -4
  78. package/dist/commands/spaces/workflows/signal.d.ts +12 -0
  79. package/dist/commands/spaces/workflows/signal.js +40 -2
  80. package/dist/commands/spaces/workflows/start.d.ts +1 -0
  81. package/dist/commands/spaces/workflows/start.js +4 -1
  82. package/dist/commands/spaces/workflows/task-execution/create.d.ts +1 -0
  83. package/dist/commands/spaces/workflows/task-execution/create.js +1 -0
  84. package/dist/commands/spaces/workflows/test.d.ts +1 -0
  85. package/dist/commands/spaces/workflows/test.js +1 -0
  86. package/dist/commands/spaces/workflows/triggers/create.d.ts +1 -0
  87. package/dist/commands/spaces/workflows/triggers/create.js +1 -0
  88. package/dist/commands/spaces/workflows/triggers/fire.d.ts +1 -0
  89. package/dist/commands/spaces/workflows/triggers/fire.js +1 -0
  90. package/dist/commands/spaces/workflows/triggers/list.d.ts +1 -0
  91. package/dist/commands/spaces/workflows/triggers/list.js +1 -0
  92. package/dist/commands/spaces/workflows/triggers/update.d.ts +1 -0
  93. package/dist/commands/spaces/workflows/triggers/update.js +1 -0
  94. package/dist/commands/spaces/workflows/update.d.ts +1 -0
  95. package/dist/commands/spaces/workflows/update.js +4 -0
  96. package/dist/commands/spaces/workflows/validate.d.ts +1 -0
  97. package/dist/commands/spaces/workflows/validate.js +27 -2
  98. package/dist/commands/tasks/activity.js +17 -3
  99. package/dist/commands/tasks/bulk-update.d.ts +1 -0
  100. package/dist/commands/tasks/bulk-update.js +7 -0
  101. package/dist/commands/tasks/complete.js +2 -1
  102. package/dist/commands/tasks/create-tree.d.ts +69 -0
  103. package/dist/commands/tasks/create-tree.js +413 -47
  104. package/dist/commands/tasks/list.d.ts +2 -0
  105. package/dist/commands/tasks/list.js +25 -3
  106. package/dist/commands/tasks/rearm-recurrence.d.ts +22 -0
  107. package/dist/commands/tasks/rearm-recurrence.js +87 -0
  108. package/dist/commands/tasks/show.d.ts +9 -0
  109. package/dist/commands/tasks/show.js +79 -33
  110. package/dist/commands/tasks/timeline.js +4 -0
  111. package/dist/commands/tasks/unschedule.js +5 -1
  112. package/dist/commands/tasks/update.d.ts +1 -0
  113. package/dist/commands/tasks/update.js +17 -2
  114. package/dist/commands/triggers/audit.js +12 -3
  115. package/dist/commands/triggers/create.js +9 -3
  116. package/dist/commands/triggers/fire-detail.d.ts +7 -0
  117. package/dist/commands/triggers/fire-detail.js +30 -12
  118. package/dist/commands/triggers/fire.js +13 -3
  119. package/dist/commands/triggers/parse-intent.d.ts +7 -0
  120. package/dist/commands/triggers/parse-intent.js +31 -9
  121. package/dist/commands/triggers/update.js +1 -1
  122. package/dist/commands/workspaces/grants.js +20 -3
  123. package/dist/commands/workspaces/members.d.ts +20 -0
  124. package/dist/commands/workspaces/members.js +64 -0
  125. package/dist/commands/workspaces/stewardship.js +14 -2
  126. package/dist/help.js +12 -0
  127. package/dist/hooks/command-not-found.js +27 -1
  128. package/dist/lib/command-miss.d.ts +52 -2
  129. package/dist/lib/command-miss.js +187 -18
  130. package/dist/lib/commitment-loop-status.d.ts +8 -0
  131. package/dist/lib/commitment-loop-status.js +45 -0
  132. package/dist/lib/commitment-product.js +5 -2
  133. package/dist/lib/commitments.d.ts +18 -3
  134. package/dist/lib/commitments.js +85 -45
  135. package/dist/lib/daemon-command-hint.d.ts +15 -0
  136. package/dist/lib/daemon-command-hint.js +21 -0
  137. package/dist/lib/daemon-machine-identity-copy.d.ts +14 -0
  138. package/dist/lib/daemon-machine-identity-copy.js +27 -0
  139. package/dist/lib/daemon-machine-identity.d.ts +27 -0
  140. package/dist/lib/daemon-machine-identity.js +61 -0
  141. package/dist/lib/daemon-setup.js +10 -1
  142. package/dist/lib/daemonBrokerRefusal.js +3 -2
  143. package/dist/lib/daemonHandoff.d.ts +19 -1
  144. package/dist/lib/daemonHandoff.js +61 -1
  145. package/dist/lib/deployed-build.d.ts +43 -0
  146. package/dist/lib/deployed-build.js +66 -0
  147. package/dist/lib/grants.d.ts +27 -1
  148. package/dist/lib/grants.js +39 -21
  149. package/dist/lib/harnesses.d.ts +71 -0
  150. package/dist/lib/harnesses.js +70 -0
  151. package/dist/lib/json-mode.d.ts +11 -0
  152. package/dist/lib/json-mode.js +19 -0
  153. package/dist/lib/json-output.d.ts +25 -0
  154. package/dist/lib/json-output.js +30 -0
  155. package/dist/lib/list-output.d.ts +10 -1
  156. package/dist/lib/list-output.js +22 -1
  157. package/dist/lib/local-daemon-readiness.d.ts +90 -0
  158. package/dist/lib/local-daemon-readiness.js +143 -0
  159. package/dist/lib/machines.d.ts +117 -0
  160. package/dist/lib/machines.js +139 -0
  161. package/dist/lib/managed-instruction-local.d.ts +2 -0
  162. package/dist/lib/managed-instruction-local.js +2 -0
  163. package/dist/lib/profile-machine-identity-guard.d.ts +18 -0
  164. package/dist/lib/profile-machine-identity-guard.js +39 -0
  165. package/dist/lib/request-field-flags.d.ts +20 -0
  166. package/dist/lib/request-field-flags.js +34 -0
  167. package/dist/lib/stewardship-output.d.ts +1 -1
  168. package/dist/lib/stewardship-output.js +26 -30
  169. package/dist/lib/task-batch.d.ts +61 -4
  170. package/dist/lib/task-batch.js +316 -80
  171. package/dist/lib/task-economics.d.ts +15 -0
  172. package/dist/lib/task-economics.js +39 -2
  173. package/dist/lib/task-recurrence-outcome.d.ts +6 -6
  174. package/dist/lib/task-recurrence-outcome.js +27 -3
  175. package/dist/lib/tasks.d.ts +39 -0
  176. package/dist/lib/tasks.js +132 -0
  177. package/dist/lib/triggers.d.ts +42 -1
  178. package/dist/lib/triggers.js +98 -2
  179. package/dist/lib/workflow-issues.d.ts +14 -0
  180. package/dist/lib/workflow-issues.js +32 -0
  181. package/dist/lib/workflow-run-view.d.ts +59 -0
  182. package/dist/lib/workflow-run-view.js +110 -0
  183. package/dist/lib/workspaces.d.ts +48 -4
  184. package/dist/lib/workspaces.js +55 -0
  185. package/dist/lib/write-target.d.ts +29 -0
  186. package/dist/lib/write-target.js +72 -0
  187. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.d.ts +1 -1
  188. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.js +5 -3
  189. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/machineUuid.d.ts +60 -0
  190. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/machineUuid.js +130 -6
  191. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/workspaceIsolationProbeWire.d.ts +51 -0
  192. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/workspaceIsolationProbeWire.js +50 -0
  193. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.d.ts +1 -1
  194. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.js +1 -1
  195. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/machineUuid.d.ts +60 -0
  196. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/machineUuid.js +128 -6
  197. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/workspaceIsolationProbeWire.d.ts +51 -0
  198. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/workspaceIsolationProbeWire.js +46 -0
  199. package/dist/node_modules/@skrr-ai/auth-core/package.json +11 -1
  200. package/dist/node_modules/@skrr-ai/data-provider/index.js +7523 -7140
  201. package/oclif.manifest.json +473 -59
  202. package/package.json +28 -1
@@ -1,5 +1,6 @@
1
1
  import { BaseCommand } from '../../../base-command';
2
2
  export default class SpacesWorkflowsTest extends BaseCommand {
3
+ static aliases: string[];
3
4
  static description: string;
4
5
  static args: {
5
6
  spaceId: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
@@ -6,6 +6,7 @@ const base_command_1 = require("../../../base-command");
6
6
  const prompt_1 = require("../../../lib/prompt");
7
7
  const space_output_1 = require("../../../lib/space-output");
8
8
  class SpacesWorkflowsTest extends base_command_1.BaseCommand {
9
+ static aliases = ['workflows:test'];
9
10
  static description = 'Start a test workflow run, optionally using recorded node fixtures';
10
11
  static args = {
11
12
  spaceId: core_1.Args.string({ description: 'Owning Space ID', required: true, ignoreStdin: true }),
@@ -2,6 +2,7 @@ import { type WorkflowTrigger } from '@skrr-ai/data-provider';
2
2
  import { BaseCommand } from '../../../../base-command';
3
3
  declare function readTriggerConfig(inline: string | undefined, file: string | undefined): Promise<WorkflowTrigger['config']>;
4
4
  export default class SpacesWorkflowsTriggersCreate extends BaseCommand {
5
+ static aliases: string[];
5
6
  static description: string;
6
7
  static args: {
7
8
  spaceId: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
@@ -15,6 +15,7 @@ async function readTriggerConfig(inline, file) {
15
15
  return value;
16
16
  }
17
17
  class SpacesWorkflowsTriggersCreate extends base_command_1.BaseCommand {
18
+ static aliases = ['workflows:triggers:create'];
18
19
  static description = 'Create a schedule, webhook, or space-event workflow trigger';
19
20
  static args = {
20
21
  spaceId: core_1.Args.string({ required: true, ignoreStdin: true }),
@@ -1,5 +1,6 @@
1
1
  import { BaseCommand } from '../../../../base-command';
2
2
  export default class SpacesWorkflowsTriggersFire extends BaseCommand {
3
+ static aliases: string[];
3
4
  static description: string;
4
5
  static args: {
5
6
  spaceId: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
@@ -6,6 +6,7 @@ const base_command_1 = require("../../../../base-command");
6
6
  const prompt_1 = require("../../../../lib/prompt");
7
7
  const space_output_1 = require("../../../../lib/space-output");
8
8
  class SpacesWorkflowsTriggersFire extends base_command_1.BaseCommand {
9
+ static aliases = ['workflows:triggers:fire'];
9
10
  static description = 'Manually fire a workflow trigger with an idempotent delivery identity';
10
11
  static args = {
11
12
  spaceId: core_1.Args.string({ required: true, ignoreStdin: true }),
@@ -1,5 +1,6 @@
1
1
  import { BaseCommand } from '../../../../base-command';
2
2
  export default class SpacesWorkflowsTriggersList extends BaseCommand {
3
+ static aliases: string[];
3
4
  static description: string;
4
5
  static args: {
5
6
  spaceId: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
@@ -6,6 +6,7 @@ const base_command_1 = require("../../../../base-command");
6
6
  const format_1 = require("../../../../lib/format");
7
7
  const space_output_1 = require("../../../../lib/space-output");
8
8
  class SpacesWorkflowsTriggersList extends base_command_1.BaseCommand {
9
+ static aliases = ['workflows:triggers:list'];
9
10
  static description = 'List workflow triggers';
10
11
  static args = {
11
12
  spaceId: core_1.Args.string({ required: true, ignoreStdin: true }),
@@ -1,5 +1,6 @@
1
1
  import { BaseCommand } from '../../../../base-command';
2
2
  export default class SpacesWorkflowsTriggersUpdate extends BaseCommand {
3
+ static aliases: string[];
3
4
  static description: string;
4
5
  static args: {
5
6
  spaceId: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
@@ -6,6 +6,7 @@ const base_command_1 = require("../../../../base-command");
6
6
  const create_1 = require("./create");
7
7
  const space_output_1 = require("../../../../lib/space-output");
8
8
  class SpacesWorkflowsTriggersUpdate extends base_command_1.BaseCommand {
9
+ static aliases = ['workflows:triggers:update'];
9
10
  static description = 'Update a workflow trigger’s type, state, or configuration';
10
11
  static args = {
11
12
  spaceId: core_1.Args.string({ required: true, ignoreStdin: true }),
@@ -16,6 +16,7 @@ export declare function buildWorkflowUpdatePayload({ body, title, description, c
16
16
  }): WorkflowPatch;
17
17
  /** Update metadata or the mutable draft; executable changes use optimistic concurrency. */
18
18
  export default class SpacesWorkflowsUpdate extends BaseCommand {
19
+ static aliases: string[];
19
20
  static description: string;
20
21
  static examples: string[];
21
22
  static args: {
@@ -7,6 +7,7 @@ const data_provider_1 = require("@skrr-ai/data-provider");
7
7
  const base_command_1 = require("../../../base-command");
8
8
  const prompt_1 = require("../../../lib/prompt");
9
9
  const space_output_1 = require("../../../lib/space-output");
10
+ const workflow_issues_1 = require("../../../lib/workflow-issues");
10
11
  /** `90m`, `4h`, `2d` to milliseconds; null when malformed or outside the shared bounds. */
11
12
  function parseWorkflowDuration(text) {
12
13
  const match = /^(\d+)\s*([mhd])$/i.exec(text.trim());
@@ -29,6 +30,7 @@ function buildWorkflowUpdatePayload({ body, title, description, clearDescription
29
30
  }
30
31
  /** Update metadata or the mutable draft; executable changes use optimistic concurrency. */
31
32
  class SpacesWorkflowsUpdate extends base_command_1.BaseCommand {
33
+ static aliases = ['workflows:update'];
32
34
  static description = 'Update workflow metadata or its mutable graph draft';
33
35
  static examples = [
34
36
  '<%= config.bin %> spaces workflows update <space-id> <workflow-id> --title "Release train"',
@@ -159,6 +161,8 @@ class SpacesWorkflowsUpdate extends base_command_1.BaseCommand {
159
161
  }
160
162
  this.log(`Updated workflow ${workflow.id}: ${workflow.title}`);
161
163
  this.log(`Draft revisions: semantic ${workflow.draft.semanticRevision}, presentation ${workflow.draft.presentationRevision}`);
164
+ for (const line of (0, workflow_issues_1.describeDraftIssues)(workflow.issues))
165
+ this.log(line);
162
166
  }
163
167
  }
164
168
  exports.default = SpacesWorkflowsUpdate;
@@ -1,5 +1,6 @@
1
1
  import { BaseCommand } from '../../../base-command';
2
2
  export default class SpacesWorkflowsValidate extends BaseCommand {
3
+ static aliases: string[];
3
4
  static description: string;
4
5
  static args: {
5
6
  spaceId: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
@@ -4,7 +4,9 @@ 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 space_output_1 = require("../../../lib/space-output");
7
+ const workflow_issues_1 = require("../../../lib/workflow-issues");
7
8
  class SpacesWorkflowsValidate extends base_command_1.BaseCommand {
9
+ static aliases = ['workflows:validate'];
8
10
  static description = 'Validate a workflow draft before publishing';
9
11
  static args = {
10
12
  spaceId: core_1.Args.string({ description: 'Owning Space ID', required: true, ignoreStdin: true }),
@@ -28,15 +30,38 @@ class SpacesWorkflowsValidate extends base_command_1.BaseCommand {
28
30
  this.handleApiError(error);
29
31
  return;
30
32
  }
33
+ // The one rule (OSK-16493): an error-severity issue means invalid, whatever `valid` says. A
34
+ // server that predates the shared gate answered `valid: true` beside such an issue, and the
35
+ // text view then called the draft ready to publish and hid the issue.
36
+ const blocking = (0, data_provider_1.blockingWorkflowIssues)(result.issues ?? []);
37
+ const valid = Boolean(result.valid) && blocking.length === 0;
31
38
  if (flags.json) {
32
39
  this.log(JSON.stringify((0, space_output_1.withSpacePerspectiveUrl)(this.cliConfig.baseURL, args.spaceId, 'workflows', result), null, 2));
40
+ // One answer, two renderings: an invalid draft fails the command in either mode, so a
41
+ // script reading --json can trust the exit status exactly as a person reading text can
42
+ // (OSK-16473).
43
+ if (!valid)
44
+ this.exit(1);
33
45
  return;
34
46
  }
35
- if (result.valid) {
47
+ const advisories = (result.issues ?? []).filter((issue) => issue.severity !== 'error');
48
+ if (valid) {
36
49
  this.log('Workflow draft is valid and ready to publish.');
50
+ if (advisories.length) {
51
+ this.log(`${advisories.length} warning${advisories.length === 1 ? '' : 's'} (publishing is allowed):`);
52
+ for (const line of (0, workflow_issues_1.formatWorkflowIssues)(advisories))
53
+ this.log(line);
54
+ }
37
55
  return;
38
56
  }
39
- this.log(`Workflow draft is invalid${result.code ? ` (${result.code})` : ''}: ${result.message ?? 'Unknown validation error'}`);
57
+ this.log(`Workflow draft is invalid${result.code ? ` (${result.code})` : ''}: ${result.message ?? blocking[0]?.message ?? 'Unknown validation error'}`);
58
+ // Every problem, not only the first one publish would stop at.
59
+ const all = result.issues ?? [];
60
+ if (all.length) {
61
+ this.log('All problems found:');
62
+ for (const line of (0, workflow_issues_1.formatWorkflowIssues)(all))
63
+ this.log(line);
64
+ }
40
65
  this.exit(1);
41
66
  }
42
67
  }
@@ -6,7 +6,18 @@ const core_1 = require("@oclif/core");
6
6
  const data_provider_1 = require("@skrr-ai/data-provider");
7
7
  const base_command_1 = require("../../base-command");
8
8
  const format_1 = require("../../lib/format");
9
+ const task_economics_1 = require("../../lib/task-economics");
9
10
  const task_legacy_1 = require("../../lib/task-legacy");
11
+ /**
12
+ * A system-written embedded entry names no person (OSK-16475): it carries
13
+ * `details.actorKind: 'system'` instead of a `userId`, so the actor is the service.
14
+ */
15
+ function systemEntryActor(details) {
16
+ const value = details;
17
+ if (value?.actorKind !== 'system')
18
+ return undefined;
19
+ return `system:${value.actorService ?? '-'}`;
20
+ }
10
21
  function activityRow(entry) {
11
22
  const actor = entry.actor;
12
23
  const actorText = actor
@@ -17,12 +28,15 @@ function activityRow(entry) {
17
28
  : actor.kind === 'integration'
18
29
  ? `integration:${actor.provider}`
19
30
  : `system:${actor.service}`
20
- : (entry.userId ?? entry.actorId);
31
+ : (entry.userId ?? entry.actorId ?? systemEntryActor(entry.details));
32
+ const type = entry.action ?? entry.event ?? entry.type;
21
33
  return {
22
34
  time: (0, format_1.localTime)(entry.occurredAt ?? entry.timestamp ?? entry.createdAt),
23
- event: (0, format_1.formatCell)(entry.action ?? entry.event ?? entry.type),
35
+ event: (0, format_1.formatCell)(type),
24
36
  actor: (0, format_1.formatCell)(actorText),
25
- details: (0, format_1.formatCell)(entry.data ?? entry.details ?? entry.metadata),
37
+ details: typeof type === 'string' && type.startsWith(data_provider_1.TASK_ECONOMICS_ACTIVITY_TYPE_PREFIX)
38
+ ? (0, task_economics_1.describeEconomicsChange)(entry.data)
39
+ : (0, format_1.formatCell)(entry.data ?? entry.details ?? entry.metadata),
26
40
  };
27
41
  }
28
42
  /**
@@ -3,6 +3,7 @@ export default class TasksBulkUpdate extends BaseCommand {
3
3
  static description: string;
4
4
  static examples: string[];
5
5
  static flags: {
6
+ 'expect-target': import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
6
7
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
8
  'from-json': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
8
9
  'dry-run': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
@@ -7,6 +7,7 @@ const web_url_1 = require("../../lib/web-url");
7
7
  const prompt_1 = require("../../lib/prompt");
8
8
  const dry_run_plans_1 = require("../../lib/dry-run-plans");
9
9
  const task_batch_1 = require("../../lib/task-batch");
10
+ const write_target_1 = require("../../lib/write-target");
10
11
  const tasks_1 = require("../../lib/tasks");
11
12
  class TasksBulkUpdate extends base_command_1.BaseCommand {
12
13
  static description = 'Apply partial updates to many tasks from JSON';
@@ -14,6 +15,7 @@ class TasksBulkUpdate extends base_command_1.BaseCommand {
14
15
  '<%= config.bin %> tasks bulk-update --from-json updates.json --json',
15
16
  '<%= config.bin %> tasks bulk-update --from-json updates.json --continue-on-error',
16
17
  '<%= config.bin %> tasks bulk-update --from-json updates.json --dry-run --json',
18
+ '<%= config.bin %> tasks bulk-update --from-json updates.json --expect-target skrr.ai --json',
17
19
  ];
18
20
  static flags = {
19
21
  json: core_1.Flags.boolean({ description: 'Output bulk result as JSON' }),
@@ -27,6 +29,7 @@ class TasksBulkUpdate extends base_command_1.BaseCommand {
27
29
  'continue-on-error': core_1.Flags.boolean({
28
30
  description: 'Continue applying later updates after one task fails',
29
31
  }),
32
+ ...write_target_1.expectTargetFlag,
30
33
  };
31
34
  async run() {
32
35
  this.requireAuth();
@@ -80,6 +83,9 @@ class TasksBulkUpdate extends base_command_1.BaseCommand {
80
83
  this.exit(1);
81
84
  return;
82
85
  }
86
+ // Everything above only read. Say where the writes land, and honour
87
+ // `--expect-target`, before the first one (OSK-S-440 #10).
88
+ const target = await this.assertWriteTarget(flags['expect-target']);
83
89
  const results = [];
84
90
  const errors = [];
85
91
  const rows = updates.map((update) => {
@@ -180,6 +186,7 @@ class TasksBulkUpdate extends base_command_1.BaseCommand {
180
186
  const base = this.cliConfig.baseURL;
181
187
  const enriched = {
182
188
  ...summary,
189
+ target,
183
190
  results: results.map((row) => {
184
191
  const rec = row;
185
192
  // Only link rows that actually updated — a failed row may not exist
@@ -357,7 +357,8 @@ class TasksComplete extends base_command_1.BaseCommand {
357
357
  for (const sentence of (0, task_closure_1.closureSnapshotLines)(result.task?.resolution?.closure)) {
358
358
  this.log(sentence);
359
359
  }
360
- const recurrenceLine = (0, task_recurrence_outcome_1.recurrenceOutcomeLine)(result.recurrence);
360
+ const completedRef = result.task?.identifier || taskId;
361
+ const recurrenceLine = (0, task_recurrence_outcome_1.recurrenceOutcomeLine)(result.recurrence, completedRef, this.config.bin);
361
362
  if (recurrenceLine)
362
363
  this.log(recurrenceLine);
363
364
  for (const advisory of result.advisories || [])
@@ -6,6 +6,14 @@ export type TreeNode = TaskRecord & {
6
6
  export type PlannedNode = {
7
7
  key: string;
8
8
  parentKey?: string;
9
+ /**
10
+ * Keys of other nodes in this file that block this one (`blockedByTempIds`).
11
+ * The ORDER of `planTree`'s result is parents-first only; `orderForCreation`
12
+ * makes it blockers-first too.
13
+ */
14
+ blockerKeys?: string[];
15
+ /** True when `externalKey` was filled in from a key prefix rather than written on the node. */
16
+ keyDerived?: boolean;
9
17
  node: TreeNode;
10
18
  payload: TaskRecord;
11
19
  };
@@ -45,6 +53,12 @@ export type TreeFailure = {
45
53
  /**
46
54
  * What a half-applied tree reports (E4). The ids already created are the only
47
55
  * way to continue or clean up, and the failing call used to print none of them.
56
+ *
57
+ * Every confirmed id is in `mapping` however the run ended, and `summary` counts
58
+ * the three things a failure can leave: confirmed, UNKNOWN (submitted, outcome
59
+ * not established — it may exist) and not attempted. They are different next
60
+ * steps, and a count that folded them together was the thing the first report
61
+ * of OSK-S-440 could not rely on.
48
62
  */
49
63
  export declare function partialFailureResult(args: {
50
64
  results: Array<Record<string, unknown>>;
@@ -55,14 +69,23 @@ export declare function partialFailureResult(args: {
55
69
  keyed?: boolean;
56
70
  warnings: Array<Record<string, unknown>>;
57
71
  failures?: Array<Record<string, unknown>>;
72
+ /** The command to run next, as it should be typed. */
73
+ next?: string;
58
74
  }): {
59
75
  warnings?: Record<string, unknown>[] | undefined;
76
+ next?: string | undefined;
60
77
  rerun: string;
61
78
  failures?: Record<string, unknown>[] | undefined;
62
79
  object: string;
63
80
  ok: boolean;
64
81
  count: number;
65
82
  total: number;
83
+ summary: {
84
+ confirmed: number;
85
+ unknown: number;
86
+ notAttempted: number;
87
+ failed: number;
88
+ };
66
89
  created: {
67
90
  tempId: unknown;
68
91
  parentTempId: unknown;
@@ -74,22 +97,68 @@ export declare function partialFailureResult(args: {
74
97
  mapping: Record<string, string>;
75
98
  failedAt: TreeFailure;
76
99
  };
100
+ /**
101
+ * Order nodes so everything a node depends on — its parent and every blocker —
102
+ * comes BEFORE it, keeping input order otherwise. The batch and the serial path
103
+ * both create in this order, so a parent id and a blocker id exist by the time a
104
+ * node that needs them is written.
105
+ *
106
+ * Also the place a bad `blockedByTempIds` is caught: before any request, naming
107
+ * the node, rather than as a per-row refusal after half the tree exists.
108
+ */
109
+ export declare function orderForCreation(planned: PlannedNode[]): {
110
+ ordered: PlannedNode[];
111
+ errors: string[];
112
+ };
77
113
  export default class TasksCreateTree extends BaseCommand {
78
114
  static description: string;
79
115
  static examples: string[];
80
116
  static flags: {
117
+ 'expect-target': import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
81
118
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
82
119
  'from-json': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
83
120
  'dry-run': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
121
+ verify: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
84
122
  'external-key-prefix': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
85
123
  fresh: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
86
124
  resume: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
125
+ 'no-batch': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
87
126
  'default-agent': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
88
127
  space: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
89
128
  goal: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
129
+ project: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
90
130
  };
91
131
  run(): Promise<void>;
132
+ /**
133
+ * `--verify`: which nodes of this tree exist, and which do not. Read-only by
134
+ * construction — it is reached before anything that writes — so it is safe to
135
+ * run at any time, as often as wanted, against a tree of any size.
136
+ */
137
+ private verifyTree;
138
+ /**
139
+ * The command that continues this tree, as it should be typed: this
140
+ * invocation's own input and scope, plus `--resume`. Rebuilt from the parsed
141
+ * flags rather than echoed from argv, so it is the same whether the person
142
+ * typed `--space x` or `--space=x`, and so it can say plainly when the input
143
+ * came from stdin and cannot be replayed from a path.
144
+ */
145
+ private nextCommand;
92
146
  }
147
+ /**
148
+ * The note that names an Agent put in charge of nodes by DEFAULT, or undefined
149
+ * when no node was. Sources a person wrote themselves (`explicit-assignee`,
150
+ * `provided` — an operator's own `--default-agent`) are not surprises; the
151
+ * session's agent, a parent's, or the space lead are.
152
+ */
153
+ export declare function describeDefaultAgentAssignment(resolutions: Record<string, unknown>): {
154
+ code: string;
155
+ value: {
156
+ count: number;
157
+ agentIds: string[];
158
+ sources: string[];
159
+ };
160
+ hint: string;
161
+ } | undefined;
93
162
  export declare function normalizeTreeRoots(input: TaskRecord): TreeNode[];
94
163
  export declare function planTree(roots: TreeNode[], opts: {
95
164
  defaults: TaskRecord;