@skrr-ai/cli 0.1.108 → 0.1.109

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 (174) hide show
  1. package/README.md +10 -0
  2. package/dist/base-command.d.ts +59 -0
  3. package/dist/base-command.js +118 -7
  4. package/dist/commands/agents/update.d.ts +14 -0
  5. package/dist/commands/agents/update.js +40 -1
  6. package/dist/commands/commitments/accounting.js +7 -2
  7. package/dist/commands/commitments/cost.d.ts +11 -0
  8. package/dist/commands/commitments/cost.js +26 -3
  9. package/dist/commands/commitments/create.js +2 -1
  10. package/dist/commands/commitments/operating-review.d.ts +15 -0
  11. package/dist/commands/commitments/operating-review.js +103 -50
  12. package/dist/commands/commitments/update.js +12 -5
  13. package/dist/commands/doctor.js +9 -0
  14. package/dist/commands/goals/list.js +6 -1
  15. package/dist/commands/grants/rotate.js +4 -0
  16. package/dist/commands/login.js +42 -14
  17. package/dist/commands/machines/list.js +28 -6
  18. package/dist/commands/projects/show.js +1 -1
  19. package/dist/commands/revoke-daemon.js +2 -1
  20. package/dist/commands/spaces/workflows/archive.d.ts +1 -0
  21. package/dist/commands/spaces/workflows/archive.js +1 -0
  22. package/dist/commands/spaces/workflows/artifact.d.ts +1 -0
  23. package/dist/commands/spaces/workflows/artifact.js +1 -0
  24. package/dist/commands/spaces/workflows/cancel-node.d.ts +1 -0
  25. package/dist/commands/spaces/workflows/cancel-node.js +1 -0
  26. package/dist/commands/spaces/workflows/cancel.d.ts +1 -0
  27. package/dist/commands/spaces/workflows/cancel.js +6 -2
  28. package/dist/commands/spaces/workflows/create.d.ts +1 -0
  29. package/dist/commands/spaces/workflows/create.js +7 -1
  30. package/dist/commands/spaces/workflows/events.d.ts +1 -0
  31. package/dist/commands/spaces/workflows/events.js +1 -0
  32. package/dist/commands/spaces/workflows/fixtures/create.d.ts +1 -0
  33. package/dist/commands/spaces/workflows/fixtures/create.js +1 -0
  34. package/dist/commands/spaces/workflows/fixtures/list.d.ts +1 -0
  35. package/dist/commands/spaces/workflows/fixtures/list.js +1 -0
  36. package/dist/commands/spaces/workflows/lifecycle-diagnostics.d.ts +1 -0
  37. package/dist/commands/spaces/workflows/lifecycle-diagnostics.js +1 -0
  38. package/dist/commands/spaces/workflows/list.d.ts +1 -0
  39. package/dist/commands/spaces/workflows/list.js +1 -0
  40. package/dist/commands/spaces/workflows/node-types.d.ts +2 -0
  41. package/dist/commands/spaces/workflows/node-types.js +24 -6
  42. package/dist/commands/spaces/workflows/pause.d.ts +1 -0
  43. package/dist/commands/spaces/workflows/pause.js +1 -0
  44. package/dist/commands/spaces/workflows/plan/show.d.ts +1 -0
  45. package/dist/commands/spaces/workflows/plan/show.js +1 -0
  46. package/dist/commands/spaces/workflows/plan/update.d.ts +1 -0
  47. package/dist/commands/spaces/workflows/plan/update.js +1 -0
  48. package/dist/commands/spaces/workflows/proposals/apply.d.ts +1 -0
  49. package/dist/commands/spaces/workflows/proposals/apply.js +1 -0
  50. package/dist/commands/spaces/workflows/proposals/confirm.d.ts +1 -0
  51. package/dist/commands/spaces/workflows/proposals/confirm.js +1 -0
  52. package/dist/commands/spaces/workflows/proposals/create.d.ts +1 -0
  53. package/dist/commands/spaces/workflows/proposals/create.js +1 -0
  54. package/dist/commands/spaces/workflows/proposals/dismiss.d.ts +1 -0
  55. package/dist/commands/spaces/workflows/proposals/dismiss.js +1 -0
  56. package/dist/commands/spaces/workflows/proposals/list.d.ts +1 -0
  57. package/dist/commands/spaces/workflows/proposals/list.js +1 -0
  58. package/dist/commands/spaces/workflows/publish.d.ts +1 -0
  59. package/dist/commands/spaces/workflows/publish.js +9 -0
  60. package/dist/commands/spaces/workflows/reconcile.d.ts +1 -0
  61. package/dist/commands/spaces/workflows/reconcile.js +1 -0
  62. package/dist/commands/spaces/workflows/resume.d.ts +1 -0
  63. package/dist/commands/spaces/workflows/resume.js +1 -0
  64. package/dist/commands/spaces/workflows/retry.d.ts +1 -0
  65. package/dist/commands/spaces/workflows/retry.js +1 -0
  66. package/dist/commands/spaces/workflows/run.d.ts +1 -0
  67. package/dist/commands/spaces/workflows/run.js +14 -7
  68. package/dist/commands/spaces/workflows/runs.d.ts +1 -0
  69. package/dist/commands/spaces/workflows/runs.js +1 -0
  70. package/dist/commands/spaces/workflows/show.d.ts +25 -0
  71. package/dist/commands/spaces/workflows/show.js +42 -4
  72. package/dist/commands/spaces/workflows/signal.d.ts +12 -0
  73. package/dist/commands/spaces/workflows/signal.js +40 -2
  74. package/dist/commands/spaces/workflows/start.d.ts +1 -0
  75. package/dist/commands/spaces/workflows/start.js +1 -0
  76. package/dist/commands/spaces/workflows/task-execution/create.d.ts +1 -0
  77. package/dist/commands/spaces/workflows/task-execution/create.js +1 -0
  78. package/dist/commands/spaces/workflows/test.d.ts +1 -0
  79. package/dist/commands/spaces/workflows/test.js +1 -0
  80. package/dist/commands/spaces/workflows/triggers/create.d.ts +1 -0
  81. package/dist/commands/spaces/workflows/triggers/create.js +1 -0
  82. package/dist/commands/spaces/workflows/triggers/fire.d.ts +1 -0
  83. package/dist/commands/spaces/workflows/triggers/fire.js +1 -0
  84. package/dist/commands/spaces/workflows/triggers/list.d.ts +1 -0
  85. package/dist/commands/spaces/workflows/triggers/list.js +1 -0
  86. package/dist/commands/spaces/workflows/triggers/update.d.ts +1 -0
  87. package/dist/commands/spaces/workflows/triggers/update.js +1 -0
  88. package/dist/commands/spaces/workflows/update.d.ts +1 -0
  89. package/dist/commands/spaces/workflows/update.js +4 -0
  90. package/dist/commands/spaces/workflows/validate.d.ts +1 -0
  91. package/dist/commands/spaces/workflows/validate.js +15 -0
  92. package/dist/commands/tasks/activity.js +6 -2
  93. package/dist/commands/tasks/bulk-update.d.ts +1 -0
  94. package/dist/commands/tasks/bulk-update.js +7 -0
  95. package/dist/commands/tasks/complete.js +2 -1
  96. package/dist/commands/tasks/create-tree.d.ts +69 -0
  97. package/dist/commands/tasks/create-tree.js +413 -47
  98. package/dist/commands/tasks/list.d.ts +2 -0
  99. package/dist/commands/tasks/list.js +19 -1
  100. package/dist/commands/tasks/rearm-recurrence.d.ts +22 -0
  101. package/dist/commands/tasks/rearm-recurrence.js +68 -0
  102. package/dist/commands/tasks/show.d.ts +1 -0
  103. package/dist/commands/tasks/show.js +17 -3
  104. package/dist/commands/tasks/timeline.js +4 -0
  105. package/dist/commands/tasks/update.d.ts +1 -0
  106. package/dist/commands/tasks/update.js +6 -1
  107. package/dist/commands/triggers/create.js +8 -2
  108. package/dist/commands/triggers/parse-intent.d.ts +7 -0
  109. package/dist/commands/triggers/parse-intent.js +31 -9
  110. package/dist/commands/workspaces/grants.js +23 -3
  111. package/dist/commands/workspaces/members.d.ts +20 -0
  112. package/dist/commands/workspaces/members.js +64 -0
  113. package/dist/commands/workspaces/stewardship.js +14 -2
  114. package/dist/help.js +12 -0
  115. package/dist/hooks/command-not-found.js +27 -1
  116. package/dist/lib/command-miss.d.ts +52 -2
  117. package/dist/lib/command-miss.js +187 -18
  118. package/dist/lib/commitment-loop-status.d.ts +8 -0
  119. package/dist/lib/commitment-loop-status.js +45 -0
  120. package/dist/lib/commitments.d.ts +16 -2
  121. package/dist/lib/commitments.js +48 -8
  122. package/dist/lib/daemon-command-hint.d.ts +15 -0
  123. package/dist/lib/daemon-command-hint.js +21 -0
  124. package/dist/lib/daemon-setup.js +10 -1
  125. package/dist/lib/daemonBrokerRefusal.js +3 -2
  126. package/dist/lib/daemonHandoff.js +2 -1
  127. package/dist/lib/deployed-build.d.ts +43 -0
  128. package/dist/lib/deployed-build.js +66 -0
  129. package/dist/lib/grants.d.ts +27 -1
  130. package/dist/lib/grants.js +39 -21
  131. package/dist/lib/json-mode.d.ts +11 -0
  132. package/dist/lib/json-mode.js +19 -0
  133. package/dist/lib/json-output.d.ts +25 -0
  134. package/dist/lib/json-output.js +30 -0
  135. package/dist/lib/list-output.d.ts +9 -0
  136. package/dist/lib/list-output.js +20 -1
  137. package/dist/lib/local-daemon-readiness.d.ts +90 -0
  138. package/dist/lib/local-daemon-readiness.js +143 -0
  139. package/dist/lib/machines.d.ts +117 -0
  140. package/dist/lib/machines.js +139 -0
  141. package/dist/lib/managed-instruction-local.d.ts +2 -0
  142. package/dist/lib/managed-instruction-local.js +2 -0
  143. package/dist/lib/profile-machine-identity-guard.d.ts +18 -0
  144. package/dist/lib/profile-machine-identity-guard.js +29 -0
  145. package/dist/lib/request-field-flags.d.ts +20 -0
  146. package/dist/lib/request-field-flags.js +34 -0
  147. package/dist/lib/stewardship-output.d.ts +1 -1
  148. package/dist/lib/stewardship-output.js +26 -30
  149. package/dist/lib/task-batch.d.ts +61 -4
  150. package/dist/lib/task-batch.js +316 -80
  151. package/dist/lib/task-economics.d.ts +5 -0
  152. package/dist/lib/task-economics.js +15 -0
  153. package/dist/lib/task-recurrence-outcome.d.ts +6 -6
  154. package/dist/lib/task-recurrence-outcome.js +27 -3
  155. package/dist/lib/tasks.d.ts +39 -0
  156. package/dist/lib/tasks.js +132 -0
  157. package/dist/lib/triggers.d.ts +31 -1
  158. package/dist/lib/triggers.js +55 -1
  159. package/dist/lib/workflow-issues.d.ts +14 -0
  160. package/dist/lib/workflow-issues.js +32 -0
  161. package/dist/lib/workflow-run-view.d.ts +55 -0
  162. package/dist/lib/workflow-run-view.js +105 -0
  163. package/dist/lib/workspaces.d.ts +31 -4
  164. package/dist/lib/workspaces.js +43 -0
  165. package/dist/lib/write-target.d.ts +29 -0
  166. package/dist/lib/write-target.js +72 -0
  167. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/workspaceIsolationProbeWire.d.ts +51 -0
  168. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/workspaceIsolationProbeWire.js +50 -0
  169. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/workspaceIsolationProbeWire.d.ts +51 -0
  170. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/workspaceIsolationProbeWire.js +46 -0
  171. package/dist/node_modules/@skrr-ai/auth-core/package.json +11 -1
  172. package/dist/node_modules/@skrr-ai/data-provider/index.js +6718 -6370
  173. package/oclif.manifest.json +376 -52
  174. package/package.json +19 -1
@@ -4,6 +4,7 @@ exports.printStewardshipCoverage = printStewardshipCoverage;
4
4
  exports.printWorkspaceGrants = printWorkspaceGrants;
5
5
  exports.printWorkspaceStewardship = printWorkspaceStewardship;
6
6
  const format_1 = require("./format");
7
+ const grants_1 = require("./grants");
7
8
  function printStewardshipCoverage(report, log) {
8
9
  if (report.coverage.complete) {
9
10
  log('Coverage: complete within the bounded sources.');
@@ -41,23 +42,24 @@ function printStewardshipCoverage(report, log) {
41
42
  }
42
43
  }
43
44
  }
44
- /** Who holds the Grant, in the same `kind id` words `skrr grants list` uses. */
45
- function principalText(principal) {
46
- const value = principal;
47
- if (!value?.kind)
48
- return '—';
49
- const id = value.agentId ?? value.commitmentId;
50
- return id ? `${value.kind} ${id}` : value.kind;
51
- }
52
- /** What the Grant allows: its capability names, or an honest dash when it lists none. */
53
- function accessText(capabilities) {
45
+ /** What the Grant's capabilities name, or an honest dash when it lists none. */
46
+ function capabilitiesText(capabilities) {
54
47
  return Array.isArray(capabilities) && capabilities.length ? capabilities.join(', ') : '—';
55
48
  }
56
- function printWorkspaceGrants(report, log) {
49
+ /**
50
+ * The owner as a person reads it: `Name (id)` when the id belongs to a current
51
+ * member, the bare id otherwise — an owner who has left is not a member, and
52
+ * the id is still the thing to act on.
53
+ */
54
+ function ownerText(ownerUserId, members) {
55
+ const name = members?.get(ownerUserId);
56
+ return name ? `${name} (${ownerUserId})` : ownerUserId;
57
+ }
58
+ function printWorkspaceGrants(report, log, members) {
57
59
  printStewardshipCoverage(report, log);
58
- printGrantRows(report, log);
60
+ printGrantRows(report, log, members);
59
61
  }
60
- function printGrantRows(report, log) {
62
+ function printGrantRows(report, log, members) {
61
63
  if (report.grants === null) {
62
64
  log('Grants: unavailable.');
63
65
  return;
@@ -69,30 +71,24 @@ function printGrantRows(report, log) {
69
71
  : 'No workspace Grants observed.');
70
72
  return;
71
73
  }
74
+ // The columns `skrr grants list` shows come from the same function, so a
75
+ // header means the same thing in both tables (OSK-15357); the workspace view
76
+ // adds who owns the Grant, its capabilities, its expiry and what uses it.
72
77
  (0, format_1.renderTable)(report.grants.map((row) => ({
73
- id: row.id,
74
- label: row.label,
75
- provider: row.provider || '—',
76
- principal: principalText(row.principal),
77
- access: accessText(row.capabilities),
78
- owner: row.ownerUserId,
79
- active: row.active ? 'yes' : 'no',
78
+ ...(0, grants_1.grantTableCells)(row),
79
+ owner: ownerText(row.ownerUserId, members),
80
+ capabilities: capabilitiesText(row.capabilities),
80
81
  // No expiry is a fact about the Grant; a blank cell read as "not readable" (OSK-15357).
81
82
  expires: row.expiresAt ?? 'never',
82
- envKeys: row.credential?.envKeys.length ? row.credential.envKeys.join(', ') : '—',
83
83
  referencedBy: row.referencedBy === null
84
84
  ? 'unavailable'
85
- : `${row.referencedBy.join(', ')}${row.referencesTruncated ? ' (truncated)' : ''}`,
85
+ : `${row.referencedBy.join(', ') || '—'}${row.referencesTruncated ? ' (truncated)' : ''}`,
86
86
  })), [
87
- { key: 'id', header: 'ID' },
88
- { key: 'label', header: 'LABEL' },
89
- { key: 'provider', header: 'PROVIDER' },
90
- { key: 'principal', header: 'HELD BY' },
91
- { key: 'access', header: 'ACCESS' },
87
+ { key: 'id', header: 'ID', verbatim: true },
88
+ ...grants_1.GRANT_TABLE_COLUMNS,
92
89
  { key: 'owner', header: 'OWNER' },
93
- { key: 'active', header: 'ACTIVE' },
90
+ { key: 'capabilities', header: 'CAPABILITIES' },
94
91
  { key: 'expires', header: 'EXPIRES' },
95
- { key: 'envKeys', header: 'ENV NAMES' },
96
92
  { key: 'referencedBy', header: 'REFERENCED BY' },
97
93
  ], log);
98
94
  }
@@ -101,7 +97,7 @@ function printWorkspaceStewardship(report, log) {
101
97
  log(`Membership: ${report.membership.status}${report.membership.role ? ` (${report.membership.role})` : ''}${
102
98
  // "Absent" is all the report knows: a removed member and an id that never existed read alike (OSK-15356).
103
99
  report.membership.status === 'absent'
104
- ? ' — not a current member; this report cannot tell a removed member from an id that never existed'
100
+ ? ' — not a current member; this report cannot tell a removed member from an id that never existed (`skrr workspaces members <workspace-id>` lists current members)'
105
101
  : ''}`);
106
102
  const isCut = (source) => report.coverage.sources.some((entry) => entry.name === source && entry.truncated);
107
103
  const count = (rows, source) => rows === null
@@ -26,6 +26,12 @@ export declare function batchIdempotencyKey(kind: 'create' | 'patch', items: unk
26
26
  export type BatchCreateNode = {
27
27
  key: string;
28
28
  parentKey?: string;
29
+ /**
30
+ * Keys of other nodes that block this one. Each blocker must come BEFORE this
31
+ * node in the list; the batch resolves them to real ids on the server (same
32
+ * chunk) or from `mapping` (an earlier chunk, or a task that already existed).
33
+ */
34
+ blockerKeys?: string[];
29
35
  payload: Record<string, unknown>;
30
36
  };
31
37
  export type BatchCreatedRow = {
@@ -56,13 +62,64 @@ export type BatchCreateOutcome = {
56
62
  supported: true;
57
63
  rows: BatchCreatedRow[];
58
64
  failures: BatchCreateFailure[];
65
+ /** Requests made to the batch route, retries included. */
66
+ rounds: number;
67
+ };
68
+ /** What a long create reports between requests (the command decides whether anyone sees it). */
69
+ export type BatchProgress = {
70
+ /** Nodes confirmed to exist so far, created now or found already there. */
71
+ confirmed: number;
72
+ total: number;
73
+ round: number;
74
+ elapsedMs: number;
75
+ /** Set while waiting before the next attempt, with why. */
76
+ waiting?: {
77
+ ms: number;
78
+ reason: string;
79
+ };
80
+ };
81
+ export type BatchCreateOptions = {
82
+ onProgress?: (progress: BatchProgress) => void;
83
+ };
84
+ /**
85
+ * How a create that is not finishing is retried. A seam rather than constants so
86
+ * a test can run the whole policy without waiting through it.
87
+ *
88
+ * Each round that confirms nothing waits the next interval and counts toward the
89
+ * limit; a round that confirms anything resets it. The total wait is bounded
90
+ * (about 15 s), on purpose: this is a courtesy to a server that is briefly slow
91
+ * or rate-limited, not a promise to outlast an outage — past it the command says
92
+ * what is unknown and how to continue.
93
+ */
94
+ export declare const batchRetryPolicy: {
95
+ backoffMs: number[];
96
+ sleep: (ms: number) => Promise<void>;
59
97
  };
60
98
  /**
61
- * Create `nodes` (parents before children) in chunks. `mapping` holds key -> id
62
- * for nodes that already exist and is extended in place. Stops after the first
63
- * chunk that reports a failure, as the serial path stopped at its first failure.
99
+ * Create `nodes` — parents and blockers BEFORE what depends on them — until every
100
+ * one exists, or say precisely which do not and why.
101
+ *
102
+ * One request is a bounded unit of work, not the whole job: the server answers
103
+ * within a response budget, creating what it can and reporting the rest as not
104
+ * started (`BATCH_DEADLINE_EXCEEDED`) or still in flight (`pending`). That is a
105
+ * normal, successful answer, so this loop is what turns it into a finished tree:
106
+ * submit, record what is confirmed, submit what is left. It used to stop at the
107
+ * first row the server had not confirmed and hand the person a `--resume` to
108
+ * type — once per row or two, against a server that confirms a row or two per
109
+ * request (OSK-S-440 #1, #3, #4).
110
+ *
111
+ * The one rule that makes resubmitting safe is the one the server enforces: a
112
+ * node with a stable `externalKey` can be created once. A submitted write whose
113
+ * outcome is unknown is therefore READ first (`reconcileSubmittedNodes`), and only
114
+ * if the key is still absent is the node sent again — where, if the first write
115
+ * has landed in the meantime, the unique index turns it into `exists`. A node with
116
+ * no stable key is never resubmitted after an uncertain outcome, because nothing
117
+ * could tell the second write from a duplicate; that case stops and says so, as
118
+ * before.
119
+ *
120
+ * `mapping` holds key -> id for nodes that already exist and is extended in place.
64
121
  */
65
- export declare function createNodesViaBatch(nodes: BatchCreateNode[], mapping: Record<string, string>): Promise<BatchCreateOutcome>;
122
+ export declare function createNodesViaBatch(nodes: BatchCreateNode[], mapping: Record<string, string>, options?: BatchCreateOptions): Promise<BatchCreateOutcome>;
66
123
  export type BatchPatchOutcome = {
67
124
  supported: false;
68
125
  } | {