@krapht/ork 1.0.0-alpha.3 → 1.0.0-alpha.5

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__-BwrKe6yz.mjs → __build_info__-Dl8yTEu-.mjs} +2 -2
  2. package/dist/bin.mjs +63 -225
  3. package/dist/{clean-hXSaN8BT.mjs → clean-DYVmLkd4.mjs} +1 -1
  4. package/dist/{completion-Cga01yQP.mjs → completion-BVx917Yr.mjs} +5 -5
  5. package/dist/{context-mCAwzFFM.mjs → context-CepHRoj9.mjs} +3 -3
  6. package/dist/{decide-BvZnKErW.mjs → decide-CK_-lI5V.mjs} +3 -3
  7. package/dist/{find-CbetS8I2.mjs → find-DWiDJ5Lc.mjs} +1 -1
  8. package/dist/{format-D87bY6Ud.mjs → format-yBEAXZhk.mjs} +223 -17
  9. package/dist/{in-a-run-Bs4Wv-Cz.mjs → in-a-run-CKFIeMpU.mjs} +1 -1
  10. package/dist/{limits-RzKQ_zPk.mjs → limits-CwzPe9wZ.mjs} +1 -1
  11. package/dist/{list-DX65Sbu7.mjs → list-BE02pCZ9.mjs} +1 -1
  12. package/dist/{mcp-DKrrxowo.mjs → mcp-DMuBbUHU.mjs} +6 -6
  13. package/dist/{output-Q3TZ-Ave.mjs → output-BhYkshYq.mjs} +9 -6
  14. package/dist/{pause-B5Z41lR3.mjs → pause-C_Q0W6iX.mjs} +4 -4
  15. package/dist/{relay-BLnjMdjT.mjs → relay-COCvG-0I.mjs} +2 -2
  16. package/dist/{remove-IbcZOemm.mjs → remove-RVcX1KqP.mjs} +3 -3
  17. package/dist/{send-CJKEhBL1.mjs → send-OVpRei_5.mjs} +3 -3
  18. package/dist/{src-LSxjnWDH.mjs → src-CxZr4Bp2.mjs} +16 -8
  19. package/dist/{src-DnETlJ1r.mjs → src-Do_MhwiV.mjs} +186 -30
  20. package/dist/{src-XDSRnAZV.mjs → src-HxtJOMRr.mjs} +172 -167
  21. package/dist/{src-BTDzibW3.mjs → src-QEycKJWk.mjs} +26 -12
  22. package/dist/ui/THIRD_PARTY_LICENSES.txt +594 -0
  23. package/dist/ui/assets/app-DzI77WV9.js +75 -0
  24. package/dist/ui/assets/app-pTYGrAbI.css +1 -0
  25. package/dist/ui/assets/{index-BkI68sr5.js → index-2G_6XIIv.js} +3 -3
  26. package/dist/ui/assets/theme-CdXvqTQ6.js +1 -0
  27. package/dist/ui/index.html +2 -2
  28. package/dist/{ui-fvrO7Gxd.mjs → ui-Dz_qfUOz.mjs} +4 -4
  29. package/dist/{usage-bNdcBcj9.mjs → usage-BcLUZ1xw.mjs} +5 -5
  30. package/dist/{watch-EhlO304A.mjs → watch-Buyn0Mhz.mjs} +6 -6
  31. package/dist/{workflows-C5hYAVcE.mjs → workflows-1sntXqSd.mjs} +3 -3
  32. package/dist/{worktrees-BQFcpYz1.mjs → worktrees-B_Go_A9w.mjs} +4 -4
  33. package/package.json +1 -1
  34. package/dist/ui/assets/app-BNElhp7Z.js +0 -67
  35. package/dist/ui/assets/app-BNT0SuIz.css +0 -1
  36. package/dist/ui/assets/theme-3xH5jxKs.js +0 -1
@@ -1,4 +1,4 @@
1
- import { An as guardedBase, En as inside, Gt as publishPost, Mn as writePlainFile, On as LESSON_CAP_TOKENS, Rt as FEEDBACK_KINDS, Yt as targetOf, Zt as maskSecrets, bn as placeFiles, g as parseVersion, h as isNewer, jn as plainPathInside, kn as estimateTokens, m as compareVersions, qt as fingerprint, xn as placeFor, zt as FEEDBACK_SEVERITIES } from "./src-DnETlJ1r.mjs";
1
+ import { Cn as placeFiles, Fn as writePlainFile, Ht as FEEDBACK_SEVERITIES, Jt as publishPost, Mn as estimateTokens, Nn as guardedBase, Pn as plainPathInside, Qt as targetOf, Vt as FEEDBACK_KINDS, Xt as fingerprint, cn as maskSecrets, g as parseVersion, h as isNewer, jn as LESSON_CAP_TOKENS, kn as inside, m as compareVersions, wn as placeFor } from "./src-Do_MhwiV.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";
@@ -611,5 +611,5 @@ const registryShown = (registry) => {
611
611
  * fails when it is stale.
612
612
  */
613
613
  const ORK_NAME = "@krapht/ork";
614
- const ORK_VERSION = "1.0.0-alpha.3";
614
+ const ORK_VERSION = "1.0.0-alpha.5";
615
615
  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 };
package/dist/bin.mjs CHANGED
@@ -1,18 +1,18 @@
1
1
  #!/usr/bin/env node
2
- import { Bn as serializeWorkflow, Bt as FEEDBACK_TARGETS, Cn as runDirOf, D as inspectProject, Dn as projectRootOf, Dt as userMessageText, En as inside, Ft as PROJECT_FILE, H as tellNode, Ht as planPost, I as createCalls, It as gitRulesOf, J as tellLiveRun, Jn as beforeOf, Jt as normalizeTitle, Kn as settingsOf, Kt as createFeedback, L as addressOf, Lt as loadProject, M as clearGitLocalEnv, N as parseInputPairs, P as resolveInputs, R as endLink, Rt as FEEDBACK_KINDS, Sn as projectsHome, Tt as startRun, Un as WorkflowSchema, V as peerOf, W as flattenTree, Wt as sendPost, Xt as maskReplacer, Yn as isClaudeNode, _ as lateTriggers, _n as hasInRepoFiles, _t as runStatus, an as wakeRun, ar as CLAUDE_DRIVERS, bn as placeFiles, cn as planMoveInto, cr as experimentsOn, d as runningRunIds, dn as toolsInUse, dt as namingNoDriver, er as INTEGRATIONS, et as adoptedCalls, f as runningScript, fn as createAgent, ft as sessionDriver, h as isNewer, hn as loadAgents, ht as liveStatus, i as NOT_STARTED, in as socketRoom, ir as ORK_LAYOUT, it as replayLoopAnswers, l as planUpgrade, ln as linkTools, lr as knownExperiments, mn as catalogAgent, n as resolveBase, nn as serveRun, nt as resumable, on as planAgentMigration, or as firstLine, ot as detachRun, pn as deleteAgent, q as requestStop, qt as fingerprint, rn as socketPath, rr as AGENT_TOOL_LAYOUTS, rt as createReplay, sn as applySteps, sr as EXPERIMENTS, st as followEvents, t as createWorkspace, tt as detachResume, u as releaseNotes, un as toolLinks, ut as planNodeSession, v as triggersReport, vn as inRepoPlace, vt as runTree, wn as shownPath, wt as walkSummary, xn as placeFor, yn as newProjectId, z as endLinksOf, zt as FEEDBACK_SEVERITIES } from "./src-DnETlJ1r.mjs";
3
- import { C as feedbackActions, S as placeOf, _ as previewPost, b as acceptItem, c as checkDue, d as pendingNotice, f as readUpdateCache, g as nodeSession, h as writeUpdateCache, i as registryOf, l as fetchLatest, m as updateCachePath, n as ORK_VERSION, o as updateSwitchOff, p as refreshUpdateCache, r as isSwitchedOn, s as runInstall, t as ORK_NAME, u as newerVersion$1, v as checkNote, w as openFixRun, y as recordNote } from "./__build_info__-BwrKe6yz.mjs";
4
- import { i as builtinWorkflowFile, n as pendingDecisions, r as builtinProblem, t as answerDecision } from "./decide-BvZnKErW.mjs";
5
- import { n as newRunId, t as findRun } from "./find-CbetS8I2.mjs";
6
- import { a as write, c as openStore, i as style, l as storePath, n as cost, o as writeErr, s as nodeOf, t as confirm } from "./output-Q3TZ-Ave.mjs";
7
- import { n as listOrkWorktrees, t as createdWorktrees } from "./list-DX65Sbu7.mjs";
8
- import { a as planClean, t as applyClean } from "./clean-hXSaN8BT.mjs";
2
+ import { An as projectRootOf, Cn as placeFiles, D as inspectProject, Dn as shownPath, Dt as userMessageText, En as runDirOf, Ft as PROJECT_FILE, Gt as planPost, H as tellNode, Ht as FEEDBACK_SEVERITIES, I as createCalls, It as gitRulesOf, J as tellLiveRun, Kn as WorkflowSchema, L as addressOf, Lt as loadProject, M as clearGitLocalEnv, N as parseInputPairs, P as resolveInputs, Qn as isClaudeNode, R as endLink, Sn as newProjectId, Tn as projectsHome, Tt as startRun, Un as serializeWorkflow, Ut as FEEDBACK_TARGETS, V as peerOf, Vt as FEEDBACK_KINDS, W as flattenTree, Xt as fingerprint, Yn as settingsOf, Yt as createFeedback, Zn as beforeOf, Zt as normalizeTitle, _ as lateTriggers, _n as catalogAgent, _t as runStatus, an as socketRoom, bn as hasInRepoFiles, cr as CLAUDE_DRIVERS, d as runningRunIds, dn as planMoveInto, dr as experimentsOn, dt as namingNoDriver, et as adoptedCalls, f as runningScript, fn as linkTools, fr as knownExperiments, ft as sessionDriver, gn as deleteAgent, h as isNewer, hn as createAgent, ht as liveStatus, i as NOT_STARTED, in as socketPath, it as replayLoopAnswers, kn as inside, l as planUpgrade, ln as planAgentMigration, lr as firstLine, mn as toolsInUse, n as resolveBase, nt as resumable, on as wakeRun, or as AGENT_TOOL_LAYOUTS, ot as detachRun, pn as toolLinks, q as requestStop, qt as sendPost, rn as serveRun, rr as INTEGRATIONS, rt as createReplay, sn as maskReplacer, sr as ORK_LAYOUT, st as followEvents, t as createWorkspace, tt as detachResume, u as releaseNotes, un as applySteps, ur as EXPERIMENTS, ut as planNodeSession, v as triggersReport, vn as loadAgents, vt as runTree, wn as placeFor, wt as walkSummary, xn as inRepoPlace, z as endLinksOf } from "./src-Do_MhwiV.mjs";
3
+ import { a as formatRunEvent, i as formatEvent, n as formatRuns, o as createTerminalHuman, r as formatTree, s as createDecisionQueue, t as ago } from "./format-yBEAXZhk.mjs";
4
+ import { C as feedbackActions, S as placeOf, _ as previewPost, b as acceptItem, c as checkDue, d as pendingNotice, f as readUpdateCache, g as nodeSession, h as writeUpdateCache, i as registryOf, l as fetchLatest, m as updateCachePath, n as ORK_VERSION, o as updateSwitchOff, p as refreshUpdateCache, r as isSwitchedOn, s as runInstall, t as ORK_NAME, u as newerVersion$1, v as checkNote, w as openFixRun, y as recordNote } from "./__build_info__-Dl8yTEu-.mjs";
5
+ import { i as builtinWorkflowFile, n as pendingDecisions, r as builtinProblem, t as answerDecision } from "./decide-CK_-lI5V.mjs";
6
+ import { n as newRunId, t as findRun } from "./find-DWiDJ5Lc.mjs";
7
+ import { a as write, c as openStore, i as style, l as storePath, n as cost, o as writeErr, s as nodeOf, t as confirm } from "./output-BhYkshYq.mjs";
8
+ import { n as listOrkWorktrees, t as createdWorktrees } from "./list-BE02pCZ9.mjs";
9
+ import { a as planClean, t as applyClean } from "./clean-DYVmLkd4.mjs";
9
10
  import { c as subcommandsOf, i as argsOf, n as groupedEntries, o as publicArgs, s as resolved, t as groupOf } from "./help-groups-BwYoAWsh.mjs";
10
- import { a as formatRunEvent, i as formatEvent, n as formatRuns, o as createTerminalHuman, r as formatTree, t as ago } from "./format-D87bY6Ud.mjs";
11
- import { c as registeredProjects, i as refusedBuiltin, n as WORKFLOW_SUFFIX, o as workflowArg, s as projectAt, t as WORKFLOW_DIR } from "./workflows-C5hYAVcE.mjs";
12
- import { a as validate, c as warningLines, i as loadWorkflow, o as validateFile, r as formatReport, s as walkLoaded, t as context } from "./context-mCAwzFFM.mjs";
13
- import { i as runLimits, r as limitsRefusal, t as chatNotice } from "./limits-RzKQ_zPk.mjs";
14
- import { _ as resultOf, a as builtinExecutors, d as maskedEnv, f as maskedNamesOfRun, g as clearOutputFiles, h as sessionEnv, i as onPath, l as clearStateFiles, m as runScrubber, n as missingProgramMessage, r as missingPrograms, t as envProblems } from "./src-XDSRnAZV.mjs";
15
- import { i as decideRefusal, n as chatRefusal } from "./in-a-run-Bs4Wv-Cz.mjs";
11
+ import { _ as namedMcpEntries, a as builtinExecutors, d as maskedEnv, f as maskedNamesOfRun, g as clearOutputFiles, h as sessionEnv, i as onPath, l as clearStateFiles, m as runScrubber, n as missingProgramMessage, r as missingPrograms, t as envProblems, v as resultOf } from "./src-HxtJOMRr.mjs";
12
+ import { c as registeredProjects, i as refusedBuiltin, n as WORKFLOW_SUFFIX, o as workflowArg, s as projectAt, t as WORKFLOW_DIR } from "./workflows-1sntXqSd.mjs";
13
+ import { a as validate, c as warningLines, i as loadWorkflow, o as validateFile, r as formatReport, s as walkLoaded, t as context } from "./context-CepHRoj9.mjs";
14
+ import { i as runLimits, r as limitsRefusal, t as chatNotice } from "./limits-CwzPe9wZ.mjs";
15
+ import { i as decideRefusal, n as chatRefusal } from "./in-a-run-CKFIeMpU.mjs";
16
16
  import path from "node:path";
17
17
  import { stringify } from "yaml";
18
18
  import { z } from "zod";
@@ -53,198 +53,6 @@ const readyDriver = (checks) => {
53
53
  ready: ready.length
54
54
  };
55
55
  };
56
- // ../core/src/control/queue.ts
57
- const PERMISSION_OPTIONS = [{
58
- id: "allow",
59
- label: "Allow"
60
- }, {
61
- id: "deny",
62
- label: "Deny"
63
- }];
64
- const DENIED = "The user did not allow this tool.";
65
- /** The deny message a session gets, with the person's words when given. */
66
- const deniedMessage = (note) => note === void 0 ? DENIED : `${DENIED} They said: ${note}`;
67
- /** At most `max` characters of a tool's input, for the decision's context. */
68
- const inputPreview = (input, max = 400) => {
69
- const json = JSON.stringify(input);
70
- return json.length > max ? `${json.slice(0, max - 1)}…` : json;
71
- };
72
- const createDecisionQueue = (options) => {
73
- const { store, runId, emit } = options;
74
- let count = 0;
75
- /** Opens a decision and settles it with the first answer. */
76
- const decide = (open, local, withdrawn) => {
77
- count += 1;
78
- const id = `${runId}-${String(count)}`;
79
- const record = store.openDecision({
80
- ...open,
81
- id,
82
- runId
83
- });
84
- const event = {
85
- type: "decision.opened",
86
- node: record.node,
87
- decision: id,
88
- kind: record.kind,
89
- question: record.question,
90
- options: record.options
91
- };
92
- if (record.recommended !== void 0) event.recommended = record.recommended;
93
- if (record.owner !== void 0) event.owner = record.owner;
94
- emit(event);
95
- const { promise, resolve, reject } = Promise.withResolvers();
96
- const settled = new AbortController();
97
- /** `note` is the stored one: masked, and absent when blank. */
98
- const finish = (answer, by, note) => {
99
- if (settled.signal.aborted) return;
100
- settled.abort();
101
- const answered = {
102
- type: "decision.answered",
103
- node: open.node,
104
- decision: id,
105
- answer,
106
- by
107
- };
108
- if (note !== void 0) answered.note = note;
109
- emit(answered);
110
- resolve(note === void 0 ? {
111
- answer,
112
- by
113
- } : {
114
- answer,
115
- by,
116
- note
117
- });
118
- };
119
- const withdraw = () => {
120
- if (settled.signal.aborted) return;
121
- settled.abort();
122
- store.withdrawDecision(id);
123
- emit({
124
- type: "decision.withdrawn",
125
- node: open.node,
126
- decision: id
127
- });
128
- reject(/* @__PURE__ */ new Error("the question was withdrawn"));
129
- };
130
- if (withdrawn?.aborted === true) withdraw();
131
- withdrawn?.addEventListener("abort", withdraw, { once: true });
132
- const fromStore = async () => {
133
- try {
134
- const closed = await options.waitFor(id, settled.signal);
135
- if (closed.status === "answered" && closed.answer !== void 0) finish(closed.answer, closed.answeredBy ?? "decide", closed.note);
136
- } catch {}
137
- };
138
- const fromTerminal = async (ask) => {
139
- try {
140
- const { answer, note } = await ask(settled.signal);
141
- if (store.answerDecision(id, answer, "terminal", note)) finish(answer, "terminal", store.decision(id)?.note);
142
- } catch {}
143
- };
144
- fromStore();
145
- if (local !== void 0) fromTerminal(local);
146
- return promise;
147
- };
148
- return {
149
- ask: (question) => {
150
- const open = {
151
- node: question.nodeId,
152
- kind: "question",
153
- question: question.question,
154
- options: question.options
155
- };
156
- if (question.recommended !== void 0) open.recommended = question.recommended;
157
- if (question.context !== void 0) open.context = question.context;
158
- if (question.owner !== void 0) open.owner = question.owner;
159
- const { local } = options;
160
- return decide(open, local === void 0 ? void 0 : (signal) => {
161
- let note;
162
- return local.ask({
163
- ...question,
164
- signal,
165
- onNote: (given) => {
166
- note = given;
167
- }
168
- }).then((answer) => note === void 0 ? { answer } : {
169
- answer,
170
- note
171
- });
172
- }, question.signal).then(({ answer, note }) => {
173
- if (note !== void 0) question.onNote?.(note);
174
- return answer;
175
- });
176
- },
177
- settled: (question) => {
178
- count += 1;
179
- const id = `${runId}-${String(count)}`;
180
- const { owner } = question;
181
- const record = store.openDecision({
182
- id,
183
- runId,
184
- node: question.nodeId,
185
- kind: "question",
186
- question: question.question,
187
- options: question.options,
188
- owner,
189
- ...question.recommended === void 0 ? {} : { recommended: question.recommended },
190
- ...question.context === void 0 ? {} : { context: question.context }
191
- });
192
- emit({
193
- type: "decision.opened",
194
- node: record.node,
195
- decision: id,
196
- kind: "question",
197
- question: record.question,
198
- options: record.options,
199
- owner,
200
- ...record.recommended === void 0 ? {} : { recommended: record.recommended }
201
- });
202
- store.answerDecision(id, question.answer, "owner", question.note);
203
- const note = store.decision(id)?.note;
204
- emit({
205
- type: "decision.answered",
206
- node: record.node,
207
- decision: id,
208
- answer: question.answer,
209
- by: "owner",
210
- owner,
211
- ...note === void 0 ? {} : { note }
212
- });
213
- },
214
- permit: async (request) => {
215
- const { local } = options;
216
- let localMessage = DENIED;
217
- const { answer, note } = await decide({
218
- node: request.nodeId,
219
- kind: "permission",
220
- question: `Allow ${request.toolName}?`,
221
- options: PERMISSION_OPTIONS,
222
- context: inputPreview(request.input)
223
- }, local === void 0 ? void 0 : (signal) => {
224
- let said;
225
- return local.permit({
226
- ...request,
227
- signal,
228
- onNote: (given) => {
229
- said = given;
230
- }
231
- }).then((result) => {
232
- if (!result.allow) localMessage = result.message;
233
- const choice = result.allow ? "allow" : "deny";
234
- return said === void 0 ? { answer: choice } : {
235
- answer: choice,
236
- note: said
237
- };
238
- });
239
- });
240
- if (note !== void 0) request.onNote?.(note);
241
- return answer === "allow" ? { allow: true } : {
242
- allow: false,
243
- message: note === void 0 ? localMessage : deniedMessage(note)
244
- };
245
- }
246
- };
247
- };
248
56
  // ../core/src/control/control.ts
249
57
  const startControl = async (options) => {
250
58
  const { store, runId } = options;
@@ -1064,6 +872,8 @@ const resumeChat = async (options) => {
1064
872
  ...template === void 0 ? {} : { template }
1065
873
  });
1066
874
  if (!plan.ok) return plan.error;
875
+ const servers = namedMcpEntries(run.project, plan.mcp);
876
+ if (!servers.ok) return servers.error;
1067
877
  let driver = options.driver ?? session.driver ?? plan.driver;
1068
878
  if (driver === void 0) {
1069
879
  const ready = readyDriver(await (options.driverChecks ?? checksHere)());
@@ -1079,6 +889,7 @@ const resumeChat = async (options) => {
1079
889
  });
1080
890
  const started = (await options.runtime(driver)).start({
1081
891
  ...plan.spec,
892
+ ...servers.value,
1082
893
  resume: session.sessionId,
1083
894
  prompt: options.body,
1084
895
  ...machineClaudeOf(events)
@@ -1195,6 +1006,8 @@ const runNode = async (options) => {
1195
1006
  pluginDir: path.join(runDir, "plugins", options.nodeId)
1196
1007
  });
1197
1008
  if (!plan.ok) return failed([plan.error]);
1009
+ const servers = namedMcpEntries(projectRoot, plan.mcp);
1010
+ if (!servers.ok) return failed([servers.error]);
1198
1011
  const named = sessionDriver({
1199
1012
  override: options.driver,
1200
1013
  named: plan.driver
@@ -1268,7 +1081,10 @@ const runNode = async (options) => {
1268
1081
  });
1269
1082
  const runtime = await options.runtime(driver);
1270
1083
  if (options.machineClaude === true) plan.spec.machineClaude = true;
1271
- const session = runtime.start(plan.spec, {
1084
+ const session = runtime.start({
1085
+ ...plan.spec,
1086
+ ...servers.value
1087
+ }, {
1272
1088
  human: control.human,
1273
1089
  ...graph === null ? {} : { feedback: createFeedback({
1274
1090
  graph,
@@ -1714,7 +1530,7 @@ const flagValues = (rawArgs, flag) => {
1714
1530
  };
1715
1531
  const isDriver = (value) => CLAUDE_DRIVERS.some((d) => d.id === value);
1716
1532
  /** Loads the drivers only when a run starts, so other commands stay fast. */
1717
- const loadRuntime = async (driver) => (await import("./src-LSxjnWDH.mjs")).createRuntime(driver, sessionEnv(process.env));
1533
+ const loadRuntime = async (driver) => (await import("./src-CxZr4Bp2.mjs")).createRuntime(driver, sessionEnv(process.env));
1718
1534
  /**
1719
1535
  * Ctrl-C asks the run to stop, and so does a terminal closing or a polite kill,
1720
1536
  * so that the run ends tidily and leaves no result unscrubbed.
@@ -2045,7 +1861,8 @@ const chat = defineCommand({
2045
1861
  * writes to the store, then wakes the run on its socket; specs/messaging.md).
2046
1862
  * `--say` gives the answer a note, which goes to the run with it. With `--id`
2047
1863
  * and `--choose`, `--note` and `--rating` instead note how the decision's
2048
- * node went, as the run's feedback (specs/feedback.md).
1864
+ * node went, as the run's feedback (specs/feedback.md). `--document` prints
1865
+ * what a gate gave to read beside its question.
2049
1866
  */
2050
1867
  const failed$2 = (message) => {
2051
1868
  writeErr(message);
@@ -2084,7 +1901,7 @@ const saidLine = (store, id) => {
2084
1901
  return note === void 0 ? "" : style("dim", ` · said: ${note}`);
2085
1902
  };
2086
1903
  /** One line per open decision, for `--list`. */
2087
- const formatDecisions = (decisions) => decisions.length === 0 ? ["No open decisions."] : decisions.map((d) => `${style("bold", d.id)} ${style("cyan", d.node)}${d.owner === void 0 ? "" : style("dim", ` via ${d.owner}`)} ${d.question} ${style("dim", `[${d.options.map((o) => o.id === d.recommended ? `${o.id}*` : o.id).join(", ")}]`)}`);
1904
+ const formatDecisions = (decisions, workflow) => decisions.length === 0 ? [workflow === void 0 ? "No open decisions." : `No open decisions in workflow ${workflow}.`] : decisions.map((d) => `${style("bold", d.id)} ${style("cyan", d.node)}${d.owner === void 0 ? "" : style("dim", ` via ${d.owner}`)} ${d.question} ${d.document === void 0 ? "" : `${style("dim", "+document")} `}${style("dim", `[${d.options.map((o) => o.id === d.recommended ? `${o.id}*` : o.id).join(", ")}]`)}`);
2088
1905
  const decide = defineCommand({
2089
1906
  meta: {
2090
1907
  name: "decide",
@@ -2111,6 +1928,15 @@ const decide = defineCommand({
2111
1928
  description: "List them as JSON",
2112
1929
  default: false
2113
1930
  },
1931
+ workflow: {
1932
+ type: "string",
1933
+ description: "Only the decisions of this workflow's runs"
1934
+ },
1935
+ document: {
1936
+ type: "boolean",
1937
+ description: "Print the document of the decision --id names",
1938
+ default: false
1939
+ },
2114
1940
  id: {
2115
1941
  type: "string",
2116
1942
  description: "Answer this decision…"
@@ -2133,7 +1959,7 @@ const decide = defineCommand({
2133
1959
  }
2134
1960
  },
2135
1961
  run: async ({ args }) => {
2136
- const refusal = args.id !== void 0 || args.choose !== void 0 || process.stdin.isTTY && !args.list && !args.json ? decideRefusal() : null;
1962
+ const refusal = !args.document && (args.id !== void 0 || args.choose !== void 0 || process.stdin.isTTY && !args.list && !args.json) ? decideRefusal() : null;
2137
1963
  if (refusal !== null) {
2138
1964
  failed$2(refusal);
2139
1965
  return;
@@ -2145,6 +1971,16 @@ const decide = defineCommand({
2145
1971
  interactive: process.stdin.isTTY
2146
1972
  });
2147
1973
  try {
1974
+ if (args.document) {
1975
+ if (args.id === void 0 || args.choose !== void 0) {
1976
+ failed$2("--document goes with --id, without --choose.");
1977
+ return;
1978
+ }
1979
+ const { document } = store.decision(args.id) ?? {};
1980
+ if (document === void 0) failed$2(`${args.id} has no document.`);
1981
+ else write(document);
1982
+ return;
1983
+ }
2148
1984
  if (args.id !== void 0 || args.choose !== void 0) {
2149
1985
  if (args.id === void 0 || args.choose === void 0) {
2150
1986
  failed$2("--id and --choose go together.");
@@ -2176,6 +2012,7 @@ const decide = defineCommand({
2176
2012
  return;
2177
2013
  }
2178
2014
  const filter = {};
2015
+ if (args.workflow !== void 0) filter.workflow = args.workflow;
2179
2016
  if (args.run !== void 0 && args.run !== "") {
2180
2017
  const found = findRun(store, args.run, process.cwd());
2181
2018
  if (!found.ok) {
@@ -2190,7 +2027,7 @@ const decide = defineCommand({
2190
2027
  return;
2191
2028
  }
2192
2029
  if (args.list || !process.stdin.isTTY || open.length === 0) {
2193
- for (const line of formatDecisions(open)) write(line);
2030
+ for (const line of formatDecisions(open, args.workflow)) write(line);
2194
2031
  return;
2195
2032
  }
2196
2033
  for (const d of open) {
@@ -2202,6 +2039,7 @@ const decide = defineCommand({
2202
2039
  };
2203
2040
  if (d.recommended !== void 0) question.recommended = d.recommended;
2204
2041
  if (d.context !== void 0) question.context = d.context;
2042
+ if (d.document !== void 0) question.document = d.document;
2205
2043
  let note;
2206
2044
  question.onNote = (given) => {
2207
2045
  note = given;
@@ -4607,27 +4445,27 @@ const main = defineCommand({
4607
4445
  ps,
4608
4446
  logs,
4609
4447
  tree,
4610
- usage: () => import("./usage-bNdcBcj9.mjs").then((module) => module.usage),
4611
- prune: () => import("./usage-bNdcBcj9.mjs").then((module) => module.prune),
4448
+ usage: () => import("./usage-BcLUZ1xw.mjs").then((module) => module.usage),
4449
+ prune: () => import("./usage-BcLUZ1xw.mjs").then((module) => module.prune),
4612
4450
  decide,
4613
- relay: () => import("./relay-BLnjMdjT.mjs").then((module) => module.relay),
4614
- pause: () => import("./pause-B5Z41lR3.mjs").then((module) => module.pause),
4615
- continue: () => import("./pause-B5Z41lR3.mjs").then((module) => module.continueRun),
4451
+ relay: () => import("./relay-COCvG-0I.mjs").then((module) => module.relay),
4452
+ pause: () => import("./pause-C_Q0W6iX.mjs").then((module) => module.pause),
4453
+ continue: () => import("./pause-C_Q0W6iX.mjs").then((module) => module.continueRun),
4616
4454
  stop,
4617
4455
  chat,
4618
- send: () => import("./send-CJKEhBL1.mjs").then((module) => module.send),
4456
+ send: () => import("./send-OVpRei_5.mjs").then((module) => module.send),
4619
4457
  resume,
4620
4458
  feedback,
4621
4459
  context,
4622
- worktrees: () => import("./worktrees-BQFcpYz1.mjs").then((module) => module.worktrees),
4623
- wt: () => import("./worktrees-BQFcpYz1.mjs").then((module) => module.worktrees),
4624
- watch: () => import("./watch-EhlO304A.mjs").then((module) => module.watch),
4625
- mcp: () => import("./mcp-DKrrxowo.mjs").then((module) => module.mcp),
4626
- ui: () => import("./ui-fvrO7Gxd.mjs").then((module) => module.ui),
4460
+ worktrees: () => import("./worktrees-B_Go_A9w.mjs").then((module) => module.worktrees),
4461
+ wt: () => import("./worktrees-B_Go_A9w.mjs").then((module) => module.worktrees),
4462
+ watch: () => import("./watch-Buyn0Mhz.mjs").then((module) => module.watch),
4463
+ mcp: () => import("./mcp-DMuBbUHU.mjs").then((module) => module.mcp),
4464
+ ui: () => import("./ui-Dz_qfUOz.mjs").then((module) => module.ui),
4627
4465
  doctor,
4628
4466
  upgrade,
4629
- completion: () => import("./completion-Cga01yQP.mjs").then((module) => module.completion),
4630
- __complete: () => import("./completion-Cga01yQP.mjs").then((module) => module.completeCommand(main))
4467
+ completion: () => import("./completion-BVx917Yr.mjs").then((module) => module.completion),
4468
+ __complete: () => import("./completion-BVx917Yr.mjs").then((module) => module.completeCommand(main))
4631
4469
  }
4632
4470
  });
4633
4471
  // src/bin.ts
@@ -4645,7 +4483,7 @@ const main = defineCommand({
4645
4483
  clearGitLocalEnv();
4646
4484
  const argv = process.argv.slice(2);
4647
4485
  if (argv[0] === "__complete") {
4648
- const { printCompletions } = await import("./completion-Cga01yQP.mjs");
4486
+ const { printCompletions } = await import("./completion-BVx917Yr.mjs");
4649
4487
  await printCompletions(main, argv.slice(1));
4650
4488
  } else if (process.env["ORK_UPDATE_CHECK_CHILD"] === "1") await runUpdateChild();
4651
4489
  else {
@@ -1,4 +1,4 @@
1
- import { A as gitOk, O as removeWorktree } from "./src-DnETlJ1r.mjs";
1
+ import { A as gitOk, O as removeWorktree } from "./src-Do_MhwiV.mjs";
2
2
  // ../core/src/worktree/clean.ts
3
3
  /**
4
4
  * @file What `ork worktrees clean` and `ork worktrees remove` do with what
@@ -1,9 +1,9 @@
1
- import { Qn as NodeIdSchema, ar as CLAUDE_DRIVERS, bn as placeFiles, ht as liveStatus, xn as placeFor } from "./src-DnETlJ1r.mjs";
2
- import { a as builtinWorkflowNames, n as pendingDecisions, o as builtinWorkflowText, s as isBuiltinArg } from "./decide-BvZnKErW.mjs";
3
- import { t as findRun } from "./find-CbetS8I2.mjs";
4
- import { c as openStore, l as storePath, o as writeErr } from "./output-Q3TZ-Ave.mjs";
1
+ import { Cn as placeFiles, cr as CLAUDE_DRIVERS, ht as liveStatus, tr as NodeIdSchema, wn as placeFor } from "./src-Do_MhwiV.mjs";
2
+ import { a as builtinWorkflowNames, n as pendingDecisions, o as builtinWorkflowText, s as isBuiltinArg } from "./decide-CK_-lI5V.mjs";
3
+ import { t as findRun } from "./find-DWiDJ5Lc.mjs";
4
+ import { c as openStore, l as storePath, o as writeErr } from "./output-BhYkshYq.mjs";
5
5
  import { a as findEntry, c as subcommandsOf, d as SHELL_SCRIPTS, l as COMPLETE_COMMAND, n as groupedEntries, r as argInfoOf, t as groupOf, u as SHELLS } from "./help-groups-BwYoAWsh.mjs";
6
- import { a as resolveWorkflowArg, n as WORKFLOW_SUFFIX } from "./workflows-C5hYAVcE.mjs";
6
+ import { a as resolveWorkflowArg, n as WORKFLOW_SUFFIX } from "./workflows-1sntXqSd.mjs";
7
7
  import path from "node:path";
8
8
  import { parse } from "yaml";
9
9
  import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
@@ -1,6 +1,6 @@
1
- import { C as workflowTextHash, Ct as walkChecks, On as LESSON_CAP_TOKENS, S as readProjectTriggers, St as checkWorkflowText, Tn as workflowDirOf, bn as placeFiles, lt as explainSession, wt as walkSummary, xn as placeFor } from "./src-DnETlJ1r.mjs";
2
- import { a as write, i as style, r as plain } from "./output-Q3TZ-Ave.mjs";
3
- import { c as registeredProjects, i as refusedBuiltin, o as workflowArg, r as findWorkflowFiles, s as projectAt } from "./workflows-C5hYAVcE.mjs";
1
+ import { C as workflowTextHash, Cn as placeFiles, Ct as walkChecks, On as workflowDirOf, S as readProjectTriggers, St as checkWorkflowText, jn as LESSON_CAP_TOKENS, lt as explainSession, wn as placeFor, wt as walkSummary } from "./src-Do_MhwiV.mjs";
2
+ import { a as write, i as style, r as plain } from "./output-BhYkshYq.mjs";
3
+ import { c as registeredProjects, i as refusedBuiltin, o as workflowArg, r as findWorkflowFiles, s as projectAt } from "./workflows-1sntXqSd.mjs";
4
4
  import path from "node:path";
5
5
  import { readFileSync } from "node:fs";
6
6
  import { defineCommand } from "citty";
@@ -1,4 +1,4 @@
1
- import { An as guardedBase, Mn as writePlainFile, an as wakeRun, bn as placeFiles, ht as liveStatus, jn as plainPathInside, rn as socketPath } from "./src-DnETlJ1r.mjs";
1
+ import { Cn as placeFiles, Fn as writePlainFile, Nn as guardedBase, Pn as plainPathInside, ht as liveStatus, in as socketPath, on as wakeRun } from "./src-Do_MhwiV.mjs";
2
2
  import path from "node:path";
3
3
  import { existsSync, readFileSync } from "node:fs";
4
4
  import { createHash } from "node:crypto";
@@ -69,7 +69,7 @@ const builtinWorkflowFile = (place, arg) => {
69
69
  * An answer goes to the store (the first one wins), then the run is woken on
70
70
  * its socket so it picks the answer up at once (specs/messaging.md).
71
71
  */
72
- /** Open decisions whose run is still live, oldest first. */
72
+ /** Open decisions whose run is still live, oldest first, ANDing the filter. */
73
73
  const pendingDecisions = (store, filter) => {
74
74
  const live = /* @__PURE__ */ new Map();
75
75
  return store.decisions({
@@ -78,7 +78,7 @@ const pendingDecisions = (store, filter) => {
78
78
  }).filter((decision) => {
79
79
  if (!live.has(decision.runId)) {
80
80
  const [run] = store.lookup(decision.runId);
81
- live.set(decision.runId, run !== void 0 && liveStatus(run) === "running");
81
+ live.set(decision.runId, run !== void 0 && liveStatus(run) === "running" && (filter.workflow === void 0 || run.workflow === filter.workflow));
82
82
  }
83
83
  return live.get(decision.runId) === true;
84
84
  });
@@ -1,4 +1,4 @@
1
- import { xn as placeFor } from "./src-DnETlJ1r.mjs";
1
+ import { wn as placeFor } from "./src-Do_MhwiV.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  // ../core/src/remote/find.ts
4
4
  /**