@kodax-ai/kodax 0.7.97-beta.2 → 0.7.97-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +96 -0
- package/README.md +55 -2
- package/README_CN.md +37 -1
- package/dist/artifacts/dist/contract.js +1 -1
- package/dist/artifacts/dist/contract.js.map +1 -1
- package/dist/artifacts/dist/document-render.d.ts +1 -1
- package/dist/artifacts/dist/document-render.js +41 -10
- package/dist/artifacts/dist/document-render.js.map +1 -1
- package/dist/artifacts/dist/kodax.js +1 -1
- package/dist/artifacts/dist/kodax.js.map +1 -1
- package/dist/artifacts/dist/libreoffice.d.ts +6 -1
- package/dist/artifacts/dist/libreoffice.js +37 -13
- package/dist/artifacts/dist/libreoffice.js.map +1 -1
- package/dist/artifacts/dist/runtime.js +13 -6
- package/dist/artifacts/dist/runtime.js.map +1 -1
- package/dist/artifacts/skills/artifact-review/SKILL.md +5 -1
- package/dist/chunks/agent-NWQPMZ7B.js +2 -0
- package/dist/chunks/agent-adapter-V3IPADCX.js +2 -0
- package/dist/chunks/argument-completer-VNKHT4X4.js +2 -0
- package/dist/chunks/{bedrock-native-Z5VNWF5U.js → bedrock-native-OEPOBW6W.js} +1 -1
- package/dist/chunks/{chunk-NSR4RW2F.js → chunk-3I2MIS4D.js} +1 -1
- package/dist/chunks/{chunk-RYBUYHDL.js → chunk-3Y5PBEOD.js} +1 -1
- package/dist/chunks/chunk-4FVCMKG2.js +20 -0
- package/dist/chunks/{chunk-F6GJXQNA.js → chunk-4GYXZTOD.js} +7 -7
- package/dist/chunks/{chunk-EISRVOBJ.js → chunk-4Z7ZHL6V.js} +2 -2
- package/dist/chunks/{chunk-W2CWO4PQ.js → chunk-576AAIQM.js} +1 -1
- package/dist/chunks/chunk-5E2P4RYS.js +4 -0
- package/dist/chunks/{chunk-X5M7TLJV.js → chunk-5LFQ5FVY.js} +1 -1
- package/dist/chunks/{chunk-WMMESRP3.js → chunk-6RDMSU4B.js} +1 -1
- package/dist/chunks/{chunk-3CP7AUWY.js → chunk-7BA4TSKC.js} +1 -1
- package/dist/chunks/{chunk-I325ER7D.js → chunk-AUU3N4V4.js} +1 -1
- package/dist/chunks/{chunk-DCE7XQUG.js → chunk-AYDLX2UK.js} +1 -1
- package/dist/chunks/{chunk-D36OIMV7.js → chunk-BP3NAYKY.js} +64 -64
- package/dist/chunks/{chunk-6TITQQAI.js → chunk-BSCSKJNC.js} +230 -229
- package/dist/chunks/{chunk-2HH5AS7E.js → chunk-DAQGOWKD.js} +88 -462
- package/dist/chunks/{chunk-UF3GZ5PO.js → chunk-EZF6ZRCO.js} +1 -1
- package/dist/chunks/chunk-F2TFWNVZ.js +2 -0
- package/dist/chunks/{chunk-53CJDQS2.js → chunk-FVXZ5L33.js} +1 -1
- package/dist/chunks/{chunk-MCDZNQWD.js → chunk-G32BMSHH.js} +75 -71
- package/dist/chunks/chunk-HJLYZ5AX.js +361 -0
- package/dist/chunks/{chunk-P55RJIOG.js → chunk-IOIFCU46.js} +1 -1
- package/dist/chunks/{chunk-DV5YPYLW.js → chunk-IR46ZHXU.js} +1 -1
- package/dist/chunks/chunk-NJDR5EEF.js +6 -0
- package/dist/chunks/{chunk-KDSO7V4O.js → chunk-OC3DQXN6.js} +1 -1
- package/dist/chunks/{chunk-J2L2NK6E.js → chunk-OMVAPRQI.js} +90 -57
- package/dist/chunks/chunk-OXCB2TRF.js +42 -0
- package/dist/chunks/{chunk-C6JGLEYD.js → chunk-P6R6V7EW.js} +1 -1
- package/dist/chunks/{chunk-SK3RRGHJ.js → chunk-PFBZ4ZXO.js} +28 -28
- package/dist/chunks/{chunk-V2XJSFFE.js → chunk-QDE6THC5.js} +1 -1
- package/dist/chunks/{chunk-EPK6EWRI.js → chunk-QRYEP34M.js} +1 -1
- package/dist/chunks/chunk-ROWYE472.js +460 -0
- package/dist/chunks/{chunk-R42S4BLA.js → chunk-SQGESMNC.js} +1 -1
- package/dist/chunks/{chunk-XZSFUGPN.js → chunk-U73VEVMP.js} +1 -1
- package/dist/chunks/{chunk-D425EZGC.js → chunk-V2TG7GNW.js} +1 -1
- package/dist/chunks/{chunk-QSZCR5GC.js → chunk-VRO2CDBY.js} +97 -97
- package/dist/chunks/{chunk-BBZWF2EA.js → chunk-WMQQQY3D.js} +1 -1
- package/dist/chunks/{chunk-JAF2YLZO.js → chunk-X3YYJJTF.js} +2 -2
- package/dist/chunks/{chunk-UL6YIT4M.js → chunk-XYRI6ER5.js} +1 -1
- package/dist/chunks/chunk-YRPB3LID.js +3 -0
- package/dist/chunks/{chunk-5MUVRFMU.js → chunk-ZDAU3LZ2.js} +1 -1
- package/dist/chunks/{chunk-WWPVEK6B.js → chunk-ZP3YSYWM.js} +10 -10
- package/dist/chunks/{client-LTIFNED5.js → client-NJ32JBC3.js} +1 -1
- package/dist/chunks/compaction-config-JBQGU3NO.js +2 -0
- package/dist/chunks/{construction-bootstrap-OAZKGI5Y.js → construction-bootstrap-CM47ZXG7.js} +1 -1
- package/dist/chunks/dist-O6BHIQEP.js +2 -0
- package/dist/chunks/{google-native-WLL27OV7.js → google-native-BV5GKT5B.js} +1 -1
- package/dist/chunks/host-PI5NL4W4.js +2 -0
- package/dist/chunks/{mistral-native-JXPIDDYZ.js → mistral-native-X42JCFZH.js} +1 -1
- package/dist/chunks/{model-DZF6URW3.js → model-MT3WJX76.js} +1 -1
- package/dist/chunks/{permission-YVVMLQ5I.js → permission-YVDVSE6H.js} +1 -1
- package/dist/chunks/{pi-messages-5LLOZH57.js → pi-messages-DVJANXV5.js} +1 -1
- package/dist/chunks/readline-helpers-5JS7UGTE.js +2 -0
- package/dist/chunks/run-manager-Y6VYEWSJ.js +2 -0
- package/dist/chunks/running-session-ANMBA5XV.js +2 -0
- package/dist/chunks/skills-XL2XIBWV.js +2 -0
- package/dist/chunks/{tool-dispatch-MLM3QTSU.js → tool-dispatch-2FOG65FC.js} +1 -1
- package/dist/chunks/{utils-2QNMYRGA.js → utils-XZ22R6VB.js} +1 -1
- package/dist/client-history.js +2 -0
- package/dist/history-turn.js +3 -0
- package/dist/index.d.ts +19 -19
- package/dist/index.js +2 -2
- package/dist/kodax_bootstrap.js +1 -1
- package/dist/kodax_cli.js +1472 -1810
- package/dist/kodax_doctor.js +1 -1
- package/dist/maintenance-scheduler.js +2 -0
- package/dist/manual-topics.json +32 -3
- package/dist/native/win32-x64/kodax-windows-sandbox.exe +0 -0
- package/dist/native/win32-x64/kodax-windows-text-transaction.node +0 -0
- package/dist/native/win32-x64/manifest.json +2 -2
- package/dist/one-shot-task.js +1 -1
- package/dist/provider-auth-cli.js +1 -1
- package/dist/runtime-daemon-schema.json +1 -1
- package/dist/sandbox-network-broker.js +93 -441
- package/dist/sdk-a2a.d.ts +13 -13
- package/dist/sdk-a2a.js +1 -1
- package/dist/sdk-agent.d.ts +17 -12
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-client.d.ts +6 -6
- package/dist/sdk-client.js +1 -1
- package/dist/sdk-coding.d.ts +17 -17
- package/dist/sdk-coding.js +1 -1
- package/dist/sdk-experimental-memory.d.ts +2 -2
- package/dist/sdk-experimental-memory.js +1 -1
- package/dist/sdk-llm.d.ts +4 -2
- package/dist/sdk-llm.js +1 -1
- package/dist/sdk-mcp.js +1 -1
- package/dist/sdk-media.d.ts +13 -13
- package/dist/sdk-media.js +1 -1
- package/dist/sdk-repl.d.ts +16 -16
- package/dist/sdk-repl.js +1 -1
- package/dist/sdk-runtime.d.ts +46 -46
- package/dist/sdk-runtime.js +1 -1
- package/dist/sdk-sandbox.js +1 -1
- package/dist/sdk-session.d.ts +7 -7
- package/dist/sdk-session.js +1 -1
- package/dist/sdk-skills.js +1 -1
- package/dist/semantic-worker.js +87 -435
- package/dist/storage-repair-cli.js +1 -1
- package/dist/types-chunks/{bash-prefix-extractor.d-CJliu5-D.d.ts → bash-prefix-extractor.d-BghXa_md.d.ts} +9 -3
- package/dist/types-chunks/{capsule.d-EMwSALqK.d.ts → capsule.d-BTlvC5qq.d.ts} +4 -4
- package/dist/types-chunks/{client-contract-B7q69yMA.d.ts → client-contract-B7ZSFKTv.d.ts} +52 -4
- package/dist/types-chunks/{controller.d-C0SAuNKu.d.ts → controller.d-Btu5FDdw.d.ts} +1 -1
- package/dist/types-chunks/{controller.d-D-hPLKaA.d.ts → controller.d-D6rEz5LS.d.ts} +3 -3
- package/dist/types-chunks/{history-retrieval.d-BwEUR9cb.d.ts → history-retrieval.d-B_AriUJp.d.ts} +1 -1
- package/dist/types-chunks/{manifest.d-YE3-AIeO.d.ts → manifest.d-Yyce-hHj.d.ts} +1 -1
- package/dist/types-chunks/{public-api.d-BhDU643p.d.ts → public-api.d-BLv3lFmw.d.ts} +9 -4
- package/dist/types-chunks/{review-inbox.d-Bgt46S7L.d.ts → review-inbox.d-yREk25Vf.d.ts} +2 -0
- package/dist/types-chunks/{review-packet.d-ChOfJaNI.d.ts → review-packet.d-xwXxHmML.d.ts} +1 -1
- package/dist/types-chunks/{run-manager.d-ChzguipG.d.ts → run-manager.d-D4sa9JYz.d.ts} +26 -12
- package/dist/types-chunks/{runtime-client-info-P_mRDG7j.d.ts → runtime-client-info-oRMrkHmb.d.ts} +2 -2
- package/dist/types-chunks/{runtime-event-BW5Pla7a.d.ts → runtime-event-BOyaILWg.d.ts} +3 -1
- package/dist/types-chunks/{sdk-runtime-cDe7qmN3.d.ts → sdk-runtime-CYyXmQok.d.ts} +27 -13
- package/dist/types-chunks/{sdk-session-D3pcSbnA.d.ts → sdk-session-D6mS5qgO.d.ts} +6 -3
- package/dist/types-chunks/{skill-invocation-error.d-gsNNDnnt.d.ts → skill-invocation-error.d-Be3qg4JQ.d.ts} +3 -3
- package/dist/types-chunks/{trusted-repl-entry-Bbkd2HlO.d.ts → trusted-repl-entry-YWNc4m-Z.d.ts} +7 -7
- package/dist/types-chunks/{types.d-BlXTogOo.d.ts → types.d-BQ-hbni4.d.ts} +1 -1
- package/dist/types-chunks/{utils.d-CxHyBvO6.d.ts → utils.d-C0F3Uf2X.d.ts} +6 -6
- package/dist/windows-effect-job-programs.json +4 -0
- package/docs/ARTIFACT_SDK.md +3 -3
- package/docs/CLIENT_CONTRACT.md +4 -2
- package/docs/SDK_MIGRATION.md +9 -5
- package/docs/SPACE_SDK_SEAMS.md +12 -1
- package/package.json +4 -3
- package/public_docs/README.md +10 -3
- package/public_docs/sdk/embedder-guide.md +1 -1
- package/dist/chunks/agent-DS7M57WD.js +0 -2
- package/dist/chunks/agent-adapter-TLWGGK3V.js +0 -2
- package/dist/chunks/argument-completer-OGCXKTRQ.js +0 -2
- package/dist/chunks/chunk-GJXOTOZB.js +0 -465
- package/dist/chunks/chunk-KE2NBMAP.js +0 -20
- package/dist/chunks/chunk-OGTRDK4Q.js +0 -359
- package/dist/chunks/chunk-R2HTPDI7.js +0 -2
- package/dist/chunks/chunk-SDPZFH6M.js +0 -4
- package/dist/chunks/chunk-XDMNJW6J.js +0 -42
- package/dist/chunks/compaction-config-ECMOFP5H.js +0 -2
- package/dist/chunks/dist-5J53DGAO.js +0 -2
- package/dist/chunks/host-65E5NM5P.js +0 -2
- package/dist/chunks/readline-helpers-UZXWBRXQ.js +0 -2
- package/dist/chunks/run-manager-ZFACIZM2.js +0 -2
- package/dist/chunks/running-session-Q5Y6A2QV.js +0 -2
- package/dist/chunks/skills-TJP6BLZJ.js +0 -2
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{B as ee,C as D,b as E,c as A,d as Z,l as Q,m as Y}from"./chunk-GJXOTOZB.js";import{a as U,o as J}from"./chunk-SDPZFH6M.js";import{v as $}from"./chunk-EISRVOBJ.js";import{Zb as H}from"./chunk-2HH5AS7E.js";import{h as O}from"./chunk-J2L2NK6E.js";import{a as o}from"./chunk-V4WSBIXB.js";import{setTimeout as ge}from"node:timers/promises";import{randomBytes as we,randomUUID as he}from"node:crypto";function k(t,c){let f=o(()=>{if(t.capabilities?.sessionPromotion?.version!==1)throw Object.assign(new Error("Session promotion requires an upgraded Host."),{code:"daemon_upgrade_required"})},"requirePromotionContract"),a=o(async e=>{let n=structuredClone(e.input);for(let i of["authorization","credential","hostTools","providerCredential","providerCredentialAccess","origin","trustedRunId","workflowHostPolicy","profile","agentProfile","workModePolicy","toolVisibilityPolicy","tools","binding","businessBinding","defaultSkill"])delete n[i];let s=await c?.({...e,input:n},Z(t,"sessionId"in n?n.sessionId:void 0));if(s?.profile?.requiredWorkMode!==void 0&&t.capabilities?.productExecutionModeConstraint?.version!==1)throw Object.assign(new Error("Execution mode constraints require an upgraded Host."),{code:"daemon_upgrade_required"});if((s?.profile!==void 0||s?.tools!==void 0)&&t.capabilities?.productExecutionProfile?.version!==2)throw Object.assign(new Error("Execution profiles require an upgraded Host."),{code:"daemon_upgrade_required"});if((s?.profile?.defaultSkill!==void 0||s?.binding!==void 0||s?.businessBinding!==void 0)&&t.capabilities?.productExecutionBinding?.version!==1)throw Object.assign(new Error("Default Skills require an upgraded Host."),{code:"daemon_upgrade_required"});return{...n,...s===void 0?{}:{authorization:structuredClone(s)}}},"authorize");return{statistics:t.statistics??{read:o(async()=>{throw new Error("Execution facts require a compatible Host.")},"read"),readRequests:o(async()=>{throw new Error("Execution facts require a compatible Host.")},"readRequests"),readTools:o(async()=>{throw new Error("Execution facts require a compatible Host.")},"readTools")},lifecycle:t.lifecycle??{requestExit:o(async()=>{throw new Error("Client exit control requires a compatible daemon Host.")},"requestExit"),readExit:o(async()=>{throw new Error("Client exit control requires a compatible daemon Host.")},"readExit"),listPendingExits:o(async()=>{throw new Error("Client exit control requires a compatible daemon Host.")},"listPendingExits")},commands:{execute:o(async e=>t.invocations.executeCommand(await a({kind:"command",input:e})),"execute"),readPrompt:o(e=>t.invocations.readCommandPrompt(e),"readPrompt")},review:{start:o(async e=>t.invocations.startReview(await a({kind:"review",input:e})),"start")},host:{shutdown:o(async()=>{if(t.daemon===void 0)throw new Error("Host shutdown requires a shared Host connection.");return t.daemon.shutdown()},"shutdown")},sessions:{cancel:o(e=>t.sessions.cancel(e),"cancel"),create:o(e=>t.sessions.create(e),"create"),promote:o(async e=>(f(),t.sessions.promote(e)),"promote"),readPromotion:o(async(e,n)=>(f(),t.sessions.readPromotion(e,n)),"readPromotion"),list:o(e=>t.sessions.list(e),"list"),read:o(e=>t.sessions.load(e),"read"),delete:o(e=>t.sessions.delete(e),"delete"),archive:o(e=>t.sessions.archive(e),"archive"),unarchive:o(e=>t.sessions.unarchive(e),"unarchive"),getAutoModeStats:o(async e=>await t.sessions.getAutoModeStats(e)??void 0,"getAutoModeStats"),getSettings:o(async e=>E(await t.sessions.getSettings(e)),"getSettings"),getSettingsVersioned:o(async e=>{let n=await t.sessions.getSettingsVersioned(e);return{revision:n.revision,value:E(n.value)}},"getSettingsVersioned"),updateSettingsVersioned:o(async(e,n,s)=>{let i=await t.sessions.updateSettingsVersioned(e,n,s);return{revision:i.revision,value:E(i.value)}},"updateSettingsVersioned"),updateSettings:o(async(e,n)=>E(await t.sessions.updateSettings(e,n)),"updateSettings"),observe:o((e,n,s)=>t.sessions.observeView(e,n,s),"observe"),readItem:o((e,n,s)=>t.sessions.readViewItem(e,n,s),"readItem"),readHistory:o((e,n)=>t.sessions.readHistory(e,n),"readHistory"),readHistoryEntry:o((e,n,s)=>t.sessions.readHistoryEntry(e,n,s),"readHistoryEntry"),searchHistory:o((e,n)=>t.sessions.searchHistory(e,n),"searchHistory"),readGoal:o(e=>t.sessions.readGoal(e),"readGoal"),createGoal:o((e,n)=>t.sessions.createGoal({sessionId:e,...n}),"createGoal"),pauseGoal:o(e=>t.sessions.pauseGoal(e),"pauseGoal"),resumeGoal:o(e=>t.sessions.resumeGoal(e),"resumeGoal"),clearGoal:o(e=>t.sessions.clearGoal(e),"clearGoal"),appendNotice:o(async(e,n)=>{if(!await t.sessions.appendNotice({sessionId:e,...n}))throw new Error("Host did not save the Session notice.")},"appendNotice"),readLineage:o(e=>t.sessions.readLineage(e),"readLineage"),labelEntry:o((e,n)=>t.sessions.labelEntry({sessionId:e,...n}),"labelEntry"),selectBranch:o((e,n,s)=>t.sessions.setActiveEntry({sessionId:e,entryId:n,...s}).then(i=>{if(i===null)throw Object.assign(new Error("No lineage entry matches the selector."),{code:"conflict"});return i}),"selectBranch"),rewindSession:o((e,n)=>t.sessions.rewind({sessionId:e,...n}).then(s=>{if(s===null)throw Object.assign(new Error("Rewind target no longer resolves."),{code:"conflict"});return s}),"rewindSession"),forkSession:o((e,n)=>t.sessions.fork({sessionId:e,...n??{}}).then(s=>{if(s===null)throw Object.assign(new Error("Fork boundary no longer resolves."),{code:"conflict"});return s}),"forkSession"),recoverSession:o((e,n)=>t.sessions.recover({sessionId:e,...n??{}}),"recoverSession"),compact:o(async(e,n)=>{let s=await a({kind:"compaction",input:{...n,sessionId:e}}),i=await t.sessions.compact({sessionId:s.sessionId,customInstructions:s.customInstructions,...s.authorization?.credential!==void 0?{credential:s.authorization.credential}:{}});return{compacted:i.compacted,messages:i.messages,tokensBefore:i.tokensBefore,tokensAfter:i.tokensAfter,...i.report!==void 0?{report:i.report}:{},...i.reason!==void 0?{reason:i.reason}:{}}},"compact")},learning:{list:o(e=>t.learning.list(e),"list"),get:o(e=>t.learning.get(e),"get"),getSnapshot:o(()=>t.learning.getSnapshot(),"getSnapshot"),events:o(e=>t.learning.events(e),"events"),subscribe:o(e=>t.learning.subscribe(e),"subscribe"),acknowledge:o(e=>t.learning.acknowledge(e),"acknowledge"),snooze:o((e,n)=>t.learning.snooze(e,n),"snooze"),reject:o(e=>t.learning.reject(e),"reject"),disable:o(e=>t.learning.disable(e),"disable"),rollback:o(e=>t.learning.rollback(e),"rollback"),promote:o((e,n)=>t.learning.promote(e,n),"promote"),review:o(e=>t.learning.review(e),"review"),trust:o(e=>t.learning.trust(e),"trust")},memory:{async forProject(e){let n=await t.memory.forProject(e);return{memoryRoot:n.memoryRoot,entrypointPath:n.entrypointPath,listReviews:o(()=>n.listReviews(),"listReviews"),reviewerProviderConfigured:o(()=>n.reviewerProviderConfigured(),"reviewerProviderConfigured"),rebuild:o(()=>n.rebuild(),"rebuild"),ensureOpenTarget:o(s=>n.ensureOpenTarget(s),"ensureOpenTarget"),controller:{listRefs:o(s=>n.controller.listRefs(s),"listRefs"),readRef:o(s=>n.controller.readRef(s),"readRef"),remember:o(s=>n.controller.remember(s),"remember"),forgetRef:o((s,i)=>n.controller.forgetRef(s,i),"forgetRef"),approveProposal:o((s,i,r)=>n.controller.approveProposal(s,i,r),"approveProposal"),rejectProposal:o((s,i,r)=>n.controller.rejectProposal(s,i,r),"rejectProposal"),listInbox:o(async()=>(await n.controller.listInbox()).map(s=>({...s,revision:H(s)})),"listInbox"),showProposal:o(async s=>{let i=await n.controller.showProposal(s);return i===void 0?void 0:{...i,revision:H(i)}},"showProposal")}}}},inputs:{submit:o(async e=>t.runs.acceptInput(await a({kind:"input",input:e})),"submit"),read:o((e,n)=>t.runs.getInput(e,n),"read"),withdraw:o((e,n)=>t.runs.withdrawInput(e,n),"withdraw")},runs:{recover:o(async({sessionId:e,runId:n})=>{if((await t.runs.get(n)).sessionId!==e)throw new Error("Recovery Run belongs to a different Session.");let s=await a({kind:"recovery",input:{sessionId:e,runId:n}}),i=await t.sessions.getSettings(e),r=await t.runs.recover({runId:n,options:{provider:i.provider,model:i.model,reasoningMode:i.reasoningMode},...s.authorization===void 0?{}:{authorization:s.authorization}});return{runId:r.runId,sessionId:r.sessionId}},"recover"),startTool:o(async e=>{let n=await a({kind:"tool",input:e}),s=await t.runs.start({sessionId:n.sessionId,inputId:n.inputId,prompt:n.rawInput,options:{toolInvocation:{name:n.name,input:n.input}},...n.authorization!==void 0?{authorization:n.authorization}:{}});return{runId:s.runId,sessionId:s.sessionId}},"startTool"),read:o(e=>t.runs.get(e),"read"),stop:o(e=>t.runs.abort(e),"stop"),await:o(async e=>{let n=await t.runs.await(e);return{runId:n.runId,sessionId:n.sessionId,phase:n.phase,...n.failureDetail!==void 0?{failureDetail:n.failureDetail}:{},...n.result!==void 0?{result:n.result}:{},...n.error!==void 0?{error:n.error.message}:{},...n.terminal!==void 0?{terminal:n.terminal}:{},...n.stop!==void 0?{stop:n.stop}:{}}},"await")},interactions:{list:o(e=>t.interactions.list(e),"list"),respond:o((e,n)=>t.interactions.respond(e,n),"respond")},permissions:{listGrants:o(async()=>{let e=await t.permissions.listGrants();return{revision:e.revision,grants:e.value.map(n=>({id:n.id,...n.scope.sessionId!==void 0?{sessionId:n.scope.sessionId}:{},...n.label!==void 0?{label:n.label}:{},...n.persistence!==void 0?{persistence:n.persistence}:{}}))}},"listGrants"),revokeGrant:o((e,n)=>t.permissions.revokeGrant(e,n),"revokeGrant")},registrations:{list:o(()=>t.admin.agentRegistrations.list(),"list"),upsert:o((e,n)=>t.admin.agentRegistrations.upsert(e,n),"upsert"),setEnabled:o((e,n,s)=>t.admin.agentRegistrations.setEnabled(e,n,s),"setEnabled"),remove:o((e,n)=>t.admin.agentRegistrations.remove(e,n),"remove")},agents:{reviewLean:o(async e=>t.invocations.startAgentsLean(await a({kind:"agents_lean",input:e})),"reviewLean"),tree:o(e=>t.agents.tree(e),"tree"),detail:o((e,n)=>t.agents.detail(e,n),"detail"),spawn:o(async(e,n)=>{let s=await a({kind:"agent_spawn",input:{sessionId:e,agent:n}});return s.authorization===void 0?t.agents.spawn(e,s.agent):t.agents.spawn(e,s.agent,{authorization:s.authorization})},"spawn"),send:o((e,n,s,i)=>t.agents.send(e,n,s,i),"send"),followup:o(async(e,n,s,i)=>{let r=await a({kind:"agent_followup",input:{sessionId:e,actorPath:n,objective:s,...i?.resumeCheckpoint===void 0?{}:{resumeCheckpoint:i.resumeCheckpoint},...i?.expectedRevision===void 0?{}:{expectedRevision:i.expectedRevision}}});return t.agents.followup(e,n,s,{expectedRevision:r.expectedRevision,...r.resumeCheckpoint===void 0?{}:{resumeCheckpoint:r.resumeCheckpoint},...r.authorization===void 0?{}:{authorization:r.authorization}})},"followup"),interrupt:o((e,n,s)=>t.agents.interrupt(e,n,s),"interrupt"),output:o((e,n,s)=>t.agents.output(e,n,s),"output"),wait:o((e,n,s,i)=>t.agents.wait(e,n,s,i?.signal===void 0?void 0:{signal:i.signal}),"wait")},config:{read:o(async()=>A(await t.config.read()),"read"),readEffective:o(async()=>{let{entries:e,application:n}=await t.config.readEffective(),s=o((r,g)=>({value:g,source:e[r]?.source??"unset",applied:e[r]?.applied===!0||e[r]?.present!==!0}),"project"),i=e.fallbackProviders?.value;return{...n===void 0?{}:{application:n,maxOutputTokens:s("maxOutputTokens",e.maxOutputTokens?.value===void 0?void 0:Number(e.maxOutputTokens.value)),disablePromptCache:s("disablePromptCache",e.disablePromptCache?.value===void 0?void 0:e.disablePromptCache.value===!0||e.disablePromptCache.value==="1"),lsp:s("lsp",e.lsp?.value===void 0?void 0:e.lsp.value===!0||e.lsp.value==="1")},stallLog:s("stallLog",e.stallLog?.value==="1"||e.stallLog?.value===!0),fallbackProviders:s("fallbackProviders",typeof i=="string"?i.split(",").map(r=>r.trim()).filter(Boolean):Array.isArray(i)?i.filter(r=>typeof r=="string"):[])}},"readEffective"),patch:o(async e=>A(await t.config.patch(e)),"patch"),reload:o(async()=>({ok:!0,config:A((await t.config.reload()).config)}),"reload")},mcp:{status:o(()=>t.mcp.status(),"status"),listServers:o(()=>t.mcp.listServers(),"listServers"),getServer:o(e=>t.mcp.getServer(e),"getServer"),validateServer:o((e,n)=>t.mcp.validateServer(e,n),"validateServer"),upsertServer:o((e,n)=>t.mcp.upsertServer(e,n),"upsertServer"),deleteServer:o(e=>t.mcp.deleteServer(e),"deleteServer"),reloadServers:o(()=>t.mcp.reloadServers(),"reloadServers"),listTools:o(e=>t.mcp.listTools(e),"listTools")},workflows:{start:o(async e=>t.workflows.start({...await a({kind:"workflow",input:e}),settingsDefaults:"product"}),"start"),list:o(async e=>{let n=[];for(let s of await t.workflows.list(e??{})){let i=s.updatedAt===void 0?await t.workflows.get(s.runId):s;if(i?.updatedAt===void 0)throw new Error(`Workflow process is unavailable: ${s.runId}`);n.push({runId:s.runId,workflowName:s.workflow,status:s.status,totalSpawned:s.totalSpawned,eventCount:s.eventCount,runDir:s.runDir,...s.endedAt!==void 0?{endedAt:new Date(s.endedAt).toISOString()}:{},startedAt:new Date(s.startedAt).toISOString(),updatedAt:i.updatedAt,...i.displayName!==void 0?{displayName:i.displayName}:{},...s.resultText!==void 0?{resultSummary:s.resultText}:{},...s.error!==void 0?{error:s.error}:{}})}return n},"list"),get:o(e=>t.workflows.get(e),"get"),subscribe:o((e,n,s)=>{let i=t.workflows.subscribe(e,n,s);return{ready:i.ready??Promise.resolve(),close:o(()=>i.close(),"close")}},"subscribe"),pause:o(e=>t.workflows.pause(e),"pause"),resume:o(e=>t.workflows.resume(e),"resume"),stop:o((e,n)=>t.workflows.stop(e,n),"stop")},catalog:{inspectRepoIntelligence:o(async e=>{if(!t.catalog.inspectRepoIntelligence)throw Object.assign(new Error("Repository diagnostics require an upgraded Host."),{code:"daemon_upgrade_required"});return t.catalog.inspectRepoIntelligence(e)},"inspectRepoIntelligence"),prewarmRepoIntelligence:o(async e=>{if(!t.catalog.prewarmRepoIntelligence)throw Object.assign(new Error("Repository prewarm requires an upgraded Host."),{code:"daemon_upgrade_required"});return t.catalog.prewarmRepoIntelligence(e)},"prewarmRepoIntelligence"),extensions:o(async()=>{let e=await t.catalog.extensions(),n=o(({path:r,label:g,loadSource:h})=>({path:r,label:g,loadSource:h}),"loaded"),s=o(({kind:r,id:g,label:h})=>({kind:r,id:g,label:h}),"source"),i=e.diagnostics;return{active:e.active,extensions:e.extensions.map(n),diagnostics:i&&{loadedExtensions:i.loadedExtensions.map(n),capabilityProviders:i.capabilityProviders.map(({id:r,kinds:g,metadata:h})=>({id:r,kinds:g,metadata:h})),commands:i.commands.map(({name:r,aliases:g,description:h})=>({name:r,aliases:g,description:h})),tools:i.tools.map(r=>({name:r.name,source:s(r.source),shadowedSources:r.shadowedSources.map(s)})),hooks:i.hooks.map(r=>({hook:r.hook,order:r.order,source:s(r.source)})),failures:i.failures.map(r=>({stage:r.stage,target:r.target,message:r.message,source:s(r.source)})),defaults:{activeTools:i.defaults.activeTools,modelSelection:{...i.defaults.modelSelection},thinkingLevel:i.defaults.thinkingLevel}}}},"extensions"),providers:o(()=>t.catalog.providers(),"providers"),models:o(async e=>(await t.catalog.providers()).filter(n=>e?.provider===void 0||n.name===e.provider).map(n=>({provider:n.name,models:n.models})),"models"),reasoningEfforts:o(e=>t.catalog.reasoningEfforts(e),"reasoningEfforts"),probeReasoningEfforts:o(async e=>{let n=await a({kind:"provider_probe",input:e});return t.catalog.probeReasoningEfforts({provider:n.provider,model:n.model,efforts:n.efforts,...n.authorization?.credential?{credential:n.authorization.credential}:{}})},"probeReasoningEfforts"),forgetCapabilities:o(e=>t.catalog.forgetCapabilities(e),"forgetCapabilities"),commands:o(async e=>(await t.catalog.commands(e)).map(n=>({name:n.name,...n.aliases!==void 0?{aliases:n.aliases}:{},description:n.description,source:String(n.source),...n.userInvocable!==void 0?{userInvocable:n.userInvocable}:{}})),"commands"),skills:o(async e=>(await t.catalog.skills(e)).map(n=>({name:n.name,description:n.description,userInvocable:n.userInvocable,path:n.path,source:String(n.source)})),"skills")},disconnect:o(()=>t.close(),"disconnect")}}o(k,"toKodaXProductClient");async function te(t={},c){let f={name:"kodax-client",...t.clientInfo,instanceId:t.clientInfo?.instanceId??he(),instanceSecret:t.clientInfo?.instanceSecret??we(32).toString("hex")},a=await D({...t,clientInfo:f});return ve(a,e=>D({...t,clientInfo:f,daemonStartupSignal:AbortSignal.any([e,...t.daemonStartupSignal?[t.daemonStartupSignal]:[]])}),c)}o(te,"ensureRecoveringKodaXRuntime");function q(t){let c=t&&typeof t=="object"&&"code"in t?t.code:void 0;return typeof c=="string"&&["protocol_closed","transport_error","ECONNREFUSED","ECONNRESET","ENOENT","ETIMEDOUT"].includes(c)}o(q,"transientConnectionFailure");function ve(t,c,f){let a=t,e=!1,n=!1,s=new AbortController,i,r,g=0,h,I=t.connection?.current(),z=new Set,x=new Set,K=new Map,P=new Set,S=new Set,M=o(l=>{I=l;for(let d of z)try{d(l)}catch(p){C("Connection observer failed.",p)}},"report"),C=o((l,d)=>O({source:"runtime.client-recovery",level:"warn",message:l,detail:d}),"diagnose"),N=o(()=>{if(e||n)return Promise.reject(new Error("Runtime client is closing."));if(i)return i;let l=a;h?.close();let d=(async()=>{await l.close();let p=0;for(;;){s.signal.throwIfAborted();try{if(a=await c(s.signal),e||n){await a.close(),s.signal.throwIfAborted();return}K.clear(),r=void 0;let m=g;B();for(let u of x)await u();if(g!==m)throw Object.assign(new Error("Host disconnected during subscription setup."),{code:"protocol_closed"});break}catch(m){if(!q(m))throw m;C("Host connection is unavailable; waiting to reconnect.",m),h?.close(),await a.close(),await ge(Math.min(3e4,1e3*2**Math.min(p++,5)),void 0,{signal:s.signal})}}for(let m of S)m()})();return i=d,d.then(()=>{i===d&&(i=void 0)},p=>{i===d&&(i=void 0),r=p,e||(C("Host reconnection could not complete.",p),I&&M({...I,state:"disconnected",reconnectable:!1,reason:String(p)}));for(let m of S)m()}),d},"reconnect"),B=o(()=>{let l=a;h=a.connection?.subscribe(d=>{l===a&&(M(d),!e&&!n&&d.state==="disconnected"&&d.reconnectable&&q(d)&&(g+=1,N().catch(()=>{})))})},"bindLifecycle"),F=o(async l=>{if(e||n||P.has(l)||a.identity.runtimeId===t.identity.runtimeId)return;let d=K.get(l);if(d)return d;let p=a,m=(async()=>{let u=await p.runs.get(l);e||P.has(l)||u.stop||u.phase!=="recovering"||!u.contextRecovery?.checkpoint||await k(p,f).runs.recover({sessionId:u.sessionId,runId:l})})();return K.set(l,m),m},"recoverRun"),ce=o(async l=>{for(;;){if(i&&await i,s.signal.throwIfAborted(),r)throw r;let d=a;try{await F(l);let p=await d.runs.await(l);if(p.phase!=="recovering")return p;d===a&&!i&&await new Promise((m,u)=>{let y=o(()=>{S.delete(y),s.signal.removeEventListener("abort",R),m()},"wake"),R=o(()=>{y(),u(s.signal.reason)},"abort");S.add(y),s.signal.addEventListener("abort",R,{once:!0})})}catch(p){if(!q(p))throw p;d===a&&await N()}}},"awaitRun"),de=o(async(l,...d)=>(P.add(l),i&&await i,a.runs.abort(l,...d)),"abort"),le=o(async l=>(P.add(l.expectedRunId),i&&await i,a.sessions.cancel(l)),"cancel"),ue=o(async(l,d,p)=>{let m=!1,u=0,y,R=o(async()=>{if(m||e)return;let w=++u;y?.close();let j=a,G=await j.sessions.observeView(l,_=>{if(!(m||w!==u||j!==a)){d(_);for(let V of _.runs)V.phase==="recovering"&&F(V.runId).catch(W=>{C("Checkpoint continuation requires attention.",W),!m&&w===u&&p?.onStatus?.({state:"interrupted",message:String(W)})})}},{...p,onStatus:o(_=>{!m&&w===u&&j===a&&p?.onStatus?.(_)},"onStatus")});m||e||w!==u?G.close():y=G},"resume"),b=o(async()=>{try{await R()}catch(w){if(q(w))throw w;C("Session observation could not reconnect.",w),p?.onStatus?.({state:"closed",reason:"unavailable",message:String(w)})}},"reopen");return i&&await i,await R(),x.add(b),{close(){m||(m=!0,u+=1,x.delete(b),y?.close())}}},"observeView"),pe=o((l,d)=>{let p,m=!1,u=o(()=>{p?.close();let R=a;p=R.events.subscribe(l,b=>{!m&&R===a&&d(b)})},"resume");u();let y=o(async()=>{m||u()},"reopen");return x.add(y),{close(){m||(m=!0,x.delete(y),p?.close())}}},"subscribeEvents"),fe=o(async()=>{e=!0,s.abort(new Error("Runtime client closed.")),h?.close();for(let l of S)l();await i?.catch(()=>{}),await a.close()},"close"),X=new Map,me=new Proxy(t,{get(l,d){if(d==="close")return fe;let p=Reflect.get(a,d);return!p||typeof p!="object"||["identity","capabilities","grantedScopes"].includes(String(d))?p:(X.has(d)||X.set(d,new Proxy({},{get(m,u){if(d==="runs"&&u==="await")return ce;if(d==="runs"&&u==="abort")return de;if(d==="sessions"&&u==="cancel")return le;if(d==="sessions"&&u==="observeView")return ue;if(d==="events"&&u==="subscribe")return pe;if(d==="daemon"&&u==="shutdown"||d==="lifecycle"&&u==="requestExit")return async(...b)=>{n=!0,i&&(s.abort(new Error("Client exited while Host was unavailable; exit could not be acknowledged.")),await i);let w=Reflect.get(a,d);return Reflect.apply(Reflect.get(w,u),w,b)};if(d==="connection"&&u==="current")return()=>I;if(d==="connection"&&u==="subscribe")return b=>(z.add(b),I&&b(I),{close:o(()=>{z.delete(b)},"close")});let y=Reflect.get(a,d),R=Reflect.get(y,u);return typeof R=="function"?(...b)=>{let w=Reflect.get(a,d);return Reflect.apply(Reflect.get(w,u),w,b)}:R}})),X.get(d))}});return B(),me}o(ve,"createRecoveringRuntimeClient");import Re from"node:path";import{createHash as se,randomUUID as He}from"node:crypto";import T from"node:fs";import ie from"node:path";function re(t,c){return`client_${se("sha256").update(JSON.stringify([t,c])).digest("hex")}`}o(re,"runtimeClientPrincipal");var ye=o(t=>se("sha256").update(t).digest("hex"),"digest"),be=o((t,c)=>ie.join(t.rootDir,"client-exits",ye(c)),"directory");function L(t,c){let f=be(t,c);return T.existsSync(f)?T.readdirSync(f).filter(a=>a.endsWith(".json")).map(a=>{let e=JSON.parse(T.readFileSync(ie.join(f,a),"utf8"));if(e.clientId!==c||e.accepted!==!0||!e.requestId||!e.host?.owner||!e.cleanup||!Array.isArray(e.cleanup.runIds))throw new Error("Invalid persisted client exit receipt.");return e}):[]}o(L,"readExitReceipts");async function ae(t,c){let f=c.host.owner,a=J(t.lockFile),e=Q(f.pid,f.processStartIdentity),n=e?c:ne(c);if(c.runtimeId!==f.runtimeId)return v(n,"blocked","owner_identity_mismatch","inspect_failure");if(e)return c.cleanup.state==="failed"||c.host.cleanup==="failed"?v(n,"blocked","cleanup_failed","inspect_failure"):a===void 0||!oe(a,f)?v(n,"blocked","daemon_active","retry_verification"):!c.host.requested&&c.cleanup.state==="succeeded"?v(n,"ready","client_cleanup_verified","start_or_connect"):c.host.state==="protected"?v(n,"blocked","host_protected","retry_exit"):c.cleanup.state!=="succeeded"?v(n,c.cleanup.state==="pending"?"pending":"blocked",c.cleanup.state==="pending"?"client_cleanup_pending":"client_cleanup_unknown","retry_exit"):v(n,"pending","daemon_active","retry_verification");let s=await Y({configHome:t.configHome,profile:t.profile,owner:f,timeoutMs:1,pollIntervalMs:1}),i=L(t,c.clientId).find(h=>h.requestId===c.requestId);if(i&&(i.runtimeId!==c.runtimeId||i.host.requested!==c.host.requested||!oe(i.host.owner,f)))return v(n,"blocked","owner_identity_mismatch","inspect_failure");let r=i?ne(i):n;if(r.host.cleanup==="failed")return v(r,"blocked","cleanup_failed","inspect_failure");if(s.status==="succeeded"||s.status==="replacement_running")return!f.processStartIdentity||f.processContainment==="windows-job"&&!f.supervisorProcessStartIdentity?v(r,"blocked","owner_identity_unverified","inspect_failure"):v({...r,host:{...r.host,state:"succeeded",cleanup:"succeeded",...s.status==="replacement_running"?{replacementRunning:!0}:{}}},"ready","host_shutdown_verified","start_or_connect");if(s.status==="failed")return v({...r,host:{...r.host,state:"failed",cleanup:"failed",message:s.outcome.error}},"blocked","cleanup_failed","inspect_failure");let g=s.status==="unverified"?s.reason:"outcome_missing";return v({...r,host:{...r.host,state:c.host.requested?"unknown":"not_requested",message:g}},"blocked",g,g==="containment_unavailable"?"inspect_failure":"retry_verification")}o(ae,"verifyExitReceipt");function v(t,c,f,a){return{...t,recovery:{state:c,reason:f,nextAction:a,checkedAt:new Date().toISOString()}}}o(v,"withRecovery");function ne(t){return t.cleanup.state==="pending"?{...t,cleanup:{...t.cleanup,state:"unknown",issues:[...t.cleanup.issues,"Original Host stopped before client cleanup was confirmed."]}}:t}o(ne,"afterOwnerLoss");function oe(t,c){return t.runtimeId===c.runtimeId&&t.pid===c.pid&&t.kind===c.kind&&t.processStartIdentity===c.processStartIdentity&&t.processContainment===c.processContainment&&t.supervisorPid===c.supervisorPid&&t.supervisorProcessStartIdentity===c.supervisorProcessStartIdentity}o(oe,"sameExitOwner");async function tt(t){let{instanceId:c,instanceSecret:f}=t.clientInfo;if(!c||!/^[A-Za-z0-9_.:-]{4,160}$/.test(c)||!f||f.length<32||f.length>512)throw new Error("Exit recovery requires the original stable client identity and secret.");let a=U(t.homeDir===void 0?$:Re.resolve(t.homeDir,".kodax"),t.profile);return Promise.all(L(a,re(c,f)).map(e=>ae(a,e)))}o(tt,"readKodaXClientExits");async function nt(t={}){return k(await te({...t,requirements:{productClient:1,productHistoryBoundaries:1,productExitControl:1,productExecutionFacts:1,productInputRecovery:1,...t.authorizeExecution?{productExecutionAuthorization:2,productActorAuthorization:1,providerProbeAuthorization:1}:{}}},t.authorizeExecution),t.authorizeExecution)}o(nt,"ensureKodaXClient");async function ot(t={}){let c=await ee({homeDir:t.homeDir,profile:t.profile,endpoint:t.endpoint,daemonToken:t.token,autoStart:!1,onStartupProgress:t.onStartupProgress,clientInfo:t.clientInfo,requirements:{productClient:1,productHistoryBoundaries:1,productExitControl:1,productExecutionFacts:1,productInputRecovery:1,...t.authorizeExecution?{productExecutionAuthorization:2,productActorAuthorization:1,providerProbeAuthorization:1}:{}}});return k(c,t.authorizeExecution)}o(ot,"connectKodaXClient");export{k as a,tt as b,nt as c,ot as d};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{p as h}from"./chunk-J2L2NK6E.js";import{a as i}from"./chunk-V4WSBIXB.js";import{createHash as J,randomUUID as F}from"node:crypto";import*as r from"node:fs";import a from"node:path";var E,v=!1;function A(e){return e!==process.pid?h(e):(v||(E=h(e),v=!0),E)}i(A,"readRuntimeOwnerProcessStartIdentity");function C(e,n="default"){let t=W(n),o=a.resolve(e),s=a.join(o,"runtime","daemon",t);return{profile:t,configHome:o,rootDir:s,stateFile:a.join(s,"daemon.json"),lockFile:a.join(s,"daemon.lock"),tokenFile:a.join(s,"daemon.token"),logFile:a.join(s,"daemon.log"),runsDir:a.join(s,"runs"),eventsDir:a.join(s,"events"),ownerPolicyFile:a.join(s,"owner-policy.json"),ownerPolicyLockFile:a.join(s,"owner-policy.lock")}}i(C,"resolveRuntimeDaemonPathsFromConfigHome");function T(e,n){let t=i(o=>{let s=a.resolve(o);return process.platform==="win32"?s.toLowerCase():s},"resolveIdentity");return t(e)===t(n)}i(T,"isSameRuntimeDaemonPath");function re(e,n){let t=a.resolve(e);return T(n,a.join(t,".kodax"))?t:a.resolve(n)}i(re,"resolveRuntimeDaemonEndpointScope");function O(e){if(!r.existsSync(e.ownerPolicyFile))return{mode:"daemon",revision:0,updatedAt:new Date(0).toISOString()};try{let n=JSON.parse(r.readFileSync(e.ownerPolicyFile,"utf8"));if(I(n)&&(n.mode==="daemon"||n.mode==="inline"||n.mode==="host")&&typeof n.revision=="number"&&Number.isSafeInteger(n.revision)&&n.revision>=0&&typeof n.updatedAt=="string")return{mode:n.mode==="host"?"daemon":n.mode,revision:n.revision,updatedAt:n.updatedAt,...n.mode==="host"?{unified:!0}:{}}}catch{}throw new Error("Runtime owner policy is corrupt; refusing to choose an owner.")}i(O,"readRuntimeOwnerPolicy");function te(e,n,t){z(e);let o=O(e);if(o.unified&&!t)return o;r.mkdirSync(n,{recursive:!0});let s=a.join(r.realpathSync(n),".product-host");r.mkdirSync(s,{recursive:!0});let c={ownerPolicyLockFile:a.join(s,"owner-policy.lock")},l=S(c);if(!l)throw new Error("Session storage owner transition is already in progress.");try{let f=S(e);if(!f)throw new Error("Runtime owner transition is already in progress.");try{let u=O(e);if(u.unified&&!t)return u;let d=p(e.lockFile);if(!d&&r.existsSync(e.lockFile))throw new Error("Cannot migrate an unreadable Runtime owner lock.");let k=j(e);if(!k&&r.existsSync(e.stateFile))throw new Error("Cannot migrate an unreadable Host descriptor.");if(k&&(!d||k.runtimeId!==d.runtimeId||k.pid!==d.pid)&&w({pid:k.pid})!=="gone")throw new Error("Cannot migrate a live or unverified Host descriptor without its matching owner lock.");let x=a.join(s,"owner.lock"),y=p(x);if(!y&&r.existsSync(x))throw new Error("Cannot migrate an unreadable Session storage owner lock.");let m=t?Z(e.configHome,n):void 0,R=m?p(C(e.configHome,m.profile).lockFile):void 0;if(t&&(!m||m.profile!==t.profile||m.profile===e.profile||m.ownerFile!==t.ownerFile||!P(m.owner,t.owner)||!m.owner.processStartIdentity||w(m.owner)!=="alive"||!R||R.runtimeId!==m.owner.runtimeId||R.pid!==m.owner.pid||R.processStartIdentity!==m.owner.processStartIdentity||R.kind==="inline"))throw new Error("The verified shared Host changed before requested-profile migration.");if(y&&w(y)!=="gone"){if(!t&&u.mode==="daemon"&&d&&d.kind!=="inline"&&y.kind==="daemon"&&y.runtimeId===d.runtimeId&&y.pid===d.pid&&y.processStartIdentity===d.processStartIdentity&&w(d)==="alive")return u;if(!m||!P(y,m.owner))throw new Error("Cannot migrate while Session storage has an active or unverified owner.")}if(d){let L=w(d);if(!t&&L==="alive"&&u.mode==="daemon"&&d.kind!=="inline")return u;if(L!=="gone")throw new Error("Cannot migrate while the Runtime owner is active or its liveness is unverified.");if(u.mode==="inline"&&d.kind!=="inline")throw new Error("Cannot migrate ambiguous legacy Runtime ownership.")}return u.unified?u:M(e,"daemon",u.revision,f.nonce,!0)}finally{g(e,f)}}finally{g(c,l)}}i(te,"prepareRuntimeDaemonOwner");function M(e,n,t,o,s=!1){let c=O(e);if(c.unified&&!s)throw new Error("Legacy Runtime ownership changes are retired for this profile.");if(c.revision!==t)throw _(`Runtime owner policy conflict: expected ${t}, current ${c.revision}.`);let l={mode:n,revision:c.revision+1,updatedAt:new Date().toISOString(),...s?{unified:!0}:{}},f=`${e.ownerPolicyFile}.${process.pid}.${o}.tmp`;try{let u=r.openSync(f,"wx",384);try{let d=s?{mode:"host",revision:l.revision,updatedAt:l.updatedAt}:l;r.writeFileSync(u,`${JSON.stringify(d,null,2)}
|
|
3
|
-
`,"utf8"),r.fsyncSync(u)}finally{r.closeSync(u)}return r.renameSync(f,e.ownerPolicyFile),l}finally{r.rmSync(f,{force:!0})}}i(M,"writeRuntimeOwnerPolicy");function _(e){let n=new Error(e);return n.code="conflict",n}i(_,"runtimeOwnerPolicyConflict");var D=new Map;function S(e,n=!0){let t=D.get(e.ownerPolicyLockFile);t!==void 0&&g(e,t);let o=F(),s=A(process.pid),c={runtimeId:`owner-transition-${o}`,pid:process.pid,createdAt:new Date().toISOString(),...s===void 0?{}:{processStartIdentity:s}},l={...c,nonce:o};if($({rootDir:a.dirname(e.ownerPolicyLockFile),lockFile:e.ownerPolicyLockFile},l))return{nonce:o,owner:c};if(n&&q(e))return S(e,!1)}i(S,"tryAcquireRuntimeOwnerCoordination");function q(e){let n=b(e);if(!n||w(n.owner)!=="gone")return!1;let t=`${e.ownerPolicyLockFile}.reclaim.${J("sha256").update(n.nonce).digest("hex")}`;if(!$({rootDir:a.dirname(t),lockFile:t},{runtimeId:`owner-reclaim-${F()}`,pid:process.pid,createdAt:new Date().toISOString()}))return!1;try{let s=b(e);return!s||s.nonce!==n.nonce?!1:(r.unlinkSync(e.ownerPolicyLockFile),!0)}catch{return!1}}i(q,"removeAbandonedRuntimeOwnerCoordination");function b(e){try{let n=JSON.parse(r.readFileSync(e.ownerPolicyLockFile,"utf8"));return!I(n)||typeof n.nonce!="string"||!N(n)||!n.runtimeId.startsWith("owner-transition-")?void 0:{nonce:n.nonce,owner:n}}catch{return}}i(b,"readRuntimeOwnerCoordinationHandle");function g(e,n){try{let t=JSON.parse(r.readFileSync(e.ownerPolicyLockFile,"utf8"));I(t)&&t.nonce===n.nonce&&r.unlinkSync(e.ownerPolicyLockFile),D.delete(e.ownerPolicyLockFile)}catch(t){if(t.code==="ENOENT"){D.delete(e.ownerPolicyLockFile);return}throw D.set(e.ownerPolicyLockFile,n),t}}i(g,"releaseRuntimeOwnerCoordination");function W(e){let n=e.trim()||"default";if(n==="."||n===".."||!/^[A-Za-z0-9_.-]+$/.test(n))throw new Error(`Invalid runtime daemon profile: ${e}`);return n}i(W,"normalizeRuntimeDaemonProfile");function z(e){r.mkdirSync(e.rootDir,{recursive:!0}),r.mkdirSync(e.runsDir,{recursive:!0}),r.mkdirSync(e.eventsDir,{recursive:!0})}i(z,"ensureRuntimeDaemonDirectories");function oe(e){try{let n=r.readFileSync(e.tokenFile,"utf8").trim();return n.length>0?n:void 0}catch(n){if(n.code==="ENOENT")return;throw n}}i(oe,"readRuntimeDaemonToken");function j(e){if(r.existsSync(e.stateFile))try{let n=JSON.parse(r.readFileSync(e.stateFile,"utf8"));return X(n)?n:void 0}catch{return}}i(j,"readRuntimeDaemonState");function w(e){if(!Number.isSafeInteger(e.pid)||e.pid<=0)return"gone";try{process.kill(e.pid,0)}catch(t){return H(t)&&t.code==="ESRCH"?"gone":"unknown"}if(process.platform==="linux")try{let t=r.readFileSync(`/proc/${e.pid}/stat`,"utf8"),o=/^\d+ \(.*\) ([A-Za-z]) /s.exec(t);if(o&&["Z","X","x"].includes(o[1]))return"gone";if(!o)return"unknown"}catch{return"unknown"}if(e.processStartIdentity===void 0)return"alive";let n=A(e.pid);return n===void 0?"unknown":n===e.processStartIdentity?"alive":"gone"}i(w,"runtimeOwnerProcessState");function U(e,n){return a.join(e.rootDir,`shutdown-outcome.${encodeURIComponent(n.runtimeId)}.${n.pid}.json`)}i(U,"runtimeDaemonShutdownOutcomePath");function ie(e,n){try{let t=JSON.parse(r.readFileSync(U(e,n),"utf8"));return B(t)&&t.runtimeId===n.runtimeId&&t.pid===n.pid?t:void 0}catch{return}}i(ie,"readRuntimeDaemonShutdownOutcome");function $(e,n){r.mkdirSync(e.rootDir,{recursive:!0});let t=`${e.lockFile}.${F()}.tmp`,o,s=!1;try{o=r.openSync(t,"wx",384),r.writeFileSync(o,`${JSON.stringify(n,null,2)}
|
|
4
|
-
`,"utf8"),r.fsyncSync(o);let c=o;return o=void 0,r.closeSync(c),r.linkSync(t,e.lockFile),s=!0,{file:e.lockFile,owner:n}}catch(c){if(H(c)&&c.code==="EEXIST")return;throw c}finally{try{try{o!==void 0&&r.closeSync(o)}finally{r.rmSync(t,{force:!0})}}catch(c){if(s&&P(p(e.lockFile),n))try{r.unlinkSync(e.lockFile)}catch(l){throw new AggregateError([c,l],"Runtime owner publication cleanup failed.")}throw c}}}i($,"tryAcquireRuntimeDaemonLock");function se(e){r.mkdirSync(e,{recursive:!0});let n=a.join(r.realpathSync(e),".product-host");r.mkdirSync(n,{recursive:!0});let t={ownerPolicyLockFile:a.join(n,"startup.lock")},o=S(t);return o===void 0?void 0:()=>g(t,o)}i(se,"tryAcquireRuntimeSessionStorageStartup");function Z(e,n){if(!r.existsSync(n))return;let t=a.join(r.realpathSync(n),".product-host","owner.lock"),o=p(t);if(!o||o.kind!=="daemon"||w(o)==="gone")return;let s=a.join(a.resolve(e),"runtime","daemon");for(let c of r.existsSync(s)?r.readdirSync(s,{withFileTypes:!0}):[]){if(!c.isDirectory()||!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(c.name))continue;let l=C(e,c.name),f=j(l),u=p(l.lockFile);if(!(f?.profile!==c.name||f.runtimeId!==o.runtimeId||f.pid!==o.pid||u?.runtimeId!==o.runtimeId||u.pid!==o.pid||u.kind!==void 0&&u.kind!=="daemon"||u.processStartIdentity!==void 0&&u.processStartIdentity!==o.processStartIdentity))return{profile:c.name,ownerFile:t,owner:o}}throw Object.assign(new Error(`The shared Session storage owner ${o.runtimeId} (PID ${o.pid}) cannot be attached yet. Waiting for its verified daemon descriptor.`),{code:"session_storage_owned",retryable:!0})}i(Z,"findRuntimeSessionStorageHost");function ae(e){if(!["daemon.lock","owner.lock"].includes(a.basename(e)))throw new Error("Unsupported Runtime ownership repair target.");let n={ownerPolicyLockFile:a.join(a.dirname(e),"owner-policy.lock")},t=S(n);return t?()=>g(n,t):void 0}i(ae,"tryAcquireRuntimeLockMaintenance");function p(e){if(r.existsSync(e))try{let n=JSON.parse(r.readFileSync(e,"utf8"));return N(n)?n:void 0}catch{return}}i(p,"readRuntimeDaemonLockOwner");function P(e,n){return e===void 0||n===void 0?e===n:e.runtimeId===n.runtimeId&&e.pid===n.pid&&e.createdAt===n.createdAt&&e.kind===n.kind&&e.processStartIdentity===n.processStartIdentity&&e.processContainment===n.processContainment&&e.supervisorPid===n.supervisorPid&&e.supervisorProcessStartIdentity===n.supervisorProcessStartIdentity}i(P,"sameRuntimeLockOwner");function ce(e){return e.state?e.endpointReachable&&!e.identityMatches?"mismatch":e.pidAlive&&e.endpointReachable&&e.identityMatches?"healthy":!e.pidAlive&&!e.endpointReachable?"stale":"unhealthy":"missing"}i(ce,"classifyRuntimeDaemonHealth");function X(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let n=e;return typeof n.runtimeId=="string"&&typeof n.profile=="string"&&typeof n.pid=="number"&&typeof n.startedAt=="string"&&typeof n.endpoint=="string"&&typeof n.version=="string"&&K(n.status)&&(n.configHome===void 0||typeof n.configHome=="string")&&(n.lastError===void 0||typeof n.lastError=="string")}i(X,"isRuntimeDaemonState");function B(e){return G(e)?e.version===1&&typeof e.runtimeId=="string"&&typeof e.pid=="number"&&(e.status==="succeeded"||e.status==="failed")&&typeof e.completedAt=="string"&&(e.error===void 0||typeof e.error=="string"):!1}i(B,"isRuntimeDaemonShutdownOutcome");function G(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}i(G,"isPlainRecord");function N(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let n=e;return typeof n.runtimeId=="string"&&typeof n.pid=="number"&&Number.isSafeInteger(n.pid)&&n.pid>0&&typeof n.createdAt=="string"&&(n.kind===void 0||n.kind==="daemon"||n.kind==="inline")&&(n.processStartIdentity===void 0||typeof n.processStartIdentity=="string"&&n.processStartIdentity.length>0)&&(n.processContainment===void 0||n.processContainment==="windows-job")&&(n.supervisorProcessStartIdentity===void 0||typeof n.supervisorProcessStartIdentity=="string"&&n.supervisorProcessStartIdentity.length>0)&&(n.processContainment==="windows-job"?Number.isSafeInteger(n.supervisorPid)&&n.supervisorPid>0:n.supervisorPid===void 0&&n.supervisorProcessStartIdentity===void 0)}i(N,"isRuntimeDaemonLockOwner");function K(e){return e==="starting"||e==="ready"||e==="draining"||e==="stopping"||e==="unhealthy"||e==="crashed"}i(K,"isRuntimeDaemonStatus");function H(e){return e instanceof Error&&"code"in e}i(H,"isNodeFileError");function I(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}i(I,"isRecord");export{C as a,re as b,O as c,te as d,W as e,z as f,oe as g,j as h,w as i,ie as j,$ as k,se as l,Z as m,ae as n,p as o,ce as p};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{$b as it,Od as at,Qa as et,Qb as nt,Rb as rt,Sa as tt,_b as ot,_d as Z,a as L,b as ye,fc as st,ma as Ze,tc as ke}from"./chunk-OGTRDK4Q.js";import{a as A}from"./chunk-65652LR4.js";import{Db as Ye,s as z,z as He}from"./chunk-2HH5AS7E.js";import{b as Ke,k as Q,qb as Je,rb as Qe}from"./chunk-J2L2NK6E.js";import{d as he}from"./chunk-KDSO7V4O.js";import{ga as ge}from"./chunk-SK3RRGHJ.js";import{N as Ve,O as ze,q as Xe,t as Y}from"./chunk-KE2NBMAP.js";import{R as Ge,o as Be,r as qe}from"./chunk-V5RCDBKU.js";import{b as M,d as N,e as j}from"./chunk-KDLOPBFZ.js";import{a as i}from"./chunk-V4WSBIXB.js";import{createHash as Qt}from"node:crypto";function be(e){if(typeof e!="object"||e===null)return;let t=e;if(t.version!==1||typeof t.sessionId!="string"||!t.sessionId||t.activeEntryId!==null&&typeof t.activeEntryId!="string"||typeof t.messagesDigest!="string"||!/^[a-f0-9]{64}$/.test(t.messagesDigest)||t.turnId!==void 0&&typeof t.turnId!="string"||[t.remainingIterations,t.remainingContinuationIterations].some(r=>r!==void 0&&(typeof r!="number"||!Number.isSafeInteger(r)||r<0)))return;let n;if(t.isolation!==void 0){if(!t.isolation||typeof t.isolation!="object")return;let r=t.isolation;if(typeof r.worktreePath!="string"||!r.worktreePath||typeof r.gitRoot!="string"||!r.gitRoot)return;n={worktreePath:r.worktreePath,gitRoot:r.gitRoot}}return{version:1,sessionId:t.sessionId,activeEntryId:t.activeEntryId,...n?{isolation:n}:{},...typeof t.remainingIterations=="number"?{remainingIterations:t.remainingIterations}:{},...typeof t.remainingContinuationIterations=="number"?{remainingContinuationIterations:t.remainingContinuationIterations}:{},messagesDigest:t.messagesDigest,...typeof t.turnId=="string"?{turnId:t.turnId}:{}}}i(be,"parseGenerationCheckpoint");async function xr(e,t){let n=await e.load(t.sessionId);if(!n?.lineage||n.lineage.activeEntryId!==t.activeEntryId||Qt("sha256").update(JSON.stringify(n.messages)).digest("hex")!==t.messagesDigest)throw new Error("Generation checkpoint no longer matches committed history.");return n}i(xr,"loadGenerationCheckpoint");function xe(e){if(!e.trim())return[];let t=[],n=/(^|\s)\/skill:([\w](?:[\w.\-:]*[\w])?)/g,r;for(;(r=n.exec(e))!==null;){let o=r[1]??"",d=r[2]??"";if(!d)continue;let s=r.index+o.length,c=`/skill:${d}`;e[s+c.length]!=="/"&&t.push({name:d,raw:c,start:s,end:s+c.length})}return t}i(xe,"parseInlineSkillReferences");function we(e){if(!e.trim())return[];let t=[],n=/(^|\s)\/(?!skill:)([\w](?:[\w.\-:]*[\w])?)/g,r;for(;(r=n.exec(e))!==null;){let o=r[1]??"",d=r[2]??"";if(!d)continue;let s=r.index+o.length,c=`/${d}`;e[s+c.length]!=="/"&&t.push({name:d,raw:c,start:s,end:s+c.length})}return t}i(we,"parseBareInlineSlashReferences");function Sr(e){return Array.from(new Set(xe(e).map(t=>t.name)))}i(Sr,"uniqueInlineSkillNames");function Rr(e){return Array.from(new Set(we(e).map(t=>t.name)))}i(Rr,"uniqueBareInlineSlashNames");var Zt=[/\brate.?limit\b/i,/\btoo many requests\b/i,/\b429\b/,/\bquota exceeded\b/i,/\bapi credits?\b/i,/请求过多/,/频率限制/,/限流/,/配额/],dt=[/\boverloaded\b/i,/\bcapacity\b/i,/\bserver (error|busy)\b/i,/\bprovider service error\b/i,/\btry (again )?(a )?moment later\b/i,/\b(api|http|provider|status( code)?)\b[^\n]{0,40}\b5(00|02|03|29)\b/i,/\b5(00|02|03|29)\b[^\n]{0,40}\b(api|http|provider|server|status( code)?)\b/i,/\b503\b/,/\b502\b/,/\binternal server error\b/i,/\bservice unavailable\b/i,/服务繁忙/,/服务不可用/,/服务器错误/,/服务器内部错误/,/过载/,/容量不足/],Ce=[/\bconnection (error|reset|closed|refused|terminated)\b/i,/\bsocket hang up\b/i,/\bsocket closed\b/i,/\bfetch failed\b/i,/\beconnrefused\b/i,/\beconnreset\b/i,/\bepipe\b/i,/\benotfound\b/i,/\beai_again\b/i,/\bother side closed\b/i,/\bnetwork\b/i,/\baborted\b/i,/\bterminated\b/i,/\bpremature close\b/i,/\bund_err_socket\b/i,/\bund_err_closed\b/i,/\bund_err_aborted\b/i,/\bund_err_destroyed\b/i,/网络错误/,/网络异常/,/连接错误/,/连接失败/,/连接被拒绝/,/连接被重置/,/连接被终止/,/连接已终止/,/连接中断/],Se=[/\btimed? ?out\b/i,/\betimedout\b/i,/\bheaders timeout\b/i,/\bbody timeout\b/i,/\bund_err_headers_timeout\b/i,/\bund_err_body_timeout\b/i,/\bund_err_connect_timeout\b/i,/连接超时/,/请求超时/,/响应超时/],lt=[/\bstream incomplete\b/i,/\bstream interrupted\b/i],en=[/\bstream stalled or delayed\b/i,/\b60s idle\b/i,/\bidle timeout\b/i],tn=[/\bhard timeout\b/i,/\b10 minutes?\b/i,/\bapi hard timeout\b/i],nn=[/reasoning_content/i,/thinking.{0,40}signature/i,/signature.{0,40}thinking/i],rn=[/\bcontext too long\b/i,/\bmaximum context\b/i,/\bcontext length\b/i,/\bcontext window\b/i,/\btoo many tokens\b/i],on=[/\b(401|403)\b/,/\b(auth|unauthorized|forbidden|api key|not configured|permission denied)\b/i];function sn(e,t){let n=Te(e);if(e.name==="AbortError")return{errorClass:"user_abort",failureStage:t??"before_first_delta",retryable:!1,maxRetries:0,baseRetryDelay:0};if(Y(e)||e instanceof M&&e.metadata?.retryable===!1)return{errorClass:"non_retryable_provider_error",failureStage:t??"before_first_delta",retryable:!1,maxRetries:0,baseRetryDelay:0};if(e instanceof M&&e.metadata?.httpStatus===408)return{errorClass:"request_timeout",failureStage:t??"before_first_delta",retryable:!0,maxRetries:2,baseRetryDelay:5e3};if(e instanceof N||_(n,Zt)){let r=e instanceof N?e.retryAfter:void 0;return{errorClass:"rate_limit",failureStage:t??"before_first_delta",retryable:!0,maxRetries:3,baseRetryDelay:r??6e4}}return e instanceof M&&_(n,dt)?{errorClass:"provider_overloaded",failureStage:t??"before_first_delta",retryable:!0,maxRetries:3,baseRetryDelay:5e3}:e.name==="StreamIncompleteError"||_(n,lt)?{errorClass:"incomplete_stream",failureStage:an(n,t),retryable:!0,maxRetries:3,baseRetryDelay:2e3}:_(n,en)?{errorClass:"stream_idle_timeout",failureStage:t??"mid_stream_text",retryable:!0,maxRetries:3,baseRetryDelay:3e3}:_(n,tn)?{errorClass:"request_timeout",failureStage:t??"before_first_delta",retryable:!0,maxRetries:2,baseRetryDelay:5e3}:e instanceof j&&e.isTimeout||_(n,Se)?{errorClass:"request_timeout",failureStage:t??"before_first_delta",retryable:!0,maxRetries:3,baseRetryDelay:5e3}:e instanceof j||_(n,Ce)?{errorClass:"connection_failure",failureStage:t??"before_first_delta",retryable:!0,maxRetries:3,baseRetryDelay:2e3}:e instanceof M?_(n,[...Ce,...Se])?{errorClass:"connection_failure",failureStage:t??"before_first_delta",retryable:!0,maxRetries:3,baseRetryDelay:2e3}:_(n,nn)?{errorClass:"reasoning_content_required",failureStage:t??"before_first_delta",retryable:!0,maxRetries:1,baseRetryDelay:0}:{errorClass:"non_retryable_provider_error",failureStage:t??"before_first_delta",retryable:!1,maxRetries:0,baseRetryDelay:0}:_(n,dt)?{errorClass:"provider_overloaded",failureStage:t??"before_first_delta",retryable:!0,maxRetries:3,baseRetryDelay:5e3}:_(n,[...Ce,...Se,...lt])?{errorClass:"connection_failure",failureStage:t??"before_first_delta",retryable:!0,maxRetries:2,baseRetryDelay:2e3}:{errorClass:"non_retryable_provider_error",failureStage:t??"before_first_delta",retryable:!1,maxRetries:0,baseRetryDelay:0}}i(sn,"classifyResilienceError");function go(e,t){if(t<=0)return!1;let n=Te(e);if(Re(e))return!1;let r=sn(e);return r.errorClass==="provider_overloaded"||r.errorClass==="reasoning_content_required"||_(n,rn)}i(go,"isSessionRecoveryCandidateError");function Re(e){return _(Te(e),on)}i(Re,"isAuthenticationOrConfigurationError");function _(e,t){return t.some(n=>n.test(e))}i(_,"matchesAny");function Te(e){let t=[],n=new Set,r=e,o=0,d=5;for(;r!=null&&o<d&&!n.has(r);){if(n.add(r),r instanceof Error){r.name==="TimeoutError"&&t.push("timeout"),r.message&&t.push(r.message);let s=r.code;typeof s=="string"&&s.length>0&&t.push(s),r=r.cause}else if(typeof r=="string")t.push(r),r=void 0;else if(typeof r=="object"){let s=r.message;typeof s=="string"&&t.push(s);let c=r.code;typeof c=="string"&&t.push(c),r=r.cause}else break;o+=1}return t.join(" | ").toLowerCase()}i(Te,"collectErrorText");function an(e,t){return t||(/\btool.?input\b/i.test(e)||/\btool.?call\b/i.test(e)?"mid_stream_tool_input":/\bthinking\b/i.test(e)?"mid_stream_thinking":"mid_stream_text")}i(an,"inferStageForStreamError");import{readFileSync as dn,statSync as ln}from"node:fs";import{join as ct,parse as cn,resolve as ve}from"node:path";var un=["AGENTS.md"];function fn(){return Ke()}i(fn,"getKodaxGlobalDir");var ee=new Map;function pn(e){let t;try{t=ln(e).mtimeMs}catch{return ee.delete(e),null}let n=ee.get(e);if(n&&n.mtimeMs===t)return n.content;try{let r=dn(e,"utf-8");return ee.set(e,{mtimeMs:t,content:r}),r}catch{return ee.delete(e),null}}i(pn,"readFileWithMtimeCache");function Ie(e,t){for(let n of t){let r=ct(e,n),o=pn(r);if(o!==null)return{path:r,content:o,scope:"directory"}}return null}i(Ie,"loadAgentsFile");function mn(e){return Ie(e,un)}i(mn,"loadContextFileFromDir");function ut(e){let t=ve(e?.cwd??process.cwd()),n=e?.kodaxDir??fn(),r=e?.projectRoot?ve(e.projectRoot):null,o=r??cn(t).root,d=[],s=new Set,c=Ie(n,["AGENTS.md"]);c&&(c.scope="global",d.push(c),s.add(c.path));let u=[],m=t,h=new Set;for(;!h.has(m);){h.add(m);let p=mn(m);if(p&&!s.has(p.path)&&(p.scope="directory",u.unshift(p),s.add(p.path)),m===o)break;let b=ve(m,"..");if(b===m)break;m=b}if(d.push(...u),r){let p=Ie(ct(r,".kodax"),["AGENTS.md"]);p&&!s.has(p.path)&&(p.scope="project",d.push(p))}return d}i(ut,"loadAgentsFiles");function ft(e){return e.length===0?"":`
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Project Context
|
|
6
|
-
|
|
7
|
-
${e.map(n=>`
|
|
8
|
-
## ${{global:"Global Rules",project:"Project Rules",directory:"Directory Rules"}[n.scope]} (from ${n.path})
|
|
9
|
-
|
|
10
|
-
${n.content}
|
|
11
|
-
`).join(`
|
|
12
|
-
---
|
|
13
|
-
`)}
|
|
14
|
-
`}i(ft,"formatAgentsForPrompt");function D(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}i(D,"isRecord");function gn(e){return e instanceof Error?e.message:String(e)}i(gn,"errorMessage");function oe(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}i(oe,"safeStringify");function pt(e,t){switch(t){case"string":return typeof e=="string";case"number":return typeof e=="number";case"integer":return typeof e=="number"&&Number.isInteger(e);case"boolean":return typeof e=="boolean";case"object":return D(e);case"array":return Array.isArray(e);case"null":return e===null;default:return!0}}i(pt,"matchesType");function hn(e,t){return e.some(n=>n===t?!0:typeof n!="object"||typeof t!="object"?!1:oe(n)===oe(t))}i(hn,"enumMatches");function te(e,t){return e?`${e}.${t}`:t}i(te,"joinPath");function ne(e,t,n=""){if(!D(t))return[];let r=[],o=n||"(root)",d=t.type;if(typeof d=="string"&&!pt(e,d))return[`${o}: expected type ${d}`];if(Array.isArray(d)&&!d.some(s=>typeof s=="string"&&pt(e,s)))return[`${o}: expected one of types ${d.join("|")}`];if(Array.isArray(t.enum)&&!hn(t.enum,e)&&r.push(`${o}: value is not one of the allowed enum values`),Array.isArray(t.oneOf)){let s=t.oneOf.filter(c=>ne(e,c,n).length===0).length;s!==1&&r.push(`${o}: value must match exactly one of the ${t.oneOf.length} oneOf variants (matched ${s})`)}if(D(e)){let s=D(t.properties)?t.properties:void 0;if(Array.isArray(t.required))for(let c of t.required)typeof c=="string"&&!(c in e)&&r.push(`${te(n,c)}: required field is missing`);if(s){for(let[c,u]of Object.entries(e))c in s&&r.push(...ne(u,s[c],te(n,c)));if(t.additionalProperties===!1)for(let c of Object.keys(e))c in s||r.push(`${te(n,c)}: unexpected property (additionalProperties is false)`)}}return Array.isArray(e)&&D(t.items)&&e.forEach((s,c)=>{r.push(...ne(s,t.items,`${o}[${c}]`))}),r}i(ne,"validateAgainstSchema");var yn=["$ref","$defs","definitions","allOf","anyOf","not","if","then","else","const","patternProperties","propertyNames","dependencies","dependentSchemas","dependentRequired","contains","unevaluatedProperties","unevaluatedItems","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","minLength","maxLength","pattern","minItems","maxItems","uniqueItems","minProperties","maxProperties"];function re(e,t,n){if(D(e)){for(let r of yn)r in e&&!n.has(r)&&n.set(r,t||"(root)");if(D(e.properties))for(let[r,o]of Object.entries(e.properties))re(o,te(t,r),n);if(D(e.items)&&re(e.items,`${t||"(root)"}[]`,n),Array.isArray(e.oneOf))for(let r of e.oneOf)re(r,`${t||"(root)"}(oneOf)`,n);D(e.additionalProperties)&&!n.has("additionalProperties (schema form)")&&n.set("additionalProperties (schema form)",t||"(root)")}}i(re,"collectUnsupportedKeywords");function So(e){if(!D(e))return;let t=new Map;if(re(e,"",t),t.size===0)return;let n=[...t.entries()].map(([r,o])=>`\`${r}\` (at ${o})`).join(", ");throw new Error(`outputSchema uses unsupported JSON-Schema keyword(s): ${n}. The workflow validator supports only type, enum, required, properties, items, oneOf, and additionalProperties: false (nested object arrays included). Inline the referenced shapes, drop value-constraint keywords, and use that subset.`)}i(So,"assertSupportedOutputSchema");function kn(e){let t=e.indexOf("{"),n=e.indexOf("[");return t<0?n:n<0?t:Math.min(t,n)}i(kn,"firstStructureStart");function mt(e){let t=kn(e);if(t<0)return;let n=e[t],r=n==="{"?"}":"]",o=0,d=!1,s=!1;for(let c=t;c<e.length;c+=1){let u=e[c];if(d){s?s=!1:u==="\\"?s=!0:u==='"'&&(d=!1);continue}if(u==='"'){d=!0;continue}if(u===n)o+=1;else if(u===r&&(o-=1,o===0))return e.slice(t,c+1)}}i(mt,"balancedStructure");function bn(e){if(typeof e!="string"||e.trim().length===0)return;let t=/```(?:json)?\s*([\s\S]*?)```/gi,n,r;for(;(n=t.exec(e))!==null;){let o=n[1]?.trim();o&&(r=o)}return r?mt(r)??r:mt(e)}i(bn,"extractJsonCandidate");function _e(e,t){let n=bn(e);if(n===void 0)return{ok:!1,errors:["no JSON value was found in the output"]};let r;try{r=JSON.parse(n)}catch(d){return{ok:!1,errors:[`output was not valid JSON: ${gn(d)}`]}}let o=ne(r,t);return{ok:o.length===0,value:r,errors:o}}i(_e,"evaluateStructuredOutput");function gt(e){return["## Required Output Format","After your analysis, end your response with a single fenced ```json code block containing ONLY a JSON value that matches the JSON Schema below. Put nothing after the closing fence.","Schema:","```json",oe(e),"```"].join(`
|
|
15
|
-
`)}i(gt,"buildStructuredOutputInstruction");function ht(e,t){return["Your previous response did not produce a valid result object for the workflow.","Problems:",...e.map(n=>`- ${n}`),"Re-emit ONLY a single fenced ```json code block containing a JSON value that matches this schema. No prose, nothing after the closing fence.","Schema:","```json",oe(t),"```"].join(`
|
|
16
|
-
`)}i(ht,"buildStructuredOutputRepairPrompt");var vo={type:"object",additionalProperties:!1,required:["schemaVersion","outcomes","assertedCoverage"],properties:{schemaVersion:{type:"number",enum:[1]},outcomes:{type:"array",items:{type:"object",additionalProperties:!1,required:["target","disposition","evidenceRefs"],properties:{target:{oneOf:[{type:"object",additionalProperties:!1,required:["actorPath","turnId"],properties:{actorPath:{type:"string"},turnId:{type:"string"}}},{type:"object",additionalProperties:!1,required:["evidenceRef"],properties:{evidenceRef:{type:"string"}}}]},disposition:{type:"string",enum:["confirmed","refuted","unresolved"]},evidenceRefs:{type:"array",items:{type:"string"}}}}},assertedCoverage:{type:"array",items:{type:"string"}}}};function kt(e){if(!se(e)||!Oe(e,["schemaVersion","outcomes","assertedCoverage"])||e.schemaVersion!==1||!Array.isArray(e.outcomes)||e.outcomes.length>50||!Array.isArray(e.assertedCoverage)||e.assertedCoverage.length>50)return;let t=bt(e.assertedCoverage);if(t===void 0)return;let n=[];for(let r of e.outcomes){let o=xn(r);if(o===void 0)return;n.push(o)}return{schemaVersion:1,outcomes:n,assertedCoverage:[...new Set(t)]}}i(kt,"parsePatternDispositionEnvelope");function yt(e){if(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number"&&Number.isFinite(e))return e;if(Array.isArray(e)){let n=[];for(let r of e){let o=yt(r);if(o===void 0)return;n.push(o)}return n}if(!se(e))return;let t={};for(let[n,r]of Object.entries(e)){let o=yt(r);if(o===void 0)return;t[n]=o}return t}i(yt,"toAgentMetadataValue");function xn(e){if(!se(e)||!Oe(e,["target","disposition","evidenceRefs"])||!se(e.target)||!Oe(e.target,["actorPath","turnId","evidenceRef"])||e.disposition!=="confirmed"&&e.disposition!=="refuted"&&e.disposition!=="unresolved"||!Array.isArray(e.evidenceRefs)||e.evidenceRefs.length>20)return;let t=bt(e.evidenceRefs);if(t===void 0)return;let n=ie(e.target.actorPath),r=ie(e.target.turnId),o=ie(e.target.evidenceRef),d=n!==void 0&&r!==void 0;if(d!==(o!==void 0)&&!(!d&&(e.target.actorPath!==void 0||e.target.turnId!==void 0)))return{target:d?{actorPath:n,turnId:r}:{evidenceRef:o},disposition:e.disposition,evidenceRefs:[...new Set(t)]}}i(xn,"parseOutcome");function bt(e){let t=[];for(let n of e){let r=ie(n);if(r===void 0)return;t.push(r)}return t}i(bt,"stringArray");function ie(e){if(typeof e!="string")return;let t=e.trim();return t.length>0&&t.length<=512?t:void 0}i(ie,"boundedString");function se(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}i(se,"isRecord");function Oe(e,t){let n=new Set(t);return Object.keys(e).every(r=>n.has(r))}i(Oe,"hasOnlyKeys");function K(e){let t=e instanceof Error?e:new Error(String(e)),n=/^[A-Za-z][A-Za-z0-9_.-]{0,63}$/.test(t.name)?t.name:"Error",r="code"in t?t.code:void 0,o=typeof r=="string"&&/^[A-Z][A-Z0-9_]{0,79}$/.test(r)?r:"KODAX_LOCAL_EXECUTION_ERROR",d=Ge(t.message).slice(0,1e3),s="Local SDK execution failed.";return{source:"local",errorClass:"local_execution_error",requestPhase:"local_execution",errorName:n,code:o,safeMessage:s,message:`${s} ${n}: ${d}`}}i(K,"buildLocalExecutionFailure");function Pe(e){return e.failure??(!e.success&&e.errorMetadata?.lastError?K(new Error(e.errorMetadata.lastError)):void 0)}i(Pe,"childExecutionFailure");import{execFileSync as Un}from"child_process";import{randomUUID as Nn}from"node:crypto";import Ln from"fs/promises";import Rt from"os";function xt(e,t,n){let r=e?.provider?.trim()||process.env[t]?.trim()||void 0,o=e?.model?.trim()||process.env[n]?.trim()||void 0;if(!(!r&&!o))return{provider:r,model:o}}i(xt,"resolveTier");function Ee(e,t){let n=Xe()?.modelTiers;if(e==="fast")return t?xt(n?.fast,"KODAX_FAST_PROVIDER","KODAX_FAST_MODEL"):void 0;if(e==="deep")return xt(n?.deep,"KODAX_DEEP_PROVIDER","KODAX_DEEP_MODEL")}i(Ee,"resolveModelHintTier");import{randomUUID as wn}from"node:crypto";function Cn(){let e=process.env.KODAX_FALLBACK_PROVIDERS?.trim();return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}i(Cn,"resolveFallbackChain");function Sn(e){if(Y(e))return!1;if(e instanceof M||e instanceof N){let t=e.metadata;if(t?.retryable===!1||t?.failureCode&&t.failureCode!=="response_stream_error")return!1;if(t?.httpStatus!==void 0)return t.httpStatus===408||t.httpStatus===429||t.httpStatus>=500;if(Re(e))return!1}return e instanceof N||e instanceof j||e instanceof M}i(Sn,"isFallbackEligibleError");function Rn(e){return e instanceof N?"rate-limit exhausted":e instanceof j?"network error":e instanceof M?"provider error":e instanceof Error?e.message:String(e)}i(Rn,"errorReason");function Tn(e){let t=e.failure;return e.success||e.interrupted||!t||t.source==="local"||t.errorClass==="local_execution_error"||t.failureCode&&t.failureCode!=="response_stream_error"||t.retryable===!1||t.errorClass==="user_abort"||Y(t)?!1:t.httpStatus!==void 0?t.httpStatus===408||t.httpStatus===429||t.httpStatus>=500:["rate_limit","provider_overloaded","connection_failure","request_timeout","stream_idle_timeout","chunk_timeout"].includes(t.errorClass)}i(Tn,"unavailableProviderResult");function H(e){let t=e.totalTokensUsed??e.usage?.totalTokens??e.contextTokenSnapshot?.usage?.totalTokens??e.contextTokenSnapshot?.currentTokens??0;return Number.isFinite(t)&&t>0?t:0}i(H,"readChildTokenUsage");function wt(e,t){let n={inputTokens:(e?.inputTokens??0)+t.inputTokens,outputTokens:(e?.outputTokens??0)+t.outputTokens,totalTokens:(e?.totalTokens??0)+t.totalTokens};for(let r of["cachedReadTokens","cachedWriteTokens","thoughtTokens"])(e?.[r]!==void 0||t[r]!==void 0)&&(n[r]=(e?.[r]??0)+(t[r]??0));return n}i(wt,"addUsage");async function Ae(e,t,n,r){let o=e.provider??"anthropic",d=`route_${wn()}`,s=0,c,u,m=!0,h=0,p,b=i(async x=>{let R={chainId:d,attempt:++s,fromProvider:c};c=x.provider??o;let C=new Map,k=i(()=>{let f;for(let v of C.values())v!==void 0&&(f=wt(f,v));return f},"observedUsage"),y;try{y=await Be(R,()=>qe(f=>{f.route?.chainId===d&&f.route.attempt===R.attempt&&f.state!=="started"&&C.set(f.requestId,f.usage)},()=>n(x,t)))}catch(f){m=!1;let v=k()?.totalTokens??0;return v>0&&(h+=v,r?.onUsage?.(h)),{error:f}}let a=k(),l=a?.totalTokens??0;h+=Math.max(H(y),l),r?.onUsage?.(h);let g=a!==void 0&&l>=(y.usage?.totalTokens??0)?a:y.usage;return g===void 0||[...C.values()].some(f=>f===void 0)?m=!1:u=wt(u,g),{result:y}},"attempt");p=await b(e);let S=Cn().filter(x=>x!==o&&(r?.isProviderAllowed?.(x)??!0));for(let x of S){let R="result"in p?Tn(p.result):Sn(p.error);if(e.abortSignal?.aborted||!R)break;r?.onFallback?.({fromProvider:o,toProvider:x,reason:"result"in p?p.result.failure.message:Rn(p.error)}),p=await b({...e,provider:x,model:void 0})}if("result"in p)return s===1&&h<=H(p.result)&&(m?u?.totalTokens===p.result.usage?.totalTokens:p.result.usage===void 0)?p.result:{...p.result,totalTokensUsed:h,usage:m?u:void 0};throw p.error}i(Ae,"invokeChildWithFallback");import{execFileSync as vn}from"node:child_process";import{existsSync as In}from"node:fs";import{readFile as _n,unlink as On,writeFile as Pn,rename as En}from"node:fs/promises";import{dirname as An,isAbsolute as Dn,relative as Mn,resolve as B}from"node:path";import{randomUUID as $n}from"node:crypto";var ae=i(e=>`${e}.generation.json`,"markerPath");function Xo(e){return In(ae(e))}i(Xo,"hasGenerationWorktree");async function Ct(e,t,n){let r={...n,isolation:{worktreePath:B(e),gitRoot:B(t)}},o=ae(e),d=`${o}.${$n()}.tmp`;return await Pn(d,JSON.stringify(r),{mode:384}),await En(d,o),r}i(Ct,"pinGenerationWorktree");async function St(e,t){let n=e.isolation;if(!n||B(n.gitRoot)!==B(t))throw new Error("Generation worktree repository no longer matches.");let r=n.worktreePath;if(!Dn(r)||An(r)===r)throw new Error("Invalid generation worktree path.");let o=JSON.parse(await _n(ae(r),"utf8"));if(JSON.stringify(be(o))!==JSON.stringify(be(e)))throw new Error("Generation worktree checkpoint no longer matches.");if(Q({cwd:t}),!vn("git",["worktree","list","--porcelain"],{cwd:t,windowsHide:!0,encoding:"utf8"}).split(/\r?\n/).filter(s=>s.startsWith("worktree ")).map(s=>B(s.slice(9))).includes(B(r))||!Mn(t,r))throw new Error("Generation worktree is no longer registered in its repository.");return r}i(St,"restoreGenerationWorktree");async function De(e){try{await On(ae(e))}catch(t){if(t.code!=="ENOENT")throw t}}i(De,"releaseGenerationWorktree");import{dirname as Fn}from"node:path";var Me,de;async function _t(){if(Me)return Me;if(!de){let e="./agent.js";de=import("./agent-DS7M57WD.js").then(t=>{let n=t.runKodaX;if(typeof n!="function")throw new Error("[child-executor] Agent module loaded but `runKodaX` export is missing or not a function. This indicates an API break in packages/coding/src/agent.ts. Check that `export { runKodaX }` is still present.");return Me=n,n}).catch(t=>{if(de=void 0,t instanceof Error&&t.message.startsWith("[child-executor]"))throw t;let n=t instanceof Error?t.message:String(t);throw new Error(`[child-executor] Failed to lazy-load agent module (\`${e}\`) for a nested Agent turn. This usually means the @kodax-ai/coding build is broken or out of date. Underlying cause: ${n}`)})}return de}i(_t,"getRunKodaX");var Wn=["You are summarizing your own just-completed child-agent report for a parent workflow.","Do not use tools. Do not continue investigation. Produce only the digest."].join(`
|
|
17
|
-
`),jn=["Create a short user-facing digest of your previous report for the parent workflow.","Return only 2-4 bullet lines.","Each bullet must be concrete: a finding, decision, risk, evidence pointer, unresolved question, or next action.","Use the same natural language as the user request or your report.","Do not include a title, table, generic preamble, or workflow handoff markers."].join(`
|
|
18
|
-
`),Ot=4,Pt=1e4,Kn=45e3,Hn=40;function Et(e,t){if(e.generationCheckpoint){if(!e.historyStorage||!e.actorTurnId)throw new Error("Worker generation checkpoint requires its original Actor turn and history storage.");return{id:e.generationCheckpoint.sessionId,generationCheckpoint:e.generationCheckpoint,storage:e.historyStorage,scope:"managed-task-worker"}}return e.historyStorage?{id:`worker-${Nn()}`,scope:"managed-task-worker",storage:e.historyStorage,...t&&t.length>0?{initialMessages:[...t]}:{}}:t&&t.length>0?{initialMessages:[...t]}:void 0}i(Et,"buildChildRunSession");function ce(e){let t={};return e.parentOptions.repoIntelligenceMode!==void 0&&(t.repoIntelligenceMode=e.parentOptions.repoIntelligenceMode),e.parentOptions.repoIntelligenceTrace!==void 0&&(t.repoIntelligenceTrace=e.parentOptions.repoIntelligenceTrace),t}i(ce,"inheritRepoIntelligenceContext");async function Ti(e,t,n){if(e.length===0)return It;let r=e.filter(p=>p.readOnly),o=e.filter(p=>!p.readOnly),d=kr(o,n.parentRole,n.parentHarness),s=[...r,...d];if(s.length===0)return It;let c=[],u=[],m=n.onProgress??(()=>{});m(`Starting ${s.length} child tasks in parallel`);let h=await Ye({bundles:s,runOne:i(p=>p.readOnly?ar(p,t,n):lr(p,t,n),"runOne"),maxParallel:n.maxParallel,abortSignal:n.abortSignal,onProgress:i((p,b)=>{p.kind==="start"?m(`[${b.completedCount}/${b.totalCount}] Running: ${p.bundle.id}`):p.kind==="item-done"&&m(`[${b.completedCount}/${b.totalCount}] Done: ${p.bundle.id} \u2192 ${p.result.status}`)},"onProgress")});for(let p of h.results)p.status==="fulfilled"?c.push(p.value):c.push(F(p.bundle,`[Crash] ${p.reason.message}`,"failed"));for(let p of h.cancelled)u.push(p.id);return yr(s,c,u)}i(Ti,"executeChildAgents");function At(e,t){let n=[...t?.bindingConstraints??[],...e.constraints];return{...t,delegatedObjective:e.objective,bindingConstraints:n,...e.scopeSummary!==void 0?{scopeHint:e.scopeSummary}:{},readOnly:t?.readOnly===!0||e.readOnly}}i(At,"buildChildPermissionIntent");var Bn=["list_dispatchable_agents","spawn_agent","run_workflow","send_message","followup_task","wait_agent","interrupt_agent","list_agents","agent_output","emit_managed_protocol"];function ue(e){return[...Z(),...ke(e)]}i(ue,"childToolDefinitions");function qn(e,t,n){if(!t)return e;let r=new Set(t.tools),o=r.has("*"),d=new Set(e);for(let s of ue(n)){let c=!o&&!r.has(s.name),u=!t.network&&(s.sideEffect==="reads-network"||s.sideEffect==="mutates-network"),m=!t.canAskUser&&s.name==="ask_user_question";(c||u||m)&&d.add(s.name)}return[...d]}i(qn,"restrictToolsForActor");function Dt(e,t,n,r,o=!1){let d=o?ke(r).filter(c=>c.sideEffect!=="readonly").map(c=>c.name):[],s=qn([...e,...d],t,r);return n!==void 0?s:[...new Set([...s,...Bn])]}i(Dt,"restrictToolsForChildRuntime");function fe(e,t){return t.contextAgentId??e.id}i(fe,"childContextAgentId");function pe(e,t){return t.contextParentAgentId??(t.actorControl!==void 0?t.actorParentAgentId:e.currentAgentId)}i(pe,"childContextParentAgentId");function le(e,t,n){if(t.includes(e))return!1;let r=Z().find(o=>o.name===e);return r?n.toolVisibilityPolicy?.({name:r.name,sideEffect:r.sideEffect,planModeAllowed:r.planModeAllowed===!0})??!0:!1}i(le,"isChildToolVisible");function Ue(e,t){return t===void 0||t.providers.includes("*")||t.providers.includes(e)}i(Ue,"isProviderAllowed");function Ne(e,t){if(!Ue(e,t))throw new Error(`Child Actor is not authorized to use provider ${e}.`)}i(Ne,"assertChildProviderAllowed");function Gn(e){let t=JSON.parse(e);if(typeof t!="object"||t===null||!("path"in t))throw new Error("worktree_create returned an invalid payload");let n=t.path;if(typeof n!="string"||n.length===0)throw new Error("worktree_create returned an invalid path");return n}i(Gn,"readWorktreePath");async function Mt(e,t,n){if(e.isolation!=="worktree")return{ctx:t};let r=n?.isolation?void 0:await nt({description:`workflow-${e.id}`},t),o=n?.isolation?await St(n,t.gitRoot??L(t)):Gn(r);return{ctx:{...t,gitRoot:o,executionCwd:o},worktreePath:o,parentGitRoot:t.gitRoot??L(t)}}i(Mt,"prepareChildIsolationScope");function $t(e,t){return t.worktreePath?[`[Workflow worktree: ${t.worktreePath}]`,e].join(`
|
|
19
|
-
`):e}i($t,"annotateWorktreeSummary");async function Tt(e,t){if(e.worktreePath&&!e.suspended)try{if(await De(e.worktreePath),t.workflowWorktreeBaseDir)return;await rt(e.worktreePath,{...t,workflowWorktreeBaseDir:Fn(e.worktreePath)});return}catch(n){return`[Workflow worktree cleanup failed: ${n instanceof Error?n.message:String(n)}]`}}i(Tt,"cleanupChildIsolationScope");function Xn(e,t){return t?{...e,summary:`${e.summary}
|
|
20
|
-
${t}`}:e}i(Xn,"appendCleanupWarning");async function Ut(e,t,n){let r;try{r=await n()}catch(d){throw await Tt(e,t),d}let o=await Tt(e,t);return Xn(r,o)}i(Ut,"withChildIsolationCleanup");function Vn(e){let t=e.split(/\r?\n+/).map(n=>n.trim()).filter(n=>n.length>0).filter(n=>!/\[\/?workflow handoff\]/i.test(n)).filter(n=>!/^```/.test(n));if(t.length!==0)return t.slice(0,Ot).join(`
|
|
21
|
-
`)}i(Vn,"normalizeWorkflowChildDigest");var zn=4096,Yn=/(?:\[truncated|tool output truncated|full output saved to:|\[tool error\]|summary unavailable|digest failed)/i,Jn=/^(?:i will|i'll|i need to|next i|let me)\b/i;function Qn(e){if(typeof e!="object"||e===null||Array.isArray(e)||e.type!=="object")return!1;let t=e.properties,n=e.required;if(typeof t!="object"||t===null||Array.isArray(t)||!Array.isArray(n)||!n.includes("summary"))return!1;let r=t.summary;return typeof r=="object"&&r!==null&&!Array.isArray(r)&&r.type==="string"}i(Qn,"hasTopLevelSummarySchema");function Zn(e){let t=e.split(/\r?\n/).map(r=>r.trim()).filter(r=>r.length>0&&!/^```[a-z0-9_-]*$/i.test(r)),n=t.join(`
|
|
22
|
-
`);if(!(t.length<1||t.length>Ot)&&!(n.length>zn)&&!Yn.test(n)&&!Jn.test(n))return n}i(Zn,"normalizeReusableWorkflowSummary");function Nt(e,t,n){if(e.workflowOutputContract?.kodaxAuthored!==!0)return;let r=[];if(Qn(e.outputSchema)&&typeof t=="object"&&t!==null&&!Array.isArray(t)){let o=t.summary;typeof o=="string"&&r.push(o)}e.workflowOutputContract.terseResult&&r.push(n);for(let o of r){let d=Zn(o);if(d!==void 0)return d}}i(Nt,"reusableWorkflowSummary");function Lt(e,t,n,r){return e.workflowChild===!0&&e.abortSignal?.aborted!==!0&&t.success===!0&&t.limitReached!==!0&&t.interrupted!==!0&&t.lastText.trim().length>0&&(n===void 0||Nt(n,r,t.lastText)===void 0)}i(Lt,"shouldCreateWorkflowChildDigest");function er(e){return e.replace(/[\\/]+SKILL\.md$/i,"")}i(er,"deriveSkillRootFromSkillFile");function tr(e,t){return e.split(/\r?\n/).find(r=>r.trim().startsWith(t))?.trim().slice(t.length).trim()||void 0}i(tr,"extractPrefixedLine");function vt(e,t,n){let r=e.split(/\r?\n/),o=r.findIndex(s=>s.trim()===t);if(o<0)return[];let d=[];for(let s of r.slice(o+1)){let c=s.trim();if(!c){if(d.length>0)break;continue}if(!c.startsWith("- ")||(d.push(c),d.length>=n))break}return d}i(vt,"extractListSection");function nr(e){if(!e)return;let t=tr(e.expandedContent,"Skill root:")??er(e.path),n=vt(e.expandedContent,"Support roots:",12),r=vt(e.expandedContent,"Support file inventory:",Hn);return["## Active Skill Resources",`Parent task is using skill "${e.name}". If this child needs skill support files, use these exact paths instead of broad home/workspace searches.`,`- Skill file: ${e.path}`,t?`- Skill root: ${t}`:void 0,n.length>0?"Support roots:":void 0,...n,r.length>0?"Selected support files:":void 0,...r,n.length>0?"If a needed support file is not listed above, combine its relative path with the matching support root.":void 0].filter(d=>!!d).join(`
|
|
23
|
-
`)}i(nr,"buildActiveSkillResourceBriefing");async function rr(e,t){if(e.skillRegistry)return e.skillRegistry;let n=Je(t);return n.size===0&&(n=await Qe(t)),n}i(rr,"resolveReferencedSkillRegistry");async function or(e,t){let n=[...xe(e),...we(e)].sort((m,h)=>m.start-h.start);if(n.length===0)return;let r=L(t),o=t.gitRoot??r,d=await rr(t,o),s=t.skillInvocation,c=s!==void 0&&n.some(m=>m.name===s.name),u=new Set;for(let m of n)m.name!==s?.name&&(m.raw.startsWith("/skill:")||d.has(m.name))&&u.add(m.name);if(!(!c&&u.size===0))return[c?"## Explicit User Skill Invocation":void 0,c?`The host provided the active user-invoked Skill "${s?.name}" through structured Skill context. Follow that context directly and do not call the \`skill\` tool for it again.`:void 0,u.size>0?"## Referenced Skills":void 0,u.size>0?`The child objective mentions Skill reference(s): ${[...u].map(m=>`/skill:${m}`).join(", ")}.`:void 0,u.size>0?"These references came through a model-authored child objective, not a direct user invocation. Invoke the `skill` tool before following them so model-invocation policy remains enforced.":void 0].filter(m=>!!m).join(`
|
|
24
|
-
|
|
25
|
-
`)}i(or,"buildReferencedSkillBriefing");function Ft(e,t,n,r){return t.workflowDigestMode==="async"&&e.isolation!=="worktree"&&t.onWorkflowChildDigest!==void 0&&Lt(t,n,e,r)}i(Ft,"shouldRunWorkflowDigestAsync");function Wt(e){if(e===void 0)return;let t={...e.onContextBudgetSnapshot!==void 0?{onContextBudgetSnapshot:e.onContextBudgetSnapshot}:{},...e.onPromptCacheDiagnostics!==void 0?{onPromptCacheDiagnostics:e.onPromptCacheDiagnostics}:{},...e.onToolExposurePlanned!==void 0?{onToolExposurePlanned:e.onToolExposurePlanned}:{},...e.onContextCompactionSkipped!==void 0?{onContextCompactionSkipped:e.onContextCompactionSkipped}:{}};return Object.keys(t).length>0?t:void 0}i(Wt,"selectContextDiagnosticEvents");async function Le(e){let t=Nt(e.bundle,e.structured,e.result.lastText);if(t!==void 0)return{digest:t,totalTokensUsed:0,digestTokensUsed:0};if(!Lt(e.options,e.result,e.bundle,e.structured))return{totalTokensUsed:0,digestTokensUsed:0};let n=new AbortController,r=i(()=>n.abort(),"onParentAbort");e.options.abortSignal?.addEventListener("abort",r);let o=setTimeout(()=>n.abort(),e.timeoutMs);try{let d=Wt(e.options.parentOptions.events),s=await e.runFn({provider:e.provider,...e.model?{model:e.model}:{},effort:e.effort??e.options.parentOptions.effort,reasoningMode:e.options.parentOptions.reasoningMode,agentMode:"sa",maxIter:1,abortSignal:n.signal,extensionRuntime:e.options.parentOptions.extensionRuntime,...d!==void 0?{events:d}:{},...e.options.parentOptions.compaction!==void 0?{compaction:e.options.parentOptions.compaction}:{},...e.options.parentOptions.disablePromptCache!==void 0?{disablePromptCache:e.options.parentOptions.disablePromptCache}:{},guardrails:e.options.guardrails,session:{initialMessages:e.result.messages},context:{gitRoot:e.scopeCtx.gitRoot,executionCwd:e.scopeCtx.executionCwd??e.scopeCtx.gitRoot,shellExecution:e.scopeCtx.shellExecution,assertReadablePath:e.scopeCtx.assertReadablePath,toolVisibilityPolicy:e.scopeCtx.toolVisibilityPolicy,skillRegistry:e.scopeCtx.skillRegistry,admitLearnedSkillInvocation:e.scopeCtx.admitLearnedSkillInvocation,skillScriptRunner:e.scopeCtx.skillScriptRunner,...ce(e.options),...e.options.parentOptions.contextDiagnostics!==void 0?{contextDiagnostics:e.options.parentOptions.contextDiagnostics}:{},systemPromptOverride:Wn,excludeTools:ue(e.options.parentOptions.extensionRuntime).map(h=>h.name),contextIdentitySessionId:e.scopeCtx.contextIdentitySessionId??e.scopeCtx.sessionId,ownsContextRevision:!1,currentAgentId:fe(e.bundle,e.options),parentAgentId:pe(e.scopeCtx,e.options)}},jn),c=Vn(s.lastText),u=H(s),m=s.usage?{inputTokens:s.usage.inputTokens,outputTokens:s.usage.outputTokens,totalTokens:s.usage.totalTokens,...s.usage.cachedReadTokens!==void 0?{cacheReadTokens:s.usage.cachedReadTokens}:{}}:void 0;return c?{digest:c,totalTokensUsed:u,digestTokensUsed:u,...m?{usage:m}:{}}:{totalTokensUsed:u,digestTokensUsed:u,attemptFailed:!0,...m?{usage:m}:{}}}catch{return{totalTokensUsed:0,digestTokensUsed:0,attemptFailed:!0}}finally{clearTimeout(o),e.options.abortSignal?.removeEventListener("abort",r)}}i(Le,"createWorkflowChildDigest");function jt(e){Le({...e,timeoutMs:Kn}).then(t=>{try{e.options.onWorkflowChildDigest?.({childId:e.bundle.id,...t.digest?{digest:t.digest}:{},...t.attemptFailed?{digestFailed:!0}:{},...t.digestTokensUsed>0?{digestTokensUsed:t.digestTokensUsed}:{},...t.usage?{usage:t.usage}:{},totalTokensUsed:t.totalTokensUsed})}catch{}})}i(jt,"scheduleWorkflowChildDigest");var ir=["You are re-formatting your own just-completed report into the JSON a parent workflow requires.","Do not use tools. Do not continue investigation. Output only the JSON block."].join(`
|
|
26
|
-
`),sr=15e3;async function Kt(e){let t=e.bundle.outputSchema;if(t===void 0)return;let n=_e(e.result.lastText,t);if(n.ok)return e.bundle.structuredOutputContract==="pattern-disposition-parse-only"?kt(n.value):n.value;if(e.bundle.structuredOutputContract==="pattern-disposition-parse-only")return;if(e.options.abortSignal?.aborted===!0||e.result.success!==!0||e.result.limitReached===!0||e.result.interrupted===!0)return n.value;let r=new AbortController,o=i(()=>r.abort(),"onParentAbort");e.options.abortSignal?.addEventListener("abort",o);let d=setTimeout(()=>r.abort(),sr);try{let s=Wt(e.options.parentOptions.events),c=await e.runFn({provider:e.provider,...e.model?{model:e.model}:{},effort:e.effort??e.options.parentOptions.effort,reasoningMode:e.options.parentOptions.reasoningMode,agentMode:"sa",maxIter:1,abortSignal:r.signal,extensionRuntime:e.options.parentOptions.extensionRuntime,...s!==void 0?{events:s}:{},...e.options.parentOptions.compaction!==void 0?{compaction:e.options.parentOptions.compaction}:{},...e.options.parentOptions.disablePromptCache!==void 0?{disablePromptCache:e.options.parentOptions.disablePromptCache}:{},guardrails:e.options.guardrails,session:{initialMessages:e.result.messages},context:{gitRoot:e.scopeCtx.gitRoot,executionCwd:e.scopeCtx.executionCwd??e.scopeCtx.gitRoot,shellExecution:e.scopeCtx.shellExecution,assertReadablePath:e.scopeCtx.assertReadablePath,toolVisibilityPolicy:e.scopeCtx.toolVisibilityPolicy,skillRegistry:e.scopeCtx.skillRegistry,admitLearnedSkillInvocation:e.scopeCtx.admitLearnedSkillInvocation,skillScriptRunner:e.scopeCtx.skillScriptRunner,...ce(e.options),...e.options.parentOptions.contextDiagnostics!==void 0?{contextDiagnostics:e.options.parentOptions.contextDiagnostics}:{},systemPromptOverride:ir,excludeTools:ue(e.options.parentOptions.extensionRuntime).map(m=>m.name),agentScope:e.scopeCtx.agentScope,contextIdentitySessionId:e.scopeCtx.contextIdentitySessionId??e.scopeCtx.sessionId,ownsContextRevision:!1,currentAgentId:fe(e.bundle,e.options),parentAgentId:pe(e.scopeCtx,e.options)}},ht(n.errors,t));return _e(c.lastText,t).value??n.value}catch{return n.value}finally{clearTimeout(d),e.options.abortSignal?.removeEventListener("abort",o)}}i(Kt,"resolveChildStructuredOutput");function Ht(e,t,n,r,o){if(!e.specialistName)return{systemPromptOverride:t,excludeTools:n};let d=it(e.specialistName,r.agentScope);if(!d)return{systemPromptOverride:t,excludeTools:n};let s=d.agent,c={...s.model?{modelOverride:s.model}:{},...s.provider?{providerOverride:s.provider}:{},...s.effort?{effortOverride:s.effort}:{},...s.reasoning?{reasoningProfile:s.reasoning}:{}},u=typeof s.instructions=="string"?s.instructions:t,m=ot(d);if(m===void 0)return{systemPromptOverride:u,excludeTools:n,...c};let h=new Set(m??[]),p=new Set(n),S=ue(o).map(x=>x.name).filter(x=>p.has(x)||!h.has(x));return{systemPromptOverride:u,excludeTools:S,...c}}i(Ht,"resolveSpecialistOverride");function $e(e){if(!(e===void 0||e.trim().length===0))return Ve(e)}i($e,"normalizeChildEffort");function Bt(e,t,n,r){let o=$e(n.effort)??(n.reasoningMode!==void 0?ze(n.reasoningMode):n.thinking===void 0?void 0:n.thinking?"auto":"none"),d=$e(t),s=$e(e.effort);if(d!==void 0&&s!==void 0&&s!==d)throw new Error(`specialist "${e.specialistName??"unknown"}" locks effort "${d}", but dispatch requested "${s}". Remove the dispatch effort or match the specialist effort.`);let c=d??s;if(!r)return c??o;let u=at(c??o??r.default,{...r,default:c??r.default});if(c!==void 0&&u!==c)throw new Error(`Specialist effort '${c}' exceeds its profile maximum.`);return u}i(Bt,"resolveChildEffort");function qt(e,t,n,r,o,d,s){let c=e.provider!==void 0||e.model!==void 0||t!==void 0||n!==void 0,u=e.modelHint??"inherited",m=e.modelHint===void 0?"inherited":c?"shadowed-by-selector":e.modelHint==="balanced"?"balanced-parent":e.modelHint==="fast"&&!o?"fast-write-ineligible":d===void 0?"unconfigured":"applied",h=e.provider!==void 0?"explicit":t!==void 0?"specialist":d?.provider!==void 0?"tier":r.provider!==void 0?"parent":"default",p=e.model!==void 0?"explicit":n!==void 0?"specialist":d?.model!==void 0?"tier":r.model!==void 0?"parent":void 0,b=e.provider??t??d?.provider??r.provider??"anthropic",S=e.model??n??d?.model??r.model;return{provider:b,...S!==void 0?{model:S}:{},facts:{requestedTier:u,tierOutcome:m,providerSource:h,...p?{modelSource:p}:{},initialProvider:b,...S!==void 0?{initialModel:S}:{},...s!==void 0?{resolvedEffort:s}:{}}}}i(qt,"resolveChildRoute");function Gt(e,t,n,r){let o=ge(e),d=He(o.getEffectiveContextWindow(t),o.getEffectiveMaxOutputTokens(t)),s=new Set(r),c=Z().filter(m=>!s.has(m.name)),u=z(n)+z(JSON.stringify(c))+64;return Math.max(0,d-u)}i(Gt,"resolveChildBriefingTokenBudget");async function ar(e,t,n){let r=await Mt(e,t,n.generationCheckpoint);return Ut(r,t,()=>dr(e,r,n))}i(ar,"executeReadChild");async function dr(e,t,n){let r=(await import("./running-session-Q5Y6A2QV.js")).createSessionControl(),o,d=Yt(e.id,n.onProgress,n.planModeBlockCheck,void 0,n.parentOptions.events,n.workflowCorrelation,n.childActivityName,n.maxIterationsPerChild,!0,l=>{o=l,n.onIteration?.(l)},{control:r,turnId:n.actorTurnId,capabilities:n.actorCapabilities,isolation:t}),{systemPromptOverride:s,excludeTools:c,modelOverride:u,providerOverride:m,effortOverride:h,reasoningProfile:p}=Ht(e,Fe,Vt,t.ctx,n.parentOptions.extensionRuntime),b=Dt([...t.ctx.excludeTools??[],...c],n.actorCapabilities,n.actorControl,n.parentOptions.extensionRuntime,!0),S=e.provider===void 0&&e.model===void 0&&m===void 0&&u===void 0?Ee(e.modelHint,!0):void 0,x=qt(e,m,u,n.parentOptions,!0,S),{provider:R,model:C}=x;Ne(R,n.actorCapabilities);let k;try{k=await Xt(e,t.ctx,n.maxIterationsPerChild,Gt(R,C,s,b),{canSpawn:n.actorControl!==void 0&&le("spawn_agent",b,t.ctx),canMessage:n.actorControl!==void 0&&le("send_message",b,t.ctx)})}catch(l){return F(e,l instanceof Error?l.message:String(l),"failed",{actualIterations:0,interrupted:!1,failure:K(l)})}let y,a=0;try{let l=Date.now(),g=await _t(),f=Et(n,n.initialMessages),v=Bt(e,h,n.parentOptions,p),P=R,E,w=await Ae({provider:R,model:C,effort:v,sessionControl:r,reasoningMode:n.parentOptions.reasoningMode,agentMode:n.actorControl?"ama":"sa",maxIter:n.maxIterationsPerChild,abortSignal:n.abortSignal,extensionRuntime:n.parentOptions.extensionRuntime,...n.parentOptions.compaction!==void 0?{compaction:n.parentOptions.compaction}:{},...n.parentOptions.disablePromptCache!==void 0?{disablePromptCache:n.parentOptions.disablePromptCache}:{},guardrails:n.guardrails,...f!==void 0?{session:f}:{},selfManual:t.ctx.selfManual,skillDynamicContext:t.ctx.skillDynamicContext,sandbox:n.parentOptions.sandbox??t.ctx.sandbox,context:{gitRoot:t.ctx.gitRoot,executionCwd:t.ctx.executionCwd??t.ctx.gitRoot,runtimeRunId:t.ctx.runtimeRunId,shellExecution:t.ctx.shellExecution,shellSandbox:t.ctx.shellSandbox,resolveShellPermissionMode:t.ctx.resolveShellPermissionMode,authorizeShellHostExecution:t.ctx.authorizeShellHostExecution,trustedTextMutationHost:t.ctx.trustedTextMutationHost,workspaceSandboxRoots:t.ctx.workspaceSandboxRoots,permissionIntent:At(e,n.parentOptions.permissionIntent??t.ctx.permissionIntent),assertReadablePath:t.ctx.assertReadablePath,toolVisibilityPolicy:t.ctx.toolVisibilityPolicy,skillRegistry:t.ctx.skillRegistry,admitLearnedSkillInvocation:t.ctx.admitLearnedSkillInvocation,skillScriptRunner:t.ctx.skillScriptRunner,...ce(n),...n.parentOptions.contextDiagnostics!==void 0?{contextDiagnostics:n.parentOptions.contextDiagnostics}:{},systemPromptOverride:s,excludeTools:b,agentScope:t.ctx.agentScope,actorControl:n.actorControl,...n.actorControl!==void 0?{actorQueueAgentId:he(t.ctx.contextIdentitySessionId??t.ctx.sessionId,e.id)}:{},contextIdentitySessionId:t.ctx.contextIdentitySessionId??t.ctx.sessionId,actorHost:n.actorHost,managedWorkBudget:t.ctx.managedWorkBudget,currentAgentId:fe(e,n),parentAgentId:pe(t.ctx,n),...n.actorTurnId!==void 0?{liveTurn:{deliveryKind:"initial",turnId:n.actorTurnId}}:{},...t.ctx.skillInvocation?{skillInvocation:t.ctx.skillInvocation}:{}},events:d},k,g,{onUsage:i(I=>{a=I},"onUsage"),onFallback:i(({fromProvider:I,toProvider:J,reason:$})=>{P=J,E=`${I} \u2192 ${J}: ${$}`,n.onProgress?.(`[fallback] ${e.id}: ${E}`)},"onFallback"),isProviderAllowed:i(I=>Ue(I,n.actorCapabilities),"isProviderAllowed")}),W=o?.current??0,T=H(w),q={runFn:g,result:w,provider:P,...P===R&&C?{model:C}:{},...v?{effort:v}:{},scopeCtx:t.ctx,bundle:e,options:n},G=await Kt(q),X={...q,structured:G},U=Ft(e,n,w,G),O=U?{totalTokensUsed:0,digestTokensUsed:0}:await Le({...X,timeoutMs:Pt});U&&jt(X);let V={...x.facts,...v?{resolvedEffort:v}:{},finalProvider:P,...P===R&&C?{finalModel:C}:{},...E?{fallbackReason:E}:{},iterations:W,...w.usage?{inputTokens:w.usage.inputTokens,outputTokens:w.usage.outputTokens,...w.usage.cachedReadTokens!==void 0?{cacheReadTokens:w.usage.cachedReadTokens}:{}}:{},...O.digestTokensUsed>0?{digestTokens:O.digestTokensUsed}:{},durationMs:Date.now()-l};y=F(e,$t(w.lastText,t),w.success&&!w.limitReached?"completed":"failed",{actualIterations:W,...o?{iteration:o}:{},interrupted:w.interrupted===!0,limitReached:w.limitReached===!0,totalTokensUsed:T+O.totalTokensUsed,digestTokensUsed:O.digestTokensUsed,...O.usage?{digestUsage:O.usage}:{},sessionId:w.sessionId,artifactPaths:Jt(w),digest:O.digest,digestFailed:O.attemptFailed,digestPending:U,provider:P,...P===R&&C?{model:C}:{},routeFacts:V,structured:G,failure:Pe(w)})}catch(l){y=F(e,l instanceof Error?l.message:String(l),"failed",{actualIterations:0,interrupted:!1,totalTokensUsed:a,failure:K(l)})}finally{zt(e.id,n.parentOptions.events,n.workflowCorrelation,n.childActivityName)}return y}i(dr,"runReadChildBody");async function lr(e,t,n){let r={...t,backups:new Map},o=await Mt(e,r,n.generationCheckpoint);return Ut(o,r,()=>cr(e,o,n))}i(lr,"executeWriteChild");async function cr(e,t,n){let r=(await import("./running-session-Q5Y6A2QV.js")).createSessionControl(),o=t.ctx,d,s=Yt(e.id,n.onProgress,n.planModeBlockCheck,void 0,n.parentOptions.events,n.workflowCorrelation,n.childActivityName,n.maxIterationsPerChild,!1,f=>{d=f,n.onIteration?.(f)},{control:r,turnId:n.actorTurnId,capabilities:n.actorCapabilities,isolation:t}),{systemPromptOverride:c,excludeTools:u,modelOverride:m,providerOverride:h,effortOverride:p,reasoningProfile:b}=Ht(e,Fe,We,o,n.parentOptions.extensionRuntime),S=pr(o.gitRoot??o.executionCwd??process.cwd(),c),x=Dt([...o.excludeTools??[],...u],n.actorCapabilities,n.actorControl,n.parentOptions.extensionRuntime),R=e.provider===void 0&&e.model===void 0&&h===void 0&&m===void 0?Ee(e.modelHint,!1):void 0,C=qt(e,h,m,n.parentOptions,!1,R),{provider:k,model:y}=C;Ne(k,n.actorCapabilities);let a;try{a=await Xt(e,o,n.maxIterationsPerChild,Gt(k,y,S,x),{canSpawn:n.actorControl!==void 0&&le("spawn_agent",x,o),canMessage:n.actorControl!==void 0&&le("send_message",x,o)})}catch(f){return F(e,f instanceof Error?f.message:String(f),"failed",{actualIterations:0,interrupted:!1,failure:K(f)})}let l,g=0;try{let f=Date.now(),v=await _t(),P=Et(n,n.initialMessages),E=Bt(e,p,n.parentOptions,b),w=k,W,T=await Ae({provider:k,model:y,effort:E,reasoningMode:n.parentOptions.reasoningMode,sessionControl:r,agentMode:n.actorControl?"ama":"sa",maxIter:n.maxIterationsPerChild,abortSignal:n.abortSignal,extensionRuntime:n.parentOptions.extensionRuntime,...n.parentOptions.compaction!==void 0?{compaction:n.parentOptions.compaction}:{},...n.parentOptions.disablePromptCache!==void 0?{disablePromptCache:n.parentOptions.disablePromptCache}:{},guardrails:n.guardrails,...P!==void 0?{session:P}:{},selfManual:o.selfManual,skillDynamicContext:o.skillDynamicContext,sandbox:n.parentOptions.sandbox??o.sandbox,context:{gitRoot:o.gitRoot,executionCwd:o.executionCwd??o.gitRoot,runtimeRunId:o.runtimeRunId,shellExecution:o.shellExecution,shellSandbox:o.shellSandbox,resolveShellPermissionMode:o.resolveShellPermissionMode,authorizeShellHostExecution:o.authorizeShellHostExecution,trustedTextMutationHost:o.trustedTextMutationHost,workspaceSandboxRoots:o.workspaceSandboxRoots,permissionIntent:At(e,n.parentOptions.permissionIntent??o.permissionIntent),assertReadablePath:o.assertReadablePath,toolVisibilityPolicy:o.toolVisibilityPolicy,skillRegistry:o.skillRegistry,admitLearnedSkillInvocation:o.admitLearnedSkillInvocation,skillScriptRunner:o.skillScriptRunner,...ce(n),...n.parentOptions.contextDiagnostics!==void 0?{contextDiagnostics:n.parentOptions.contextDiagnostics}:{},systemPromptOverride:S,excludeTools:x,agentScope:o.agentScope,actorControl:n.actorControl,...n.actorControl!==void 0?{actorQueueAgentId:he(o.contextIdentitySessionId??o.sessionId,e.id)}:{},contextIdentitySessionId:o.contextIdentitySessionId??o.sessionId,actorHost:n.actorHost,managedWorkBudget:o.managedWorkBudget,currentAgentId:fe(e,n),parentAgentId:pe(o,n),...n.actorTurnId!==void 0?{liveTurn:{deliveryKind:"initial",turnId:n.actorTurnId}}:{},...o.skillInvocation?{skillInvocation:o.skillInvocation}:{}},events:s},a,v,{onUsage:i($=>{g=$},"onUsage"),onFallback:i(({fromProvider:$,toProvider:me,reason:je})=>{w=me,W=`${$} -> ${me}: ${je}`,n.onProgress?.(`[fallback] ${e.id}: ${$} \u2192 ${me} (${je})`)},"onFallback"),isProviderAllowed:i($=>Ue($,n.actorCapabilities),"isProviderAllowed")}),q=d?.current??0,G=H(T),X={runFn:v,result:T,provider:w,...w===k&&y?{model:y}:{},...E?{effort:E}:{},scopeCtx:o,bundle:e,options:n},U=await Kt(X),O={...X,structured:U},V=Ft(e,n,T,U),I=V?{totalTokensUsed:0,digestTokensUsed:0}:await Le({...O,timeoutMs:Pt});V&&jt(O);let J={...C.facts,...E?{resolvedEffort:E}:{},finalProvider:w,...w===k&&y?{finalModel:y}:{},...W?{fallbackReason:W}:{},iterations:q,...T.usage?{inputTokens:T.usage.inputTokens,outputTokens:T.usage.outputTokens,...T.usage.cachedReadTokens!==void 0?{cacheReadTokens:T.usage.cachedReadTokens}:{}}:{},...I.digestTokensUsed>0?{digestTokens:I.digestTokensUsed}:{},durationMs:Date.now()-f};l=F(e,$t(T.lastText,t),T.success&&!T.limitReached?"completed":"failed",{actualIterations:q,...d?{iteration:d}:{},interrupted:T.interrupted===!0,limitReached:T.limitReached===!0,totalTokensUsed:G+I.totalTokensUsed,digestTokensUsed:I.digestTokensUsed,...I.usage?{digestUsage:I.usage}:{},sessionId:T.sessionId,artifactPaths:Jt(T),digest:I.digest,digestFailed:I.attemptFailed,digestPending:V,provider:w,...w===k&&y?{model:y}:{},routeFacts:J,structured:U,failure:Pe(T)})}catch(f){l=F(e,f instanceof Error?f.message:String(f),"failed",{actualIterations:0,interrupted:!1,totalTokensUsed:g,failure:K(f)})}finally{zt(e.id,n.parentOptions.events,n.workflowCorrelation,n.childActivityName)}return l}i(cr,"runWriteChildBody");async function Xt(e,t,n,r,o){let d=L(t),s=t.gitRoot,c=Rt.platform(),u=c==="win32"?"Windows":c==="darwin"?"macOS":c,m=c==="win32"?"Shell defaults: Windows. Use: dir, move, copy, del, type. Avoid Unix-only tools like `head`, `tail`, `rm`, `cp`, `mv`.":"Shell defaults: Unix. Use: ls, mv, cp, rm, cat, head, tail.",h=nr(t.skillInvocation),p=await or(e.objective,t),b=["# Child Agent Task","","You are a focused sub-agent executing a specific task in parallel with siblings.",`Complete this task efficiently \u2014 every iteration the parent waits on adds end-to-end latency. You have a hard limit of ${n} iterations.`,"","## Environment",`Working Directory: ${d}`,...e.isolation==="worktree"?["Workflow Isolation: dedicated git worktree requested by the workflow coordinator."]:[],...s&&s!==d?[`Git Root: ${s}`]:[],`Platform: ${u} (${Rt.release()})`,m,A("t12.child-executor.0"),"","## Objective",e.objective,...p?["",p]:[],"","## Scope",e.scopeSummary??"No specific scope summary supplied.",...h?["",h]:[],"","## Constraints",...e.constraints.length>0?e.constraints.map(C=>`- Binding constraint: ${C}`):[],e.readOnly?A("t12.child-executor.1"):"- You may modify files within the scope listed above.",...o.canSpawn?[A("t12.child-executor.2")]:[],...o.canMessage?["","## Runtime Collaboration",A("t12.child-executor.3"),A("t12.child-executor.4")]:[],...e.readOnly?[]:["","## Coordination with peers",A("t12.child-executor.5"),A("t12.child-executor.6")],"","## Execution Strategy (use parallel tool calls)","- Open broad: scope-scan turn emits parallel `glob` for structure + `grep` for key patterns + `read` on the obvious entry files, all in one response.","- Iterate narrow: deep-read on files identified by the scope scan, again emitting multiple reads in parallel per turn.","- Synthesize early: stop investigating once the evidence is sufficient to answer the objective. Extra iterations waste tokens and delay the parent's synthesis.","- Signal completion with a text-only response (no tool calls). Any final tool call re-opens the turn and forces another LLM round without giving the parent new information."],S=["","## Output Format","When done, provide a concise text summary:",...e.readOnly?[]:["- Exact files or generated outputs changed"],"- Key findings (file:line references)","- Severity assessment (if applicable)","- Specific recommendations","Do NOT call any more tools in your final response."];if(e.outputSchema!==void 0&&S.push("",gt(e.outputSchema)),e.evidenceRefs.length>0){let C=["","## Known Evidence"],k=z([...b,...C,...S].join(`
|
|
27
|
-
`)),y=Math.max(0,r-k),a=[];for(let[g,f]of e.evidenceRefs.entries())a.push({id:`child-evidence-${g}`,toolName:"child_task_summary",content:await fr(f,t)});let l=await tt(a,t,{aggregateInlineTokens:y});b.push(...C,...l.entries.map(g=>g.content))}b.push(...S);let x=b.join(`
|
|
28
|
-
`),R=z(x);if(R>r)throw new et(R,r);return x}i(Xt,"buildChildBriefing");var ur=["file:","diff:","finding:","task_id:"];function vi(e,t,n){for(let r of t??[]){if(!ur.some(o=>r.startsWith(o)))throw new Error(`wf.runAgent("${e}") evidenceRefs entry "${r}" is not a valid evidence reference. Use one of: file:<path>, diff:<path>, finding:<text>, task_id:<id>. To pass another agent's output, use "task_id:" + that agent's result.taskId \u2014 not its name.`);if(r.startsWith("task_id:")){let o=r.slice(8).trim();if(o.length===0)throw new Error(`wf.runAgent("${e}") evidenceRefs contains an empty "task_id:" reference.`);if(n!==void 0&&!n.has(o))throw new Error(`wf.runAgent("${e}") evidenceRefs references unknown workflow task id "${o}". Pass the taskId from a prior result/handle (result.taskId from wf.runAgent, or handle.taskId from wf.spawnAgent) of an agent spawned earlier in this run \u2014 not an agent name or a guessed id.`)}}}i(vi,"assertValidWorkflowEvidenceRefs");async function fr(e,t){if(e.startsWith("file:")){let n=e.slice(5);try{let r=await Ln.readFile(ye(n,t),"utf-8");return`### ${n}
|
|
29
|
-
\`\`\`
|
|
30
|
-
${r}
|
|
31
|
-
\`\`\``}catch{return`- ${e} (could not read file)`}}if(e.startsWith("diff:")){let n=e.slice(5);try{Q({cwd:L(t)});let r=Un("git",["diff","HEAD","--",ye(n,t)],{cwd:L(t),encoding:"utf-8",stdio:["ignore","pipe","ignore"],timeout:1e4,windowsHide:!0});return r.length>0?`### diff: ${n}
|
|
32
|
-
\`\`\`diff
|
|
33
|
-
${r}
|
|
34
|
-
\`\`\``:`- ${e} (no changes)`}catch{return`- ${e} (could not get diff)`}}if(e.startsWith("finding:"))return`- **Known fact**: ${e.slice(8)}`;if(e.startsWith("agent-turn:")){if(!t.actorControl)return"- [evidence_refs error] agent-turn: requires Actor control.";let n;try{n=st(e)}catch(s){return`- [evidence_refs error] ${s instanceof Error?s.message:String(s)}`}if(n===void 0)return"- [evidence_refs error] invalid agent-turn reference.";let r;try{r=t.actorControl.output(n.actorPath,n.turnId)}catch{return`- ${e} (not visible or not controlled by this Agent)`}if(r.state==="running"||r.state==="accepted")return`- ${e} (turn still running; wait for its terminal event before forwarding output)`;let o="```",d=r.output??r.error??"(no final text recorded)";return d.includes(o)&&(d=d.replace(/```/g,"`\u200B`\u200B`")),`### agent-turn:${n.actorPath}#turn=${n.turnId} (${r.state})
|
|
35
|
-
${o}
|
|
36
|
-
${d}
|
|
37
|
-
${o}`}if(e.startsWith("agent:")){let n=e.slice(6).trim();if(!n||!t.actorControl)return"- [evidence_refs error] agent: requires a visible canonical actor path.";let r;try{r=t.actorControl.output(n)}catch{return`- agent:${n} (not visible or not controlled by this Agent)`}if(r.state==="running"||r.state==="accepted")return`- agent:${n} (turn still running; wait for its terminal event before forwarding output)`;let o="```",d=r.output??r.error??"(no final text recorded)";return d.includes(o)&&(d=d.replace(/```/g,"`\u200B`\u200B`")),`### agent: ${n} (${r.state})
|
|
38
|
-
${o}
|
|
39
|
-
${d}
|
|
40
|
-
${o}`}return`- [evidence_refs error] unrecognized prefix in "${e}" \u2014 valid prefixes: file:, diff:, finding:, agent-turn:, agent:`}i(fr,"resolveEvidenceRef");var Fe=[A("t12i.child-executor.block.0"),`- ${Ze}`,A("t12i.child-executor.block.1")].join(`
|
|
41
|
-
`);function pr(e,t=Fe){let n=ut({cwd:e,projectRoot:e}),r=ft(n);return r?[t,"","Project rules apply to your mutations. Follow them as the parent agent would:",r].join(`
|
|
42
|
-
`):t}i(pr,"buildWriteSystemPrompt");var We=["ask_user_question","worktree_create","worktree_remove","exit_plan_mode"],Vt=[...We,"write","edit","multi_edit","insert_after_anchor","undo"],mr=new Set(We),gr=new Set(Vt);function hr(e,t,n){return{...t!==void 0?{workflowCorrelation:t}:{},childAgentId:e,childAgentName:n??e,liveOnly:!0}}i(hr,"childActivityEventMeta");function zt(e,t,n,r){t?.onChildActivityEnd?.(hr(e,n,r))}i(zt,"emitChildActivityEnd");function Yt(e,t,n,r,o,d,s,c=200,u=!1,m,h){let p=0,b=c,S=0,x=u?gr:mr,R=150,C=i((a,l=!1)=>{if(!t)return;let g=Date.now();!l&&g-S<R||(S=g,t(a))},"throttledProgress"),k=i((a,l={})=>{let g=d??a?.workflowCorrelation,f={...a??{},...g!==void 0?{workflowCorrelation:g}:{},...a?.childAgentId!==void 0?{childAgentId:a.childAgentId}:{childAgentId:e},...a?.childAgentName!==void 0?{childAgentName:a.childAgentName}:{childAgentName:s??e},...a?.parentToolId!==void 0?{parentToolId:a.parentToolId}:{},...l.liveOnly!==void 0?{liveOnly:l.liveOnly}:{}};return f.workflowCorrelation===void 0&&f.childAgentId===void 0&&f.childAgentName===void 0&&f.parentToolId===void 0&&f.liveOnly===void 0?void 0:f},"activityEventMeta"),y=i((a,l={})=>{let f={...k(a,l)??{},...a?.toolId!==void 0?{toolId:a.toolId}:{}};return f.toolId===void 0&&f.workflowCorrelation===void 0&&f.childAgentId===void 0&&f.childAgentName===void 0&&f.parentToolId===void 0&&f.liveOnly===void 0?void 0:f},"toolEventMeta");return{...d?{workflowCorrelation:d}:{},...o?.onContextCapacityBlocked&&h?{getContextRecoveryRevision:o.getContextRecoveryRevision,registerGenerationWait:o.registerGenerationWait,isGenerationSuspensionRequested:o.isGenerationSuspensionRequested,onContextCapacityBlocked:i(async(a,l)=>{let g=h.isolation;a.checkpoint&&g?.worktreePath&&g.parentGitRoot&&(a={...a,checkpoint:await Ct(g.worktreePath,g.parentGitRoot,a.checkpoint)},g.suspended=!0);let f=await o.onContextCapacityBlocked(a,l,{...k(),...h.turnId?{turnId:h.turnId}:{}});l?.throwIfAborted(),g?.worktreePath&&g.suspended&&(await De(g.worktreePath),g.suspended=!1),f&&(f.provider!==void 0&&(Ne(f.provider,h.capabilities),h.control.setProvider(f.provider)),"model"in f&&h.control.setModel(f.model),"reasoning"in f&&h.control.setReasoning(f.reasoning))},"onContextCapacityBlocked")}:{},...o?.registerShellCleanup?{registerShellCleanup:o.registerShellCleanup}:{},onOutputSegmentStart:i((a,l)=>{o?.onOutputSegmentStart?.(a,k(l,{liveOnly:!0}))},"onOutputSegmentStart"),onTextDelta:i((a,l)=>{o?.onTextDelta?.(a,k(l,{liveOnly:!0}))},"onTextDelta"),onOutputNotice:i((a,l)=>{o?.onOutputNotice?.(a,k(l,{liveOnly:!0}))},"onOutputNotice"),onThinkingDelta:i((a,l)=>{o?.onThinkingDelta?.(a,k(l,{liveOnly:!0}))},"onThinkingDelta"),onThinkingEnd:i((a,l)=>{o?.onThinkingEnd?.(a,k(l,{liveOnly:!0}))},"onThinkingEnd"),onStreamEnd:i(a=>{o?.onStreamEnd?.(k(a,{liveOnly:!0}))},"onStreamEnd"),onProviderRateLimit:i((a,l,g,f)=>{o?.onProviderRateLimit?.(a,l,g,k(f,{liveOnly:!0}))},"onProviderRateLimit"),onRetryAfter:i((a,l)=>{o?.onRetryAfter?.(a,k(l,{liveOnly:!0}))},"onRetryAfter"),onRetry:i((a,l,g,f)=>{o?.onRetry?.(a,l,g,k(f,{liveOnly:!0}))},"onRetry"),onProviderRecovery:i((a,l)=>{o?.onProviderRecovery?.(a,k(l,{liveOnly:!0}))},"onProviderRecovery"),onCompactStart:i(a=>{o?.onCompactStart?.(k(a,{liveOnly:!0}))},"onCompactStart"),onCompactStats:i(a=>{o?.onCompactStats?.(a)},"onCompactStats"),onCompact:i((a,l)=>{o?.onCompact?.(a,k(l,{liveOnly:!0}))},"onCompact"),onContextCompactionFinished:i(a=>{o?.onContextCompactionFinished?.(a)},"onContextCompactionFinished"),onContextBudgetSnapshot:i(a=>{o?.onContextBudgetSnapshot?.(a)},"onContextBudgetSnapshot"),onPromptCacheDiagnostics:i(a=>{o?.onPromptCacheDiagnostics?.(a)},"onPromptCacheDiagnostics"),onToolExposurePlanned:i(a=>{o?.onToolExposurePlanned?.(a)},"onToolExposurePlanned"),onContextCompactionSkipped:i(a=>{o?.onContextCompactionSkipped?.(a)},"onContextCompactionSkipped"),onCompactEnd:i((a,l)=>{o?.onCompactEnd?.(k(a,{liveOnly:!0}),l)},"onCompactEnd"),beforeToolExecute:i(async(a,l,g)=>{if(x.has(a))return`[Tool Error] ${a}: Not available in child agent context.`;if(n){let f=n(a,l);if(f)return`${f} You are a child agent inheriting plan-mode constraints. Complete investigation and return findings as text \u2014 the parent agent will request user approval for any implementation.`}return o?.beforeToolExecute?o.beforeToolExecute(a,l,y(g)):!0},"beforeToolExecute"),onIterationStart:i((a,l)=>{p=a,b=l,m?.({current:a,max:l})},"onIterationStart"),onIterationEnd:i(a=>{o?.onIterationEnd?.({...a,scope:"worker"})},"onIterationEnd"),onToolUseStart:i((a,l)=>{o?.onToolUseStart?.(a,y({...l,...l?.toolId!==void 0?{toolId:l.toolId}:{toolId:a.id},...l?.workflowCorrelation!==void 0?{workflowCorrelation:l.workflowCorrelation}:{}},{liveOnly:!0}));let g=a.input&&typeof a.input=="object"?a.input.path??a.input.pattern??a.input.command??"":"",f=typeof g=="string"?g.slice(0,60):"",v=f?` ${f}`:"";C(`${e} [${p}${b>0?`/${b}`:""}] \u2192 ${a.name}${v}`)},"onToolUseStart"),onToolInputDelta:i((a,l,g)=>{o?.onToolInputDelta?.(a,l,y(g,{liveOnly:!0}))},"onToolInputDelta"),onToolSandboxObservation:i((a,l)=>{o?.onToolSandboxObservation?.(a,y(l,{liveOnly:!0}))},"onToolSandboxObservation"),onToolProgress:i((a,l)=>{o?.onToolProgress?.(a,y({...l,...l?.toolId!==void 0?{toolId:l.toolId}:{toolId:a.id},...l?.workflowCorrelation!==void 0?{workflowCorrelation:l.workflowCorrelation}:{}},{liveOnly:!0}))},"onToolProgress"),onToolResult:i((a,l)=>{o?.onToolResult?.(a,y({...l,...l?.toolId!==void 0?{toolId:l.toolId}:{toolId:a.id},...l?.workflowCorrelation!==void 0?{workflowCorrelation:l.workflowCorrelation}:{}},{liveOnly:!0}))},"onToolResult"),onToolExecutionStart:i((a,l)=>{o?.onToolExecutionStart?.(a,y(l,{liveOnly:!0}))},"onToolExecutionStart"),onToolExecutionEnd:i((a,l)=>{o?.onToolExecutionEnd?.(a,y(l,{liveOnly:!0}))},"onToolExecutionEnd"),...o?.askUser?{askUser:i((a,l)=>o.askUser(a,y(l,{liveOnly:!0})),"askUser")}:{},...o?.askUserMulti?{askUserMulti:i((a,l)=>o.askUserMulti(a,y(l,{liveOnly:!0})),"askUserMulti")}:{},...o?.askUserInput?{askUserInput:i((a,l)=>o.askUserInput(a,y(l,{liveOnly:!0})),"askUserInput")}:{}}}i(Yt,"buildChildEvents");function Jt(e){let t=new Set(["file_modified","file_created","file_deleted"]);return[...new Set((e.artifactLedger??[]).filter(n=>t.has(n.kind)).map(n=>n.target).filter(n=>n.trim().length>0))]}i(Jt,"extractMutationArtifactPaths");function F(e,t,n,r={}){return{childId:e.id,fanoutClass:e.fanoutClass,status:n,disposition:n==="completed"?"valid":"needs-more-evidence",summary:t,evidenceRefs:e.evidenceRefs,contradictions:[],actualIterations:r.actualIterations,...r.iteration?{iteration:r.iteration}:{},...r.totalTokensUsed!==void 0&&r.totalTokensUsed>0?{totalTokensUsed:r.totalTokensUsed}:{},...r.digestTokensUsed!==void 0&&r.digestTokensUsed>0?{digestTokensUsed:r.digestTokensUsed}:{},...r.digestUsage?{digestUsage:r.digestUsage}:{},...r.sessionId?{sessionId:r.sessionId}:{},...r.artifactPaths!==void 0&&r.artifactPaths.length>0?{artifactPaths:[...r.artifactPaths]}:{},...r.digest?{digest:r.digest}:{},...r.digestFailed?{digestFailed:!0}:{},...r.digestPending?{digestPending:!0}:{},...r.provider?{provider:r.provider}:{},...r.model?{model:r.model}:{},...r.routeFacts?{routeFacts:r.routeFacts}:{},...r.structured!==void 0?{structured:r.structured}:{},...r.failure!==void 0?{failure:r.failure}:{},interrupted:r.interrupted,...r.limitReached?{limitReached:!0}:{}}}i(F,"extractChildResult");function yr(e,t,n){let r=new Map(e.map(u=>[u.id,u])),o=new Map(t.map(u=>[u.childId,u])),d=e.map(u=>o.get(u.id)).filter(u=>u!==void 0&&(u.status==="completed"||u.summary.length>0)).map(u=>({childId:u.childId,objective:r.get(u.childId)?.objective??"",evidence:[u.summary,...u.evidenceRefs],artifacts:u.artifactPaths??[]})),s=[...new Set(t.flatMap(u=>u.artifactPaths??[]))],c=t.reduce((u,m)=>u+(m.totalTokensUsed??0),0);return{results:t,mergedFindings:d,mergedArtifacts:s,totalTokensUsed:c,cancelledChildren:[...n]}}i(yr,"mergeChildResults");function kr(e,t,n){return e.length===0?[]:t!=="worker"?[]:n!=="tool-dispatch"?[]:e}i(kr,"validateWriteBundles");var It={results:[],mergedFindings:[],mergedArtifacts:[],totalTokensUsed:0,cancelledChildren:[]};export{be as a,xr as b,xe as c,we as d,Sr as e,Rr as f,K as g,sn as h,go as i,Xo as j,fn as k,ut as l,ft as m,ne as n,So as o,vo as p,kt as q,yt as r,Ti as s,vi as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{a}from"./chunk-DCE7XQUG.js";import"./chunk-2HH5AS7E.js";import"./chunk-J2L2NK6E.js";import"./chunk-KDSO7V4O.js";import"./chunk-SK3RRGHJ.js";import"./chunk-WMMESRP3.js";import"./chunk-QP47JIWP.js";import"./chunk-52EN2777.js";import"./chunk-UF3GZ5PO.js";import"./chunk-KE2NBMAP.js";import"./chunk-V5RCDBKU.js";import"./chunk-KDLOPBFZ.js";import"./chunk-V4WSBIXB.js";export{a as loadCompactionConfig};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{$ as Ej,A as dj,Aa as dk,B as ej,Ba as ek,C as fj,Ca as fk,D as gj,Da as gk,E as hj,Ea as hk,F as ij,Fa as ik,G as jj,Ga as jk,H as kj,Ha as kk,I as lj,Ia as lk,J as mj,Ja as mk,K as nj,Ka as nk,L as oj,La as ok,M as pj,Ma as pk,N as qj,Na as qk,O as rj,Oa as rk,P as sj,Pa as sk,Q as tj,Qa as tk,R as uj,Ra as uk,S as vj,Sa as vk,T as wj,Ta as wk,U as xj,Ua as xk,V as yj,Va as yk,W as zj,Wa as zk,X as Aj,Xa as Ak,Y as Bj,Ya as Bk,Z as Cj,Za as Ck,_ as Dj,_a as Dk,a,aa as Fj,b as Lb,ba as Gj,c as Mb,ca as Hj,d as Nb,da as Ij,e as lc,ea as Jj,f as mc,fa as Kj,g as nc,ga as Lj,h as Mi,ha as Mj,i as Ni,ia as Nj,j as Oi,ja as Oj,k as Pi,ka as Pj,l as Qi,la as Qj,m as Ri,ma as Rj,n as Si,na as Sj,o as Ti,oa as Tj,p as Ui,pa as Uj,q as Vi,qa as Vj,r as Wi,ra as Wj,s as Xi,sa as Xj,t as Yi,ta as Yj,u as Zi,ua as Zj,v as _i,va as _j,w as $i,wa as $j,x as aj,xa as ak,y as bj,ya as bk,z as cj,za as ck}from"./chunk-QSZCR5GC.js";import{a as Sh,b as Th,c as Uh,d as Vh,e as Wh,f as Xh,g as Yh,h as Zh,i as _h,j as Li}from"./chunk-V2XJSFFE.js";import{A as yi,B as zi,C as Ai,D as Bi,E as Ci,H as Di,I as Ei,J as Fi,K as Gi,L as Hi,M as Ii,N as Ji,O as Ki,b as $h,c as ai,d as bi,e as ci,f as di,g as ei,h as fi,i as gi,j as hi,k as ii,l as ji,m as ki,n as li,o as mi,p as ni,q as oi,r as pi,s as qi,t as ri,u as si,v as ti,w as ui,x as vi,y as wi,z as xi}from"./chunk-JAF2YLZO.js";import{a as Nh,b as Oh}from"./chunk-DV5YPYLW.js";import{A as Fd,B as Gd,C as Hd,D as Id,E as Jd,a as bd,b as cd,c as dd,d as ed,e as jd,f as kd,g as ld,h as md,i as nd,j as od,k as pd,l as qd,m as rd,n as sd,o as td,p as ud,q as vd,r as wd,s as xd,t as yd,u as zd,v as Ad,w as Bd,x as Cd,y as Dd,z as Ed}from"./chunk-X5M7TLJV.js";import{a as Lh,b as Mh}from"./chunk-C6JGLEYD.js";import{Cb as Ih,Da as ih,Db as Jh,Ea as jh,Fa as kh,Fb as Kh,Na as lh,Oa as mh,Pa as nh,Qa as oh,Ra as ph,Sa as qh,T as Sg,U as Tg,Ua as rh,V as Ug,Va as sh,W as Vg,Wa as th,X as Wg,Xa as uh,Ya as vh,aa as Xg,b as Ob,ba as Yg,c as Pb,cb as xh,d as Qb,db as yh,e as Rb,ea as Zg,f as Sb,fa as _g,g as Tb,i as Ub,j as Vb,ja as $g,k as Wb,ka as ah,kb as zh,la as bh,ma as ch,mb as Ah,n as Xb,na as dh,nb as Bh,o as Yb,ob as Ch,p as Zb,pb as Dh,q as ac,qa as eh,r as oc,ra as fh,s as pc,sa as gh,sb as Eh,ta as hh,tb as Fh,ub as Gh,vb as Hh}from"./chunk-D36OIMV7.js";import{a as wh}from"./chunk-BBZWF2EA.js";import{a as Jb,b as Kb,d as Ig,e as Jg,f as Kg,g as Lg,h as Mg,o as Ph,p as Qh,q as Rh}from"./chunk-F6GJXQNA.js";import{a as bc,b as cc,c as ec,d as fc,e as gc,f as hc,h as Ng,i as Og,k as Pg,l as Qg,m as Rg}from"./chunk-XDMNJW6J.js";import"./chunk-RYBUYHDL.js";import{a as fd,b as gd,c as hd,d as id}from"./chunk-4Y6U7AH4.js";import"./chunk-EPK6EWRI.js";import"./chunk-ISLK6R2P.js";import{$a as Rd,$c as zf,$d as rg,Ab as ne,Ad as _f,B as tc,Bb as oe,Bc as bf,Bd as $f,C as uc,Cb as pe,Cc as cf,Cd as ag,D as vc,Da as Vc,Db as qe,Dc as df,Dd as bg,E as wc,Ea as Wc,Eb as re,Ed as cg,F as xc,Fa as Xc,Fb as se,Fd as dg,G as yc,Ga as Yc,Gb as te,Gd as eg,H as zc,Ha as Zc,Hb as ue,Hc as ef,I as Ac,Ib as ve,Ic as ff,J as Bc,Jb as we,Jc as gf,Kb as xe,Kc as hf,Kd as fg,L as Cc,Lb as ye,Lc as jf,M as Dc,Mc as kf,N as Ec,Na as _c,Nb as ze,Nc as lf,O as Fc,Ob as Ae,Oc as mf,P as Gc,Pb as Be,Pc as nf,Q as Hc,Qa as $c,Qc as of,Qd as gg,R as Ic,Ra as ad,Rc as pf,Rd as hg,S as Jc,Sb as Ce,Sc as qf,Sd as ig,T as Kc,Ta as Kd,Tb as De,Tc as rf,Td as jg,U as Lc,Ua as Ld,Ub as Ee,Uc as sf,Ud as kg,V as Mc,Va as Md,Vb as Fe,Vc as tf,Vd as lg,W as Nc,Wa as Nd,Wb as Ge,Wc as uf,Wd as mg,Xa as Od,Xb as He,Xc as vf,Xd as ng,Yb as Ie,Yc as wf,Yd as og,Za as Pd,Zc as xf,Zd as pg,_a as Qd,_c as yf,_d as qg,ab as Sd,ac as Je,ad as Af,ae as sg,bb as Td,bc as Ke,bd as Bf,be as tg,c as _b,cb as Ud,cc as Le,cd as Cf,ce as ug,d as $b,db as Vd,dc as Me,dd as Df,de as vg,eb as Wd,ed as Ef,f as dc,fb as Xd,fd as Ff,fe as wg,g as ic,ga as Oc,gb as Yd,gd as Gf,ge as xg,h as jc,ha as Pc,hb as Zd,hd as Hf,i as kc,ia as Qc,ib as _d,ic as Ne,id as If,ja as Rc,jb as $d,jc as Oe,jd as Jf,ka as Sc,kb as ae,kc as Pe,kd as Kf,ke as yg,la as Tc,lb as be,lc as Qe,ld as Lf,le as zg,mb as ce,mc as Re,md as Mf,me as Ag,nb as de,nc as Se,nd as Nf,ne as Bg,oc as Te,od as Of,oe as Cg,p as qc,pc as Ue,pd as Pf,pe as Dg,q as rc,qb as ee,qc as Ve,qd as Qf,qe as Eg,r as sc,rb as fe,rc as We,rd as Rf,re as Fg,sb as ge,sc as Xe,sd as Sf,se as Gg,tb as he,tc as Ye,td as Tf,ub as ie,uc as Ze,ud as Uf,vb as je,vc as _e,vd as Vf,wb as ke,wc as $e,wd as Wf,xc as af,xd as Xf,yb as le,yd as Yf,za as Uc,zb as me,zd as Zf}from"./chunk-OGTRDK4Q.js";import"./chunk-GZUWQZJD.js";import{a as Hg}from"./chunk-W2CWO4PQ.js";import"./chunk-TQ475LOI.js";import"./chunk-65652LR4.js";import"./chunk-5MUVRFMU.js";import{$c as qb,Ac as Va,Bc as Wa,Cc as Xa,D as qa,Dc as Ya,E as ra,Ec as Za,F as sa,Fa as ua,Fc as _a,G as ta,Ia as va,Ic as $a,Jc as ab,Lb as Ta,Lc as bb,Ld as ub,Mb as Ua,Mc as cb,Md as vb,Nc as db,Nd as wb,Oc as eb,Od as xb,Pc as fb,Pd as yb,Qc as gb,Qd as zb,Rc as hb,Rd as Ab,Sc as ib,Tc as jb,Uc as kb,Ud as Bb,Vc as lb,Vd as Cb,Wc as mb,Wd as Db,Xc as nb,Xd as Eb,Yc as ob,Yd as Fb,Zd as Gb,_c as pb,bd as rb,de as Hb,ed as sb,ee as Ib,fd as tb,h as f,i as g,j as h,k as i,l as j,m as k,o as l,p as m,q as n,r as o,s as p}from"./chunk-2HH5AS7E.js";import{a as b,b as c,c as d,f as e}from"./chunk-J2L2NK6E.js";import{A as Ma,B as Na,C as Oa,D as Pa,E as Qa,F as Ra,G as Sa,d as wa,l as xa,m as ya,n as za,o as Aa,p as Ba,q as Ca,r as Da,s as Ea,t as Fa,u as Ga,v as Ha,w as Ia,x as Ja,y as Ka,z as La}from"./chunk-KDSO7V4O.js";import{$ as da,B as H,C as I,D as J,E as K,F as L,G as M,H as N,I as O,J as P,K as Q,L as R,M as S,N as T,O as U,Q as V,R as W,S as X,T as Y,V as Z,W as _,X as $,Y as aa,Z as ba,_ as ca,aa as ea,ba as fa,ca as ga,da as ha,fa as ia,ga as ja,ha as ka,ia as la,k as D,ka as ma,la as na,m as E,ma as oa,n as F,pa,v as G}from"./chunk-SK3RRGHJ.js";import"./chunk-WMMESRP3.js";import"./chunk-QP47JIWP.js";import"./chunk-52EN2777.js";import"./chunk-UF3GZ5PO.js";import{$ as C,F as t,G as u,N as v,O as w,P as x,Q as y,R as z,S as A,Y as B}from"./chunk-KE2NBMAP.js";import"./chunk-V5RCDBKU.js";import{a as q,b as r,d as s}from"./chunk-KDLOPBFZ.js";import"./chunk-V4WSBIXB.js";export{zh as ALWAYS_RESIDENT_TOOL_NAMES,Xj as AUTO_MODE_DENIAL_CONSECUTIVE_THRESHOLD,Zj as AUTO_MODE_DENIAL_WINDOW_SIZE,Yj as AUTO_MODE_RECENT_DENIAL_THRESHOLD,ok as BASH_POLICY_SPEC,ed as BASH_SAFE_READ_COMMANDS,dd as BASH_WRITE_COMMANDS,Zi as BLOCKER_REQUIRED_CONSECUTIVE_TURNS,ck as BREAKER_ERROR_THRESHOLD,dk as BREAKER_WINDOW_MS,ji as BUILTIN_WORKFLOWS,rc as CANCELLED_TOOL_RESULT_MESSAGE,qc as CANCELLED_TOOL_RESULT_PREFIX,Ij as CLASSIFIER_MAX_OUTPUT_TOKENS,Ri as CODING_INVARIANTS,Bh as CODING_SUMMARY_PROMPT,Ch as CODING_UPDATE_SUMMARY_PROMPT,rf as CapabilityDeniedError,Ti as Client,Ph as CodingActorSession,ag as CombinedExtensionRuntime,sf as ConstructionManifestError,Hj as DEFAULT_CLASSIFIER_RETRY_TIMEOUT_MS,Gj as DEFAULT_CLASSIFIER_TIMEOUT_MS,Ih as DEFAULT_CODING_AGENT_NAME,tj as DEFAULT_DANGEROUS_PATTERNS,pf as DEFAULT_HANDLER_TIMEOUT_MS,Sg as DEFAULT_RESILIENCE_CONFIG,sj as DEFAULT_SAFE_PATTERNS,Cf as DEFAULT_SELF_MODIFY_BUDGET,Dc as DEFAULT_TOOL_OUTPUT_MAX_BYTES,Cc as DEFAULT_TOOL_OUTPUT_MAX_LINES,Th as DEFAULT_WORKFLOW_GENERATION_TIMEOUT_MS,ta as DefaultSummaryCompaction,oc as ErrorCategory,bd as FILE_MODIFICATION_TOOLS,bi as FINDING_VERIFICATION_OUTPUT_SCHEMA,Ee as GENERATOR_AGENT_NAME,ya as ImageResizeError,m as KODAX_API_MIN_INTERVAL,J as KODAX_DEFAULT_PROVIDER,g as KODAX_DEFAULT_TIMEOUT,Pa as KODAX_FILE_MEDIA_TYPES,h as KODAX_HARD_TIMEOUT,Na as KODAX_IMAGE_MEDIA_TYPES,k as KODAX_MAX_INCOMPLETE_RETRIES,i as KODAX_MAX_RETRIES,f as KODAX_MAX_TOKENS,I as KODAX_PROVIDERS,H as KODAX_PROVIDER_SNAPSHOTS,t as KODAX_REASONING_MODE_SEQUENCE,j as KODAX_RETRY_BASE_DELAY,u as KODAX_STABLE_EFFORT_INTENTS,l as KODAX_STAGGER_DELAY,gg as KODAX_TOOLS,Pc as KODAX_UNDERLYING_CAPABILITY_TOPICS,Oa as KODAX_VIDEO_MEDIA_TYPES,G as KodaXAnthropicCompatProvider,B as KodaXBaseProvider,Ti as KodaXClient,q as KodaXError,$f as KodaXExtensionRuntime,xa as KodaXMediaError,D as KodaXOpenAICompatProvider,r as KodaXProviderError,s as KodaXRateLimitError,mc as KodaXSessionError,jh as KodaXSkillInvocationError,nc as KodaXTerminalError,lc as KodaXToolError,_b as KodaXTrustedTextMutationError,Qb as LEARNING_REVIEW_PROMPT_SHA256,Rb as LEARNING_REVIEW_SCHEMA_SHA256,Ob as LEARNING_REVIEW_SYSTEM_PROMPT,Pb as LEARNING_REVIEW_TOOL,pb as LINEAGE_ENTRY_TYPES,Jg as LSP_SERVERS,rb as LineageCompaction,qb as LineageExtension,Kg as LspService,Qc as MANUAL_REGISTRY,Oc as MANUAL_TOPIC_IDS,Ea as MAX_DIMENSION,pj as MEMORY_INTERVENTION_SELECTOR_PROMPT,qj as MEMORY_INTERVENTION_SELECTOR_SHA256,cd as MODIFICATION_TOOLS,ab as McpAuthRequiredError,mb as McpCapabilityProvider,$a as McpExpiredSessionError,nb as McpManager,lb as McpServerRuntime,Ja as PASTE_TMP_DIR_ENV,Ka as PASTE_TMP_TTL_MS,De as PLANNER_AGENT_NAME,n as PROMISE_PATTERN,mh as PROMPT_SECTION_REGISTRY,Wg as ProviderRecoveryCoordinator,Ec as READ_DEFAULT_LIMIT,Gc as READ_MAX_LINE_CHARS,Fc as READ_PREFLIGHT_SIZE_BYTES,Xf as REPO_EXPLORER_AGENT_NAME,Yf as REPO_EXPLORER_TOOL_NAMES,va as Runner,ai as SCOPED_REVIEW_OUTPUT_SCHEMA,Ce as SCOUT_AGENT_NAME,yk as SCOUT_THEN_AUTHOR_PROMPT_LINES,sh as SELF_KNOWLEDGE_ROUTING_RULE,lh as SYSTEM_PROMPT,Di as SYSTEM_WORKFLOW_LIMITS,Ug as StableBoundaryTracker,Fa as TARGET_RAW_SIZE_BYTES,He as TASK_ENGINE_ROLE_AGENTS,Bj as TOOL_RESULT_TRUNCATION_GUARDRAIL_NAME,rk as TRACING_ENV,$c as ToolResultBatchCapacityError,Fe as WORKER_AGENT_NAME,Sh as WORKFLOW_GENERATION_SYSTEM_PROMPT,Jf as _resetRuntimeForTesting,Mf as activate,wa as actorQueueId,Oj as analyzeAutoModeCall,Ud as analyzeChangedScope,kd as analyzePowerShellMutation,Af as appendAuditEntry,zb as appendSessionLineageLabel,Se as applyAccountingDelta,ei as applyFindingVerification,Dh as applyPostCompactAttachments,Ab as applySessionCompaction,ad as applyToolResultGuardrail,Gb as archiveOldIslands,$b as assertTrustedTextMutationPolicy,Kb as assertWorkModeAvailable,Ak as authorWorkflowViaWorker,bk as autoModeDenialShouldFallback,Yb as awaitLatestCodingMemoryReviewDrain,kk as bashSignalCollector,sk as bootstrapTracing,Ni as boundedRevise,gk as breakerShouldFallback,Oi as budgetCeiling,Ei as buildApprovalSummary,Ve as buildBlockedGoal,th as buildCapabilityContextSections,Dj as buildClassifierPrompt,We as buildCompleteGoal,Re as buildCreatedGoal,fh as buildFallbackRoutingDecision,aj as buildGoalRuntimeBinding,kb as buildInitializeCapabilities,xf as buildLlmReviewPrompt,Sc as buildManualToolDescription,ij as buildMcpReverseCapabilities,Te as buildPausedGoal,Xg as buildPromptMessageContent,qh as buildPromptSnapshot,$g as buildProviderCapabilitySnapshot,gh as buildProviderPolicyHintsForDecision,ah as buildProviderPolicyPromptNotes,Td as buildRepoIntelligenceContext,ee as buildRepoIntelligenceIndex,Qd as buildRepoOverview,Ue as buildResumedGoal,hi as buildScopedReviewFinalPrompt,fi as buildScopedReviewPrimaryPrompt,gi as buildScopedReviewVerificationPrompt,zk as buildScoutThenAuthorPrompt,rh as buildSelfKnowledgeRoutingRule,bj as buildSessionGoalRuntimeBinding,Eb as buildSessionTree,vh as buildSystemPrompt,uh as buildSystemPromptSnapshot,Eg as buildToolResultBudget,Fg as buildToolResultBudgetFromUsage,bf as buildToolSearchIndex,xi as buildWorkflowCostReport,Xh as buildWorkflowGenerationSkillContext,Wh as buildWorkflowGenerationUserPrompt,Wb as canonicalMemoryProjectId,tc as canonicalizeAgentHomePolicyPath,Kj as canonicalizeAutoModePath,jk as checkAbsoluteDeny,Yg as checkIncompleteToolCalls,ih as checkPromiseSignal,Gg as clampToolResultPolicyToBudget,Fi as clampWorkflowLimits,Jj as classify,vj as classifyBashCommand,pc as classifyError,Pd as classifyFileCategory,Ng as classifyResilienceError,Ag as cleanupExpiredToolOutputs,Ua as cleanupIncompleteToolCalls,Bg as cleanupUnreferencedToolOutputs,ia as clearRuntimeModelProviders,kc as clearShellExecutionEnvironmentCache,mk as collectAllSignals,Ed as collectBashWriteTargets,Fd as collectDeterministicBashWriteTargets,bg as combineExtensionRuntimes,Ck as completeWorkflowRunCleanup,xj as computeInputSignature,If as configureRuntime,Gh as consumeCompactionCooldown,ve as convertCapabilityReadResult,ue as convertProviderSearchResults,Fb as countActiveLineageMessages,p as countTokens,qa as createAgent,_j as createAutoModeDenialTracker,nk as createAutoModeToolGuardrail,uj as createBashClassifierConfig,qk as createBashPrefixExtractor,og as createBuiltinToolDefinition,ek as createCircuitBreaker,rj as createCodingMemoryInterventionRunner,Oh as createCodingWorkflowBackend,Eh as createCompactionAntiThrashState,tf as createCtxProxy,W as createCustomProvider,Jh as createDefaultCodingAgent,wj as createDenialTracker,Uj as createExecPolicyOperation,cg as createExtensionRuntime,Rh as createExternalActorTurnExecutor,Ca as createFileArtifactFromPath,ra as createHandoff,Ba as createImageArtifactFromPath,sa as createInMemorySession,lj as createKodaXTaskRunner,Qh as createLocalCodingActorControl,Wa as createMcpCapabilityId,ob as createMcpManager,bb as createMcpTransport,Lb as createOutputSegmentProjection,Tb as createProductionLearningReviewer,nh as createPromptSection,hh as createReasoningPlan,zi as createRunGraphWriter,yh as createRuntimeContextBudgetSnapshot,Lh as createSessionControl,ub as createSessionLineage,Cj as createToolResultTruncationGuardrail,Da as createVideoArtifactFromPath,uk as createWorkflowLifecycleController,xk as createWorkflowPatternTemplateModule,Ji as createWorkflowRunManager,Vi as decideWorkflowInvocation,kf as dedupeExtensionPathsByEntrypoint,Va as defaultMcpCacheDir,qf as defaultPolicy,si as deleteSavedWorkflow,Vb as deriveCodingMemoryIdentity,Ub as deriveCodingMemoryIdentityFromRoot,Zb as deriveCodingMemoryReviewIdentities,Hf as disableSelfModify,fb as discoverAuthorizationServerMetadata,of as discoverDefaultExtensions,nf as discoverExtensionsInDirectory,mf as discoverExtensionsInDirectoryDetailed,Wf as discoverMarkdownAgents,gb as discoverOAuthEndpoints,eb as discoverProtectedResourceMetadata,mi as discoverSavedWorkflows,Xb as drainCodingMemoryReviewInbox,Ke as drainPendingSwaps,Nb as effectiveOutputSegmentText,x as effortToLegacyReasoningMode,Hi as emitWorkflowAgentDigest,Sa as enqueueWithArtifacts,Zf as ensureBuiltinRepoExplorerAgent,o as estimateTokens,xh as estimateToolSchemaTokens,Tj as evaluateExecPolicy,bh as evaluateProviderPolicy,Vj as evaluateShellExecPolicy,lf as excludeExtensionPathsByEntrypoint,ef as exec,sc as executeManagedProcess,af as executeRunScopedTool,yg as executeTool,sb as extractArtifactLedger,pk as extractCommandPrefix,_g as extractComparableUserMessageText,te as extractHtmlTitle,db as extractInsufficientScope,yd as extractPathsFromCommand,Zg as extractPromptComparableText,cb as extractResourceMetadataUrl,Ib as extractTitleFromMessages,lk as fileSignalCollector,xe as finalizeRetrievalResult,Sf as findByVersion,ld as findGitSubcommandIndex,Bb as findPreviousUserEntryId,hd as flattenArgv,id as flattenRedirections,Db as forkSessionLineage,Rg as formatAgentsForPrompt,Qj as formatExecPolicyConfigurationError,Pj as formatExecPolicyRejection,nj as formatParallelDispatchResult,Hc as formatSize,vd as generateSavePattern,Hb as generateSessionId,Zh as generateWorkflow,_h as generateWorkflowFromOptions,eg as getActiveExtensionRuntime,c as getAgentConfigHome,d as getAgentConfigPath,qg as getAllRegisteredTools,e as getAppDataDir,la as getAvailableProviderNames,Hd as getBashOutsideProjectWriteRisk,ng as getBuiltinRegisteredToolDefinition,mg as getBuiltinToolDefinition,ki as getBuiltinWorkflow,ca as getCustomModelCapabilities,Y as getCustomProvider,$ as getCustomProviderList,ba as getCustomProviderModelDescriptors,aa as getCustomProviderModels,_ as getCustomProviderNames,hf as getDefaultExtensionDirectory,Lg as getDefaultLspService,Ki as getDefaultWorkflowRunManager,Aj as getDenialContext,rd as getDirectShellBypassBlockReason,Gd as getGovernedMemoryShellWriteDenial,je as getImpactEstimate,Pg as getKodaxGlobalDir,_a as getMcpCachePaths,T as getModelCapabilities,Qa as getModelInputCapabilities,ge as getModuleContext,Cd as getPlanModeAllowedWritablePaths,Id as getPlanModeBlockReason,ie as getProcessContext,K as getProvider,O as getProviderConfiguredCapabilityProfile,N as getProviderConfiguredReasoningCapability,P as getProviderList,M as getProviderModel,S as getProviderModelDescriptors,Q as getProviderModels,kg as getRegisteredToolDefinition,fe as getRepoIntelligenceIndex,Rd as getRepoOverview,ke as getRepoRoutingSignals,vg as getRequiredToolParams,fa as getRuntimeModelProvider,ha as getRuntimeModelProviderNames,vb as getSessionLineagePath,wb as getSessionMessagesFromLineage,he as getSymbolContext,ig as getTool,jg as getToolDefinition,lg as getToolRegistrations,_c as getToolResultPolicy,wk as getWorkflowPatternTemplate,md as gitSignatureInspectionMayExecute,Oe as goalTokenDelta,Ui as hasExplicitNaturalLanguageWorkflowIntent,Je as hasPendingSwap,za as inferImageMediaType,Jd as inferPermissionMode,eh as inferTaskType,Aa as inferVideoMediaType,Yc as inspectEditFailure,le as inspectRepoIntelligenceProject,de as inspectRepoIntelligenceRuntime,zg as inspectToolOutputStorage,Sb as installProductionLearningReviewer,zc as isAgentHomeHardMutationTarget,Ac as isAgentHomeHardRemovalTarget,wd as isAlwaysConfirmPath,wc as isAutoReadableAgentHomePath,Mj as isAutoReadableKodaxPath,uc as isAutoWritableAgentHomePath,Nj as isAutoWritableKodaxPath,qd as isBashReadCommand,Ad as isBashReadCommandAutoAllowed,sd as isBashWriteCommand,zd as isCommandOnProtectedPath,Lj as isCredentialBearingKodaxPath,Z as isCustomProviderName,zj as isDeniedRecently,vc as isGovernedMemoryMutationTarget,pd as isHelpCommand,ka as isKnownProvider,fd as isNullDevice,mj as isParallelDispatchDirective,Bd as isPathInsideProject,Dd as isPlanModeAllowedPath,jd as isPowerShellMutationCommand,yc as isProtectedAgentHomeMutationTarget,xc as isProtectedAgentHomeReadTarget,Bc as isProtectedAgentHomeRemovalTarget,L as isProviderConfigured,R as isProviderName,ga as isRuntimeModelProviderName,Og as isSessionRecoveryCandidateError,od as isShellReadOnlyArgv,gf as isSupportedExtensionModulePath,ud as isToolCallAllowed,sg as isToolFileMutation,ug as isToolMutation,tg as isToolNetworkRead,rg as isToolPlanModeAllowed,Xe as isValidTokenBudget,Ai as isWorkflowProjectProtected,Hg as languageIdForPath,Tf as listAll,oa as listAllModelCapabilities,Pf as listArtifacts,U as listBuiltinModelCapabilities,pg as listBuiltinToolDefinitions,li as listBuiltinWorkflows,Le as listCodingDispatchableAgents,Rf as listConstructed,da as listCustomProviderModelCapabilities,Ye as listRunScopedTools,xg as listToolDefinitions,wg as listTools,vk as listWorkflowPatternTemplates,Qg as loadAgentsFiles,Uf as loadAgentsFromMarkdown,Sj as loadExecPolicy,ui as loadGeneratedWorkflowFromRun,cc as loadGenerationCheckpoint,uf as loadHandler,Vf as loadMarkdownAgentScope,pi as loadSavedWorkflow,oi as loadSavedWorkflowCapsule,jb as loadValidToken,_e as lookupRunScopedTool,Ne as makeDisabledGoalToolsContext,w as mapLegacyReasoningModeToEffortIntent,Dg as maybeRunReferenceAwareToolOutputGc,Cg as maybeRunToolOutputGc,hj as mcpRootsFromWorkspace,tb as mergeArtifactLedger,di as mergeScopedReviewResults,ac as normalizeKodaXAgentMode,Xa as normalizeMcpCapabilityId,Ga as normalizePastedImage,v as normalizeReasoningEffortValue,ci as normalizeScopedReviewResult,ic as normalizeShellExecutionContract,ni as normalizeWorkflowModule,oh as orderPromptSections,$h as parallelInvestigation,td as parseAllowedToolPattern,fc as parseBareInlineSlashReferences,gd as parseBashCommand,Ej as parseClassifierOutput,Xc as parseEditToolError,Rj as parseExecPolicy,bc as parseGenerationCheckpoint,nd as parseGitGrepShortOption,ec as parseInlineSkillReferences,yf as parseLlmReviewVerdict,Ya as parseMcpCapabilityId,hk as parseModelSpec,y as parseReasoningEffortEnv,dc as parseSandboxEnvironmentPass,F as parseTimeoutSecEnvMs,df as parseToolSearchQuery,Yh as parseWorkflowGeneration,ib as performOAuthLogin,La as persistImageAsBlock,Mc as persistToolOutput,cj as planGoalCreate,dj as planGoalTransition,Ah as planToolExposure,wi as preflightWorkflowCapsule,me as prepareRepoIntelligenceProject,ne as prewarmRepoIntelligenceCaches,Ci as protectWorkflowProject,wh as providerResilienceConfigFromTimeouts,Ma as prunePasteTmpDir,Ia as readAndNormalizeClipboardImage,Qf as readArtifact,Bf as readAuditEntries,Df as readBudget,a as readClientItemRange,Ha as readClipboardImage,Gf as readDisableState,dh as reasoningModeToDepth,Vg as reconstructMessagesWithToolGuard,ak as recordAutoModeAllow,$j as recordAutoModeBlock,Xi as recordBlockerAttempt,fk as recordBreakerError,Hh as recordCompactionSavings,yj as recordDenial,Dk as recoverWorkflowRunCleanups,Mb as reduceOutputSegmentProjection,Si as registerCodingInvariants,fj as registerConfiguredMcpCapabilityProvider,X as registerCustomProviders,ea as registerModelProvider,hb as registerOAuthClient,jj as registerOfficialSandboxExtension,ua as registerPresetDispatcher,hg as registerTool,Nf as rehydrateActiveArtifacts,Ef as remainingSelfModifyBudget,ri as renameSavedWorkflow,Vd as renderChangedScope,ae as renderImpactEstimate,Zd as renderModuleContext,$d as renderProcessContext,ph as renderPromptSections,Sd as renderRepoOverview,we as renderRetrievalResult,_d as renderSymbolContext,gj as replaceConfiguredMcpCapabilityProvider,ti as replaceSavedWorkflow,Ig as reportLspDiagnostics,Yi as resetBlockerCounter,Ff as resetBudget,ik as resolveClassifierModel,Me as resolveCodingDispatchableAgent,Ie as resolveConstructedAgent,jf as resolveExtensionEntrypoint,Rc as resolveKodaXManual,na as resolveModelCapabilities,ja as resolveProvider,ma as resolveProviderModelDescriptors,z as resolveReasoningEffort,A as resolveReasoningEffortForModelSwitch,ch as resolveReasoningMode,ce as resolveRepoIntelligenceMode,be as resolveRepoIntelligenceRuntimeConfig,Tg as resolveResilienceConfig,xb as resolveSessionLineageTarget,kh as resolveSkillModelOverride,Uc as resolveToolBridgeTarget,Pi as resolveToolCapability,Lc as resolveToolOutputDir,pa as resolveWireEffort,Jb as resolveWorkMode,Uh as resolveWorkflowGenerationTimeoutMs,tk as resolveWorkflowIdentity,Nh as resumeWorkflowGenerationTurn,Of as revoke,Cb as rewindSessionLineage,_f as rollbackSelfModify,vf as runAstRules,Kh as runKodaX,zf as runLlmReview,ej as runManagedTask,kj as runOrchestration,Ze as runScopedToolMap,Mi as runToolInvocation,Ii as runWorkflowFromOptions,Gi as runWorkflowModule,yi as safeWorkflowArtifactName,qi as saveGeneratedWorkflow,vi as saveGeneratedWorkflowFromRun,ii as scopedReview,Za as searchMcpCatalog,cf as searchToolIndex,dg as setActiveExtensionRuntime,b as setAgentConfigHome,yb as setSessionLineageActiveEntry,jc as shellExecutionContractFingerprint,Qe as shouldFlipBudgetLimited,Fh as shouldSkipLlmCompaction,Mg as shutdownDefaultLspService,Kf as stage,Mh as startKodaX,Li as startManagedWorkflow,Fj as stripAssistantText,se as stripHtmlToText,Lf as testArtifact,E as timeoutSecToMs,$e as toModelToolDefinition,xd as tokenizeRawCommandStages,Wj as tokenizeShellCommand,Od as toolAskUserQuestion,Kd as toolBash,Yd as toolChangedDiff,Xd as toolChangedScope,Ae as toolCodeSearch,Wc as toolEdit,Ld as toolGlob,Md as toolGrep,re as toolImpactEstimate,Zc as toolInsertAfterAnchor,oe as toolModuleContext,Qi as toolPermission,qe as toolProcessContext,Nc as toolRead,Wd as toolRepoOverview,Be as toolSemanticLookup,pe as toolSymbolContext,Nd as toolUndo,ze as toolWebFetch,ye as toolWebSearch,Vc as toolWrite,Ic as truncateHead,Kc as truncateLine,Jc as truncateTail,Pe as turnWallTimeDelta,hc as uniqueBareInlineSlashNames,gc as uniqueInlineSkillNames,Ta as validateAndFixToolHistory,V as validateCustomProviderConfig,Vh as validateGeneratedWorkflowSource,C as validateImageBytes,Ra as validateInputArtifactsForModel,oj as validateSubtaskIndependence,wf as validateToolSchemaForProvider,ff as webhook,fg as withExtensionRuntimeContext,_i as withGoalBeforeNextTurn,$i as withGoalStopHook,Tc as withManualToolBranding,Bi as withWorkflowWorktreeProtection,Ge as workerAgent,Wi as workflowStartOutcomeConsumesTurn,Bk as writeReviewPackets};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{j as a}from"./chunk-V2XJSFFE.js";import"./chunk-JAF2YLZO.js";import"./chunk-DV5YPYLW.js";import"./chunk-BBZWF2EA.js";import"./chunk-F6GJXQNA.js";import"./chunk-XDMNJW6J.js";import"./chunk-ISLK6R2P.js";import"./chunk-OGTRDK4Q.js";import"./chunk-GZUWQZJD.js";import"./chunk-W2CWO4PQ.js";import"./chunk-65652LR4.js";import"./chunk-5MUVRFMU.js";import"./chunk-2HH5AS7E.js";import"./chunk-J2L2NK6E.js";import"./chunk-KDSO7V4O.js";import"./chunk-SK3RRGHJ.js";import"./chunk-WMMESRP3.js";import"./chunk-QP47JIWP.js";import"./chunk-52EN2777.js";import"./chunk-UF3GZ5PO.js";import"./chunk-KE2NBMAP.js";import"./chunk-V5RCDBKU.js";import"./chunk-KDLOPBFZ.js";import"./chunk-V4WSBIXB.js";export{a as startManagedWorkflow};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{o as a,p as b,q as c,r as d}from"./chunk-53CJDQS2.js";import"./chunk-ZQYWDI4O.js";import"./chunk-EISRVOBJ.js";import"./chunk-QSZCR5GC.js";import"./chunk-V2XJSFFE.js";import"./chunk-JAF2YLZO.js";import"./chunk-DV5YPYLW.js";import"./chunk-X5M7TLJV.js";import"./chunk-C6JGLEYD.js";import"./chunk-D36OIMV7.js";import"./chunk-BBZWF2EA.js";import"./chunk-F6GJXQNA.js";import"./chunk-XDMNJW6J.js";import"./chunk-RYBUYHDL.js";import"./chunk-4Y6U7AH4.js";import"./chunk-EPK6EWRI.js";import"./chunk-ISLK6R2P.js";import"./chunk-OGTRDK4Q.js";import"./chunk-GZUWQZJD.js";import"./chunk-W2CWO4PQ.js";import"./chunk-TQ475LOI.js";import"./chunk-65652LR4.js";import"./chunk-5MUVRFMU.js";import"./chunk-2HH5AS7E.js";import"./chunk-J2L2NK6E.js";import"./chunk-KDSO7V4O.js";import"./chunk-SK3RRGHJ.js";import"./chunk-WMMESRP3.js";import"./chunk-QP47JIWP.js";import"./chunk-52EN2777.js";import"./chunk-UF3GZ5PO.js";import"./chunk-KE2NBMAP.js";import"./chunk-V5RCDBKU.js";import"./chunk-KDLOPBFZ.js";import"./chunk-V4WSBIXB.js";export{b as askInput,a as getPrompt,d as needsContinuation,c as openExternalEditor};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{N as a,O as b}from"./chunk-JAF2YLZO.js";import"./chunk-DV5YPYLW.js";import"./chunk-F6GJXQNA.js";import"./chunk-XDMNJW6J.js";import"./chunk-ISLK6R2P.js";import"./chunk-OGTRDK4Q.js";import"./chunk-GZUWQZJD.js";import"./chunk-W2CWO4PQ.js";import"./chunk-65652LR4.js";import"./chunk-5MUVRFMU.js";import"./chunk-2HH5AS7E.js";import"./chunk-J2L2NK6E.js";import"./chunk-KDSO7V4O.js";import"./chunk-SK3RRGHJ.js";import"./chunk-WMMESRP3.js";import"./chunk-QP47JIWP.js";import"./chunk-52EN2777.js";import"./chunk-UF3GZ5PO.js";import"./chunk-KE2NBMAP.js";import"./chunk-V5RCDBKU.js";import"./chunk-KDLOPBFZ.js";import"./chunk-V4WSBIXB.js";export{a as createWorkflowRunManager,b as getDefaultWorkflowRunManager};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{a,b}from"./chunk-C6JGLEYD.js";import"./chunk-D36OIMV7.js";import"./chunk-BBZWF2EA.js";import"./chunk-F6GJXQNA.js";import"./chunk-XDMNJW6J.js";import"./chunk-RYBUYHDL.js";import"./chunk-4Y6U7AH4.js";import"./chunk-EPK6EWRI.js";import"./chunk-ISLK6R2P.js";import"./chunk-OGTRDK4Q.js";import"./chunk-GZUWQZJD.js";import"./chunk-W2CWO4PQ.js";import"./chunk-TQ475LOI.js";import"./chunk-65652LR4.js";import"./chunk-5MUVRFMU.js";import"./chunk-2HH5AS7E.js";import"./chunk-J2L2NK6E.js";import"./chunk-KDSO7V4O.js";import"./chunk-SK3RRGHJ.js";import"./chunk-WMMESRP3.js";import"./chunk-QP47JIWP.js";import"./chunk-52EN2777.js";import"./chunk-UF3GZ5PO.js";import"./chunk-KE2NBMAP.js";import"./chunk-V5RCDBKU.js";import"./chunk-KDLOPBFZ.js";import"./chunk-V4WSBIXB.js";export{a as createSessionControl,b as startKodaX};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
|
|
2
|
-
import{$ as i,Q as a,R as b,S as c,T as d,U as e,V as f,Z as g,_ as h,aa as j,hb as k,ib as l,jb as m,kb as n,lb as o,mb as p,nb as q,ob as r,pb as s,qb as t,rb as u,sb as v,tb as w,ub as x,vb as y,wb as z,xb as A,yb as B,zb as C}from"./chunk-J2L2NK6E.js";import"./chunk-SK3RRGHJ.js";import"./chunk-WMMESRP3.js";import"./chunk-QP47JIWP.js";import"./chunk-52EN2777.js";import"./chunk-UF3GZ5PO.js";import"./chunk-KE2NBMAP.js";import"./chunk-V5RCDBKU.js";import"./chunk-KDLOPBFZ.js";import"./chunk-V4WSBIXB.js";export{w as SkillExecutor,s as SkillRegistry,o as VariableResolver,d as clearPluginSkillPaths,x as createExecutor,p as createResolver,k as discoverSkills,m as discoverSkillsWithMonorepo,C as dispatchSkillCreatorTool,y as executeSkill,z as expandSkillForLLM,A as formatSkillActivationMessage,r as formatSkillsSystemPrompt,e as getDefaultSkillPaths,l as getNestedSkillPaths,f as getSkillPathsFlat,t as getSkillRegistry,u as initializeSkillRegistry,B as isSkillCreatorDispatchAction,c as listPluginSkillPaths,i as loadFullSkill,j as loadSkillFileContent,h as loadSkillMetadata,n as parseArguments,g as parseSkillMarkdown,a as registerPluginSkillPath,v as resetSkillRegistry,q as resolveSkillContent,b as unregisterPluginSkillPath};
|