// @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
import{Ab as a,vb as i}from"./chunk-7JLYVWAF.js";import"./chunk-CD3R5YBH.js";import"./chunk-HMYEQJGT.js";import"./chunk-OWSKU55I.js";import"./chunk-DKXUY5F2.js";import"./chunk-3RKBXWZS.js";import{a as t}from"./chunk-V4WSBIXB.js";var n=null;function f(e){n=e}t(f,"bindAskUserForConstruction");function d(e){return e.content?.capabilities?.tools??[]}t(d,"readDeclaredTools");var u=t(async e=>{if(!n)return"reject";let o=d(e),r=o.length>0?o.join(", "):"<none>";return await n({question:`Activate constructed tool ${e.name}@${e.version}?
It declares capabilities.tools = [${r}].`,options:[{label:"Approve \u2014 register and make callable",description:"The tool will be added to the active tool registry and the LLM can invoke it on the next turn.",value:"approve"},{label:"Reject \u2014 do not register",description:"The artifact stays staged on disk; rerun activate_tool to retry.",value:"reject"}]})==="approve"?"approve":"reject"},"replConstructionPolicy"),p=t(async e=>{if(!n)return"reject";let o=e.llmSummary.flaggedConcerns.length>0?e.llmSummary.flaggedConcerns.map(l=>`  \u2022 ${l}`).join(`
`):"  \u2022 <none>",r=e.prevContent.instructions??"<no instructions>",s=e.nextContent.instructions??"<no instructions>",c=[`Self-modify activation: ${e.agentName}@${e.fromVersion} \u2192 ${e.toVersion}`,"",`LLM diff summary (severity=${e.llmSummary.severity}):`,`  ${e.llmSummary.summary}`,"","Flagged concerns:",o,"",`Budget remaining (after approve): ${e.budgetRemaining-1}/${e.budgetLimit}`,"","\u2500\u2500 Previous instructions \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",r,"\u2500\u2500 Proposed instructions \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",s,"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500","","The LLM summary is advisory \u2014 read the proposed instructions above before approving."].join(`
`);return await n({question:c,options:[{label:"Approve \u2014 activate the new version on the next run",description:"Resolver swap is deferred to the next Runner.run boundary so the in-flight conversation keeps the prior reference.",value:"approve"},{label:"Reject \u2014 stay on the previous version",description:"Budget is not consumed on rejection; the staged version is left on disk for diff inspection.",value:"reject"}]})==="approve"?"approve":"reject"},"replSelfModifyAskUser");async function g(e){return i({cwd:e,policy:u,selfModifyAskUser:p}),a()}t(g,"bootstrapConstructionRuntime");export{f as bindAskUserForConstruction,g as bootstrapConstructionRuntime};
