chainlesschain 0.166.100 → 0.166.102
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/package.json +3 -3
- 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/assets/{AIOps-Cd4iUOPt.js → AIOps-CyHIMEd8.js} +1 -1
- package/src/assets/web-panel/assets/{ActionButton--ucr-zko.js → ActionButton-vuNxDpHm.js} +1 -1
- package/src/assets/web-panel/assets/{Analytics-DbejYMWk.js → Analytics-D0quEM0q.js} +3 -3
- package/src/assets/web-panel/assets/{AppLayout-CLgKxeGw.js → AppLayout-xRSVpbCs.js} +5 -5
- package/src/assets/web-panel/assets/{Artifacts-CTT5BIL5.js → Artifacts-ktfVAZBC.js} +1 -1
- package/src/assets/web-panel/assets/{Audit-DP-WBWe9.js → Audit-UJW6maH4.js} +1 -1
- package/src/assets/web-panel/assets/{BackgroundAgents-B6VqheJk.js → BackgroundAgents-BYrfdCoT.js} +1 -1
- package/src/assets/web-panel/assets/{Backup-VWJK5zim.js → Backup-IBgsJ7BK.js} +1 -1
- package/src/assets/web-panel/assets/{BaseInput-YGFO9RHd.js → BaseInput-BmP8_zxy.js} +1 -1
- package/src/assets/web-panel/assets/{Chat-CVfydnCd.js → Chat-urkw8_BF.js} +5 -5
- package/src/assets/web-panel/assets/{ChatBubbleRenderer-BICpB-qU.js → ChatBubbleRenderer-Cw44zZbh.js} +1 -1
- package/src/assets/web-panel/assets/{Checkbox-Bd5vKRMk.js → Checkbox-CYboo-__.js} +1 -1
- package/src/assets/web-panel/assets/{Codegen-DHNgPHvg.js → Codegen-DaqR_Ay8.js} +1 -1
- package/src/assets/web-panel/assets/{Col-CA2BYQ8T.js → Col-04BSIj_z.js} +1 -1
- package/src/assets/web-panel/assets/{Community-DnKJ-qpI.js → Community-DxFk7Trv.js} +1 -1
- package/src/assets/web-panel/assets/{Compact-C9BZ8t4r.js → Compact-mjgWlMCB.js} +1 -1
- package/src/assets/web-panel/assets/{Compliance-ByyQ2FOl.js → Compliance-CC5ee7QV.js} +1 -1
- package/src/assets/web-panel/assets/{Cowork-rXTwXE_c.js → Cowork-BK4BhHZd.js} +2 -2
- package/src/assets/web-panel/assets/{Cron-BuW-HODy.js → Cron-CP6jAxq0.js} +2 -2
- package/src/assets/web-panel/assets/{Crosschain-OudNtbYW.js → Crosschain-DJPaViZS.js} +1 -1
- package/src/assets/web-panel/assets/{DID-BQ6BxYNN.js → DID-BTLxkuOj.js} +2 -2
- package/src/assets/web-panel/assets/{Dashboard-Cz5HG8tz.js → Dashboard-Djkiqh3d.js} +2 -2
- package/src/assets/web-panel/assets/{Dropdown-BzclHOVv.js → Dropdown-t_eUhqom.js} +1 -1
- package/src/assets/web-panel/assets/{EmailListRenderer-CbJETFdy.js → EmailListRenderer-7w6USx_J.js} +1 -1
- package/src/assets/web-panel/assets/{EvolutionSettings-Dx_pJG3d.js → EvolutionSettings-mU5IHEk5.js} +1 -1
- package/src/assets/web-panel/assets/{FamilyGuardDashboard-6JCS1MNg.js → FamilyGuardDashboard-BCh-VBBC.js} +1 -1
- package/src/assets/web-panel/assets/{Federation-BrPkMYaf.js → Federation-Be_VpjI2.js} +1 -1
- package/src/assets/web-panel/assets/{FormItemContext-Bhc9pobs.js → FormItemContext-D_lzQ7PI.js} +1 -1
- package/src/assets/web-panel/assets/{GenericCardRenderer-BxOh07uQ.js → GenericCardRenderer-LYu3KapV.js} +1 -1
- package/src/assets/web-panel/assets/{Git-D_idoujr.js → Git-BBeF-PP4.js} +2 -2
- package/src/assets/web-panel/assets/{Governance-ZGfIRE-x.js → Governance-CoF8Kzg7.js} +1 -1
- package/src/assets/web-panel/assets/{Inference-DpAmcwbw.js → Inference-C4DLMnXS.js} +1 -1
- package/src/assets/web-panel/assets/{KnowledgeGraph-D1S1UTgP.js → KnowledgeGraph-B2mlNewk.js} +1 -1
- package/src/assets/web-panel/assets/{Logs-2sc8V5XV.js → Logs-DMZ_44Ya.js} +2 -2
- package/src/assets/web-panel/assets/MarkdownRenderer-Ck7Iv_9e.js +1 -0
- package/src/assets/web-panel/assets/{Marketplace-0xlFUKbe.js → Marketplace-BqDzTew_.js} +1 -1
- package/src/assets/web-panel/assets/{McpTools-D25eJLGm.js → McpTools-BbwSbDN9.js} +3 -3
- package/src/assets/web-panel/assets/{Memory-BLRGd9hM.js → Memory-DAaTWgrm.js} +2 -2
- package/src/assets/web-panel/assets/{MobileBridge-zpFINGzn.js → MobileBridge-BjbTGxoR.js} +1 -1
- package/src/assets/web-panel/assets/{MobileProjects-Cbyd-8kx.js → MobileProjects-DMODOBr-.js} +1 -1
- package/src/assets/web-panel/assets/{Mtc-DgXgUlHc.js → Mtc-DT9N2rCs.js} +2 -2
- package/src/assets/web-panel/assets/{MtcAudit-DzcL-dKH.js → MtcAudit-DagMfUVv.js} +2 -2
- package/src/assets/web-panel/assets/{Multisig-C3OrZ6VN.js → Multisig-C1BKP6nM.js} +3 -3
- package/src/assets/web-panel/assets/{NLProgramming-Bqp_vWA7.js → NLProgramming-B5LFh72i.js} +1 -1
- package/src/assets/web-panel/assets/{Notes-Dyn45-Ht.js → Notes-Q77V3ltW.js} +3 -3
- package/src/assets/web-panel/assets/{NotificationSettings-CLjafGZr.js → NotificationSettings-HxdpNIBs.js} +1 -1
- package/src/assets/web-panel/assets/OrderTableRenderer-Dc0DpvBH.js +1 -0
- package/src/assets/web-panel/assets/{Organization-5gr9hyLm.js → Organization-QL3NZ7uW.js} +4 -4
- package/src/assets/web-panel/assets/{Overflow-BRdU02hT.js → Overflow-B_gqOKho.js} +1 -1
- package/src/assets/web-panel/assets/{P2P-DIi7fzh6.js → P2P-BBJubU8Z.js} +2 -2
- package/src/assets/web-panel/assets/{PdhVaultBrowser-BCbS1KpA.js → PdhVaultBrowser-CFnGd-2E.js} +3 -3
- package/src/assets/web-panel/assets/{Permissions-BjeP9VtA.js → Permissions-BKkznIUM.js} +4 -4
- package/src/assets/web-panel/assets/{PersonalDataHub-y8PXOQUc.js → PersonalDataHub-DYK7ZAcd.js} +4 -4
- package/src/assets/web-panel/assets/{Pipeline-B0fL5uxY.js → Pipeline-CoeKpjoN.js} +1 -1
- package/src/assets/web-panel/assets/{Privacy-C8jCDn8Z.js → Privacy-Diw4G-92.js} +1 -1
- package/src/assets/web-panel/assets/{ProjectInit-B_L6Dc6V.js → ProjectInit-CHBOFkma.js} +2 -2
- package/src/assets/web-panel/assets/{ProjectSettings-Bb1CYbZh.js → ProjectSettings-BJIsgdOf.js} +2 -2
- package/src/assets/web-panel/assets/{Projects-CUSV10Cn.js → Projects-GJjItXIk.js} +1 -1
- package/src/assets/web-panel/assets/{Providers-mBSTDJ0E.js → Providers-o8QCimor.js} +1 -1
- package/src/assets/web-panel/assets/{QrScannerModal-CHxgalvt.js → QrScannerModal-z2W-zvhW.js} +1 -1
- package/src/assets/web-panel/assets/{QuickAsk-DI9KIMEV.js → QuickAsk-_yubhsna.js} +1 -1
- package/src/assets/web-panel/assets/{Recommend-B5_zW1JH.js → Recommend-CucgJwih.js} +1 -1
- package/src/assets/web-panel/assets/{RemoteSession-BkH4bmM5.js → RemoteSession-EzfIIRg1.js} +2 -2
- package/src/assets/web-panel/assets/{Reputation-DJrAqwAq.js → Reputation-_shttE67.js} +1 -1
- package/src/assets/web-panel/assets/{Row-xZ3MAM34.js → Row-DQA_S8-9.js} +1 -1
- package/src/assets/web-panel/assets/{RssFeed-CCsrLLiu.js → RssFeed-BOqWawXT.js} +3 -3
- package/src/assets/web-panel/assets/{Search-CTCRKvaP.js → Search-Dx1v2xOq.js} +1 -1
- package/src/assets/web-panel/assets/{Security-D7joyfp2.js → Security-Bt4HHsT4.js} +4 -4
- package/src/assets/web-panel/assets/{Services-oqHPmTG4.js → Services-sruHiQ-r.js} +2 -2
- package/src/assets/web-panel/assets/{Skeleton-BR_32bTG.js → Skeleton-CiBxvmOJ.js} +1 -1
- package/src/assets/web-panel/assets/{Skills-BoRz9mln.js → Skills-De9qKODU.js} +1 -1
- package/src/assets/web-panel/assets/{Sla-UAGUHZ9b.js → Sla-B_6yn8Wp.js} +1 -1
- package/src/assets/web-panel/assets/{SpeechSettings-DeP_rMgv.js → SpeechSettings-C2CafExS.js} +1 -1
- package/src/assets/web-panel/assets/{SyncSettings-CSzzMmeA.js → SyncSettings-Dhh3Qmb0.js} +2 -2
- package/src/assets/web-panel/assets/{Tasks-CcqOLsLB.js → Tasks-Mvo5mTWm.js} +1 -1
- package/src/assets/web-panel/assets/{Templates-cDbkGSDG.js → Templates-D7WVTQQy.js} +1 -1
- package/src/assets/web-panel/assets/{Tenant-DmOy58cq.js → Tenant-7ur9Yfxd.js} +1 -1
- package/src/assets/web-panel/assets/{Terminal-CsRZH5vr.js → Terminal-BgzrOA6k.js} +2 -2
- package/src/assets/web-panel/assets/{TimelineRenderer-BgJrk6HG.js → TimelineRenderer-Dco20pT1.js} +1 -1
- package/src/assets/web-panel/assets/{Tokens-CCQglKDE.js → Tokens-hN6qBPag.js} +1 -1
- package/src/assets/web-panel/assets/{Trigger-t-Gt3oBY.js → Trigger-C4f_twAM.js} +1 -1
- package/src/assets/web-panel/assets/{Trust-DQgu2kI0.js → Trust-Wf1SMypp.js} +1 -1
- package/src/assets/web-panel/assets/{UkeySign-Cod2WUGj.js → UkeySign-DUXSyg3N.js} +1 -1
- package/src/assets/web-panel/assets/{VideoEditing-SGN5zaVK.js → VideoEditing-BvqsJaL0.js} +1 -1
- package/src/assets/web-panel/assets/{Wallet-CnLEL-LD.js → Wallet-CgAbcjKl.js} +3 -3
- package/src/assets/web-panel/assets/{WebAuthn-C2keUpD6.js → WebAuthn-DaLT0W3s.js} +2 -2
- package/src/assets/web-panel/assets/{WorkflowEditor-B1GvrwWJ.js → WorkflowEditor-CQqAXoaS.js} +1 -1
- package/src/assets/web-panel/assets/{chat-1E9_P_qY.js → chat-BhlohFTB.js} +1 -1
- package/src/assets/web-panel/assets/{colors-DuU6Os4q.js → colors-D7HqXIL8.js} +1 -1
- package/src/assets/web-panel/assets/{compact-item-C5NfOAcM.js → compact-item-Bqk4FCLY.js} +1 -1
- package/src/assets/web-panel/assets/{createContext-D4Fxz9qQ.js → createContext-CEmWrWf0.js} +1 -1
- package/src/assets/web-panel/assets/devWarning-YPX_TU7w.js +1 -0
- package/src/assets/web-panel/assets/{hasIn-C6C49iFk.js → hasIn-CDY0pFi2.js} +1 -1
- package/src/assets/web-panel/assets/{index-DP2DCKD-.js → index-1HBam9t1.js} +1 -1
- package/src/assets/web-panel/assets/{index-B-bb-R99.js → index-6f6n0KFR.js} +1 -1
- package/src/assets/web-panel/assets/{index-BmvU4Tp_.js → index-B8L3_-sG.js} +1 -1
- package/src/assets/web-panel/assets/{index-BsH8mFp4.js → index-BHGOdvOQ.js} +1 -1
- package/src/assets/web-panel/assets/{index-BVE2wCeb.js → index-BNrvBWDS.js} +1 -1
- package/src/assets/web-panel/assets/{index-CJS6GTpv.js → index-BPmRkxeX.js} +1 -1
- package/src/assets/web-panel/assets/{index-C7mh6xlu.js → index-BXRooi-O.js} +1 -1
- package/src/assets/web-panel/assets/{index-BZKRZYTX.js → index-BiLu-ImR.js} +1 -1
- package/src/assets/web-panel/assets/{index-jFg3CPlQ.js → index-BuKGuH_y.js} +1 -1
- package/src/assets/web-panel/assets/{index-BULggEX6.js → index-BxXFRLTZ.js} +1 -1
- package/src/assets/web-panel/assets/{index-DPzunJER.js → index-BxYO6nde.js} +1 -1
- package/src/assets/web-panel/assets/{index-AO6iDCSL.js → index-C02yDu4f.js} +1 -1
- package/src/assets/web-panel/assets/{index-BU5mPkNX.js → index-C3opQg47.js} +1 -1
- package/src/assets/web-panel/assets/{index-DSypQU1h.js → index-C9mvnSii.js} +1 -1
- package/src/assets/web-panel/assets/{index-DZgT7pH-.js → index-CVrwozwH.js} +1 -1
- package/src/assets/web-panel/assets/{index-CpiOzt7U.js → index-CYcjOnDX.js} +1 -1
- package/src/assets/web-panel/assets/{index-BlHkc48f.js → index-Cf1ha8l0.js} +1 -1
- package/src/assets/web-panel/assets/{index-CXb8gEWh.js → index-Chxt0t-A.js} +1 -1
- package/src/assets/web-panel/assets/{index-HQXFl8fh.js → index-CkjgSHVz.js} +1 -1
- package/src/assets/web-panel/assets/{index-DpaGe-dr.js → index-CkqBoCiu.js} +3 -3
- package/src/assets/web-panel/assets/{index-C2nO02uW.js → index-CqK0J4Sj.js} +1 -1
- package/src/assets/web-panel/assets/{index-Bu6qMjf4.js → index-CrsM-oiD.js} +1 -1
- package/src/assets/web-panel/assets/{index-Bk-paNL3.js → index-Cur88hoN.js} +1 -1
- package/src/assets/web-panel/assets/{index-CXn-e3ki.js → index-D0nfNmbq.js} +1 -1
- package/src/assets/web-panel/assets/index-D53szVZQ.js +1 -0
- package/src/assets/web-panel/assets/{index-CDVwN9Sv.js → index-DEzL7s7P.js} +1 -1
- package/src/assets/web-panel/assets/{index-B_ON9La1.js → index-DGKRAO61.js} +1 -1
- package/src/assets/web-panel/assets/{index-CQJoh5rw.js → index-DPBoWNwq.js} +1 -1
- package/src/assets/web-panel/assets/{index-cnDfwWU5.js → index-DRcDWMwP.js} +1 -1
- package/src/assets/web-panel/assets/{index-BBVqlelF.js → index-DmKdCWq1.js} +1 -1
- package/src/assets/web-panel/assets/{index-BYg1dtne.js → index-DpI1LqJX.js} +1 -1
- package/src/assets/web-panel/assets/{index-B5lzRoHp.js → index-DuMt3ewl.js} +1 -1
- package/src/assets/web-panel/assets/{index-gh11zJ9h.js → index-Dwob5XoD.js} +1 -1
- package/src/assets/web-panel/assets/index-Ub2nJbV2.js +1 -0
- package/src/assets/web-panel/assets/{index-D1TXgNPA.js → index-XErJQ1yF.js} +1 -1
- package/src/assets/web-panel/assets/{index-DFK6PTGJ.js → index-aBHlgMrq.js} +1 -1
- package/src/assets/web-panel/assets/{index-Dh-vezHe.js → index-e9oCy7_4.js} +1 -1
- package/src/assets/web-panel/assets/{index-bW6vfpLH.js → index-lBAbMOzg.js} +1 -1
- package/src/assets/web-panel/assets/{index-lNmDaf3J.js → index-o_lc3eww.js} +1 -1
- package/src/assets/web-panel/assets/{initDefaultProps-3DSfnIpD.js → initDefaultProps-CIeEUxIN.js} +1 -1
- package/src/assets/web-panel/assets/{motion-DxGLmgA0.js → motion-IPIj1ZtP.js} +1 -1
- package/src/assets/web-panel/assets/{move-DrlLG6m5.js → move-BfSeXZ-f.js} +1 -1
- package/src/assets/web-panel/assets/{mtc-parser-BITbrJSb.js → mtc-parser-DX03-Xp4.js} +1 -1
- package/src/assets/web-panel/assets/{omit-D7k5vIbk.js → omit-z9EannfX.js} +1 -1
- package/src/assets/web-panel/assets/{pickAttrs-BJSvYFWo.js → pickAttrs-DXKmRkqZ.js} +1 -1
- package/src/assets/web-panel/assets/{placementArrow-Bf4to1jA.js → placementArrow-k2HV7cIU.js} +1 -1
- package/src/assets/web-panel/assets/{responsiveObserve-BXzeyzTa.js → responsiveObserve-bX7CsyWy.js} +1 -1
- package/src/assets/web-panel/assets/{slide-DLzNUNdj.js → slide-NskjQLbJ.js} +1 -1
- package/src/assets/web-panel/assets/{statusUtils-wBBnrRm_.js → statusUtils-B3IoG-Er.js} +1 -1
- package/src/assets/web-panel/assets/{styleChecker-BnmJzXNr.js → styleChecker-DHv_UilX.js} +1 -1
- package/src/assets/web-panel/assets/{useFlexGapSupport-DrN8MrJb.js → useFlexGapSupport-DEqGB5Ng.js} +1 -1
- package/src/assets/web-panel/assets/{useFs-dnkYGkjY.js → useFs-Bl9CbrqZ.js} +1 -1
- package/src/assets/web-panel/assets/{usePersonalDataHub-k_xkv7-k.js → usePersonalDataHub-O-Ukv93M.js} +1 -1
- package/src/assets/web-panel/assets/{vnode-B-v8PXpK.js → vnode-hGCHTaZt.js} +1 -1
- package/src/assets/web-panel/assets/{zoom-Coue8wAK.js → zoom-BWhIVeKQ.js} +1 -1
- package/src/assets/web-panel/index.html +1 -1
- package/src/command-help-index.json +1 -1
- package/src/commands/agent.js +64 -40
- package/src/commands/eval.js +11 -8
- package/src/data/changelog.json +26 -0
- package/src/harness/provider-backed-compaction.js +13 -5
- package/src/lib/config-schema.js +18 -5
- package/src/lib/context-memory-kernel/live-compaction.js +142 -61
- package/src/lib/context-memory-kernel/memory-query-index.js +5 -2
- package/src/lib/context-memory-kernel/runtime.js +4 -0
- package/src/lib/context-memory-kernel/segmented-memory-port.js +28 -3
- package/src/lib/context-source-ledger.js +52 -9
- package/src/lib/formal-budget-authority.js +533 -0
- package/src/lib/formal-budget-contract.js +609 -0
- package/src/lib/formal-budget-transport.js +345 -0
- package/src/lib/goal-condition-engine.js +25 -2
- package/src/lib/llm-config-defaults.js +10 -4
- package/src/lib/llm-pricing.js +16 -4
- package/src/lib/model-capabilities.js +26 -0
- package/src/lib/model-catalog-review.js +18 -1
- package/src/lib/model-context-catalog.js +41 -1
- package/src/lib/openai-responses.js +8 -0
- package/src/lib/skill-retrieval-router.js +1 -0
- package/src/lib/usage-pricing-context.js +33 -2
- package/src/repl/agent-repl.js +247 -153
- package/src/runtime/agent-core.js +371 -97
- package/src/runtime/coding-agent-contract-shared.cjs +14 -1
- package/src/runtime/headless-runner.js +1 -0
- package/src/runtime/headless-stream.js +137 -4
- package/src/runtime/mcp-tool-search.js +0 -0
- package/src/runtime/provider-stream-state.js +14 -1
- package/src/assets/web-panel/assets/MarkdownRenderer-575jjYE6.js +0 -1
- package/src/assets/web-panel/assets/OrderTableRenderer-Bx8wMauC.js +0 -1
- package/src/assets/web-panel/assets/devWarning-zDWbYMr7.js +0 -1
- package/src/assets/web-panel/assets/index-BPBsZZnT.js +0 -1
- package/src/assets/web-panel/assets/index-CtGQDg7m.js +0 -1
package/src/repl/agent-repl.js
CHANGED
|
@@ -430,9 +430,9 @@ export async function runReplDirectToolWithLedger({
|
|
|
430
430
|
tool,
|
|
431
431
|
isError: Boolean(
|
|
432
432
|
executionFailed ||
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
433
|
+
result?.error ||
|
|
434
|
+
result?.is_error ||
|
|
435
|
+
result?.isError,
|
|
436
436
|
),
|
|
437
437
|
skill: tool === "run_skill" ? args?.skill_name : undefined,
|
|
438
438
|
...extractPluginUsageAttribution(result),
|
|
@@ -522,8 +522,9 @@ async function _fireNotification(message, type = "info", session = null) {
|
|
|
522
522
|
// Fire settings.json observe hooks first (best-effort)
|
|
523
523
|
if (_settingsHooks) {
|
|
524
524
|
try {
|
|
525
|
-
const { runObserveHooks } =
|
|
526
|
-
|
|
525
|
+
const { runObserveHooks } = await import(
|
|
526
|
+
"../lib/settings-hook-events.js"
|
|
527
|
+
);
|
|
527
528
|
await runObserveHooks(
|
|
528
529
|
_settingsHooks,
|
|
529
530
|
"Notification",
|
|
@@ -3451,8 +3452,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
3451
3452
|
// Initialize prompt compressor (adaptive to model's context window). A
|
|
3452
3453
|
// canonical cutover cannot disable the Kernel writer by toggling the legacy
|
|
3453
3454
|
// compressor feature flag; the compressor remains only its summarizer.
|
|
3454
|
-
const { resolveCliContextMemoryCutover } =
|
|
3455
|
-
|
|
3455
|
+
const { resolveCliContextMemoryCutover } = await import(
|
|
3456
|
+
"../lib/context-memory-kernel/authority.js"
|
|
3457
|
+
);
|
|
3456
3458
|
const contextMemoryCutover = resolveCliContextMemoryCutover({
|
|
3457
3459
|
env: options.contextMemoryEnv || process.env,
|
|
3458
3460
|
scopeKey: sessionId ? `cli:session:${sessionId}` : "cli:repl",
|
|
@@ -3499,8 +3501,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
3499
3501
|
});
|
|
3500
3502
|
if (contextMemoryCutover.canonical) {
|
|
3501
3503
|
const compatibilitySummarizer = _compressor;
|
|
3502
|
-
const { compactLiveMessagesCanonical } =
|
|
3503
|
-
|
|
3504
|
+
const { compactLiveMessagesCanonical } = await import(
|
|
3505
|
+
"../lib/context-memory-kernel/live-compaction.js"
|
|
3506
|
+
);
|
|
3504
3507
|
_compressor = {
|
|
3505
3508
|
canonicalKernel: true,
|
|
3506
3509
|
maxTokens: compatibilitySummarizer.maxTokens,
|
|
@@ -3595,8 +3598,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
3595
3598
|
// MEDIUM/HIGH-risk commands against the session's policy tier
|
|
3596
3599
|
// (strict / trusted / autopilot).
|
|
3597
3600
|
try {
|
|
3598
|
-
const { getApprovalGate } =
|
|
3599
|
-
|
|
3601
|
+
const { getApprovalGate } = await import(
|
|
3602
|
+
"../lib/session-core-singletons.js"
|
|
3603
|
+
);
|
|
3600
3604
|
_approvalGate = await getApprovalGate();
|
|
3601
3605
|
_approvalGate =
|
|
3602
3606
|
_approvalGate?.createSessionScope?.(
|
|
@@ -3882,12 +3886,14 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
3882
3886
|
// project plugins get a process spawned. Reaped in the SessionEnd cleanup +
|
|
3883
3887
|
// a process-exit backstop, so no monitor outlives the session.
|
|
3884
3888
|
try {
|
|
3885
|
-
const { collectPluginMonitors } =
|
|
3886
|
-
|
|
3889
|
+
const { collectPluginMonitors } = await import(
|
|
3890
|
+
"../lib/plugin-runtime/monitors.js"
|
|
3891
|
+
);
|
|
3887
3892
|
const monitors = collectPluginMonitors({ cwd: process.cwd() });
|
|
3888
3893
|
if (monitors.length > 0) {
|
|
3889
|
-
const { PluginMonitorSupervisor } =
|
|
3890
|
-
|
|
3894
|
+
const { PluginMonitorSupervisor } = await import(
|
|
3895
|
+
"../lib/plugin-monitor-supervisor.js"
|
|
3896
|
+
);
|
|
3891
3897
|
_pluginMonitors = new PluginMonitorSupervisor();
|
|
3892
3898
|
const started = _pluginMonitors.start(monitors);
|
|
3893
3899
|
if (started.length > 0) {
|
|
@@ -3919,8 +3925,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
3919
3925
|
// Apply trusted plugins' default env vars (Phase 3.3o) — only for env keys the
|
|
3920
3926
|
// user/system didn't already set; restored at SessionEnd.
|
|
3921
3927
|
try {
|
|
3922
|
-
const { applyPluginSettingsEnv } =
|
|
3923
|
-
|
|
3928
|
+
const { applyPluginSettingsEnv } = await import(
|
|
3929
|
+
"../lib/plugin-runtime/settings.js"
|
|
3930
|
+
);
|
|
3924
3931
|
const res = applyPluginSettingsEnv({ cwd: process.cwd() });
|
|
3925
3932
|
_pluginSettingsRestore = res.restore;
|
|
3926
3933
|
if (res.added.length > 0) {
|
|
@@ -3988,8 +3995,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
3988
3995
|
let _sessionMgr = null;
|
|
3989
3996
|
let _sessionHandle = null;
|
|
3990
3997
|
try {
|
|
3991
|
-
const { getSessionManager } =
|
|
3992
|
-
|
|
3998
|
+
const { getSessionManager } = await import(
|
|
3999
|
+
"../lib/session-core-singletons.js"
|
|
4000
|
+
);
|
|
3993
4001
|
// Keep durable lifecycle sidecars on the same launch-authoritative Claude
|
|
3994
4002
|
// project bucket as the JSONL transcript. Project settings may not switch
|
|
3995
4003
|
// this map/path after the REPL has admitted its launch environment.
|
|
@@ -4038,8 +4046,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
4038
4046
|
error.code = "CC_REMOTE_APPROVAL_GATE_UNAVAILABLE";
|
|
4039
4047
|
throw error;
|
|
4040
4048
|
}
|
|
4041
|
-
const { startHeadlessRemoteApproval } =
|
|
4042
|
-
|
|
4049
|
+
const { startHeadlessRemoteApproval } = await import(
|
|
4050
|
+
"../lib/remote-approval-bridge.js"
|
|
4051
|
+
);
|
|
4043
4052
|
const started = await startHeadlessRemoteApproval({
|
|
4044
4053
|
agentSessionId:
|
|
4045
4054
|
sessionId || `repl-${process.pid}-${Date.now().toString(36)}`,
|
|
@@ -4299,8 +4308,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
4299
4308
|
// project memory is off or no hook is registered.
|
|
4300
4309
|
if (_settingsHooks && _loadedReplInstructions) {
|
|
4301
4310
|
try {
|
|
4302
|
-
const { runInstructionsLoadedHooks } =
|
|
4303
|
-
|
|
4311
|
+
const { runInstructionsLoadedHooks } = await import(
|
|
4312
|
+
"../lib/settings-hook-events.js"
|
|
4313
|
+
);
|
|
4304
4314
|
const ctx = (
|
|
4305
4315
|
await runInstructionsLoadedHooks(_settingsHooks, {
|
|
4306
4316
|
files: _loadedReplInstructions.files,
|
|
@@ -4317,8 +4327,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
4317
4327
|
// settings.json SessionStart hooks → inject session context (observe-only).
|
|
4318
4328
|
if (_settingsHooks) {
|
|
4319
4329
|
try {
|
|
4320
|
-
const { runSessionStartHooks } =
|
|
4321
|
-
|
|
4330
|
+
const { runSessionStartHooks } = await import(
|
|
4331
|
+
"../lib/settings-hook-events.js"
|
|
4332
|
+
);
|
|
4322
4333
|
const ctx = (
|
|
4323
4334
|
await runSessionStartHooks(_settingsHooks, {
|
|
4324
4335
|
source: "startup",
|
|
@@ -4382,15 +4393,18 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
4382
4393
|
};
|
|
4383
4394
|
if (options.bundlePath) {
|
|
4384
4395
|
try {
|
|
4385
|
-
const { loadBundle } =
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4396
|
+
const { loadBundle } = await import(
|
|
4397
|
+
"@chainlesschain/session-core/agent-bundle-loader"
|
|
4398
|
+
);
|
|
4399
|
+
const { parseUserMdSeed, resolveBundle } = await import(
|
|
4400
|
+
"@chainlesschain/session-core/agent-bundle-resolver"
|
|
4401
|
+
);
|
|
4389
4402
|
const bundle = loadBundle(options.bundlePath);
|
|
4390
4403
|
if (contextMemoryCutover.canonical) {
|
|
4391
4404
|
_bundleResolved = resolveBundle(bundle);
|
|
4392
|
-
const { createCliCanonicalMemoryService } =
|
|
4393
|
-
|
|
4405
|
+
const { createCliCanonicalMemoryService } = await import(
|
|
4406
|
+
"../lib/context-memory-kernel/memory-service.js"
|
|
4407
|
+
);
|
|
4394
4408
|
const memoryService = createCliCanonicalMemoryService({
|
|
4395
4409
|
env: options.contextMemoryEnv || process.env,
|
|
4396
4410
|
});
|
|
@@ -4432,8 +4446,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
4432
4446
|
}
|
|
4433
4447
|
_bundleResolved.seedResult = { seeded, skipped };
|
|
4434
4448
|
} else {
|
|
4435
|
-
const { getMemoryStore } =
|
|
4436
|
-
|
|
4449
|
+
const { getMemoryStore } = await import(
|
|
4450
|
+
"../lib/session-core-singletons.js"
|
|
4451
|
+
);
|
|
4437
4452
|
_bundleResolved = resolveBundle(bundle, {
|
|
4438
4453
|
memoryStore: getMemoryStore(),
|
|
4439
4454
|
seedOptions: {
|
|
@@ -4562,8 +4577,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
4562
4577
|
// MCP tool search (context scaling): defer big tool schemas behind the
|
|
4563
4578
|
// internal tool_search tool. Below-threshold / disabled → no-op.
|
|
4564
4579
|
try {
|
|
4565
|
-
const { maybeApplyToolSearch } =
|
|
4566
|
-
|
|
4580
|
+
const { maybeApplyToolSearch } = await import(
|
|
4581
|
+
"../runtime/mcp-tool-search.js"
|
|
4582
|
+
);
|
|
4567
4583
|
const ts = maybeApplyToolSearch(_adhocMcp, {
|
|
4568
4584
|
model,
|
|
4569
4585
|
provider,
|
|
@@ -4690,8 +4706,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
4690
4706
|
// when there are no extra roots. Best-effort.
|
|
4691
4707
|
if (additionalDirectories.length > 0) {
|
|
4692
4708
|
try {
|
|
4693
|
-
const { workspaceRootDirs, notifyMcpRootsChanged } =
|
|
4694
|
-
|
|
4709
|
+
const { workspaceRootDirs, notifyMcpRootsChanged } = await import(
|
|
4710
|
+
"./add-dir.js"
|
|
4711
|
+
);
|
|
4695
4712
|
notifyMcpRootsChanged(
|
|
4696
4713
|
[_adhocMcp?.mcpClient, _bundleMcpClient],
|
|
4697
4714
|
workspaceRootDirs(process.cwd(), additionalDirectories),
|
|
@@ -4744,8 +4761,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
4744
4761
|
// --no-recall-memory is passed.
|
|
4745
4762
|
if (!options.sessionId && options.recallMemory !== false) {
|
|
4746
4763
|
try {
|
|
4747
|
-
const { buildMemoryInjection } =
|
|
4748
|
-
|
|
4764
|
+
const { buildMemoryInjection } = await import(
|
|
4765
|
+
"../lib/memory-injection.js"
|
|
4766
|
+
);
|
|
4749
4767
|
const injection = buildMemoryInjection({
|
|
4750
4768
|
agentId: options.agentId || null,
|
|
4751
4769
|
query: options.recallQuery || "",
|
|
@@ -4835,8 +4853,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
4835
4853
|
// Observe-only, best-effort — never blocks entering the REPL.
|
|
4836
4854
|
if (_settingsHooks && _startupResumeCommitted) {
|
|
4837
4855
|
try {
|
|
4838
|
-
const { runObserveHooks } =
|
|
4839
|
-
|
|
4856
|
+
const { runObserveHooks } = await import(
|
|
4857
|
+
"../lib/settings-hook-events.js"
|
|
4858
|
+
);
|
|
4840
4859
|
await runObserveHooks(
|
|
4841
4860
|
_settingsHooks,
|
|
4842
4861
|
"SessionResume",
|
|
@@ -4874,8 +4893,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
4874
4893
|
// transcript snapshot and ZERO tools. Compact call/outcome metadata shares
|
|
4875
4894
|
// the session hash chain, while advice text itself is never persisted.
|
|
4876
4895
|
try {
|
|
4877
|
-
const { createConfiguredAdvisorRuntime } =
|
|
4878
|
-
|
|
4896
|
+
const { createConfiguredAdvisorRuntime } = await import(
|
|
4897
|
+
"../lib/advisor-runtime.js"
|
|
4898
|
+
);
|
|
4879
4899
|
const advisorOverrides = {};
|
|
4880
4900
|
if (options.advisorEnabled !== undefined) {
|
|
4881
4901
|
advisorOverrides.enabled = options.advisorEnabled === true;
|
|
@@ -5244,8 +5264,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
5244
5264
|
return;
|
|
5245
5265
|
}
|
|
5246
5266
|
try {
|
|
5247
|
-
const { defaultOpenBrowser } =
|
|
5248
|
-
|
|
5267
|
+
const { defaultOpenBrowser } = await import(
|
|
5268
|
+
"../lib/mcp-oauth.js"
|
|
5269
|
+
);
|
|
5249
5270
|
const opened = defaultOpenBrowser(request.url);
|
|
5250
5271
|
resolve(opened ? { action: "accept" } : { action: "cancel" });
|
|
5251
5272
|
} catch {
|
|
@@ -5288,8 +5309,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
5288
5309
|
let _channels = null;
|
|
5289
5310
|
if (options.channels) {
|
|
5290
5311
|
try {
|
|
5291
|
-
const { startChannels, formatChannelEvent } =
|
|
5292
|
-
|
|
5312
|
+
const { startChannels, formatChannelEvent } = await import(
|
|
5313
|
+
"../lib/channels/channel-manager.js"
|
|
5314
|
+
);
|
|
5293
5315
|
let channelsConfig = {};
|
|
5294
5316
|
try {
|
|
5295
5317
|
channelsConfig =
|
|
@@ -5582,8 +5604,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
5582
5604
|
const _notifyVersionSkew = async () => {
|
|
5583
5605
|
if (_versionSkewNotified) return;
|
|
5584
5606
|
try {
|
|
5585
|
-
const { detectVersionSkew, versionSkewMessage } =
|
|
5586
|
-
|
|
5607
|
+
const { detectVersionSkew, versionSkewMessage } = await import(
|
|
5608
|
+
"../lib/version-skew.js"
|
|
5609
|
+
);
|
|
5587
5610
|
const skew = detectVersionSkew();
|
|
5588
5611
|
if (skew) {
|
|
5589
5612
|
_versionSkewNotified = true;
|
|
@@ -5758,8 +5781,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
5758
5781
|
// to the model verbatim — the same fall-through an unmatched slash line
|
|
5759
5782
|
// already takes. /exit and /quit stay live so the session can be closed.
|
|
5760
5783
|
// Predicate + sentinel are pure (lib/slash-dispatch.js, unit-tested).
|
|
5761
|
-
const { slashDispatchBypassed, slashBypassSentinel } =
|
|
5762
|
-
|
|
5784
|
+
const { slashDispatchBypassed, slashBypassSentinel } = await import(
|
|
5785
|
+
"../lib/slash-dispatch.js"
|
|
5786
|
+
);
|
|
5763
5787
|
const _slashBypassed = slashDispatchBypassed(
|
|
5764
5788
|
rawLine,
|
|
5765
5789
|
_slashCommandsDisabled,
|
|
@@ -5788,8 +5812,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
5788
5812
|
// no LLM round-trip — and fold the output into the conversation context.
|
|
5789
5813
|
if (trimmed.startsWith("!") && trimmed.slice(1).trim()) {
|
|
5790
5814
|
try {
|
|
5791
|
-
const { runBangCommand, shouldRespondToBashCommands } =
|
|
5792
|
-
|
|
5815
|
+
const { runBangCommand, shouldRespondToBashCommands } = await import(
|
|
5816
|
+
"../lib/repl-bang-memorize.js"
|
|
5817
|
+
);
|
|
5793
5818
|
const res = runBangCommand(trimmed, { cwd: process.cwd() });
|
|
5794
5819
|
logger.log(chalk.gray(`$ ${res.cmd}`));
|
|
5795
5820
|
if (res.stdout)
|
|
@@ -5826,8 +5851,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
5826
5851
|
// cc.md (auto-loaded next session) and keep it active in this one.
|
|
5827
5852
|
if (trimmed.startsWith("#") && trimmed.slice(1).trim()) {
|
|
5828
5853
|
try {
|
|
5829
|
-
const { appendMemoryNote } =
|
|
5830
|
-
|
|
5854
|
+
const { appendMemoryNote } = await import(
|
|
5855
|
+
"../lib/repl-bang-memorize.js"
|
|
5856
|
+
);
|
|
5831
5857
|
const res = appendMemoryNote(trimmed, { cwd: process.cwd() });
|
|
5832
5858
|
messages.push({
|
|
5833
5859
|
role: "system",
|
|
@@ -6212,8 +6238,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
6212
6238
|
if (trimmed === "/init" || trimmed.startsWith("/init ")) {
|
|
6213
6239
|
const force = /(^|\s)(--force|-f)(\s|$)/.test(trimmed);
|
|
6214
6240
|
try {
|
|
6215
|
-
const { inventoryProject, renderMemoryFile } =
|
|
6216
|
-
|
|
6241
|
+
const { inventoryProject, renderMemoryFile } = await import(
|
|
6242
|
+
"../lib/project-inventory.js"
|
|
6243
|
+
);
|
|
6217
6244
|
const initCwd = process.cwd();
|
|
6218
6245
|
const target = path.join(initCwd, "cc.md");
|
|
6219
6246
|
if (fs.existsSync(target) && !force) {
|
|
@@ -6257,10 +6284,12 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
6257
6284
|
try {
|
|
6258
6285
|
const { parseAgentsCommand, formatAgentsList, formatAgentDetail } =
|
|
6259
6286
|
await import("./agents-status.js");
|
|
6260
|
-
const { discoverAgents, getAgent, scaffoldAgent } =
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
|
|
6287
|
+
const { discoverAgents, getAgent, scaffoldAgent } = await import(
|
|
6288
|
+
"../lib/agents.js"
|
|
6289
|
+
);
|
|
6290
|
+
const { listSubAgentProfiles } = await import(
|
|
6291
|
+
"../lib/sub-agent-profiles.js"
|
|
6292
|
+
);
|
|
6264
6293
|
const cmd = parseAgentsCommand(trimmed);
|
|
6265
6294
|
if (cmd.action === "help") {
|
|
6266
6295
|
logger.log(
|
|
@@ -6316,8 +6345,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
6316
6345
|
|
|
6317
6346
|
if (trimmed === "/sub-agents" || trimmed === "/subagents") {
|
|
6318
6347
|
try {
|
|
6319
|
-
const { SubAgentRegistry } =
|
|
6320
|
-
|
|
6348
|
+
const { SubAgentRegistry } = await import(
|
|
6349
|
+
"../lib/sub-agent-registry.js"
|
|
6350
|
+
);
|
|
6321
6351
|
const registry = SubAgentRegistry.getInstance();
|
|
6322
6352
|
const active = registry.getActive();
|
|
6323
6353
|
const history = registry.getHistory();
|
|
@@ -6369,8 +6399,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
6369
6399
|
// user could silently switch to a retired id and only learn of it when
|
|
6370
6400
|
// the next turn fails with an opaque "model not found".
|
|
6371
6401
|
try {
|
|
6372
|
-
const { maybeWarnDeprecatedModel } =
|
|
6373
|
-
|
|
6402
|
+
const { maybeWarnDeprecatedModel } = await import(
|
|
6403
|
+
"../lib/model-deprecation.js"
|
|
6404
|
+
);
|
|
6374
6405
|
maybeWarnDeprecatedModel({ model });
|
|
6375
6406
|
} catch {
|
|
6376
6407
|
// deprecation notice is best-effort
|
|
@@ -6465,8 +6496,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
6465
6496
|
// One-shot advice is queued as an ephemeral prepareCall suffix, requiring
|
|
6466
6497
|
// the main agent to validate it locally on its next model/tool turn.
|
|
6467
6498
|
{
|
|
6468
|
-
const { parseAdvisorCommand, executeAdvisorCommand } =
|
|
6469
|
-
|
|
6499
|
+
const { parseAdvisorCommand, executeAdvisorCommand } = await import(
|
|
6500
|
+
"./advisor-command.js"
|
|
6501
|
+
);
|
|
6470
6502
|
const advisorCommand = parseAdvisorCommand(trimmed);
|
|
6471
6503
|
if (advisorCommand) {
|
|
6472
6504
|
const result = await executeAdvisorCommand(advisorCommand, {
|
|
@@ -6505,8 +6537,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
6505
6537
|
// Stash the conversation first so `/rewind clear` can restore it
|
|
6506
6538
|
// (Claude-Code 2.1.191). A no-op /clear (nothing to stash) keeps any
|
|
6507
6539
|
// existing restorable snapshot.
|
|
6508
|
-
const { snapshotClearedConversation } =
|
|
6509
|
-
|
|
6540
|
+
const { snapshotClearedConversation } = await import(
|
|
6541
|
+
"../lib/repl-rewind.js"
|
|
6542
|
+
);
|
|
6510
6543
|
const snap = snapshotClearedConversation(messages, _checkpointMarks);
|
|
6511
6544
|
if (snap) _clearedConversation = snap;
|
|
6512
6545
|
messages.length = 1; // Keep system prompt
|
|
@@ -6527,8 +6560,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
6527
6560
|
) {
|
|
6528
6561
|
try {
|
|
6529
6562
|
const arg = trimmed.slice("/terminal-setup".length).trim();
|
|
6530
|
-
const { runTerminalSetup } =
|
|
6531
|
-
|
|
6563
|
+
const { runTerminalSetup } = await import(
|
|
6564
|
+
"../commands/terminal-setup.js"
|
|
6565
|
+
);
|
|
6532
6566
|
const res = runTerminalSetup({ apply: arg === "--apply" });
|
|
6533
6567
|
for (const l of res.lines) logger.log(l);
|
|
6534
6568
|
} catch (err) {
|
|
@@ -6832,8 +6866,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
6832
6866
|
if (trimmed === "/output-style" || trimmed.startsWith("/output-style ")) {
|
|
6833
6867
|
const arg = trimmed.slice("/output-style".length).trim();
|
|
6834
6868
|
try {
|
|
6835
|
-
const { discoverOutputStyles, getOutputStyle } =
|
|
6836
|
-
|
|
6869
|
+
const { discoverOutputStyles, getOutputStyle } = await import(
|
|
6870
|
+
"../lib/output-styles.js"
|
|
6871
|
+
);
|
|
6837
6872
|
if (!arg) {
|
|
6838
6873
|
logger.log(chalk.bold("Output styles:"));
|
|
6839
6874
|
for (const s of discoverOutputStyles(process.cwd())) {
|
|
@@ -6901,13 +6936,15 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
6901
6936
|
// (byte-unchanged) without a registered CwdChanged hook.
|
|
6902
6937
|
if (_settingsHooks && oldCwd !== newCwd) {
|
|
6903
6938
|
try {
|
|
6904
|
-
const { runCwdChangedHooks, dispatchAsyncHooks } =
|
|
6905
|
-
|
|
6939
|
+
const { runCwdChangedHooks, dispatchAsyncHooks } = await import(
|
|
6940
|
+
"../lib/settings-hook-events.js"
|
|
6941
|
+
);
|
|
6906
6942
|
const payload = { oldCwd, newCwd, sessionId };
|
|
6907
6943
|
await runCwdChangedHooks(_settingsHooks, payload);
|
|
6908
6944
|
if (!_asyncHookSupervisor) {
|
|
6909
|
-
const { AsyncHookSupervisor } =
|
|
6910
|
-
|
|
6945
|
+
const { AsyncHookSupervisor } = await import(
|
|
6946
|
+
"../lib/async-hook-supervisor.js"
|
|
6947
|
+
);
|
|
6911
6948
|
_asyncHookSupervisor = new AsyncHookSupervisor({
|
|
6912
6949
|
persistStats: true,
|
|
6913
6950
|
});
|
|
@@ -6967,8 +7004,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
6967
7004
|
(parsed.command === "turn" || parsed.command === "branch")
|
|
6968
7005
|
) {
|
|
6969
7006
|
try {
|
|
6970
|
-
const { loadTurnBindingLog } =
|
|
6971
|
-
|
|
7007
|
+
const { loadTurnBindingLog } = await import(
|
|
7008
|
+
"../lib/turn-binding-store.js"
|
|
7009
|
+
);
|
|
6972
7010
|
_persistedBinding = loadTurnBindingLog(sessionId);
|
|
6973
7011
|
} catch {
|
|
6974
7012
|
/* marks-only fallback */
|
|
@@ -7027,8 +7065,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
7027
7065
|
logger.error("Could not plan a branch from that turn.");
|
|
7028
7066
|
} else {
|
|
7029
7067
|
try {
|
|
7030
|
-
const { createBranchSession } =
|
|
7031
|
-
|
|
7068
|
+
const { createBranchSession } = await import(
|
|
7069
|
+
"../harness/jsonl-session-store.js"
|
|
7070
|
+
);
|
|
7032
7071
|
const res = createBranchSession({
|
|
7033
7072
|
branchSessionId: plan.branchSessionId,
|
|
7034
7073
|
parentSessionId: sessionId,
|
|
@@ -7162,8 +7201,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
7162
7201
|
.toLowerCase();
|
|
7163
7202
|
if (ans === "" || ans === "y" || ans === "yes") {
|
|
7164
7203
|
try {
|
|
7165
|
-
const { rewindTo } =
|
|
7166
|
-
|
|
7204
|
+
const { rewindTo } = await import(
|
|
7205
|
+
"../lib/checkpoint-store.js"
|
|
7206
|
+
);
|
|
7167
7207
|
const r = rewindTo(process.cwd(), cp.id, {
|
|
7168
7208
|
session: sessionId,
|
|
7169
7209
|
});
|
|
@@ -7213,8 +7253,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
7213
7253
|
// window. Reuses the same categorizer + estimator as the archived view.
|
|
7214
7254
|
try {
|
|
7215
7255
|
const { categorizeContext } = await import("../commands/context.js");
|
|
7216
|
-
const { estimateTokens } =
|
|
7217
|
-
|
|
7256
|
+
const { estimateTokens } = await import(
|
|
7257
|
+
"../harness/prompt-compressor.js"
|
|
7258
|
+
);
|
|
7218
7259
|
const { buckets, counts, total } = categorizeContext(
|
|
7219
7260
|
messages,
|
|
7220
7261
|
estimateTokens,
|
|
@@ -7247,13 +7288,32 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
7247
7288
|
: ""
|
|
7248
7289
|
}`,
|
|
7249
7290
|
);
|
|
7291
|
+
const { default: sourceLedger } = await import(
|
|
7292
|
+
"../lib/context-source-ledger.js"
|
|
7293
|
+
);
|
|
7294
|
+
const attribution = sourceLedger.getTokenReport({ sessionId });
|
|
7295
|
+
if (attribution.entries) {
|
|
7296
|
+
logger.log(
|
|
7297
|
+
chalk.bold(
|
|
7298
|
+
"\nRecorded context sources (separate from request usage):",
|
|
7299
|
+
),
|
|
7300
|
+
);
|
|
7301
|
+
for (const [source, tokens] of Object.entries(attribution.bySource))
|
|
7302
|
+
logger.log(` ${source}: ${tokens} tok`);
|
|
7303
|
+
logger.log(
|
|
7304
|
+
chalk.gray(
|
|
7305
|
+
` estimated ${attribution.byBasis.estimated} tok; observed ${attribution.byBasis.observed} tok`,
|
|
7306
|
+
),
|
|
7307
|
+
);
|
|
7308
|
+
}
|
|
7250
7309
|
// MCP tool-schema share of the window (gap-analysis 第二阶段 item 3):
|
|
7251
7310
|
// the tools parameter rides along on EVERY request but isn't part of
|
|
7252
7311
|
// `messages`, so it's invisible to the role buckets above. Show the
|
|
7253
7312
|
// per-server schema cost + tool-search state + optimization advice.
|
|
7254
7313
|
if (_adhocMcp?.extraToolDefinitions?.length) {
|
|
7255
|
-
const { describeMcpToolContext } =
|
|
7256
|
-
|
|
7314
|
+
const { describeMcpToolContext } = await import(
|
|
7315
|
+
"../runtime/mcp-tool-search.js"
|
|
7316
|
+
);
|
|
7257
7317
|
const info = describeMcpToolContext(_adhocMcp, {
|
|
7258
7318
|
estimate: estimateTokens,
|
|
7259
7319
|
model,
|
|
@@ -7720,16 +7780,19 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
7720
7780
|
if (trimmed === "/reload-plugins") {
|
|
7721
7781
|
try {
|
|
7722
7782
|
const cwd = process.cwd();
|
|
7723
|
-
const { reloadPluginRuntime } =
|
|
7724
|
-
|
|
7783
|
+
const { reloadPluginRuntime } = await import(
|
|
7784
|
+
"../lib/plugin-runtime/reload.js"
|
|
7785
|
+
);
|
|
7725
7786
|
const sum = reloadPluginRuntime({ cwd });
|
|
7726
7787
|
|
|
7727
7788
|
// Re-merge plugin hooks onto the user's settings hooks (live session).
|
|
7728
7789
|
try {
|
|
7729
|
-
const { loadHooks, attachAuthorityErrors } =
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7790
|
+
const { loadHooks, attachAuthorityErrors } = await import(
|
|
7791
|
+
"../lib/settings-hooks.cjs"
|
|
7792
|
+
);
|
|
7793
|
+
const { mergePluginHooks } = await import(
|
|
7794
|
+
"../lib/plugin-runtime/hooks.js"
|
|
7795
|
+
);
|
|
7733
7796
|
const loaded = loadHooks({ cwd });
|
|
7734
7797
|
const merged = mergePluginHooks(
|
|
7735
7798
|
attachAuthorityErrors(loaded.hooks, loaded.authorityErrors),
|
|
@@ -7758,8 +7821,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
7758
7821
|
// react (e.g. re-audit the newly-trusted config). Best-effort.
|
|
7759
7822
|
if (_settingsHooks) {
|
|
7760
7823
|
try {
|
|
7761
|
-
const { runObserveHooks, dispatchAsyncHooks } =
|
|
7762
|
-
|
|
7824
|
+
const { runObserveHooks, dispatchAsyncHooks } = await import(
|
|
7825
|
+
"../lib/settings-hook-events.js"
|
|
7826
|
+
);
|
|
7763
7827
|
const payload = {
|
|
7764
7828
|
session_id: sessionId || null,
|
|
7765
7829
|
source: "reload-plugins",
|
|
@@ -7768,8 +7832,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
7768
7832
|
cwd,
|
|
7769
7833
|
});
|
|
7770
7834
|
if (!_asyncHookSupervisor) {
|
|
7771
|
-
const { AsyncHookSupervisor } =
|
|
7772
|
-
|
|
7835
|
+
const { AsyncHookSupervisor } = await import(
|
|
7836
|
+
"../lib/async-hook-supervisor.js"
|
|
7837
|
+
);
|
|
7773
7838
|
_asyncHookSupervisor = new AsyncHookSupervisor({
|
|
7774
7839
|
persistStats: true,
|
|
7775
7840
|
});
|
|
@@ -7785,16 +7850,18 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
7785
7850
|
|
|
7786
7851
|
// Restart background monitors with the fresh, trust-gated set.
|
|
7787
7852
|
try {
|
|
7788
|
-
const { collectPluginMonitors } =
|
|
7789
|
-
|
|
7853
|
+
const { collectPluginMonitors } = await import(
|
|
7854
|
+
"../lib/plugin-runtime/monitors.js"
|
|
7855
|
+
);
|
|
7790
7856
|
if (_pluginMonitors) {
|
|
7791
7857
|
_pluginMonitors.stopAll();
|
|
7792
7858
|
_pluginMonitors = null;
|
|
7793
7859
|
}
|
|
7794
7860
|
const monitors = collectPluginMonitors({ cwd });
|
|
7795
7861
|
if (monitors.length > 0) {
|
|
7796
|
-
const { PluginMonitorSupervisor } =
|
|
7797
|
-
|
|
7862
|
+
const { PluginMonitorSupervisor } = await import(
|
|
7863
|
+
"../lib/plugin-monitor-supervisor.js"
|
|
7864
|
+
);
|
|
7798
7865
|
_pluginMonitors = new PluginMonitorSupervisor();
|
|
7799
7866
|
_pluginMonitors.start(monitors);
|
|
7800
7867
|
}
|
|
@@ -7804,8 +7871,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
7804
7871
|
|
|
7805
7872
|
// Re-apply legacy plugin bin PATH; strict bins remain direct-only.
|
|
7806
7873
|
try {
|
|
7807
|
-
const { applyPluginBinPath } =
|
|
7808
|
-
|
|
7874
|
+
const { applyPluginBinPath } = await import(
|
|
7875
|
+
"../lib/plugin-runtime/bin.js"
|
|
7876
|
+
);
|
|
7809
7877
|
if (_pluginBinRestore) _pluginBinRestore();
|
|
7810
7878
|
const res = applyPluginBinPath({ cwd });
|
|
7811
7879
|
_pluginBinRestore = res.restore;
|
|
@@ -7815,8 +7883,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
7815
7883
|
|
|
7816
7884
|
// Re-apply plugin default env vars (a newly-trusted plugin's settings).
|
|
7817
7885
|
try {
|
|
7818
|
-
const { applyPluginSettingsEnv } =
|
|
7819
|
-
|
|
7886
|
+
const { applyPluginSettingsEnv } = await import(
|
|
7887
|
+
"../lib/plugin-runtime/settings.js"
|
|
7888
|
+
);
|
|
7820
7889
|
if (_pluginSettingsRestore) _pluginSettingsRestore();
|
|
7821
7890
|
const res = applyPluginSettingsEnv({ cwd });
|
|
7822
7891
|
_pluginSettingsRestore = res.restore;
|
|
@@ -7849,8 +7918,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
7849
7918
|
// cwd so it follows `/cd`, using this session's provider/model.
|
|
7850
7919
|
if (trimmed === "/review" || trimmed.startsWith("/review ")) {
|
|
7851
7920
|
const rest = trimmed.slice("/review".length).trim();
|
|
7852
|
-
const { parseReviewReplArgs, describeReviewArgs } =
|
|
7853
|
-
|
|
7921
|
+
const { parseReviewReplArgs, describeReviewArgs } = await import(
|
|
7922
|
+
"./review-args.js"
|
|
7923
|
+
);
|
|
7854
7924
|
const { opts: reviewOpts, errors } = parseReviewReplArgs(rest);
|
|
7855
7925
|
if (errors.length) {
|
|
7856
7926
|
for (const e of errors) logger.error(chalk.red(`/review: ${e}`));
|
|
@@ -8061,8 +8131,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
8061
8131
|
logger.log("");
|
|
8062
8132
|
} else if (subCmd === "debate" && coworkInput) {
|
|
8063
8133
|
try {
|
|
8064
|
-
const { startDebate } =
|
|
8065
|
-
|
|
8134
|
+
const { startDebate } = await import(
|
|
8135
|
+
"../lib/cowork/debate-review-cli.js"
|
|
8136
|
+
);
|
|
8066
8137
|
let code = coworkInput;
|
|
8067
8138
|
let targetLabel = coworkInput;
|
|
8068
8139
|
const resolved = path.resolve(coworkInput);
|
|
@@ -8112,8 +8183,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
8112
8183
|
}
|
|
8113
8184
|
} else if (subCmd === "compare" && coworkInput) {
|
|
8114
8185
|
try {
|
|
8115
|
-
const { compare } =
|
|
8116
|
-
|
|
8186
|
+
const { compare } = await import(
|
|
8187
|
+
"../lib/cowork/ab-comparator-cli.js"
|
|
8188
|
+
);
|
|
8117
8189
|
process.stdout.write(chalk.gray("\n Generating variants...\n"));
|
|
8118
8190
|
const result = await compare({
|
|
8119
8191
|
prompt: coworkInput,
|
|
@@ -8145,8 +8217,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
8145
8217
|
}
|
|
8146
8218
|
} else if (subCmd === "graph" && coworkInput) {
|
|
8147
8219
|
try {
|
|
8148
|
-
const { buildKnowledgeGraph } =
|
|
8149
|
-
|
|
8220
|
+
const { buildKnowledgeGraph } = await import(
|
|
8221
|
+
"../lib/cowork/code-knowledge-graph-cli.js"
|
|
8222
|
+
);
|
|
8150
8223
|
process.stdout.write(chalk.gray("\n Analyzing code graph...\n"));
|
|
8151
8224
|
const result = await buildKnowledgeGraph({
|
|
8152
8225
|
targetPath: path.resolve(coworkInput),
|
|
@@ -8183,8 +8256,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
8183
8256
|
}
|
|
8184
8257
|
} else if (subCmd === "decision" && coworkInput) {
|
|
8185
8258
|
try {
|
|
8186
|
-
const { extractDecisions } =
|
|
8187
|
-
|
|
8259
|
+
const { extractDecisions } = await import(
|
|
8260
|
+
"../lib/cowork/decision-kb-cli.js"
|
|
8261
|
+
);
|
|
8188
8262
|
process.stdout.write(chalk.gray("\n Analyzing decisions...\n"));
|
|
8189
8263
|
const result = await extractDecisions({
|
|
8190
8264
|
targetPath: path.resolve(coworkInput),
|
|
@@ -8450,8 +8524,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
8450
8524
|
{ messages, signal: _turnAbort?.signal || null },
|
|
8451
8525
|
);
|
|
8452
8526
|
if (result.ok) {
|
|
8453
|
-
const { renderAdvisorAdvice } =
|
|
8454
|
-
|
|
8527
|
+
const { renderAdvisorAdvice } = await import(
|
|
8528
|
+
"./advisor-command.js"
|
|
8529
|
+
);
|
|
8455
8530
|
logger.log(renderAdvisorAdvice(result));
|
|
8456
8531
|
} else if (result.effect !== "disabled") {
|
|
8457
8532
|
logger.warn(result.error);
|
|
@@ -8553,10 +8628,12 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
8553
8628
|
const planRequest =
|
|
8554
8629
|
subCmd.slice(11).trim() || "Help me with the current task";
|
|
8555
8630
|
try {
|
|
8556
|
-
const { CLIInteractivePlanner } =
|
|
8557
|
-
|
|
8558
|
-
|
|
8559
|
-
|
|
8631
|
+
const { CLIInteractivePlanner } = await import(
|
|
8632
|
+
"../lib/interactive-planner.js"
|
|
8633
|
+
);
|
|
8634
|
+
const { TerminalInteractionAdapter } = await import(
|
|
8635
|
+
"../lib/interaction-adapter.js"
|
|
8636
|
+
);
|
|
8560
8637
|
const chatFn = createChatFn({
|
|
8561
8638
|
...(evolutionIngress === null ? {} : { evolutionIngress }),
|
|
8562
8639
|
provider,
|
|
@@ -8635,8 +8712,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
8635
8712
|
// a note) and `cc memory recall` (scoped store).
|
|
8636
8713
|
if (trimmed === "/memory" || trimmed.startsWith("/memory ")) {
|
|
8637
8714
|
try {
|
|
8638
|
-
const { loadProjectInstructions } =
|
|
8639
|
-
|
|
8715
|
+
const { loadProjectInstructions } = await import(
|
|
8716
|
+
"../lib/project-instructions.js"
|
|
8717
|
+
);
|
|
8640
8718
|
const { renderMemoryFiles } = await import("./memory-status.js");
|
|
8641
8719
|
const loaded = loadProjectInstructions({ cwd: process.cwd() });
|
|
8642
8720
|
logger.log(
|
|
@@ -8728,8 +8806,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
8728
8806
|
} catch (_err) {
|
|
8729
8807
|
// config read is best-effort; checks degrade gracefully
|
|
8730
8808
|
}
|
|
8731
|
-
const { buildDoctorChecks, renderDoctor } =
|
|
8732
|
-
|
|
8809
|
+
const { buildDoctorChecks, renderDoctor } = await import(
|
|
8810
|
+
"./doctor-status.js"
|
|
8811
|
+
);
|
|
8733
8812
|
const { ideToolNames } = await import("./ide-status.js");
|
|
8734
8813
|
const checks = buildDoctorChecks({
|
|
8735
8814
|
config,
|
|
@@ -9202,8 +9281,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
9202
9281
|
// is observe-only). block → abort the turn; context → inject before the turn.
|
|
9203
9282
|
if (_settingsHooks) {
|
|
9204
9283
|
try {
|
|
9205
|
-
const { runUserPromptSubmitHooks } =
|
|
9206
|
-
|
|
9284
|
+
const { runUserPromptSubmitHooks } = await import(
|
|
9285
|
+
"../lib/settings-hook-events.js"
|
|
9286
|
+
);
|
|
9207
9287
|
const ups = await runUserPromptSubmitHooks(_settingsHooks, {
|
|
9208
9288
|
prompt: userContent,
|
|
9209
9289
|
cwd: process.cwd(),
|
|
@@ -9225,11 +9305,13 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
9225
9305
|
// long-running check (background tests, CI status) runs ALONGSIDE this
|
|
9226
9306
|
// turn without blocking it; its result/rewake surfaces on a later turn
|
|
9227
9307
|
// via the async-hook drain below. Lazily create the supervisor.
|
|
9228
|
-
const { dispatchAsyncHooks } =
|
|
9229
|
-
|
|
9308
|
+
const { dispatchAsyncHooks } = await import(
|
|
9309
|
+
"../lib/settings-hook-events.js"
|
|
9310
|
+
);
|
|
9230
9311
|
if (!_asyncHookSupervisor) {
|
|
9231
|
-
const { AsyncHookSupervisor } =
|
|
9232
|
-
|
|
9312
|
+
const { AsyncHookSupervisor } = await import(
|
|
9313
|
+
"../lib/async-hook-supervisor.js"
|
|
9314
|
+
);
|
|
9233
9315
|
_asyncHookSupervisor = new AsyncHookSupervisor({
|
|
9234
9316
|
persistStats: true,
|
|
9235
9317
|
});
|
|
@@ -9317,8 +9399,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
9317
9399
|
// Ephemeral: persistence stores effectivePrompt, not this snapshot.
|
|
9318
9400
|
// Best-effort; CC_IDE_CONTEXT=0 disables.
|
|
9319
9401
|
try {
|
|
9320
|
-
const { buildIdePromptContext, expandIdeMentions } =
|
|
9321
|
-
|
|
9402
|
+
const { buildIdePromptContext, expandIdeMentions } = await import(
|
|
9403
|
+
"../lib/ide-context.js"
|
|
9404
|
+
);
|
|
9322
9405
|
const hostMcp = _getReplHostMcp();
|
|
9323
9406
|
const ideCtx = await buildIdePromptContext(hostMcp);
|
|
9324
9407
|
if (ideCtx) userContent += `\n\n${ideCtx}`;
|
|
@@ -9417,8 +9500,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
9417
9500
|
if (sessionId && useJsonl) {
|
|
9418
9501
|
try {
|
|
9419
9502
|
if (!_turnBindingProducer) {
|
|
9420
|
-
const { createReplTurnBindingProducer } =
|
|
9421
|
-
|
|
9503
|
+
const { createReplTurnBindingProducer } = await import(
|
|
9504
|
+
"./repl-turn-binding.js"
|
|
9505
|
+
);
|
|
9422
9506
|
_turnBindingProducer = createReplTurnBindingProducer({
|
|
9423
9507
|
sessionId,
|
|
9424
9508
|
onError: (error, phase) => {
|
|
@@ -9452,8 +9536,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
9452
9536
|
const defs = CLISlotFiller.getSlotDefinitions(intent.type);
|
|
9453
9537
|
const missing = defs.required.filter((s) => !intent.entities[s]);
|
|
9454
9538
|
if (missing.length > 0) {
|
|
9455
|
-
const { TerminalInteractionAdapter } =
|
|
9456
|
-
|
|
9539
|
+
const { TerminalInteractionAdapter } = await import(
|
|
9540
|
+
"../lib/interaction-adapter.js"
|
|
9541
|
+
);
|
|
9457
9542
|
const interaction = new TerminalInteractionAdapter();
|
|
9458
9543
|
const filler = new CLISlotFiller({ interaction });
|
|
9459
9544
|
const result = await filler.fillSlots(intent, {
|
|
@@ -9542,8 +9627,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
9542
9627
|
const { resolveActiveGoal } = await import("../lib/goal-store.js");
|
|
9543
9628
|
const boundGoal = resolveActiveGoal({ sessionId });
|
|
9544
9629
|
if (boundGoal) {
|
|
9545
|
-
const { goalPrepareCall, composePrepareCall } =
|
|
9546
|
-
|
|
9630
|
+
const { goalPrepareCall, composePrepareCall } = await import(
|
|
9631
|
+
"../lib/goal-context.js"
|
|
9632
|
+
);
|
|
9547
9633
|
prepareCall = composePrepareCall([
|
|
9548
9634
|
defaultPrepareCall,
|
|
9549
9635
|
goalPrepareCall(boundGoal),
|
|
@@ -9569,8 +9655,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
9569
9655
|
}
|
|
9570
9656
|
return;
|
|
9571
9657
|
}
|
|
9572
|
-
const { renderAdvisorAdvice } =
|
|
9573
|
-
|
|
9658
|
+
const { renderAdvisorAdvice } = await import(
|
|
9659
|
+
"./advisor-command.js"
|
|
9660
|
+
);
|
|
9574
9661
|
process.stderr.write(`\n${renderAdvisorAdvice(result)}\n`);
|
|
9575
9662
|
},
|
|
9576
9663
|
});
|
|
@@ -9631,8 +9718,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
9631
9718
|
// hooks (fired inside the loop, per tool call) can be dispatched
|
|
9632
9719
|
// fire-and-forget; their results/rewakes drain into the next turn above.
|
|
9633
9720
|
if (_settingsHooks && !_asyncHookSupervisor) {
|
|
9634
|
-
const { AsyncHookSupervisor } =
|
|
9635
|
-
|
|
9721
|
+
const { AsyncHookSupervisor } = await import(
|
|
9722
|
+
"../lib/async-hook-supervisor.js"
|
|
9723
|
+
);
|
|
9636
9724
|
_asyncHookSupervisor = new AsyncHookSupervisor({
|
|
9637
9725
|
persistStats: true,
|
|
9638
9726
|
});
|
|
@@ -9704,6 +9792,7 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
9704
9792
|
thinkingBudget,
|
|
9705
9793
|
baseUrl: _visionLlm ? _visionLlm.baseUrl : baseUrl,
|
|
9706
9794
|
apiKey: _visionLlm ? _visionLlm.apiKey : apiKey,
|
|
9795
|
+
serviceTier: options.serviceTier,
|
|
9707
9796
|
contextEngine,
|
|
9708
9797
|
iterationBudget,
|
|
9709
9798
|
sessionId,
|
|
@@ -9817,8 +9906,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
9817
9906
|
const fsMod = await import("node:fs");
|
|
9818
9907
|
const judge = async (cond, { finalText }) => {
|
|
9819
9908
|
const { chatWithTools } = await import("../runtime/agent-core.js");
|
|
9820
|
-
const { firstBalancedJson } =
|
|
9821
|
-
|
|
9909
|
+
const { firstBalancedJson } = await import(
|
|
9910
|
+
"../lib/json-schema-output.js"
|
|
9911
|
+
);
|
|
9822
9912
|
const p =
|
|
9823
9913
|
`Judge whether this coding session met a completion condition.\n` +
|
|
9824
9914
|
`Condition: ${cond.text || cond.source}\n\n` +
|
|
@@ -9920,8 +10010,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
9920
10010
|
} else {
|
|
9921
10011
|
// Phase G #2 — route through StreamRouter so REPL / WS / future
|
|
9922
10012
|
// streaming providers share one StreamEvent protocol.
|
|
9923
|
-
const { streamAgentResponse } =
|
|
9924
|
-
|
|
10013
|
+
const { streamAgentResponse } = await import(
|
|
10014
|
+
"../lib/agent-stream.js"
|
|
10015
|
+
);
|
|
9925
10016
|
process.stdout.write("\n");
|
|
9926
10017
|
const noStream = options.noStream === true;
|
|
9927
10018
|
const streamResult = await streamAgentResponse(effectiveResponse, {
|
|
@@ -10078,8 +10169,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
10078
10169
|
// drain above). Best-effort — never break turn completion.
|
|
10079
10170
|
if (_settingsHooks) {
|
|
10080
10171
|
try {
|
|
10081
|
-
const { runObserveHooks, dispatchAsyncHooks } =
|
|
10082
|
-
|
|
10172
|
+
const { runObserveHooks, dispatchAsyncHooks } = await import(
|
|
10173
|
+
"../lib/settings-hook-events.js"
|
|
10174
|
+
);
|
|
10083
10175
|
await runObserveHooks(
|
|
10084
10176
|
_settingsHooks,
|
|
10085
10177
|
"Stop",
|
|
@@ -10087,8 +10179,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
10087
10179
|
{ cwd: process.cwd() },
|
|
10088
10180
|
);
|
|
10089
10181
|
if (!_asyncHookSupervisor) {
|
|
10090
|
-
const { AsyncHookSupervisor } =
|
|
10091
|
-
|
|
10182
|
+
const { AsyncHookSupervisor } = await import(
|
|
10183
|
+
"../lib/async-hook-supervisor.js"
|
|
10184
|
+
);
|
|
10092
10185
|
_asyncHookSupervisor = new AsyncHookSupervisor({
|
|
10093
10186
|
persistStats: true,
|
|
10094
10187
|
});
|
|
@@ -10273,8 +10366,9 @@ async function startAgentReplInWorkspaceOwned(
|
|
|
10273
10366
|
// settings.json SessionEnd hooks (observe-only) when the REPL exits.
|
|
10274
10367
|
if (_settingsHooks) {
|
|
10275
10368
|
try {
|
|
10276
|
-
const { runObserveHooks } =
|
|
10277
|
-
|
|
10369
|
+
const { runObserveHooks } = await import(
|
|
10370
|
+
"../lib/settings-hook-events.js"
|
|
10371
|
+
);
|
|
10278
10372
|
await runObserveHooks(
|
|
10279
10373
|
_settingsHooks,
|
|
10280
10374
|
"SessionEnd",
|