@iowarp/clio-coder 0.3.2 → 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 +269 -458
- package/CONTRIBUTING.md +1 -1
- package/README.md +3 -3
- package/dist/{acp-BIYHVZIM.js → acp-S5R4RR5B.js} +7 -6
- package/dist/{agents-YT6SSRIT.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-WMSVI4G2.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-WVO7V2QY.js → chunk-35MKKU5R.js} +4 -4
- package/dist/{chunk-LBNRH5WM.js → chunk-3HZ5RWN2.js} +5 -5
- package/dist/{chunk-AGYYIBLL.js → chunk-3JLKSKD7.js} +2 -2
- package/dist/{chunk-MBS4V7ZP.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-77VKQEHF.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-J5HN4RYU.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-G2DE3C7R.js → chunk-EDRHSCIE.js} +4 -4
- package/dist/{chunk-4KLWL3UC.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-EPVUXGXG.js → chunk-HV5X7OR2.js} +14 -12
- package/dist/{chunk-TZTZS7QK.js → chunk-HXG4IURW.js} +5 -3
- package/dist/{chunk-IGLFWIYI.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-V4RXGQ5Q.js → chunk-KRPY7NTG.js} +10 -7
- package/dist/chunk-LL4KHSZI.js +22 -0
- package/dist/{chunk-KJ5LWLOE.js → chunk-MEQ45TQ4.js} +15 -9
- package/dist/{chunk-5UUP6MWO.js → chunk-MV3K5QF2.js} +5 -436
- package/dist/{chunk-AO4RKG4M.js → chunk-N4CZJQRK.js} +5 -5
- package/dist/{chunk-ARBGF5F7.js → chunk-NILBFAPG.js} +14 -8
- package/dist/chunk-OZNBF4L3.js +23 -0
- package/dist/{verify-G6V4D2G7.js → chunk-PCZJO5TI.js} +127 -42
- package/dist/chunk-QQK64KLB.js +1360 -0
- package/dist/{chunk-6EJV5X2W.js → chunk-QQL5RT5M.js} +979 -1619
- package/dist/{chunk-LZSJBIVT.js → chunk-QWU7ZBO7.js} +70 -720
- package/dist/{chunk-2EHAIA3X.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-7EYHLWU7.js → chunk-UZHIZC5S.js} +7 -7
- package/dist/{chunk-QTYWRVRA.js → chunk-VAWWTKDP.js} +8 -8
- package/dist/{chunk-X75S7HFS.js → chunk-VEZEGCGW.js} +214 -20
- package/dist/{chunk-OHHN2SO4.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-3ZXDFGR5.js → chunk-X6COSD2O.js} +5 -5
- package/dist/chunk-ZGVHUX3M.js +66 -0
- package/dist/{chunk-MAW544W2.js → chunk-ZWMF7253.js} +4 -4
- package/dist/{chunk-MQSRRFWA.js → chunk-ZYKPLLNQ.js} +563 -546
- package/dist/cli/index.js +27 -23
- package/dist/{clio-4LY5K2AC.js → clio-J5JIOIDS.js} +7 -6
- package/dist/{code-nav-7AX6FYE6.js → code-nav-AXCXSBHX.js} +5 -3
- package/dist/{config-GTLUW2PR.js → config-OEBMIN2U.js} +37 -27
- package/dist/{configure-R6A64DHX.js → configure-PUQOSIXQ.js} +16 -13
- package/dist/{context-5VKGUVJJ.js → context-EKDCKUUZ.js} +82 -7
- package/dist/{context-RW5HC47S.js → context-MGSE4Z2T.js} +33 -23
- package/dist/{context-JFZEJ7W5.js → context-URSXPBCK.js} +17 -9
- package/dist/{context-clear-6ZHBAZZT.js → context-clear-KDAJRNUK.js} +33 -23
- package/dist/context-working-set-SBKMPPI2.js +1552 -0
- package/dist/{dispatch-runner-VKBRCWQC.js → dispatch-runner-MSWN72NK.js} +43 -29
- package/dist/{doctor-KI767GSN.js → doctor-7BSE27PJ.js} +10 -10
- package/dist/{eval-XSSNATB4.js → eval-IZGDOO4H.js} +9 -8
- package/dist/{evidence-UA6AWDQQ.js → evidence-SR7WXB5B.js} +51 -23
- package/dist/{evolve-QNTFGV6Z.js → evolve-K7VE2CBX.js} +30 -20
- package/dist/{fleet-Q7UOMUSG.js → fleet-7XMJNQNF.js} +48 -38
- package/dist/{fleet-preflight-DDN536IT.js → fleet-preflight-AQNAH644.js} +3 -3
- package/dist/{init-WBB65ZHQ.js → init-JGNPAYXT.js} +41 -31
- package/dist/{memory-MD3O64RI.js → memory-4ALKDJ4Q.js} +32 -22
- package/dist/{models-BZU34YWD.js → models-ZMMLFJNN.js} +22 -19
- package/dist/{monitor-MEQA5C3I.js → monitor-2F3T5KHP.js} +55 -43
- package/dist/{orchestrator-CGFKEP27.js → orchestrator-ORHT43JB.js} +2507 -1896
- package/dist/{reset-L2FQEE3E.js → reset-NXGTYNUO.js} +4 -3
- package/dist/{run-IV4Q6RLN.js → run-RF4WJGMT.js} +51 -41
- package/dist/{share-S5BZQC5I.js → share-UT3W6E4M.js} +5 -4
- package/dist/{skills-LQEKRDTN.js → skills-PSACKC5Q.js} +2 -2
- package/dist/{skills-eval-3DC4HEWS.js → skills-eval-WJSI55RZ.js} +34 -24
- package/dist/{targets-C4SSGQOB.js → targets-PIIRAOYS.js} +23 -20
- package/dist/{terminal-lease-IT5JW2NR.js → terminal-lease-ULWXWNVY.js} +5 -4
- package/dist/{upgrade-7TT7SQ3G.js → upgrade-346TZ6AV.js} +18 -17
- package/dist/{usage-GV4PKT3M.js → usage-6KKXR32N.js} +34 -24
- package/dist/verifiers-4UUM6TEE.js +1214 -0
- package/dist/verify-X5HDROLA.js +25 -0
- package/dist/{wiki-generate-DQF6Z66B.js → wiki-generate-7STOCIFZ.js} +42 -31
- package/dist/worker/entry.js +33 -24
- package/docs/README.md +8 -7
- 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 +6 -6
- package/docs/middleware-and-components.md +1 -1
- package/docs/model-catalog.md +7 -9
- package/docs/observability.md +4 -4
- package/docs/performance-methodology.md +2 -2
- 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 +35 -35
- 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 +2 -2
- 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/git-commit-attribution.ts +46 -21
- 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/config/keybindings.ts +3 -3
- 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 +571 -244
- package/src/interactive/chat-renderer.ts +79 -39
- 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/editor-submit.ts +26 -1
- package/src/interactive/footer/widgets.ts +22 -20
- package/src/interactive/footer-panel.ts +6 -1
- package/src/interactive/interactive-application.ts +2 -0
- package/src/interactive/interactive-event-projection.ts +12 -0
- package/src/interactive/interactive-slash-runtime.ts +49 -8
- 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/overlays/ask-user.ts +146 -24
- package/src/interactive/renderers/tool-execution.ts +167 -56
- package/src/interactive/session-transcript.ts +2 -2
- package/src/interactive/slash-commands.ts +29 -2
- package/src/interactive/status/index.ts +12 -1
- package/src/interactive/status/reasoning.ts +87 -0
- package/src/interactive/status/summary.ts +13 -2
- package/src/interactive/transcript-detail.ts +120 -0
- 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 +18 -6
- 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/presentation.ts +107 -0
- package/src/tools/registry.ts +65 -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-MNA4JGU4.js +0 -255
- package/dist/chunk-SRF2PJNW.js +0 -184
- package/dist/chunk-T6YILFSB.js +0 -80
- package/dist/chunk-VAKQQHWR.js +0 -434
|
@@ -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
|
|
@@ -1418,13 +1418,13 @@ var CLIO_APP_KEYBINDINGS = {
|
|
|
1418
1418
|
},
|
|
1419
1419
|
"clio.tool.expand": {
|
|
1420
1420
|
defaultKeys: "alt+o",
|
|
1421
|
-
description: "Fold or unfold the newest tool call or worker block between its one-line summary and full details
|
|
1421
|
+
description: "Fold or unfold the newest tool call or worker block between its one-line summary and full details, overriding the /output level for that block"
|
|
1422
1422
|
},
|
|
1423
1423
|
"clio.tool.expandAll": {
|
|
1424
1424
|
// Alt+Shift+letter is commonly consumed by OS keyboard-layout switching.
|
|
1425
1425
|
// Keep it discoverable, but pair it with the legacy-safe Ctrl+Alt form.
|
|
1426
1426
|
defaultKeys: ["ctrl+alt+o", "alt+shift+o"],
|
|
1427
|
-
description: "Fold or unfold every tool call and worker block at once
|
|
1427
|
+
description: "Fold or unfold every tool call and worker block at once, overriding the /output level; changing /output clears the overrides"
|
|
1428
1428
|
},
|
|
1429
1429
|
"clio.tool.liveOutput": {
|
|
1430
1430
|
defaultKeys: "alt+p",
|
|
@@ -1438,7 +1438,7 @@ var CLIO_APP_KEYBINDINGS = {
|
|
|
1438
1438
|
// Ctrl+Alt+R is the fallback for terminals/OSes that do not forward
|
|
1439
1439
|
// Alt+Shift+R as a distinct key event.
|
|
1440
1440
|
defaultKeys: ["ctrl+alt+r", "alt+shift+r"],
|
|
1441
|
-
description: "Toggle all thinking blocks between hidden markers and full bodies
|
|
1441
|
+
description: "Toggle all thinking blocks between hidden markers and full bodies, overriding the /output level; changing /output clears the overrides"
|
|
1442
1442
|
},
|
|
1443
1443
|
"clio.editor.external": {
|
|
1444
1444
|
defaultKeys: "alt+g",
|
|
@@ -1879,4 +1879,4 @@ export {
|
|
|
1879
1879
|
formatPlatformKeybindingNotice,
|
|
1880
1880
|
createKeybindingManager
|
|
1881
1881
|
};
|
|
1882
|
-
//# sourceMappingURL=chunk-
|
|
1882
|
+
//# sourceMappingURL=chunk-ZWMF7253.js.map
|