Lines 278-318javascript
280`}i(Jw,"buildSelfModifyDiffPrompt");function Yw(e){let t={summary:"LLM summary unavailable \u2014 review the raw manifest diff carefully before approving.",severity:"major",flaggedConcerns:["LLM reviewer did not return a parseable summary."],raw:e},n=Zw(e);if(!n)return t;let r;try{r=JSON.parse(n)}catch{return t}let o=typeof r.summary=="string"?r.summary:void 0,s=Qw(r.severity)?r.severity:void 0,a=Array.isArray(r.flaggedConcerns)?r.flaggedConcerns.filter(c=>typeof c=="string"):void 0;return!o||!s||!a?t:{summary:o,severity:s,flaggedConcerns:a,raw:e}}i(Yw,"parseSelfModifyDiffSummary");function Qw ...
281`),tools:vb(du),maxBudget:kb}}i(uu,"buildRepoExplorerAgentContent");function fu(e=Date.now()){return{kind:"agent",name:Fr,version:"0.7.57-builtin",content:uu(),status:"active",createdAt:e,testedAt:e,activatedAt:e}}i(fu,"buildRepoExplorerAgentArtifact");async function _b(){if($e(Fr))
282`)}i(ls,"renderTestResult");var $b=`export async function handler(input, ctx) {
283 // TODO: implement using only declared capabilities (ctx.tools.<name>).
284 // Return a string. Throw on unrecoverable input. The runtime applies
285 // a timeout (default 30s) and rejects calls to undeclared tools.
286 return JSON.stringify({ note: 'scaffold \u2014 replace this body', input });
288`;async function ds(e,t){try{let n=xt(e,"name"),r=_(e,"version")??"0.1.0",o=_(e,"description")??"TODO: short tool description.",s=e.capabilities,a=(()=>{if(!s)return{tools:[]};if(typeof s!="object")throw new Error("capabilities must be an object with a tools[] array.");let l=s.tools;if(l===void 0)return{tools:[]};if(!Array.isArray(l)||l.some(d=>typeof d!="string"))throw new Error("capabilities.tools must be an array of builtin tool names (strings).");return{tools:l}})(),c={kind:"tool",name:n,version:r,status:"staged",createdAt:Date.now(),content:{description:o,inputSchema:{type:"object",proper ...
289`)}catch(n){return`[Tool Error] scaffold_tool: ${n.message}`}}i(ds,"toolScaffoldTool");async function us(e,t){try{let n=xt(e,"artifact_json"),r=_(e,"provider")??"anthropic",o;try{o=gu(hu(n))}catch
290`)}catch(n){return`[Tool Error] stage_construction: ${n.message}`}}i(fs,"toolStageConstruction");async function ps(e,t){try{let n=xt(e,"name"),r=xt(e,"version"),o=_(e,"provider"),s=await vt(n,r);if(!s)return`[Tool Error] test_tool: no staged artifact found for ${n}@${r}.`;if(s.status==="revoked")return`[Tool Error] test_tool: artifact ${n}@${r} is revoked. Bump the version and re-stage.`;let a={artifact:s,stagedAt:Date.now()},c=await On(a,o?{provider:o}:void 0);return ls(c)}catch(n){return`[Tool Error] test_tool: ${n.message}`}}i(ps,"toolTestTool");async function ms(e,t){try{let n=xt(e,"name") ...
291`)}catch(n){return`[Tool Error] activate_tool: ${n.message}`}}i(ms,"toolActivateTool");var yu={quick:0,balanced:1,deep:2};function wu(e){if(e.prevKind!=="agent"||e.nextKind!=="agent")return{ok:!1,rule:"kind-invalid",reason:`Self-modify only supports kind='agent' (prev='${
292`)}catch(n){return`[Tool Error] ${Ie}: ${n.message}`}}i(bu,"toolStageSelfModify");var gs=["scaffold_agent","validate_agent","stage_agent_construction","test_agent","activate_agent"],tI=new Set(gs),Nb=new Set([...gs,Ie]);function Db(e,t){return t?[...e]:e.filter(n=>!Nb.has(n))}i(Db,"filterAgentConstructionToolNames");function Et(e,t){let n=e[t];if(typeof n!="string"||n.trim().length===0)throw new Error(`'${t}' is required and must be a non-empty string.`);return n.trim()}i(Et,"readRequiredString");function ku(e){try{return JSON.parse(e)}catch(t){throw new Error(`artifact_json failed to parse as ...
293`)}i(_u,"renderTestResult");async function xu(e,t){try{let n=Et(e,"name"),r=_(e,"version")??"0.1.0",o=_(e,"description")??"TODO: short summary of what this agent does and when to invoke it.",s={kind:"agent",name:n,version:r,status:"staged",createdAt:Date.now(),content:{instructions:`${o}
295TODO: replace with the agent's full operating instructions.`,tools:[],reasoning:{default:"balanced",max:"deep",escalateOnRevise:!1}}};return["Scaffolded agent manifest (fill TODO sections, then call validate_agent):","","Manifest schema notes:"," - instructions: string (required) \u2014 the agent's system-prompt body.",' - tools: ToolRef[] \u2014 refs like { ref: "builtin:read" } or { ref: "constructed:foo@1.0.0" }.',' - handoffs: AgentHandoffRef[] \u2014 { target: { ref }, kind: "continuation"|"as-tool" }.'," - reasoning: { default, max?, escalateOnRevise? } \u2014 same shape as Layer A A ...
296`)}catch(n){return`[Tool Error] scaffold_agent: ${n.message}`}}i(xu,"toolScaffoldAgent");async function Eu(e,t){try{let n=Et(e,"artifact_json"),r;try{r=vu(ku(n))}catch(l){return`[Tool Error] validate_agent: ${l.message}`}if(qs().length===0)return["[Tool Error] validate_agent: invariant registry is empty.","Call registerCodingInvariants() (from @kodax-ai/coding) before invoking validate_agent \u2014","the REPL surface bootstraps this at startup; non-REPL contexts must register explicitly."].join(" ");let o=Q({name:r.name,content:r.content}),s=await J.admit(o),a=[],c=[];if(!s.ok)a.push(`[admissi ...
297`)}catch(n){return`[Tool Error] stage_agent_construction: ${n.message}`}}i(Su,"toolStageAgentConstruction");async function Tu(e,t){try{let n=Et(e,"name"),r=Et(e,"version"),o=await vt(n,r);if(!o)return`[Tool Error] test_agent: no staged artifact found for ${n}@${r}.`;if(o.kind!=="agent")return`[Tool Error] test_agent: ${n}@${r} has kind='${o.kind}', expected 'agent'. Use test_tool for tool artifacts.`;if(o.status==="revoked")return`[Tool Error] test_agent: ${n}@${r} is revoked. Bump the version and re-stage.`;let s={artifact:o,stagedAt:Date.now()},a=await On(s);return _u(a)}catch(n){return`[Too ...
298`)}catch(n){return`[Tool Error] activate_agent: ${n.message}`}}i(Au,"toolActivateAgent");var jr=Object.freeze({web_search:'Discover web content when no specific URL is known \u2014 call `tool_search("web_search")` for full schema.',web_fetch:'Fetch a specific remote URL (HTML\u2192markdown, cached) \u2014 call `tool_search("web_fetch")` for full schema (includes GitHub-URL gh-CLI guidance).',code_search:'Ranked text search across the repo with noise filtering \u2014 call `tool_search("code_search")` for selection heuristics vs grep / symbol_context.',semantic_lookup:'Symbol-/module-/process-aw ...
299`)}i(rk,"buildResult");var ok=i(async(e,t)=>{let n=e,r=typeof n.query=="string"?n.query:"";if(r.length===0)return"tool_search: `query` is required. Forms: `select:NAME[,NAME...]` for exact lookup, or keyword search (`+required loose terms`).";let o=typeof n.max_results=="number"&&n.max_results>
300
HighCommand Output Exfiltration
Source combines command execution, command-output handling, and outbound requests; review data flow before blocking.
dist/chunks/chunk-7QB55SYG.jsView on unpkg · L298 301`)||void 0}async refreshCapabilityProviders(t){let n=!1,r;for(let o of[this.primary,this.secondary])try{await o.refreshCapabilityProviders(t),n=!0}catch(s){if(r??=s,!t||!this.shouldTryNextCapabilityRuntime(s,t))throw s}if(!n&&r)throw r}getDiagnostics(){let t=this.primary.getDiagnostics(),n=this.secondary.getDiagnostics();return{loadedExtensions:[...n.loadedExtensions,...t.loadedExtensions].sort((r,o)=>r.path.localeCompare(o.path)),capabilityProviders:[...n.capabilityProviders,...t.capabilityProviders].sort((r,o)=>r.id.localeCompare(o.id)),commands:[...n.commands,...t.commands].sort((r,o)=>r.na ...
302`),input_schema:{type:"object",properties:{path:{type:"string",description:"The absolute path to the file"},offset:{type:"number",description:"Line number to start from (text files only)"},limit:{type:"number",description:"Number of lines to read (text files only)"}},required:["path"]},handler:oo,sideEffect:"readonly",toClassifierInput:i(()=>"","toClassifierInput")},{name:"kodax_manual",description:co(),input_schema:{type:"object",properties:{topic:{type:"string",description:'A manual topic id (e.g. "providers", "config", "agents", "extensions", "doctor"). Unknown topics return the index.'},qu ...
303`),input_schema:{type:"object",properties:{skill:{type:"string",description:'The skill name (e.g. "commit", "review-pr"). Leading slash is tolerated.'},args:{type:"string",description:"Optional arguments forwarded to the skill resolver."}},required:["skill"]},handler:yl,sideEffect:"mutates-state",toClassifierInput:i(()=>"","toClassifierInput")},{name:"write",description:'Write content to a file on the local filesystem. Large diffs may be summarized in the tool result.\n\n## When to Use This Tool\n\n- Creating a NEW file the user explicitly asked for.\n- Performing a complete rewrite of an exis ...
305Set status to complete only when the objective is achieved and no required work remains. Completion triggers a runtime verifier; if the verifier does not confirm, the call is rejected and you must keep working.
307Set status to blocked only when the goal cannot proceed without external unblock, and the same blocking condition has persisted across recent goal turns. The runtime counter rejects blocked status until the same blocker_kind has repeated for 3 consecutive turns.
309Pause, resume, and budget-limited transitions are controlled by the user, not this tool. Do not call to stop work \u2014 only call when the objective is truly achieved or truly blocked.`,input_schema:{type:"object",properties:{status:{type:"string",enum:["complete","blocked"],description:'New status. "complete" requires verifier confirmation; "blocked" requires the same blocker_kind across 3 consecutive turns.'},blocker_kind:{type:"string",description:'Required when status=blocked. A short identifier for the persistent obstacle (e.g. "awaiting-user-permission", "missing-dependency"). The runti ...
310... and ${o} more`:"";return`<diagnostics file="${e}">
313</diagnostics>`}i(Qu,"report");import{existsSync as Zu,readFileSync as Jk,statSync as Yk}from"fs";import ve from"path";import{createRequire as ef}from"module";var Vk=process.platform==="win32";function ue(e){let t=e.replace(/\\/g,"/");return Vk?t.toLowerCase():t}i(ue,"normalizeFsPath");var Qk=process.platform==="win32",Zk=Qk?(process.env.PATHEXT??".EXE;.CMD;.BAT;.COM").split(";").filter(Boolean):[""];function tf(e){try{return Zu(e)&&Yk(e).isFile()}catch{return!1}}i(tf,"isFile");function nf(e){let t=(process.env.PATH??"").split(ve.delimiter).filter(Boolean);for(let n of t)for(let r of Zk){let o ...
314`)}i(zr,"formatLocations");function df(e){return typeof e=="string"?e:e.value}i(df,"markedToString");function uf(e){if(!e)return"No hover information.";let t=e.contents;return typeof t=="string"?t.trim()||"No hover information.":Array.isArray(t)?t.map(df).join
315`).trim()||"No hover information.":"kind"in t?t.value.trim()||"No hover information.":df(t).trim()||"No hover information."}i(uf,"formatHover");var pv=Object.freeze({[V.File]:"File",[V.Module]:"Module",[V.Namespace]:"Namespace",[V.Package]:"Package",[V
316`)}i(ff,"formatSymbols");function pf(e,t){return e.length===0?t:e.map(n=>{let r=n.containerName?` in ${n.containerName}`:"";return`${Hr(n.kind)} ${n.name}${r} ${mv(n.location)}`}).join(`
317`)}i(pf,"formatWorkspaceSymbols");function Ls(e){let t=e.detail?` - ${e.detail}`:"";return`${Hr(e.kind)} ${e.name} ${Os(e.uri)}:${Is(e.selectionRange)}${t}`}i(Ls,"formatCallHierarchyItem");function mf(e){return e.length===0?"unknown call site":e.map(Is).join(", ")}i(mf,"formatRanges");function hf(e,t){return e.length===0?t:e.map(Ls).join(`
318`)}i(hf,"formatCallHierarchyItems");function gf(e,t){return e.length===0?t:e.map(n=>`${Ls(n.from)} calls at ${mf(n.fromRanges)}`).join(`
Long lines were clipped for display.