@krapht/ork 1.0.0-alpha.10 → 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 (41) hide show
  1. package/dist/{__build_info__-DFF18K8y.mjs → __build_info__-BJbE3Zvp.mjs} +4 -72
  2. package/dist/attach-BmV5ckb9.mjs +89 -0
  3. package/dist/bin.mjs +467 -864
  4. package/dist/{decide-3l9q8UtX.mjs → builtin-files-w0YULJ4c.mjs} +2 -50
  5. package/dist/chips-CyeB_rhR.mjs +43 -0
  6. package/dist/{clean-DVaEH9e7.mjs → clean-D8GI_2K-.mjs} +1 -1
  7. package/dist/{completion-Dv5kf598.mjs → completion-CzElB8nS.mjs} +24 -16
  8. package/dist/{context-CEaKOVmG.mjs → context-BAwgVSX5.mjs} +43 -31
  9. package/dist/decide-DlbyctOE.mjs +50 -0
  10. package/dist/{find-DEjjOlTG.mjs → find-p05wlbmu.mjs} +1 -1
  11. package/dist/format-Dni98cbh.mjs +206 -0
  12. package/dist/{help-groups-BwYoAWsh.mjs → help-groups-DYP_zMRP.mjs} +4 -0
  13. package/dist/{in-a-run-BS9Nc-JW.mjs → in-a-run-BI-hLIl_.mjs} +4 -2
  14. package/dist/{limits-BSwEjQST.mjs → limits-CElmhowV.mjs} +1 -1
  15. package/dist/{list-Qxr6rwsY.mjs → list-zW2xKuGr.mjs} +1 -1
  16. package/dist/{mcp-CslnG5wf.mjs → mcp-CM3b65AZ.mjs} +6 -6
  17. package/dist/output-CnRzrbUM.mjs +423 -0
  18. package/dist/{pause-D7OVB5Ac.mjs → pause-BuS83WAI.mjs} +4 -4
  19. package/dist/{relay-EceRIebO.mjs → relay-DAsJA8wF.mjs} +2 -2
  20. package/dist/{remove-0IQZVWmI.mjs → remove-Dh7D_hVn.mjs} +3 -3
  21. package/dist/{report-DK4LGqwF.mjs → report-CEN8VoUb.mjs} +31 -20
  22. package/dist/{send-C0uwfUYi.mjs → send-MFEQZH31.mjs} +3 -3
  23. package/dist/{src-cmmXKHn1.mjs → src-BfxkJOYm.mjs} +234 -150
  24. package/dist/{src-Df6KOIDC.mjs → src-CdDTQLdQ.mjs} +2081 -1035
  25. package/dist/{src-oaJYIddp.mjs → src-D1QedD5y.mjs} +523 -81
  26. package/dist/{src-i5k2Y-kf.mjs → src-S9yK2OHU.mjs} +79 -11
  27. package/dist/store-B2OaE4ID.mjs +1356 -0
  28. package/dist/ui/assets/{app-qs8Lofv6.js → app-CAoZtku5.js} +16 -16
  29. package/dist/ui/assets/app-QoHVi-mb.css +1 -0
  30. package/dist/ui/assets/{index-DV1ZaOk-.js → index-BL7Ad0OA.js} +2 -2
  31. package/dist/ui/index.html +1 -1
  32. package/dist/{ui-CBkHJdqk.mjs → ui-C4Ys26oO.mjs} +4 -4
  33. package/dist/{usage-Cd8pEYyK.mjs → usage-C2zx-X6q.mjs} +43 -32
  34. package/dist/verdict-CIy8tAyX.mjs +84 -0
  35. package/dist/{watch-DW5R2OPO.mjs → watch-DzCeqM05.mjs} +28 -16
  36. package/dist/{workflows-BT1gDRIV.mjs → workflows-Rr5w90A0.mjs} +3 -3
  37. package/dist/{worktrees-g1MQMGie.mjs → worktrees-f6SAbum5.mjs} +11 -10
  38. package/package.json +1 -1
  39. package/dist/format-Cb5_m-Qd.mjs +0 -191
  40. package/dist/output-Bqljtmp_.mjs +0 -40
  41. package/dist/ui/assets/app-C8uhHVYp.css +0 -1
@@ -1,10 +1,11 @@
1
- import { $n as NodeSchema, An as inside, Bn as newWorkflowText, D as openStore, Dn as runDirOf, E as isNodeEvent, Gn as parseWorkflow, Gt as DISCUSSIONS, Jn as EdgeInputSchema, Jt as sendPost, Kt as planPost, Ln as skillsIn, Mn as LESSON_CAP_TOKENS, O as storePath, Ot as nestItems, Pt as nodeSays, Q as tellLiveRun, Rn as WorkflowEditSchema, St as runStatus, Tn as placeFor, Tt as processAlive, Vn as readDocument, W as linkNodes, Wn as renderJsonSchema, X as requestPause, Y as requestContinue, Z as requestStop, Zn as expandEdge, at as followEvents, bn as loadAgents, bt as liveStatus, d as runningRunIds, et as detachResume, f as runningScript, ht as walkSummary, it as detachRun, kn as workflowDirOf, l as planUpgrade, mt as walkChecks, o as limitsReport, ot as explainWorkflowText, p as detectInstaller, pt as checkWorkflowText, q as unlinkNodes, qt as runGh, r as capsHere, rn as readCondition, tt as resumable, u as releaseNotes, v as triggersReport, wn as placeFiles, xt as pausedOf, zn as applyEdits } from "./src-Df6KOIDC.mjs";
2
- import { C as placeOf$1, S as lessonPlaceOf, T as openFixRun, _ as nodeSession, a as registryShown, b as recordNote, c as checkDue, f as readUpdateCache, g as activeTree, h as writeUpdateCache, i as registryOf, l as fetchLatest, m as updateCachePath, o as updateSwitchOff, p as refreshUpdateCache, s as runInstall, u as newerVersion, v as previewPost, w as feedbackActions, x as acceptItem } from "./__build_info__-DFF18K8y.mjs";
3
- import { n as pendingDecisions, r as builtinProblem, t as answerDecision } from "./decide-3l9q8UtX.mjs";
4
- import { n as newRunId, t as findRun } from "./find-DEjjOlTG.mjs";
5
- import { n as usageReport } from "./report-DK4LGqwF.mjs";
6
- import { a as planClean, i as keyOf, o as stepActs, r as cleanStep, s as stepPrunes, t as applyClean } from "./clean-DVaEH9e7.mjs";
7
- import { a as readWorktrees, c as mergeStateOf, d as stateParts, i as projectHead, l as planLine, n as lostWork, r as planRemove, s as labelOf, t as applyRemove, u as removeRefusal } from "./remove-0IQZVWmI.mjs";
1
+ import { $n as skillsIn, $t as endOf, At as nestItems, B as linkNodes, Bn as placeFiles, C as openStore, Ct as runStatus, Dt as processAlive, G as requestContinue, Gn as workflowDirOf, In as loadAgents, J as tellLiveRun, Jn as LESSON_CAP_TOKENS, K as requestPause, Kn as inside, S as isNodeEvent, St as pausedOf, U as unlinkNodes, Un as runDirOf, Ut as nodeSays, Vn as placeFor, X as detachResume, Z as resumable, a as releaseNotes, c as detectInstaller, cn as planPost, er as WorkflowEditSchema, et as detachRun, gt as walkSummary, hr as NodeSchema, ht as walkChecks, i as planUpgrade, it as limitsReport, ln as runGh, mt as checkWorkflowText, nn as END_KINDS, nr as newWorkflowText, o as runningRunIds, or as renderJsonSchema, p as triggersReport, pr as expandEdge, q as requestStop, r as capsHere, rr as readDocument, s as runningScript, sn as DISCUSSIONS, sr as parseWorkflow, st as explainWorkflowText, tr as applyEdits, tt as followEvents, un as sendPost, ur as EdgeInputSchema, w as storePath, x as activeTree, xt as liveStatus, yn as readCondition } from "./src-CdDTQLdQ.mjs";
2
+ import { C as feedbackActions, S as placeOf$1, _ as previewPost, a as registryShown, b as acceptItem, c as checkDue, f as readUpdateCache, g as nodeSession, h as writeUpdateCache, i as registryOf, l as fetchLatest, m as updateCachePath, o as updateSwitchOff, p as refreshUpdateCache, s as runInstall, u as newerVersion, w as openFixRun, x as lessonPlaceOf, y as recordNote } from "./__build_info__-BJbE3Zvp.mjs";
3
+ import { t as builtinProblem } from "./builtin-files-w0YULJ4c.mjs";
4
+ import { n as pendingDecisions, t as answerDecision } from "./decide-DlbyctOE.mjs";
5
+ import { n as newRunId, t as findRun } from "./find-p05wlbmu.mjs";
6
+ import { n as usageReport } from "./report-CEN8VoUb.mjs";
7
+ import { a as planClean, i as keyOf, o as stepActs, r as cleanStep, s as stepPrunes, t as applyClean } from "./clean-D8GI_2K-.mjs";
8
+ import { a as readWorktrees, c as mergeStateOf, d as stateParts, i as projectHead, l as planLine, n as lostWork, r as planRemove, s as labelOf, t as applyRemove, u as removeRefusal } from "./remove-Dh7D_hVn.mjs";
8
9
  import path from "node:path";
9
10
  import { z } from "zod";
10
11
  import { chmodSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
@@ -779,7 +780,7 @@ const runOf = (context, id) => {
779
780
  const projectOf = (context, key) => context.store.projects().find((p) => p.id === key || p.root === key);
780
781
  /** A run as the API shows it: with its live status and what is paused. */
781
782
  const viewOf$2 = (context, run) => {
782
- const events = run.status === "running" ? context.store.events(run.id).map((stored) => stored.event) : [];
783
+ const events = run.status === "running" ? context.store.controlEvents(run.id).map((stored) => stored.event) : [];
783
784
  return {
784
785
  ...run,
785
786
  live: runStatus(run, events),
@@ -1450,6 +1451,72 @@ const builderRoutes = (context) => {
1450
1451
  builderSave: ({ params, body }) => inProject(params.id, (project) => saveDraft(context, project, params.name, body.force === true))
1451
1452
  };
1452
1453
  };
1454
+ // ../server/src/end-view.ts
1455
+ /**
1456
+ * @file Resolves how nodes ended for the API: each `node.finished` event (read
1457
+ * through core's `endOf`, so a run stored before ends existed gets a kind
1458
+ * too) and each tree node get an `EndView` (contract-ends.ts).
1459
+ */
1460
+ /** Core's hints send the reader to Details; with no detail there is none. */
1461
+ const HINT_TO_DETAILS = /\bIts (?:last )?(?:output|detail) is under Details(?:; |\.\s*)/u;
1462
+ const hintFor = (hint, hasDetail) => {
1463
+ if (hasDetail) return hint;
1464
+ const rest = hint.replace(HINT_TO_DETAILS, "");
1465
+ return rest === "" ? rest : rest[0]?.toUpperCase() + rest.slice(1);
1466
+ };
1467
+ const endViewOf = (end) => {
1468
+ const info = END_KINDS[end.kind];
1469
+ return {
1470
+ kind: end.kind,
1471
+ message: end.message,
1472
+ ...end.detail === void 0 ? {} : { detail: end.detail },
1473
+ label: info.label,
1474
+ actor: info.actor,
1475
+ transient: info.transient,
1476
+ hint: hintFor(info.hint, end.detail !== void 0),
1477
+ docsAnchor: info.docsAnchor
1478
+ };
1479
+ };
1480
+ /** The event as served: a `node.finished` gets its `end`, old ones too. */
1481
+ const servedEvent = (stored) => {
1482
+ const { event } = stored;
1483
+ return event.type === "node.finished" ? {
1484
+ ...stored,
1485
+ event: {
1486
+ ...event,
1487
+ end: endViewOf(endOf(event))
1488
+ }
1489
+ } : {
1490
+ ...stored,
1491
+ event
1492
+ };
1493
+ };
1494
+ /**
1495
+ * The tree with each node's latest end, from the events it was folded from. A
1496
+ * node that started again has none until it finishes; a failed node's `now` is
1497
+ * the end's message, not the raw error.
1498
+ */
1499
+ const treeWithEnds = (roots, stored) => {
1500
+ const ends = /* @__PURE__ */ new Map();
1501
+ for (const { event } of stored) if (event.type === "node.started") ends.delete(event.id);
1502
+ else if (event.type === "node.finished") ends.set(event.id, endViewOf(endOf(event)));
1503
+ const dress = (node) => {
1504
+ const end = ends.get(node.id);
1505
+ const children = node.children.map(dress);
1506
+ if (end === void 0) return {
1507
+ ...node,
1508
+ children
1509
+ };
1510
+ const failed = node.state === "failed" && end.actor !== null;
1511
+ return {
1512
+ ...node,
1513
+ ...failed ? { now: end.message } : {},
1514
+ end,
1515
+ children
1516
+ };
1517
+ };
1518
+ return roots.map((node) => dress(node));
1519
+ };
1453
1520
  // ../server/src/workflows.ts
1454
1521
  /**
1455
1522
  * @file A project's workflows, for the UI's Run workflow dialog: each
@@ -1548,7 +1615,8 @@ const readRoutes = (context) => ({
1548
1615
  tree: ({ params }) => {
1549
1616
  const found = runOf(context, params.id);
1550
1617
  if (!found.ok) return found.refusal;
1551
- return ok(nestItems(activeTree(context.store.events(found.run.id))));
1618
+ const stored = context.store.events(found.run.id);
1619
+ return ok(treeWithEnds(nestItems(activeTree(stored)), stored));
1552
1620
  },
1553
1621
  graph: ({ params }) => {
1554
1622
  const found = runOf(context, params.id);
@@ -1560,7 +1628,7 @@ const readRoutes = (context) => ({
1560
1628
  if (!found.ok) return found.refusal;
1561
1629
  const events = context.store.events(found.run.id, query.after ?? 0).filter((s) => query.node === void 0 || isNodeEvent(s.event, query.node));
1562
1630
  const newest = query.last === void 0 ? events : events.slice(-query.last);
1563
- return ok(query.limit === void 0 ? newest : newest.slice(0, query.limit));
1631
+ return ok((query.limit === void 0 ? newest : newest.slice(0, query.limit)).map((stored) => servedEvent(stored)));
1564
1632
  },
1565
1633
  decisions: ({ query }) => {
1566
1634
  const workflow = query.workflow === void 0 ? {} : { workflow: query.workflow };
@@ -2801,7 +2869,7 @@ const runStream = async (context, req, res, url, id, shutdown) => {
2801
2869
  }
2802
2870
  const stream = openEventStream(res);
2803
2871
  const end = await followEvents(context.store, found.run.id, (stored) => {
2804
- stream.send("run-event", stored, stored.seq);
2872
+ stream.send("run-event", servedEvent(stored), stored.seq);
2805
2873
  }, {
2806
2874
  follow: true,
2807
2875
  after,