@krapht/ork 1.0.0-alpha.12 → 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.
- package/dist/{__build_info__-BJbE3Zvp.mjs → __build_info__-B82-dGJY.mjs} +3 -3
- package/dist/{attach-BmV5ckb9.mjs → attach-CdtGX9se.mjs} +5 -5
- package/dist/bin.mjs +274 -236
- package/dist/{builtin-files-w0YULJ4c.mjs → builtin-files-Bdq23IIi.mjs} +2 -2
- package/dist/{chips-CyeB_rhR.mjs → chips-BqcT58qr.mjs} +1 -1
- package/dist/{completion-CzElB8nS.mjs → completion--ywde-56.mjs} +52 -11
- package/dist/{context-BAwgVSX5.mjs → context-Y_I4Mofq.mjs} +18 -8
- package/dist/{find-p05wlbmu.mjs → find-BVX-bL4u.mjs} +1 -1
- package/dist/{format-Dni98cbh.mjs → format-CvTE5CZQ.mjs} +12 -12
- package/dist/{help-groups-DYP_zMRP.mjs → help-groups-CpR2UzSn.mjs} +20 -6
- package/dist/{in-a-run-BI-hLIl_.mjs → in-a-run-cL5N9gpH.mjs} +1 -1
- package/dist/{limits-CElmhowV.mjs → limits-Dhe--wmX.mjs} +2 -2
- package/dist/{mcp-CM3b65AZ.mjs → mcp-CsmboyXv.mjs} +6 -6
- package/dist/once-CrwI-ZdN.mjs +76 -0
- package/dist/{output-CnRzrbUM.mjs → output-B1kwo0YU.mjs} +17 -1
- package/dist/{pause-BuS83WAI.mjs → pause-DssrYcda.mjs} +4 -4
- package/dist/{relay-DAsJA8wF.mjs → relay-DASRgsTQ.mjs} +2 -2
- package/dist/run-D8divGCs.mjs +192 -0
- package/dist/send-CXv8bx0i.mjs +105 -0
- package/dist/{src-S9yK2OHU.mjs → src-8Mul0695.mjs} +8 -10
- package/dist/{src-BfxkJOYm.mjs → src-C7z_6fhn.mjs} +200 -72
- package/dist/{src-D1QedD5y.mjs → src-njdtejgZ.mjs} +140 -38
- package/dist/{src-CdDTQLdQ.mjs → src-tsuZRu0H.mjs} +2787 -1134
- package/dist/{store-B2OaE4ID.mjs → store-CleF7KeS.mjs} +33 -76
- package/dist/ui/THIRD_PARTY_LICENSES.txt +18 -0
- package/dist/ui/assets/app-D_nAPnHM.css +1 -0
- package/dist/ui/assets/app-DqBAtXSZ.js +111 -0
- package/dist/ui/assets/{index-BL7Ad0OA.js → index-D-_uPI2v.js} +2 -2
- package/dist/ui/index.html +1 -1
- package/dist/{ui-C4Ys26oO.mjs → ui-CNO1M0qT.mjs} +4 -4
- package/dist/{usage-C2zx-X6q.mjs → usage-BVXi0iFY.mjs} +13 -141
- package/dist/{verdict-CIy8tAyX.mjs → verdict-CMvPCpWC.mjs} +2 -2
- package/dist/{watch-DzCeqM05.mjs → watch-DVNIciHp.mjs} +10 -8
- package/dist/{workflows-Rr5w90A0.mjs → workflows-B30QkwTk.mjs} +3 -3
- package/dist/{worktrees-f6SAbum5.mjs → worktrees-DD4_TpkH.mjs} +3 -5
- package/package.json +2 -2
- package/dist/clean-D8GI_2K-.mjs +0 -91
- package/dist/decide-DlbyctOE.mjs +0 -50
- package/dist/list-zW2xKuGr.mjs +0 -117
- package/dist/remove-Dh7D_hVn.mjs +0 -201
- package/dist/report-CEN8VoUb.mjs +0 -140
- package/dist/send-MFEQZH31.mjs +0 -163
- package/dist/ui/assets/app-CAoZtku5.js +0 -75
- package/dist/ui/assets/app-QoHVi-mb.css +0 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { $
|
|
2
|
-
import { n as
|
|
3
|
-
import {
|
|
4
|
-
import { n as
|
|
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;
|
|
@@ -696,8 +635,9 @@ const parked = (signal) => new Promise((_, reject) => {
|
|
|
696
635
|
});
|
|
697
636
|
/**
|
|
698
637
|
* Answers permission prompts and `ask_user` questions on the terminal, one at a
|
|
699
|
-
* time. Without a terminal it denies tools and leaves questions to the node
|
|
700
|
-
*
|
|
638
|
+
* time. Without a terminal it denies tools and leaves questions to the node,
|
|
639
|
+
* but a gate's question (`waits`) waits for `ork decide` or the UI. A withdrawn
|
|
640
|
+
* prompt (answered elsewhere) rejects, which frees the turn.
|
|
701
641
|
*/
|
|
702
642
|
const createTerminalHuman = (io) => {
|
|
703
643
|
let rl;
|
|
@@ -743,12 +683,17 @@ const createTerminalHuman = (io) => {
|
|
|
743
683
|
if (noted.kind === "interrupted") await parked(signal);
|
|
744
684
|
if (noted.kind === "text" && noted.value !== "") onNote(noted.value);
|
|
745
685
|
};
|
|
686
|
+
/** Says where a waiting question is answered, and waits until withdrawn. */
|
|
687
|
+
const waitElsewhere = (q) => {
|
|
688
|
+
say(paint(term(), "muted", ` no terminal; ${plain(q.nodeId)} waits for ork decide or ork ui`));
|
|
689
|
+
return parked(q.signal);
|
|
690
|
+
};
|
|
746
691
|
const oneAtATime = (work) => {
|
|
747
692
|
const result = turn.then(work);
|
|
748
693
|
turn = result.catch(() => null);
|
|
749
694
|
return result;
|
|
750
695
|
};
|
|
751
|
-
const asking = (q, place) => oneAtATime(async () => {
|
|
696
|
+
const asking = (q, place) => !io.interactive && q.waits === true ? waitElsewhere(q) : oneAtATime(async () => {
|
|
752
697
|
const { signal } = q;
|
|
753
698
|
if (signal?.aborted === true) throw new Error("the question was withdrawn");
|
|
754
699
|
const t = term();
|
|
@@ -863,6 +808,21 @@ const formatFinished = (event, tag, verbose, term = createView().term, rest = ta
|
|
|
863
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}`];
|
|
864
809
|
return [`${tag} ${mark} ${endHeadline(end)}${spent}`, ...endLines(end, verbose, term).map((line) => `${rest} ${line}`)];
|
|
865
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
|
+
};
|
|
866
826
|
// src/run/format-outcome.ts
|
|
867
827
|
/**
|
|
868
828
|
* @file How a finished session reads on the terminal: its report or its end,
|
|
@@ -966,7 +926,7 @@ const formatRunResult = (result, term = createView().term) => {
|
|
|
966
926
|
const ran = result.nodes.filter((n) => n.runs > 0).length;
|
|
967
927
|
const skipped = result.skipped ?? result.nodes.length - ran;
|
|
968
928
|
const handled = result.failuresHandled ?? 0;
|
|
969
|
-
const lines = ["", `${mark} run ${result.runId} ${result.status.replace("_", " ")} ${style("dim", `· ${
|
|
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)}`}`)}`];
|
|
970
930
|
for (const kept of result.worktrees) lines.push(` ${kept.id}: ${kept.branch ?? "detached"} ${style("dim", `at ${kept.path} (${kept.reason})`)}`);
|
|
971
931
|
for (const reason of result.reasons) lines.push(` ${style("red", reason)}`);
|
|
972
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`);
|
|
@@ -1019,11 +979,6 @@ const toolLines = (name, input, view, room, verbose, node) => {
|
|
|
1019
979
|
return [`${styledHead}${style("dim", cut(first.trim(), Math.max(1, room - headWidth - more.length)))}${style("dim", more)}`];
|
|
1020
980
|
};
|
|
1021
981
|
// src/run/format.ts
|
|
1022
|
-
/**
|
|
1023
|
-
* @file How runs read on the terminal: session events and run events with node
|
|
1024
|
-
* chips or prefixes; the node result is `format-outcome.ts`'s, a tool call
|
|
1025
|
-
* `format-tool.ts`'s and the run summary `format-result.ts`'s.
|
|
1026
|
-
*/
|
|
1027
982
|
/** A line's 2-column indent, after any style codes that open it. */
|
|
1028
983
|
const INDENT = /^((?:\u001B\[[0-9;]*m)*) {2}/u;
|
|
1029
984
|
/** Who answered a decision, as the log says it. */
|
|
@@ -1052,6 +1007,8 @@ const formatEvent = (nodeId, event, tools, verbose = false, view = createView(),
|
|
|
1052
1007
|
return formatOutcome(nodeId, event.outcome, verbose, term);
|
|
1053
1008
|
};
|
|
1054
1009
|
const items = (count) => `${String(count)} ${count === 1 ? "item" : "items"}`;
|
|
1010
|
+
/** A `once: true` check that did not run, and the pass it stands on. */
|
|
1011
|
+
const skippedLine = ({ check, at, who }) => `${check}: already passed on these files · ${at} · ${who}`;
|
|
1055
1012
|
/** Transcript lines for one run event, prefixed with the node they are from. */
|
|
1056
1013
|
const formatRunEvent = (event, width, tools, terminal = false, verbose = false, view = createView()) => {
|
|
1057
1014
|
const { term } = view;
|
|
@@ -1118,8 +1075,8 @@ const formatRunEvent = (event, width, tools, terminal = false, verbose = false,
|
|
|
1118
1075
|
return [`${tag(event.id)} ${style("yellow", `‖ paused: ${at}`)}`];
|
|
1119
1076
|
}
|
|
1120
1077
|
if (event.type === "node.released") return [`${tag(event.id)} ${style("dim", "▸ continues")}`];
|
|
1121
|
-
if (event
|
|
1122
|
-
if (event.type === "
|
|
1078
|
+
if (isMachineEvent(event)) return [`${tag(event.id)} ${machineLine(event, style)}`];
|
|
1079
|
+
if (event.type === "verify.skipped") return [`${tag(event.id)} ${style("dim", `✓ ${skippedLine(event)}`)}`];
|
|
1123
1080
|
if (event.type === "each.listed") {
|
|
1124
1081
|
const round = event.round > 1 ? ` (round ${String(event.round)})` : "";
|
|
1125
1082
|
return [`${tag(event.node)} ${style("dim", `${items(event.count)}${round}`)}`];
|
|
@@ -1200,6 +1200,24 @@ SOFTWARE.
|
|
|
1200
1200
|
|
|
1201
1201
|
------------------------------------------------------------------------
|
|
1202
1202
|
|
|
1203
|
+
yaml 2.9.1 (ISC)
|
|
1204
|
+
|
|
1205
|
+
Copyright Eemeli Aro <eemeli@gmail.com>
|
|
1206
|
+
|
|
1207
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose
|
|
1208
|
+
with or without fee is hereby granted, provided that the above copyright notice
|
|
1209
|
+
and this permission notice appear in all copies.
|
|
1210
|
+
|
|
1211
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
1212
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
1213
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
1214
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
1215
|
+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
1216
|
+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|
1217
|
+
THIS SOFTWARE.
|
|
1218
|
+
|
|
1219
|
+
------------------------------------------------------------------------
|
|
1220
|
+
|
|
1203
1221
|
zod 4.6.7 (MIT)
|
|
1204
1222
|
|
|
1205
1223
|
MIT License
|