@iowarp/clio-coder 0.5.0 → 0.5.2
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/.claude-plugin/marketplace.json +4 -4
- package/CHANGELOG.md +35 -0
- package/CONTRIBUTING.md +9 -0
- package/README.md +12 -9
- package/ROADMAP.md +30 -5
- package/dist/{acp-KS7ARGV6.js → acp-F6PGOFZ4.js} +2 -2
- package/dist/{agents-YOGJ2YEJ.js → agents-ZHP4R6EX.js} +22 -21
- package/dist/assets/codewiki.json +1 -1
- package/dist/{auth-CEDCO6O6.js → auth-N75U2H3Z.js} +4 -4
- package/dist/{chunk-D3KWFOUT.js → chunk-23UIXH6Z.js} +3 -3
- package/dist/{chunk-ZR5YA6ZF.js → chunk-36XVK5P5.js} +5 -5
- package/dist/{chunk-AVSR2HKI.js → chunk-3DZ4LPLS.js} +6 -6
- package/dist/{chunk-LYJJ6546.js → chunk-3GSPCWFX.js} +12 -12
- package/dist/{chunk-CRHPCPZP.js → chunk-4KC4CHKJ.js} +2 -2
- package/dist/{chunk-4VDHLCF5.js → chunk-4WJBWKMI.js} +2 -2
- package/dist/{chunk-KBUTSJSR.js → chunk-4XBYHXGK.js} +2 -2
- package/dist/{chunk-6W75D37F.js → chunk-53P775GE.js} +6 -3
- package/dist/{chunk-XZWSP67B.js → chunk-5APYAXCB.js} +2 -2
- package/dist/{chunk-D65E25JG.js → chunk-67HPYNTJ.js} +2 -2
- package/dist/{chunk-5JQR5B4D.js → chunk-6KV4KCQZ.js} +4 -4
- package/dist/{chunk-V4XJWDHR.js → chunk-6UKFRTXI.js} +2 -1
- package/dist/{chunk-NDPF2N2L.js → chunk-7DW7CJW2.js} +2 -2
- package/dist/{chunk-5KQEUIWM.js → chunk-7LUEQODV.js} +4 -4
- package/dist/{chunk-LNOXCGN2.js → chunk-7UFDIOBT.js} +3 -3
- package/dist/{chunk-DXSETN72.js → chunk-7WUGNN43.js} +2 -2
- package/dist/{chunk-V35KZDUZ.js → chunk-AA3GRZWS.js} +2 -2
- package/dist/{chunk-X4CEFOSG.js → chunk-ADO3OQIC.js} +4 -4
- package/dist/{chunk-UX2L5CUD.js → chunk-AI36V3ON.js} +3 -3
- package/dist/{chunk-B7GY6QER.js → chunk-B26OUMJW.js} +2 -2
- package/dist/{chunk-LAR7DX5E.js → chunk-B5TASTCK.js} +153 -62
- package/dist/{chunk-TGWZXJ7L.js → chunk-BEMQK5Q7.js} +92 -84
- package/dist/{chunk-RNDCROSG.js → chunk-CNXU7TR2.js} +3 -3
- package/dist/{chunk-3JLTRPN7.js → chunk-CVMUXT64.js} +35 -66
- package/dist/{chunk-733ZBT5P.js → chunk-E74MJF6G.js} +4 -4
- package/dist/{chunk-T2MDZES3.js → chunk-EBMTBE76.js} +3 -3
- package/dist/{chunk-OZ76TLGU.js → chunk-EEITU7S6.js} +2 -2
- package/dist/{chunk-GRHOXDKB.js → chunk-ELDJWJKM.js} +97 -14
- package/dist/{chunk-GCQFN7YI.js → chunk-EMYEQLWO.js} +2 -2
- package/dist/{chunk-LTWH2ACR.js → chunk-EQPFEDFV.js} +222 -127
- package/dist/{chunk-TDGYTWM6.js → chunk-F4I3H56H.js} +2 -2
- package/dist/chunk-F6KCJO3U.js +523 -0
- package/dist/{chunk-FGSQHUCK.js → chunk-F6VKWTTY.js} +5 -5
- package/dist/{chunk-UJD5MPP6.js → chunk-FLNXQQ5B.js} +2 -2
- package/dist/{chunk-EX57VVWW.js → chunk-FOSRJ2VZ.js} +4 -4
- package/dist/{chunk-ZARZ4POR.js → chunk-G5ZDQQE3.js} +3 -3
- package/dist/{chunk-HQVN7G4F.js → chunk-G62JBPXN.js} +7 -7
- package/dist/{chunk-ZJPORZTC.js → chunk-GIAI7A2K.js} +2 -2
- package/dist/chunk-GPTR6OTU.js +2551 -0
- package/dist/{chunk-EZD2BXGP.js → chunk-GUFQPTQK.js} +2 -2
- package/dist/{chunk-OPD7GL6F.js → chunk-H6FQVNZC.js} +8 -7
- package/dist/chunk-H7REJ7L5.js +80 -0
- package/dist/{chunk-EYTLV3W3.js → chunk-HTWTORF7.js} +2 -2
- package/dist/{chunk-DF6PI6GN.js → chunk-I6UKQPGS.js} +3 -3
- package/dist/{chunk-ISHUS7HC.js → chunk-JRW236JT.js} +3 -3
- package/dist/{chunk-DE2LU267.js → chunk-KKAJGT3B.js} +3 -2
- package/dist/{chunk-OV62D6KO.js → chunk-KQMYL5GR.js} +3 -3
- package/dist/{chunk-QDUUOZ3S.js → chunk-KWMFC7FN.js} +3 -3
- package/dist/{chunk-R7FGRZNF.js → chunk-LXYHCCIZ.js} +9 -9
- package/dist/{chunk-NFSK2VNU.js → chunk-LZMTVVN4.js} +2 -2
- package/dist/{chunk-62UK7AGW.js → chunk-M5PMRZSR.js} +397 -44
- package/dist/chunk-MMZMM6SW.js +131 -0
- package/dist/{chunk-FFYTC2KQ.js → chunk-MNABNEBX.js} +2 -2
- package/dist/{chunk-XMDBTYCH.js → chunk-N3CWOGVF.js} +3 -3
- package/dist/{chunk-VYRQHORQ.js → chunk-NMQSO6Z6.js} +4 -3
- package/dist/{chunk-R2UUNSNQ.js → chunk-O3ZAF7UY.js} +18 -5
- package/dist/{chunk-4SYHGVDE.js → chunk-OQNCLZI4.js} +4 -4
- package/dist/{chunk-EG4ARXPC.js → chunk-OX6QTA4N.js} +3 -3
- package/dist/{chunk-P4GNZPXO.js → chunk-OYUS3UZP.js} +2 -2
- package/dist/{chunk-OQ2EOAHA.js → chunk-PF36KOGI.js} +291 -112
- package/dist/{chunk-55RMDDFM.js → chunk-PGQG7ZMW.js} +2 -2
- package/dist/{chunk-CBAQPTDU.js → chunk-PIU6BXXW.js} +2 -2
- package/dist/{chunk-EKV4UBCM.js → chunk-PZBQUJ2F.js} +2 -2
- package/dist/{chunk-7RET77VB.js → chunk-Q2HKY32Y.js} +2 -2
- package/dist/{chunk-U6YTUVOX.js → chunk-Q4RMNWMZ.js} +4 -4
- package/dist/chunk-Q6FRR3AQ.js +48 -0
- package/dist/{chunk-6RJMYYIE.js → chunk-QJSIAJBY.js} +3 -3
- package/dist/{chunk-DOUISWEE.js → chunk-QOJ4ERMU.js} +5 -5
- package/dist/{chunk-IFPDAD7R.js → chunk-RWSRKXLT.js} +3 -3
- package/dist/{chunk-T33IYTZM.js → chunk-SAASVMIY.js} +3 -3
- package/dist/{chunk-2DTIWSAW.js → chunk-SEQDH6JC.js} +3 -3
- package/dist/{chunk-BRCOSE7O.js → chunk-SZUO5BSE.js} +2 -2
- package/dist/{chunk-HOEDA42N.js → chunk-T7HZ7KJF.js} +2 -2
- package/dist/{chunk-OJXOA6YU.js → chunk-TL6LNERH.js} +2 -2
- package/dist/{chunk-UCINIRHW.js → chunk-TPCZXWLT.js} +3 -3
- package/dist/{chunk-ZUKUCZYZ.js → chunk-TQ2KTH4A.js} +2 -2
- package/dist/{chunk-4WOOTKFD.js → chunk-U3FETNQB.js} +341 -20
- package/dist/{chunk-5B3RTYAK.js → chunk-UGDSB4AN.js} +2 -2
- package/dist/{chunk-VKHLUZNO.js → chunk-UZ7YBL43.js} +3 -3
- package/dist/{chunk-QNUQ7K7D.js → chunk-VKMSEO7Y.js} +4 -4
- package/dist/{chunk-IN7DGBVS.js → chunk-VLX5VZ35.js} +5 -5
- package/dist/{chunk-SJGS3GDI.js → chunk-WAGBMMNX.js} +5 -5
- package/dist/{chunk-BFOSV5EZ.js → chunk-WX2YCH7F.js} +2 -2
- package/dist/{chunk-3LT34CAM.js → chunk-XBIGUILU.js} +32 -17
- package/dist/{chunk-XDHUDE5K.js → chunk-XKYBFRWR.js} +5 -5
- package/dist/{chunk-U5QU5ZOD.js → chunk-XYPWFSU5.js} +3 -3
- package/dist/{chunk-YBUECLAF.js → chunk-YEJQDODA.js} +2 -2
- package/dist/{chunk-YQ6XEFVK.js → chunk-Z74OGONW.js} +39 -7
- package/dist/{chunk-I4ELN5BX.js → chunk-ZTNOEJRI.js} +2 -2
- package/dist/cli/index.js +26 -26
- package/dist/{clio-K2PBVCEM.js → clio-4IKFE25F.js} +2 -2
- package/dist/{clio-context-tools-GR4OHFSO.js → clio-context-tools-OHJXYX4R.js} +25 -23
- package/dist/{code-nav-4X3OI6DK.js → code-nav-XPM3MY5I.js} +7 -7
- package/dist/{config-Q5J7UBAB.js → config-343YS25T.js} +43 -41
- package/dist/{config-graph-P3555574.js → config-graph-WI263KDX.js} +43 -41
- package/dist/{configure-KIJ32ZO6.js → configure-GZDG4HER.js} +21 -21
- package/dist/{context-LFBQOSXT.js → context-4OFO7N7Y.js} +12 -12
- package/dist/{context-WBH3KSVR.js → context-JLK2RLOG.js} +42 -40
- package/dist/{context-NNLBES2Y.js → context-O6DIWCF6.js} +23 -21
- package/dist/{context-clear-YOHMQ6SQ.js → context-clear-MR7KOGQI.js} +42 -40
- package/dist/{context-working-set-MRAEVDNV.js → context-working-set-YZAD3KWO.js} +14 -13
- package/dist/{data-tool-JJPBGMQJ.js → data-tool-EKD7DFHG.js} +7 -7
- package/dist/{detail-RHJOTGN4.js → detail-YZPHFEVJ.js} +43 -41
- package/dist/{dispatch-runner-NC7PYNIO.js → dispatch-runner-VKVXVTWJ.js} +44 -42
- package/dist/{doctor-S5KZ2GTN.js → doctor-53AVQXAO.js} +17 -16
- package/dist/{doctor-deep-2EJQSHIZ.js → doctor-deep-BLRB2NCG.js} +5 -5
- package/dist/{eval-3D6M36N7.js → eval-P3BQSLQE.js} +21 -20
- package/dist/{evidence-XNVPPLVK.js → evidence-6LLI6SZH.js} +44 -42
- package/dist/{evidence-6IYN52ET.js → evidence-HTN3JLUO.js} +42 -40
- package/dist/{evidence-JVECPI3F.js → evidence-NJRE3R5H.js} +42 -40
- package/dist/{evolve-TLPUDJDM.js → evolve-WWZHJVJP.js} +42 -40
- package/dist/{fleet-WKVBF5SZ.js → fleet-GGZ4BVJE.js} +64 -62
- package/dist/{fleet-6RJWIOEO.js → fleet-QG3IIWWM.js} +44 -42
- package/dist/{fleet-commands-L6WFT7KZ.js → fleet-commands-J2ZIKISQ.js} +7 -7
- package/dist/{fleet-decisions-BTQMWU5A.js → fleet-decisions-Y2Q7375Q.js} +8 -8
- package/dist/{fleet-graph-553DZ67Q.js → fleet-graph-TCBCCCBP.js} +11 -11
- package/dist/{fleet-inspect-236FZPRB.js → fleet-inspect-KOLKBC56.js} +44 -42
- package/dist/{fleet-preflight-NZQHABWO.js → fleet-preflight-44UNCC4Y.js} +27 -25
- package/dist/{fleet-validate-7NLAE26R.js → fleet-validate-K2FXRZVA.js} +13 -13
- package/dist/{fleet-verify-E3RO6A5W.js → fleet-verify-AS444WDW.js} +42 -40
- package/dist/{fleet-view-KMZQY7YJ.js → fleet-view-X4JU4J6O.js} +43 -41
- package/dist/gui/ops-worker.js +9 -9
- package/dist/gui/reads-worker.js +9 -8
- package/dist/{init-DV5B6HQG.js → init-VSOWFHVL.js} +54 -52
- package/dist/{interactive-OXGYZYAS.js → interactive-JRCBENLZ.js} +1733 -577
- package/dist/{interop-J7UOBOSF.js → interop-JR6BCY7R.js} +10 -10
- package/dist/{inventory-OEGIL6PY.js → inventory-3JUGLVJI.js} +43 -41
- package/dist/{library-ROZAMUIL.js → library-7BOH3Y7N.js} +15 -15
- package/dist/{library-B3UPGY4V.js → library-7PFONXUI.js} +9 -9
- package/dist/{library-MXQA5DLT.js → library-TUYZMFIA.js} +7 -7
- package/dist/{library-import-2LTWOVBD.js → library-import-TJVXKLDK.js} +10 -10
- package/dist/{library-inventory-LJ3XHLWO.js → library-inventory-MD3AYTP4.js} +9 -9
- package/dist/{library-validation-DARHHUNW.js → library-validation-ZDLITEA3.js} +7 -7
- package/dist/{mcp-2GSPYQ54.js → mcp-EFCWUPUR.js} +3 -3
- package/dist/{memory-J3STUUIK.js → memory-Q2YVOKK5.js} +42 -40
- package/dist/{models-Y3GMFJ2V.js → models-M7BOCW7F.js} +17 -16
- package/dist/{monitor-LHNH577J.js → monitor-2HD3MC67.js} +47 -45
- package/dist/{orchestrator-DTAPXULA.js → orchestrator-OUW3ZN6Y.js} +1894 -226
- package/dist/{panes-A743ONZ5.js → panes-TTPPSYCL.js} +3 -3
- package/dist/{preload-OJBMAIXF.js → preload-A47C2NUF.js} +42 -40
- package/dist/{providers-CMETPZNS.js → providers-T43W7EL4.js} +4 -4
- package/dist/{resources-FY6XYFN2.js → resources-TP6X2V6W.js} +20 -11
- package/dist/{run-H64MEVTA.js → run-LDSBPMCS.js} +61 -59
- package/dist/{share-CAFMMQLM.js → share-URHKKMHR.js} +9 -9
- package/dist/{skills-ERKQUC7L.js → skills-E477MOOO.js} +13 -11
- package/dist/{skills-eval-CQ23MYQK.js → skills-eval-AIBR2L7H.js} +583 -93
- package/dist/{skills-inventory-TVUYJDVN.js → skills-inventory-HLMKY3R5.js} +13 -11
- package/dist/{slash-commands-ROG3KIFJ.js → slash-commands-LIIZKA5Y.js} +28 -26
- package/dist/{startup-background-KDWCQMWT.js → startup-background-JR2KDK6R.js} +43 -41
- package/dist/{steer-KKYXJSH4.js → steer-D7RTAPCM.js} +3 -3
- package/dist/{system-ZDW44ZGX.js → system-X2P5N4IY.js} +14 -13
- package/dist/{targets-AJWA6E7Z.js → targets-VFFAKUFM.js} +25 -24
- package/dist/{tasks-6L2JJRC5.js → tasks-ERAWZA22.js} +6 -6
- package/dist/{terminal-lease-YFUSDPAD.js → terminal-lease-V2N2BIKQ.js} +2 -2
- package/dist/{trace-LA5MVR4Y.js → trace-MA5BT7XY.js} +3 -3
- package/dist/{usage-XSILDHKF.js → usage-WYFY2L6M.js} +50 -48
- package/dist/{verifiers-ECA5GIHL.js → verifiers-TYIW2XKF.js} +7 -7
- package/dist/{verify-R6QQCCEB.js → verify-242UFYTP.js} +6 -6
- package/dist/{web-fetch-PVZNMBOB.js → web-fetch-LRAGYU6Y.js} +3 -3
- package/dist/{wiki-generate-RP22WP5K.js → wiki-generate-OFKOX2T6.js} +53 -51
- package/dist/worker/entry.js +31 -29
- package/docs/architecture/architecture.md +1 -0
- package/docs/architecture/context-engine.md +4 -2
- package/docs/architecture/observability.md +6 -4
- package/docs/architecture/prompt-envelope-and-tools.md +1 -1
- package/docs/architecture/session-lifecycle.md +1 -1
- package/docs/architecture/tui-design.md +12 -9
- package/docs/gui/parity/02-slash-and-surfaces.md +1 -1
- package/docs/guide/commands-and-modes.md +91 -5
- package/docs/guide/configuration-and-targets.md +2 -2
- package/docs/guide/context-continuity.md +49 -0
- package/docs/guide/proactive-memory.md +6 -3
- package/library/registry.yaml +292 -32
- package/library/skills/README.md +27 -2
- package/library/skills/context/context-handoff/SKILL.md +10 -4
- package/library/skills/meta/clio-coder-dev/SKILL.md +92 -88
- package/library/skills/meta/clio-coder-dev/evals.md +51 -46
- package/library/skills/meta/clio-coder-dev/plugin.json +2 -2
- package/library/skills/meta/clio-coder-dev/references/change-map.md +49 -0
- package/library/skills/meta/clio-coder-test/SKILL.md +89 -142
- package/library/skills/meta/clio-coder-test/evals.md +58 -62
- package/library/skills/meta/clio-coder-test/plugin.json +2 -2
- package/library/skills/meta/clio-coder-test/references/harness.md +3 -3
- package/library/skills/meta/clio-coder-test/references/lifecycle-validation.md +30 -0
- package/library/skills/meta/clio-coder-test/references/test-map.md +60 -89
- package/library/skills/registry.yaml +5 -5
- package/library/skills/skill-marketplace.json +12 -14
- package/package.json +1 -1
- package/src/cli/skills-eval.ts +1064 -54
- package/src/cli/usage.ts +2 -2
- package/src/core/clio-repo.ts +3 -0
- package/src/core/tool-names.ts +1 -0
- package/src/domains/context/budget/inspection.ts +9 -0
- package/src/domains/context/budget/live-view.ts +418 -0
- package/src/domains/context/budget/pressure.ts +393 -0
- package/src/domains/context/budget/request-fit.ts +15 -0
- package/src/domains/evidence/build.ts +24 -0
- package/src/domains/gateway/mcp/client.ts +1 -1
- package/src/domains/memory/commit-state.ts +160 -0
- package/src/domains/memory/operations.ts +18 -10
- package/src/domains/memory/prompt-cache.ts +95 -0
- package/src/domains/memory/prompt-section.ts +50 -7
- package/src/domains/memory/relevance.ts +93 -0
- package/src/domains/memory/restoration.ts +78 -0
- package/src/domains/memory/store.ts +39 -1
- package/src/domains/middleware/memory-intervention.ts +116 -24
- package/src/domains/observability/background-memory-usage.ts +1 -1
- package/src/domains/observability/cost.ts +3 -3
- package/src/domains/observability/extension.ts +1 -1
- package/src/domains/observability/metrics.ts +1 -1
- package/src/domains/prompts/compiler.ts +1 -1
- package/src/domains/prompts/extension.ts +38 -1
- package/src/domains/quota/anthropic-max-provider.ts +134 -0
- package/src/domains/quota/anthropic-usage.ts +220 -0
- package/src/domains/quota/antigravity-provider.ts +339 -0
- package/src/domains/quota/cache.ts +87 -0
- package/src/domains/quota/claude-code-provider.ts +169 -0
- package/src/domains/quota/codex-provider.ts +237 -0
- package/src/domains/quota/presentation.ts +240 -0
- package/src/domains/quota/registry.ts +23 -0
- package/src/domains/quota/service.ts +93 -0
- package/src/domains/quota/summary-feed.ts +86 -0
- package/src/domains/quota/types.ts +84 -0
- package/src/domains/resources/index.ts +11 -0
- package/src/domains/resources/skills/catalog-view.ts +571 -0
- package/src/domains/resources/skills/lexical-match.ts +136 -0
- package/src/domains/resources/skills/loader.ts +38 -0
- package/src/domains/resources/skills/promotion.ts +1 -55
- package/src/domains/resources/skills/provenance-pin.ts +50 -20
- package/src/domains/safety/action-classifier.ts +1 -0
- package/src/domains/session/compaction/branch-summary.ts +4 -1
- package/src/domains/session/compaction/compact.ts +18 -2
- package/src/domains/session/compaction/cut-point.ts +20 -1
- package/src/domains/session/compaction/tokens.ts +48 -3
- package/src/domains/session/context-accounting.ts +8 -1
- package/src/domains/session/continuity/carry.ts +59 -0
- package/src/domains/session/continuity/contract.ts +592 -0
- package/src/domains/session/continuity/evidence.ts +290 -0
- package/src/domains/session/continuity/fold.ts +1075 -0
- package/src/domains/session/continuity/note.ts +79 -0
- package/src/domains/session/continuity/operator-request.ts +104 -0
- package/src/domains/session/continuity/persistence.ts +408 -0
- package/src/domains/session/continuity/ports.ts +231 -0
- package/src/domains/session/continuity/projection.ts +538 -0
- package/src/domains/session/continuity/validate.ts +352 -0
- package/src/domains/session/entries.ts +50 -3
- package/src/domains/session/index.ts +48 -0
- package/src/domains/session/migrations/index.ts +7 -3
- package/src/domains/session/tree/fork.ts +15 -1
- package/src/domains/session/usage.ts +2 -2
- package/src/engine/acp/commands.ts +1 -1
- package/src/engine/agent.ts +133 -9
- package/src/engine/session.ts +13 -6
- package/src/entry/orchestrator.ts +116 -33
- package/src/interactive/chat-loop-messages.ts +2 -2
- package/src/interactive/chat-loop.ts +219 -63
- package/src/interactive/chat-renderer.ts +99 -8
- package/src/interactive/context-overlay.ts +24 -3
- package/src/interactive/continuity-controller.ts +526 -0
- package/src/interactive/dispatch-board.ts +21 -3
- package/src/interactive/footer/dashboard.ts +25 -1
- package/src/interactive/footer/key-hints.ts +2 -2
- package/src/interactive/footer/pages.ts +70 -27
- package/src/interactive/footer/widgets.ts +32 -7
- package/src/interactive/footer-panel.ts +1 -1
- package/src/interactive/interactive-application.ts +7 -2
- package/src/interactive/interactive-input-runtime.ts +2 -2
- package/src/interactive/interactive-presentation.ts +15 -0
- package/src/interactive/interactive-slash-runtime.ts +45 -8
- package/src/interactive/interactive-tickers.ts +7 -1
- package/src/interactive/model-session-replay.ts +130 -3
- package/src/interactive/output-reserve.ts +35 -0
- package/src/interactive/overlay-general-openers.ts +12 -8
- package/src/interactive/overlay-key-routing.ts +6 -9
- package/src/interactive/overlay-lifecycle.ts +10 -6
- package/src/interactive/overlay-session-lifecycle.ts +21 -14
- package/src/interactive/quota-view.ts +229 -0
- package/src/interactive/session-last-turn.ts +1 -1
- package/src/interactive/session-transcript.ts +2 -1
- package/src/interactive/session-usage-reseed.ts +2 -2
- package/src/interactive/side-question.ts +2 -2
- package/src/interactive/slash-commands.ts +28 -9
- package/src/interactive/turn-context.ts +686 -63
- package/src/interactive/turn-middleware.ts +39 -6
- package/src/interactive/turn-persistence.ts +15 -2
- package/src/interactive/turn-prewarm.ts +1 -1
- package/src/interactive/turn-runtime.ts +48 -5
- package/src/interactive/{cost-overlay.ts → usage-overlay.ts} +121 -33
- package/src/interactive/welcome-dashboard.ts +26 -3
- package/src/tools/agent-tools.ts +3 -1
- package/src/tools/bootstrap.ts +6 -0
- package/src/tools/builtin-tool-catalog.ts +9 -0
- package/src/tools/context/index.ts +148 -113
- package/src/tools/context/surface.ts +11 -7
- package/src/tools/core-bootstrap.ts +4 -0
- package/src/tools/observation.ts +8 -2
- package/src/tools/policy.ts +3 -0
- package/src/tools/self-compact.ts +31 -0
- package/src/tools/surface.ts +1 -0
- package/src/tools/tasks.ts +1 -1
- package/dist/chunk-CTFPFW3H.js +0 -44
- package/dist/chunk-EOJPDNUP.js +0 -1325
- package/dist/chunk-I4Y4WKZR.js +0 -386
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Binding `ContinuityPersistencePorts` to the real session writer.
|
|
3
|
+
*
|
|
4
|
+
* The 02A protocol is injected on purpose, and this is the only place it meets
|
|
5
|
+
* Clio's actual append, flush and checkpoint. Four properties of the existing
|
|
6
|
+
* seams shape it:
|
|
7
|
+
*
|
|
8
|
+
* - `SessionContract` forwards every write to whichever session is *current*.
|
|
9
|
+
* A checkpoint is awaited, and a `/tree` switch or `/resume` during that
|
|
10
|
+
* await installs a different session. So the origin is captured once, at
|
|
11
|
+
* admission, and rechecked before every write and after every barrier. The
|
|
12
|
+
* ports never ask "which session is open", only "is the one I was bound to
|
|
13
|
+
* still open".
|
|
14
|
+
* - `sessionPaths()` mkdirs and `sessionCurrentPath()` resolves through
|
|
15
|
+
* `clioStateDir()`, which initializes the state root. Neither may be used
|
|
16
|
+
* from a readback: an inspection that rebuilds the directory it is
|
|
17
|
+
* inspecting is how an uninstalled state root came back. The readback
|
|
18
|
+
* composes its path from `clioStatePath()` and the captured metadata and
|
|
19
|
+
* never creates anything.
|
|
20
|
+
* - `readSessionFileEntries()` is not read-only either. It promotes a
|
|
21
|
+
* leftover `current.jsonl.tmp` over a missing target and fsyncs the
|
|
22
|
+
* directory. That recovery is right for opening a session and wrong for
|
|
23
|
+
* proving whether one record exists, so the readback here does its own
|
|
24
|
+
* plain read and reports the ambiguity instead of resolving it.
|
|
25
|
+
* - The existing summary lookup returns at its first `kind` + id match. That
|
|
26
|
+
* is precedent, not proof: it cannot see a later conflicting copy and it
|
|
27
|
+
* compares no payload. The readback below scans the whole ledger, compares
|
|
28
|
+
* every copy by value, and treats one malformed line anywhere as enough to
|
|
29
|
+
* make the answer unresolved.
|
|
30
|
+
*
|
|
31
|
+
* Nothing here executes a recovery, and nothing widens `SessionContract`.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
35
|
+
import { join } from "node:path";
|
|
36
|
+
|
|
37
|
+
import { clioStatePath, stateRootRemoved } from "../../../core/xdg.js";
|
|
38
|
+
import { CURRENT_SESSION_FORMAT_VERSION } from "../../../engine/session.js";
|
|
39
|
+
import type { SessionContract, SessionEntryInput } from "../contract.js";
|
|
40
|
+
import { isSessionEntry, isSessionHeader } from "../entries.js";
|
|
41
|
+
import { OLDEST_READABLE_SESSION_FORMAT_VERSION } from "../migrations/index.js";
|
|
42
|
+
import type { ContinuityAppendable, ContinuityPersistencePorts, ContinuityReadback } from "./contract.js";
|
|
43
|
+
import { canonicalJson } from "./validate.js";
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The session a transaction was admitted in, captured before any write.
|
|
47
|
+
*
|
|
48
|
+
* `cwdHash` travels with the id because the ledger path needs both and reading
|
|
49
|
+
* it back from the live meta would follow a navigation instead of pinning it.
|
|
50
|
+
*/
|
|
51
|
+
export interface ContinuityPortOrigin {
|
|
52
|
+
sessionId: string;
|
|
53
|
+
cwdHash: string;
|
|
54
|
+
/**
|
|
55
|
+
* Extra liveness the caller pins beyond the session id: the selected message
|
|
56
|
+
* leaf, the initiating turn, a cancellation generation. Packet 03 supplies
|
|
57
|
+
* this from its runtime authority; when absent, only the session id is
|
|
58
|
+
* pinned, which is the minimum that keeps a write off another session.
|
|
59
|
+
*/
|
|
60
|
+
stillCurrent?: () => boolean;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface ContinuityPortsInput {
|
|
64
|
+
session: SessionContract;
|
|
65
|
+
origin: ContinuityPortOrigin;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** The pinned ledger path, composed without creating anything. */
|
|
69
|
+
function pinnedLedgerPath(origin: ContinuityPortOrigin): string {
|
|
70
|
+
return join(clioStatePath(), "sessions", origin.cwdHash, origin.sessionId, "current.jsonl");
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Prove what the ledger holds for exactly this record.
|
|
75
|
+
*
|
|
76
|
+
* Every outcome other than `matching` and `absent` is a refusal to conclude.
|
|
77
|
+
* A missing ledger with a leftover temp beside it is the ambiguous case the
|
|
78
|
+
* binding notes call out: the record may be in the temp, the temp may be stale,
|
|
79
|
+
* and promoting it would be a write during an inspection. It answers
|
|
80
|
+
* `unresolved` and leaves the files alone.
|
|
81
|
+
*/
|
|
82
|
+
export function readContinuityRecordExact(
|
|
83
|
+
origin: ContinuityPortOrigin,
|
|
84
|
+
expected: ContinuityAppendable,
|
|
85
|
+
): ContinuityReadback {
|
|
86
|
+
const path = pinnedLedgerPath(origin);
|
|
87
|
+
if (!existsSync(path)) {
|
|
88
|
+
const temp = `${path}.tmp`;
|
|
89
|
+
if (existsSync(temp)) {
|
|
90
|
+
return { status: "unresolved", detail: "session ledger is missing and a temporary candidate exists beside it" };
|
|
91
|
+
}
|
|
92
|
+
return { status: "unresolved", detail: "session ledger does not exist" };
|
|
93
|
+
}
|
|
94
|
+
let raw: string;
|
|
95
|
+
try {
|
|
96
|
+
raw = readFileSync(path, "utf8");
|
|
97
|
+
} catch (error) {
|
|
98
|
+
return {
|
|
99
|
+
status: "unresolved",
|
|
100
|
+
detail: `session ledger could not be read: ${error instanceof Error ? error.message : String(error)}`,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
const wanted = canonicalJson(expected);
|
|
104
|
+
let found = 0;
|
|
105
|
+
let conflicting: string | null = null;
|
|
106
|
+
let headers = 0;
|
|
107
|
+
for (const line of raw.split("\n")) {
|
|
108
|
+
if (line.trim().length === 0) continue;
|
|
109
|
+
let parsed: unknown;
|
|
110
|
+
try {
|
|
111
|
+
parsed = JSON.parse(line) as unknown;
|
|
112
|
+
} catch {
|
|
113
|
+
// One unreadable line anywhere can be the record being looked for, so
|
|
114
|
+
// nothing after it can prove absence. §6: malformed data never proves
|
|
115
|
+
// absence, and a torn tail is not permission to write the id again.
|
|
116
|
+
return { status: "unresolved", detail: "session ledger contains a line that could not be parsed" };
|
|
117
|
+
}
|
|
118
|
+
if (isSessionHeader(parsed)) {
|
|
119
|
+
// The header is what makes this file the pinned session's ledger. A
|
|
120
|
+
// file holding someone else's header is not evidence about this
|
|
121
|
+
// session at all, and answering `absent` from it would license a
|
|
122
|
+
// re-append into a session whose ledger was never actually read. A
|
|
123
|
+
// version this build does not read is the same refusal: a future
|
|
124
|
+
// format can hold records this scan cannot see.
|
|
125
|
+
headers += 1;
|
|
126
|
+
if (headers > 1) return { status: "unresolved", detail: "session ledger carries more than one session header" };
|
|
127
|
+
if (parsed.id !== origin.sessionId) {
|
|
128
|
+
return {
|
|
129
|
+
status: "unresolved",
|
|
130
|
+
detail: `session ledger carries session header ${parsed.id}, not ${origin.sessionId}`,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
if (parsed.version < OLDEST_READABLE_SESSION_FORMAT_VERSION || parsed.version > CURRENT_SESSION_FORMAT_VERSION) {
|
|
134
|
+
return { status: "unresolved", detail: `session ledger header declares format version ${parsed.version}` };
|
|
135
|
+
}
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
// Parsing is a weaker test than being a record. A JSON scalar, an array, or
|
|
139
|
+
// an object missing its envelope is data this reader cannot account for,
|
|
140
|
+
// and skipping it would let exactly the kind of damage §6 is about turn
|
|
141
|
+
// into a clean `absent`. The admitted shapes are the v3/v4/v5 session
|
|
142
|
+
// header and the entry union; anything else stops the scan.
|
|
143
|
+
if (!isSessionEntry(parsed)) {
|
|
144
|
+
return { status: "unresolved", detail: "session ledger contains a structured record this build cannot validate" };
|
|
145
|
+
}
|
|
146
|
+
const record = parsed as unknown as Record<string, unknown>;
|
|
147
|
+
if (record.turnId !== expected.turnId) continue;
|
|
148
|
+
// The scan does not stop at the first hit: a second copy under one id with
|
|
149
|
+
// different bytes is a conflict even when an earlier copy matched exactly.
|
|
150
|
+
if (canonicalJson(record) === wanted) {
|
|
151
|
+
found += 1;
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
conflicting = `stored record ${String(expected.turnId)} has this id and different payload`;
|
|
155
|
+
}
|
|
156
|
+
if (conflicting !== null) return { status: "conflicting", detail: conflicting };
|
|
157
|
+
// Ownership has to be positively established before an answer of `absent`
|
|
158
|
+
// means anything. A ledger with no header at all is a legacy or truncated
|
|
159
|
+
// file this binding cannot attribute to the pinned session, so it is
|
|
160
|
+
// unresolved rather than proof that the record was never written. Nothing is
|
|
161
|
+
// repaired: no header is added and no file is rewritten.
|
|
162
|
+
if (headers === 0) {
|
|
163
|
+
return { status: "unresolved", detail: "session ledger carries no session header to attribute it to this session" };
|
|
164
|
+
}
|
|
165
|
+
return found > 0 ? { status: "matching" } : { status: "absent" };
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Bind the protocol to this session's writer.
|
|
170
|
+
*
|
|
171
|
+
* `flushAppends` is forwarded only when the contract really has it. A
|
|
172
|
+
* `SessionContract` without one is an unsupported persistence port, and the
|
|
173
|
+
* group persister reports that rather than treating a barrier nobody ran as a
|
|
174
|
+
* success. `checkpoint` keeps its own inner removed-state guards; the outer
|
|
175
|
+
* checks here do not replace them.
|
|
176
|
+
*/
|
|
177
|
+
export function createContinuityPersistencePorts(input: ContinuityPortsInput): ContinuityPersistencePorts {
|
|
178
|
+
const session = input.session;
|
|
179
|
+
// Captured by value, not by reference. Holding the caller's object would let
|
|
180
|
+
// a mutation made while a checkpoint is awaited retarget both the liveness
|
|
181
|
+
// check and the readback path at once, which is precisely the confusion the
|
|
182
|
+
// pinned origin exists to prevent: the ports would then agree that a
|
|
183
|
+
// different session is "current" and read that session's ledger to confirm it.
|
|
184
|
+
const origin: ContinuityPortOrigin = {
|
|
185
|
+
sessionId: input.origin.sessionId,
|
|
186
|
+
cwdHash: input.origin.cwdHash,
|
|
187
|
+
...(input.origin.stillCurrent === undefined ? {} : { stillCurrent: input.origin.stillCurrent }),
|
|
188
|
+
};
|
|
189
|
+
const isOriginCurrent = (): boolean => {
|
|
190
|
+
if (session.current()?.id !== origin.sessionId) return false;
|
|
191
|
+
return origin.stillCurrent?.() ?? true;
|
|
192
|
+
};
|
|
193
|
+
const ports: ContinuityPersistencePorts = {
|
|
194
|
+
append(entry: ContinuityAppendable): void {
|
|
195
|
+
// Defence in depth. `persistContinuityGroup` checks origin immediately
|
|
196
|
+
// before calling this, but the two are separately reviewable and a write
|
|
197
|
+
// to the wrong session is unrecoverable, so the writer refuses too.
|
|
198
|
+
if (!isOriginCurrent()) {
|
|
199
|
+
throw new Error(`continuity append refused: session ${origin.sessionId} is no longer current`);
|
|
200
|
+
}
|
|
201
|
+
// Reserved identity, supplied explicitly. Letting the manager mint a
|
|
202
|
+
// replacement turnId would break the one invariant recovery depends on:
|
|
203
|
+
// that a missing commit is rebuilt under the id its prepare reserved.
|
|
204
|
+
if (typeof entry.turnId !== "string" || entry.turnId.length === 0) {
|
|
205
|
+
throw new Error("continuity append refused: the record carries no reserved turnId");
|
|
206
|
+
}
|
|
207
|
+
if (typeof entry.timestamp !== "string" || entry.timestamp.length === 0) {
|
|
208
|
+
throw new Error("continuity append refused: the record carries no explicit timestamp");
|
|
209
|
+
}
|
|
210
|
+
session.appendEntry(entry as unknown as SessionEntryInput);
|
|
211
|
+
},
|
|
212
|
+
readExact: (expected) => readContinuityRecordExact(origin, expected),
|
|
213
|
+
isStateRemoved: () => stateRootRemoved(),
|
|
214
|
+
isOriginCurrent,
|
|
215
|
+
};
|
|
216
|
+
if (session.flushAppends) {
|
|
217
|
+
ports.flushAppends = () => {
|
|
218
|
+
if (!isOriginCurrent()) {
|
|
219
|
+
throw new Error(`continuity flush refused: session ${origin.sessionId} is no longer current`);
|
|
220
|
+
}
|
|
221
|
+
session.flushAppends?.();
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
ports.checkpoint = async (reason: string) => {
|
|
225
|
+
if (!isOriginCurrent()) {
|
|
226
|
+
throw new Error(`continuity checkpoint refused: session ${origin.sessionId} is no longer current`);
|
|
227
|
+
}
|
|
228
|
+
await session.checkpoint(reason);
|
|
229
|
+
};
|
|
230
|
+
return ports;
|
|
231
|
+
}
|