@iowarp/clio-coder 0.3.4 → 0.3.6
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 +37 -2
- package/CONTRIBUTING.md +6 -6
- package/README.md +2 -2
- package/dist/{acp-S5R4RR5B.js → acp-2BEHC4DL.js} +4 -4
- package/dist/{agents-P6DMMVZY.js → agents-LNNFTM53.js} +13 -11
- package/dist/assets/codewiki.json +1 -1
- package/dist/{auth-2XCZLPKS.js → auth-KXXFI2VS.js} +6 -6
- package/dist/{chunk-YCWGATWI.js → chunk-24I7BN55.js} +2 -2
- package/dist/{chunk-EKMEHE4H.js → chunk-33YXPOE3.js} +2 -3
- package/dist/chunk-3BPUFZDL.js +37 -0
- package/dist/{chunk-WPQLXFOZ.js → chunk-43AOLP7E.js} +2 -2
- package/dist/{chunk-N4CZJQRK.js → chunk-5JGRAMKL.js} +4 -4
- package/dist/{chunk-BRXQQJFP.js → chunk-6US73PDB.js} +568 -47
- package/dist/{chunk-K6WL7QZT.js → chunk-6XXKFVSN.js} +2 -2
- package/dist/{chunk-QQK64KLB.js → chunk-CJUB2JJ2.js} +138 -20
- package/dist/{chunk-HV5X7OR2.js → chunk-CKXWIANG.js} +12 -12
- package/dist/{chunk-UZHIZC5S.js → chunk-CYQKWTG3.js} +61 -76
- package/dist/{chunk-QWU7ZBO7.js → chunk-DJVECN66.js} +204 -45
- package/dist/{chunk-ZWMF7253.js → chunk-E2ER4LJF.js} +304 -9
- package/dist/{chunk-7RXG6QRZ.js → chunk-EKY57CSP.js} +2 -75
- package/dist/{chunk-EDRHSCIE.js → chunk-EYPA3EGJ.js} +10 -2
- package/dist/{chunk-TTNYS3EA.js → chunk-G7MUEIGA.js} +1 -1
- package/dist/{chunk-BPGS2WCQ.js → chunk-GEYXPTRF.js} +2 -1
- package/dist/{chunk-BEY543CS.js → chunk-GOXNB3AO.js} +5 -2
- package/dist/{chunk-G4BMMOKF.js → chunk-HVDIIIQW.js} +2 -2
- package/dist/chunk-HWUFFB6L.js +83 -0
- package/dist/{chunk-35MKKU5R.js → chunk-K7T3E2SR.js} +15 -8
- package/dist/{chunk-VAWWTKDP.js → chunk-KHSFENX2.js} +2 -2
- package/dist/chunk-LCGCVYZ4.js +57 -0
- package/dist/{chunk-X6COSD2O.js → chunk-LYF7OHWH.js} +41 -14
- package/dist/{chunk-POHLU5DW.js → chunk-M6L6IDJG.js} +3 -3
- package/dist/{chunk-X4RCMKVQ.js → chunk-NDINPTJ4.js} +2 -2
- package/dist/{chunk-5M54SPOL.js → chunk-ODFEOB4F.js} +161 -5
- package/dist/{chunk-3JLKSKD7.js → chunk-OH3TOQTB.js} +5 -1
- package/dist/{chunk-MEQ45TQ4.js → chunk-PBTHKCPN.js} +18 -4
- package/dist/{chunk-ED4KHGC3.js → chunk-PPAMZ32Z.js} +9 -2
- package/dist/{chunk-QQL5RT5M.js → chunk-QM3F2GKX.js} +94 -36
- package/dist/{chunk-A2GZF7DC.js → chunk-QNQHSOLF.js} +4 -4
- package/dist/{chunk-KRPY7NTG.js → chunk-R46L2BIR.js} +3 -3
- package/dist/{chunk-BP4OYD6A.js → chunk-RY3LY4J5.js} +20 -2
- package/dist/{chunk-34475P3I.js → chunk-TSHXZTOQ.js} +5 -4
- package/dist/{chunk-VJWL6YS5.js → chunk-UUVG37B4.js} +2 -2
- package/dist/{chunk-2TZWSW76.js → chunk-WHGPSPT5.js} +2 -2
- package/dist/{chunk-TW3WDMVS.js → chunk-WHJYKASB.js} +2 -2
- package/dist/{chunk-YHZX5GEU.js → chunk-XAKHZX5N.js} +2 -2
- package/dist/{chunk-HXG4IURW.js → chunk-XE2VEJHX.js} +2 -2
- package/dist/{chunk-3HZ5RWN2.js → chunk-XF5N4U5A.js} +7 -6
- package/dist/{chunk-ZYKPLLNQ.js → chunk-XXQNGV4M.js} +590 -32
- package/dist/{chunk-4JUF2NNX.js → chunk-XYDYPRZI.js} +4 -4
- package/dist/{chunk-VMNQ6OZA.js → chunk-ZRGEBJ4T.js} +971 -794
- package/dist/{chunk-2LZI5CAG.js → chunk-ZXF4XRKW.js} +75 -33
- package/dist/{chunk-VSNATDE6.js → chunk-ZZMN5OM4.js} +2 -2
- package/dist/cli/index.js +31 -31
- package/dist/{clio-J5JIOIDS.js → clio-M2KGYUFZ.js} +2 -2
- package/dist/{code-nav-AXCXSBHX.js → code-nav-GQNL7XA6.js} +5 -5
- package/dist/codewiki/build-worker.js +4 -4
- package/dist/{components-KELWS457.js → components-5TTYYX6G.js} +3 -3
- package/dist/{config-OEBMIN2U.js → config-XUUYQIWO.js} +27 -25
- package/dist/{configure-PUQOSIXQ.js → configure-IHJ7YOMV.js} +7 -7
- package/dist/{context-URSXPBCK.js → context-74JLXAWD.js} +12 -12
- package/dist/{context-MGSE4Z2T.js → context-75MIWW3U.js} +24 -22
- package/dist/{context-EKDCKUUZ.js → context-ZQ7SIFJV.js} +8 -7
- package/dist/{context-clear-KDAJRNUK.js → context-clear-GYKWNUML.js} +24 -22
- package/dist/{context-index-BZ4UYMTC.js → context-index-SSR5ECNE.js} +3 -3
- package/dist/{context-working-set-SBKMPPI2.js → context-working-set-UX5KEP4J.js} +11 -10
- package/dist/{dispatch-runner-MSWN72NK.js → dispatch-runner-GIJBHNFL.js} +21 -20
- package/dist/{docs-2C2LTVT2.js → docs-6FZSCG5B.js} +3 -3
- package/dist/{doctor-7BSE27PJ.js → doctor-SVJ5BZCW.js} +4 -4
- package/dist/{eval-IZGDOO4H.js → eval-CG6LLBLD.js} +47 -232
- package/dist/{evidence-SR7WXB5B.js → evidence-ZYFIEN42.js} +19 -18
- package/dist/{evolve-K7VE2CBX.js → evolve-QGEXEMDW.js} +19 -18
- package/dist/{extensions-QVDOHDGJ.js → extensions-ADGNCJJD.js} +3 -3
- package/dist/{fleet-7XMJNQNF.js → fleet-S5R4ZOQY.js} +49 -30
- package/dist/{fleet-preflight-AQNAH644.js → fleet-preflight-BHSNPBMH.js} +2 -2
- package/dist/{init-JGNPAYXT.js → init-5DRU55YR.js} +31 -29
- package/dist/memory-7YKKR6UC.js +467 -0
- package/dist/{models-ZMMLFJNN.js → models-ZPOLRU2C.js} +10 -10
- package/dist/{monitor-2F3T5KHP.js → monitor-US5F5YGZ.js} +33 -18
- package/dist/{orchestrator-ORHT43JB.js → orchestrator-E2AL4T5N.js} +1092 -659
- package/dist/{paths-UXLN5YYZ.js → paths-E7KYAQWE.js} +3 -3
- package/dist/{reset-NXGTYNUO.js → reset-KZ652EK6.js} +3 -3
- package/dist/{run-RF4WJGMT.js → run-SRNBKDWD.js} +52 -40
- package/dist/{share-UT3W6E4M.js → share-CGZE33UP.js} +3 -3
- package/dist/{skills-PSACKC5Q.js → skills-S2X4DLY5.js} +4 -4
- package/dist/{skills-eval-WJSI55RZ.js → skills-eval-W2GGIC4R.js} +19 -18
- package/dist/{targets-PIIRAOYS.js → targets-54SWINWB.js} +14 -12
- package/dist/{terminal-lease-ULWXWNVY.js → terminal-lease-SAIF2OGY.js} +5 -4
- package/dist/{uninstall-FZCQCDKC.js → uninstall-BVLWXKBT.js} +3 -3
- package/dist/{upgrade-346TZ6AV.js → upgrade-JKAR27XC.js} +8 -8
- package/dist/{usage-6KKXR32N.js → usage-MSAWCLX4.js} +60 -27
- package/dist/{verifiers-4UUM6TEE.js → verifiers-NCBTHHN2.js} +60 -54
- package/dist/{wiki-generate-7STOCIFZ.js → wiki-generate-GUSOQ6ZP.js} +30 -28
- package/dist/worker/entry.js +69 -58
- package/dist/{workspace-G4ZWUIPR.js → workspace-ZJ6BFM3Q.js} +4 -4
- package/docs/README.md +3 -3
- package/docs/acp.md +1 -1
- package/docs/alcf-provider.md +1 -1
- package/docs/architecture.md +2 -2
- package/docs/artifact-placement.md +1 -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 +9 -7
- package/docs/configuration-and-targets.md +12 -1
- package/docs/context-engine.md +4 -2
- package/docs/context-working-set.md +4 -4
- package/docs/development-pipeline.md +1 -1
- package/docs/documentation-coverage.md +3 -3
- package/docs/documentation-guide.md +2 -2
- package/docs/eval-runner.md +1 -1
- package/docs/evals-internal.md +4 -45
- package/docs/evidence-and-memory.md +67 -7
- 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 +28 -2
- package/docs/installation-and-lifecycle.md +2 -2
- package/docs/middleware-and-components.md +19 -2
- package/docs/model-catalog.md +1 -1
- package/docs/observability.md +3 -3
- package/docs/proactive-memory.md +26 -16
- package/docs/prompt-envelope-and-tools.md +4 -2
- package/docs/provider-adapter-cookbook.md +1 -1
- package/docs/release-cut-checklist.md +38 -35
- package/docs/safety-model.md +29 -7
- package/docs/scientific-validation.md +3 -3
- package/docs/session-lifecycle.md +1 -1
- package/docs/skills-marketplace.md +1 -1
- package/docs/tool-usage.md +2 -2
- package/docs/trace-store.md +1 -1
- package/docs/troubleshooting.md +1 -1
- package/docs/tui-design.md +38 -4
- package/docs/worker-dispatch-mechanics.md +1 -1
- package/package.json +7 -4
- package/src/cli/agents.ts +2 -3
- package/src/cli/argv.ts +14 -1
- package/src/cli/fleet.ts +15 -0
- package/src/cli/index.ts +1 -1
- package/src/cli/memory.ts +272 -10
- package/src/cli/modes/json-stream.ts +2 -2
- package/src/cli/modes/print.ts +12 -1
- package/src/cli/run.ts +22 -2
- package/src/cli/targets.ts +12 -3
- package/src/cli/usage.ts +55 -7
- package/src/core/bus-events.ts +3 -0
- package/src/core/response-model-id.ts +134 -0
- package/src/core/toml.ts +62 -0
- package/src/core/workspace-files.ts +0 -1
- package/src/domains/agents/builtins/architect.md +1 -1
- package/src/domains/agents/catalog.ts +5 -4
- package/src/domains/agents/recipe.ts +54 -14
- package/src/domains/agents/result-contract.ts +7 -4
- package/src/domains/context/bootstrap.ts +36 -27
- package/src/domains/context/project-metadata.ts +19 -63
- package/src/domains/context/prompt-context.ts +8 -0
- package/src/domains/context/working-set/policies/index.ts +3 -4
- package/src/domains/dispatch/budget-envelope.ts +396 -0
- package/src/domains/dispatch/contract.ts +2 -0
- package/src/domains/dispatch/extension.ts +81 -27
- package/src/domains/dispatch/orphan-recovery.ts +1 -0
- package/src/domains/dispatch/receipt-integrity.ts +4 -0
- package/src/domains/dispatch/state.ts +1 -0
- package/src/domains/dispatch/types.ts +10 -3
- package/src/domains/dispatch/validation.ts +14 -0
- package/src/domains/dispatch/worker-spawn.ts +14 -3
- package/src/domains/eval/metrics/evidence.ts +0 -116
- package/src/domains/eval/metrics/invariants.ts +1 -1
- package/src/domains/eval/runners/clio-run.ts +1 -10
- package/src/domains/eval/runners/external-command.ts +2 -29
- package/src/domains/eval/schema/suite.ts +0 -7
- package/src/domains/eval/suites/run.ts +1 -7
- package/src/domains/memory/index.ts +22 -0
- package/src/domains/memory/operations.ts +58 -1
- package/src/domains/memory/promotion.ts +281 -0
- package/src/domains/memory/prompt-section.ts +25 -5
- package/src/domains/memory/proposal.ts +51 -7
- package/src/domains/memory/task-bank.ts +3 -2
- package/src/domains/memory/task-memory-handoff.ts +181 -24
- package/src/domains/memory/task-memory-policy.ts +3 -1
- package/src/domains/memory/types.ts +37 -0
- package/src/domains/memory/validate.ts +178 -0
- package/src/domains/middleware/memory-intervention.ts +35 -25
- package/src/domains/middleware/runtime.ts +6 -0
- package/src/domains/middleware/skills-reminder.ts +19 -4
- package/src/domains/middleware/stalled-turn.ts +43 -1
- package/src/domains/middleware/types.ts +10 -0
- package/src/domains/observability/contract.ts +6 -1
- package/src/domains/observability/cost.ts +20 -4
- package/src/domains/observability/extension.ts +2 -2
- package/src/domains/providers/index.ts +3 -0
- package/src/domains/providers/model-discovery.ts +9 -0
- package/src/domains/providers/runtime-resolution.ts +38 -1
- package/src/domains/providers/runtimes/common/probe-helpers.ts +97 -16
- package/src/domains/providers/types/context-window-slots.ts +18 -0
- package/src/domains/providers/types/runtime-descriptor.ts +3 -1
- package/src/domains/safety/call-target.ts +211 -14
- package/src/domains/safety/decision-presentation.ts +268 -0
- package/src/domains/safety/redaction.ts +73 -0
- package/src/domains/session/context-ledger.ts +10 -1
- package/src/domains/session/decision-board.ts +4 -0
- package/src/domains/session/entries.ts +3 -0
- package/src/domains/session/history.ts +68 -19
- package/src/domains/session/usage.ts +24 -7
- package/src/engine/acp/event-mapper.ts +7 -0
- package/src/engine/acp/server.ts +29 -2
- package/src/engine/apis/lmstudio.ts +25 -4
- package/src/engine/apis/openai-completions.ts +147 -22
- package/src/engine/claude/sdk-runtime.ts +8 -2
- package/src/engine/claude/tool-safety.ts +13 -0
- package/src/engine/loop-guard.ts +27 -3
- package/src/engine/worker-events.ts +4 -3
- package/src/engine/worker-runtime.ts +59 -54
- package/src/entry/orchestrator.ts +18 -1
- package/src/interactive/chat-loop-messages.ts +22 -0
- package/src/interactive/chat-loop.ts +13 -0
- package/src/interactive/chat-renderer.ts +19 -3
- package/src/interactive/clio-editor.ts +44 -7
- package/src/interactive/context-overlay.ts +43 -5
- package/src/interactive/cost-overlay.ts +39 -8
- package/src/interactive/dispatch-board.ts +212 -35
- package/src/interactive/footer/widgets.ts +13 -0
- package/src/interactive/interactive-application.ts +6 -1
- package/src/interactive/interactive-input-runtime.ts +11 -1
- package/src/interactive/interactive-presentation.ts +11 -1
- package/src/interactive/memory-overlay.ts +89 -4
- package/src/interactive/overlay-ask-user-lifecycle.ts +1 -1
- package/src/interactive/overlay-frame.ts +5 -2
- package/src/interactive/overlay-general-openers.ts +40 -1
- package/src/interactive/overlay-key-routing.ts +41 -1
- package/src/interactive/overlay-lifecycle.ts +11 -4
- package/src/interactive/overlay-permission-lifecycle.ts +23 -8
- package/src/interactive/overlay-transitions.ts +11 -0
- package/src/interactive/overlays/ask-user.ts +74 -30
- package/src/interactive/overlays/decisions.ts +3 -1
- package/src/interactive/permission-hint.ts +35 -0
- package/src/interactive/permission-overlay.ts +95 -45
- package/src/interactive/renderers/tool-execution.ts +19 -49
- package/src/interactive/session-last-turn.ts +8 -1
- package/src/interactive/session-usage-reseed.ts +36 -10
- package/src/interactive/slash-commands.ts +2 -2
- package/src/interactive/status/summary.ts +5 -0
- package/src/interactive/status/types.ts +5 -0
- package/src/interactive/terminal-lease.ts +1 -0
- package/src/interactive/turn-context.ts +96 -23
- package/src/interactive/turn-middleware.ts +1 -0
- package/src/interactive/turn-runtime.ts +37 -8
- package/src/interactive/turn-state.ts +3 -0
- package/src/interactive/worker-progress.ts +440 -0
- package/src/interactive/worker-stream.ts +51 -110
- package/src/tools/agent-tools.ts +28 -3
- package/src/tools/ask-user.ts +21 -1
- package/src/tools/context/index.ts +2 -2
- package/src/tools/dispatch-arguments.ts +8 -0
- package/src/tools/dispatch-event-text.ts +19 -0
- package/src/tools/dispatch.ts +24 -1
- package/src/tools/monitor.ts +15 -0
- package/src/tools/registry.ts +15 -5
- package/src/tools/result-disposition.ts +156 -0
- package/src/tools/result-shaping.ts +59 -1
- package/src/tools/verify/authoring.ts +55 -54
- package/src/tools/worker-evidence.ts +19 -0
- package/src/worker/spec-contract.ts +43 -3
- package/dist/chunk-EFADSJET.js +0 -18
- package/dist/memory-4ALKDJ4Q.js +0 -246
- package/src/domains/eval/metrics/chaos-stream.ts +0 -93
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
import path from "node:path";
|
|
13
13
|
import { isMap, isSeq, parseDocument, stringify, type YAMLMap } from "yaml";
|
|
14
14
|
import { resolveSafeCwd, SAFE_EXEC_DEFAULT_TIMEOUT_MS } from "../../core/safe-exec.js";
|
|
15
|
+
import { parseTomlDocument, tomlTableAt } from "../../core/toml.js";
|
|
15
16
|
import { isVerificationScriptName } from "../../core/verification-scripts.js";
|
|
16
17
|
import { compareCodepoints } from "../../domains/evidence/ordering.js";
|
|
17
18
|
import type { ToolResult } from "../registry.js";
|
|
@@ -288,8 +289,13 @@ function cargoProposals(workspaceRoot: string, diagnostics: string[]): RawPropos
|
|
|
288
289
|
diagnostics.push(`${relative}: ${text.message}; Cargo discovery skipped.`);
|
|
289
290
|
return [];
|
|
290
291
|
}
|
|
291
|
-
const
|
|
292
|
-
|
|
292
|
+
const document = parseTomlDocument(text);
|
|
293
|
+
if (document === null) {
|
|
294
|
+
diagnostics.push(`${relative}: invalid TOML; Cargo discovery skipped.`);
|
|
295
|
+
return [];
|
|
296
|
+
}
|
|
297
|
+
const workspace = tomlTableAt(document, ["workspace"]) !== null;
|
|
298
|
+
const packageManifest = tomlTableAt(document, ["package"]) !== null;
|
|
293
299
|
if (!workspace && !packageManifest) {
|
|
294
300
|
diagnostics.push(`${relative}: no [package] or [workspace] declaration was found; Cargo discovery skipped.`);
|
|
295
301
|
return [];
|
|
@@ -364,73 +370,68 @@ function cmakeProposals(workspaceRoot: string, diagnostics: string[]): RawPropos
|
|
|
364
370
|
return proposals;
|
|
365
371
|
}
|
|
366
372
|
|
|
367
|
-
function tomlSections(text: string): Map<string, string[]> {
|
|
368
|
-
const sections = new Map<string, string[]>();
|
|
369
|
-
let active = "";
|
|
370
|
-
for (const line of text.split(/\r?\n/u)) {
|
|
371
|
-
const header = /^\s*\[([^\]]+)\]\s*(?:#.*)?$/u.exec(line);
|
|
372
|
-
if (header?.[1] !== undefined) {
|
|
373
|
-
active = header[1].trim();
|
|
374
|
-
if (!sections.has(active)) sections.set(active, []);
|
|
375
|
-
continue;
|
|
376
|
-
}
|
|
377
|
-
if (active.length > 0) sections.get(active)?.push(line);
|
|
378
|
-
}
|
|
379
|
-
return sections;
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
function declaredScriptName(line: string): string | null {
|
|
383
|
-
const match = /^\s*(?:"([^"]+)"|'([^']+)'|([A-Za-z0-9_.:-]+))\s*=\s*(?:"[^"]+"|'[^']+')\s*(?:#.*)?$/u.exec(line);
|
|
384
|
-
return match?.[1] ?? match?.[2] ?? match?.[3] ?? null;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
373
|
function pythonProposals(workspaceRoot: string, diagnostics: string[]): RawProposal[] {
|
|
388
374
|
const proposals: RawProposal[] = [];
|
|
389
375
|
const pyprojectPath = "pyproject.toml";
|
|
390
376
|
const pyproject = regularFileText(path.join(workspaceRoot, pyprojectPath), workspaceRoot);
|
|
391
377
|
if (pyproject instanceof Error) diagnostics.push(`${pyprojectPath}: ${pyproject.message}; Python discovery skipped.`);
|
|
392
378
|
if (typeof pyproject === "string") {
|
|
393
|
-
const
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
[
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
detail: `[${section}]`,
|
|
411
|
-
authority: "toolchain-defined",
|
|
412
|
-
},
|
|
413
|
-
});
|
|
414
|
-
}
|
|
415
|
-
for (const section of ["project.scripts", "tool.poetry.scripts"]) {
|
|
416
|
-
for (const line of sections.get(section) ?? []) {
|
|
417
|
-
const name = declaredScriptName(line);
|
|
418
|
-
if (name === null || !isVerificationScriptName(name)) continue;
|
|
379
|
+
const document = parseTomlDocument(pyproject);
|
|
380
|
+
if (document === null) {
|
|
381
|
+
diagnostics.push(`${pyprojectPath}: invalid TOML; Python discovery skipped.`);
|
|
382
|
+
} else {
|
|
383
|
+
for (const [path, section, module, id, description, tags] of [
|
|
384
|
+
[
|
|
385
|
+
["tool", "pytest", "ini_options"],
|
|
386
|
+
"tool.pytest.ini_options",
|
|
387
|
+
"pytest",
|
|
388
|
+
"python-pytest",
|
|
389
|
+
"Run the declared pytest suite",
|
|
390
|
+
["python", "test"],
|
|
391
|
+
],
|
|
392
|
+
[["tool", "tox"], "tool.tox", "tox", "python-tox", "Run the declared tox environments", ["python", "test"]],
|
|
393
|
+
[["tool", "nox"], "tool.nox", "nox", "python-nox", "Run the declared nox sessions", ["python", "test"]],
|
|
394
|
+
] as const) {
|
|
395
|
+
if (tomlTableAt(document, path) === null) continue;
|
|
419
396
|
proposals.push({
|
|
420
|
-
preferredId:
|
|
421
|
-
description
|
|
422
|
-
command: [
|
|
397
|
+
preferredId: id,
|
|
398
|
+
description,
|
|
399
|
+
command: ["python", "-m", module],
|
|
423
400
|
cwd: ".",
|
|
424
401
|
timeoutMs: SAFE_EXEC_DEFAULT_TIMEOUT_MS,
|
|
425
|
-
tags: [
|
|
402
|
+
tags: [...tags],
|
|
426
403
|
provenance: {
|
|
427
404
|
kind: "python-runner",
|
|
428
405
|
path: pyprojectPath,
|
|
429
|
-
detail: `[${section}]
|
|
430
|
-
authority: "
|
|
406
|
+
detail: `[${section}]`,
|
|
407
|
+
authority: "toolchain-defined",
|
|
431
408
|
},
|
|
432
409
|
});
|
|
433
410
|
}
|
|
411
|
+
for (const [path, section] of [
|
|
412
|
+
[["project", "scripts"], "project.scripts"],
|
|
413
|
+
[["tool", "poetry", "scripts"], "tool.poetry.scripts"],
|
|
414
|
+
] as const) {
|
|
415
|
+
const scripts = tomlTableAt(document, path);
|
|
416
|
+
if (scripts === null) continue;
|
|
417
|
+
for (const [name, target] of Object.entries(scripts)) {
|
|
418
|
+
if (typeof target !== "string" || !isVerificationScriptName(name)) continue;
|
|
419
|
+
proposals.push({
|
|
420
|
+
preferredId: `python-${slug(name, "check")}`,
|
|
421
|
+
description: `Run declared Python entry point '${name}'`,
|
|
422
|
+
command: [name],
|
|
423
|
+
cwd: ".",
|
|
424
|
+
timeoutMs: SAFE_EXEC_DEFAULT_TIMEOUT_MS,
|
|
425
|
+
tags: [slug(name.split(/[:.-]/u)[0] ?? "python", "python"), "python"],
|
|
426
|
+
provenance: {
|
|
427
|
+
kind: "python-runner",
|
|
428
|
+
path: pyprojectPath,
|
|
429
|
+
detail: `[${section}] entry '${name}'`,
|
|
430
|
+
authority: "project-declared",
|
|
431
|
+
},
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
}
|
|
434
435
|
}
|
|
435
436
|
}
|
|
436
437
|
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { mentionsWorkerToolCallCap } from "../core/guardrails.js";
|
|
2
|
+
import {
|
|
3
|
+
formatBudgetPolicy,
|
|
4
|
+
formatBudgetReasons,
|
|
5
|
+
formatBudgetRequest,
|
|
6
|
+
formatEffectiveBudget,
|
|
7
|
+
} from "../domains/dispatch/budget-envelope.js";
|
|
2
8
|
import type { ReceiptIntegrityResult } from "../domains/dispatch/receipt-integrity.js";
|
|
3
9
|
import type { RunReceipt, RunReceiptVerification } from "../domains/dispatch/types.js";
|
|
4
10
|
import { adaptRunReceiptTrustStatus, type CanonicalTrustStatus } from "../domains/evidence/trust-status.js";
|
|
11
|
+
import { receiptResponseModelIdObservationLabel } from "./dispatch-event-text.js";
|
|
5
12
|
|
|
6
13
|
/** Matches a source citation the parent can independently spot-check. */
|
|
7
14
|
const SOURCE_CITATION_PATTERN = /([\w./~-]+):(\d+)/g;
|
|
@@ -136,10 +143,22 @@ export function receiptEvidenceLabels(
|
|
|
136
143
|
sections.length > 0 ? ` sections:${[...sections].sort().join(",")}` : ""
|
|
137
144
|
}${receipt.projectContext.contentHash !== undefined ? ` sha256:${receipt.projectContext.contentHash}` : ""}`;
|
|
138
145
|
}
|
|
146
|
+
const responseModelIdObservation = receiptResponseModelIdObservationLabel(receipt);
|
|
147
|
+
const budget =
|
|
148
|
+
receipt.budget === undefined
|
|
149
|
+
? []
|
|
150
|
+
: [
|
|
151
|
+
`budget_recipe_policy=${JSON.stringify(formatBudgetPolicy(receipt.budget))}`,
|
|
152
|
+
`budget_requested=${JSON.stringify(formatBudgetRequest(receipt.budget))}`,
|
|
153
|
+
`budget_effective=${JSON.stringify(formatEffectiveBudget(receipt.budget))}`,
|
|
154
|
+
`budget_reason=${JSON.stringify(formatBudgetReasons(receipt.budget))}`,
|
|
155
|
+
];
|
|
139
156
|
return [
|
|
140
157
|
canonical,
|
|
141
158
|
`receipt_integrity=verified/v${receipt.integrity.version}/${receipt.integrity.algorithm}`,
|
|
142
159
|
`evidence_verification=${verification.state}/${verification.basis}`,
|
|
160
|
+
...(responseModelIdObservation ? [responseModelIdObservation] : []),
|
|
161
|
+
...budget,
|
|
143
162
|
...receiptAdmissionLabels(receipt),
|
|
144
163
|
...receiptActivityLabels(receipt, status),
|
|
145
164
|
briefing,
|
|
@@ -48,6 +48,11 @@ export interface WorkerProtectedArtifactState {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/** Concrete dispatch-time budget after recipe policy and operator clamping. */
|
|
51
|
+
export interface WorkerBudgetPhase {
|
|
52
|
+
toolCalls: number;
|
|
53
|
+
readReserve: number;
|
|
54
|
+
}
|
|
55
|
+
|
|
51
56
|
export interface WorkerBudget {
|
|
52
57
|
/** Agent phase boundary before synthesis or bounded termination. */
|
|
53
58
|
toolCalls: number;
|
|
@@ -57,6 +62,8 @@ export interface WorkerBudget {
|
|
|
57
62
|
synthesis: boolean;
|
|
58
63
|
/** Independent operator-owned attempt ceiling; recipes cannot widen it. */
|
|
59
64
|
hardCap: number;
|
|
65
|
+
/** Optional ceiling that a bounded result-contract revision may activate. */
|
|
66
|
+
revision?: WorkerBudgetPhase;
|
|
60
67
|
}
|
|
61
68
|
|
|
62
69
|
interface WorkerSpecFields {
|
|
@@ -416,10 +423,16 @@ function validateAllowedTools(value: unknown): void {
|
|
|
416
423
|
|
|
417
424
|
function validateWorkerBudget(value: unknown): void {
|
|
418
425
|
const budget = readRecord(value, "WorkerSpec.budget");
|
|
419
|
-
const expected = ["hardCap", "readReserve", "synthesis", "toolCalls"];
|
|
426
|
+
const expected = ["hardCap", "readReserve", "revision", "synthesis", "toolCalls"];
|
|
420
427
|
const actual = Object.keys(budget).sort();
|
|
421
|
-
if (
|
|
422
|
-
|
|
428
|
+
if (
|
|
429
|
+
actual.some((key) => !expected.includes(key)) ||
|
|
430
|
+
actual.some((key) => key === "revision" && budget.revision === undefined)
|
|
431
|
+
) {
|
|
432
|
+
throw new Error(`WorkerSpec.budget may contain only: ${expected.join(", ")}`);
|
|
433
|
+
}
|
|
434
|
+
for (const required of ["hardCap", "readReserve", "synthesis", "toolCalls"] as const) {
|
|
435
|
+
if (!Object.hasOwn(budget, required)) throw new Error(`WorkerSpec.budget.${required} is required`);
|
|
423
436
|
}
|
|
424
437
|
for (const key of ["toolCalls", "readReserve", "hardCap"] as const) {
|
|
425
438
|
const value = budget[key];
|
|
@@ -436,6 +449,33 @@ function validateWorkerBudget(value: unknown): void {
|
|
|
436
449
|
throw new Error("WorkerSpec.budget.readReserve must be an integer in [0, toolCalls)");
|
|
437
450
|
}
|
|
438
451
|
if (typeof budget.synthesis !== "boolean") throw new Error("WorkerSpec.budget.synthesis must be a boolean");
|
|
452
|
+
if (budget.revision !== undefined) {
|
|
453
|
+
const revision = readRecord(budget.revision, "WorkerSpec.budget.revision");
|
|
454
|
+
const revisionKeys = Object.keys(revision).sort();
|
|
455
|
+
if (revisionKeys.length !== 2 || revisionKeys[0] !== "readReserve" || revisionKeys[1] !== "toolCalls") {
|
|
456
|
+
throw new Error("WorkerSpec.budget.revision must contain exactly: readReserve, toolCalls");
|
|
457
|
+
}
|
|
458
|
+
for (const key of ["toolCalls", "readReserve"] as const) {
|
|
459
|
+
if (typeof revision[key] !== "number" || !Number.isSafeInteger(revision[key])) {
|
|
460
|
+
throw new Error(`WorkerSpec.budget.revision.${key} must be a safe integer`);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
if ((revision.toolCalls as number) < (budget.toolCalls as number)) {
|
|
464
|
+
throw new Error("WorkerSpec.budget.revision.toolCalls must not be smaller than WorkerSpec.budget.toolCalls");
|
|
465
|
+
}
|
|
466
|
+
if (
|
|
467
|
+
(revision.toolCalls as number) === (budget.toolCalls as number) &&
|
|
468
|
+
(revision.readReserve as number) <= (budget.readReserve as number)
|
|
469
|
+
) {
|
|
470
|
+
throw new Error("WorkerSpec.budget.revision must increase toolCalls or readReserve");
|
|
471
|
+
}
|
|
472
|
+
if ((revision.toolCalls as number) > (budget.hardCap as number)) {
|
|
473
|
+
throw new Error("WorkerSpec.budget.revision.toolCalls must not exceed WorkerSpec.budget.hardCap");
|
|
474
|
+
}
|
|
475
|
+
if ((revision.readReserve as number) < 0 || (revision.readReserve as number) >= (revision.toolCalls as number)) {
|
|
476
|
+
throw new Error("WorkerSpec.budget.revision.readReserve must be an integer in [0, toolCalls)");
|
|
477
|
+
}
|
|
478
|
+
}
|
|
439
479
|
}
|
|
440
480
|
|
|
441
481
|
function validateRuntimeCapabilityDecision(value: unknown, source: string): void {
|
package/dist/chunk-EFADSJET.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
durableAssistantTextFromEvent
|
|
4
|
-
} from "./chunk-QQL5RT5M.js";
|
|
5
|
-
import {
|
|
6
|
-
init_esm_shims
|
|
7
|
-
} from "./chunk-3R73A4XB.js";
|
|
8
|
-
|
|
9
|
-
// src/tools/dispatch-event-text.ts
|
|
10
|
-
init_esm_shims();
|
|
11
|
-
function assistantTextFromEvent(event) {
|
|
12
|
-
return durableAssistantTextFromEvent(event).trim();
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export {
|
|
16
|
-
assistantTextFromEvent
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=chunk-EFADSJET.js.map
|
package/dist/memory-4ALKDJ4Q.js
DELETED
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
import { createRequire as __clioCreateRequire } from "node:module"; const require = __clioCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
approveMemoryRecord,
|
|
4
|
-
loadMemoryRecords,
|
|
5
|
-
memoryStatus,
|
|
6
|
-
proposeMemoryFromEvidence,
|
|
7
|
-
pruneStaleMemory,
|
|
8
|
-
rejectMemoryRecord
|
|
9
|
-
} from "./chunk-BRXQQJFP.js";
|
|
10
|
-
import "./chunk-QQL5RT5M.js";
|
|
11
|
-
import "./chunk-QQK64KLB.js";
|
|
12
|
-
import "./chunk-QKMUKYO7.js";
|
|
13
|
-
import "./chunk-3JLKSKD7.js";
|
|
14
|
-
import "./chunk-34475P3I.js";
|
|
15
|
-
import "./chunk-TXOTCRLG.js";
|
|
16
|
-
import "./chunk-G4BMMOKF.js";
|
|
17
|
-
import "./chunk-W6GROXXM.js";
|
|
18
|
-
import "./chunk-2TZWSW76.js";
|
|
19
|
-
import "./chunk-ZYKPLLNQ.js";
|
|
20
|
-
import "./chunk-WPQLXFOZ.js";
|
|
21
|
-
import "./chunk-7RXG6QRZ.js";
|
|
22
|
-
import "./chunk-22NAGB7X.js";
|
|
23
|
-
import "./chunk-AOCYTWAV.js";
|
|
24
|
-
import "./chunk-MV3K5QF2.js";
|
|
25
|
-
import "./chunk-CMZWFGD2.js";
|
|
26
|
-
import "./chunk-I4HZDVNP.js";
|
|
27
|
-
import "./chunk-FYYLNIL5.js";
|
|
28
|
-
import "./chunk-UL3WSD3F.js";
|
|
29
|
-
import "./chunk-OQE5J4C6.js";
|
|
30
|
-
import "./chunk-ECH6PKUQ.js";
|
|
31
|
-
import "./chunk-BEY543CS.js";
|
|
32
|
-
import "./chunk-5M54SPOL.js";
|
|
33
|
-
import "./chunk-OZNBF4L3.js";
|
|
34
|
-
import "./chunk-4BJ5BYCE.js";
|
|
35
|
-
import "./chunk-6XLNIQDB.js";
|
|
36
|
-
import "./chunk-5B2AEOW5.js";
|
|
37
|
-
import "./chunk-CGKSTWHD.js";
|
|
38
|
-
import "./chunk-YHZX5GEU.js";
|
|
39
|
-
import "./chunk-EKMEHE4H.js";
|
|
40
|
-
import "./chunk-YCWGATWI.js";
|
|
41
|
-
import {
|
|
42
|
-
printError,
|
|
43
|
-
printOk
|
|
44
|
-
} from "./chunk-ED4KHGC3.js";
|
|
45
|
-
import "./chunk-5TSRNF4G.js";
|
|
46
|
-
import "./chunk-QWU7ZBO7.js";
|
|
47
|
-
import "./chunk-CFGTUFWB.js";
|
|
48
|
-
import "./chunk-AD2SYQYC.js";
|
|
49
|
-
import "./chunk-4OC57DA6.js";
|
|
50
|
-
import "./chunk-LL4KHSZI.js";
|
|
51
|
-
import "./chunk-4VP4KH3K.js";
|
|
52
|
-
import "./chunk-VEZEGCGW.js";
|
|
53
|
-
import "./chunk-FQ4SKYE4.js";
|
|
54
|
-
import "./chunk-IKCO5N3L.js";
|
|
55
|
-
import "./chunk-3I7MS7N2.js";
|
|
56
|
-
import "./chunk-IHXBNWMM.js";
|
|
57
|
-
import "./chunk-BPGS2WCQ.js";
|
|
58
|
-
import "./chunk-SST6Z5JA.js";
|
|
59
|
-
import "./chunk-FO5ZOVUY.js";
|
|
60
|
-
import "./chunk-R346GLFC.js";
|
|
61
|
-
import "./chunk-4ZG3XFUR.js";
|
|
62
|
-
import "./chunk-FCSXB6T2.js";
|
|
63
|
-
import "./chunk-APJ265NV.js";
|
|
64
|
-
import "./chunk-YXLYO42X.js";
|
|
65
|
-
import {
|
|
66
|
-
clioDataDir
|
|
67
|
-
} from "./chunk-BNAZZHFG.js";
|
|
68
|
-
import "./chunk-6EJMN2Y3.js";
|
|
69
|
-
import "./chunk-WEPFGWHJ.js";
|
|
70
|
-
import "./chunk-ZGVHUX3M.js";
|
|
71
|
-
import "./chunk-TTNYS3EA.js";
|
|
72
|
-
import "./chunk-7CR24IG7.js";
|
|
73
|
-
import "./chunk-IWHMRKLL.js";
|
|
74
|
-
import {
|
|
75
|
-
init_esm_shims
|
|
76
|
-
} from "./chunk-3R73A4XB.js";
|
|
77
|
-
|
|
78
|
-
// src/cli/memory.ts
|
|
79
|
-
init_esm_shims();
|
|
80
|
-
var HELP = `clio-coder memory list
|
|
81
|
-
clio-coder memory propose --from-evidence <evidenceId>
|
|
82
|
-
clio-coder memory approve <memoryId>
|
|
83
|
-
clio-coder memory reject <memoryId>
|
|
84
|
-
clio-coder memory prune --stale
|
|
85
|
-
|
|
86
|
-
Manage scoped, approved, evidence-linked local memory records.
|
|
87
|
-
`;
|
|
88
|
-
function parseMemoryArgs(args) {
|
|
89
|
-
const parsed = { stale: false, help: false };
|
|
90
|
-
for (let index = 0; index < args.length; index += 1) {
|
|
91
|
-
const arg = args[index];
|
|
92
|
-
if (arg === void 0) continue;
|
|
93
|
-
if (arg === "--help" || arg === "-h") {
|
|
94
|
-
parsed.help = true;
|
|
95
|
-
continue;
|
|
96
|
-
}
|
|
97
|
-
if (parsed.command === void 0) {
|
|
98
|
-
if (arg === "list" || arg === "propose" || arg === "approve" || arg === "reject" || arg === "prune") {
|
|
99
|
-
parsed.command = arg;
|
|
100
|
-
continue;
|
|
101
|
-
}
|
|
102
|
-
throw new Error(`unknown memory command: ${arg}`);
|
|
103
|
-
}
|
|
104
|
-
if (parsed.command === "propose") {
|
|
105
|
-
if (arg === "--from-evidence") {
|
|
106
|
-
const value = args[index + 1];
|
|
107
|
-
if (value === void 0 || value.startsWith("-")) throw new Error("--from-evidence requires an evidence id");
|
|
108
|
-
parsed.evidenceId = value;
|
|
109
|
-
index += 1;
|
|
110
|
-
continue;
|
|
111
|
-
}
|
|
112
|
-
throw new Error(`unknown memory propose argument: ${arg}`);
|
|
113
|
-
}
|
|
114
|
-
if (parsed.command === "approve" || parsed.command === "reject") {
|
|
115
|
-
if (parsed.memoryId === void 0 && !arg.startsWith("-")) {
|
|
116
|
-
parsed.memoryId = arg;
|
|
117
|
-
continue;
|
|
118
|
-
}
|
|
119
|
-
throw new Error(`unexpected memory ${parsed.command} argument: ${arg}`);
|
|
120
|
-
}
|
|
121
|
-
if (parsed.command === "prune") {
|
|
122
|
-
if (arg === "--stale") {
|
|
123
|
-
parsed.stale = true;
|
|
124
|
-
continue;
|
|
125
|
-
}
|
|
126
|
-
throw new Error(`unknown memory prune argument: ${arg}`);
|
|
127
|
-
}
|
|
128
|
-
throw new Error(`unexpected memory argument: ${arg}`);
|
|
129
|
-
}
|
|
130
|
-
if (parsed.help) return parsed;
|
|
131
|
-
if (parsed.command === void 0) throw new Error("memory requires list, propose, approve, reject, or prune");
|
|
132
|
-
if (parsed.command === "propose" && parsed.evidenceId === void 0) {
|
|
133
|
-
throw new Error("propose requires --from-evidence <evidenceId>");
|
|
134
|
-
}
|
|
135
|
-
if ((parsed.command === "approve" || parsed.command === "reject") && parsed.memoryId === void 0) {
|
|
136
|
-
throw new Error(`${parsed.command} requires a memory id`);
|
|
137
|
-
}
|
|
138
|
-
if (parsed.command === "prune" && !parsed.stale) throw new Error("prune requires --stale");
|
|
139
|
-
if (parsed.command === "list" && (parsed.evidenceId !== void 0 || parsed.memoryId !== void 0 || parsed.stale)) {
|
|
140
|
-
throw new Error("list does not accept extra arguments");
|
|
141
|
-
}
|
|
142
|
-
return parsed;
|
|
143
|
-
}
|
|
144
|
-
async function runMemoryCommand(args) {
|
|
145
|
-
let parsed;
|
|
146
|
-
try {
|
|
147
|
-
parsed = parseMemoryArgs(args);
|
|
148
|
-
} catch (error) {
|
|
149
|
-
printError(error instanceof Error ? error.message : String(error));
|
|
150
|
-
process.stderr.write(HELP);
|
|
151
|
-
return 2;
|
|
152
|
-
}
|
|
153
|
-
if (parsed.help) {
|
|
154
|
-
process.stdout.write(HELP);
|
|
155
|
-
return 0;
|
|
156
|
-
}
|
|
157
|
-
const dataDir = clioDataDir();
|
|
158
|
-
try {
|
|
159
|
-
if (parsed.command === "list") {
|
|
160
|
-
renderMemoryList(await loadMemoryRecords(dataDir));
|
|
161
|
-
return 0;
|
|
162
|
-
}
|
|
163
|
-
if (parsed.command === "propose") {
|
|
164
|
-
const evidenceId = parsed.evidenceId;
|
|
165
|
-
if (evidenceId === void 0) {
|
|
166
|
-
printError("propose requires --from-evidence <evidenceId>");
|
|
167
|
-
return 2;
|
|
168
|
-
}
|
|
169
|
-
const result = await proposeMemoryFromEvidence(dataDir, evidenceId);
|
|
170
|
-
renderProposal(result.record, result.created);
|
|
171
|
-
return 0;
|
|
172
|
-
}
|
|
173
|
-
if (parsed.command === "approve") {
|
|
174
|
-
const memoryId = parsed.memoryId;
|
|
175
|
-
if (memoryId === void 0) {
|
|
176
|
-
printError("approve requires a memory id");
|
|
177
|
-
return 2;
|
|
178
|
-
}
|
|
179
|
-
const record = await approveMemoryRecord(dataDir, memoryId);
|
|
180
|
-
printOk(`approved ${record.id}`);
|
|
181
|
-
return 0;
|
|
182
|
-
}
|
|
183
|
-
if (parsed.command === "reject") {
|
|
184
|
-
const memoryId = parsed.memoryId;
|
|
185
|
-
if (memoryId === void 0) {
|
|
186
|
-
printError("reject requires a memory id");
|
|
187
|
-
return 2;
|
|
188
|
-
}
|
|
189
|
-
const record = await rejectMemoryRecord(dataDir, memoryId);
|
|
190
|
-
printOk(`rejected ${record.id}`);
|
|
191
|
-
return 0;
|
|
192
|
-
}
|
|
193
|
-
if (parsed.command === "prune") {
|
|
194
|
-
const pruned = await pruneStaleMemory(dataDir);
|
|
195
|
-
printOk(`pruned ${pruned.length} stale memory record${pruned.length === 1 ? "" : "s"}`);
|
|
196
|
-
return 0;
|
|
197
|
-
}
|
|
198
|
-
printError("memory requires list, propose, approve, reject, or prune");
|
|
199
|
-
return 2;
|
|
200
|
-
} catch (error) {
|
|
201
|
-
printError(error instanceof Error ? error.message : String(error));
|
|
202
|
-
return 1;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
function renderProposal(record, created) {
|
|
206
|
-
process.stdout.write(`memory: ${record.id}
|
|
207
|
-
`);
|
|
208
|
-
process.stdout.write(`status: ${created ? "proposed" : memoryStatus(record)}
|
|
209
|
-
`);
|
|
210
|
-
process.stdout.write(`scope: ${record.scope}
|
|
211
|
-
`);
|
|
212
|
-
process.stdout.write(`key: ${record.key}
|
|
213
|
-
`);
|
|
214
|
-
process.stdout.write(`evidence: ${record.evidenceRefs.join(", ")}
|
|
215
|
-
`);
|
|
216
|
-
process.stdout.write(`confidence: ${record.confidence.toFixed(2)}
|
|
217
|
-
`);
|
|
218
|
-
process.stdout.write(`lesson: ${record.lesson}
|
|
219
|
-
`);
|
|
220
|
-
}
|
|
221
|
-
function renderMemoryList(records) {
|
|
222
|
-
process.stdout.write(`${records.length} memory record${records.length === 1 ? "" : "s"}
|
|
223
|
-
`);
|
|
224
|
-
if (records.length === 0) return;
|
|
225
|
-
process.stdout.write("\n");
|
|
226
|
-
for (const record of records) {
|
|
227
|
-
process.stdout.write(
|
|
228
|
-
[
|
|
229
|
-
record.id.padEnd(21),
|
|
230
|
-
memoryStatus(record).padEnd(10),
|
|
231
|
-
record.scope.padEnd(13),
|
|
232
|
-
`confidence=${record.confidence.toFixed(2)}`.padEnd(16),
|
|
233
|
-
`evidence=${record.evidenceRefs.join(",")}`
|
|
234
|
-
].join("")
|
|
235
|
-
);
|
|
236
|
-
process.stdout.write("\n");
|
|
237
|
-
process.stdout.write(` key: ${record.key}
|
|
238
|
-
`);
|
|
239
|
-
process.stdout.write(` lesson: ${record.lesson}
|
|
240
|
-
`);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
export {
|
|
244
|
-
runMemoryCommand
|
|
245
|
-
};
|
|
246
|
-
//# sourceMappingURL=memory-4ALKDJ4Q.js.map
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
export interface EvalChaosMarker {
|
|
2
|
-
seed: number;
|
|
3
|
-
faultInjected: boolean;
|
|
4
|
-
exitCode: number;
|
|
5
|
-
orphanedChildren: number;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface EvalChaosObservation {
|
|
9
|
-
markerCount: number;
|
|
10
|
-
marker: EvalChaosMarker | null;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface EvalChaosFold {
|
|
14
|
-
/** Feed a raw stdout chunk; partial trailing lines are held until completed. */
|
|
15
|
-
push(chunk: string): void;
|
|
16
|
-
observation(): EvalChaosObservation;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const EMPTY_CHAOS_OBSERVATION: EvalChaosObservation = { markerCount: 0, marker: null };
|
|
20
|
-
|
|
21
|
-
/** Fold the SIGINT harness marker from stdout before bounded artifact truncation can erase it. */
|
|
22
|
-
export function createChaosFold(): EvalChaosFold {
|
|
23
|
-
let markerCount = 0;
|
|
24
|
-
let marker: EvalChaosMarker | null = null;
|
|
25
|
-
let pending = "";
|
|
26
|
-
|
|
27
|
-
const consume = (line: string): void => {
|
|
28
|
-
if (line.trim().length === 0) return;
|
|
29
|
-
let parsed: unknown;
|
|
30
|
-
try {
|
|
31
|
-
parsed = JSON.parse(line) as unknown;
|
|
32
|
-
} catch {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
if (!isRecord(parsed) || parsed.type !== "clio_soak_chaos") return;
|
|
36
|
-
markerCount += 1;
|
|
37
|
-
marker = parseChaosMarker(parsed);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
return {
|
|
41
|
-
push(chunk: string): void {
|
|
42
|
-
pending += chunk;
|
|
43
|
-
for (;;) {
|
|
44
|
-
const newline = pending.indexOf("\n");
|
|
45
|
-
if (newline === -1) break;
|
|
46
|
-
consume(pending.slice(0, newline).replace(/\r$/u, ""));
|
|
47
|
-
pending = pending.slice(newline + 1);
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
observation(): EvalChaosObservation {
|
|
51
|
-
if (pending.length > 0) {
|
|
52
|
-
consume(pending.replace(/\r$/u, ""));
|
|
53
|
-
pending = "";
|
|
54
|
-
}
|
|
55
|
-
return { markerCount, marker: marker === null ? null : { ...marker } };
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export function addChaosObservations(left: EvalChaosObservation, right: EvalChaosObservation): EvalChaosObservation {
|
|
61
|
-
const markerCount = left.markerCount + right.markerCount;
|
|
62
|
-
return {
|
|
63
|
-
markerCount,
|
|
64
|
-
marker: markerCount === 1 ? (left.marker ?? right.marker) : null,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/** Emit canonical metrics only for one fully valid marker; every other shape is unmeasured. */
|
|
69
|
-
export function chaosMetricEntries(observation: EvalChaosObservation): Record<string, number | boolean> {
|
|
70
|
-
if (observation.markerCount !== 1 || observation.marker === null) return {};
|
|
71
|
-
return {
|
|
72
|
-
"chaos.seed": observation.marker.seed,
|
|
73
|
-
"chaos.faultInjected": observation.marker.faultInjected,
|
|
74
|
-
"chaos.exitCode": observation.marker.exitCode,
|
|
75
|
-
"process.orphanedChildren": observation.marker.orphanedChildren,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export function parseChaosMarker(event: Record<string, unknown>): EvalChaosMarker | null {
|
|
80
|
-
if (event.type !== "clio_soak_chaos") return null;
|
|
81
|
-
const { seed, faultInjected, exitCode, orphanedChildren } = event;
|
|
82
|
-
if (!isFiniteInteger(seed) || typeof faultInjected !== "boolean" || !isFiniteInteger(exitCode)) return null;
|
|
83
|
-
if (!isFiniteInteger(orphanedChildren) || orphanedChildren < 0) return null;
|
|
84
|
-
return { seed, faultInjected, exitCode, orphanedChildren };
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function isFiniteInteger(value: unknown): value is number {
|
|
88
|
-
return typeof value === "number" && Number.isFinite(value) && Number.isInteger(value);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
92
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
93
|
-
}
|