@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,258 @@
|
|
|
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/skill-activation.ts
|
|
7
|
+
init_esm_shims();
|
|
8
|
+
var SKILL_SUGGESTION_ANCHOR = "Suggested skill: /skill <name>";
|
|
9
|
+
var SKILL_SUGGESTION_PREFIX = SKILL_SUGGESTION_ANCHOR.slice(0, SKILL_SUGGESTION_ANCHOR.indexOf("<name>"));
|
|
10
|
+
var SKILL_SURFACE_EXEMPT_TOOLS = /* @__PURE__ */ new Set(["context", "ask_user"]);
|
|
11
|
+
function evaluateSkillToolSurface(policy, tool) {
|
|
12
|
+
if (!policy || policy.loadedSkillPolicies.size === 0) return null;
|
|
13
|
+
if (SKILL_SURFACE_EXEMPT_TOOLS.has(tool)) return null;
|
|
14
|
+
const entries = [...policy.loadedSkillPolicies.entries()];
|
|
15
|
+
const skills = entries.map(([name]) => name);
|
|
16
|
+
const disallowedBy = entries.filter(([, declared]) => declared.disallowedTools?.includes(tool) === true).map(([name]) => name);
|
|
17
|
+
if (disallowedBy.length > 0) return { skills, mergedAllowedTools: null, disallowedBy };
|
|
18
|
+
const allowLists = entries.map(([, declared]) => declared.allowedTools);
|
|
19
|
+
if (allowLists.some((list) => list === void 0 || list.length === 0)) return null;
|
|
20
|
+
const merged = [...new Set(allowLists.flatMap((list) => [...list ?? []]))];
|
|
21
|
+
if (merged.includes(tool)) return null;
|
|
22
|
+
return { skills, mergedAllowedTools: merged, disallowedBy: [] };
|
|
23
|
+
}
|
|
24
|
+
function agentSkillToolPolicy(skillNames) {
|
|
25
|
+
const allowedSkillNames = [...new Set(skillNames.map((name) => name.trim()).filter((name) => name.length > 0))];
|
|
26
|
+
if (allowedSkillNames.length === 0) return void 0;
|
|
27
|
+
return {
|
|
28
|
+
allowedSkillNames,
|
|
29
|
+
requests: allowedSkillNames.map((name) => ({ name, args: "", source: "recipe", installed: true })),
|
|
30
|
+
loadedSkillNames: /* @__PURE__ */ new Set(),
|
|
31
|
+
loadedSkillPolicies: /* @__PURE__ */ new Map()
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function trimmedString(value) {
|
|
35
|
+
return typeof value === "string" && value.trim().length > 0 ? value.trim() : null;
|
|
36
|
+
}
|
|
37
|
+
function skillActivationFromSource(source, triggeredBy, turnId) {
|
|
38
|
+
const sourceOrigin = trimmedString(source.sourceOrigin) ?? trimmedString(source.sourceInfo?.source);
|
|
39
|
+
return {
|
|
40
|
+
name: source.name,
|
|
41
|
+
filePath: source.filePath,
|
|
42
|
+
hash: source.hash,
|
|
43
|
+
source: source.source,
|
|
44
|
+
...sourceOrigin ? { sourceOrigin } : {},
|
|
45
|
+
triggeredBy,
|
|
46
|
+
...turnId ? { turnId } : {}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function skillActivationFromToolDetails(details, turnId) {
|
|
50
|
+
if (!details || typeof details !== "object" || Array.isArray(details)) return null;
|
|
51
|
+
const record = details;
|
|
52
|
+
const name = trimmedString(record.name);
|
|
53
|
+
const filePath = trimmedString(record.filePath) ?? trimmedString(record.path);
|
|
54
|
+
const hash = trimmedString(record.hash);
|
|
55
|
+
const source = trimmedString(record.source);
|
|
56
|
+
const sourceOrigin = trimmedString(record.sourceOrigin) ?? trimmedString(record.origin);
|
|
57
|
+
if (!name || !filePath || !hash || !source) return null;
|
|
58
|
+
const activation = skillActivationFromSource(
|
|
59
|
+
{ name, filePath, hash, source, ...sourceOrigin ? { sourceOrigin } : {} },
|
|
60
|
+
"tool",
|
|
61
|
+
turnId
|
|
62
|
+
);
|
|
63
|
+
if (record.drift === "match" || record.drift === "mismatch") activation.drift = record.drift;
|
|
64
|
+
return activation;
|
|
65
|
+
}
|
|
66
|
+
function isSkillActivation(value) {
|
|
67
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
68
|
+
const record = value;
|
|
69
|
+
return typeof record.name === "string" && typeof record.filePath === "string" && typeof record.hash === "string" && typeof record.source === "string" && (record.sourceOrigin === void 0 || typeof record.sourceOrigin === "string") && (record.triggeredBy === "slash-command" || record.triggeredBy === "tool") && (record.turnId === void 0 || typeof record.turnId === "string") && (record.runId === void 0 || typeof record.runId === "string");
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// src/domains/session/entries.ts
|
|
73
|
+
init_esm_shims();
|
|
74
|
+
var EVICTION_REASONS = [
|
|
75
|
+
"superseded_read",
|
|
76
|
+
"stale_after_mutation",
|
|
77
|
+
"listing_consumed",
|
|
78
|
+
"failure_resolved",
|
|
79
|
+
"thinking_turn_closed",
|
|
80
|
+
"age_horizon",
|
|
81
|
+
"operator"
|
|
82
|
+
];
|
|
83
|
+
var EVICTION_TRIGGERS = ["pressure", "operator"];
|
|
84
|
+
var RECALL_TRIGGERS = ["tool", "operator"];
|
|
85
|
+
var SESSION_ENTRY_KINDS = [
|
|
86
|
+
"message",
|
|
87
|
+
"bashExecution",
|
|
88
|
+
"custom",
|
|
89
|
+
"modelChange",
|
|
90
|
+
"thinkingLevelChange",
|
|
91
|
+
"fileEntry",
|
|
92
|
+
"branchSummary",
|
|
93
|
+
"compactionSummary",
|
|
94
|
+
"sessionInfo",
|
|
95
|
+
"label",
|
|
96
|
+
"protectedArtifact",
|
|
97
|
+
"skillActivation",
|
|
98
|
+
"taskLedger",
|
|
99
|
+
"decisionLedger",
|
|
100
|
+
"workerRun",
|
|
101
|
+
"contextEviction",
|
|
102
|
+
"contextRecall"
|
|
103
|
+
];
|
|
104
|
+
function isRecord(value) {
|
|
105
|
+
return !!value && typeof value === "object";
|
|
106
|
+
}
|
|
107
|
+
function isString(value) {
|
|
108
|
+
return typeof value === "string";
|
|
109
|
+
}
|
|
110
|
+
function isOptionalString(value) {
|
|
111
|
+
return value === void 0 || typeof value === "string";
|
|
112
|
+
}
|
|
113
|
+
function isOptionalBoolean(value) {
|
|
114
|
+
return value === void 0 || typeof value === "boolean";
|
|
115
|
+
}
|
|
116
|
+
function isNumber(value) {
|
|
117
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
118
|
+
}
|
|
119
|
+
function isPositiveInteger(value) {
|
|
120
|
+
return isNumber(value) && Number.isInteger(value) && value > 0;
|
|
121
|
+
}
|
|
122
|
+
function isOptionalNumber(value) {
|
|
123
|
+
return value === void 0 || isNumber(value);
|
|
124
|
+
}
|
|
125
|
+
function isNullableString(value) {
|
|
126
|
+
return value === null || typeof value === "string";
|
|
127
|
+
}
|
|
128
|
+
function isOneOf(value, allowed) {
|
|
129
|
+
return typeof value === "string" && allowed.includes(value);
|
|
130
|
+
}
|
|
131
|
+
function isStringArray(value) {
|
|
132
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
133
|
+
}
|
|
134
|
+
function hasBaseSessionEntryFields(v) {
|
|
135
|
+
return isString(v.turnId) && isNullableString(v.parentTurnId) && isString(v.timestamp);
|
|
136
|
+
}
|
|
137
|
+
var MESSAGE_ROLES = ["user", "assistant", "tool_call", "tool_result", "system", "checkpoint"];
|
|
138
|
+
var FILE_OPERATIONS = ["read", "write", "edit", "create", "delete"];
|
|
139
|
+
var COMPACTION_TRIGGERS = ["auto", "force", "overflow"];
|
|
140
|
+
var PROTECTED_ARTIFACT_SOURCES = [
|
|
141
|
+
"validation",
|
|
142
|
+
"middleware",
|
|
143
|
+
"user",
|
|
144
|
+
"session"
|
|
145
|
+
];
|
|
146
|
+
var TASK_LEDGER_STATUSES = ["pending", "active", "completed", "blocked", "cancelled"];
|
|
147
|
+
var TASK_LEDGER_EVIDENCE_STATUSES = [
|
|
148
|
+
"required",
|
|
149
|
+
"pending",
|
|
150
|
+
"passed",
|
|
151
|
+
"failed",
|
|
152
|
+
"missing"
|
|
153
|
+
];
|
|
154
|
+
var DECISION_STATUSES = ["active", "superseded"];
|
|
155
|
+
var DECISION_INTERVIEW_STATUSES = ["complete", "cancelled"];
|
|
156
|
+
var WORKER_RUN_ORIGINS = ["user", "agent"];
|
|
157
|
+
var WORKER_RUN_RUNTIME_KINDS = ["clio", "acp", "claude-sdk", "claude-code"];
|
|
158
|
+
function isWorkerRunRuntime(value) {
|
|
159
|
+
if (!isRecord(value)) return false;
|
|
160
|
+
return isOneOf(value.kind, WORKER_RUN_RUNTIME_KINDS) && isOptionalString(value.targetId) && isOptionalString(value.wireModelId) && isOptionalString(value.peerId);
|
|
161
|
+
}
|
|
162
|
+
function isTaskLedgerGoal(value) {
|
|
163
|
+
if (!isRecord(value)) return false;
|
|
164
|
+
if (!isString(value.id) || !isString(value.title)) return false;
|
|
165
|
+
if (!isOneOf(value.status, TASK_LEDGER_STATUSES)) return false;
|
|
166
|
+
if (value.parentGoalId !== void 0 && !isNullableString(value.parentGoalId)) return false;
|
|
167
|
+
const hasPairedProvenance = value.origin === "user" ? isString(value.userTaskId) && /^u[1-9]\d*$/.test(value.userTaskId) : (value.origin === void 0 || value.origin === "agent") && value.userTaskId === void 0;
|
|
168
|
+
return isOptionalString(value.description) && hasPairedProvenance;
|
|
169
|
+
}
|
|
170
|
+
function isTaskLedgerEvidence(value) {
|
|
171
|
+
if (!isRecord(value)) return false;
|
|
172
|
+
if (!isString(value.id) || !isString(value.description)) return false;
|
|
173
|
+
if (!isOneOf(value.status, TASK_LEDGER_EVIDENCE_STATUSES)) return false;
|
|
174
|
+
return isOptionalString(value.command) && isOptionalString(value.artifactPath) && isOptionalString(value.observedAt) && isOptionalString(value.notes);
|
|
175
|
+
}
|
|
176
|
+
function isDecisionRecord(value) {
|
|
177
|
+
if (!isRecord(value)) return false;
|
|
178
|
+
if (!isString(value.key) || !/^[a-z0-9]+(?:_[a-z0-9]+)*$/.test(value.key)) return false;
|
|
179
|
+
if (!isString(value.value) || !isOneOf(value.status, DECISION_STATUSES) || !isString(value.decidedAt)) return false;
|
|
180
|
+
if (!isOptionalString(value.label) || !isOptionalString(value.source_question)) return false;
|
|
181
|
+
if (!isOptionalString(value.revisedAt) || !isOptionalString(value.correction)) return false;
|
|
182
|
+
return value.status === "superseded" ? isString(value.revisedAt) : value.revisedAt === void 0 && value.correction === void 0;
|
|
183
|
+
}
|
|
184
|
+
function isOptionalCompactionUsage(value) {
|
|
185
|
+
if (value === void 0) return true;
|
|
186
|
+
if (!isRecord(value)) return false;
|
|
187
|
+
const cost = value.cost;
|
|
188
|
+
return isNumber(value.input) && isNumber(value.output) && isNumber(value.cacheRead) && isNumber(value.cacheWrite) && isNumber(value.reasoning) && isNumber(value.totalTokens) && isNumber(value.apiCalls) && isRecord(cost) && isNumber(cost.total);
|
|
189
|
+
}
|
|
190
|
+
function isProtectedArtifact(value) {
|
|
191
|
+
if (!isRecord(value)) return false;
|
|
192
|
+
return isString(value.path) && isString(value.protectedAt) && isString(value.reason) && isOneOf(value.source, PROTECTED_ARTIFACT_SOURCES) && isOptionalString(value.validationCommand) && isOptionalNumber(value.validationExitCode);
|
|
193
|
+
}
|
|
194
|
+
function isSessionHeader(value) {
|
|
195
|
+
if (!isRecord(value)) return false;
|
|
196
|
+
return value.type === "session" && isPositiveInteger(value.version) && isString(value.id) && isString(value.timestamp) && isString(value.cwd) && isOptionalString(value.parentSession) && isOptionalString(value.parentTurnId);
|
|
197
|
+
}
|
|
198
|
+
function isWorkingSetRef(value) {
|
|
199
|
+
return isRecord(value) && isString(value.entry);
|
|
200
|
+
}
|
|
201
|
+
function isEvictedItem(value) {
|
|
202
|
+
return isRecord(value) && isWorkingSetRef(value.ref) && isOneOf(value.reason, EVICTION_REASONS) && isNumber(value.tokensFreed) && isString(value.marker) && isOptionalString(value.by);
|
|
203
|
+
}
|
|
204
|
+
function isSessionEntry(value) {
|
|
205
|
+
if (!value || typeof value !== "object") return false;
|
|
206
|
+
const v = value;
|
|
207
|
+
if (!hasBaseSessionEntryFields(v)) return false;
|
|
208
|
+
if (!isOneOf(v.kind, SESSION_ENTRY_KINDS)) return false;
|
|
209
|
+
switch (v.kind) {
|
|
210
|
+
case "message":
|
|
211
|
+
return Object.hasOwn(v, "payload") && isOneOf(v.role, MESSAGE_ROLES);
|
|
212
|
+
case "bashExecution":
|
|
213
|
+
return isString(v.command) && isString(v.output) && (v.exitCode === null || isNumber(v.exitCode)) && typeof v.cancelled === "boolean" && typeof v.truncated === "boolean" && isOptionalString(v.fullOutputPath) && isOptionalBoolean(v.excludeFromContext);
|
|
214
|
+
case "custom":
|
|
215
|
+
return isString(v.customType) && isOptionalBoolean(v.display);
|
|
216
|
+
case "modelChange":
|
|
217
|
+
return isString(v.provider) && isString(v.modelId) && isOptionalString(v.target);
|
|
218
|
+
case "thinkingLevelChange":
|
|
219
|
+
return isString(v.thinkingLevel);
|
|
220
|
+
case "fileEntry":
|
|
221
|
+
return isString(v.path) && isOneOf(v.operation, FILE_OPERATIONS) && isOptionalNumber(v.bytes) && isOptionalString(v.hash);
|
|
222
|
+
case "branchSummary":
|
|
223
|
+
return isString(v.fromTurnId) && isString(v.summary);
|
|
224
|
+
case "compactionSummary":
|
|
225
|
+
return isString(v.summary) && isNumber(v.tokensBefore) && isString(v.firstKeptTurnId) && isOptionalCompactionUsage(v.usage) && (v.trigger === void 0 || isOneOf(v.trigger, COMPACTION_TRIGGERS)) && isOptionalNumber(v.tokensAfter) && isOptionalNumber(v.messagesSummarized) && isOptionalBoolean(v.isSplitTurn);
|
|
226
|
+
case "sessionInfo":
|
|
227
|
+
return isOptionalString(v.name) && isOptionalString(v.targetTurnId) && isOptionalString(v.label);
|
|
228
|
+
case "label":
|
|
229
|
+
return isString(v.targetTurnId) && isOptionalString(v.label);
|
|
230
|
+
case "protectedArtifact":
|
|
231
|
+
return v.action === "protect" && isProtectedArtifact(v.artifact) && isOptionalString(v.toolName) && isOptionalString(v.toolCallId) && isOptionalString(v.runId) && isOptionalString(v.correlationId);
|
|
232
|
+
case "skillActivation":
|
|
233
|
+
return isSkillActivation(v.activation);
|
|
234
|
+
case "taskLedger":
|
|
235
|
+
return isOptionalString(v.boardId) && Array.isArray(v.goals) && v.goals.every(isTaskLedgerGoal) && Array.isArray(v.subgoals) && v.subgoals.every(isTaskLedgerGoal) && isStringArray(v.activeRunIds) && Array.isArray(v.requiredValidationEvidence) && v.requiredValidationEvidence.every(isTaskLedgerEvidence);
|
|
236
|
+
case "decisionLedger":
|
|
237
|
+
return isString(v.interviewId) && isOneOf(v.interviewStatus, DECISION_INTERVIEW_STATUSES) && isString(v.startedAt) && isString(v.endedAt) && isNumber(v.roundCount) && Number.isInteger(v.roundCount) && v.roundCount >= 0 && isOptionalString(v.summary) && isOptionalString(v.transcriptPath) && Array.isArray(v.decisions) && v.decisions.every(isDecisionRecord);
|
|
238
|
+
case "workerRun":
|
|
239
|
+
return isString(v.assignmentId) && isString(v.runId) && isOneOf(v.origin, WORKER_RUN_ORIGINS) && isString(v.agentId) && isWorkerRunRuntime(v.runtime) && isOptionalString(v.parentToolCallId);
|
|
240
|
+
case "contextEviction":
|
|
241
|
+
return isString(v.policyId) && isOneOf(v.trigger, EVICTION_TRIGGERS) && Array.isArray(v.evicted) && v.evicted.every(isEvictedItem) && isNumber(v.tokensBefore) && isNumber(v.tokensAfter) && (v.pressureBefore === null || isNumber(v.pressureBefore)) && (v.snapshotIdBefore === null || isString(v.snapshotIdBefore));
|
|
242
|
+
case "contextRecall":
|
|
243
|
+
return isWorkingSetRef(v.ref) && isOneOf(v.trigger, RECALL_TRIGGERS) && isNumber(v.tokensReadmitted) && isOptionalString(v.toolCallId);
|
|
244
|
+
}
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export {
|
|
249
|
+
SKILL_SUGGESTION_ANCHOR,
|
|
250
|
+
SKILL_SUGGESTION_PREFIX,
|
|
251
|
+
evaluateSkillToolSurface,
|
|
252
|
+
agentSkillToolPolicy,
|
|
253
|
+
skillActivationFromToolDetails,
|
|
254
|
+
isSkillActivation,
|
|
255
|
+
isSessionHeader,
|
|
256
|
+
isSessionEntry
|
|
257
|
+
};
|
|
258
|
+
//# sourceMappingURL=chunk-BEY543CS.js.map
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
adaptRunReceiptTrustStatus
|
|
4
|
+
} from "./chunk-QQL5RT5M.js";
|
|
2
5
|
import {
|
|
3
6
|
mentionsWorkerToolCallCap
|
|
4
7
|
} from "./chunk-4ZG3XFUR.js";
|
|
@@ -22,8 +25,8 @@ function hasSourceCitation(text) {
|
|
|
22
25
|
return sourceCitations(text).length > 0;
|
|
23
26
|
}
|
|
24
27
|
var SPOT_CHECK_GUIDANCE = 'Spot-check delegated claims before repeating them: re-read any cited file:line location, and re-run or inspect the named validation before repeating a "tests pass" claim.';
|
|
25
|
-
function isMutationClassRun(receipt,
|
|
26
|
-
if (
|
|
28
|
+
function isMutationClassRun(receipt, status) {
|
|
29
|
+
if (status.validationGrounding.state === "not_applicable") return false;
|
|
27
30
|
if (receipt.executionRole === "builder" || receipt.executionRole === "recovery") return true;
|
|
28
31
|
return receipt.quality?.resultContract?.sourceId?.startsWith("agent-result-contract:mutation-report") === true;
|
|
29
32
|
}
|
|
@@ -43,14 +46,14 @@ function receiptAdmissionLabels(receipt) {
|
|
|
43
46
|
}
|
|
44
47
|
return labels;
|
|
45
48
|
}
|
|
46
|
-
function receiptActivityLabels(receipt,
|
|
49
|
+
function receiptActivityLabels(receipt, status) {
|
|
47
50
|
const labels = [];
|
|
48
51
|
const activity = receipt.toolActivity;
|
|
49
52
|
if (activity !== void 0) {
|
|
50
53
|
labels.push(
|
|
51
54
|
`work=calls:${activity.calls} ok:${activity.succeeded} failed:${activity.failed} blocked:${activity.blocked} mutations:${activity.mutatingSucceeded ? "yes" : "no"}`
|
|
52
55
|
);
|
|
53
|
-
if (!activity.mutatingSucceeded && isMutationClassRun(receipt,
|
|
56
|
+
if (!activity.mutatingSucceeded && isMutationClassRun(receipt, status)) labels.push("mutation_effect=none");
|
|
54
57
|
}
|
|
55
58
|
const findings = receipt.findingsSummary;
|
|
56
59
|
if (findings !== void 0) {
|
|
@@ -60,7 +63,11 @@ function receiptActivityLabels(receipt, verification) {
|
|
|
60
63
|
return labels;
|
|
61
64
|
}
|
|
62
65
|
function receiptEvidenceLabels(receipt, verification, integrity) {
|
|
63
|
-
|
|
66
|
+
const status = adaptRunReceiptTrustStatus({ ...receipt, verification }, { integrity });
|
|
67
|
+
const canonical = canonicalTrustLabel(status);
|
|
68
|
+
if (!integrity.ok) {
|
|
69
|
+
return [canonical, `receipt_integrity=FAILED reason=${JSON.stringify(integrity.reason)}`];
|
|
70
|
+
}
|
|
64
71
|
const briefing = receipt.briefing === void 0 ? "briefing=none" : `briefing=bytes:${receipt.briefing.bytes} sha256:${receipt.briefing.contentHash}`;
|
|
65
72
|
let projectContext = "project_context=absent";
|
|
66
73
|
if (receipt.projectContext !== void 0) {
|
|
@@ -68,17 +75,29 @@ function receiptEvidenceLabels(receipt, verification, integrity) {
|
|
|
68
75
|
projectContext = `project_context=${receipt.projectContext.tier} chars:${receipt.projectContext.chars ?? 0}${sections.length > 0 ? ` sections:${[...sections].sort().join(",")}` : ""}${receipt.projectContext.contentHash !== void 0 ? ` sha256:${receipt.projectContext.contentHash}` : ""}`;
|
|
69
76
|
}
|
|
70
77
|
return [
|
|
78
|
+
canonical,
|
|
71
79
|
`receipt_integrity=verified/v${receipt.integrity.version}/${receipt.integrity.algorithm}`,
|
|
72
80
|
`evidence_verification=${verification.state}/${verification.basis}`,
|
|
73
81
|
...receiptAdmissionLabels(receipt),
|
|
74
|
-
...receiptActivityLabels(receipt,
|
|
82
|
+
...receiptActivityLabels(receipt, status),
|
|
75
83
|
briefing,
|
|
76
84
|
projectContext
|
|
77
85
|
];
|
|
78
86
|
}
|
|
79
|
-
function
|
|
80
|
-
|
|
81
|
-
|
|
87
|
+
function canonicalTrustLabel(status) {
|
|
88
|
+
return [
|
|
89
|
+
`trust_status=v${status.version}`,
|
|
90
|
+
`artifactIntegrity:${status.artifactIntegrity.state}`,
|
|
91
|
+
`validationGrounding:${status.validationGrounding.state}`,
|
|
92
|
+
`independentReview:${status.independentReview.state}`,
|
|
93
|
+
`contextProvenance:${status.contextProvenance.state}`,
|
|
94
|
+
`autonomyEnforcement:${status.autonomyEnforcement.state}`,
|
|
95
|
+
`completionEvidence:${status.completionEvidence.state}`
|
|
96
|
+
].join(" ");
|
|
97
|
+
}
|
|
98
|
+
function workerTextLabel(status) {
|
|
99
|
+
switch (status.validationGrounding.state) {
|
|
100
|
+
case "validated":
|
|
82
101
|
return "worker output (tool-verified):";
|
|
83
102
|
case "not_applicable":
|
|
84
103
|
return "reconnaissance output (advisory leads, not validation evidence):";
|
|
@@ -88,7 +107,7 @@ function workerTextLabel(verification) {
|
|
|
88
107
|
return "worker claims (unverified prose):";
|
|
89
108
|
}
|
|
90
109
|
}
|
|
91
|
-
function workerTextNonEvidenceNotices(receipt,
|
|
110
|
+
function workerTextNonEvidenceNotices(receipt, status, answerText) {
|
|
92
111
|
const notices = [];
|
|
93
112
|
const failedRun = receipt.exitCode !== 0 || receipt.outcome !== void 0 && receipt.outcome !== "succeeded";
|
|
94
113
|
if (mentionsWorkerToolCallCap(receipt.failureMessage) || mentionsWorkerToolCallCap(receipt.outcomeDetail)) {
|
|
@@ -102,7 +121,7 @@ function workerTextNonEvidenceNotices(receipt, verification, answerText) {
|
|
|
102
121
|
}
|
|
103
122
|
if (receipt.toolActivity !== void 0 && receipt.toolActivity.succeeded === 0) {
|
|
104
123
|
notices.push("non-evidence: no tool call succeeded in this run; the text above was written without observed work.");
|
|
105
|
-
} else if (receipt.toolActivity?.mutatingSucceeded === false && isMutationClassRun(receipt,
|
|
124
|
+
} else if (receipt.toolActivity?.mutatingSucceeded === false && isMutationClassRun(receipt, status)) {
|
|
106
125
|
notices.push(
|
|
107
126
|
"non-evidence: this run was dispatched as work that changes the tree, but no mutating tool call succeeded. Nothing was written. Confirm with a diff before repeating any claim that something was fixed."
|
|
108
127
|
);
|
|
@@ -119,7 +138,7 @@ function workerTextNonEvidenceNotices(receipt, verification, answerText) {
|
|
|
119
138
|
`non-evidence: '${receipt.capabilityMismatch.agentId}' is a ${receipt.capabilityMismatch.capabilityClass} recipe and cannot write to the workspace, but this task classified as ${receipt.capabilityMismatch.taskType}. Nothing it reports as changed can have been changed by it.`
|
|
120
139
|
);
|
|
121
140
|
}
|
|
122
|
-
if (!failedRun &&
|
|
141
|
+
if (!failedRun && status.validationGrounding.state === "not_applicable" && answerText.length > 0 && !hasSourceCitation(answerText)) {
|
|
123
142
|
notices.push(
|
|
124
143
|
"non-evidence: this reconnaissance answer cites no file:line locations; treat its leads as unconfirmed."
|
|
125
144
|
);
|
|
@@ -133,4 +152,4 @@ export {
|
|
|
133
152
|
workerTextLabel,
|
|
134
153
|
workerTextNonEvidenceNotices
|
|
135
154
|
};
|
|
136
|
-
//# sourceMappingURL=chunk-
|
|
155
|
+
//# sourceMappingURL=chunk-BP4OYD6A.js.map
|