chainlesschain 0.166.143 → 0.166.145
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/README.md +63 -10
- package/package.json +2 -2
- package/src/assets/linux-subreaper/linux-arm64/manifest.json +1 -1
- package/src/assets/linux-subreaper/linux-x64/manifest.json +1 -1
- package/src/assets/web-panel/.build-hash +1 -1
- package/src/assets/web-panel/assets/{AIOps-DNySV2Kf.js → AIOps-BjBY1txq.js} +1 -1
- package/src/assets/web-panel/assets/{ActionButton-ByFuxJsa.js → ActionButton-CS2ov4iK.js} +1 -1
- package/src/assets/web-panel/assets/{Analytics-ETbdywk5.js → Analytics-C9LS7ahG.js} +1 -1
- package/src/assets/web-panel/assets/{AppLayout-CuHekZaP.js → AppLayout-4_s9gBVg.js} +2 -2
- package/src/assets/web-panel/assets/{Artifacts-BJJq2BDq.js → Artifacts-CwS17ayg.js} +1 -1
- package/src/assets/web-panel/assets/{Audit-DXrietv8.js → Audit-D3QMRsd-.js} +1 -1
- package/src/assets/web-panel/assets/{BackgroundAgents-CFB1fxsr.js → BackgroundAgents-Bxau9H9Q.js} +1 -1
- package/src/assets/web-panel/assets/{Backup-VLtflRmp.js → Backup--YSJyAuP.js} +1 -1
- package/src/assets/web-panel/assets/{BaseInput-BbqBaS2r.js → BaseInput-DZolkmdu.js} +1 -1
- package/src/assets/web-panel/assets/{Chat-t0g7BXL8.js → Chat-DA-7fNKq.js} +1 -1
- package/src/assets/web-panel/assets/{ChatBubbleRenderer-JNFsjV0j.js → ChatBubbleRenderer-DniEWT5j.js} +1 -1
- package/src/assets/web-panel/assets/{Checkbox-BCSclHQb.js → Checkbox-B4hgbnOB.js} +1 -1
- package/src/assets/web-panel/assets/{Codegen-BcyINEHT.js → Codegen-BQ3HSq9S.js} +1 -1
- package/src/assets/web-panel/assets/{Col-C-0WNlwS.js → Col-DJwxq_Wu.js} +1 -1
- package/src/assets/web-panel/assets/{Community-DxZeoORX.js → Community-DZYVM_iz.js} +1 -1
- package/src/assets/web-panel/assets/{Compact-BNnX4jpz.js → Compact-1Yq5o53N.js} +1 -1
- package/src/assets/web-panel/assets/{Compliance-KnjHtn9C.js → Compliance-52Per8mR.js} +1 -1
- package/src/assets/web-panel/assets/{Cowork-CDyCrhbX.js → Cowork-BaCNxzo7.js} +1 -1
- package/src/assets/web-panel/assets/{Cron-DxpS3D1G.js → Cron-DADTMPPr.js} +1 -1
- package/src/assets/web-panel/assets/{Crosschain-BSzTZYyc.js → Crosschain-CS3rx96X.js} +1 -1
- package/src/assets/web-panel/assets/{DID-Bfj9Vdne.js → DID-B8eatIvd.js} +1 -1
- package/src/assets/web-panel/assets/{Dashboard-CcERVdgo.js → Dashboard-0vsurC1X.js} +2 -2
- package/src/assets/web-panel/assets/{Dropdown-BtYXAz6E.js → Dropdown-BULy3ccq.js} +1 -1
- package/src/assets/web-panel/assets/{EmailListRenderer-fdCMeGXU.js → EmailListRenderer-CcwgCUpu.js} +1 -1
- package/src/assets/web-panel/assets/{EvolutionSettings-LHxhcuF2.js → EvolutionSettings-DLs_6II3.js} +1 -1
- package/src/assets/web-panel/assets/{FamilyGuardDashboard-MIgtLsos.js → FamilyGuardDashboard-DpUpWwQP.js} +1 -1
- package/src/assets/web-panel/assets/{Federation-9-TOztwa.js → Federation-6hx8MMYA.js} +1 -1
- package/src/assets/web-panel/assets/{FormItemContext-BKcwEE6w.js → FormItemContext-CsdE-ZR5.js} +1 -1
- package/src/assets/web-panel/assets/{GenericCardRenderer-DJBPVUK2.js → GenericCardRenderer-DzXneQPV.js} +1 -1
- package/src/assets/web-panel/assets/{Git-C_XYISjG.js → Git-D_ThKL1Q.js} +1 -1
- package/src/assets/web-panel/assets/{Governance-DWsbPrwq.js → Governance-BFBSlr-9.js} +1 -1
- package/src/assets/web-panel/assets/{Inference-D0_bYket.js → Inference-BAI0b1Jl.js} +1 -1
- package/src/assets/web-panel/assets/{KnowledgeGraph-BoA3VQlw.js → KnowledgeGraph-CpO6Bdtr.js} +1 -1
- package/src/assets/web-panel/assets/{Logs-LEGItChf.js → Logs-BcRaS_HC.js} +1 -1
- package/src/assets/web-panel/assets/{MarkdownRenderer-DOHVc-Uw.js → MarkdownRenderer-CmZaA7Ct.js} +1 -1
- package/src/assets/web-panel/assets/{Marketplace-BKovl9NH.js → Marketplace-BpHBn0Nw.js} +1 -1
- package/src/assets/web-panel/assets/{McpTools-D61ktoGb.js → McpTools-auVxEYSE.js} +1 -1
- package/src/assets/web-panel/assets/{Memory-CllorS0l.js → Memory-DpCyb656.js} +1 -1
- package/src/assets/web-panel/assets/{MobileBridge-D-dJ78bk.js → MobileBridge-CEIGi769.js} +1 -1
- package/src/assets/web-panel/assets/{MobileProjects-CaxMKkd3.js → MobileProjects-pphH0a8n.js} +1 -1
- package/src/assets/web-panel/assets/{Mtc-qEc62Qsx.js → Mtc-CMJXBEp1.js} +1 -1
- package/src/assets/web-panel/assets/{MtcAudit-BY68jOZJ.js → MtcAudit-BI25yvzM.js} +1 -1
- package/src/assets/web-panel/assets/{Multisig-eCCR8ELt.js → Multisig-BhMDExsQ.js} +1 -1
- package/src/assets/web-panel/assets/{NLProgramming-VtGv8pky.js → NLProgramming-CatOR9Ez.js} +1 -1
- package/src/assets/web-panel/assets/{Notes-CPkYQySe.js → Notes-BHG6SBpu.js} +1 -1
- package/src/assets/web-panel/assets/{NotificationSettings-BuAvlHUu.js → NotificationSettings-BB-m0AbL.js} +1 -1
- package/src/assets/web-panel/assets/{OrderTableRenderer-CLf_HAGv.js → OrderTableRenderer-W-WReAih.js} +1 -1
- package/src/assets/web-panel/assets/{Organization-DjujhMbD.js → Organization-BkQCgon_.js} +1 -1
- package/src/assets/web-panel/assets/{Overflow-RznznTS4.js → Overflow-kCTwPrIc.js} +1 -1
- package/src/assets/web-panel/assets/{P2P-DSa5ot0t.js → P2P-CvOF8whc.js} +1 -1
- package/src/assets/web-panel/assets/{PdhVaultBrowser-oSEh6vkf.js → PdhVaultBrowser-DYkTzn6u.js} +2 -2
- package/src/assets/web-panel/assets/{Permissions-CdOZguX9.js → Permissions-F-UzeWVt.js} +1 -1
- package/src/assets/web-panel/assets/{PersonalDataHub-B4--6iEF.js → PersonalDataHub-BURpZBb6.js} +1 -1
- package/src/assets/web-panel/assets/{Pipeline-BnI57jE8.js → Pipeline-lZYx_7qc.js} +1 -1
- package/src/assets/web-panel/assets/{Privacy-C8MId3ad.js → Privacy-DdfYgt1_.js} +1 -1
- package/src/assets/web-panel/assets/{ProjectInit-DPGyYO8a.js → ProjectInit-DbMBCojn.js} +1 -1
- package/src/assets/web-panel/assets/{ProjectSettings-qBMqaJaO.js → ProjectSettings-DPGbzkyi.js} +1 -1
- package/src/assets/web-panel/assets/{Projects-Bq87Syce.js → Projects-B9-t2ofM.js} +1 -1
- package/src/assets/web-panel/assets/{Providers-CVuG9Ugf.js → Providers-q9dSBLsP.js} +1 -1
- package/src/assets/web-panel/assets/{QrScannerModal-C94c8m3q.js → QrScannerModal-BIth1Lij.js} +1 -1
- package/src/assets/web-panel/assets/{QuickAsk-BvfsXZ8s.js → QuickAsk-C928WbdK.js} +1 -1
- package/src/assets/web-panel/assets/{Recommend-CoezBYH9.js → Recommend-CzDNsNPZ.js} +1 -1
- package/src/assets/web-panel/assets/{RemoteSession-CcYC4v3u.js → RemoteSession-CedjOslI.js} +1 -1
- package/src/assets/web-panel/assets/{Reputation-diDbL4cO.js → Reputation-B8ggKVtj.js} +1 -1
- package/src/assets/web-panel/assets/{Row-5qp3_fNS.js → Row-Cx167nF6.js} +1 -1
- package/src/assets/web-panel/assets/{RssFeed-BCsMvpV4.js → RssFeed-Cj8hwiLP.js} +1 -1
- package/src/assets/web-panel/assets/{Search-Br9nVxOp.js → Search-Dsyrkogu.js} +1 -1
- package/src/assets/web-panel/assets/{Security-BdOUzRfA.js → Security-DfOcWFt-.js} +1 -1
- package/src/assets/web-panel/assets/{Services-Cp9TqzyN.js → Services-CSyv-JgS.js} +1 -1
- package/src/assets/web-panel/assets/{Skeleton-DSdWsUMR.js → Skeleton-B0chhFP5.js} +1 -1
- package/src/assets/web-panel/assets/{Skills-DRczAMTe.js → Skills-B_jrR_AF.js} +1 -1
- package/src/assets/web-panel/assets/{Sla-B6G_Vd8N.js → Sla-krP10aUI.js} +1 -1
- package/src/assets/web-panel/assets/{SpeechSettings-BCcLx5x4.js → SpeechSettings-Cm_Cjvf2.js} +1 -1
- package/src/assets/web-panel/assets/{SyncSettings-BFhwtxCp.js → SyncSettings-Cmb-KoqG.js} +1 -1
- package/src/assets/web-panel/assets/{Tasks-DGRE6VHO.js → Tasks-DUOiwTxY.js} +1 -1
- package/src/assets/web-panel/assets/{Templates-CJkJRFzd.js → Templates-DcEPspsP.js} +1 -1
- package/src/assets/web-panel/assets/{Tenant-CAOv6p00.js → Tenant-Dw93LtrE.js} +1 -1
- package/src/assets/web-panel/assets/{Terminal-CDrwwrKj.js → Terminal-B04i0AIG.js} +1 -1
- package/src/assets/web-panel/assets/{TimelineRenderer-DI0YE2SN.js → TimelineRenderer-C-aAORNK.js} +1 -1
- package/src/assets/web-panel/assets/{Tokens-DmqWTZSG.js → Tokens-W1RBfDKb.js} +1 -1
- package/src/assets/web-panel/assets/{Trigger-CkXkhmjk.js → Trigger-BuuH9sMn.js} +1 -1
- package/src/assets/web-panel/assets/{Trust-U8YJLcoJ.js → Trust-Bma-Vz-f.js} +1 -1
- package/src/assets/web-panel/assets/{UkeySign-BLTozMmr.js → UkeySign-CqWw3_ha.js} +1 -1
- package/src/assets/web-panel/assets/{VideoEditing-DHKyFlZa.js → VideoEditing-6NYmQRUe.js} +1 -1
- package/src/assets/web-panel/assets/{Wallet-DapBxIQt.js → Wallet-CTUuBxsr.js} +1 -1
- package/src/assets/web-panel/assets/{WebAuthn-CkvG3yOr.js → WebAuthn-D8mN5UQU.js} +1 -1
- package/src/assets/web-panel/assets/{WorkflowEditor-cNLsinXP.js → WorkflowEditor-DOB46XMH.js} +1 -1
- package/src/assets/web-panel/assets/{chat-BzgkgfMC.js → chat-BPNlNLwi.js} +1 -1
- package/src/assets/web-panel/assets/{colors-BPpVKQsb.js → colors-D-LNng0Q.js} +1 -1
- package/src/assets/web-panel/assets/{compact-item-zepznuTv.js → compact-item-Vkl3KOAb.js} +1 -1
- package/src/assets/web-panel/assets/{createContext-BRto-SQH.js → createContext-CFsJ9Bmp.js} +1 -1
- package/src/assets/web-panel/assets/{hasIn-CqsmU_n6.js → hasIn-C1v7eiIB.js} +1 -1
- package/src/assets/web-panel/assets/{index-DKa_jSfj.js → index-0oRhV07J.js} +1 -1
- package/src/assets/web-panel/assets/{index-wbvZayBb.js → index-5oK4ICcR.js} +1 -1
- package/src/assets/web-panel/assets/{index-CwkhrUmw.js → index-9JeeBF92.js} +1 -1
- package/src/assets/web-panel/assets/{index-B0Z6rfV-.js → index-BGyhWFpc.js} +1 -1
- package/src/assets/web-panel/assets/{index-DUclk35X.js → index-BH5PxoVq.js} +1 -1
- package/src/assets/web-panel/assets/{index-Z6DBe2RU.js → index-BMcTUbpz.js} +1 -1
- package/src/assets/web-panel/assets/{index-DXkw-nt5.js → index-BMsRfvkp.js} +1 -1
- package/src/assets/web-panel/assets/{index-BeBxP1M6.js → index-BObyCZ2w.js} +1 -1
- package/src/assets/web-panel/assets/{index-D_asIcU7.js → index-BPwv3l6X.js} +1 -1
- package/src/assets/web-panel/assets/{index-BeSzdB7x.js → index-BQr5mmyc.js} +1 -1
- package/src/assets/web-panel/assets/{index-w36TkwyO.js → index-BVHaJNpn.js} +1 -1
- package/src/assets/web-panel/assets/{index-D_-w4KkD.js → index-BefXafSw.js} +1 -1
- package/src/assets/web-panel/assets/{index-DvGttIXQ.js → index-BgvrlrtJ.js} +1 -1
- package/src/assets/web-panel/assets/{index-LVvzNdPa.js → index-BiPmMm38.js} +1 -1
- package/src/assets/web-panel/assets/{index-CdHXVSZ4.js → index-BoZnaD3Q.js} +1 -1
- package/src/assets/web-panel/assets/{index-Q5sAV7wp.js → index-BxJC59QT.js} +1 -1
- package/src/assets/web-panel/assets/{index-BGHd4D8F.js → index-CD8egQCF.js} +1 -1
- package/src/assets/web-panel/assets/index-CLafGdQC.js +1 -0
- package/src/assets/web-panel/assets/{index-JrVhUwyh.js → index-CaJvbmCw.js} +1 -1
- package/src/assets/web-panel/assets/{index-CTk9gY88.js → index-CfVl0Oqt.js} +1 -1
- package/src/assets/web-panel/assets/{index-DJSn3owP.js → index-ChGe005u.js} +1 -1
- package/src/assets/web-panel/assets/{index-DDPmr5Yr.js → index-Cjxxw-1P.js} +1 -1
- package/src/assets/web-panel/assets/{index-BEXKES7V.js → index-CmkppTkH.js} +1 -1
- package/src/assets/web-panel/assets/{index-CmPnDXx4.js → index-DFErisPY.js} +1 -1
- package/src/assets/web-panel/assets/{index-B_l6gfDh.js → index-DVfUt2bK.js} +1 -1
- package/src/assets/web-panel/assets/index-DYHw3Xoi.js +1 -0
- package/src/assets/web-panel/assets/{index-CnezE05k.js → index-DZ16Oxcu.js} +1 -1
- package/src/assets/web-panel/assets/{index-faHHtBKj.js → index-DbmhJVc3.js} +1 -1
- package/src/assets/web-panel/assets/{index-CzoKAiyT.js → index-Dd0OgZmt.js} +3 -3
- package/src/assets/web-panel/assets/{index-B-bNzvdU.js → index-DgYmI2pD.js} +1 -1
- package/src/assets/web-panel/assets/{index-B9_jRD2e.js → index-DmUZGqe2.js} +1 -1
- package/src/assets/web-panel/assets/{index-BuBnM6Kz.js → index-Dq9SDl82.js} +1 -1
- package/src/assets/web-panel/assets/{index-BLwY9y0X.js → index-DuIfomtv.js} +1 -1
- package/src/assets/web-panel/assets/{index-S8fkzbQ_.js → index-MGJzHAw_.js} +1 -1
- package/src/assets/web-panel/assets/{index-Df_CY0We.js → index-PCe8NA3J.js} +1 -1
- package/src/assets/web-panel/assets/{index-DEbAW3Ec.js → index-PiL6D-FC.js} +1 -1
- package/src/assets/web-panel/assets/{index-CBI-7Q3W.js → index-a_H30VZX.js} +1 -1
- package/src/assets/web-panel/assets/{index-Dnvj_XU-.js → index-hBzgHVea.js} +1 -1
- package/src/assets/web-panel/assets/{index-Bz7pG8z3.js → index-uDSUo2y2.js} +1 -1
- package/src/assets/web-panel/assets/{initDefaultProps-BlhbrsQk.js → initDefaultProps-CCYgHcTH.js} +1 -1
- package/src/assets/web-panel/assets/{motion-UZx12NPM.js → motion-4Yr4ZkjE.js} +1 -1
- package/src/assets/web-panel/assets/{move-BTby5W4q.js → move-ZP90E-ji.js} +1 -1
- package/src/assets/web-panel/assets/{mtc-parser-BOOaGiCg.js → mtc-parser-s0N3WyRA.js} +1 -1
- package/src/assets/web-panel/assets/{omit-BVylGzEr.js → omit-BZ6gx9Kf.js} +1 -1
- package/src/assets/web-panel/assets/{pickAttrs-Cp3Nflbr.js → pickAttrs-DxUtFOOQ.js} +1 -1
- package/src/assets/web-panel/assets/{placementArrow-BVXYvwH2.js → placementArrow-Btzjn1hK.js} +1 -1
- package/src/assets/web-panel/assets/{responsiveObserve-C67SbpBN.js → responsiveObserve-DYcoe1XJ.js} +1 -1
- package/src/assets/web-panel/assets/{slide-CnBvM22R.js → slide-BiBewdr4.js} +1 -1
- package/src/assets/web-panel/assets/{statusUtils-T8fy53tf.js → statusUtils-D9vt0dkG.js} +1 -1
- package/src/assets/web-panel/assets/{styleChecker-Bf7i4nlm.js → styleChecker-BXsm_vG0.js} +1 -1
- package/src/assets/web-panel/assets/{useFlexGapSupport-BUKk7jqw.js → useFlexGapSupport-CIG8zET4.js} +1 -1
- package/src/assets/web-panel/assets/{useFs-T5lg6SpD.js → useFs-ChFPF8GI.js} +1 -1
- package/src/assets/web-panel/assets/{usePersonalDataHub-Brvye8Tg.js → usePersonalDataHub-D4CzWJhY.js} +1 -1
- package/src/assets/web-panel/assets/{vnode-CK992ojP.js → vnode-6V5tphk5.js} +1 -1
- package/src/assets/web-panel/assets/{zoom-CcABB_97.js → zoom-B2H_VwfU.js} +1 -1
- package/src/assets/web-panel/index.html +1 -1
- package/src/command-help-index.json +3 -3
- package/src/commands/agent.js +44 -61
- package/src/commands/goal.js +79 -0
- package/src/commands/mcp-tasks.js +206 -0
- package/src/commands/mcp.js +34 -2
- package/src/commands/session-show.js +36 -1
- package/src/data/changelog.json +26 -0
- package/src/harness/jsonl-session-store.js +6 -0
- package/src/harness/mcp-client.js +431 -6
- package/src/harness/session-list-index.js +11 -58
- package/src/host/README.md +43 -0
- package/src/host/project-goal-graph.js +57 -0
- package/src/lib/codex-app-server-adapter.js +20 -0
- package/src/lib/codex-app-server-support.js +2 -2
- package/src/lib/context-memory-kernel/memory-query-control.js +5 -1
- package/src/lib/context-memory-kernel/memory-query-index.js +37 -1
- package/src/lib/context-memory-kernel/message-adapter.js +27 -5
- package/src/lib/context-memory-kernel/provider-context.js +196 -14
- package/src/lib/context-memory-kernel/segmented-memory-port.js +26 -1
- package/src/lib/evolution/agent-evolution-ingress.js +55 -1
- package/src/lib/evolution/skill-candidate-registry.js +3 -1
- package/src/lib/formal-budget-provider-scope.js +29 -7
- package/src/lib/formal-budget-transport.js +36 -5
- package/src/lib/goal-store.js +219 -0
- package/src/lib/graph-kernel/graph-runtime-surfaces.json +30 -0
- package/src/lib/graph-kernel/production-source-evidence.js +3 -3
- package/src/lib/graph-kernel/runtime-surface-manifest.js +46 -9
- package/src/lib/graph-kernel/runtime.js +12 -1
- package/src/lib/mcp-call-ledger-projection.js +1026 -0
- package/src/lib/mcp-call-ledger-store.js +19 -1024
- package/src/lib/mcp-ledger-recovery-admission.js +25 -0
- package/src/lib/mcp-task-delivery-contract.js +190 -0
- package/src/lib/mcp-task-delivery.js +113 -0
- package/src/lib/mcp-task-journal-projection.js +450 -0
- package/src/lib/mcp-task-journal.js +57 -0
- package/src/lib/mcp-task-runtime.js +480 -0
- package/src/lib/mcp-tasks.js +193 -0
- package/src/lib/model-input-diagnostics.js +265 -0
- package/src/lib/model-input-source-mapping.js +343 -0
- package/src/lib/openai-responses.js +32 -9
- package/src/lib/provider-request-admission.js +181 -0
- package/src/lib/public-ide-capability-manifest.js +2 -0
- package/src/lib/scheduler-kernel/graph-authority-adapter.js +140 -15
- package/src/lib/session-generation-authority.js +58 -0
- package/src/lib/session-host-snapshot.js +6 -0
- package/src/lib/session-model-input-diagnostics.js +262 -0
- package/src/lib/session-transcript-history.js +6 -0
- package/src/lib/session-transcript-page.js +7 -1
- package/src/lib/session-transcript-structure.js +38 -0
- package/src/lib/sub-agent-context.js +7 -3
- package/src/repl/agent-repl.js +178 -230
- package/src/runtime/agent-core.js +267 -140
- package/src/runtime/headless-runner.js +57 -69
- package/src/assets/web-panel/assets/index-DruOFzuF.js +0 -1
- package/src/assets/web-panel/assets/index-hhOrZ6HO.js +0 -1
package/src/repl/agent-repl.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createPersistedModelInputObserver } from "../lib/session-model-input-diagnostics.js";
|
|
1
2
|
/**
|
|
2
3
|
* Agentic REPL - Claude Code / Codex style
|
|
3
4
|
*
|
|
@@ -439,9 +440,9 @@ export async function runReplDirectToolWithLedger({
|
|
|
439
440
|
tool,
|
|
440
441
|
isError: Boolean(
|
|
441
442
|
executionFailed ||
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
443
|
+
result?.error ||
|
|
444
|
+
result?.is_error ||
|
|
445
|
+
result?.isError,
|
|
445
446
|
),
|
|
446
447
|
skill: tool === "run_skill" ? args?.skill_name : undefined,
|
|
447
448
|
...extractPluginUsageAttribution(result),
|
|
@@ -531,9 +532,8 @@ async function _fireNotification(message, type = "info", session = null) {
|
|
|
531
532
|
// Fire settings.json observe hooks first (best-effort)
|
|
532
533
|
if (_settingsHooks) {
|
|
533
534
|
try {
|
|
534
|
-
const { runObserveHooks } =
|
|
535
|
-
"../lib/settings-hook-events.js"
|
|
536
|
-
);
|
|
535
|
+
const { runObserveHooks } =
|
|
536
|
+
await import("../lib/settings-hook-events.js");
|
|
537
537
|
await runObserveHooks(
|
|
538
538
|
_settingsHooks,
|
|
539
539
|
"Notification",
|
|
@@ -722,6 +722,16 @@ export async function agentLoop(messages, options) {
|
|
|
722
722
|
);
|
|
723
723
|
}
|
|
724
724
|
: undefined);
|
|
725
|
+
const onModelInputDiagnostic =
|
|
726
|
+
options.persistUsageTelemetry === true && options.sessionId
|
|
727
|
+
? createPersistedModelInputObserver({
|
|
728
|
+
append: (type, data) =>
|
|
729
|
+
persistRuntimeLedger(() =>
|
|
730
|
+
persistBoundary(options.sessionId, type, data),
|
|
731
|
+
),
|
|
732
|
+
observe: options.onModelInputDiagnostic,
|
|
733
|
+
})
|
|
734
|
+
: options.onModelInputDiagnostic;
|
|
725
735
|
const childToolExecs = new Map();
|
|
726
736
|
const onToolCallBoundary =
|
|
727
737
|
options.onToolCallBoundary ||
|
|
@@ -783,6 +793,7 @@ export async function agentLoop(messages, options) {
|
|
|
783
793
|
onUsageSettlement,
|
|
784
794
|
onToolCallBoundary,
|
|
785
795
|
onToolCallSettlement,
|
|
796
|
+
onModelInputDiagnostic,
|
|
786
797
|
onProviderFallback,
|
|
787
798
|
})) {
|
|
788
799
|
if (evolutionIngress !== null) {
|
|
@@ -3137,6 +3148,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
3137
3148
|
startupAdmission,
|
|
3138
3149
|
outputScope,
|
|
3139
3150
|
) {
|
|
3151
|
+
// Keep the user's session-wide recall choice across model switches, direct
|
|
3152
|
+
// judges and resumed turns; canonical per-request planning also needs it.
|
|
3153
|
+
const recallMemory = options.recallMemory !== false;
|
|
3140
3154
|
// The compressor captures this session's ingress and metering callbacks.
|
|
3141
3155
|
// A later REPL instance must not replace another session's authority.
|
|
3142
3156
|
let _compressor = null;
|
|
@@ -3535,9 +3549,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
3535
3549
|
// Initialize prompt compressor (adaptive to model's context window). A
|
|
3536
3550
|
// canonical cutover cannot disable the Kernel writer by toggling the legacy
|
|
3537
3551
|
// compressor feature flag; the compressor remains only its summarizer.
|
|
3538
|
-
const { resolveCliContextMemoryCutover } =
|
|
3539
|
-
"../lib/context-memory-kernel/authority.js"
|
|
3540
|
-
);
|
|
3552
|
+
const { resolveCliContextMemoryCutover } =
|
|
3553
|
+
await import("../lib/context-memory-kernel/authority.js");
|
|
3541
3554
|
const contextMemoryCutover = resolveCliContextMemoryCutover({
|
|
3542
3555
|
env: options.contextMemoryEnv || process.env,
|
|
3543
3556
|
scopeKey: sessionId ? `cli:session:${sessionId}` : "cli:repl",
|
|
@@ -3559,6 +3572,7 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
3559
3572
|
includeLedgerMetadata: true,
|
|
3560
3573
|
call: ({ signal }) =>
|
|
3561
3574
|
chatWithTools([{ role: "user", content: prompt }], {
|
|
3575
|
+
contextMemoryRecall: recallMemory,
|
|
3562
3576
|
...(evolutionIngress === null ? {} : { evolutionIngress }),
|
|
3563
3577
|
provider,
|
|
3564
3578
|
model,
|
|
@@ -3585,9 +3599,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
3585
3599
|
});
|
|
3586
3600
|
if (contextMemoryCutover.canonical) {
|
|
3587
3601
|
const compatibilitySummarizer = _compressor;
|
|
3588
|
-
const { compactLiveMessagesCanonical } =
|
|
3589
|
-
"../lib/context-memory-kernel/live-compaction.js"
|
|
3590
|
-
);
|
|
3602
|
+
const { compactLiveMessagesCanonical } =
|
|
3603
|
+
await import("../lib/context-memory-kernel/live-compaction.js");
|
|
3591
3604
|
_compressor = {
|
|
3592
3605
|
canonicalKernel: true,
|
|
3593
3606
|
maxTokens: compatibilitySummarizer.maxTokens,
|
|
@@ -3645,7 +3658,11 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
3645
3658
|
// Non-critical
|
|
3646
3659
|
}
|
|
3647
3660
|
|
|
3648
|
-
contextEngine = new CLIContextEngineering({
|
|
3661
|
+
contextEngine = new CLIContextEngineering({
|
|
3662
|
+
db,
|
|
3663
|
+
permanentMemory,
|
|
3664
|
+
memoryEnabled: recallMemory,
|
|
3665
|
+
});
|
|
3649
3666
|
|
|
3650
3667
|
// Initialize autonomous agent
|
|
3651
3668
|
const autonomousAgent = new CLIAutonomousAgent();
|
|
@@ -3682,9 +3699,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
3682
3699
|
// MEDIUM/HIGH-risk commands against the session's policy tier
|
|
3683
3700
|
// (strict / trusted / autopilot).
|
|
3684
3701
|
try {
|
|
3685
|
-
const { getApprovalGate } =
|
|
3686
|
-
"../lib/session-core-singletons.js"
|
|
3687
|
-
);
|
|
3702
|
+
const { getApprovalGate } =
|
|
3703
|
+
await import("../lib/session-core-singletons.js");
|
|
3688
3704
|
_approvalGate = await getApprovalGate();
|
|
3689
3705
|
_approvalGate =
|
|
3690
3706
|
_approvalGate?.createSessionScope?.(
|
|
@@ -3970,14 +3986,12 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
3970
3986
|
// project plugins get a process spawned. Reaped in the SessionEnd cleanup +
|
|
3971
3987
|
// a process-exit backstop, so no monitor outlives the session.
|
|
3972
3988
|
try {
|
|
3973
|
-
const { collectPluginMonitors } =
|
|
3974
|
-
"../lib/plugin-runtime/monitors.js"
|
|
3975
|
-
);
|
|
3989
|
+
const { collectPluginMonitors } =
|
|
3990
|
+
await import("../lib/plugin-runtime/monitors.js");
|
|
3976
3991
|
const monitors = collectPluginMonitors({ cwd: process.cwd() });
|
|
3977
3992
|
if (monitors.length > 0) {
|
|
3978
|
-
const { PluginMonitorSupervisor } =
|
|
3979
|
-
"../lib/plugin-monitor-supervisor.js"
|
|
3980
|
-
);
|
|
3993
|
+
const { PluginMonitorSupervisor } =
|
|
3994
|
+
await import("../lib/plugin-monitor-supervisor.js");
|
|
3981
3995
|
_pluginMonitors = new PluginMonitorSupervisor();
|
|
3982
3996
|
const started = _pluginMonitors.start(monitors);
|
|
3983
3997
|
if (started.length > 0) {
|
|
@@ -4009,9 +4023,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
4009
4023
|
// Apply trusted plugins' default env vars (Phase 3.3o) — only for env keys the
|
|
4010
4024
|
// user/system didn't already set; restored at SessionEnd.
|
|
4011
4025
|
try {
|
|
4012
|
-
const { applyPluginSettingsEnv } =
|
|
4013
|
-
"../lib/plugin-runtime/settings.js"
|
|
4014
|
-
);
|
|
4026
|
+
const { applyPluginSettingsEnv } =
|
|
4027
|
+
await import("../lib/plugin-runtime/settings.js");
|
|
4015
4028
|
const res = applyPluginSettingsEnv({ cwd: process.cwd() });
|
|
4016
4029
|
_pluginSettingsRestore = res.restore;
|
|
4017
4030
|
if (res.added.length > 0) {
|
|
@@ -4082,9 +4095,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
4082
4095
|
let _sessionMgr = null;
|
|
4083
4096
|
let _sessionHandle = null;
|
|
4084
4097
|
try {
|
|
4085
|
-
const { getSessionManager } =
|
|
4086
|
-
"../lib/session-core-singletons.js"
|
|
4087
|
-
);
|
|
4098
|
+
const { getSessionManager } =
|
|
4099
|
+
await import("../lib/session-core-singletons.js");
|
|
4088
4100
|
// Keep durable lifecycle sidecars on the same launch-authoritative Claude
|
|
4089
4101
|
// project bucket as the JSONL transcript. Project settings may not switch
|
|
4090
4102
|
// this map/path after the REPL has admitted its launch environment.
|
|
@@ -4133,9 +4145,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
4133
4145
|
error.code = "CC_REMOTE_APPROVAL_GATE_UNAVAILABLE";
|
|
4134
4146
|
throw error;
|
|
4135
4147
|
}
|
|
4136
|
-
const { startHeadlessRemoteApproval } =
|
|
4137
|
-
"../lib/remote-approval-bridge.js"
|
|
4138
|
-
);
|
|
4148
|
+
const { startHeadlessRemoteApproval } =
|
|
4149
|
+
await import("../lib/remote-approval-bridge.js");
|
|
4139
4150
|
const started = await startHeadlessRemoteApproval({
|
|
4140
4151
|
agentSessionId:
|
|
4141
4152
|
sessionId || `repl-${process.pid}-${Date.now().toString(36)}`,
|
|
@@ -4398,9 +4409,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
4398
4409
|
// project memory is off or no hook is registered.
|
|
4399
4410
|
if (_settingsHooks && _loadedReplInstructions) {
|
|
4400
4411
|
try {
|
|
4401
|
-
const { runInstructionsLoadedHooks } =
|
|
4402
|
-
"../lib/settings-hook-events.js"
|
|
4403
|
-
);
|
|
4412
|
+
const { runInstructionsLoadedHooks } =
|
|
4413
|
+
await import("../lib/settings-hook-events.js");
|
|
4404
4414
|
const ctx = (
|
|
4405
4415
|
await runInstructionsLoadedHooks(_settingsHooks, {
|
|
4406
4416
|
files: _loadedReplInstructions.files,
|
|
@@ -4417,9 +4427,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
4417
4427
|
// settings.json SessionStart hooks → inject session context (observe-only).
|
|
4418
4428
|
if (_settingsHooks) {
|
|
4419
4429
|
try {
|
|
4420
|
-
const { runSessionStartHooks } =
|
|
4421
|
-
"../lib/settings-hook-events.js"
|
|
4422
|
-
);
|
|
4430
|
+
const { runSessionStartHooks } =
|
|
4431
|
+
await import("../lib/settings-hook-events.js");
|
|
4423
4432
|
const ctx = (
|
|
4424
4433
|
await runSessionStartHooks(_settingsHooks, {
|
|
4425
4434
|
source: "startup",
|
|
@@ -4487,18 +4496,15 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
4487
4496
|
};
|
|
4488
4497
|
if (options.bundlePath) {
|
|
4489
4498
|
try {
|
|
4490
|
-
const { loadBundle } =
|
|
4491
|
-
"@chainlesschain/session-core/agent-bundle-loader"
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
"@chainlesschain/session-core/agent-bundle-resolver"
|
|
4495
|
-
);
|
|
4499
|
+
const { loadBundle } =
|
|
4500
|
+
await import("@chainlesschain/session-core/agent-bundle-loader");
|
|
4501
|
+
const { parseUserMdSeed, resolveBundle } =
|
|
4502
|
+
await import("@chainlesschain/session-core/agent-bundle-resolver");
|
|
4496
4503
|
const bundle = loadBundle(options.bundlePath);
|
|
4497
4504
|
if (contextMemoryCutover.canonical) {
|
|
4498
4505
|
_bundleResolved = resolveBundle(bundle);
|
|
4499
|
-
const { createCliCanonicalMemoryService } =
|
|
4500
|
-
"../lib/context-memory-kernel/memory-service.js"
|
|
4501
|
-
);
|
|
4506
|
+
const { createCliCanonicalMemoryService } =
|
|
4507
|
+
await import("../lib/context-memory-kernel/memory-service.js");
|
|
4502
4508
|
const memoryService = createCliCanonicalMemoryService({
|
|
4503
4509
|
env: options.contextMemoryEnv || process.env,
|
|
4504
4510
|
});
|
|
@@ -4540,9 +4546,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
4540
4546
|
}
|
|
4541
4547
|
_bundleResolved.seedResult = { seeded, skipped };
|
|
4542
4548
|
} else {
|
|
4543
|
-
const { getMemoryStore } =
|
|
4544
|
-
"../lib/session-core-singletons.js"
|
|
4545
|
-
);
|
|
4549
|
+
const { getMemoryStore } =
|
|
4550
|
+
await import("../lib/session-core-singletons.js");
|
|
4546
4551
|
_bundleResolved = resolveBundle(bundle, {
|
|
4547
4552
|
memoryStore: getMemoryStore(),
|
|
4548
4553
|
seedOptions: {
|
|
@@ -4800,9 +4805,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
4800
4805
|
// when there are no extra roots. Best-effort.
|
|
4801
4806
|
if (additionalDirectories.length > 0) {
|
|
4802
4807
|
try {
|
|
4803
|
-
const { workspaceRootDirs, notifyMcpRootsChanged } =
|
|
4804
|
-
"./add-dir.js"
|
|
4805
|
-
);
|
|
4808
|
+
const { workspaceRootDirs, notifyMcpRootsChanged } =
|
|
4809
|
+
await import("./add-dir.js");
|
|
4806
4810
|
notifyMcpRootsChanged(
|
|
4807
4811
|
[_adhocMcp?.mcpClient, _bundleMcpClient],
|
|
4808
4812
|
workspaceRootDirs(process.cwd(), additionalDirectories),
|
|
@@ -4853,11 +4857,10 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
4853
4857
|
// Phase G #5 — inject top-K memory recall into system prompt for new sessions
|
|
4854
4858
|
// Skip on resume (existing context already reflects prior work) and when
|
|
4855
4859
|
// --no-recall-memory is passed.
|
|
4856
|
-
if (!options.sessionId &&
|
|
4860
|
+
if (!options.sessionId && recallMemory && !contextMemoryCutover.canonical) {
|
|
4857
4861
|
try {
|
|
4858
|
-
const { buildMemoryInjection } =
|
|
4859
|
-
"../lib/memory-injection.js"
|
|
4860
|
-
);
|
|
4862
|
+
const { buildMemoryInjection } =
|
|
4863
|
+
await import("../lib/memory-injection.js");
|
|
4861
4864
|
const injection = buildMemoryInjection({
|
|
4862
4865
|
agentId: options.agentId || null,
|
|
4863
4866
|
query: options.recallQuery || "",
|
|
@@ -4959,9 +4962,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
4959
4962
|
// Observe-only, best-effort — never blocks entering the REPL.
|
|
4960
4963
|
if (_settingsHooks && _startupResumeCommitted) {
|
|
4961
4964
|
try {
|
|
4962
|
-
const { runObserveHooks } =
|
|
4963
|
-
"../lib/settings-hook-events.js"
|
|
4964
|
-
);
|
|
4965
|
+
const { runObserveHooks } =
|
|
4966
|
+
await import("../lib/settings-hook-events.js");
|
|
4965
4967
|
await runObserveHooks(
|
|
4966
4968
|
_settingsHooks,
|
|
4967
4969
|
"SessionResume",
|
|
@@ -4999,9 +5001,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
4999
5001
|
// transcript snapshot and ZERO tools. Compact call/outcome metadata shares
|
|
5000
5002
|
// the session hash chain, while advice text itself is never persisted.
|
|
5001
5003
|
try {
|
|
5002
|
-
const { createConfiguredAdvisorRuntime } =
|
|
5003
|
-
"../lib/advisor-runtime.js"
|
|
5004
|
-
);
|
|
5004
|
+
const { createConfiguredAdvisorRuntime } =
|
|
5005
|
+
await import("../lib/advisor-runtime.js");
|
|
5005
5006
|
const advisorOverrides = {};
|
|
5006
5007
|
if (options.advisorEnabled !== undefined) {
|
|
5007
5008
|
advisorOverrides.enabled = options.advisorEnabled === true;
|
|
@@ -5370,9 +5371,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
5370
5371
|
return;
|
|
5371
5372
|
}
|
|
5372
5373
|
try {
|
|
5373
|
-
const { defaultOpenBrowser } =
|
|
5374
|
-
"../lib/mcp-oauth.js"
|
|
5375
|
-
);
|
|
5374
|
+
const { defaultOpenBrowser } =
|
|
5375
|
+
await import("../lib/mcp-oauth.js");
|
|
5376
5376
|
const opened = defaultOpenBrowser(request.url);
|
|
5377
5377
|
resolve(opened ? { action: "accept" } : { action: "cancel" });
|
|
5378
5378
|
} catch {
|
|
@@ -5415,9 +5415,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
5415
5415
|
let _channels = null;
|
|
5416
5416
|
if (options.channels) {
|
|
5417
5417
|
try {
|
|
5418
|
-
const { startChannels, formatChannelEvent } =
|
|
5419
|
-
"../lib/channels/channel-manager.js"
|
|
5420
|
-
);
|
|
5418
|
+
const { startChannels, formatChannelEvent } =
|
|
5419
|
+
await import("../lib/channels/channel-manager.js");
|
|
5421
5420
|
let channelsConfig = {};
|
|
5422
5421
|
try {
|
|
5423
5422
|
channelsConfig =
|
|
@@ -5710,9 +5709,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
5710
5709
|
const _notifyVersionSkew = async () => {
|
|
5711
5710
|
if (_versionSkewNotified) return;
|
|
5712
5711
|
try {
|
|
5713
|
-
const { detectVersionSkew, versionSkewMessage } =
|
|
5714
|
-
"../lib/version-skew.js"
|
|
5715
|
-
);
|
|
5712
|
+
const { detectVersionSkew, versionSkewMessage } =
|
|
5713
|
+
await import("../lib/version-skew.js");
|
|
5716
5714
|
const skew = detectVersionSkew();
|
|
5717
5715
|
if (skew) {
|
|
5718
5716
|
_versionSkewNotified = true;
|
|
@@ -5887,9 +5885,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
5887
5885
|
// to the model verbatim — the same fall-through an unmatched slash line
|
|
5888
5886
|
// already takes. /exit and /quit stay live so the session can be closed.
|
|
5889
5887
|
// Predicate + sentinel are pure (lib/slash-dispatch.js, unit-tested).
|
|
5890
|
-
const { slashDispatchBypassed, slashBypassSentinel } =
|
|
5891
|
-
"../lib/slash-dispatch.js"
|
|
5892
|
-
);
|
|
5888
|
+
const { slashDispatchBypassed, slashBypassSentinel } =
|
|
5889
|
+
await import("../lib/slash-dispatch.js");
|
|
5893
5890
|
const _slashBypassed = slashDispatchBypassed(
|
|
5894
5891
|
rawLine,
|
|
5895
5892
|
_slashCommandsDisabled,
|
|
@@ -5918,9 +5915,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
5918
5915
|
// no LLM round-trip — and fold the output into the conversation context.
|
|
5919
5916
|
if (trimmed.startsWith("!") && trimmed.slice(1).trim()) {
|
|
5920
5917
|
try {
|
|
5921
|
-
const { runBangCommand, shouldRespondToBashCommands } =
|
|
5922
|
-
"../lib/repl-bang-memorize.js"
|
|
5923
|
-
);
|
|
5918
|
+
const { runBangCommand, shouldRespondToBashCommands } =
|
|
5919
|
+
await import("../lib/repl-bang-memorize.js");
|
|
5924
5920
|
const res = runBangCommand(trimmed, { cwd: process.cwd() });
|
|
5925
5921
|
logger.log(chalk.gray(`$ ${res.cmd}`));
|
|
5926
5922
|
if (res.stdout)
|
|
@@ -5957,9 +5953,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
5957
5953
|
// cc.md (auto-loaded next session) and keep it active in this one.
|
|
5958
5954
|
if (trimmed.startsWith("#") && trimmed.slice(1).trim()) {
|
|
5959
5955
|
try {
|
|
5960
|
-
const { appendMemoryNote } =
|
|
5961
|
-
"../lib/repl-bang-memorize.js"
|
|
5962
|
-
);
|
|
5956
|
+
const { appendMemoryNote } =
|
|
5957
|
+
await import("../lib/repl-bang-memorize.js");
|
|
5963
5958
|
const res = appendMemoryNote(trimmed, { cwd: process.cwd() });
|
|
5964
5959
|
messages.push({
|
|
5965
5960
|
role: "system",
|
|
@@ -6344,9 +6339,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
6344
6339
|
if (trimmed === "/init" || trimmed.startsWith("/init ")) {
|
|
6345
6340
|
const force = /(^|\s)(--force|-f)(\s|$)/.test(trimmed);
|
|
6346
6341
|
try {
|
|
6347
|
-
const { inventoryProject, renderMemoryFile } =
|
|
6348
|
-
"../lib/project-inventory.js"
|
|
6349
|
-
);
|
|
6342
|
+
const { inventoryProject, renderMemoryFile } =
|
|
6343
|
+
await import("../lib/project-inventory.js");
|
|
6350
6344
|
const initCwd = process.cwd();
|
|
6351
6345
|
const target = path.join(initCwd, "cc.md");
|
|
6352
6346
|
if (fs.existsSync(target) && !force) {
|
|
@@ -6390,12 +6384,10 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
6390
6384
|
try {
|
|
6391
6385
|
const { parseAgentsCommand, formatAgentsList, formatAgentDetail } =
|
|
6392
6386
|
await import("./agents-status.js");
|
|
6393
|
-
const { discoverAgents, getAgent, scaffoldAgent } =
|
|
6394
|
-
"../lib/agents.js"
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
"../lib/sub-agent-profiles.js"
|
|
6398
|
-
);
|
|
6387
|
+
const { discoverAgents, getAgent, scaffoldAgent } =
|
|
6388
|
+
await import("../lib/agents.js");
|
|
6389
|
+
const { listSubAgentProfiles } =
|
|
6390
|
+
await import("../lib/sub-agent-profiles.js");
|
|
6399
6391
|
const cmd = parseAgentsCommand(trimmed);
|
|
6400
6392
|
if (cmd.action === "help") {
|
|
6401
6393
|
logger.log(
|
|
@@ -6451,9 +6443,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
6451
6443
|
|
|
6452
6444
|
if (trimmed === "/sub-agents" || trimmed === "/subagents") {
|
|
6453
6445
|
try {
|
|
6454
|
-
const { SubAgentRegistry } =
|
|
6455
|
-
"../lib/sub-agent-registry.js"
|
|
6456
|
-
);
|
|
6446
|
+
const { SubAgentRegistry } =
|
|
6447
|
+
await import("../lib/sub-agent-registry.js");
|
|
6457
6448
|
const registry = SubAgentRegistry.getInstance();
|
|
6458
6449
|
const active = registry.getActive();
|
|
6459
6450
|
const history = registry.getHistory();
|
|
@@ -6505,9 +6496,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
6505
6496
|
// user could silently switch to a retired id and only learn of it when
|
|
6506
6497
|
// the next turn fails with an opaque "model not found".
|
|
6507
6498
|
try {
|
|
6508
|
-
const { maybeWarnDeprecatedModel } =
|
|
6509
|
-
"../lib/model-deprecation.js"
|
|
6510
|
-
);
|
|
6499
|
+
const { maybeWarnDeprecatedModel } =
|
|
6500
|
+
await import("../lib/model-deprecation.js");
|
|
6511
6501
|
maybeWarnDeprecatedModel({ model });
|
|
6512
6502
|
} catch {
|
|
6513
6503
|
// deprecation notice is best-effort
|
|
@@ -6602,9 +6592,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
6602
6592
|
// One-shot advice is queued as an ephemeral prepareCall suffix, requiring
|
|
6603
6593
|
// the main agent to validate it locally on its next model/tool turn.
|
|
6604
6594
|
{
|
|
6605
|
-
const { parseAdvisorCommand, executeAdvisorCommand } =
|
|
6606
|
-
"./advisor-command.js"
|
|
6607
|
-
);
|
|
6595
|
+
const { parseAdvisorCommand, executeAdvisorCommand } =
|
|
6596
|
+
await import("./advisor-command.js");
|
|
6608
6597
|
const advisorCommand = parseAdvisorCommand(trimmed);
|
|
6609
6598
|
if (advisorCommand) {
|
|
6610
6599
|
const result = await executeAdvisorCommand(advisorCommand, {
|
|
@@ -6643,9 +6632,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
6643
6632
|
// Stash the conversation first so `/rewind clear` can restore it
|
|
6644
6633
|
// (Claude-Code 2.1.191). A no-op /clear (nothing to stash) keeps any
|
|
6645
6634
|
// existing restorable snapshot.
|
|
6646
|
-
const { snapshotClearedConversation } =
|
|
6647
|
-
"../lib/repl-rewind.js"
|
|
6648
|
-
);
|
|
6635
|
+
const { snapshotClearedConversation } =
|
|
6636
|
+
await import("../lib/repl-rewind.js");
|
|
6649
6637
|
const snap = snapshotClearedConversation(messages, _checkpointMarks);
|
|
6650
6638
|
if (snap) _clearedConversation = snap;
|
|
6651
6639
|
messages.length = 1; // Keep system prompt
|
|
@@ -6666,9 +6654,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
6666
6654
|
) {
|
|
6667
6655
|
try {
|
|
6668
6656
|
const arg = trimmed.slice("/terminal-setup".length).trim();
|
|
6669
|
-
const { runTerminalSetup } =
|
|
6670
|
-
"../commands/terminal-setup.js"
|
|
6671
|
-
);
|
|
6657
|
+
const { runTerminalSetup } =
|
|
6658
|
+
await import("../commands/terminal-setup.js");
|
|
6672
6659
|
const res = runTerminalSetup({ apply: arg === "--apply" });
|
|
6673
6660
|
for (const l of res.lines) logger.log(l);
|
|
6674
6661
|
} catch (err) {
|
|
@@ -6972,9 +6959,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
6972
6959
|
if (trimmed === "/output-style" || trimmed.startsWith("/output-style ")) {
|
|
6973
6960
|
const arg = trimmed.slice("/output-style".length).trim();
|
|
6974
6961
|
try {
|
|
6975
|
-
const { discoverOutputStyles, getOutputStyle } =
|
|
6976
|
-
"../lib/output-styles.js"
|
|
6977
|
-
);
|
|
6962
|
+
const { discoverOutputStyles, getOutputStyle } =
|
|
6963
|
+
await import("../lib/output-styles.js");
|
|
6978
6964
|
if (!arg) {
|
|
6979
6965
|
logger.log(chalk.bold("Output styles:"));
|
|
6980
6966
|
for (const s of discoverOutputStyles(process.cwd())) {
|
|
@@ -7042,15 +7028,13 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
7042
7028
|
// (byte-unchanged) without a registered CwdChanged hook.
|
|
7043
7029
|
if (_settingsHooks && oldCwd !== newCwd) {
|
|
7044
7030
|
try {
|
|
7045
|
-
const { runCwdChangedHooks, dispatchAsyncHooks } =
|
|
7046
|
-
"../lib/settings-hook-events.js"
|
|
7047
|
-
);
|
|
7031
|
+
const { runCwdChangedHooks, dispatchAsyncHooks } =
|
|
7032
|
+
await import("../lib/settings-hook-events.js");
|
|
7048
7033
|
const payload = { oldCwd, newCwd, sessionId };
|
|
7049
7034
|
await runCwdChangedHooks(_settingsHooks, payload);
|
|
7050
7035
|
if (!_asyncHookSupervisor) {
|
|
7051
|
-
const { AsyncHookSupervisor } =
|
|
7052
|
-
"../lib/async-hook-supervisor.js"
|
|
7053
|
-
);
|
|
7036
|
+
const { AsyncHookSupervisor } =
|
|
7037
|
+
await import("../lib/async-hook-supervisor.js");
|
|
7054
7038
|
_asyncHookSupervisor = new AsyncHookSupervisor({
|
|
7055
7039
|
persistStats: true,
|
|
7056
7040
|
});
|
|
@@ -7110,9 +7094,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
7110
7094
|
(parsed.command === "turn" || parsed.command === "branch")
|
|
7111
7095
|
) {
|
|
7112
7096
|
try {
|
|
7113
|
-
const { loadTurnBindingLog } =
|
|
7114
|
-
"../lib/turn-binding-store.js"
|
|
7115
|
-
);
|
|
7097
|
+
const { loadTurnBindingLog } =
|
|
7098
|
+
await import("../lib/turn-binding-store.js");
|
|
7116
7099
|
_persistedBinding = loadTurnBindingLog(sessionId);
|
|
7117
7100
|
} catch {
|
|
7118
7101
|
/* marks-only fallback */
|
|
@@ -7171,9 +7154,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
7171
7154
|
logger.error("Could not plan a branch from that turn.");
|
|
7172
7155
|
} else {
|
|
7173
7156
|
try {
|
|
7174
|
-
const { createBranchSession } =
|
|
7175
|
-
"../harness/jsonl-session-store.js"
|
|
7176
|
-
);
|
|
7157
|
+
const { createBranchSession } =
|
|
7158
|
+
await import("../harness/jsonl-session-store.js");
|
|
7177
7159
|
const res = createBranchSession({
|
|
7178
7160
|
branchSessionId: plan.branchSessionId,
|
|
7179
7161
|
parentSessionId: sessionId,
|
|
@@ -7307,9 +7289,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
7307
7289
|
.toLowerCase();
|
|
7308
7290
|
if (ans === "" || ans === "y" || ans === "yes") {
|
|
7309
7291
|
try {
|
|
7310
|
-
const { rewindTo } =
|
|
7311
|
-
"../lib/checkpoint-store.js"
|
|
7312
|
-
);
|
|
7292
|
+
const { rewindTo } =
|
|
7293
|
+
await import("../lib/checkpoint-store.js");
|
|
7313
7294
|
const r = rewindTo(process.cwd(), cp.id, {
|
|
7314
7295
|
session: sessionId,
|
|
7315
7296
|
});
|
|
@@ -7359,9 +7340,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
7359
7340
|
// window. Reuses the same categorizer + estimator as the archived view.
|
|
7360
7341
|
try {
|
|
7361
7342
|
const { categorizeContext } = await import("../commands/context.js");
|
|
7362
|
-
const { estimateTokens } =
|
|
7363
|
-
"../harness/prompt-compressor.js"
|
|
7364
|
-
);
|
|
7343
|
+
const { estimateTokens } =
|
|
7344
|
+
await import("../harness/prompt-compressor.js");
|
|
7365
7345
|
const { buckets, counts, total } = categorizeContext(
|
|
7366
7346
|
messages,
|
|
7367
7347
|
estimateTokens,
|
|
@@ -7394,9 +7374,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
7394
7374
|
: ""
|
|
7395
7375
|
}`,
|
|
7396
7376
|
);
|
|
7397
|
-
const { default: sourceLedger } =
|
|
7398
|
-
"../lib/context-source-ledger.js"
|
|
7399
|
-
);
|
|
7377
|
+
const { default: sourceLedger } =
|
|
7378
|
+
await import("../lib/context-source-ledger.js");
|
|
7400
7379
|
const attribution = sourceLedger.getTokenReport({ sessionId });
|
|
7401
7380
|
if (attribution.entries) {
|
|
7402
7381
|
logger.log(
|
|
@@ -7417,9 +7396,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
7417
7396
|
// `messages`, so it's invisible to the role buckets above. Show the
|
|
7418
7397
|
// per-server schema cost + tool-search state + optimization advice.
|
|
7419
7398
|
if (_adhocMcp?.extraToolDefinitions?.length) {
|
|
7420
|
-
const { describeMcpToolContext } =
|
|
7421
|
-
"../runtime/mcp-tool-search.js"
|
|
7422
|
-
);
|
|
7399
|
+
const { describeMcpToolContext } =
|
|
7400
|
+
await import("../runtime/mcp-tool-search.js");
|
|
7423
7401
|
const info = describeMcpToolContext(_adhocMcp, {
|
|
7424
7402
|
estimate: estimateTokens,
|
|
7425
7403
|
model,
|
|
@@ -7893,19 +7871,16 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
7893
7871
|
if (trimmed === "/reload-plugins") {
|
|
7894
7872
|
try {
|
|
7895
7873
|
const cwd = process.cwd();
|
|
7896
|
-
const { reloadPluginRuntime } =
|
|
7897
|
-
"../lib/plugin-runtime/reload.js"
|
|
7898
|
-
);
|
|
7874
|
+
const { reloadPluginRuntime } =
|
|
7875
|
+
await import("../lib/plugin-runtime/reload.js");
|
|
7899
7876
|
const sum = reloadPluginRuntime({ cwd });
|
|
7900
7877
|
|
|
7901
7878
|
// Re-merge plugin hooks onto the user's settings hooks (live session).
|
|
7902
7879
|
try {
|
|
7903
|
-
const { loadHooks, attachAuthorityErrors } =
|
|
7904
|
-
"../lib/settings-hooks.cjs"
|
|
7905
|
-
|
|
7906
|
-
|
|
7907
|
-
"../lib/plugin-runtime/hooks.js"
|
|
7908
|
-
);
|
|
7880
|
+
const { loadHooks, attachAuthorityErrors } =
|
|
7881
|
+
await import("../lib/settings-hooks.cjs");
|
|
7882
|
+
const { mergePluginHooks } =
|
|
7883
|
+
await import("../lib/plugin-runtime/hooks.js");
|
|
7909
7884
|
const loaded = loadHooks({ cwd });
|
|
7910
7885
|
const merged = mergePluginHooks(
|
|
7911
7886
|
attachAuthorityErrors(loaded.hooks, loaded.authorityErrors),
|
|
@@ -7934,9 +7909,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
7934
7909
|
// react (e.g. re-audit the newly-trusted config). Best-effort.
|
|
7935
7910
|
if (_settingsHooks) {
|
|
7936
7911
|
try {
|
|
7937
|
-
const { runObserveHooks, dispatchAsyncHooks } =
|
|
7938
|
-
"../lib/settings-hook-events.js"
|
|
7939
|
-
);
|
|
7912
|
+
const { runObserveHooks, dispatchAsyncHooks } =
|
|
7913
|
+
await import("../lib/settings-hook-events.js");
|
|
7940
7914
|
const payload = {
|
|
7941
7915
|
session_id: sessionId || null,
|
|
7942
7916
|
source: "reload-plugins",
|
|
@@ -7945,9 +7919,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
7945
7919
|
cwd,
|
|
7946
7920
|
});
|
|
7947
7921
|
if (!_asyncHookSupervisor) {
|
|
7948
|
-
const { AsyncHookSupervisor } =
|
|
7949
|
-
"../lib/async-hook-supervisor.js"
|
|
7950
|
-
);
|
|
7922
|
+
const { AsyncHookSupervisor } =
|
|
7923
|
+
await import("../lib/async-hook-supervisor.js");
|
|
7951
7924
|
_asyncHookSupervisor = new AsyncHookSupervisor({
|
|
7952
7925
|
persistStats: true,
|
|
7953
7926
|
});
|
|
@@ -7963,18 +7936,16 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
7963
7936
|
|
|
7964
7937
|
// Restart background monitors with the fresh, trust-gated set.
|
|
7965
7938
|
try {
|
|
7966
|
-
const { collectPluginMonitors } =
|
|
7967
|
-
"../lib/plugin-runtime/monitors.js"
|
|
7968
|
-
);
|
|
7939
|
+
const { collectPluginMonitors } =
|
|
7940
|
+
await import("../lib/plugin-runtime/monitors.js");
|
|
7969
7941
|
if (_pluginMonitors) {
|
|
7970
7942
|
_pluginMonitors.stopAll();
|
|
7971
7943
|
_pluginMonitors = null;
|
|
7972
7944
|
}
|
|
7973
7945
|
const monitors = collectPluginMonitors({ cwd });
|
|
7974
7946
|
if (monitors.length > 0) {
|
|
7975
|
-
const { PluginMonitorSupervisor } =
|
|
7976
|
-
"../lib/plugin-monitor-supervisor.js"
|
|
7977
|
-
);
|
|
7947
|
+
const { PluginMonitorSupervisor } =
|
|
7948
|
+
await import("../lib/plugin-monitor-supervisor.js");
|
|
7978
7949
|
_pluginMonitors = new PluginMonitorSupervisor();
|
|
7979
7950
|
_pluginMonitors.start(monitors);
|
|
7980
7951
|
}
|
|
@@ -7984,9 +7955,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
7984
7955
|
|
|
7985
7956
|
// Re-apply legacy plugin bin PATH; strict bins remain direct-only.
|
|
7986
7957
|
try {
|
|
7987
|
-
const { applyPluginBinPath } =
|
|
7988
|
-
"../lib/plugin-runtime/bin.js"
|
|
7989
|
-
);
|
|
7958
|
+
const { applyPluginBinPath } =
|
|
7959
|
+
await import("../lib/plugin-runtime/bin.js");
|
|
7990
7960
|
if (_pluginBinRestore) _pluginBinRestore();
|
|
7991
7961
|
const res = applyPluginBinPath({ cwd });
|
|
7992
7962
|
_pluginBinRestore = res.restore;
|
|
@@ -7996,9 +7966,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
7996
7966
|
|
|
7997
7967
|
// Re-apply plugin default env vars (a newly-trusted plugin's settings).
|
|
7998
7968
|
try {
|
|
7999
|
-
const { applyPluginSettingsEnv } =
|
|
8000
|
-
"../lib/plugin-runtime/settings.js"
|
|
8001
|
-
);
|
|
7969
|
+
const { applyPluginSettingsEnv } =
|
|
7970
|
+
await import("../lib/plugin-runtime/settings.js");
|
|
8002
7971
|
if (_pluginSettingsRestore) _pluginSettingsRestore();
|
|
8003
7972
|
const res = applyPluginSettingsEnv({ cwd });
|
|
8004
7973
|
_pluginSettingsRestore = res.restore;
|
|
@@ -8031,9 +8000,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
8031
8000
|
// cwd so it follows `/cd`, using this session's provider/model.
|
|
8032
8001
|
if (trimmed === "/review" || trimmed.startsWith("/review ")) {
|
|
8033
8002
|
const rest = trimmed.slice("/review".length).trim();
|
|
8034
|
-
const { parseReviewReplArgs, describeReviewArgs } =
|
|
8035
|
-
"./review-args.js"
|
|
8036
|
-
);
|
|
8003
|
+
const { parseReviewReplArgs, describeReviewArgs } =
|
|
8004
|
+
await import("./review-args.js");
|
|
8037
8005
|
const { opts: reviewOpts, errors } = parseReviewReplArgs(rest);
|
|
8038
8006
|
if (errors.length) {
|
|
8039
8007
|
for (const e of errors) logger.error(chalk.red(`/review: ${e}`));
|
|
@@ -8244,9 +8212,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
8244
8212
|
logger.log("");
|
|
8245
8213
|
} else if (subCmd === "debate" && coworkInput) {
|
|
8246
8214
|
try {
|
|
8247
|
-
const { startDebate } =
|
|
8248
|
-
"../lib/cowork/debate-review-cli.js"
|
|
8249
|
-
);
|
|
8215
|
+
const { startDebate } =
|
|
8216
|
+
await import("../lib/cowork/debate-review-cli.js");
|
|
8250
8217
|
let code = coworkInput;
|
|
8251
8218
|
let targetLabel = coworkInput;
|
|
8252
8219
|
const resolved = path.resolve(coworkInput);
|
|
@@ -8296,9 +8263,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
8296
8263
|
}
|
|
8297
8264
|
} else if (subCmd === "compare" && coworkInput) {
|
|
8298
8265
|
try {
|
|
8299
|
-
const { compare } =
|
|
8300
|
-
"../lib/cowork/ab-comparator-cli.js"
|
|
8301
|
-
);
|
|
8266
|
+
const { compare } =
|
|
8267
|
+
await import("../lib/cowork/ab-comparator-cli.js");
|
|
8302
8268
|
process.stdout.write(chalk.gray("\n Generating variants...\n"));
|
|
8303
8269
|
const result = await compare({
|
|
8304
8270
|
prompt: coworkInput,
|
|
@@ -8330,9 +8296,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
8330
8296
|
}
|
|
8331
8297
|
} else if (subCmd === "graph" && coworkInput) {
|
|
8332
8298
|
try {
|
|
8333
|
-
const { buildKnowledgeGraph } =
|
|
8334
|
-
"../lib/cowork/code-knowledge-graph-cli.js"
|
|
8335
|
-
);
|
|
8299
|
+
const { buildKnowledgeGraph } =
|
|
8300
|
+
await import("../lib/cowork/code-knowledge-graph-cli.js");
|
|
8336
8301
|
process.stdout.write(chalk.gray("\n Analyzing code graph...\n"));
|
|
8337
8302
|
const result = await buildKnowledgeGraph({
|
|
8338
8303
|
targetPath: path.resolve(coworkInput),
|
|
@@ -8369,9 +8334,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
8369
8334
|
}
|
|
8370
8335
|
} else if (subCmd === "decision" && coworkInput) {
|
|
8371
8336
|
try {
|
|
8372
|
-
const { extractDecisions } =
|
|
8373
|
-
"../lib/cowork/decision-kb-cli.js"
|
|
8374
|
-
);
|
|
8337
|
+
const { extractDecisions } =
|
|
8338
|
+
await import("../lib/cowork/decision-kb-cli.js");
|
|
8375
8339
|
process.stdout.write(chalk.gray("\n Analyzing decisions...\n"));
|
|
8376
8340
|
const result = await extractDecisions({
|
|
8377
8341
|
targetPath: path.resolve(coworkInput),
|
|
@@ -8637,9 +8601,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
8637
8601
|
{ messages, signal: _turnAbort?.signal || null },
|
|
8638
8602
|
);
|
|
8639
8603
|
if (result.ok) {
|
|
8640
|
-
const { renderAdvisorAdvice } =
|
|
8641
|
-
"./advisor-command.js"
|
|
8642
|
-
);
|
|
8604
|
+
const { renderAdvisorAdvice } =
|
|
8605
|
+
await import("./advisor-command.js");
|
|
8643
8606
|
logger.log(renderAdvisorAdvice(result));
|
|
8644
8607
|
} else if (result.effect !== "disabled") {
|
|
8645
8608
|
logger.warn(result.error);
|
|
@@ -8741,12 +8704,10 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
8741
8704
|
const planRequest =
|
|
8742
8705
|
subCmd.slice(11).trim() || "Help me with the current task";
|
|
8743
8706
|
try {
|
|
8744
|
-
const { CLIInteractivePlanner } =
|
|
8745
|
-
"../lib/interactive-planner.js"
|
|
8746
|
-
|
|
8747
|
-
|
|
8748
|
-
"../lib/interaction-adapter.js"
|
|
8749
|
-
);
|
|
8707
|
+
const { CLIInteractivePlanner } =
|
|
8708
|
+
await import("../lib/interactive-planner.js");
|
|
8709
|
+
const { TerminalInteractionAdapter } =
|
|
8710
|
+
await import("../lib/interaction-adapter.js");
|
|
8750
8711
|
const chatFn = createChatFn({
|
|
8751
8712
|
...(evolutionIngress === null ? {} : { evolutionIngress }),
|
|
8752
8713
|
provider,
|
|
@@ -8825,9 +8786,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
8825
8786
|
// a note) and `cc memory recall` (scoped store).
|
|
8826
8787
|
if (trimmed === "/memory" || trimmed.startsWith("/memory ")) {
|
|
8827
8788
|
try {
|
|
8828
|
-
const { loadProjectInstructions } =
|
|
8829
|
-
"../lib/project-instructions.js"
|
|
8830
|
-
);
|
|
8789
|
+
const { loadProjectInstructions } =
|
|
8790
|
+
await import("../lib/project-instructions.js");
|
|
8831
8791
|
const { renderMemoryFiles } = await import("./memory-status.js");
|
|
8832
8792
|
const loaded = loadProjectInstructions({ cwd: process.cwd() });
|
|
8833
8793
|
logger.log(
|
|
@@ -8919,9 +8879,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
8919
8879
|
} catch (_err) {
|
|
8920
8880
|
// config read is best-effort; checks degrade gracefully
|
|
8921
8881
|
}
|
|
8922
|
-
const { buildDoctorChecks, renderDoctor } =
|
|
8923
|
-
"./doctor-status.js"
|
|
8924
|
-
);
|
|
8882
|
+
const { buildDoctorChecks, renderDoctor } =
|
|
8883
|
+
await import("./doctor-status.js");
|
|
8925
8884
|
const { ideToolNames } = await import("./ide-status.js");
|
|
8926
8885
|
const checks = buildDoctorChecks({
|
|
8927
8886
|
config,
|
|
@@ -9394,9 +9353,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
9394
9353
|
// is observe-only). block → abort the turn; context → inject before the turn.
|
|
9395
9354
|
if (_settingsHooks) {
|
|
9396
9355
|
try {
|
|
9397
|
-
const { runUserPromptSubmitHooks } =
|
|
9398
|
-
"../lib/settings-hook-events.js"
|
|
9399
|
-
);
|
|
9356
|
+
const { runUserPromptSubmitHooks } =
|
|
9357
|
+
await import("../lib/settings-hook-events.js");
|
|
9400
9358
|
const ups = await runUserPromptSubmitHooks(_settingsHooks, {
|
|
9401
9359
|
prompt: userContent,
|
|
9402
9360
|
cwd: process.cwd(),
|
|
@@ -9418,13 +9376,11 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
9418
9376
|
// long-running check (background tests, CI status) runs ALONGSIDE this
|
|
9419
9377
|
// turn without blocking it; its result/rewake surfaces on a later turn
|
|
9420
9378
|
// via the async-hook drain below. Lazily create the supervisor.
|
|
9421
|
-
const { dispatchAsyncHooks } =
|
|
9422
|
-
"../lib/settings-hook-events.js"
|
|
9423
|
-
);
|
|
9379
|
+
const { dispatchAsyncHooks } =
|
|
9380
|
+
await import("../lib/settings-hook-events.js");
|
|
9424
9381
|
if (!_asyncHookSupervisor) {
|
|
9425
|
-
const { AsyncHookSupervisor } =
|
|
9426
|
-
"../lib/async-hook-supervisor.js"
|
|
9427
|
-
);
|
|
9382
|
+
const { AsyncHookSupervisor } =
|
|
9383
|
+
await import("../lib/async-hook-supervisor.js");
|
|
9428
9384
|
_asyncHookSupervisor = new AsyncHookSupervisor({
|
|
9429
9385
|
persistStats: true,
|
|
9430
9386
|
});
|
|
@@ -9512,9 +9468,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
9512
9468
|
// Ephemeral: persistence stores effectivePrompt, not this snapshot.
|
|
9513
9469
|
// Best-effort; CC_IDE_CONTEXT=0 disables.
|
|
9514
9470
|
try {
|
|
9515
|
-
const { buildIdePromptContext, expandIdeMentions } =
|
|
9516
|
-
"../lib/ide-context.js"
|
|
9517
|
-
);
|
|
9471
|
+
const { buildIdePromptContext, expandIdeMentions } =
|
|
9472
|
+
await import("../lib/ide-context.js");
|
|
9518
9473
|
const hostMcp = _getReplHostMcp();
|
|
9519
9474
|
const ideCtx = await buildIdePromptContext(hostMcp);
|
|
9520
9475
|
if (ideCtx) userContent += `\n\n${ideCtx}`;
|
|
@@ -9620,9 +9575,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
9620
9575
|
if (sessionId && useJsonl) {
|
|
9621
9576
|
try {
|
|
9622
9577
|
if (!_turnBindingProducer) {
|
|
9623
|
-
const { createReplTurnBindingProducer } =
|
|
9624
|
-
"./repl-turn-binding.js"
|
|
9625
|
-
);
|
|
9578
|
+
const { createReplTurnBindingProducer } =
|
|
9579
|
+
await import("./repl-turn-binding.js");
|
|
9626
9580
|
_turnBindingProducer = createReplTurnBindingProducer({
|
|
9627
9581
|
sessionId,
|
|
9628
9582
|
onError: (error, phase) => {
|
|
@@ -9656,9 +9610,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
9656
9610
|
const defs = CLISlotFiller.getSlotDefinitions(intent.type);
|
|
9657
9611
|
const missing = defs.required.filter((s) => !intent.entities[s]);
|
|
9658
9612
|
if (missing.length > 0) {
|
|
9659
|
-
const { TerminalInteractionAdapter } =
|
|
9660
|
-
"../lib/interaction-adapter.js"
|
|
9661
|
-
);
|
|
9613
|
+
const { TerminalInteractionAdapter } =
|
|
9614
|
+
await import("../lib/interaction-adapter.js");
|
|
9662
9615
|
const interaction = new TerminalInteractionAdapter();
|
|
9663
9616
|
const filler = new CLISlotFiller({ interaction });
|
|
9664
9617
|
const result = await filler.fillSlots(intent, {
|
|
@@ -9747,9 +9700,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
9747
9700
|
const { resolveActiveGoal } = await import("../lib/goal-store.js");
|
|
9748
9701
|
const boundGoal = resolveActiveGoal({ sessionId });
|
|
9749
9702
|
if (boundGoal) {
|
|
9750
|
-
const { goalPrepareCall, composePrepareCall } =
|
|
9751
|
-
"../lib/goal-context.js"
|
|
9752
|
-
);
|
|
9703
|
+
const { goalPrepareCall, composePrepareCall } =
|
|
9704
|
+
await import("../lib/goal-context.js");
|
|
9753
9705
|
prepareCall = composePrepareCall([
|
|
9754
9706
|
defaultPrepareCall,
|
|
9755
9707
|
goalPrepareCall(boundGoal),
|
|
@@ -9775,9 +9727,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
9775
9727
|
}
|
|
9776
9728
|
return;
|
|
9777
9729
|
}
|
|
9778
|
-
const { renderAdvisorAdvice } =
|
|
9779
|
-
"./advisor-command.js"
|
|
9780
|
-
);
|
|
9730
|
+
const { renderAdvisorAdvice } =
|
|
9731
|
+
await import("./advisor-command.js");
|
|
9781
9732
|
process.stderr.write(`\n${renderAdvisorAdvice(result)}\n`);
|
|
9782
9733
|
},
|
|
9783
9734
|
});
|
|
@@ -9838,9 +9789,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
9838
9789
|
// hooks (fired inside the loop, per tool call) can be dispatched
|
|
9839
9790
|
// fire-and-forget; their results/rewakes drain into the next turn above.
|
|
9840
9791
|
if (_settingsHooks && !_asyncHookSupervisor) {
|
|
9841
|
-
const { AsyncHookSupervisor } =
|
|
9842
|
-
"../lib/async-hook-supervisor.js"
|
|
9843
|
-
);
|
|
9792
|
+
const { AsyncHookSupervisor } =
|
|
9793
|
+
await import("../lib/async-hook-supervisor.js");
|
|
9844
9794
|
_asyncHookSupervisor = new AsyncHookSupervisor({
|
|
9845
9795
|
persistStats: true,
|
|
9846
9796
|
});
|
|
@@ -9853,6 +9803,7 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
9853
9803
|
usageEvents,
|
|
9854
9804
|
thinking: reasoning,
|
|
9855
9805
|
} = await agentLoop(messages, {
|
|
9806
|
+
contextMemoryRecall: recallMemory,
|
|
9856
9807
|
contextMemoryModelWindowTokens: options.contextMemoryModelWindowTokens,
|
|
9857
9808
|
...captureSkillRuntimeDependencies(options),
|
|
9858
9809
|
...liveOpts,
|
|
@@ -9954,6 +9905,7 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
9954
9905
|
// previous absent ceiling also yielded "default").
|
|
9955
9906
|
subAgentContract: {
|
|
9956
9907
|
permissionMode: permissionModeForTier(_sessionTier),
|
|
9908
|
+
...(recallMemory ? {} : { memory: false }),
|
|
9957
9909
|
},
|
|
9958
9910
|
prepareCall,
|
|
9959
9911
|
approvalGate: _approvalGate,
|
|
@@ -10029,9 +9981,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
10029
9981
|
const fsMod = await import("node:fs");
|
|
10030
9982
|
const judge = async (cond, { finalText }) => {
|
|
10031
9983
|
const { chatWithTools } = await import("../runtime/agent-core.js");
|
|
10032
|
-
const { firstBalancedJson } =
|
|
10033
|
-
"../lib/json-schema-output.js"
|
|
10034
|
-
);
|
|
9984
|
+
const { firstBalancedJson } =
|
|
9985
|
+
await import("../lib/json-schema-output.js");
|
|
10035
9986
|
const p =
|
|
10036
9987
|
`Judge whether this coding session met a completion condition.\n` +
|
|
10037
9988
|
`Condition: ${cond.text || cond.source}\n\n` +
|
|
@@ -10043,6 +9994,7 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
10043
9994
|
source: "model",
|
|
10044
9995
|
call: ({ signal }) =>
|
|
10045
9996
|
chatWithTools([{ role: "user", content: p }], {
|
|
9997
|
+
contextMemoryRecall: recallMemory,
|
|
10046
9998
|
...(evolutionIngress === null ? {} : { evolutionIngress }),
|
|
10047
9999
|
model: activeModel,
|
|
10048
10000
|
provider,
|
|
@@ -10133,9 +10085,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
10133
10085
|
} else {
|
|
10134
10086
|
// Phase G #2 — route through StreamRouter so REPL / WS / future
|
|
10135
10087
|
// streaming providers share one StreamEvent protocol.
|
|
10136
|
-
const { streamAgentResponse } =
|
|
10137
|
-
"../lib/agent-stream.js"
|
|
10138
|
-
);
|
|
10088
|
+
const { streamAgentResponse } =
|
|
10089
|
+
await import("../lib/agent-stream.js");
|
|
10139
10090
|
process.stdout.write("\n");
|
|
10140
10091
|
const noStream = options.noStream === true;
|
|
10141
10092
|
const streamResult = await streamAgentResponse(effectiveResponse, {
|
|
@@ -10293,9 +10244,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
10293
10244
|
// drain above). Best-effort — never break turn completion.
|
|
10294
10245
|
if (_settingsHooks) {
|
|
10295
10246
|
try {
|
|
10296
|
-
const { runObserveHooks, dispatchAsyncHooks } =
|
|
10297
|
-
"../lib/settings-hook-events.js"
|
|
10298
|
-
);
|
|
10247
|
+
const { runObserveHooks, dispatchAsyncHooks } =
|
|
10248
|
+
await import("../lib/settings-hook-events.js");
|
|
10299
10249
|
await runObserveHooks(
|
|
10300
10250
|
_settingsHooks,
|
|
10301
10251
|
"Stop",
|
|
@@ -10303,9 +10253,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
10303
10253
|
{ cwd: process.cwd() },
|
|
10304
10254
|
);
|
|
10305
10255
|
if (!_asyncHookSupervisor) {
|
|
10306
|
-
const { AsyncHookSupervisor } =
|
|
10307
|
-
"../lib/async-hook-supervisor.js"
|
|
10308
|
-
);
|
|
10256
|
+
const { AsyncHookSupervisor } =
|
|
10257
|
+
await import("../lib/async-hook-supervisor.js");
|
|
10309
10258
|
_asyncHookSupervisor = new AsyncHookSupervisor({
|
|
10310
10259
|
persistStats: true,
|
|
10311
10260
|
});
|
|
@@ -10490,9 +10439,8 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
10490
10439
|
// settings.json SessionEnd hooks (observe-only) when the REPL exits.
|
|
10491
10440
|
if (_settingsHooks) {
|
|
10492
10441
|
try {
|
|
10493
|
-
const { runObserveHooks } =
|
|
10494
|
-
"../lib/settings-hook-events.js"
|
|
10495
|
-
);
|
|
10442
|
+
const { runObserveHooks } =
|
|
10443
|
+
await import("../lib/settings-hook-events.js");
|
|
10496
10444
|
await runObserveHooks(
|
|
10497
10445
|
_settingsHooks,
|
|
10498
10446
|
"SessionEnd",
|