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

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__-Bsb1kjgF.mjs +340 -0
  2. package/dist/{store-CleF7KeS.mjs → attach-BHO3X3cf.mjs} +16 -19
  3. package/dist/{attach-CdtGX9se.mjs → attach-CPespxlQ.mjs} +5 -4
  4. package/dist/bin.mjs +64 -1339
  5. package/dist/brief-za0ozN_E.mjs +58 -0
  6. package/dist/{builtin-files-Bdq23IIi.mjs → builtin-files-2bHf76x-.mjs} +1 -1
  7. package/dist/{completion--ywde-56.mjs → completion-CQ2UYKuJ.mjs} +5 -5
  8. package/dist/context-BNqDw9z1.mjs +106 -0
  9. package/dist/{find-BVX-bL4u.mjs → find-BYLlszqj.mjs} +1 -1
  10. package/dist/follow-ups-B4GJ3Vzw.mjs +461 -0
  11. package/dist/{format-CvTE5CZQ.mjs → format-C8MsFj8_.mjs} +19 -5
  12. package/dist/{help-groups-CpR2UzSn.mjs → help-groups-CQ98mLjF.mjs} +4 -0
  13. package/dist/{in-a-run-cL5N9gpH.mjs → in-a-run-Bp0k0J09.mjs} +1 -1
  14. package/dist/{__build_info__-B82-dGJY.mjs → install-DWtXTq4y.mjs} +3 -227
  15. package/dist/{limits-Dhe--wmX.mjs → limits-B1qzS4cX.mjs} +1 -1
  16. package/dist/{mcp-CsmboyXv.mjs → mcp-BOrVkyhN.mjs} +6 -6
  17. package/dist/{once-CrwI-ZdN.mjs → once-C1fL3GVo.mjs} +3 -3
  18. package/dist/orphan-guard-BFKg8VSd.mjs +58 -0
  19. package/dist/{pause-DssrYcda.mjs → pause-DOMK-R8V.mjs} +3 -3
  20. package/dist/post-BzA6Qobq.mjs +44 -0
  21. package/dist/{relay-DASRgsTQ.mjs → relay-OWuu4fib.mjs} +1 -1
  22. package/dist/run--4-1xAF2.mjs +1451 -0
  23. package/dist/{run-D8divGCs.mjs → run-CiPsW9Kf.mjs} +1 -1
  24. package/dist/{send-CXv8bx0i.mjs → send-CnNNW-ot.mjs} +2 -2
  25. package/dist/{src-njdtejgZ.mjs → src-B9zWIVqo.mjs} +129 -12
  26. package/dist/{src-8Mul0695.mjs → src-DQKz2eOH.mjs} +322 -75
  27. package/dist/{src-C7z_6fhn.mjs → src-DcrhgipG.mjs} +17 -10
  28. package/dist/{src-tsuZRu0H.mjs → src-Dr_fTSu-.mjs} +4832 -4155
  29. package/dist/store-oKJ-cCf3.mjs +16 -0
  30. package/dist/ui/assets/app-Bdc6OBeZ.css +1 -0
  31. package/dist/ui/assets/app-Drp8Dm9y.js +111 -0
  32. package/dist/ui/assets/{index-D-_uPI2v.js → index-BtwkftKe.js} +2 -2
  33. package/dist/ui/index.html +1 -1
  34. package/dist/{ui-CNO1M0qT.mjs → ui-CzKlsCnm.mjs} +3 -3
  35. package/dist/{usage-BVXi0iFY.mjs → usage-DHGNk2JL.mjs} +3 -3
  36. package/dist/{context-Y_I4Mofq.mjs → validate-Bs_gg22g.mjs} +4 -104
  37. package/dist/{watch-DVNIciHp.mjs → watch-CCCfw3n7.mjs} +19 -5
  38. package/dist/{workflows-B30QkwTk.mjs → workflows-CW28ZU-z.mjs} +2 -2
  39. package/dist/{worktrees-DD4_TpkH.mjs → worktrees-CyE8aF6j.mjs} +1 -1
  40. package/package.json +1 -1
  41. package/dist/ui/assets/app-D_nAPnHM.css +0 -1
  42. package/dist/ui/assets/app-DqBAtXSZ.js +0 -111
@@ -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-D-_uPI2v.js"></script>
22
+ <script type="module" crossorigin src="/assets/index-BtwkftKe.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__-B82-dGJY.mjs";
1
+ import { n as ORK_VERSION, t as ORK_NAME } from "./__build_info__-Bsb1kjgF.mjs";
2
2
  import { c as write, l as writeErr, s as style } from "./output-B1kwo0YU.mjs";
3
- import { o as mayShowSignIn } from "./in-a-run-cL5N9gpH.mjs";
4
- import { i as uiFilePath, l as newToken, n as startServer, r as runningServer, t as DEFAULT_PORT } from "./src-8Mul0695.mjs";
3
+ import { o as mayShowSignIn } from "./in-a-run-Bp0k0J09.mjs";
4
+ import { i as uiFilePath, l as newToken, n as startServer, r as runningServer, t as DEFAULT_PORT } from "./src-DQKz2eOH.mjs";
5
5
  import path from "node:path";
6
6
  import { constants } from "node:os";
7
7
  import { spawn } from "node:child_process";
@@ -1,8 +1,8 @@
1
- import { At as usd, G as applyPrune, K as planPrune, S as usageReport, U as openStore, mr as placeFor, x as USAGE_DIMENSIONS } from "./src-tsuZRu0H.mjs";
1
+ import { Dr as placeFor, G as applyPrune, K as planPrune, S as usageReport, St as usd, U as openStore, x as USAGE_DIMENSIONS } from "./src-Dr_fTSu-.mjs";
2
2
  import { C as termOf, c as write, l as writeErr, n as cost, o as shortCount, r as costOf, s as style, t as confirm } from "./output-B1kwo0YU.mjs";
3
3
  import { n as chip, t as CHIP_LABELS } from "./chips-BqcT58qr.mjs";
4
- import { n as limitsHere } from "./limits-Dhe--wmX.mjs";
5
- import { a as header, o as table } from "./format-CvTE5CZQ.mjs";
4
+ import { n as limitsHere } from "./limits-B1qzS4cX.mjs";
5
+ import { a as header, o as table } from "./format-C8MsFj8_.mjs";
6
6
  import { defineCommand } from "citty";
7
7
  // src/runs/usage.ts
8
8
  /**
@@ -1,8 +1,8 @@
1
- import { It as checkWorkflowText, Jr as retiredDriverHint, Kr as DriverSchema, L as readProjectTriggers, Lt as walkChecks, M as lateTriggers, Mt as explainSession, N as triggersReport, R as workflowTextHash, Rt as walkSummary, U as openStore, W as storePath, Xn as socketRoom, Xr as INTEGRATIONS, ai as DRIVER_IDS, ci as experimentsOn, ei as driverChecks, et as budgetWarnings, hn as namingNoDriver, ii as AGENT_DRIVERS, li as knownExperiments, mr as placeFor, oi as firstLine, pr as placeFiles, rt as driverQueues, si as EXPERIMENTS, ti as readyDriver, tt as driverRefusals, vr as workflowDirOf, xn as loadProject, xr as LESSON_CAP_TOKENS } from "./src-tsuZRu0H.mjs";
2
- import { c as checkDue, d as pendingNotice, f as readUpdateCache, h as writeUpdateCache, i as registryOf, m as updateCachePath, n as ORK_VERSION, o as updateSwitchOff, p as refreshUpdateCache, r as isSwitchedOn, t as ORK_NAME, u as newerVersion } from "./__build_info__-B82-dGJY.mjs";
1
+ import { At as walkSummary, Dr as placeFor, Er as placeFiles, In as loadProject, L as readProjectTriggers, M as lateTriggers, N as triggersReport, Ot as checkWorkflowText, Qt as namingNoDriver, R as workflowTextHash, Si as knownExperiments, U as openStore, W as storePath, _i as AGENT_DRIVERS, ai as DriverSchema, bi as EXPERIMENTS, et as budgetWarnings, jr as workflowDirOf, kt as walkChecks, li as INTEGRATIONS, lr as socketRoom, mi as readyDriver, pi as driverChecks, rt as driverQueues, si as retiredDriverHint, tt as driverRefusals, vi as DRIVER_IDS, xi as experimentsOn, yi as firstLine } from "./src-Dr_fTSu-.mjs";
2
+ import { d as readUpdateCache, f as refreshUpdateCache, i as registryOf, l as newerVersion, m as writeUpdateCache, n as ORK_VERSION, o as updateSwitchOff, p as updateCachePath, r as isSwitchedOn, s as checkDue, t as ORK_NAME, u as pendingNotice } from "./__build_info__-Bsb1kjgF.mjs";
3
3
  import { C as termOf, D as wrap, E as widthOf, a as plain, c as write, h as paint, l as writeErr, s as style, w as cut, x as plainEnv } from "./output-B1kwo0YU.mjs";
4
4
  import { n as chip, t as CHIP_LABELS } from "./chips-BqcT58qr.mjs";
5
- import { c as registeredProjects, i as refusedBuiltin, o as workflowArg, r as findWorkflowFiles, s as projectAt } from "./workflows-B30QkwTk.mjs";
5
+ import { c as registeredProjects, i as refusedBuiltin, r as findWorkflowFiles, s as projectAt } from "./workflows-CW28ZU-z.mjs";
6
6
  import path from "node:path";
7
7
  import { readFileSync } from "node:fs";
8
8
  import { execFile, spawn } from "node:child_process";
@@ -602,104 +602,4 @@ const validate = defineCommand({
602
602
  if (reports.some((r) => hasErrors(r.diagnostics))) process.exitCode = 1;
603
603
  }
604
604
  });
605
- // src/commands/context.ts
606
- /**
607
- * @file `ork context explain <wf> <node>`: what one node's session would load,
608
- * layer by layer, as core's `explainSession` plans it without writing
609
- * anything (one of Ork's own `ork:` workflows is written into the project's
610
- * run folder first, as `ork run` does): its project instructions, every skill
611
- * with the layer it came from and whether it is live, shadowed or switched
612
- * off, its context files, its practices, and estimated tokens.
613
- */
614
- /** Loads a workflow file and plans one node's session in it, in place. */
615
- const explainNode = (file, nodeId, cwd, home) => {
616
- const { report, workflow, graph, place, workflowDir } = loadWorkflow(file, cwd, home);
617
- if (workflow === null) return {
618
- ok: false,
619
- lines: formatReport(report)
620
- };
621
- const result = explainSession(workflow, graph, nodeId, {
622
- root: place.root,
623
- orkDir: place.dir,
624
- workflowDir,
625
- ...home === void 0 ? {} : { home }
626
- });
627
- return result.ok ? result : {
628
- ok: false,
629
- lines: [result.error]
630
- };
631
- };
632
- const approx = (count) => style("dim", `≈${count.toLocaleString("en")} tokens`);
633
- const formatExplanation = (e) => {
634
- const width = Math.max(8, ...e.skills.map((s) => s.name.length));
635
- const sourceWidth = Math.max(0, ...e.skills.map((s) => s.source.length));
636
- const lines = [
637
- `${style("bold", e.node)} ${style("dim", `(${e.type}) in ${e.workflow}`)}${e.template === void 0 ? "" : style("dim", `, planned as ${e.template}, the node it was spawned from`)}`,
638
- "",
639
- ...e.agent === void 0 ? [] : [`${style("bold", "Agent")} ${e.agent.name} ${style("dim", `(${e.agent.where})`)} ${approx(e.agent.tokens)}`],
640
- `${style("bold", "Instructions")} ${e.instructions}`,
641
- "",
642
- style("bold", "Skills")
643
- ];
644
- if (e.skills.length === 0) lines.push(style("dim", " none"));
645
- for (const s of e.skills) {
646
- const mark = s.state === "live" ? style("green", "✓") : style("dim", "−");
647
- const state = s.why === void 0 ? approx(s.tokens).replace("tokens", "tokens when used") : style("yellow", `off: ${s.why}`);
648
- lines.push(` ${mark} ${s.name.padEnd(width)} ${s.layer.padEnd(8)} ${style("dim", s.source.padEnd(sourceWidth))} ${state}`);
649
- }
650
- lines.push("", style("bold", "Context files"));
651
- if (e.files.length === 0) lines.push(style("dim", " none"));
652
- for (const f of e.files) {
653
- const cut = f.cutFrom === void 0 ? "" : ` ${style("yellow", `cut at the ${LESSON_CAP_TOKENS.toLocaleString("en")}-token cap; the whole file is ${approx(f.cutFrom)}`)}`;
654
- lines.push(` ${f.layer.padEnd(8)} ${f.name} ${approx(f.tokens)}${cut}`);
655
- }
656
- lines.push("", style("bold", "Practices"));
657
- for (const p of e.practices) lines.push(` ${p.name.padEnd(8)} ${approx(p.tokens)}`);
658
- for (const name of e.skippedPractices) lines.push(` ${name.padEnd(8)} ${style("dim", "the project's own skill wins")}`);
659
- if (e.practices.length === 0 && e.skippedPractices.length === 0) lines.push(style("dim", " off"));
660
- lines.push("", `Appended to Claude Code's system prompt: ${approx(e.appendedTokens)}`);
661
- return lines;
662
- };
663
- const explain = defineCommand({
664
- meta: {
665
- name: "explain",
666
- description: "Show what one node's session loads, layer by layer"
667
- },
668
- args: {
669
- workflow: {
670
- type: "positional",
671
- description: "A workflow file, the name of one in the project's workflows (.ork/workflows/), or one of Ork's own (ork:feedback-apply)",
672
- required: true
673
- },
674
- node: {
675
- type: "positional",
676
- description: "Node id",
677
- required: true
678
- },
679
- json: {
680
- type: "boolean",
681
- description: "Print JSON",
682
- default: false
683
- }
684
- },
685
- run: ({ args }) => {
686
- const cwd = process.cwd();
687
- if (refusedBuiltin([args.workflow], cwd)) return;
688
- const result = explainNode(workflowArg(args.workflow, cwd).file, args.node, cwd);
689
- if (!result.ok) {
690
- for (const line of result.lines) process.stderr.write(`${line}\n`);
691
- process.exitCode = 1;
692
- return;
693
- }
694
- if (args.json) write(JSON.stringify(result.explanation, void 0, 2));
695
- else for (const line of formatExplanation(result.explanation)) write(line);
696
- }
697
- });
698
- const context = defineCommand({
699
- meta: {
700
- name: "context",
701
- description: "Inspect the context Ork compiles for each node"
702
- },
703
- subCommands: { explain }
704
- });
705
- export { showUpdateNotice as C, runUpdateChild as S, updateCheckOff as T, orkCheck as _, validateFile as a, triggerChecks as b, warningLines as c, chooseReadyDriver as d, runReadyDriver as f, headWarning as g, experimentsCheck as h, validate as i, budgetWarningLines as l, exec as m, explainNode as n, walkLoaded as o, unfitLines as p, loadWorkflow as r, formatReport as s, context as t, checksHere as u, runChecks as v, startUpdateCheck as w, UPDATE_CHILD_ENV as x, socketCheck as y };
605
+ export { updateCheckOff as C, startUpdateCheck as S, socketCheck as _, formatReport as a, runUpdateChild as b, checksHere as c, unfitLines as d, exec as f, runChecks as g, orkCheck as h, walkLoaded as i, chooseReadyDriver as l, headWarning as m, validate as n, warningLines as o, experimentsCheck as p, validateFile as r, budgetWarningLines as s, loadWorkflow as t, runReadyDriver as u, triggerChecks as v, showUpdateNotice as x, UPDATE_CHILD_ENV as y };
@@ -1,10 +1,10 @@
1
- import { B as watchingPid, Br as CheckReportSchema, F as triggerStanding, Gr as isToolNode, I as declaredTriggers, L as readProjectTriggers, N as triggersReport, P as createWatcher, U as openStore, Ut as liveStatus, Xt as stillTheSameProcess, Yr as timeoutMs, pr as placeFiles, wt as detachRun, z as takeWatchLock } from "./src-tsuZRu0H.mjs";
2
- import { n as newRunId } from "./find-BVX-bL4u.mjs";
1
+ import { $r as CheckReportSchema, An as stillTheSameProcess, B as watchingPid, Cn as liveStatus, Er as placeFiles, F as triggerStanding, I as declaredTriggers, L as readProjectTriggers, N as triggersReport, P as createWatcher, U as openStore, Yn as runGh, ci as timeoutMs, gt as detachRun, ii as isToolNode, ln as startFollowUpChecks, z as takeWatchLock } from "./src-Dr_fTSu-.mjs";
2
+ import { n as newRunId } from "./find-BYLlszqj.mjs";
3
3
  import { C as termOf, E as widthOf, a as plain, c as write, l as writeErr, s as style, t as confirm, w as cut } from "./output-B1kwo0YU.mjs";
4
4
  import { n as chip, t as CHIP_LABELS } from "./chips-BqcT58qr.mjs";
5
- import { c as toolExecutor, o as spawnTool, s as mcpCallExecutor } from "./src-C7z_6fhn.mjs";
6
- import { i as runLimits, r as limitsRefusal } from "./limits-Dhe--wmX.mjs";
7
- import { t as acceptRefusal } from "./in-a-run-cL5N9gpH.mjs";
5
+ import { c as toolExecutor, o as spawnTool, s as mcpCallExecutor } from "./src-DcrhgipG.mjs";
6
+ import { i as runLimits, r as limitsRefusal } from "./limits-B1qzS4cX.mjs";
7
+ import { t as acceptRefusal } from "./in-a-run-Bp0k0J09.mjs";
8
8
  import path from "node:path";
9
9
  import { mkdirSync } from "node:fs";
10
10
  import { homedir } from "node:os";
@@ -150,6 +150,8 @@ const acceptLines = (item, standing, term = termOf(process.stdout)) => [
150
150
  ];
151
151
  /** The triggers `--accept` can't offer, so they aren't silently left out. */
152
152
  const unacceptableLines = (item, term = termOf(process.stdout)) => [`${style("bold", plain(item.id))} ${style("dim", plain(item.place.root))}`, ...item.diagnostics.filter(({ severity }) => severity === "error").map(({ message }) => ` ${failMark(term)} ${plain(message)}`)];
153
+ /** What `ork watch` says when follow-ups come due. */
154
+ const dueLines = (due) => due.map((f) => `▸ follow-up due (${plain(f.for)}): ${plain(f.title)}${f.note === void 0 ? "" : ` (${plain(f.note)})`}, \`ork follow-ups show ${f.id}\``);
153
155
  // src/watch/start.ts
154
156
  /**
155
157
  * @file Starting a trigger's run (RFC-011): an ordinary run in the background,
@@ -273,7 +275,19 @@ const watchLoop = async (store) => {
273
275
  const timer = setInterval(() => {
274
276
  watcher.tick();
275
277
  }, TICK_MS);
278
+ const stopChecks = startFollowUpChecks({
279
+ rows: store,
280
+ gh: runGh,
281
+ projects: () => store.projects().map((project) => project.root),
282
+ onDue: (due) => {
283
+ for (const line of dueLines(due)) write(line);
284
+ },
285
+ onError: (error) => {
286
+ writeErr(`follow-ups: ${error}`);
287
+ }
288
+ });
276
289
  await stopped;
290
+ stopChecks();
277
291
  clearInterval(timer);
278
292
  stopping.abort();
279
293
  await watcher.settled();
@@ -1,5 +1,5 @@
1
- import { U as openStore, W as storePath, gr as runDirOf, mr as placeFor, pr as placeFiles, yr as inside } from "./src-tsuZRu0H.mjs";
2
- import { a as isBuiltinArg, n as builtinWorkflowFile, t as builtinProblem } from "./builtin-files-Bdq23IIi.mjs";
1
+ import { Dr as placeFor, Er as placeFiles, Mr as inside, U as openStore, W as storePath, kr as runDirOf } from "./src-Dr_fTSu-.mjs";
2
+ import { a as isBuiltinArg, n as builtinWorkflowFile, t as builtinProblem } from "./builtin-files-2bHf76x-.mjs";
3
3
  import { l as writeErr } from "./output-B1kwo0YU.mjs";
4
4
  import path from "node:path";
5
5
  import { existsSync, readdirSync, statSync } from "node:fs";
@@ -1,4 +1,4 @@
1
- import { U as openStore, Y as inspectProject, _ as keyOf, a as planRemove, c as repoRoot, d as planLine, h as applyClean, i as lostWork, l as labelOf, p as stateParts, r as applyRemove, s as readWorktrees, u as mergeStateOf, v as planClean, y as stepActs } from "./src-tsuZRu0H.mjs";
1
+ import { U as openStore, Y as inspectProject, _ as keyOf, a as planRemove, c as repoRoot, d as planLine, h as applyClean, i as lostWork, l as labelOf, p as stateParts, r as applyRemove, s as readWorktrees, u as mergeStateOf, v as planClean, y as stepActs } from "./src-Dr_fTSu-.mjs";
2
2
  import { C as termOf, c as write, h as paint, l as writeErr, s as style, t as confirm, w as cut } from "./output-B1kwo0YU.mjs";
3
3
  import { n as chip } from "./chips-BqcT58qr.mjs";
4
4
  import path from "node:path";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krapht/ork",
3
- "version": "1.0.0-alpha.14",
3
+ "version": "1.0.0-alpha.15",
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",