@krapht/ork 1.0.0-alpha.13 → 1.0.0-alpha.14

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 (42) hide show
  1. package/dist/{__build_info__-Da73_nBs.mjs → __build_info__-B82-dGJY.mjs} +2 -2
  2. package/dist/{attach-E6NNyA3T.mjs → attach-CdtGX9se.mjs} +5 -5
  3. package/dist/bin.mjs +194 -215
  4. package/dist/{builtin-files-n6o6oWpB.mjs → builtin-files-Bdq23IIi.mjs} +1 -1
  5. package/dist/{chips-CyeB_rhR.mjs → chips-BqcT58qr.mjs} +1 -1
  6. package/dist/{completion-SNNNxnv9.mjs → completion--ywde-56.mjs} +52 -11
  7. package/dist/{context-DHudLA5e.mjs → context-Y_I4Mofq.mjs} +17 -7
  8. package/dist/{find-CjsNYAAf.mjs → find-BVX-bL4u.mjs} +1 -1
  9. package/dist/{format-C60TFpRe.mjs → format-CvTE5CZQ.mjs} +12 -12
  10. package/dist/{help-groups-CyfPWlST.mjs → help-groups-CpR2UzSn.mjs} +16 -6
  11. package/dist/{in-a-run-BYjTXaST.mjs → in-a-run-cL5N9gpH.mjs} +1 -1
  12. package/dist/{limits-C5QKZNLT.mjs → limits-Dhe--wmX.mjs} +1 -1
  13. package/dist/{mcp-bcctR-wc.mjs → mcp-CsmboyXv.mjs} +6 -6
  14. package/dist/{once-DPQu5Q3H.mjs → once-CrwI-ZdN.mjs} +4 -4
  15. package/dist/{output-CnRzrbUM.mjs → output-B1kwo0YU.mjs} +17 -1
  16. package/dist/{pause-BPvlDIvz.mjs → pause-DssrYcda.mjs} +4 -4
  17. package/dist/{relay-C8W0t_zc.mjs → relay-DASRgsTQ.mjs} +2 -2
  18. package/dist/{run-CQIfq918.mjs → run-D8divGCs.mjs} +1 -1
  19. package/dist/send-CXv8bx0i.mjs +105 -0
  20. package/dist/{src-CGJGL1sZ.mjs → src-8Mul0695.mjs} +8 -10
  21. package/dist/{src-D93tHZ5B.mjs → src-C7z_6fhn.mjs} +92 -39
  22. package/dist/{src-CqRqsb2t.mjs → src-njdtejgZ.mjs} +98 -33
  23. package/dist/{src-BeR6f70A.mjs → src-tsuZRu0H.mjs} +2353 -918
  24. package/dist/{store-CM3cERGl.mjs → store-CleF7KeS.mjs} +21 -73
  25. package/dist/ui/assets/app-D_nAPnHM.css +1 -0
  26. package/dist/ui/assets/{app-DYRC0V4p.js → app-DqBAtXSZ.js} +19 -19
  27. package/dist/ui/assets/{index-CWwm8HTG.js → index-D-_uPI2v.js} +2 -2
  28. package/dist/ui/index.html +1 -1
  29. package/dist/{ui-D2Ydofq0.mjs → ui-CNO1M0qT.mjs} +4 -4
  30. package/dist/{usage-6WIowblz.mjs → usage-BVXi0iFY.mjs} +13 -141
  31. package/dist/{verdict-CIy8tAyX.mjs → verdict-CMvPCpWC.mjs} +2 -2
  32. package/dist/{watch-uOU_WeBI.mjs → watch-DVNIciHp.mjs} +10 -8
  33. package/dist/{workflows-7tQdMnrA.mjs → workflows-B30QkwTk.mjs} +3 -3
  34. package/dist/{worktrees-ZCII298F.mjs → worktrees-DD4_TpkH.mjs} +3 -5
  35. package/package.json +2 -2
  36. package/dist/clean-Bh4KZgzc.mjs +0 -91
  37. package/dist/decide-DuIHACvH.mjs +0 -50
  38. package/dist/list-BUb5Uc3H.mjs +0 -117
  39. package/dist/remove-BkFWGVYo.mjs +0 -201
  40. package/dist/report-CEN8VoUb.mjs +0 -140
  41. package/dist/send-CaZlGG5a.mjs +0 -163
  42. package/dist/ui/assets/app-QoHVi-mb.css +0 -1
@@ -1,8 +1,7 @@
1
- import { $ as followEvents, C as isNodeEvent, Ft as slotWaitLine, On as maskSecrets, _t as liveStatus, in as END_KINDS, nn as outcomeEnd, tn as endOf, w as openStore } from "./src-BeR6f70A.mjs";
2
- import { n as pendingDecisions, t as answerDecision } from "./decide-DuIHACvH.mjs";
3
- import { E as readKeys, S as cut, T as wrap, _ as withdrawn, a as style, c as confirmOrStop, d as apply, f as bold, g as readLine, h as interrupt, i as plain, m as createRegion, n as cost, p as paint, v as canKey, w as widthOf, x as termOf, y as plainEnv } from "./output-CnRzrbUM.mjs";
4
- import { n as chip, r as nodeChip, t as CHIP_LABELS } from "./chips-CyeB_rhR.mjs";
5
- import { a as createView, i as formatBusEvent, n as nodeVerdict, o as styler, r as firstLine, t as hasConflict } from "./verdict-CIy8tAyX.mjs";
1
+ import { $n as maskSecrets, An as END_KINDS, Dn as endOf, H as isNodeEvent, On as outcomeEnd, Tt as followEvents, U as openStore, cn as slotWaitLine, ct as followRunTree, lt as answerDecision, nn as lockWaitLine, ut as pendingDecisions } from "./src-tsuZRu0H.mjs";
2
+ import { C as termOf, D as wrap, E as widthOf, O as readKeys, _ as interrupt, a as plain, b as canKey, g as createRegion, h as paint, m as bold, n as cost, p as apply, r as costOf, s as style, u as confirmOrStop, v as readLine, w as cut, x as plainEnv, y as withdrawn } from "./output-B1kwo0YU.mjs";
3
+ import { n as chip, r as nodeChip, t as CHIP_LABELS } from "./chips-BqcT58qr.mjs";
4
+ import { a as createView, i as formatBusEvent, n as nodeVerdict, o as styler, r as firstLine, t as hasConflict } from "./verdict-CMvPCpWC.mjs";
6
5
  import { createInterface } from "node:readline/promises";
7
6
  // ../core/src/control/queue.ts
8
7
  const PERMISSION_OPTIONS = [{
@@ -219,66 +218,6 @@ const createDecisionQueue = (options) => {
219
218
  }
220
219
  };
221
220
  };
222
- // ../core/src/remote/follow-tree.ts
223
- /**
224
- * Calls `onEvent` for each event of `root` and of the runs it called, once
225
- * each. A called run's stored events come right after the `call.started` that
226
- * started it; live events as they arrive. Ends when the root ends or `signal`
227
- * aborts.
228
- */
229
- const followRunTree = async (store, root, onEvent, options = {}) => {
230
- /** Every run followed, with its call path, in the order found. */
231
- const paths = /* @__PURE__ */ new Map([[root, []]]);
232
- /** Each run's last event seen, for the catch-up once the root ends. */
233
- const seqs = /* @__PURE__ */ new Map();
234
- const followers = [];
235
- /** Ends the called runs' following once the root's has ended. */
236
- const halt = new AbortController();
237
- const signal = options.signal === void 0 ? halt.signal : AbortSignal.any([options.signal, halt.signal]);
238
- const handle = (run, path) => (stored) => {
239
- seqs.set(run, stored.seq);
240
- onEvent({
241
- run,
242
- path,
243
- stored
244
- });
245
- const { event } = stored;
246
- if (event.type === "call.started" && !paths.has(event.run)) follow(event.run, [...path, event.node]);
247
- };
248
- const follow = (run, path) => {
249
- paths.set(run, path);
250
- followers.push(followEvents(store, run, handle(run, path), {
251
- ...options,
252
- follow: true,
253
- after: seqs.get(run) ?? 0,
254
- signal
255
- }));
256
- };
257
- /** Waits for every follower, including those started while waiting. */
258
- const settle = async () => {
259
- while (followers.length > 0) await Promise.all(followers.splice(0));
260
- };
261
- const end = await followEvents(store, root, handle(root, []), {
262
- ...options,
263
- follow: true
264
- });
265
- halt.abort();
266
- await settle();
267
- if (end !== "aborted") {
268
- for (const [run, path] of [...paths].slice(1)) followers.push(followEvents(store, run, handle(run, path), {
269
- follow: false,
270
- after: seqs.get(run) ?? 0
271
- }));
272
- await settle();
273
- }
274
- return {
275
- end,
276
- stillRunning: [...paths.keys()].slice(1).filter((id) => {
277
- const [run] = store.lookup(id);
278
- return run !== void 0 && liveStatus(run) === "running";
279
- })
280
- };
281
- };
282
221
  // src/human-card.ts
283
222
  /** Lines of context a card shows before `d` (or `--verbose`) shows the rest. */
284
223
  const CONTEXT_LINES = 6;
@@ -869,6 +808,21 @@ const formatFinished = (event, tag, verbose, term = createView().term, rest = ta
869
808
  if (!(!event.ok && end.kind !== "reported_failure" && (event.end !== void 0 || end.kind !== "unknown"))) return [`${tag} ${mark} ${nodeVerdict(event.output, event.ok, event.error)}${spent}`];
870
809
  return [`${tag} ${mark} ${endHeadline(end)}${spent}`, ...endLines(end, verbose, term).map((line) => `${rest} ${line}`)];
871
810
  };
811
+ // src/run/format-machine.ts
812
+ /**
813
+ * @file How a node's waits for the machine read in `ork logs`: a slot for a
814
+ * heavy command (ADR-080) and a lock (RFC-016), each naming who holds it.
815
+ */
816
+ /** Whether `event` is a slot's or a lock's. */
817
+ const isMachineEvent = (event) => event.type.startsWith("slot.") || event.type.startsWith("lock.");
818
+ /** A slot or lock event's line, after its node's tag. */
819
+ const machineLine = (event, style) => {
820
+ if (event.type === "slot.waiting") return style("yellow", `‖ ${slotWaitLine(event.holders)}`);
821
+ if (event.type === "slot.taken") return style("dim", "▸ got a check slot");
822
+ if (event.type === "lock.waiting") return style("yellow", `‖ ${lockWaitLine(event.lock, event.holders)}`);
823
+ if (event.type === "lock.taken") return style("dim", `▸ holds ${event.lock}`);
824
+ return style("dim", `▸ let ${event.lock} go`);
825
+ };
872
826
  // src/run/format-outcome.ts
873
827
  /**
874
828
  * @file How a finished session reads on the terminal: its report or its end,
@@ -972,7 +926,7 @@ const formatRunResult = (result, term = createView().term) => {
972
926
  const ran = result.nodes.filter((n) => n.runs > 0).length;
973
927
  const skipped = result.skipped ?? result.nodes.length - ran;
974
928
  const handled = result.failuresHandled ?? 0;
975
- const lines = ["", `${mark} run ${result.runId} ${result.status.replace("_", " ")} ${style("dim", `· ${cost(result.costUsd)} · ${String(ran)} ran, ${String(skipped)} skipped${handled === 0 ? "" : `, ${failuresHandled(handled)}`}`)}`];
929
+ const lines = ["", `${mark} run ${result.runId} ${result.status.replace("_", " ")} ${style("dim", `· ${costOf(result.costUsd, result.partial, result.tokens)} · ${String(ran)} ran, ${String(skipped)} skipped${handled === 0 ? "" : `, ${failuresHandled(handled)}`}`)}`];
976
930
  for (const kept of result.worktrees) lines.push(` ${kept.id}: ${kept.branch ?? "detached"} ${style("dim", `at ${kept.path} (${kept.reason})`)}`);
977
931
  for (const reason of result.reasons) lines.push(` ${style("red", reason)}`);
978
932
  for (const { node, messages } of result.unread ?? []) lines.push(` ${style(["yellow", "bold"], "warning")} ${node} never ran, so ${messages === 1 ? "1 message" : `${String(messages)} messages`} to it went unread`);
@@ -1025,11 +979,6 @@ const toolLines = (name, input, view, room, verbose, node) => {
1025
979
  return [`${styledHead}${style("dim", cut(first.trim(), Math.max(1, room - headWidth - more.length)))}${style("dim", more)}`];
1026
980
  };
1027
981
  // src/run/format.ts
1028
- /**
1029
- * @file How runs read on the terminal: session events and run events with node
1030
- * chips or prefixes; the node result is `format-outcome.ts`'s, a tool call
1031
- * `format-tool.ts`'s and the run summary `format-result.ts`'s.
1032
- */
1033
982
  /** A line's 2-column indent, after any style codes that open it. */
1034
983
  const INDENT = /^((?:\u001B\[[0-9;]*m)*) {2}/u;
1035
984
  /** Who answered a decision, as the log says it. */
@@ -1126,8 +1075,7 @@ const formatRunEvent = (event, width, tools, terminal = false, verbose = false,
1126
1075
  return [`${tag(event.id)} ${style("yellow", `‖ paused: ${at}`)}`];
1127
1076
  }
1128
1077
  if (event.type === "node.released") return [`${tag(event.id)} ${style("dim", "▸ continues")}`];
1129
- if (event.type === "slot.waiting") return [`${tag(event.id)} ${style("yellow", `‖ ${slotWaitLine(event.holders)}`)}`];
1130
- if (event.type === "slot.taken") return [`${tag(event.id)} ${style("dim", "▸ got a check slot")}`];
1078
+ if (isMachineEvent(event)) return [`${tag(event.id)} ${machineLine(event, style)}`];
1131
1079
  if (event.type === "verify.skipped") return [`${tag(event.id)} ${style("dim", `✓ ${skippedLine(event)}`)}`];
1132
1080
  if (event.type === "each.listed") {
1133
1081
  const round = event.round > 1 ? ` (round ${String(event.round)})` : "";