@krapht/ork 1.0.0-alpha.1 → 1.0.0-alpha.10
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/README.md +3 -4
- package/dist/{__build_info__-D9lSlMFy.mjs → __build_info__-DFF18K8y.mjs} +72 -3
- package/dist/bin.mjs +579 -379
- package/dist/{clean-CA_Oi2Wl.mjs → clean-DVaEH9e7.mjs} +5 -2
- package/dist/{completion-DBGfL-gN.mjs → completion-Dv5kf598.mjs} +6 -6
- package/dist/context-CEaKOVmG.mjs +683 -0
- package/dist/{decide-CoIJh34e.mjs → decide-3l9q8UtX.mjs} +3 -3
- package/dist/{find-rBBk7Jui.mjs → find-DEjjOlTG.mjs} +1 -1
- package/dist/format-Cb5_m-Qd.mjs +191 -0
- package/dist/{in-a-run-DdAakpRR.mjs → in-a-run-BS9Nc-JW.mjs} +1 -1
- package/dist/{limits-BPM9wUlV.mjs → limits-BSwEjQST.mjs} +1 -1
- package/dist/{list-Bv5Lxu7z.mjs → list-Qxr6rwsY.mjs} +11 -4
- package/dist/{mcp-DM30MFBw.mjs → mcp-CslnG5wf.mjs} +6 -6
- package/dist/output-Bqljtmp_.mjs +40 -0
- package/dist/{pause-C7lJkSma.mjs → pause-D7OVB5Ac.mjs} +4 -4
- package/dist/{relay-BipJYszF.mjs → relay-EceRIebO.mjs} +2 -2
- package/dist/{remove-BDs9isB6.mjs → remove-0IQZVWmI.mjs} +14 -7
- package/dist/{send-nbkjf3sc.mjs → send-C0uwfUYi.mjs} +3 -3
- package/dist/{src-hrj2h0IZ.mjs → src-Df6KOIDC.mjs} +5678 -3245
- package/dist/{src-BxUJPGa5.mjs → src-cmmXKHn1.mjs} +265 -203
- package/dist/{src-B0TT7DBi.mjs → src-i5k2Y-kf.mjs} +35 -86
- package/dist/src-oaJYIddp.mjs +2255 -0
- package/dist/ui/THIRD_PARTY_LICENSES.txt +594 -0
- package/dist/ui/assets/app-C8uhHVYp.css +1 -0
- package/dist/ui/assets/app-qs8Lofv6.js +75 -0
- package/dist/ui/assets/{index-CPx74lFf.js → index-DV1ZaOk-.js} +3 -3
- package/dist/ui/assets/theme-CdXvqTQ6.js +1 -0
- package/dist/ui/index.html +2 -2
- package/dist/{ui-B98FSboa.mjs → ui-CBkHJdqk.mjs} +4 -4
- package/dist/{usage-EW7DI6Z7.mjs → usage-Cd8pEYyK.mjs} +5 -5
- package/dist/{watch-BAkSGaOp.mjs → watch-DW5R2OPO.mjs} +6 -6
- package/dist/{workflows-vsEohqa7.mjs → workflows-BT1gDRIV.mjs} +4 -3
- package/dist/{worktrees-Ahj9rdWK.mjs → worktrees-g1MQMGie.mjs} +78 -19
- package/package.json +2 -4
- package/dist/context-6x3kXREO.mjs +0 -274
- package/dist/format-zMmhqyLE.mjs +0 -427
- package/dist/output-TV_j7Ni0.mjs +0 -950
- package/dist/src-B9v0lDc6.mjs +0 -1204
- package/dist/ui/assets/app-BNT0SuIz.css +0 -1
- package/dist/ui/assets/app-CmkynZyW.js +0 -67
- package/dist/ui/assets/theme-3xH5jxKs.js +0 -1
|
@@ -1,86 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { C as
|
|
3
|
-
import { n as pendingDecisions, r as builtinProblem, t as answerDecision } from "./decide-
|
|
4
|
-
import { n as newRunId, t as findRun } from "./find-
|
|
5
|
-
import { c as openStore, l as storePath, s as nodeOf } from "./output-TV_j7Ni0.mjs";
|
|
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";
|
|
6
5
|
import { n as usageReport } from "./report-DK4LGqwF.mjs";
|
|
7
|
-
import { a as planClean, i as keyOf, o as stepActs, r as cleanStep, s as stepPrunes, t as applyClean } from "./clean-
|
|
8
|
-
import { a as readWorktrees, c as
|
|
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";
|
|
9
8
|
import path from "node:path";
|
|
10
9
|
import { z } from "zod";
|
|
11
10
|
import { chmodSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
12
11
|
import { createHash, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
|
|
13
12
|
import { homedir } from "node:os";
|
|
14
13
|
import { createServer } from "node:http";
|
|
15
|
-
// ../core/src/store/activity.ts
|
|
16
|
-
const LONGEST_LINE = 120;
|
|
17
|
-
/**
|
|
18
|
-
* The fields of a tool's input that say what it's working on, best first. Only
|
|
19
|
-
* these are shown, so what else a tool was given stays in the logs.
|
|
20
|
-
*/
|
|
21
|
-
const TARGETS = [
|
|
22
|
-
"file_path",
|
|
23
|
-
"notebook_path",
|
|
24
|
-
"path",
|
|
25
|
-
"url",
|
|
26
|
-
"pattern",
|
|
27
|
-
"query",
|
|
28
|
-
"command"
|
|
29
|
-
];
|
|
30
|
-
const oneLine = (text) => {
|
|
31
|
-
const line = text.replaceAll(/\s+/gu, " ").trim();
|
|
32
|
-
return line.length > LONGEST_LINE ? `${line.slice(0, 119)}…` : line;
|
|
33
|
-
};
|
|
34
|
-
const toolLine = ({ name, input }) => {
|
|
35
|
-
const target = TARGETS.map((field) => input[field]).find((value) => typeof value === "string" && value.trim() !== "");
|
|
36
|
-
if (typeof target !== "string") return name;
|
|
37
|
-
return oneLine(target.startsWith(`${name} `) ? target : `${name} ${target}`);
|
|
38
|
-
};
|
|
39
|
-
/** What a finished node said, or why it failed. */
|
|
40
|
-
const finishedNow = (ok, error, summary) => {
|
|
41
|
-
if (!ok) return error === void 0 ? void 0 : oneLine(error);
|
|
42
|
-
return typeof summary === "string" && summary.trim() !== "" ? oneLine(summary) : void 0;
|
|
43
|
-
};
|
|
44
|
-
/** Each node's activity, by id; a node that never started has none. */
|
|
45
|
-
const runActivity = (stored) => {
|
|
46
|
-
const nodes = /* @__PURE__ */ new Map();
|
|
47
|
-
const of = (id) => {
|
|
48
|
-
const found = nodes.get(id);
|
|
49
|
-
if (found !== void 0) return found;
|
|
50
|
-
const fresh = {};
|
|
51
|
-
nodes.set(id, fresh);
|
|
52
|
-
return fresh;
|
|
53
|
-
};
|
|
54
|
-
for (const { at, event } of stored) if (event.type === "node.started") {
|
|
55
|
-
const node = of(event.id);
|
|
56
|
-
node.startedAt ??= at;
|
|
57
|
-
delete node.finishedAt;
|
|
58
|
-
delete node.now;
|
|
59
|
-
} else if (event.type === "node.event") {
|
|
60
|
-
if (event.event.type === "tool.called") of(event.id).now = toolLine(event.event);
|
|
61
|
-
} else if (event.type === "decision.opened") of(event.node).now = oneLine(`Asked: ${event.question}`);
|
|
62
|
-
else if (event.type === "decision.answered") of(event.node).now = oneLine(`Answered: ${event.answer}`);
|
|
63
|
-
else if (event.type === "decision.withdrawn") delete of(event.node).now;
|
|
64
|
-
else if (event.type === "node.finished") {
|
|
65
|
-
const node = of(event.id);
|
|
66
|
-
node.finishedAt = at;
|
|
67
|
-
const now = finishedNow(event.ok, event.error, event.output["summary"]);
|
|
68
|
-
if (now === void 0) delete node.now;
|
|
69
|
-
else node.now = now;
|
|
70
|
-
}
|
|
71
|
-
return nodes;
|
|
72
|
-
};
|
|
73
|
-
/** The ownership tree, with what each node is doing and when it ran. */
|
|
74
|
-
const activeTree = (stored) => {
|
|
75
|
-
const activity = runActivity(stored);
|
|
76
|
-
const dress = (node) => {
|
|
77
|
-
Object.assign(node, activity.get(node.id));
|
|
78
|
-
for (const child of node.children) dress(child);
|
|
79
|
-
};
|
|
80
|
-
const roots = runTree(stored.map(({ event }) => event));
|
|
81
|
-
for (const root of roots) dress(root);
|
|
82
|
-
return roots;
|
|
83
|
-
};
|
|
84
14
|
// ../server/src/contract-builder.ts
|
|
85
15
|
/** A new workflow's name, as its file and its `name:` take it. */
|
|
86
16
|
const NewWorkflowSchema = z.strictObject({ name: z.string().min(1) });
|
|
@@ -167,7 +97,13 @@ const AcceptSchema = z.strictObject({
|
|
|
167
97
|
/** Which workflow's lessons, when it was seen in more than one. */
|
|
168
98
|
workflow: z.string().min(1).optional()
|
|
169
99
|
});
|
|
170
|
-
const
|
|
100
|
+
const DriverIdSchema = z.enum({
|
|
101
|
+
"claude-code": "claude-code",
|
|
102
|
+
"open-code": "open-code",
|
|
103
|
+
"command-code": "command-code"
|
|
104
|
+
});
|
|
105
|
+
DriverIdSchema.options;
|
|
106
|
+
const ApplySchema = z.strictObject({ driver: DriverIdSchema.optional() });
|
|
171
107
|
const PublishPreviewSchema = z.strictObject({
|
|
172
108
|
/** Also hide the repositories' and workflows' names. */
|
|
173
109
|
hideNames: z.boolean() });
|
|
@@ -327,7 +263,6 @@ const WORKTREES_API = {
|
|
|
327
263
|
// ../server/src/contract.ts
|
|
328
264
|
const Count = z.coerce.number().int().positive();
|
|
329
265
|
const Seq = z.coerce.number().int().nonnegative();
|
|
330
|
-
const Driver = z.enum(["sdk", "cli"]);
|
|
331
266
|
const RunsQuerySchema = z.strictObject({
|
|
332
267
|
project: z.string().min(1).optional(),
|
|
333
268
|
limit: Count.optional()
|
|
@@ -349,7 +284,9 @@ const EventsQuerySchema = z.strictObject({
|
|
|
349
284
|
});
|
|
350
285
|
const DecisionsQuerySchema = z.strictObject({
|
|
351
286
|
run: z.string().min(1).optional(),
|
|
352
|
-
project: z.string().min(1).optional()
|
|
287
|
+
project: z.string().min(1).optional(),
|
|
288
|
+
/** Only runs of this workflow, by name; ANDed with `run` or `project`. */
|
|
289
|
+
workflow: z.string().min(1).optional()
|
|
353
290
|
});
|
|
354
291
|
/** An answer: the option, and what the person said with it, if anything. */
|
|
355
292
|
const AnswerSchema = z.strictObject({
|
|
@@ -358,7 +295,7 @@ const AnswerSchema = z.strictObject({
|
|
|
358
295
|
});
|
|
359
296
|
const RunFlags = {
|
|
360
297
|
inputs: z.record(z.string(), z.string()).optional(),
|
|
361
|
-
driver:
|
|
298
|
+
driver: DriverIdSchema.optional(),
|
|
362
299
|
inPlace: z.boolean().optional(),
|
|
363
300
|
allowDirty: z.boolean().optional()
|
|
364
301
|
};
|
|
@@ -483,7 +420,8 @@ const STREAMS = {
|
|
|
483
420
|
run: "/api/runs/:id/stream",
|
|
484
421
|
/**
|
|
485
422
|
* `runs`, `decisions`, `version`, each when it changes; `?project=` keeps
|
|
486
|
-
* one
|
|
423
|
+
* one, `?workflow=` narrows `decisions` to that workflow's. `upgrade`: the
|
|
424
|
+
* upgrade's output, then `end` (contract-update.ts).
|
|
487
425
|
*/
|
|
488
426
|
overview: "/api/stream",
|
|
489
427
|
upgrade: "/api/upgrade/stream"
|
|
@@ -1610,7 +1548,7 @@ const readRoutes = (context) => ({
|
|
|
1610
1548
|
tree: ({ params }) => {
|
|
1611
1549
|
const found = runOf(context, params.id);
|
|
1612
1550
|
if (!found.ok) return found.refusal;
|
|
1613
|
-
return ok(activeTree(context.store.events(found.run.id)));
|
|
1551
|
+
return ok(nestItems(activeTree(context.store.events(found.run.id))));
|
|
1614
1552
|
},
|
|
1615
1553
|
graph: ({ params }) => {
|
|
1616
1554
|
const found = runOf(context, params.id);
|
|
@@ -1620,15 +1558,22 @@ const readRoutes = (context) => ({
|
|
|
1620
1558
|
events: ({ params, query }) => {
|
|
1621
1559
|
const found = runOf(context, params.id);
|
|
1622
1560
|
if (!found.ok) return found.refusal;
|
|
1623
|
-
const events = context.store.events(found.run.id, query.after ?? 0).filter((s) => query.node === void 0 ||
|
|
1561
|
+
const events = context.store.events(found.run.id, query.after ?? 0).filter((s) => query.node === void 0 || isNodeEvent(s.event, query.node));
|
|
1624
1562
|
const newest = query.last === void 0 ? events : events.slice(-query.last);
|
|
1625
1563
|
return ok(query.limit === void 0 ? newest : newest.slice(0, query.limit));
|
|
1626
1564
|
},
|
|
1627
1565
|
decisions: ({ query }) => {
|
|
1628
|
-
|
|
1566
|
+
const workflow = query.workflow === void 0 ? {} : { workflow: query.workflow };
|
|
1567
|
+
if (query.run === void 0) return ok(pendingDecisions(context.store, {
|
|
1568
|
+
...workflow,
|
|
1569
|
+
...query.project === void 0 ? {} : { project: projectRoot(context, query.project) }
|
|
1570
|
+
}));
|
|
1629
1571
|
const found = runOf(context, query.run);
|
|
1630
1572
|
if (!found.ok) return found.refusal;
|
|
1631
|
-
return ok(pendingDecisions(context.store, {
|
|
1573
|
+
return ok(pendingDecisions(context.store, {
|
|
1574
|
+
...workflow,
|
|
1575
|
+
runId: found.run.id
|
|
1576
|
+
}));
|
|
1632
1577
|
},
|
|
1633
1578
|
decision: ({ params }) => {
|
|
1634
1579
|
const found = context.store.decision(params.id);
|
|
@@ -2869,6 +2814,7 @@ const runStream = async (context, req, res, url, id, shutdown) => {
|
|
|
2869
2814
|
const overviewStream = (context, res, url, shutdown) => {
|
|
2870
2815
|
const key = url.searchParams.get("project");
|
|
2871
2816
|
const root = key === null ? void 0 : projectOf(context, key)?.root ?? key;
|
|
2817
|
+
const workflow = url.searchParams.get("workflow");
|
|
2872
2818
|
const stream = openEventStream(res);
|
|
2873
2819
|
const last = {
|
|
2874
2820
|
runs: "",
|
|
@@ -2881,7 +2827,10 @@ const overviewStream = (context, res, url, shutdown) => {
|
|
|
2881
2827
|
...filter,
|
|
2882
2828
|
limit: OVERVIEW_RUNS
|
|
2883
2829
|
}).map((run) => viewOf$2(context, run));
|
|
2884
|
-
const decisions = pendingDecisions(context.store,
|
|
2830
|
+
const decisions = pendingDecisions(context.store, {
|
|
2831
|
+
...filter,
|
|
2832
|
+
...workflow === null ? {} : { workflow }
|
|
2833
|
+
});
|
|
2885
2834
|
for (const [name, value] of [
|
|
2886
2835
|
["runs", runs],
|
|
2887
2836
|
["decisions", decisions],
|