@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
@@ -1,4 +1,4 @@
1
- import { Bn as placeFiles, En as maskSecrets, Jn as LESSON_CAP_TOKENS, Kn as inside, Qn as writePlainFile, Vn as placeFor, Xn as guardedBase, Yn as estimateTokens, Zn as plainPathInside, an as FEEDBACK_SEVERITIES, d as parseVersion, dn as publishPost, hn as targetOf, in as FEEDBACK_KINDS, l as compareVersions, pn as fingerprint, u as isNewer } from "./src-D6_xjm-x.mjs";
1
+ import { Bn as placeFiles, En as maskSecrets, Jn as LESSON_CAP_TOKENS, Kn as inside, Qn as writePlainFile, Vn as placeFor, Xn as guardedBase, Yn as estimateTokens, Zn as plainPathInside, an as FEEDBACK_SEVERITIES, d as parseVersion, dn as publishPost, hn as targetOf, in as FEEDBACK_KINDS, l as compareVersions, pn as fingerprint, u as isNewer } from "./src-CdDTQLdQ.mjs";
2
2
  import path from "node:path";
3
3
  import { existsSync, mkdirSync, readFileSync, realpathSync, renameSync, writeFileSync } from "node:fs";
4
4
  import { homedir } from "node:os";
@@ -402,6 +402,7 @@ const nodeSession = (events, node) => {
402
402
  session.sessionId = inner.sessionId;
403
403
  if (inner.cwd !== void 0) session.cwd = inner.cwd;
404
404
  if (inner.driver !== void 0) session.driver = inner.driver;
405
+ if (inner.model !== "") session.model = inner.model;
405
406
  }
406
407
  if (inner.type === "session.finished" && inner.outcome.sessionId !== "") session.sessionId = inner.outcome.sessionId;
407
408
  }
@@ -611,5 +612,5 @@ const registryShown = (registry) => {
611
612
  * fails when it is stale.
612
613
  */
613
614
  const ORK_NAME = "@krapht/ork";
614
- const ORK_VERSION = "1.0.0-alpha.11";
615
+ const ORK_VERSION = "1.0.0-alpha.12";
615
616
  export { feedbackActions as C, placeOf as S, previewPost as _, registryShown as a, acceptItem as b, checkDue as c, pendingNotice as d, readUpdateCache as f, nodeSession as g, writeUpdateCache as h, registryOf as i, fetchLatest as l, updateCachePath as m, ORK_VERSION as n, updateSwitchOff as o, refreshUpdateCache as p, isSwitchedOn as r, runInstall as s, ORK_NAME as t, newerVersion as u, checkNote as v, openFixRun as w, lessonPlaceOf as x, recordNote as y };
@@ -0,0 +1,89 @@
1
+ import "./src-CdDTQLdQ.mjs";
2
+ import { l as createTerminalHuman, n as attachRun, t as withStore } from "./store-B2OaE4ID.mjs";
3
+ import { t as findRun } from "./find-p05wlbmu.mjs";
4
+ import { a as style, o as write, s as writeErr } from "./output-CnRzrbUM.mjs";
5
+ import { n as attachRefusal } from "./in-a-run-BI-hLIl_.mjs";
6
+ import { defineCommand } from "citty";
7
+ // src/commands/attach.ts
8
+ /**
9
+ * @file `ork attach`: follow a run and the runs it called on this terminal, and
10
+ * answer their open decisions here (specs/cli.md). Ctrl-C detaches: the run
11
+ * keeps going and its decisions stay open (specs/run-control.md).
12
+ */
13
+ /**
14
+ * Follows `runId` and what it called until it ends or the person detaches, and
15
+ * returns the exit code: 0 when the run succeeded or they detached, else 1.
16
+ */
17
+ const attachSession = async (store, runId, session) => {
18
+ const detach = new AbortController();
19
+ session.signal?.addEventListener("abort", () => {
20
+ detach.abort();
21
+ });
22
+ const interactive = session.terminal?.interactive === true;
23
+ const human = session.terminal === void 0 || !interactive ? void 0 : createTerminalHuman({
24
+ ...session.terminal,
25
+ interrupt: () => {
26
+ detach.abort();
27
+ }
28
+ });
29
+ try {
30
+ const attached = await attachRun(store, runId, session.out, {
31
+ signal: detach.signal,
32
+ hintNoTerminal: human === void 0,
33
+ ...human === void 0 ? {} : { human },
34
+ ...session.home === void 0 ? {} : { home: session.home },
35
+ ...session.intervalMs === void 0 ? {} : { intervalMs: session.intervalMs }
36
+ });
37
+ if (detach.signal.aborted) {
38
+ session.out(style("dim", `detached; run ${runId} keeps going · ork attach ${runId} · ork stop ${runId}`));
39
+ return 0;
40
+ }
41
+ return attached.exitCode;
42
+ } finally {
43
+ human?.close();
44
+ }
45
+ };
46
+ const attach = defineCommand({
47
+ meta: {
48
+ name: "attach",
49
+ description: "Follow a run and the runs it called, and answer their questions here; Ctrl-C detaches"
50
+ },
51
+ args: { run: {
52
+ type: "positional",
53
+ description: "A run id or a prefix of one",
54
+ required: true
55
+ } },
56
+ run: ({ args }) => withStore(async (store) => {
57
+ const refusal = process.stdin.isTTY ? attachRefusal() : null;
58
+ if (refusal !== null) {
59
+ writeErr(refusal);
60
+ process.exitCode = 1;
61
+ return;
62
+ }
63
+ const found = findRun(store, args.run, process.cwd());
64
+ if (!found.ok) {
65
+ writeErr(found.error);
66
+ process.exitCode = 1;
67
+ return;
68
+ }
69
+ const abort = new AbortController();
70
+ const onSigint = () => {
71
+ abort.abort();
72
+ };
73
+ process.once("SIGINT", onSigint);
74
+ try {
75
+ process.exitCode = await attachSession(store, found.run.id, {
76
+ out: write,
77
+ signal: abort.signal,
78
+ terminal: {
79
+ input: process.stdin,
80
+ output: process.stdout,
81
+ interactive: process.stdin.isTTY
82
+ }
83
+ });
84
+ } finally {
85
+ process.off("SIGINT", onSigint);
86
+ }
87
+ })
88
+ });
89
+ export { attach };