@krapht/ork 1.0.0-alpha.20 → 1.0.0-alpha.21
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.
- package/dist/{__build_info__-D6mXC4cD.mjs → __build_info__-0wqQ-rtf.mjs} +3 -51
- package/dist/{attach-C1OnxyMh.mjs → attach-C0-YyNoY.mjs} +6 -6
- package/dist/{attach-CEGbRg1D.mjs → attach-CAKNqnUK.mjs} +64 -35
- package/dist/bin.mjs +1426 -72
- package/dist/{brief-DH66xmj8.mjs → brief-C2hew8cS.mjs} +7 -6
- package/dist/{builtin-files-Cf-NZDqM.mjs → builtin-files-YYAnbZGD.mjs} +1 -1
- package/dist/{chips-BqcT58qr.mjs → chips-CP_pgKlj.mjs} +7 -2
- package/dist/{completion-DS0gCZRm.mjs → completion-K4rAVsrf.mjs} +6 -6
- package/dist/{context-CGPh12HV.mjs → context-B-fjPJky.mjs} +4 -4
- package/dist/context-DMK0U1w0.mjs +160 -0
- package/dist/{detached-Dakw5RZj.mjs → detached-q0AYG0Bs.mjs} +6 -5
- package/dist/{find-BTikxc54.mjs → find-Ct5CNl1J.mjs} +1 -1
- package/dist/{flags-C8yCq0j5.mjs → flags-C90N4J1i.mjs} +3 -3
- package/dist/{follow-ups-CtlhHbwe.mjs → follow-ups-D3HPyNYM.mjs} +14 -9
- package/dist/{format-BB4E-T6x.mjs → format-CiPhQqbX.mjs} +24 -13
- package/dist/{help-groups-BpRgBSTh.mjs → help-groups-BQvcKQ9H.mjs} +8 -3
- package/dist/{in-a-run-CbnKjO7t.mjs → in-a-run-D_wg4iJi.mjs} +2 -2
- package/dist/{install-CWcpX5g4.mjs → install-Hji6LIei.mjs} +50 -2
- package/dist/{limits-VQqsBoQk.mjs → limits-BD6RZRCS.mjs} +1 -1
- package/dist/{mcp-wGfkMCVF.mjs → mcp-CpbDmBLG.mjs} +6 -6
- package/dist/{once-BHxSdZz_.mjs → once-J8Qn5fTG.mjs} +4 -4
- package/dist/{output-B1kwo0YU.mjs → output-DXZbnFt_.mjs} +61 -42
- package/dist/{pause-C_Wxh-KM.mjs → pause-Cl4ZYA35.mjs} +4 -4
- package/dist/{print-DNYzq4Rr.mjs → print-DzugGZQB.mjs} +2 -2
- package/dist/{project-records-XY3ku95x.mjs → project-records-CtkmlsHN.mjs} +3 -3
- package/dist/{relay-BA6tsnpc.mjs → relay-CiP77vga.mjs} +2 -2
- package/dist/{run-Bvvg-fiF.mjs → run-CtuNY3mE.mjs} +1 -1
- package/dist/{send-nrKtak5F.mjs → send-DRYGks8K.mjs} +3 -4
- package/dist/short-flags-DkJLWVqh.mjs +1 -0
- package/dist/short-flags-Qf21as0E.mjs +83 -0
- package/dist/{src-D4JSymhK.mjs → src-BMFQKHz4.mjs} +32 -14
- package/dist/{src-CmEvHdju.mjs → src-BrFfDKux.mjs} +8 -7
- package/dist/{src-8cOPOgrT.mjs → src-BuF9Lbow.mjs} +77 -18
- package/dist/{src-I_RyKu6_.mjs → src-k0A_QpST.mjs} +5 -3
- package/dist/store-rTgRu8xy.mjs +25 -0
- package/dist/ui/assets/app-BYxpKJRh.css +1 -0
- package/dist/ui/assets/{app-BowhjEAe.js → app-SEFEJLkF.js} +8 -8
- package/dist/ui/assets/{index-CrMa2oHB.js → index-Cb6Voq_W.js} +2 -2
- package/dist/ui/index.html +1 -1
- package/dist/{ui-DY3Dnpho.mjs → ui-C2f37TSb.mjs} +9 -6
- package/dist/{usage-1VwSg_Qt.mjs → usage-BuvGcQSk.mjs} +6 -7
- package/dist/validate-ObP5lt29.mjs +1 -0
- package/dist/{validate-BxayjjkV.mjs → validate-_HjACtk9.mjs} +6 -6
- package/dist/{verdict-CMvPCpWC.mjs → verdict-B592j1W3.mjs} +2 -2
- package/dist/{watch-CT0EtLPZ.mjs → watch-DV3ixCYj.mjs} +7 -7
- package/dist/{workflows-DHHi-APg.mjs → workflows-QLjBhGNS.mjs} +3 -3
- package/dist/{worktrees-CZvbHzbN.mjs → worktrees-D3ubG_Qw.mjs} +6 -6
- package/dist/yolo-BSH1E_kE.mjs +33 -0
- package/package.json +1 -1
- package/dist/run-DBUAq-Uu.mjs +0 -1452
- package/dist/store-CDpk8Wtz.mjs +0 -16
- package/dist/ui/assets/app--FijEXiJ.css +0 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { n as newRunId } from "./find-
|
|
4
|
-
import { l as writeErr } from "./output-
|
|
5
|
-
import { t as loadWorkflow } from "./validate-
|
|
1
|
+
import { gr as runGh } from "./src-BuF9Lbow.mjs";
|
|
2
|
+
import { a as refreshDue, c as heldNote, l as takeFollowUps, n as checkTakeable, o as runIsLive, s as availableDue, t as briefOf } from "./context-DMK0U1w0.mjs";
|
|
3
|
+
import { n as newRunId } from "./find-Ct5CNl1J.mjs";
|
|
4
|
+
import { l as writeErr } from "./output-DXZbnFt_.mjs";
|
|
5
|
+
import { t as loadWorkflow } from "./validate-_HjACtk9.mjs";
|
|
6
|
+
import { n as flagValues } from "./short-flags-Qf21as0E.mjs";
|
|
6
7
|
// src/follow-ups/brief.ts
|
|
7
8
|
/**
|
|
8
9
|
* @file `ork run --follow-ups <ids>`: the `agent` follow-ups become the run's
|
|
@@ -61,7 +62,7 @@ const problemsOf = (loaded, inputs) => {
|
|
|
61
62
|
* folder, and the run it starts marks them.
|
|
62
63
|
*/
|
|
63
64
|
const prepareFollowUps = async (store, rawArgs, runId, target, gh = runGh, mark = true) => {
|
|
64
|
-
const inputs = flagValues(rawArgs, "
|
|
65
|
+
const inputs = flagValues(rawArgs, "input");
|
|
65
66
|
const plain = {
|
|
66
67
|
inputs,
|
|
67
68
|
...runId === void 0 ? {} : { runId }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Kr as placeFiles, ii as writePlainFile, ni as guardedBase, ri as plainPathInside } from "./src-BuF9Lbow.mjs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { D as apply, E as NODE_PALETTE, T as CHIP } from "./output-DXZbnFt_.mjs";
|
|
2
2
|
// src/term/chips.ts
|
|
3
3
|
/** The chip words the kit's commands use. */
|
|
4
4
|
const CHIP_LABELS = {
|
|
@@ -25,6 +25,11 @@ const statusChip = (status) => {
|
|
|
25
25
|
role
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* The ASK chip of a question card, in the bright green of the card's bar, so a
|
|
30
|
+
* question reads apart from a run's other chips; `[ASK]` when plain.
|
|
31
|
+
*/
|
|
32
|
+
const askChip = (term) => term.rich ? apply(term, ["bgGreenBright", "black"], ` ${CHIP_LABELS.ask} `) : `[${CHIP_LABELS.ask}]`;
|
|
28
33
|
/** A chip: ` LABEL ` on the role's background; `[LABEL]` when plain. */
|
|
29
34
|
const chip = (term, label, role) => term.rich ? apply(term, CHIP[role], ` ${label} `) : `[${label}]`;
|
|
30
35
|
/** A stable non-negative number for `text` (FNV-1a). */
|
|
@@ -40,4 +45,4 @@ const nodeChip = (term, id) => {
|
|
|
40
45
|
const format = NODE_PALETTE[nodeSlot(id)] ?? CHIP.muted;
|
|
41
46
|
return term.rich ? apply(term, format, ` ${id} `) : `[${id}]`;
|
|
42
47
|
};
|
|
43
|
-
export { statusChip as i,
|
|
48
|
+
export { statusChip as a, nodeChip as i, askChip as n, chip as r, CHIP_LABELS as t };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as isBuiltinArg, i as builtinWorkflowText, r as builtinWorkflowNames } from "./builtin-files-
|
|
3
|
-
import { t as findRun } from "./find-
|
|
4
|
-
import { a as SHELL_SCRIPTS, i as SHELLS, n as groupedEntries, r as COMPLETE_COMMAND, t as groupOf } from "./help-groups-
|
|
1
|
+
import { Ei as NodeIdSchema, Kr as placeFiles, Pn as liveStatus, R as openStore, Ri as AGENT_DRIVERS, qr as placeFor, st as pendingDecisions, z as storePath } from "./src-BuF9Lbow.mjs";
|
|
2
|
+
import { a as isBuiltinArg, i as builtinWorkflowText, r as builtinWorkflowNames } from "./builtin-files-YYAnbZGD.mjs";
|
|
3
|
+
import { t as findRun } from "./find-Ct5CNl1J.mjs";
|
|
4
|
+
import { a as SHELL_SCRIPTS, i as SHELLS, n as groupedEntries, r as COMPLETE_COMMAND, t as groupOf } from "./help-groups-BQvcKQ9H.mjs";
|
|
5
5
|
import { o as subcommandsOf, r as findEntry, t as argInfoOf } from "./command-tree-CEkzWNy6.mjs";
|
|
6
|
-
import { l as writeErr } from "./output-
|
|
7
|
-
import { n as WORKFLOW_SUFFIX, o as resolveWorkflowArg } from "./workflows-
|
|
6
|
+
import { l as writeErr } from "./output-DXZbnFt_.mjs";
|
|
7
|
+
import { n as WORKFLOW_SUFFIX, o as resolveWorkflowArg } from "./workflows-QLjBhGNS.mjs";
|
|
8
8
|
import path from "node:path";
|
|
9
9
|
import { parse } from "yaml";
|
|
10
10
|
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as write, s as style } from "./output-
|
|
3
|
-
import { a as refusedBuiltin, s as workflowArg } from "./workflows-
|
|
4
|
-
import { a as formatReport, t as loadWorkflow } from "./validate-
|
|
1
|
+
import { bt as explainSession, ei as LESSON_CAP_TOKENS } from "./src-BuF9Lbow.mjs";
|
|
2
|
+
import { c as write, s as style } from "./output-DXZbnFt_.mjs";
|
|
3
|
+
import { a as refusedBuiltin, s as workflowArg } from "./workflows-QLjBhGNS.mjs";
|
|
4
|
+
import { a as formatReport, t as loadWorkflow } from "./validate-_HjACtk9.mjs";
|
|
5
5
|
import { defineCommand } from "citty";
|
|
6
6
|
// src/commands/context.ts
|
|
7
7
|
/**
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { $n as findFollowUp, Kr as placeFiles, Pn as liveStatus, Sn as deliverFollowUp, Yn as loadProject, gr as runGh, vn as checkFollowUpsDue } from "./src-BuF9Lbow.mjs";
|
|
2
|
+
// ../core/src/follow-ups/take.ts
|
|
3
|
+
const put = (rows, f, run, at) => {
|
|
4
|
+
const next = {
|
|
5
|
+
...f,
|
|
6
|
+
takenBy: run,
|
|
7
|
+
updatedAt: at
|
|
8
|
+
};
|
|
9
|
+
rows.putFollowUp(next);
|
|
10
|
+
return next;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Why `f` is held by the run that took it, as the end of `taken by run <id>,
|
|
14
|
+
* <note>`; `undefined` when it is free. A run the store does not know counts as
|
|
15
|
+
* live while the mark is recent, so a run that fails its preflight frees its
|
|
16
|
+
* follow-ups when the window ends.
|
|
17
|
+
*/
|
|
18
|
+
const heldNote = (f, isLive, now) => {
|
|
19
|
+
if (f.takenBy === void 0) return void 0;
|
|
20
|
+
const live = isLive(f.takenBy);
|
|
21
|
+
if (live !== void 0) return live ? "still running" : void 0;
|
|
22
|
+
return now - Date.parse(f.updatedAt) < 12e4 ? "not started yet; free in under 2 minutes" : void 0;
|
|
23
|
+
};
|
|
24
|
+
/** Whether another run holds `f`: it is not free to take again. */
|
|
25
|
+
const heldByLive = (f, run, isLive, now) => f.takenBy !== run && heldNote(f, isLive, now) !== void 0;
|
|
26
|
+
/**
|
|
27
|
+
* The project's due `agent` follow-ups no live run has taken (`ids`), and those
|
|
28
|
+
* a live run holds (`held`), so a second `--follow-ups due` doesn't take them
|
|
29
|
+
* twice.
|
|
30
|
+
*/
|
|
31
|
+
const availableDue = (rows, project, isLive, run = "", now = () => (/* @__PURE__ */ new Date()).toISOString()) => {
|
|
32
|
+
const at = Date.parse(now());
|
|
33
|
+
const due = rows.followUps(project).filter((f) => f.for === "agent" && f.status === "due");
|
|
34
|
+
return {
|
|
35
|
+
ids: due.filter((f) => !heldByLive(f, run, isLive, at)).map((f) => f.id),
|
|
36
|
+
held: due.filter((f) => heldByLive(f, run, isLive, at))
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* `ork run start --follow-ups <ids>`: the open `agent` follow-ups among `ids`
|
|
41
|
+
* become `run`'s brief; why each other id wasn't taken. One a live run took is
|
|
42
|
+
* refused; one a finished, failed or crashed run took can be taken again.
|
|
43
|
+
*/
|
|
44
|
+
const takeFollowUps = (rows, taking, now = () => (/* @__PURE__ */ new Date()).toISOString()) => {
|
|
45
|
+
const taken = [];
|
|
46
|
+
const refused = [];
|
|
47
|
+
const at = Date.parse(now());
|
|
48
|
+
for (const id of taking.ids) {
|
|
49
|
+
const f = rows.followUp(taking.project, id);
|
|
50
|
+
if (f === void 0) refused.push(`${id}: there is no such follow-up`);
|
|
51
|
+
else if (f.for !== "agent") refused.push(`${id}: it is for ${f.for}`);
|
|
52
|
+
else if (f.status === "done" || f.status === "dropped") refused.push(`${id}: it is ${f.status}`);
|
|
53
|
+
else {
|
|
54
|
+
const note = f.takenBy === taking.run ? void 0 : heldNote(f, taking.isLive, at);
|
|
55
|
+
if (note === void 0) taken.push(put(rows, f, taking.run, now()));
|
|
56
|
+
else refused.push(`${id}: taken by run ${f.takenBy}, ${note}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
taken,
|
|
61
|
+
refused
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
// src/follow-ups/context.ts
|
|
65
|
+
/**
|
|
66
|
+
* @file What `ork follow-ups` and a run share: the project's `followUps` rule,
|
|
67
|
+
* the sink a run hands its sessions' `follow_up` tool, the due check that
|
|
68
|
+
* runs before every call (a `gh` that fails only warns), and the follow-ups
|
|
69
|
+
* `ork run --follow-ups` takes as a run's brief.
|
|
70
|
+
*/
|
|
71
|
+
/** The project's `followUps` rule, when it sets one. */
|
|
72
|
+
const followUpsRule = (place) => loadProject(place.root, placeFiles(place).rules).project?.followUps;
|
|
73
|
+
/** What a run hands its sessions: each `follow_up` call, kept as the rule says. */
|
|
74
|
+
const followUpSink = (options) => (input, at) => {
|
|
75
|
+
const rule = followUpsRule(options.place);
|
|
76
|
+
return deliverFollowUp(input, {
|
|
77
|
+
store: options.store,
|
|
78
|
+
project: options.place.root,
|
|
79
|
+
worktree: at.cwd,
|
|
80
|
+
...rule === void 0 ? {} : { rule },
|
|
81
|
+
...options.home === void 0 ? {} : { home: options.home },
|
|
82
|
+
...options.gh === void 0 ? {} : { gh: options.gh }
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
/** Gh's own words when it has no login. */
|
|
86
|
+
const SIGNED_OUT = /not logged in|gh auth login/iu;
|
|
87
|
+
/**
|
|
88
|
+
* A gh error's first line, without a trailing period, so the notice is one
|
|
89
|
+
* line.
|
|
90
|
+
*/
|
|
91
|
+
const oneLine = (error) => (error.trim().split("\n")[0] ?? "").trim().replace(/\.$/u, "");
|
|
92
|
+
/**
|
|
93
|
+
* Moves the project's follow-ups whose time has come to due, as every `ork
|
|
94
|
+
* follow-ups` call does first. `gh` failing only warns, through `warn`: one
|
|
95
|
+
* line per call, however many refs failed.
|
|
96
|
+
*/
|
|
97
|
+
const refreshDue = async (store, project, warn, gh = runGh) => {
|
|
98
|
+
try {
|
|
99
|
+
const checked = await checkFollowUpsDue({
|
|
100
|
+
rows: store,
|
|
101
|
+
project,
|
|
102
|
+
gh
|
|
103
|
+
});
|
|
104
|
+
const [first] = checked.errors;
|
|
105
|
+
if (first !== void 0) warn(checked.errors.some((error) => SIGNED_OUT.test(error)) ? "Can't check PRs: `gh` isn't signed in. After-merge follow-ups stay waiting; run `gh auth login` yourself." : `Can't check PRs: ${oneLine(first)}. After-merge follow-ups stay waiting.`);
|
|
106
|
+
return checked.due;
|
|
107
|
+
} catch (error) {
|
|
108
|
+
warn(`couldn't check what is due: ${error instanceof Error ? error.message : String(error)}`);
|
|
109
|
+
return [];
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
/** The text a run starts from when it takes these follow-ups as its brief. */
|
|
113
|
+
const briefOf = (followUps) => ["Do these follow-ups left by earlier changes:", ...followUps.flatMap((f) => [
|
|
114
|
+
"",
|
|
115
|
+
`## ${f.title} (${f.id})`,
|
|
116
|
+
...f.body === "" ? [] : [f.body],
|
|
117
|
+
...f.where.length === 0 ? [] : [`Files: ${f.where.join(", ")}`]
|
|
118
|
+
])].join("\n");
|
|
119
|
+
/**
|
|
120
|
+
* Whether a run is going, as `ork ps` decides: running with its process alive.
|
|
121
|
+
* `undefined` for a run the store does not know yet: core holds its mark for a
|
|
122
|
+
* short while, as the run may be about to begin.
|
|
123
|
+
*/
|
|
124
|
+
const runIsLive = (store) => (runId) => {
|
|
125
|
+
const [run] = store.lookup(runId);
|
|
126
|
+
return run === void 0 ? void 0 : liveStatus(run) === "running";
|
|
127
|
+
};
|
|
128
|
+
const nothing = () => {};
|
|
129
|
+
/**
|
|
130
|
+
* The follow-ups `ids` (or prefixes) name, when every one can be taken as a
|
|
131
|
+
* brief; nothing is written, so a run that fails to start leaves them alone.
|
|
132
|
+
*/
|
|
133
|
+
const checkTakeable = (store, project, ids) => {
|
|
134
|
+
const full = [];
|
|
135
|
+
const lines = [];
|
|
136
|
+
for (const id of ids) {
|
|
137
|
+
const found = findFollowUp(store, project, id);
|
|
138
|
+
if (found.ok) full.push(found.followUp.id);
|
|
139
|
+
else lines.push(found.error);
|
|
140
|
+
}
|
|
141
|
+
const { taken, refused } = takeFollowUps({
|
|
142
|
+
followUp: (p, id) => store.followUp(p, id),
|
|
143
|
+
followUps: (p) => store.followUps(p),
|
|
144
|
+
putFollowUp: nothing
|
|
145
|
+
}, {
|
|
146
|
+
project,
|
|
147
|
+
run: "",
|
|
148
|
+
ids: full,
|
|
149
|
+
isLive: runIsLive(store)
|
|
150
|
+
});
|
|
151
|
+
const all = [...lines, ...refused];
|
|
152
|
+
return all.length > 0 ? {
|
|
153
|
+
ok: false,
|
|
154
|
+
lines: all.map((line) => `--follow-ups: ${line}`)
|
|
155
|
+
} : {
|
|
156
|
+
ok: true,
|
|
157
|
+
followUps: taken
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
export { refreshDue as a, heldNote as c, followUpsRule as i, takeFollowUps as l, checkTakeable as n, runIsLive as o, followUpSink as r, availableDue as s, briefOf as t };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { pt as detachRun } from "./src-
|
|
2
|
-
import { n as newRunId } from "./find-
|
|
3
|
-
import { c as write, i as detachHint, l as writeErr, s as style } from "./output-
|
|
1
|
+
import { pt as detachRun } from "./src-BuF9Lbow.mjs";
|
|
2
|
+
import { n as newRunId } from "./find-Ct5CNl1J.mjs";
|
|
3
|
+
import { c as write, i as detachHint, l as writeErr, s as style } from "./output-DXZbnFt_.mjs";
|
|
4
|
+
import { r as isFlag } from "./short-flags-Qf21as0E.mjs";
|
|
4
5
|
// src/run/detached.ts
|
|
5
6
|
/**
|
|
6
7
|
* @file `ork run --detach`: checks what the run would refuse (a `--follow-ups`
|
|
@@ -10,7 +11,7 @@ import { c as write, i as detachHint, l as writeErr, s as style } from "./output
|
|
|
10
11
|
/** Starts the run in the background; `rawArgs` are `ork run`'s own, as typed. */
|
|
11
12
|
const startDetached = async (store, options) => {
|
|
12
13
|
const { rawArgs, cwd, target } = options;
|
|
13
|
-
const { prepareFollowUps } = await import("./brief-
|
|
14
|
+
const { prepareFollowUps } = await import("./brief-C2hew8cS.mjs");
|
|
14
15
|
if (await prepareFollowUps(store, rawArgs, void 0, target, void 0, false) === void 0) return;
|
|
15
16
|
const single = options.node !== void 0 && options.node !== "";
|
|
16
17
|
const runId = newRunId(store, single ? "node-" : "");
|
|
@@ -19,7 +20,7 @@ const startDetached = async (store, options) => {
|
|
|
19
20
|
runId,
|
|
20
21
|
args: [
|
|
21
22
|
"run",
|
|
22
|
-
...rawArgs.filter((arg) => arg
|
|
23
|
+
...rawArgs.filter((arg) => !isFlag(arg, "detach")),
|
|
23
24
|
"--run-id",
|
|
24
25
|
runId
|
|
25
26
|
],
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { qr as placeFor } from "./src-BuF9Lbow.mjs";
|
|
2
2
|
import { i as parseLimit, n as unknownProjectRefusal, r as parseFilters, t as limitRefusal } from "./refusals-DQQX3AIb.mjs";
|
|
3
|
-
import { t as findRun } from "./find-
|
|
3
|
+
import { t as findRun } from "./find-Ct5CNl1J.mjs";
|
|
4
4
|
import { a as resolved, n as argsOf } from "./command-tree-CEkzWNy6.mjs";
|
|
5
|
-
import { l as writeErr } from "./output-
|
|
5
|
+
import { l as writeErr } from "./output-DXZbnFt_.mjs";
|
|
6
6
|
import { t as argumentError } from "./argument-error-CihH46Le.mjs";
|
|
7
7
|
// src/list/known-flags.ts
|
|
8
8
|
/** Names citty reads without the command declaring them. */
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { $n as
|
|
2
|
-
import {
|
|
1
|
+
import { $n as findFollowUp, Cn as followUpProblem, Kt as followUpListTable, Sn as deliverFollowUp, Zn as changeFollowUp, _n as postFollowUpMessage, bn as recordPublished, er as followUpActions, gr as runGh, qr as placeFor, tr as isGithubIssueUrl, yn as markDue } from "./src-BuF9Lbow.mjs";
|
|
2
|
+
import { a as refreshDue, i as followUpsRule } from "./context-DMK0U1w0.mjs";
|
|
3
3
|
import { t as applyFilters } from "./apply-Mb0fNpCX.mjs";
|
|
4
4
|
import { n as unknownProjectRefusal } from "./refusals-DQQX3AIb.mjs";
|
|
5
|
-
import { t as findRun } from "./find-
|
|
6
|
-
import { a as plain, c as write, l as writeErr, s as style } from "./output-
|
|
5
|
+
import { t as findRun } from "./find-Ct5CNl1J.mjs";
|
|
6
|
+
import { a as plain, c as write, l as writeErr, s as style } from "./output-DXZbnFt_.mjs";
|
|
7
|
+
import { n as flagValues } from "./short-flags-Qf21as0E.mjs";
|
|
7
8
|
import { t as refuseExtraArguments } from "./extra-arguments-BxQMXARO.mjs";
|
|
8
|
-
import { c as refuseUnknownFlags, i as readListArgs, n as filterArgs } from "./flags-
|
|
9
|
-
import { t as printList } from "./print-
|
|
10
|
-
import { t as withStore } from "./store-
|
|
9
|
+
import { c as refuseUnknownFlags, i as readListArgs, n as filterArgs } from "./flags-C90N4J1i.mjs";
|
|
10
|
+
import { t as printList } from "./print-DzugGZQB.mjs";
|
|
11
|
+
import { t as withStore } from "./store-rTgRu8xy.mjs";
|
|
11
12
|
import { homedir } from "node:os";
|
|
12
13
|
import { defineCommand } from "citty";
|
|
13
14
|
// src/follow-ups/command.ts
|
|
@@ -253,6 +254,10 @@ const due = defineCommand({
|
|
|
253
254
|
const waiting = eachTarget(args._, (target) => {
|
|
254
255
|
const one = findFollowUp(store, place.root, target);
|
|
255
256
|
const run = findRun(store, target, "");
|
|
257
|
+
if (!one.ok && !run.ok) return {
|
|
258
|
+
ok: false,
|
|
259
|
+
error: one.error
|
|
260
|
+
};
|
|
256
261
|
const runId = run.ok ? run.run.id : target;
|
|
257
262
|
const ready = (one.ok ? [one.followUp] : store.followUps(place.root).filter((f) => f.from.run === runId)).filter((f) => f.status === "waiting");
|
|
258
263
|
return ready.length === 0 ? {
|
|
@@ -441,13 +446,13 @@ const add = defineCommand({
|
|
|
441
446
|
fail("--channel github needs --to <the issue or pull request URL>, https://github.com/<owner>/<repo>/(issues|pull)/<n>.");
|
|
442
447
|
return;
|
|
443
448
|
}
|
|
444
|
-
const steps = flagValues(rawArgs, "
|
|
449
|
+
const steps = flagValues(rawArgs, "step").map((raw) => stepOf(raw));
|
|
445
450
|
const input = {
|
|
446
451
|
title: args.title,
|
|
447
452
|
for: recipient,
|
|
448
453
|
kind,
|
|
449
454
|
due,
|
|
450
|
-
where: flagValues(rawArgs, "
|
|
455
|
+
where: flagValues(rawArgs, "where"),
|
|
451
456
|
...args.body === void 0 ? {} : { body: args.body },
|
|
452
457
|
...args.ref === void 0 ? {} : { ref: args.ref },
|
|
453
458
|
...args.text === void 0 ? {} : { draft: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Fn as lockWaitsOf,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { n as nodeVerdict } from "./verdict-
|
|
1
|
+
import { Fn as lockWaitsOf, Ln as runStatus, Nt as lockWaitLine, Pn as liveStatus, Rn as slotWaitingOf, Vn as yoloOf, Wn as isItem, jr as maskSecrets, zn as slotWaitsOf, zt as slotWaitLine } from "./src-BuF9Lbow.mjs";
|
|
2
|
+
import { n as cost, o as shortCount, r as costOf, s as style, v as termOf, x as widthOf, y as cut } from "./output-DXZbnFt_.mjs";
|
|
3
|
+
import { a as statusChip, r as chip } from "./chips-CP_pgKlj.mjs";
|
|
4
|
+
import { n as nodeVerdict } from "./verdict-B592j1W3.mjs";
|
|
5
5
|
// src/term/table.ts
|
|
6
6
|
/**
|
|
7
7
|
* @file Aligned columns for the listing commands: each column as wide as its
|
|
@@ -101,14 +101,15 @@ const listedStatus = (run, events) => {
|
|
|
101
101
|
* The `ork ps` table; `withProject` adds each run's project. A called run's
|
|
102
102
|
* cost is dimmed and says its caller's, whose cost already counts it.
|
|
103
103
|
*/
|
|
104
|
-
const formatRuns = (runs, withProject, now = Date.now(), statusOf = liveStatus, term = termOf(process.stdout)) => {
|
|
104
|
+
const formatRuns = (runs, withProject, now = Date.now(), statusOf = liveStatus, term = termOf(process.stdout), yolo = () => false) => {
|
|
105
105
|
if (runs.length === 0) return ["No runs."];
|
|
106
106
|
const rows = runs.map((run) => {
|
|
107
107
|
const status = statusOf(run);
|
|
108
108
|
const end = run.finishedAt === void 0 ? now : Date.parse(run.finishedAt);
|
|
109
109
|
return {
|
|
110
110
|
id: run.id,
|
|
111
|
-
workflow: run.workflow,
|
|
111
|
+
workflow: yolo(run) ? `${run.workflow} · yolo` : run.workflow,
|
|
112
|
+
yolo: yolo(run),
|
|
112
113
|
status,
|
|
113
114
|
when: `${ago(run.startedAt, now)} · ${duration(end - Date.parse(run.startedAt))}`,
|
|
114
115
|
cost: run.parent === void 0 ? costOf(run.costUsd, run.partial, run.tokens) : `${costOf(run.costUsd, run.partial, run.tokens)} in ${run.parent}`,
|
|
@@ -122,7 +123,10 @@ const formatRuns = (runs, withProject, now = Date.now(), statusOf = liveStatus,
|
|
|
122
123
|
text: r.id,
|
|
123
124
|
look: (s) => style("bold", s)
|
|
124
125
|
},
|
|
125
|
-
|
|
126
|
+
r.yolo ? {
|
|
127
|
+
text: r.workflow,
|
|
128
|
+
look: (s) => style("yellow", s)
|
|
129
|
+
} : { text: r.workflow },
|
|
126
130
|
{
|
|
127
131
|
text: r.status,
|
|
128
132
|
chip: statusChip(r.status),
|
|
@@ -203,8 +207,8 @@ const crashedState = (node) => {
|
|
|
203
207
|
};
|
|
204
208
|
/**
|
|
205
209
|
* The ownership tree, one line per node, children under their owner. A node in
|
|
206
|
-
* `waits` (a live run's
|
|
207
|
-
*
|
|
210
|
+
* `waits` (a live run's lock and slot waits) reads its line, an item too. In a
|
|
211
|
+
* `crashed` run, a node started but not ended reads `cut off` and one not
|
|
208
212
|
* started `not run`: nothing will end them.
|
|
209
213
|
*/
|
|
210
214
|
const formatTree = (roots, now = Date.now(), waits = [], crashed = false) => {
|
|
@@ -229,9 +233,9 @@ const formatTree = (roots, now = Date.now(), waits = [], crashed = false) => {
|
|
|
229
233
|
const type = Math.max(...lines.map((l) => l.node.type.length));
|
|
230
234
|
return lines.map(({ label: text, node }) => {
|
|
231
235
|
const usage = worth(node);
|
|
232
|
-
const
|
|
236
|
+
const wait = waits.find((each) => each.id === node.id)?.line;
|
|
233
237
|
const cut = crashed ? crashedState(node) : null;
|
|
234
|
-
const state = cut ?? (node.held === true ? `${style("yellow", "‖")} paused` :
|
|
238
|
+
const state = cut ?? (node.held === true ? `${style("yellow", "‖")} paused` : wait === void 0 ? `${STATE_MARK[node.state]()} ${stateText(node)}` : `${STATE_MARK.waiting()} ${wait}`);
|
|
235
239
|
const spent = isItem(node) && node.startedAt !== void 0 && cut === null ? style("dim", ` ${duration((node.finishedAt === void 0 ? now : Date.parse(node.finishedAt)) - Date.parse(node.startedAt))}`) : "";
|
|
236
240
|
return `${node.description === void 0 ? text : `${text.slice(0, text.length - node.description.length)}${dim(node.description)}`}${" ".repeat(label - widthOf(text))} ${style("dim", node.type.padEnd(type))} ${state}${spent}${usage}`;
|
|
237
241
|
});
|
|
@@ -243,7 +247,14 @@ const formatTree = (roots, now = Date.now(), waits = [], crashed = false) => {
|
|
|
243
247
|
*/
|
|
244
248
|
const formatTreeView = (run, events, roots, now = Date.now()) => {
|
|
245
249
|
const status = runStatus(run, events);
|
|
246
|
-
const waits = status === "running" ? lockWaitsOf(events)
|
|
247
|
-
|
|
250
|
+
const waits = status === "running" ? [...lockWaitsOf(events).map(({ id, lock }) => ({
|
|
251
|
+
id,
|
|
252
|
+
line: `waiting for ${lock}`
|
|
253
|
+
})), ...slotWaitingOf(events).map(({ id, holders }) => ({
|
|
254
|
+
id,
|
|
255
|
+
line: slotWaitLine(holders)
|
|
256
|
+
}))] : [];
|
|
257
|
+
const yolo = status === "running" && yoloOf(events) ? style("yellow", " · yolo") : "";
|
|
258
|
+
return [`${style("bold", `run ${run.id}`)} ${dim(`of ${run.workflow} · ${listedStatus(run, events)} · ${cost(run.costUsd)}`)}${yolo}`, ...formatTree(roots, now, waits, status === "crashed")];
|
|
248
259
|
};
|
|
249
260
|
export { header as a, listedStatus as i, formatRuns as n, table as o, formatTreeView as r, ago as t };
|
|
@@ -18,7 +18,7 @@ const SHELL_SCRIPTS = {
|
|
|
18
18
|
|
|
19
19
|
_ork() {
|
|
20
20
|
local -a lines cands opens
|
|
21
|
-
local line group=commands files=0 n=0 ret=1
|
|
21
|
+
local line value said group=commands files=0 n=0 ret=1
|
|
22
22
|
lines=("\${(@f)$("\${words[1]}" ${COMPLETE_COMMAND} -- "\${(@)words[2,CURRENT]}" 2>/dev/null)}")
|
|
23
23
|
# A last group line offers what the last group gathered.
|
|
24
24
|
lines+=(":group end")
|
|
@@ -36,8 +36,13 @@ _ork() {
|
|
|
36
36
|
cands=() opens=()
|
|
37
37
|
group=\${line#:group }
|
|
38
38
|
;;
|
|
39
|
-
(
|
|
40
|
-
|
|
39
|
+
(?*)
|
|
40
|
+
value=\${\${line%%$'\\t'*}//:/\\\\:}
|
|
41
|
+
said=\${line#*$'\\t'}
|
|
42
|
+
# No description: the value alone, or zsh shows an empty one as --.
|
|
43
|
+
[[ $said == "$line" || -z $said ]] || value+=":$said"
|
|
44
|
+
if [[ $line == *=$'\\t'* ]]; then opens+=("$value"); else cands+=("$value"); fi
|
|
45
|
+
;;
|
|
41
46
|
esac
|
|
42
47
|
done
|
|
43
48
|
if (( files )); then
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { z as storePath } from "./src-
|
|
2
|
-
import { g as storeGuarded, h as runMarkerIn } from "./src-
|
|
1
|
+
import { z as storePath } from "./src-BuF9Lbow.mjs";
|
|
2
|
+
import { g as storeGuarded, h as runMarkerIn } from "./src-k0A_QpST.mjs";
|
|
3
3
|
// src/commands/in-a-run.ts
|
|
4
4
|
/**
|
|
5
5
|
* @file The commands that act as the user refuse a program or an agent in a run
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Kr as placeFiles, Qr as inside, br as feedbackActions, ei as LESSON_CAP_TOKENS, ii as writePlainFile, ni as guardedBase, qr as placeFor, ri as plainPathInside, ti as estimateTokens } from "./src-BuF9Lbow.mjs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
4
4
|
import { spawn } from "node:child_process";
|
|
@@ -181,6 +181,54 @@ const lessonPlaceOf = (store, item, workflow, registered) => {
|
|
|
181
181
|
exists
|
|
182
182
|
};
|
|
183
183
|
};
|
|
184
|
+
// ../core/src/remote/session.ts
|
|
185
|
+
const chattable = (type) => type === "agent.leader" || type === "agent.worker";
|
|
186
|
+
/** Reads `node`'s session from a run's events, and every node's last output. */
|
|
187
|
+
const nodeSession = (events, node) => {
|
|
188
|
+
const session = {
|
|
189
|
+
known: false,
|
|
190
|
+
chattable: false,
|
|
191
|
+
running: false
|
|
192
|
+
};
|
|
193
|
+
const outputs = {};
|
|
194
|
+
for (const { event } of events) {
|
|
195
|
+
if (event.type === "run.started") {
|
|
196
|
+
const declared = event.nodes.find((n) => n.id === node);
|
|
197
|
+
if (declared !== void 0) {
|
|
198
|
+
session.known = true;
|
|
199
|
+
session.chattable = chattable(declared.type);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
if (event.type === "node.finished") outputs[event.id] = event.output;
|
|
203
|
+
if (!("id" in event) || event.id !== node) continue;
|
|
204
|
+
if (event.type === "node.started") {
|
|
205
|
+
session.known = true;
|
|
206
|
+
session.chattable = chattable(event.nodeType);
|
|
207
|
+
session.running = true;
|
|
208
|
+
}
|
|
209
|
+
if (event.type === "node.finished") session.running = false;
|
|
210
|
+
if (event.type === "worktree" && event.action === "created") session.checkout = {
|
|
211
|
+
path: event.path,
|
|
212
|
+
...event.branch === void 0 ? {} : { branch: event.branch },
|
|
213
|
+
own: true,
|
|
214
|
+
owner: node
|
|
215
|
+
};
|
|
216
|
+
if (event.type !== "node.event") continue;
|
|
217
|
+
const inner = event.event;
|
|
218
|
+
if (inner.fork === true) continue;
|
|
219
|
+
if (inner.type === "session.started") {
|
|
220
|
+
session.sessionId = inner.sessionId;
|
|
221
|
+
if (inner.cwd !== void 0) session.cwd = inner.cwd;
|
|
222
|
+
if (inner.driver !== void 0) session.driver = inner.driver;
|
|
223
|
+
if (inner.model !== "") session.model = inner.model;
|
|
224
|
+
}
|
|
225
|
+
if (inner.type === "session.finished" && inner.outcome.sessionId !== "") session.sessionId = inner.outcome.sessionId;
|
|
226
|
+
}
|
|
227
|
+
return {
|
|
228
|
+
session,
|
|
229
|
+
outputs
|
|
230
|
+
};
|
|
231
|
+
};
|
|
184
232
|
/**
|
|
185
233
|
* Runs the command; resolves its exit code. Without `onOutput` it writes on the
|
|
186
234
|
* terminal.
|
|
@@ -208,4 +256,4 @@ const runInstall = (argv, onOutput) => new Promise((resolve) => {
|
|
|
208
256
|
resolve(code ?? 1);
|
|
209
257
|
});
|
|
210
258
|
});
|
|
211
|
-
export { placeOf as i,
|
|
259
|
+
export { placeOf as a, lessonPlaceOf as i, nodeSession as n, acceptItem as r, runInstall as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _t as limitsReport, gt as limitsNow, ht as NOT_STARTED, v as capsHere } from "./src-
|
|
1
|
+
import { _t as limitsReport, gt as limitsNow, ht as NOT_STARTED, v as capsHere } from "./src-BuF9Lbow.mjs";
|
|
2
2
|
// src/run/limits.ts
|
|
3
3
|
/**
|
|
4
4
|
* @file The limits across runs that apply here (RFC-007): the user's settings
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { T as isNewer } from "./src-
|
|
2
|
-
import { h as runMarkerIn } from "./src-
|
|
3
|
-
import { n as ORK_VERSION } from "./__build_info__-
|
|
4
|
-
import { n as explainNode } from "./context-
|
|
5
|
-
import { a as openMcp, c as refused, o as tool, s as answer } from "./src-
|
|
1
|
+
import { T as isNewer } from "./src-BuF9Lbow.mjs";
|
|
2
|
+
import { h as runMarkerIn } from "./src-k0A_QpST.mjs";
|
|
3
|
+
import { n as ORK_VERSION } from "./__build_info__-0wqQ-rtf.mjs";
|
|
4
|
+
import { n as explainNode } from "./context-B-fjPJky.mjs";
|
|
5
|
+
import { a as openMcp, c as refused, o as tool, s as answer } from "./src-BrFfDKux.mjs";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import { defineCommand } from "citty";
|
|
8
8
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
@@ -43,7 +43,7 @@ const orkMcpServer = (options = {}) => {
|
|
|
43
43
|
...options.script === void 0 ? {} : { script: options.script }
|
|
44
44
|
});
|
|
45
45
|
const all = [...opened.tools, explainTool(opened, options.home)];
|
|
46
|
-
const tools = options.expects !== void 0 && isNewer(options.expects, "1.0.0-alpha.
|
|
46
|
+
const tools = options.expects !== void 0 && isNewer(options.expects, "1.0.0-alpha.21") ? tooOld(all, options.expects) : all;
|
|
47
47
|
const server = new McpServer({
|
|
48
48
|
name: "ork",
|
|
49
49
|
version: ORK_VERSION
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./src-
|
|
2
|
-
import { n as OncePathspecError, t as runOnce } from "./run-
|
|
3
|
-
import { c as write, l as writeErr, s as style } from "./output-
|
|
4
|
-
import { t as ago } from "./format-
|
|
1
|
+
import "./src-BuF9Lbow.mjs";
|
|
2
|
+
import { n as OncePathspecError, t as runOnce } from "./run-CtuNY3mE.mjs";
|
|
3
|
+
import { c as write, l as writeErr, s as style } from "./output-DXZbnFt_.mjs";
|
|
4
|
+
import { t as ago } from "./format-CiPhQqbX.mjs";
|
|
5
5
|
import { spawn } from "node:child_process";
|
|
6
6
|
import { defineCommand, parseArgs } from "citty";
|
|
7
7
|
// src/commands/once.ts
|