@krapht/ork 1.0.0-alpha.11 → 1.0.0-alpha.12

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 (36) hide show
  1. package/dist/{__build_info__-CIchF6nr.mjs → __build_info__-BJbE3Zvp.mjs} +3 -2
  2. package/dist/attach-BmV5ckb9.mjs +89 -0
  3. package/dist/bin.mjs +132 -1208
  4. package/dist/{decide-B6PnKeqo.mjs → builtin-files-w0YULJ4c.mjs} +2 -50
  5. package/dist/{chips-BA7SrrH5.mjs → chips-CyeB_rhR.mjs} +1 -1
  6. package/dist/{clean-Di-KT7Mf.mjs → clean-D8GI_2K-.mjs} +1 -1
  7. package/dist/{completion-C5D0sEs5.mjs → completion-CzElB8nS.mjs} +7 -6
  8. package/dist/{context-BaNshWr9.mjs → context-BAwgVSX5.mjs} +5 -5
  9. package/dist/decide-DlbyctOE.mjs +50 -0
  10. package/dist/{find-BicBbGMg.mjs → find-p05wlbmu.mjs} +1 -1
  11. package/dist/{format-lWhN-jYR.mjs → format-Dni98cbh.mjs} +5 -85
  12. package/dist/{help-groups-BwYoAWsh.mjs → help-groups-DYP_zMRP.mjs} +4 -0
  13. package/dist/{in-a-run-CgkVouyG.mjs → in-a-run-BI-hLIl_.mjs} +4 -2
  14. package/dist/{limits-jZQp9ZJC.mjs → limits-CElmhowV.mjs} +1 -1
  15. package/dist/{list-CEaJ07jd.mjs → list-zW2xKuGr.mjs} +1 -1
  16. package/dist/{mcp-DYgVA9f5.mjs → mcp-CM3b65AZ.mjs} +6 -6
  17. package/dist/{output-CM95njYt.mjs → output-CnRzrbUM.mjs} +3 -1
  18. package/dist/{pause-D6PuSlNl.mjs → pause-BuS83WAI.mjs} +4 -4
  19. package/dist/{relay-DNx7be9k.mjs → relay-DAsJA8wF.mjs} +2 -2
  20. package/dist/{remove-CpMb4NDl.mjs → remove-Dh7D_hVn.mjs} +3 -3
  21. package/dist/{send-CLs_fyg7.mjs → send-MFEQZH31.mjs} +3 -3
  22. package/dist/{src-9iGkjnsy.mjs → src-BfxkJOYm.mjs} +1 -1
  23. package/dist/{src-D6_xjm-x.mjs → src-CdDTQLdQ.mjs} +173 -24
  24. package/dist/{src-BnZgZGrf.mjs → src-D1QedD5y.mjs} +1 -1
  25. package/dist/{src-B6KvTm7B.mjs → src-S9yK2OHU.mjs} +7 -6
  26. package/dist/store-B2OaE4ID.mjs +1356 -0
  27. package/dist/ui/assets/{app-CxURph7a.js → app-CAoZtku5.js} +1 -1
  28. package/dist/ui/assets/{index-By_8KKG6.js → index-BL7Ad0OA.js} +2 -2
  29. package/dist/ui/index.html +1 -1
  30. package/dist/{ui-CIci4UBW.mjs → ui-C4Ys26oO.mjs} +4 -4
  31. package/dist/{usage-GceBGMjU.mjs → usage-C2zx-X6q.mjs} +6 -6
  32. package/dist/verdict-CIy8tAyX.mjs +84 -0
  33. package/dist/{watch-BmoybMQg.mjs → watch-DzCeqM05.mjs} +7 -7
  34. package/dist/{workflows-DZvW3i1e.mjs → workflows-Rr5w90A0.mjs} +3 -3
  35. package/dist/{worktrees-Be51E2rB.mjs → worktrees-f6SAbum5.mjs} +5 -5
  36. package/package.json +1 -1
@@ -19,7 +19,7 @@
19
19
  href="/favicon.svg"
20
20
  type="image/svg+xml"
21
21
  />
22
- <script type="module" crossorigin src="/assets/index-By_8KKG6.js"></script>
22
+ <script type="module" crossorigin src="/assets/index-BL7Ad0OA.js"></script>
23
23
  <link rel="modulepreload" crossorigin href="/assets/theme-CdXvqTQ6.js">
24
24
  <link rel="stylesheet" crossorigin href="/assets/index-BPIbqRRb.css">
25
25
  </head>
@@ -1,7 +1,7 @@
1
- import { n as ORK_VERSION, t as ORK_NAME } from "./__build_info__-CIchF6nr.mjs";
2
- import { a as write, i as style, o as writeErr } from "./output-CM95njYt.mjs";
3
- import { a as mayShowSignIn } from "./in-a-run-CgkVouyG.mjs";
4
- import { i as uiFilePath, l as newToken, n as startServer, r as runningServer, t as DEFAULT_PORT } from "./src-B6KvTm7B.mjs";
1
+ import { n as ORK_VERSION, t as ORK_NAME } from "./__build_info__-BJbE3Zvp.mjs";
2
+ import { a as style, o as write, s as writeErr } from "./output-CnRzrbUM.mjs";
3
+ import { o as mayShowSignIn } from "./in-a-run-BI-hLIl_.mjs";
4
+ import { i as uiFilePath, l as newToken, n as startServer, r as runningServer, t as DEFAULT_PORT } from "./src-S9yK2OHU.mjs";
5
5
  import path from "node:path";
6
6
  import { constants } from "node:os";
7
7
  import { spawn } from "node:child_process";
@@ -1,10 +1,10 @@
1
- import { C as openStore, Un as runDirOf, Vn as placeFor, ot as usd, xt as liveStatus } from "./src-D6_xjm-x.mjs";
2
- import { n as listOrkWorktrees, t as createdWorktrees } from "./list-CEaJ07jd.mjs";
1
+ import { C as openStore, Un as runDirOf, Vn as placeFor, ot as usd, xt as liveStatus } from "./src-CdDTQLdQ.mjs";
2
+ import { n as listOrkWorktrees, t as createdWorktrees } from "./list-zW2xKuGr.mjs";
3
3
  import { n as usageReport, t as USAGE_DIMENSIONS } from "./report-CEN8VoUb.mjs";
4
- import { a as write, b as termOf, i as style, n as cost, o as writeErr, t as confirm } from "./output-CM95njYt.mjs";
5
- import { n as chip, t as CHIP_LABELS } from "./chips-BA7SrrH5.mjs";
6
- import { a as header, o as table } from "./format-lWhN-jYR.mjs";
7
- import { n as limitsHere } from "./limits-jZQp9ZJC.mjs";
4
+ import { a as style, n as cost, o as write, s as writeErr, t as confirm, x as termOf } from "./output-CnRzrbUM.mjs";
5
+ import { n as chip, t as CHIP_LABELS } from "./chips-CyeB_rhR.mjs";
6
+ import { n as limitsHere } from "./limits-CElmhowV.mjs";
7
+ import { a as header, o as table } from "./format-Dni98cbh.mjs";
8
8
  import { existsSync, rmSync } from "node:fs";
9
9
  import { defineCommand } from "citty";
10
10
  // ../core/src/store/prune.ts
@@ -0,0 +1,84 @@
1
+ import { d as apply, x as termOf } from "./output-CnRzrbUM.mjs";
2
+ import { n as chip, t as CHIP_LABELS } from "./chips-CyeB_rhR.mjs";
3
+ // src/run/view.ts
4
+ /**
5
+ * @file How a run's lines are drawn: the terminal kit's {@link Term} for the
6
+ * stream they go to, and what a transcript has to remember between events (a
7
+ * node's worktree, to show its paths relative to it). Plain, a view draws
8
+ * today's line-based transcript; rich, it draws chips and cuts to the width.
9
+ */
10
+ /** A view for `stream` (stdout when not given), as `env` sets it. */
11
+ const createView = (stream = process.stdout, env = process.env) => ({
12
+ term: termOf(stream, env),
13
+ roots: /* @__PURE__ */ new Map()
14
+ });
15
+ /** Styles text for `term`: no escape codes when it is plain. */
16
+ const styler = (term) => (format, text) => apply(term, format, text);
17
+ // src/run/format-bus.ts
18
+ /** The first line of a message body, cut to fit one terminal line. */
19
+ const firstLine = (body) => {
20
+ const [line = ""] = body.trim().split("\n");
21
+ return line.length > 100 ? `${line.slice(0, 99)}…` : line;
22
+ };
23
+ /** Messages, owner questions and claims, without the node prefix. */
24
+ const formatBusEvent = (event, term = createView().term) => {
25
+ const style = styler(term);
26
+ if (event.type === "claim.taken") return [style("dim", `⚑ claimed ${event.resource}`)];
27
+ if (event.type === "claim.refused") {
28
+ const held = event.held === event.resource ? "" : ` (it holds ${event.held})`;
29
+ return [style("yellow", `⚑ ${event.resource} is ${event.holder}'s${held}`)];
30
+ }
31
+ if (event.type === "claim.released") return [style("dim", `⚑ released ${event.resource}`)];
32
+ if (event.type === "message.sent") {
33
+ const how = event.via === void 0 ? "" : ` (${event.via})`;
34
+ return [style("dim", `✉ to ${event.to}${how}: ${firstLine(event.body)}`)];
35
+ }
36
+ if (event.type === "message.received") {
37
+ const how = event.via === void 0 ? "" : ` (${event.via})`;
38
+ return [style("dim", `✉ from ${event.from}${how}: ${firstLine(event.body)}`)];
39
+ }
40
+ if (event.type === "call.started") return [style("dim", `↳ started ${event.workflow} as run ${event.run}`)];
41
+ if (event.type === "link.notice") return [style("dim", `↔ ${event.text}`)];
42
+ if (event.type === "message.read") return [];
43
+ if (event.type === "owner.asked") return [`${term.rich ? chip(term, CHIP_LABELS.ask, "accent") : style(["yellow", "bold"], "?")} asked as the owner of ${event.about}: ${event.text} ${style("dim", `(${event.question})`)}`];
44
+ if (event.type === "owner.answered") return [style("dim", `→ ${event.answer} (owner)`)];
45
+ return [style("dim", "→ its session ended first; asking you")];
46
+ };
47
+ // src/run/items-ran.ts
48
+ /**
49
+ * @file How a fan-out's finished line counts its items: only the ones that
50
+ * started.
51
+ */
52
+ /** How many of a fan-out's items started; a skipped one never did. */
53
+ const itemsRan = (count, statuses) => {
54
+ const ran = Array.isArray(statuses) ? statuses.filter((status) => status !== "skipped").length : count;
55
+ return ran === count ? `${String(count)} ran` : `${String(ran)} of ${String(count)} ran`;
56
+ };
57
+ // src/run/verdict.ts
58
+ /**
59
+ * @file The one-line verdict of a finished node: its report's status, unless
60
+ * the node failed or its work did not merge.
61
+ */
62
+ /** Whether a finished node's work did not merge into its owner. */
63
+ const hasConflict = (output) => {
64
+ const { merge } = output;
65
+ return typeof merge === "object" && merge !== null && "ok" in merge && merge.ok === false;
66
+ };
67
+ /**
68
+ * A one-line verdict for a finished node, by what its type outputs. A node that
69
+ * failed reads `fail` even when its report said `pass` (a hook refused its
70
+ * commit); a child that did not merge says so.
71
+ */
72
+ const nodeVerdict = (output, ok = true, error) => {
73
+ const { status, summary, exitCode, choice, answeredBy, count } = output;
74
+ if (typeof status === "string") {
75
+ if (!ok && (status === "pass" || status === "done")) return error === void 0 ? "fail" : `fail: ${firstLine(error)}`;
76
+ const label = hasConflict(output) ? `${status}, merge conflict` : status;
77
+ return typeof summary === "string" && summary !== "" ? `${label}: ${summary}` : label;
78
+ }
79
+ if (typeof exitCode === "number") return `exit ${String(exitCode)}`;
80
+ if (typeof choice === "string") return `${choice} (${String(answeredBy)})`;
81
+ if (typeof count === "number") return itemsRan(count, output["statuses"]);
82
+ return "done";
83
+ };
84
+ export { createView as a, formatBusEvent as i, nodeVerdict as n, styler as o, firstLine as r, hasConflict as t };
@@ -1,10 +1,10 @@
1
- import { Bn as placeFiles, C as openStore, Ot as stillTheSameProcess, _ as readProjectTriggers, _r as isToolNode, b as watchingPid, et as detachRun, fr as CheckReportSchema, g as declaredTriggers, h as triggerStanding, m as createWatcher, p as triggersReport, xr as timeoutMs, xt as liveStatus, y as takeWatchLock } from "./src-D6_xjm-x.mjs";
2
- import { n as newRunId } from "./find-BicBbGMg.mjs";
3
- import { C as widthOf, a as write, b as termOf, i as style, o as writeErr, r as plain, t as confirm, x as cut } from "./output-CM95njYt.mjs";
4
- import { n as chip, t as CHIP_LABELS } from "./chips-BA7SrrH5.mjs";
5
- import { c as toolExecutor, o as spawnTool, s as mcpCallExecutor } from "./src-9iGkjnsy.mjs";
6
- import { i as runLimits, r as limitsRefusal } from "./limits-jZQp9ZJC.mjs";
7
- import { t as acceptRefusal } from "./in-a-run-CgkVouyG.mjs";
1
+ import { Bn as placeFiles, C as openStore, Ot as stillTheSameProcess, _ as readProjectTriggers, _r as isToolNode, b as watchingPid, et as detachRun, fr as CheckReportSchema, g as declaredTriggers, h as triggerStanding, m as createWatcher, p as triggersReport, xr as timeoutMs, xt as liveStatus, y as takeWatchLock } from "./src-CdDTQLdQ.mjs";
2
+ import { n as newRunId } from "./find-p05wlbmu.mjs";
3
+ import { S as cut, a as style, i as plain, o as write, s as writeErr, t as confirm, w as widthOf, x as termOf } from "./output-CnRzrbUM.mjs";
4
+ import { n as chip, t as CHIP_LABELS } from "./chips-CyeB_rhR.mjs";
5
+ import { c as toolExecutor, o as spawnTool, s as mcpCallExecutor } from "./src-BfxkJOYm.mjs";
6
+ import { i as runLimits, r as limitsRefusal } from "./limits-CElmhowV.mjs";
7
+ import { t as acceptRefusal } from "./in-a-run-BI-hLIl_.mjs";
8
8
  import path from "node:path";
9
9
  import { mkdirSync } from "node:fs";
10
10
  import { homedir } from "node:os";
@@ -1,6 +1,6 @@
1
- import { Bn as placeFiles, C as openStore, Kn as inside, Un as runDirOf, Vn as placeFor, w as storePath } from "./src-D6_xjm-x.mjs";
2
- import { i as builtinWorkflowFile, r as builtinProblem, s as isBuiltinArg } from "./decide-B6PnKeqo.mjs";
3
- import { o as writeErr } from "./output-CM95njYt.mjs";
1
+ import { Bn as placeFiles, C as openStore, Kn as inside, Un as runDirOf, Vn as placeFor, w as storePath } from "./src-CdDTQLdQ.mjs";
2
+ import { a as isBuiltinArg, n as builtinWorkflowFile, t as builtinProblem } from "./builtin-files-w0YULJ4c.mjs";
3
+ import { s as writeErr } from "./output-CnRzrbUM.mjs";
4
4
  import path from "node:path";
5
5
  import { existsSync, readdirSync, statSync } from "node:fs";
6
6
  // src/project/place.ts
@@ -1,8 +1,8 @@
1
- import { C as openStore, E as inspectProject } from "./src-D6_xjm-x.mjs";
2
- import { a as planClean, i as keyOf, o as stepActs, t as applyClean } from "./clean-Di-KT7Mf.mjs";
3
- import { a as readWorktrees, c as mergeStateOf, d as stateParts, l as planLine, n as lostWork, o as repoRoot, r as planRemove, s as labelOf, t as applyRemove } from "./remove-CpMb4NDl.mjs";
4
- import { a as write, b as termOf, f as paint, i as style, o as writeErr, t as confirm, x as cut } from "./output-CM95njYt.mjs";
5
- import { n as chip } from "./chips-BA7SrrH5.mjs";
1
+ import { C as openStore, E as inspectProject } from "./src-CdDTQLdQ.mjs";
2
+ import { a as planClean, i as keyOf, o as stepActs, t as applyClean } from "./clean-D8GI_2K-.mjs";
3
+ import { a as readWorktrees, c as mergeStateOf, d as stateParts, l as planLine, n as lostWork, o as repoRoot, r as planRemove, s as labelOf, t as applyRemove } from "./remove-Dh7D_hVn.mjs";
4
+ import { S as cut, a as style, o as write, p as paint, s as writeErr, t as confirm, x as termOf } from "./output-CnRzrbUM.mjs";
5
+ import { n as chip } from "./chips-CyeB_rhR.mjs";
6
6
  import path from "node:path";
7
7
  import { realpathSync } from "node:fs";
8
8
  import { defineCommand } from "citty";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krapht/ork",
3
- "version": "1.0.0-alpha.11",
3
+ "version": "1.0.0-alpha.12",
4
4
  "description": "Orchestrate Claude agents on your machine: hierarchical, serializable workflows with a CLI and a localhost UI.",
5
5
  "keywords": [
6
6
  "claude",