@iowarp/clio-coder 0.3.3 → 0.3.4
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/CHANGELOG.md +39 -0
- package/CONTRIBUTING.md +1 -1
- package/README.md +3 -3
- package/dist/{acp-P2AQILE2.js → acp-S5R4RR5B.js} +7 -6
- package/dist/{agents-72W3BI7I.js → agents-P6DMMVZY.js} +24 -21
- package/dist/assets/codewiki.json +1 -1
- package/dist/{auth-5TWEIYDN.js → auth-2XCZLPKS.js} +12 -8
- package/dist/{chunk-GGXXDWE4.js → chunk-22NAGB7X.js} +2 -2
- package/dist/{chunk-2DJ2KNFG.js → chunk-2LZI5CAG.js} +133 -13
- package/dist/{chunk-OAO4GE4M.js → chunk-2TZWSW76.js} +2 -2
- package/dist/{chunk-OOJYHWRB.js → chunk-34475P3I.js} +2 -2
- package/dist/{chunk-4XUGQOHA.js → chunk-35MKKU5R.js} +4 -4
- package/dist/{chunk-LM5TQCJZ.js → chunk-3HZ5RWN2.js} +5 -5
- package/dist/{chunk-AGYYIBLL.js → chunk-3JLKSKD7.js} +2 -2
- package/dist/{chunk-KZWTDYJF.js → chunk-4JUF2NNX.js} +7 -7
- package/dist/{chunk-ZDOOVTXZ.js → chunk-4OC57DA6.js} +27 -4
- package/dist/chunk-5M54SPOL.js +926 -0
- package/dist/{chunk-STBPMHSX.js → chunk-7RXG6QRZ.js} +51 -11
- package/dist/{chunk-X6IAEBZR.js → chunk-A2GZF7DC.js} +5 -5
- package/dist/{chunk-A3CYT5EX.js → chunk-AD2SYQYC.js} +55 -2
- package/dist/chunk-AOCYTWAV.js +449 -0
- package/dist/chunk-BEY543CS.js +258 -0
- package/dist/{chunk-6N5PTWMY.js → chunk-BP4OYD6A.js} +32 -13
- package/dist/chunk-BPGS2WCQ.js +612 -0
- package/dist/{chunk-V6RTAOC2.js → chunk-BRXQQJFP.js} +8 -8
- package/dist/chunk-CFGTUFWB.js +67 -0
- package/dist/{chunk-CBCAPZAA.js → chunk-E25LMLRW.js} +2 -2
- package/dist/{chunk-DUYJ5IO6.js → chunk-EDRHSCIE.js} +4 -4
- package/dist/{chunk-XBXAASKX.js → chunk-EFADSJET.js} +2 -2
- package/dist/{chunk-M6SHUN7Q.js → chunk-FO5ZOVUY.js} +2 -2
- package/dist/chunk-FYYLNIL5.js +313 -0
- package/dist/{chunk-FNTMWMX5.js → chunk-HV5X7OR2.js} +14 -12
- package/dist/{chunk-TZTZS7QK.js → chunk-HXG4IURW.js} +5 -3
- package/dist/{chunk-5UFT4SUX.js → chunk-K6WL7QZT.js} +3 -3
- package/dist/chunk-K7VKOLQQ.js +15 -0
- package/dist/{chunk-BMEMKKIT.js → chunk-KOHPCX4K.js} +2 -2
- package/dist/{chunk-OC7FIQPC.js → chunk-KRPY7NTG.js} +10 -7
- package/dist/chunk-LL4KHSZI.js +22 -0
- package/dist/{chunk-DSELYM6W.js → chunk-MEQ45TQ4.js} +15 -9
- package/dist/{chunk-5UUP6MWO.js → chunk-MV3K5QF2.js} +5 -436
- package/dist/{chunk-6SGHMWE3.js → chunk-N4CZJQRK.js} +5 -5
- package/dist/{chunk-TZK7PACC.js → chunk-NILBFAPG.js} +14 -8
- package/dist/chunk-OZNBF4L3.js +23 -0
- package/dist/{verify-375KUB3Y.js → chunk-PCZJO5TI.js} +127 -42
- package/dist/chunk-QQK64KLB.js +1360 -0
- package/dist/{chunk-SRDMMSEP.js → chunk-QQL5RT5M.js} +979 -1619
- package/dist/{chunk-LZSJBIVT.js → chunk-QWU7ZBO7.js} +70 -720
- package/dist/{chunk-2TLUCQVG.js → chunk-RD5U66HV.js} +3 -3
- package/dist/{chunk-OKGUZO2U.js → chunk-SPULKLCF.js} +4 -3
- package/dist/{chunk-OQ33BKR3.js → chunk-TTNYS3EA.js} +3 -60
- package/dist/chunk-TW3WDMVS.js +677 -0
- package/dist/chunk-TZSKNMZG.js +434 -0
- package/dist/{chunk-7MNJORFF.js → chunk-UL3WSD3F.js} +6 -1
- package/dist/{chunk-PIWWS5BL.js → chunk-UZHIZC5S.js} +7 -7
- package/dist/{chunk-UFIIWP2H.js → chunk-VAWWTKDP.js} +8 -8
- package/dist/{chunk-COU2UHX6.js → chunk-VEZEGCGW.js} +170 -2
- package/dist/{chunk-LW6DSM3M.js → chunk-VMNQ6OZA.js} +98 -202
- package/dist/chunk-VSNATDE6.js +122 -0
- package/dist/chunk-W6GROXXM.js +69 -0
- package/dist/chunk-WPQLXFOZ.js +375 -0
- package/dist/{chunk-ORBHGJC5.js → chunk-WR67VIZY.js} +3 -3
- package/dist/{chunk-PAJK6MAQ.js → chunk-X6COSD2O.js} +5 -5
- package/dist/chunk-ZGVHUX3M.js +66 -0
- package/dist/{chunk-LWLEKMDQ.js → chunk-ZYKPLLNQ.js} +510 -547
- package/dist/cli/index.js +27 -23
- package/dist/{clio-JOU4FXVA.js → clio-J5JIOIDS.js} +7 -6
- package/dist/{code-nav-7AX6FYE6.js → code-nav-AXCXSBHX.js} +5 -3
- package/dist/{config-XCDVKR23.js → config-OEBMIN2U.js} +37 -27
- package/dist/{configure-4GAP54ZW.js → configure-PUQOSIXQ.js} +16 -13
- package/dist/{context-5VKGUVJJ.js → context-EKDCKUUZ.js} +82 -7
- package/dist/{context-4UOGGLQ5.js → context-MGSE4Z2T.js} +33 -23
- package/dist/{context-77FM5DV5.js → context-URSXPBCK.js} +17 -9
- package/dist/{context-clear-XXJRLCJJ.js → context-clear-KDAJRNUK.js} +33 -23
- package/dist/context-working-set-SBKMPPI2.js +1552 -0
- package/dist/{dispatch-runner-QPRDDBDX.js → dispatch-runner-MSWN72NK.js} +43 -29
- package/dist/{doctor-HR46URBJ.js → doctor-7BSE27PJ.js} +10 -10
- package/dist/{eval-XSSNATB4.js → eval-IZGDOO4H.js} +9 -8
- package/dist/{evidence-6HG2PY2B.js → evidence-SR7WXB5B.js} +51 -23
- package/dist/{evolve-K7YU3NCY.js → evolve-K7VE2CBX.js} +30 -20
- package/dist/{fleet-VY3HHKN6.js → fleet-7XMJNQNF.js} +48 -38
- package/dist/{fleet-preflight-DDN536IT.js → fleet-preflight-AQNAH644.js} +3 -3
- package/dist/{init-JYGXI3FK.js → init-JGNPAYXT.js} +41 -31
- package/dist/{memory-WFZMGYHX.js → memory-4ALKDJ4Q.js} +32 -22
- package/dist/{models-I5QWSEOM.js → models-ZMMLFJNN.js} +22 -19
- package/dist/{monitor-GE4ID3IA.js → monitor-2F3T5KHP.js} +55 -43
- package/dist/{orchestrator-EM5MC3HM.js → orchestrator-ORHT43JB.js} +572 -388
- package/dist/{reset-L2FQEE3E.js → reset-NXGTYNUO.js} +4 -3
- package/dist/{run-ZU3QMZPZ.js → run-RF4WJGMT.js} +51 -41
- package/dist/{share-S5BZQC5I.js → share-UT3W6E4M.js} +5 -4
- package/dist/{skills-X5VXCRNQ.js → skills-PSACKC5Q.js} +2 -2
- package/dist/{skills-eval-WKIHWTHR.js → skills-eval-WJSI55RZ.js} +34 -24
- package/dist/{targets-SNCPI2NR.js → targets-PIIRAOYS.js} +23 -20
- package/dist/{terminal-lease-BNAHVHBS.js → terminal-lease-ULWXWNVY.js} +4 -3
- package/dist/{upgrade-JQHHPQ4K.js → upgrade-346TZ6AV.js} +18 -17
- package/dist/{usage-OR4O5SMZ.js → usage-6KKXR32N.js} +34 -24
- package/dist/verifiers-4UUM6TEE.js +1214 -0
- package/dist/verify-X5HDROLA.js +25 -0
- package/dist/{wiki-generate-UEXP2ARI.js → wiki-generate-7STOCIFZ.js} +42 -31
- package/dist/worker/entry.js +33 -24
- package/docs/README.md +7 -6
- package/docs/acp.md +1 -1
- package/docs/alcf-provider.md +1 -1
- package/docs/architecture.md +2 -2
- package/docs/artifact-versions.md +1 -1
- package/docs/built-in-agents.md +1 -1
- package/docs/capacity-and-scheduling.md +1 -1
- package/docs/commands-and-modes.md +53 -21
- package/docs/config-knobs-audit.md +1 -2
- package/docs/configuration-and-targets.md +15 -1
- package/docs/context-engine.md +64 -12
- package/docs/context-working-set.md +194 -0
- package/docs/development-pipeline.md +1 -1
- package/docs/documentation-coverage.md +5 -5
- package/docs/documentation-guide.md +6 -5
- package/docs/environment-variables.md +2 -1
- package/docs/eval-runner.md +1 -1
- package/docs/evals-internal.md +14 -1
- package/docs/evidence-and-memory.md +74 -2
- package/docs/evolution.md +1 -1
- package/docs/exit-codes-and-output.md +1 -1
- package/docs/extensions-and-sharing.md +2 -2
- package/docs/fleet-dispatch.md +22 -7
- package/docs/glossary.md +21 -1
- package/docs/installation-and-lifecycle.md +2 -2
- package/docs/middleware-and-components.md +1 -1
- package/docs/model-catalog.md +7 -9
- package/docs/observability.md +4 -4
- package/docs/proactive-memory.md +1 -1
- package/docs/prompt-envelope-and-tools.md +4 -4
- package/docs/provider-adapter-cookbook.md +1 -1
- package/docs/release-cut-checklist.md +31 -31
- package/docs/safety-model.md +23 -4
- package/docs/scientific-validation.md +21 -3
- package/docs/session-lifecycle.md +3 -3
- package/docs/skills-marketplace.md +1 -1
- package/docs/tool-usage.md +79 -12
- package/docs/trace-store.md +1 -1
- package/docs/troubleshooting.md +1 -1
- package/docs/tui-design.md +1 -1
- package/docs/worker-dispatch-mechanics.md +11 -1
- package/package.json +8 -11
- package/skills/meta/clio-test/SKILL.md +20 -17
- package/skills/meta/clio-test/evals.md +3 -3
- package/skills/meta/clio-test/references/harness.md +35 -6
- package/skills/meta/clio-test/references/test-map.md +20 -10
- package/skills/registry.yaml +2 -2
- package/skills/skill-marketplace.json +1 -1
- package/src/cli/context-working-set.ts +513 -0
- package/src/cli/context.ts +8 -0
- package/src/cli/evidence.ts +20 -2
- package/src/cli/index.ts +4 -0
- package/src/cli/verifiers.ts +325 -0
- package/src/core/bash-exec.ts +39 -14
- package/src/core/bus-events.ts +19 -4
- package/src/core/config.ts +54 -0
- package/src/core/defaults.ts +50 -3
- package/src/core/verification-scripts.ts +6 -0
- package/src/domains/agents/builtins/verifier.md +3 -0
- package/src/domains/config/classify.ts +1 -0
- package/src/domains/context/working-set/contract.ts +161 -0
- package/src/domains/context/working-set/defaults.ts +28 -0
- package/src/domains/context/working-set/engine.ts +203 -0
- package/src/domains/context/working-set/fold.ts +62 -0
- package/src/domains/context/working-set/horizon.ts +38 -0
- package/src/domains/context/working-set/marker.ts +103 -0
- package/src/domains/context/working-set/path-index.ts +436 -0
- package/src/domains/context/working-set/payload.ts +152 -0
- package/src/domains/context/working-set/policies/age-horizon.ts +55 -0
- package/src/domains/context/working-set/policies/index.ts +21 -0
- package/src/domains/context/working-set/policies/structural.ts +160 -0
- package/src/domains/context/working-set/project.ts +132 -0
- package/src/domains/context/working-set/protect.ts +109 -0
- package/src/domains/context/working-set/recall.ts +177 -0
- package/src/domains/context/working-set/replay/controls.ts +112 -0
- package/src/domains/context/working-set/replay/load-clio.ts +199 -0
- package/src/domains/context/working-set/replay/metrics.ts +185 -0
- package/src/domains/context/working-set/replay/reference-graph.ts +79 -0
- package/src/domains/context/working-set/replay/report.ts +139 -0
- package/src/domains/context/working-set/replay/runner.ts +325 -0
- package/src/domains/context/working-set/replay/synthetic.ts +422 -0
- package/src/domains/context/working-set/replay/trace.ts +21 -0
- package/src/domains/context/working-set/visible.ts +54 -0
- package/src/domains/evidence/build.ts +112 -45
- package/src/domains/evidence/eval.ts +24 -7
- package/src/domains/evidence/index.ts +53 -0
- package/src/domains/evidence/ordering.ts +12 -0
- package/src/domains/evidence/run-trust.ts +221 -0
- package/src/domains/evidence/store.ts +46 -6
- package/src/domains/evidence/trust-status.ts +854 -0
- package/src/domains/evidence/types.ts +26 -0
- package/src/domains/middleware/memory-intervention.ts +3 -0
- package/src/domains/middleware/stalled-turn.ts +165 -4
- package/src/domains/safety/autonomy.ts +1 -1
- package/src/domains/safety/default-path-policy.ts +8 -0
- package/src/domains/safety/finish-contract.ts +4 -3
- package/src/domains/safety/policy-engine.ts +48 -6
- package/src/domains/session/compaction/compact.ts +23 -1
- package/src/domains/session/compaction/cut-point.ts +2 -0
- package/src/domains/session/compaction/tokens.ts +16 -1
- package/src/domains/session/context-ledger.ts +2 -0
- package/src/domains/session/entries.ts +107 -1
- package/src/domains/session/manager.ts +9 -2
- package/src/domains/session/migrations/index.ts +22 -3
- package/src/engine/acp/server.ts +3 -0
- package/src/engine/agent.ts +18 -1
- package/src/engine/session.ts +9 -3
- package/src/entry/orchestrator.ts +16 -4
- package/src/interactive/chat-loop-messages.ts +18 -6
- package/src/interactive/chat-panel.ts +17 -1
- package/src/interactive/chat-renderer.ts +30 -21
- package/src/interactive/context-meter.ts +10 -0
- package/src/interactive/context-overlay.ts +81 -6
- package/src/interactive/context-recall-command.ts +110 -0
- package/src/interactive/interactive-slash-runtime.ts +37 -1
- package/src/interactive/model-session-replay.ts +21 -0
- package/src/interactive/overlay-general-openers.ts +6 -0
- package/src/interactive/overlay-session-lifecycle.ts +8 -4
- package/src/interactive/renderers/tool-execution.ts +18 -2
- package/src/interactive/session-transcript.ts +2 -2
- package/src/interactive/slash-commands.ts +29 -2
- package/src/interactive/turn-context.ts +238 -88
- package/src/interactive/turn-middleware.ts +6 -6
- package/src/tools/agent-tools.ts +11 -4
- package/src/tools/bash.ts +144 -82
- package/src/tools/builtin-tool-catalog.ts +11 -5
- package/src/tools/context/index.ts +105 -3
- package/src/tools/context/surface.ts +3 -2
- package/src/tools/core-bootstrap.ts +21 -0
- package/src/tools/dispatch-runner.ts +9 -7
- package/src/tools/monitor.ts +28 -20
- package/src/tools/registry.ts +59 -7
- package/src/tools/result-disposition.ts +550 -0
- package/src/tools/result-shaping.ts +262 -19
- package/src/tools/safe-exec.ts +2 -0
- package/src/tools/verify/authoring.ts +1119 -0
- package/src/tools/verify/catalog.ts +346 -0
- package/src/tools/verify/index.ts +13 -3
- package/src/tools/verify/scripts.ts +135 -37
- package/src/tools/verify/surface.ts +9 -5
- package/src/tools/worker-evidence.ts +35 -12
- package/dist/chunk-J7CWMCQD.js +0 -255
- package/dist/chunk-T6YILFSB.js +0 -80
- package/dist/chunk-VAKQQHWR.js +0 -434
- package/dist/chunk-VPAYEGVX.js +0 -184
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
EMPTY_WORKING_SET_VIEW,
|
|
4
|
+
callPathsByToolCallId,
|
|
5
|
+
offloadPathOf,
|
|
6
|
+
parseRefKey,
|
|
7
|
+
primaryPathOf,
|
|
8
|
+
refKey,
|
|
9
|
+
toolResultPayload,
|
|
10
|
+
toolResultText
|
|
11
|
+
} from "./chunk-TZSKNMZG.js";
|
|
12
|
+
import {
|
|
13
|
+
filterEntriesToActivePath
|
|
14
|
+
} from "./chunk-W6GROXXM.js";
|
|
15
|
+
import {
|
|
16
|
+
ceilChars
|
|
17
|
+
} from "./chunk-BPGS2WCQ.js";
|
|
18
|
+
import {
|
|
19
|
+
init_esm_shims
|
|
20
|
+
} from "./chunk-3R73A4XB.js";
|
|
21
|
+
|
|
22
|
+
// src/domains/context/working-set/recall.ts
|
|
23
|
+
init_esm_shims();
|
|
24
|
+
function isThinkingEntry(entry) {
|
|
25
|
+
return entry.kind === "message" && entry.role === "assistant";
|
|
26
|
+
}
|
|
27
|
+
function isToolResultEntry(entry) {
|
|
28
|
+
return entry.kind === "message" && entry.role === "tool_result";
|
|
29
|
+
}
|
|
30
|
+
function resolveRecall(entries, view, ref, activeLeafTurnId) {
|
|
31
|
+
const parsed = parseRefKey(ref);
|
|
32
|
+
if (parsed === null) return { ok: false, error: { kind: "invalid_ref", ref } };
|
|
33
|
+
const key = refKey(parsed);
|
|
34
|
+
const active = filterEntriesToActivePath(entries, activeLeafTurnId);
|
|
35
|
+
const entry = active.find((candidate) => candidate.turnId === key);
|
|
36
|
+
if (entry === void 0) {
|
|
37
|
+
return { ok: false, error: { kind: "not_on_active_path", ref: key } };
|
|
38
|
+
}
|
|
39
|
+
if (isThinkingEntry(entry) || !view.evicted.has(key) || !isToolResultEntry(entry)) {
|
|
40
|
+
return { ok: false, error: { kind: "not_evicted", ref: key } };
|
|
41
|
+
}
|
|
42
|
+
const payload = toolResultPayload(entry.payload);
|
|
43
|
+
const body = toolResultText(payload.result);
|
|
44
|
+
const offloadPath = offloadPathOf(payload);
|
|
45
|
+
return {
|
|
46
|
+
ok: true,
|
|
47
|
+
result: {
|
|
48
|
+
ref: parsed,
|
|
49
|
+
entry,
|
|
50
|
+
body,
|
|
51
|
+
tokens: ceilChars(body.length),
|
|
52
|
+
...offloadPath !== void 0 ? { offloadPath } : {}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function recallParentTurnId(entries, activeLeafTurnId) {
|
|
57
|
+
const active = filterEntriesToActivePath(entries, activeLeafTurnId);
|
|
58
|
+
for (let i = active.length - 1; i >= 0; i -= 1) {
|
|
59
|
+
const candidate = active[i];
|
|
60
|
+
if (candidate?.kind === "message") return candidate.turnId;
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
function buildRecallFields(result, meta) {
|
|
65
|
+
return {
|
|
66
|
+
kind: "contextRecall",
|
|
67
|
+
ref: { entry: result.ref.entry },
|
|
68
|
+
trigger: meta.trigger,
|
|
69
|
+
tokensReadmitted: result.tokens,
|
|
70
|
+
...meta.toolCallId !== void 0 ? { toolCallId: meta.toolCallId } : {}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
var MAX_LISTED_REFS = 8;
|
|
74
|
+
function recallableRefListing(entries, view) {
|
|
75
|
+
const byTurnId = /* @__PURE__ */ new Map();
|
|
76
|
+
for (const entry of entries) byTurnId.set(entry.turnId, entry);
|
|
77
|
+
const callPaths = callPathsByToolCallId(entries);
|
|
78
|
+
const refs = [];
|
|
79
|
+
for (const key of view.evicted.keys()) {
|
|
80
|
+
const entry = byTurnId.get(key);
|
|
81
|
+
if (entry === void 0 || !isToolResultEntry(entry)) continue;
|
|
82
|
+
const payload = toolResultPayload(entry.payload);
|
|
83
|
+
const toolCallId = typeof payload.obj.toolCallId === "string" ? payload.obj.toolCallId : void 0;
|
|
84
|
+
const path = primaryPathOf(payload) ?? (toolCallId === void 0 ? void 0 : callPaths.get(toolCallId));
|
|
85
|
+
refs.push(`${key} (${payload.toolName}${path === void 0 ? "" : ` ${path}`})`);
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
refs: refs.slice(0, MAX_LISTED_REFS),
|
|
89
|
+
remaining: Math.max(0, refs.length - MAX_LISTED_REFS)
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function recallableRefMessage(entries, view) {
|
|
93
|
+
const listing = recallableRefListing(entries, view);
|
|
94
|
+
if (listing.refs.length === 0) return "No recallable refs on the active path.";
|
|
95
|
+
const more = listing.remaining > 0 ? `, and ${listing.remaining} more` : "";
|
|
96
|
+
return `Recallable refs on the active path: ${listing.refs.join(", ")}${more}.`;
|
|
97
|
+
}
|
|
98
|
+
function recallErrorMessage(error, entries = [], view = EMPTY_WORKING_SET_VIEW) {
|
|
99
|
+
const listing = ` ${recallableRefMessage(entries, view)}`;
|
|
100
|
+
switch (error.kind) {
|
|
101
|
+
case "invalid_ref":
|
|
102
|
+
return `recall ref must be a single turnId without whitespace; got '${error.ref}'.`;
|
|
103
|
+
case "not_on_active_path":
|
|
104
|
+
return `ref ${error.ref} is not on the active path of this session (unknown or on an abandoned branch).${listing}`;
|
|
105
|
+
case "not_evicted": {
|
|
106
|
+
const entry = entries.find((candidate) => candidate.turnId === error.ref);
|
|
107
|
+
if (entry !== void 0 && isThinkingEntry(entry)) {
|
|
108
|
+
return `ref ${error.ref} is an assistant turn; thinking is not recallable.${listing}`;
|
|
109
|
+
}
|
|
110
|
+
return `ref ${error.ref} is not evicted; its content is already in context.${listing}`;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export {
|
|
116
|
+
resolveRecall,
|
|
117
|
+
recallParentTurnId,
|
|
118
|
+
buildRecallFields,
|
|
119
|
+
recallableRefListing,
|
|
120
|
+
recallErrorMessage
|
|
121
|
+
};
|
|
122
|
+
//# sourceMappingURL=chunk-VSNATDE6.js.map
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
init_esm_shims
|
|
4
|
+
} from "./chunk-3R73A4XB.js";
|
|
5
|
+
|
|
6
|
+
// src/domains/session/tree/active-path.ts
|
|
7
|
+
init_esm_shims();
|
|
8
|
+
function filterEntriesToActivePath(entries, leafTurnId) {
|
|
9
|
+
const messages = [];
|
|
10
|
+
const messagesById = /* @__PURE__ */ new Map();
|
|
11
|
+
for (const entry of entries) {
|
|
12
|
+
if (entry.kind !== "message") continue;
|
|
13
|
+
messages.push(entry);
|
|
14
|
+
messagesById.set(entry.turnId, entry);
|
|
15
|
+
}
|
|
16
|
+
const latest = messages[messages.length - 1];
|
|
17
|
+
const pinnedLeaf = resolveLeafMessage(entries, messagesById, leafTurnId);
|
|
18
|
+
if (!hasBranch(messages) && (pinnedLeaf === void 0 || pinnedLeaf.turnId === latest?.turnId)) return [...entries];
|
|
19
|
+
const leaf = pinnedLeaf ?? latest;
|
|
20
|
+
if (!leaf) return [...entries];
|
|
21
|
+
const pathIds = /* @__PURE__ */ new Set();
|
|
22
|
+
let current = leaf;
|
|
23
|
+
while (current && !pathIds.has(current.turnId)) {
|
|
24
|
+
pathIds.add(current.turnId);
|
|
25
|
+
if (current.parentTurnId === null) break;
|
|
26
|
+
current = messagesById.get(current.parentTurnId);
|
|
27
|
+
}
|
|
28
|
+
const leafIndex = entries.findIndex((entry) => entry.kind === "message" && entry.turnId === leaf.turnId);
|
|
29
|
+
return entries.filter((entry, index) => entryBelongsToPath(entry, pathIds, leafIndex >= 0 && index <= leafIndex));
|
|
30
|
+
}
|
|
31
|
+
function resolveLeafMessage(entries, messagesById, leafTurnId) {
|
|
32
|
+
if (leafTurnId === void 0) return void 0;
|
|
33
|
+
const direct = messagesById.get(leafTurnId);
|
|
34
|
+
if (direct) return direct;
|
|
35
|
+
const sidecar = entries.find((entry) => entry.turnId === leafTurnId);
|
|
36
|
+
if (!sidecar) return void 0;
|
|
37
|
+
const anchor = sidecarAnchorTurnId(sidecar);
|
|
38
|
+
return anchor === null ? void 0 : messagesById.get(anchor);
|
|
39
|
+
}
|
|
40
|
+
function sidecarAnchorTurnId(entry) {
|
|
41
|
+
if (entry.kind === "label") return entry.targetTurnId;
|
|
42
|
+
if (entry.kind === "sessionInfo") return entry.targetTurnId ?? entry.parentTurnId;
|
|
43
|
+
if (entry.kind === "compactionSummary" && entry.firstKeptTurnId.length > 0) return entry.firstKeptTurnId;
|
|
44
|
+
return entry.parentTurnId;
|
|
45
|
+
}
|
|
46
|
+
function hasBranch(messages) {
|
|
47
|
+
const seenParents = /* @__PURE__ */ new Set();
|
|
48
|
+
for (const message of messages) {
|
|
49
|
+
if (message.parentTurnId === null) continue;
|
|
50
|
+
if (seenParents.has(message.parentTurnId)) return true;
|
|
51
|
+
seenParents.add(message.parentTurnId);
|
|
52
|
+
}
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
function entryBelongsToPath(entry, pathIds, atOrBeforeLeaf) {
|
|
56
|
+
if (entry.kind === "message") return pathIds.has(entry.turnId);
|
|
57
|
+
if (entry.kind === "label") return pathIds.has(entry.targetTurnId);
|
|
58
|
+
if (entry.kind === "sessionInfo") return entry.targetTurnId === void 0 || pathIds.has(entry.targetTurnId);
|
|
59
|
+
if (entry.kind === "compactionSummary" && entry.firstKeptTurnId.length > 0 && pathIds.has(entry.firstKeptTurnId)) {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
return entry.parentTurnId === null ? atOrBeforeLeaf : pathIds.has(entry.parentTurnId);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export {
|
|
66
|
+
filterEntriesToActivePath,
|
|
67
|
+
entryBelongsToPath
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=chunk-W6GROXXM.js.map
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
isSessionEntry
|
|
4
|
+
} from "./chunk-BEY543CS.js";
|
|
5
|
+
import {
|
|
6
|
+
init_esm_shims
|
|
7
|
+
} from "./chunk-3R73A4XB.js";
|
|
8
|
+
|
|
9
|
+
// src/domains/session/task-board.ts
|
|
10
|
+
init_esm_shims();
|
|
11
|
+
import { randomUUID } from "node:crypto";
|
|
12
|
+
var TASK_BOARD_GOAL_ID = "board";
|
|
13
|
+
var LEGACY_TASK_BOARD_ID = "legacy";
|
|
14
|
+
function isOpenUserTask(task) {
|
|
15
|
+
return task.origin === "user" && (task.status === "pending" || task.status === "active");
|
|
16
|
+
}
|
|
17
|
+
function taskBoardCounts(board) {
|
|
18
|
+
const counts = {
|
|
19
|
+
total: board.tasks.length,
|
|
20
|
+
completed: 0,
|
|
21
|
+
active: 0,
|
|
22
|
+
pending: 0,
|
|
23
|
+
blocked: 0,
|
|
24
|
+
cancelled: 0,
|
|
25
|
+
open: 0
|
|
26
|
+
};
|
|
27
|
+
for (const task of board.tasks) {
|
|
28
|
+
if (task.status === "completed") counts.completed += 1;
|
|
29
|
+
else if (task.status === "active") counts.active += 1;
|
|
30
|
+
else if (task.status === "pending") counts.pending += 1;
|
|
31
|
+
else if (task.status === "blocked") counts.blocked += 1;
|
|
32
|
+
else counts.cancelled += 1;
|
|
33
|
+
}
|
|
34
|
+
counts.open = counts.pending + counts.active;
|
|
35
|
+
return counts;
|
|
36
|
+
}
|
|
37
|
+
function boardStatus(tasks) {
|
|
38
|
+
const counts = taskBoardCounts({ tasks });
|
|
39
|
+
if (counts.total === 0) return "pending";
|
|
40
|
+
if (counts.active > 0) return "active";
|
|
41
|
+
if (counts.open === 0 && counts.blocked === 0) return "completed";
|
|
42
|
+
if (counts.blocked > 0 && counts.open === 0) return "blocked";
|
|
43
|
+
return "pending";
|
|
44
|
+
}
|
|
45
|
+
function toTaskLedgerEntryFields(board, now) {
|
|
46
|
+
const evidence = [];
|
|
47
|
+
const subgoals = board.tasks.map((task) => {
|
|
48
|
+
if (task.status === "completed" && task.evidence) {
|
|
49
|
+
evidence.push({
|
|
50
|
+
id: `${task.id}.evidence`,
|
|
51
|
+
description: task.evidence,
|
|
52
|
+
status: "passed",
|
|
53
|
+
observedAt: now.toISOString()
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
const goal = {
|
|
57
|
+
id: task.id,
|
|
58
|
+
title: task.title,
|
|
59
|
+
status: task.status,
|
|
60
|
+
parentGoalId: TASK_BOARD_GOAL_ID
|
|
61
|
+
};
|
|
62
|
+
if (task.origin) goal.origin = task.origin;
|
|
63
|
+
if (task.userTaskId) goal.userTaskId = task.userTaskId;
|
|
64
|
+
if (task.reason) goal.description = task.reason;
|
|
65
|
+
return goal;
|
|
66
|
+
});
|
|
67
|
+
return {
|
|
68
|
+
kind: "taskLedger",
|
|
69
|
+
parentTurnId: null,
|
|
70
|
+
boardId: board.boardId,
|
|
71
|
+
goals: [{ id: TASK_BOARD_GOAL_ID, title: board.title, status: boardStatus(board.tasks) }],
|
|
72
|
+
subgoals,
|
|
73
|
+
activeRunIds: [...board.activeRunIds],
|
|
74
|
+
requiredValidationEvidence: evidence
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function isTaskLedgerShaped(value) {
|
|
78
|
+
return isSessionEntry(value) && value.kind === "taskLedger";
|
|
79
|
+
}
|
|
80
|
+
function foldTaskBoard(entries) {
|
|
81
|
+
let last = null;
|
|
82
|
+
for (const raw of entries) {
|
|
83
|
+
if (isTaskLedgerShaped(raw)) last = toEntryView(raw);
|
|
84
|
+
}
|
|
85
|
+
return last;
|
|
86
|
+
}
|
|
87
|
+
function foldSessionTaskHistory(entries) {
|
|
88
|
+
const boards = /* @__PURE__ */ new Map();
|
|
89
|
+
for (const [index, raw] of entries.entries()) {
|
|
90
|
+
if (!isTaskLedgerShaped(raw)) continue;
|
|
91
|
+
const view = toEntryView(raw);
|
|
92
|
+
if (!view) continue;
|
|
93
|
+
const boardId = typeof raw.boardId === "string" && raw.boardId.length > 0 ? raw.boardId : LEGACY_TASK_BOARD_ID;
|
|
94
|
+
const timestamp = typeof raw.timestamp === "string" ? raw.timestamp : "";
|
|
95
|
+
if (boardId === LEGACY_TASK_BOARD_ID) {
|
|
96
|
+
boards.set(boardId, {
|
|
97
|
+
boardId,
|
|
98
|
+
title: view.title,
|
|
99
|
+
tasks: new Map(view.tasks.map((task) => [task.id, task])),
|
|
100
|
+
lastSnapshotAt: timestamp,
|
|
101
|
+
lastIndex: index
|
|
102
|
+
});
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
const existing = boards.get(boardId);
|
|
106
|
+
if (!existing) {
|
|
107
|
+
boards.set(boardId, {
|
|
108
|
+
boardId,
|
|
109
|
+
title: view.title,
|
|
110
|
+
tasks: new Map(view.tasks.map((task) => [task.id, task])),
|
|
111
|
+
lastSnapshotAt: timestamp,
|
|
112
|
+
lastIndex: index
|
|
113
|
+
});
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
existing.title = view.title;
|
|
117
|
+
for (const task of view.tasks) existing.tasks.set(task.id, task);
|
|
118
|
+
existing.lastSnapshotAt = timestamp;
|
|
119
|
+
existing.lastIndex = index;
|
|
120
|
+
}
|
|
121
|
+
return [...boards.values()].sort((left, right) => right.lastIndex - left.lastIndex).map(({ lastIndex: _lastIndex, tasks, ...board }) => ({ ...board, tasks: [...tasks.values()] }));
|
|
122
|
+
}
|
|
123
|
+
function toEntryView(entry) {
|
|
124
|
+
const boardGoal = entry.goals[0];
|
|
125
|
+
if (!boardGoal) return null;
|
|
126
|
+
const evidenceByTask = /* @__PURE__ */ new Map();
|
|
127
|
+
for (const item of entry.requiredValidationEvidence) {
|
|
128
|
+
const taskId = item.id.endsWith(".evidence") ? item.id.slice(0, -".evidence".length) : item.id;
|
|
129
|
+
evidenceByTask.set(taskId, item.description);
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
132
|
+
boardId: entry.boardId ?? LEGACY_TASK_BOARD_ID,
|
|
133
|
+
title: boardGoal.title,
|
|
134
|
+
tasks: entry.subgoals.map((goal) => {
|
|
135
|
+
const task = {
|
|
136
|
+
id: goal.id,
|
|
137
|
+
title: goal.title,
|
|
138
|
+
status: goal.status,
|
|
139
|
+
origin: goal.origin ?? "agent"
|
|
140
|
+
};
|
|
141
|
+
if (goal.userTaskId) task.userTaskId = goal.userTaskId;
|
|
142
|
+
if (goal.description) task.reason = goal.description;
|
|
143
|
+
const evidence = evidenceByTask.get(goal.id);
|
|
144
|
+
if (evidence) task.evidence = evidence;
|
|
145
|
+
return task;
|
|
146
|
+
}),
|
|
147
|
+
// Run linkage is process-live: the runs recorded in old entries ended
|
|
148
|
+
// with the process that dispatched them, so a refold starts empty and
|
|
149
|
+
// the historical linkage stays readable in the earlier entries.
|
|
150
|
+
activeRunIds: []
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function nextTaskId(tasks) {
|
|
154
|
+
let max = 0;
|
|
155
|
+
for (const task of tasks) {
|
|
156
|
+
const match = /^t(\d+)$/.exec(task.id);
|
|
157
|
+
if (match) max = Math.max(max, Number(match[1]));
|
|
158
|
+
}
|
|
159
|
+
return max + 1;
|
|
160
|
+
}
|
|
161
|
+
function normalizeTitles(titles) {
|
|
162
|
+
return titles.map((title) => title.trim()).filter((title) => title.length > 0);
|
|
163
|
+
}
|
|
164
|
+
function applyMutation(board, mutation) {
|
|
165
|
+
if (mutation.op === "plan") {
|
|
166
|
+
const titles = normalizeTitles(mutation.tasks);
|
|
167
|
+
if (mutation.title.trim().length === 0) return { error: "plan requires a non-empty title" };
|
|
168
|
+
if (titles.length === 0) return { error: "plan requires at least one task" };
|
|
169
|
+
const retained = board?.tasks.filter(isOpenUserTask) ?? [];
|
|
170
|
+
const notes2 = [];
|
|
171
|
+
const replacedOpen = board ? taskBoardCounts(board).open - retained.length : 0;
|
|
172
|
+
if (board && replacedOpen > 0) {
|
|
173
|
+
notes2.push(`replaced board "${board.title}" with ${replacedOpen} agent task(s) still open`);
|
|
174
|
+
}
|
|
175
|
+
if (retained.length > 0) notes2.push(`preserved ${retained.length} open operator task(s)`);
|
|
176
|
+
const start = nextTaskId(retained);
|
|
177
|
+
return {
|
|
178
|
+
board: {
|
|
179
|
+
boardId: "",
|
|
180
|
+
title: mutation.title.trim(),
|
|
181
|
+
tasks: [
|
|
182
|
+
...retained,
|
|
183
|
+
...titles.map((title, index) => ({
|
|
184
|
+
id: `t${start + index}`,
|
|
185
|
+
title,
|
|
186
|
+
status: "pending",
|
|
187
|
+
origin: "agent"
|
|
188
|
+
}))
|
|
189
|
+
],
|
|
190
|
+
// Runs in flight outlive a board swap: they belong to the session,
|
|
191
|
+
// so the fresh board inherits the linkage until the runs finish.
|
|
192
|
+
activeRunIds: board?.activeRunIds ?? []
|
|
193
|
+
},
|
|
194
|
+
notes: notes2
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
if (mutation.op === "pick") {
|
|
198
|
+
const title = mutation.title.trim();
|
|
199
|
+
if (title.length === 0) return { error: "pick requires a non-empty operator task title" };
|
|
200
|
+
if (!/^u[1-9]\d*$/.test(mutation.userTaskId)) return { error: "pick requires an operator task id like u3" };
|
|
201
|
+
if (board?.tasks.some(
|
|
202
|
+
(task) => task.userTaskId === mutation.userTaskId && (task.status === "pending" || task.status === "active" || task.status === "completed")
|
|
203
|
+
)) {
|
|
204
|
+
return { error: `operator task ${mutation.userTaskId} is already linked to durable board work` };
|
|
205
|
+
}
|
|
206
|
+
const tasks2 = board?.tasks ?? [];
|
|
207
|
+
const picked = {
|
|
208
|
+
id: `t${nextTaskId(tasks2)}`,
|
|
209
|
+
title,
|
|
210
|
+
status: "pending",
|
|
211
|
+
origin: "user",
|
|
212
|
+
userTaskId: mutation.userTaskId
|
|
213
|
+
};
|
|
214
|
+
return {
|
|
215
|
+
board: {
|
|
216
|
+
boardId: board?.boardId ?? "",
|
|
217
|
+
title: board?.title ?? "Operator tasks",
|
|
218
|
+
tasks: [...tasks2, picked],
|
|
219
|
+
activeRunIds: board?.activeRunIds ?? []
|
|
220
|
+
},
|
|
221
|
+
notes: []
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
if (board === null) return { error: 'no task board yet; declare one with action="plan" first' };
|
|
225
|
+
if (mutation.op === "add") {
|
|
226
|
+
const titles = normalizeTitles(mutation.tasks);
|
|
227
|
+
if (titles.length === 0) return { error: "add requires at least one task" };
|
|
228
|
+
const start = nextTaskId(board.tasks);
|
|
229
|
+
const added = titles.map((title, index) => ({
|
|
230
|
+
id: `t${start + index}`,
|
|
231
|
+
title,
|
|
232
|
+
status: "pending",
|
|
233
|
+
origin: "agent"
|
|
234
|
+
}));
|
|
235
|
+
return { board: { ...board, tasks: [...board.tasks, ...added] }, notes: [] };
|
|
236
|
+
}
|
|
237
|
+
const target = board.tasks.find((task) => task.id === mutation.id);
|
|
238
|
+
if (!target) return { error: `task ${mutation.id} not found on the board` };
|
|
239
|
+
if (mutation.op === "block" && mutation.reason.trim().length === 0) {
|
|
240
|
+
return { error: "block requires a reason so the ledger records why work stopped" };
|
|
241
|
+
}
|
|
242
|
+
if (mutation.op === "done") {
|
|
243
|
+
if (mutation.evidence.trim().length === 0) {
|
|
244
|
+
return {
|
|
245
|
+
error: "done requires note as the evidence that the task actually finished (the command you ran, the file:line you verified). If the work did not happen, use block with a reason or drop it."
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
if (target.status === "pending") {
|
|
249
|
+
return {
|
|
250
|
+
error: `task ${target.id} was never started, so it cannot be completed. Start it and do the work, or record the truth with block (reason) or drop.`
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
const notes = [];
|
|
255
|
+
const tasks = board.tasks.map((task) => {
|
|
256
|
+
if (task.id !== target.id) {
|
|
257
|
+
if (mutation.op === "start" && task.status === "active") {
|
|
258
|
+
notes.push(`parked ${task.id} back to pending (one task active at a time)`);
|
|
259
|
+
return { ...task, status: "pending" };
|
|
260
|
+
}
|
|
261
|
+
return task;
|
|
262
|
+
}
|
|
263
|
+
return applyStatusMutation(task, mutation);
|
|
264
|
+
});
|
|
265
|
+
return { board: { ...board, tasks }, notes };
|
|
266
|
+
}
|
|
267
|
+
function applyStatusMutation(task, mutation) {
|
|
268
|
+
switch (mutation.op) {
|
|
269
|
+
case "start":
|
|
270
|
+
return { ...task, status: "active" };
|
|
271
|
+
case "done": {
|
|
272
|
+
const done = { ...task, status: "completed", evidence: mutation.evidence.trim() };
|
|
273
|
+
delete done.reason;
|
|
274
|
+
return done;
|
|
275
|
+
}
|
|
276
|
+
case "block":
|
|
277
|
+
return { ...task, status: "blocked", reason: mutation.reason.trim() };
|
|
278
|
+
case "drop": {
|
|
279
|
+
const dropped = { ...task, status: "cancelled" };
|
|
280
|
+
if (mutation.reason?.trim()) dropped.reason = mutation.reason.trim();
|
|
281
|
+
return dropped;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
function createTaskBoardStore(deps = {}) {
|
|
286
|
+
let cachedSessionId;
|
|
287
|
+
let dirty = true;
|
|
288
|
+
let board = null;
|
|
289
|
+
const syncToSession = () => {
|
|
290
|
+
const sessionId = deps.getSessionId?.() ?? null;
|
|
291
|
+
if (!dirty && cachedSessionId === sessionId) return;
|
|
292
|
+
dirty = false;
|
|
293
|
+
cachedSessionId = sessionId;
|
|
294
|
+
try {
|
|
295
|
+
board = deps.readEntries ? foldTaskBoard(deps.readEntries()) : null;
|
|
296
|
+
} catch {
|
|
297
|
+
board = null;
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
const persist = (next) => {
|
|
301
|
+
try {
|
|
302
|
+
deps.appendEntry?.(toTaskLedgerEntryFields(next, deps.now?.() ?? /* @__PURE__ */ new Date()));
|
|
303
|
+
} catch {
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
const mutationRequiresAcknowledgement = (current, mutation) => {
|
|
307
|
+
if (mutation.op === "pick") return true;
|
|
308
|
+
if (mutation.op === "plan") return current?.tasks.some(isOpenUserTask) ?? false;
|
|
309
|
+
if (mutation.op !== "done") return false;
|
|
310
|
+
return current?.tasks.some((task) => task.id === mutation.id && task.origin === "user") ?? false;
|
|
311
|
+
};
|
|
312
|
+
return {
|
|
313
|
+
snapshot() {
|
|
314
|
+
syncToSession();
|
|
315
|
+
return board;
|
|
316
|
+
},
|
|
317
|
+
cachedSnapshot() {
|
|
318
|
+
const sessionId = deps.getSessionId?.() ?? null;
|
|
319
|
+
return !dirty && cachedSessionId === sessionId ? board : null;
|
|
320
|
+
},
|
|
321
|
+
historySnapshot() {
|
|
322
|
+
syncToSession();
|
|
323
|
+
try {
|
|
324
|
+
return deps.readEntries ? foldSessionTaskHistory(deps.readEntries()) : [];
|
|
325
|
+
} catch {
|
|
326
|
+
return [];
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
apply(mutation) {
|
|
330
|
+
syncToSession();
|
|
331
|
+
const result = applyMutation(board, mutation);
|
|
332
|
+
if ("error" in result) return { ok: false, message: result.error };
|
|
333
|
+
const needsBoardId = mutation.op === "plan" || result.board.boardId.length === 0;
|
|
334
|
+
const nextBoard = needsBoardId ? { ...result.board, boardId: deps.createBoardId?.() ?? randomUUID() } : result.board;
|
|
335
|
+
if (mutationRequiresAcknowledgement(board, mutation)) {
|
|
336
|
+
if (!deps.appendEntry) {
|
|
337
|
+
return { ok: false, message: "durable task-ledger persistence is unavailable for operator-linked work" };
|
|
338
|
+
}
|
|
339
|
+
try {
|
|
340
|
+
deps.appendEntry(toTaskLedgerEntryFields(nextBoard, deps.now?.() ?? /* @__PURE__ */ new Date()));
|
|
341
|
+
} catch (error) {
|
|
342
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
343
|
+
return { ok: false, message: `could not persist operator-linked task board: ${message}` };
|
|
344
|
+
}
|
|
345
|
+
board = nextBoard;
|
|
346
|
+
return { ok: true, board: nextBoard, notes: result.notes };
|
|
347
|
+
}
|
|
348
|
+
board = nextBoard;
|
|
349
|
+
persist(nextBoard);
|
|
350
|
+
return { ok: true, board: nextBoard, notes: result.notes };
|
|
351
|
+
},
|
|
352
|
+
attachRun(runId) {
|
|
353
|
+
syncToSession();
|
|
354
|
+
if (board === null || runId.length === 0 || board.activeRunIds.includes(runId)) return;
|
|
355
|
+
board = { ...board, activeRunIds: [...board.activeRunIds, runId] };
|
|
356
|
+
persist(board);
|
|
357
|
+
},
|
|
358
|
+
detachRun(runId) {
|
|
359
|
+
syncToSession();
|
|
360
|
+
if (board === null || !board.activeRunIds.includes(runId)) return;
|
|
361
|
+
board = { ...board, activeRunIds: board.activeRunIds.filter((id) => id !== runId) };
|
|
362
|
+
persist(board);
|
|
363
|
+
},
|
|
364
|
+
invalidate() {
|
|
365
|
+
dirty = true;
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
export {
|
|
371
|
+
taskBoardCounts,
|
|
372
|
+
foldSessionTaskHistory,
|
|
373
|
+
createTaskBoardStore
|
|
374
|
+
};
|
|
375
|
+
//# sourceMappingURL=chunk-WPQLXFOZ.js.map
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
readSettings,
|
|
4
4
|
settingsPath,
|
|
5
5
|
updateSettings
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-AD2SYQYC.js";
|
|
7
7
|
import {
|
|
8
8
|
DEFAULT_SETTINGS
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-4OC57DA6.js";
|
|
10
10
|
import {
|
|
11
11
|
require_dist
|
|
12
12
|
} from "./chunk-APJ265NV.js";
|
|
@@ -552,4 +552,4 @@ export {
|
|
|
552
552
|
importShareArchive,
|
|
553
553
|
ShareDomainModule
|
|
554
554
|
};
|
|
555
|
-
//# sourceMappingURL=chunk-
|
|
555
|
+
//# sourceMappingURL=chunk-WR67VIZY.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
assertAgentIdNamespace
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KRPY7NTG.js";
|
|
5
5
|
import {
|
|
6
6
|
parseFrontmatter
|
|
7
7
|
} from "./chunk-QKMUKYO7.js";
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
import {
|
|
22
22
|
createSafetyPolicyEngine,
|
|
23
23
|
parseResultContract
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-7RXG6QRZ.js";
|
|
25
25
|
import {
|
|
26
26
|
assertAgentSpecPolicy,
|
|
27
27
|
classify,
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
isAgentProjectContextTier,
|
|
34
34
|
isShadowAgent,
|
|
35
35
|
normalizeAgentSpec
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-AOCYTWAV.js";
|
|
37
37
|
import {
|
|
38
38
|
clioConfigDir,
|
|
39
39
|
clioStateDir,
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
import {
|
|
43
43
|
BusChannels,
|
|
44
44
|
isRunAbortedPayload
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-TTNYS3EA.js";
|
|
46
46
|
import {
|
|
47
47
|
resolvePackageRoot
|
|
48
48
|
} from "./chunk-IWHMRKLL.js";
|
|
@@ -1036,4 +1036,4 @@ export {
|
|
|
1036
1036
|
AgentsDomainModule,
|
|
1037
1037
|
SafetyDomainModule
|
|
1038
1038
|
};
|
|
1039
|
-
//# sourceMappingURL=chunk-
|
|
1039
|
+
//# sourceMappingURL=chunk-X6COSD2O.js.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
init_esm_shims
|
|
4
|
+
} from "./chunk-3R73A4XB.js";
|
|
5
|
+
|
|
6
|
+
// src/core/shared-bus.ts
|
|
7
|
+
init_esm_shims();
|
|
8
|
+
|
|
9
|
+
// src/core/event-bus.ts
|
|
10
|
+
init_esm_shims();
|
|
11
|
+
function reportListenerError(channel, error) {
|
|
12
|
+
const message = error instanceof Error ? error.stack ?? error.message : String(error);
|
|
13
|
+
console.error(`[clio:event-bus] Listener crashed on ${channel}: ${message}`);
|
|
14
|
+
}
|
|
15
|
+
function createSafeEventBus() {
|
|
16
|
+
const registry = /* @__PURE__ */ new Map();
|
|
17
|
+
const deliver = (channel, payload) => {
|
|
18
|
+
const ls = registry.get(channel);
|
|
19
|
+
if (!ls) return;
|
|
20
|
+
for (const listener of [...ls]) {
|
|
21
|
+
try {
|
|
22
|
+
const result = listener(payload);
|
|
23
|
+
if (result && typeof result.then === "function") {
|
|
24
|
+
result.catch((error) => reportListenerError(channel, error));
|
|
25
|
+
}
|
|
26
|
+
} catch (error) {
|
|
27
|
+
reportListenerError(channel, error);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const bus = {
|
|
32
|
+
emit(channel, payload) {
|
|
33
|
+
deliver(channel, payload);
|
|
34
|
+
},
|
|
35
|
+
on(channel, listener) {
|
|
36
|
+
const set = registry.get(channel) ?? /* @__PURE__ */ new Set();
|
|
37
|
+
set.add(listener);
|
|
38
|
+
registry.set(channel, set);
|
|
39
|
+
return () => {
|
|
40
|
+
const current = registry.get(channel);
|
|
41
|
+
if (!current) return;
|
|
42
|
+
current.delete(listener);
|
|
43
|
+
if (current.size === 0) registry.delete(channel);
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
listeners(channel) {
|
|
47
|
+
return [...registry.get(channel) ?? []];
|
|
48
|
+
},
|
|
49
|
+
clear() {
|
|
50
|
+
registry.clear();
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
return bus;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// src/core/shared-bus.ts
|
|
57
|
+
var sharedBus = null;
|
|
58
|
+
function getSharedBus() {
|
|
59
|
+
if (!sharedBus) sharedBus = createSafeEventBus();
|
|
60
|
+
return sharedBus;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export {
|
|
64
|
+
getSharedBus
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=chunk-ZGVHUX3M.js.map
|