@kodax-ai/kodax 0.7.80 → 0.7.82

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.
Files changed (64) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/README.md +26 -3
  3. package/README_CN.md +21 -3
  4. package/dist/chunks/{agent-5PHGNFW3.js → agent-4UTCCMD5.js} +1 -1
  5. package/dist/chunks/argument-completer-N7ORRJBS.js +2 -0
  6. package/dist/chunks/{chunk-PMKAG4SZ.js → chunk-7ZN2MLVM.js} +1 -1
  7. package/dist/chunks/{chunk-GC4JBMBS.js → chunk-GIVYTXQW.js} +7 -7
  8. package/dist/chunks/{chunk-IHPH3444.js → chunk-JDZFNWMZ.js} +2 -2
  9. package/dist/chunks/{chunk-BWX4YZX3.js → chunk-KH2HED37.js} +2 -2
  10. package/dist/chunks/{chunk-RXXKDR6Y.js → chunk-NINELPXH.js} +1 -1
  11. package/dist/chunks/chunk-PGTU7JQX.js +30 -0
  12. package/dist/chunks/{chunk-T5U4OP2N.js → chunk-S6JTWDN6.js} +1 -1
  13. package/dist/chunks/{chunk-CDCCTM5I.js → chunk-VQBJMNFD.js} +2 -2
  14. package/dist/chunks/{chunk-CEB5FDND.js → chunk-WMYCNECP.js} +57 -57
  15. package/dist/chunks/{chunk-FQ7NVMSU.js → chunk-XTCDCU2Q.js} +136 -136
  16. package/dist/chunks/{chunk-RPF5RGWZ.js → chunk-ZOBNDWOA.js} +151 -151
  17. package/dist/chunks/chunk-ZZUIO5KL.js +348 -0
  18. package/dist/chunks/{compaction-config-6J6XCBJS.js → compaction-config-IDL5JQVI.js} +1 -1
  19. package/dist/chunks/{construction-bootstrap-KPCAE3VN.js → construction-bootstrap-STYUR6XA.js} +1 -1
  20. package/dist/chunks/{dist-RWEVZOFK.js → dist-RKBHBUHV.js} +1 -1
  21. package/dist/chunks/{host-OGS2R5J4.js → host-RF2IX3N6.js} +1 -1
  22. package/dist/chunks/{run-manager-2YMM3BOT.js → run-manager-WE2KPAKZ.js} +1 -1
  23. package/dist/chunks/{utils-2YHRUZYC.js → utils-Z2RSAENX.js} +1 -1
  24. package/dist/index.d.ts +12 -12
  25. package/dist/index.js +1 -1
  26. package/dist/kodax_bootstrap.js +1 -1
  27. package/dist/kodax_cli.js +1292 -1292
  28. package/dist/kodax_resume.js +4 -4
  29. package/dist/runtime-worker.js +1148 -1148
  30. package/dist/sandbox-workspace-session.js +4 -4
  31. package/dist/sdk-a2a.d.ts +8 -8
  32. package/dist/sdk-a2a.js +1 -1
  33. package/dist/sdk-agent.d.ts +10 -10
  34. package/dist/sdk-agent.js +1 -1
  35. package/dist/sdk-coding.d.ts +13 -13
  36. package/dist/sdk-coding.js +1 -1
  37. package/dist/sdk-mcp.js +1 -1
  38. package/dist/sdk-repl.d.ts +11 -11
  39. package/dist/sdk-repl.js +1 -1
  40. package/dist/sdk-runtime.d.ts +15 -8
  41. package/dist/sdk-runtime.js +1 -1
  42. package/dist/sdk-sandbox.js +1 -1
  43. package/dist/sdk-session.d.ts +4 -4
  44. package/dist/sdk-session.js +1 -1
  45. package/dist/sdk-skills.js +1 -1
  46. package/dist/semantic-worker.js +2 -2
  47. package/dist/types-chunks/{bash-prefix-extractor.d-DStqKIlu.d.ts → bash-prefix-extractor.d-CJM7OY-L.d.ts} +4 -2
  48. package/dist/types-chunks/{capsule.d-BuFJaYxA.d.ts → capsule.d-B7yoH4dM.d.ts} +4 -2
  49. package/dist/types-chunks/{controller.d-C2aHqzHj.d.ts → controller.d-CYNuR2n9.d.ts} +2 -2
  50. package/dist/types-chunks/{guardrail.d-DM-OK0m3.d.ts → guardrail.d-fM3mn4Op.d.ts} +2 -2
  51. package/dist/types-chunks/{history-retrieval.d-DImTKgO6.d.ts → history-retrieval.d-BDI-ZMvY.d.ts} +1 -1
  52. package/dist/types-chunks/{public-api.d-CewTvUKV.d.ts → public-api.d-i10kvYFs.d.ts} +2 -2
  53. package/dist/types-chunks/{repl.d-DvXQtgr7.d.ts → repl.d-Cs3eqGVT.d.ts} +5 -5
  54. package/dist/types-chunks/{run-manager.d-C6ahvZqK.d.ts → run-manager.d-CodHf6rw.d.ts} +1 -1
  55. package/dist/types-chunks/{sdk-session-C59RUrri.d.ts → sdk-session-CRXu5xNs.d.ts} +2 -2
  56. package/dist/types-chunks/{shell-command-sets.d-Dp4UvPLL.d.ts → shell-command-sets.d-DfeSUjjM.d.ts} +1 -1
  57. package/dist/types-chunks/{types.d-BzpPDBPV.d.ts → types.d-DIXZFauU.d.ts} +1 -1
  58. package/dist/types-chunks/{types.d-yuJzE82x.d.ts → types.d-DKs4tfSd.d.ts} +2 -2
  59. package/dist/types-chunks/{utils.d-BpACJmzt.d.ts → utils.d-CgITiLyc.d.ts} +4 -4
  60. package/docs/SDK_EMBEDDER_GUIDE.md +38 -10
  61. package/package.json +1 -1
  62. package/dist/chunks/argument-completer-FXRZFMTC.js +0 -2
  63. package/dist/chunks/chunk-UZSHBQER.js +0 -30
  64. package/dist/chunks/chunk-VECRQTSD.js +0 -348
@@ -1,5 +1,5 @@
1
1
  // @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
2
- var Br=Object.defineProperty;var o=(e,t)=>Br(e,"name",{value:t,configurable:!0});import{createHash as AM,randomUUID as bl}from"node:crypto";import{constants as MM,readdirSync as OM,statSync as $M,writeSync as kl}from"node:fs";import{copyFile as NM,lstat as LM,mkdir as jM,readFile as Sl,realpath as FM,rename as KM,rm as xl,stat as XM,writeFile as BM}from"node:fs/promises";import{createRequire as El}from"node:module";import y from"node:path";import Il from"node:readline";import{fileURLToPath as HM,pathToFileURL as Rl}from"node:url";import{DEFAULT_WINDOWS_PROXY_PORT_RANGE as GM,SandboxManager as Q,getSrtWinPath as JM,getWindowsSandboxUserStatus as YM,grantWindowsAcl as QM,installWindowsSandbox as ZM,resolveSrtWin as eO,revokeWindowsAcl as tO}from"@anthropic-ai/sandbox-runtime";import{AsyncLocalStorage as Ur}from"node:async_hooks";var Wr=new Ur;function pe(e){let t=Wr.getStore()?.credential;return t?Z(e,t,new WeakMap):e}o(pe,"redactScopedProviderCredential");function Z(e,t,n){if(typeof e=="string")return e.split(t).join("[REDACTED_CREDENTIAL]");if(e===null||typeof e!="object")return e;let r=n.get(e);if(r!==void 0)return r;if(e instanceof Error){let s=new Error(Z(e.message,t,n));return n.set(e,s),s.name=e.name,e.stack!==void 0&&(s.stack=Z(e.stack,t,n)),s}if(Array.isArray(e)){let s=[];n.set(e,s);for(let a of e)s.push(Z(a,t,n));return s}let i={};n.set(e,i);for(let[s,a]of Object.entries(Object.getOwnPropertyDescriptors(e))){if(!a.enumerable||!("value"in a))continue;let c=s.split(t).join("[REDACTED_CREDENTIAL]");i[c]=Z(a.value,t,n)}return i}o(Z,"redactCredentialValue");import{AsyncLocalStorage as qr}from"node:async_hooks";var ru=new qr;var ee={transport:"native-api",conversationSemantics:"full-history",mcpSupport:"none",contextFidelity:"full",toolCallingFidelity:"full",sessionSupport:"full",longRunningSupport:"full",multimodalSupport:"none",evidenceSupport:"full"},Et={...ee,multimodalSupport:"image-input"},me={transport:"cli-bridge",conversationSemantics:"last-user-message",mcpSupport:"none",contextFidelity:"lossy",toolCallingFidelity:"limited",sessionSupport:"stateless",longRunningSupport:"limited",multimodalSupport:"none",evidenceSupport:"limited"},It={...me,multimodalSupport:"image-input"};import Du from"@anthropic-ai/sdk";import{parse as ku}from"partial-json";import Yu from"openai";import{ClientSideConnection as yf,PROTOCOL_VERSION as wf,ndJsonStream as vf}from"@agentclientprotocol/sdk";var lf=Object.freeze({status:"terminated"}),uf=Object.freeze({status:"already-exited"}),ff=Object.freeze({status:"unknown"}),pf=String.raw`
2
+ var Br=Object.defineProperty;var o=(e,t)=>Br(e,"name",{value:t,configurable:!0});import{createHash as PM,randomUUID as bl}from"node:crypto";import{constants as OM,readdirSync as $M,statSync as DM,writeSync as kl}from"node:fs";import{copyFile as LM,lstat as jM,mkdir as FM,readFile as Sl,realpath as KM,rename as XM,rm as xl,stat as BM,writeFile as UM}from"node:fs/promises";import{createRequire as El}from"node:module";import y from"node:path";import Il from"node:readline";import{fileURLToPath as VM,pathToFileURL as Rl}from"node:url";import{DEFAULT_WINDOWS_PROXY_PORT_RANGE as JM,SandboxManager as Q,getSrtWinPath as YM,getWindowsSandboxUserStatus as QM,grantWindowsAcl as ZM,installWindowsSandbox as eO,resolveSrtWin as tO,revokeWindowsAcl as nO}from"@anthropic-ai/sandbox-runtime";import{AsyncLocalStorage as Ur}from"node:async_hooks";var Wr=new Ur;function pe(e){let t=Wr.getStore()?.credential;return t?Z(e,t,new WeakMap):e}o(pe,"redactScopedProviderCredential");function Z(e,t,n){if(typeof e=="string")return e.split(t).join("[REDACTED_CREDENTIAL]");if(e===null||typeof e!="object")return e;let r=n.get(e);if(r!==void 0)return r;if(e instanceof Error){let s=new Error(Z(e.message,t,n));return n.set(e,s),s.name=e.name,e.stack!==void 0&&(s.stack=Z(e.stack,t,n)),s}if(Array.isArray(e)){let s=[];n.set(e,s);for(let a of e)s.push(Z(a,t,n));return s}let i={};n.set(e,i);for(let[s,a]of Object.entries(Object.getOwnPropertyDescriptors(e))){if(!a.enumerable||!("value"in a))continue;let c=s.split(t).join("[REDACTED_CREDENTIAL]");i[c]=Z(a.value,t,n)}return i}o(Z,"redactCredentialValue");import{AsyncLocalStorage as qr}from"node:async_hooks";var ru=new qr;var ee={transport:"native-api",conversationSemantics:"full-history",mcpSupport:"none",contextFidelity:"full",toolCallingFidelity:"full",sessionSupport:"full",longRunningSupport:"full",multimodalSupport:"none",evidenceSupport:"full"},Et={...ee,multimodalSupport:"image-input"},me={transport:"cli-bridge",conversationSemantics:"last-user-message",mcpSupport:"none",contextFidelity:"lossy",toolCallingFidelity:"limited",sessionSupport:"stateless",longRunningSupport:"limited",multimodalSupport:"none",evidenceSupport:"limited"},It={...me,multimodalSupport:"image-input"};import Du from"@anthropic-ai/sdk";import{parse as ku}from"partial-json";import Yu from"openai";import{ClientSideConnection as yf,PROTOCOL_VERSION as wf,ndJsonStream as vf}from"@agentclientprotocol/sdk";var lf=Object.freeze({status:"terminated"}),uf=Object.freeze({status:"already-exited"}),ff=Object.freeze({status:"unknown"}),pf=String.raw`
3
3
  using System;
4
4
  using System.Runtime.InteropServices;
5
5
  using System.Text;
@@ -535,7 +535,7 @@ process.on('SIGTERM', () => process.exit(0));
535
535
  process.on('SIGINT', () => process.exit(0));
536
536
  `;var _r=Object.freeze(["message","label","compaction","branch_summary","archive_marker","rewind_marker","artifact_ledger","memory_outcome_digest","memory_review_receipt"]),Pd=0,Md=0,Cr=o(e=>{let t=e==="label"?++Pd:++Md,n=Math.random().toString(36).slice(2,8);return`${e}-${Date.now()}-${t}-${n}`},"nextId");async function Od(e,t,n){let r=Cr("label");return await e.append({id:r,ts:Date.now(),type:"label",payload:{targetId:t,label:n}}),r}o(Od,"appendLabel");async function $d(e,t,n){let r=Cr("artifact");return await e.append({id:r,ts:Date.now(),type:"artifact_ledger",payload:{ref:t,summary:n}}),r}o($d,"appendArtifact");function Dd(e){let t=[],n=new Map,r=[],i=null;for(let s of e){if(s.type==="label"){let c=s.payload;c?.targetId&&r.push({targetId:c.targetId,label:c.label});continue}let a={entry:s,children:[]};if(s.type==="message"){t.push(a),n.set(s.id,a),i=a;continue}i?i.children.push(a):t.push(a)}for(let{targetId:s,label:a}of r){let c=n.get(s);c&&a!==void 0&&(c.label=a)}return t}o(Dd,"buildLineageTree");var Nd=Object.freeze({name:"lineage",entryTypes:_r,operators:Object.freeze({label:o((async(e,...t)=>{let[n,r]=t;return Od(e,n,r)}),"label"),attachArtifact:o((async(e,...t)=>{let[n,r]=t;return $d(e,n,r)}),"attachArtifact")}),reducers:Object.freeze({buildLineageTree:o(e=>Dd(e),"buildLineageTree")})});var qd=new Set(["skill","ask_user_question","exit_plan_mode","spawn_agent","send_message","followup_task","wait_agent","interrupt_agent","list_agents","agent_output","tool_search","get_goal","create_goal","update_goal","todo_create","todo_update","todo_list","todo_get","worktree_create","worktree_remove","undo","mcp_search","mcp_describe","mcp_call","mcp_read_resource","mcp_get_prompt","repo_overview","changed_scope","changed_diff","changed_diff_bundle","module_context","symbol_context","process_context","impact_estimate","relationship_scan","cyclic_dependencies","semantic_lookup"]),vt=qd,De=`[\u5BF9\u8BDD\u5386\u53F2\u6458\u8981]
537
537
 
538
- `;var XT=De.trimEnd();var BT=16*1024;var Jd={enabled:!1,maxAge:20,protectedTools:Array.from(vt)};import GC from"typescript";var uP=new Intl.Segmenter("en",{granularity:"grapheme"});var Tl=El(import.meta.url),rO=process.env.KODAX_BUNDLED==="true"?void 0:Rl(Tl.resolve("@anthropic-ai/sandbox-runtime")).href;var oO=[".ssh",".aws",".azure",".gnupg",".kube",".docker",".kodax",".agents",".codex",".claude",".gemini",".direnv",".terraform.d",y.join(".cargo","credentials.toml"),y.join(".config","gcloud"),y.join(".config","gh"),y.join(".config","openai"),y.join(".config","anthropic"),".gitconfig",y.join(".config","git","config"),".terraformrc",y.join(".config","pypoetry","auth.toml"),".condarc",".bashrc",".bash_profile",".zshrc",".zprofile",".profile",y.join(".config","fish","config.fish"),y.join(".config","fish","fish_variables"),".bash_history",".zsh_history",y.join(".m2","settings.xml"),y.join(".m2","settings-security.xml"),y.join(".gradle","gradle.properties"),y.join(".nuget","NuGet","NuGet.Config"),y.join(".pip","pip.conf"),y.join(".config","pip","pip.conf"),y.join(".cache","huggingface","token"),y.join(".huggingface","token"),y.join(".config","rclone","rclone.conf"),y.join(".local","share","keyrings"),y.join("Library","Keychains"),y.join("AppData","Roaming","Microsoft","Protect"),y.join("AppData","Roaming","Microsoft","Credentials"),y.join("AppData","Roaming","Microsoft","Vault"),y.join("AppData","Local","Microsoft","Credentials"),y.join("AppData","Local","Microsoft","Protect"),y.join("AppData","Local","Microsoft","Vault"),".password-store",".env",".envrc",".pgpass",".env.local",".env.development",".env.production",".env.test",".env.staging",".npmrc",".pypirc",".netrc",".git-credentials","credentials","credentials.json","application_default_credentials.json","id_rsa","id_dsa","id_ecdsa","id_ed25519"],Nr=JSON.stringify(Se),kt=JSON.stringify(ke),_l=String.raw`
538
+ `;var XT=De.trimEnd();var BT=16*1024;var Jd={enabled:!1,maxAge:20,protectedTools:Array.from(vt)};import JC from"typescript";var fP=new Intl.Segmenter("en",{granularity:"grapheme"});var Tl=El(import.meta.url),oO=process.env.KODAX_BUNDLED==="true"?void 0:Rl(Tl.resolve("@anthropic-ai/sandbox-runtime")).href;var iO=[".ssh",".aws",".azure",".gnupg",".kube",".docker",".kodax",".agents",".codex",".claude",".gemini",".direnv",".terraform.d",y.join(".cargo","credentials.toml"),y.join(".config","gcloud"),y.join(".config","gh"),y.join(".config","openai"),y.join(".config","anthropic"),".gitconfig",y.join(".config","git","config"),".terraformrc",y.join(".config","pypoetry","auth.toml"),".condarc",".bashrc",".bash_profile",".zshrc",".zprofile",".profile",y.join(".config","fish","config.fish"),y.join(".config","fish","fish_variables"),".bash_history",".zsh_history",y.join(".m2","settings.xml"),y.join(".m2","settings-security.xml"),y.join(".gradle","gradle.properties"),y.join(".nuget","NuGet","NuGet.Config"),y.join(".pip","pip.conf"),y.join(".config","pip","pip.conf"),y.join(".cache","huggingface","token"),y.join(".huggingface","token"),y.join(".config","rclone","rclone.conf"),y.join(".local","share","keyrings"),y.join("Library","Keychains"),y.join("AppData","Roaming","Microsoft","Protect"),y.join("AppData","Roaming","Microsoft","Credentials"),y.join("AppData","Roaming","Microsoft","Vault"),y.join("AppData","Local","Microsoft","Credentials"),y.join("AppData","Local","Microsoft","Protect"),y.join("AppData","Local","Microsoft","Vault"),".password-store",".env",".envrc",".pgpass",".env.local",".env.development",".env.production",".env.test",".env.staging",".npmrc",".pypirc",".netrc",".git-credentials","credentials","credentials.json","application_default_credentials.json","id_rsa","id_dsa","id_ecdsa","id_ed25519"],Nr=JSON.stringify(Se),kt=JSON.stringify(ke),_l=String.raw`
539
539
  const { spawn } = require('node:child_process');
540
540
  const { writeSync } = require('node:fs');
541
541
  const input = JSON.parse(Buffer.from(process.argv[2], 'base64').toString('utf8'));
@@ -560,7 +560,7 @@ child.once('error', (error) => {
560
560
  child.once('exit', (code, signal) => {
561
561
  process.exitCode = signal ? 1 : code ?? 1;
562
562
  });
563
- `,jr="eval(Buffer.from(process.argv[1],'base64').toString('utf8'))",Cl=JSON.stringify(jr),Fr=Buffer.from(_l,"utf8").toString("base64"),Al=JSON.stringify(Fr),iO=String.raw`
563
+ `,jr="eval(Buffer.from(process.argv[1],'base64').toString('utf8'))",Cl=JSON.stringify(jr),Fr=Buffer.from(_l,"utf8").toString("base64"),Al=JSON.stringify(Fr),sO=String.raw`
564
564
  import { spawn } from 'node:child_process';
565
565
  import { randomUUID } from 'node:crypto';
566
566
  import { readFile, rm, writeFile } from 'node:fs/promises';
@@ -823,7 +823,7 @@ try {
823
823
  process.exitCode = 1;
824
824
  }
825
825
  }
826
- `;function St(e){return e instanceof Error?e.message:String(e)}o(St,"errorText");function Pl(){return process.env.KODAX_A2A_NODE??(process.env.KODAX_BUNDLED==="true"?"node":process.execPath)}o(Pl,"sandboxJavaScriptCommand");var sO=5*6e4;function Ml(e,t){let n=e.lastIndexOf("--");if(n<0)throw new Error("ASRT Windows wrapper omitted its child separator.");let r=new Set;for(let c=0;c<n-1;c+=1){if(e[c]!=="--env")continue;let d=e[c+1]?.split("=",1)[0];d&&r.add(d.toLowerCase())}let i=[];for(let[c,d]of Object.entries(t)){if(d===void 0)continue;if(!c||c.includes("=")||c.includes("\0")||d.includes("\0"))throw new Error("Invalid environment entry for ASRT Windows child.");let l=c.toLowerCase();r.has(l)&&l!=="path"&&l!=="pathext"||i.push("--env",`${c}=${d}`)}let s=[...e.slice(0,n),...i,...e.slice(n)];if(s.reduce((c,d)=>c+d.length+3,0)>3e4)throw new Error("ASRT Windows child environment exceeds the CreateProcess command-line limit.");return s}o(Ml,"withWindowsSandboxChildEnvironment");async function Ol(e,t){let n=e.bootstrapCommand??Pl(),r=n===process.execPath&&process.versions.electron!==void 0,i=e.command===process.execPath&&process.versions.electron!==void 0,s=i?["--import",Se,...e.args]:e.args,a=i||r?{...e.env,[ke]:"1"}:e.env,c=o(l=>process.platform==="win32"?`"${l.replaceAll('"','""')}"`:`'${l.replaceAll("'",`'"'"'`)}'`,"quote"),d=[c(n),"-e",c(jr),Fr,Buffer.from(JSON.stringify({command:e.command,args:s,cwd:e.cwd,targetStartedMarker:t}),"utf8").toString("base64")].join(" ");if(process.platform==="win32"){let l={filesystem:{denyRead:e.config.filesystem.denyRead,allowRead:[],allowWrite:[],denyWrite:e.config.filesystem.denyWrite}},u=await Q.wrapWithSandboxArgv(d,"cmd",l,void 0,e.cwd),f=Ml(u.argv,a);return{executable:f[0],args:f.slice(1),env:u.env,shell:!1}}return{executable:await Q.wrapWithSandbox(d),args:[],env:a,shell:!0}}o(Ol,"wrapSandboxTarget");async function Lr(){try{Q.cleanupAfterCommand()}catch{}await Q.reset().catch(()=>{})}o(Lr,"resetSandboxManagerBestEffort");function fe(e){kl(3,`${JSON.stringify(e)}
826
+ `;function St(e){return e instanceof Error?e.message:String(e)}o(St,"errorText");function Pl(){return process.env.KODAX_A2A_NODE??(process.env.KODAX_BUNDLED==="true"?"node":process.execPath)}o(Pl,"sandboxJavaScriptCommand");var aO=5*6e4;function Ml(e,t){let n=e.lastIndexOf("--");if(n<0)throw new Error("ASRT Windows wrapper omitted its child separator.");let r=new Set;for(let c=0;c<n-1;c+=1){if(e[c]!=="--env")continue;let d=e[c+1]?.split("=",1)[0];d&&r.add(d.toLowerCase())}let i=[];for(let[c,d]of Object.entries(t)){if(d===void 0)continue;if(!c||c.includes("=")||c.includes("\0")||d.includes("\0"))throw new Error("Invalid environment entry for ASRT Windows child.");let l=c.toLowerCase();r.has(l)&&l!=="path"&&l!=="pathext"||i.push("--env",`${c}=${d}`)}let s=[...e.slice(0,n),...i,...e.slice(n)];if(s.reduce((c,d)=>c+d.length+3,0)>3e4)throw new Error("ASRT Windows child environment exceeds the CreateProcess command-line limit.");return s}o(Ml,"withWindowsSandboxChildEnvironment");async function Ol(e,t){let n=e.bootstrapCommand??Pl(),r=n===process.execPath&&process.versions.electron!==void 0,i=e.command===process.execPath&&process.versions.electron!==void 0,s=i?["--import",Se,...e.args]:e.args,a=i||r?{...e.env,[ke]:"1"}:e.env,c=o(l=>process.platform==="win32"?`"${l.replaceAll('"','""')}"`:`'${l.replaceAll("'",`'"'"'`)}'`,"quote"),d=[c(n),"-e",c(jr),Fr,Buffer.from(JSON.stringify({command:e.command,args:s,cwd:e.cwd,targetStartedMarker:t}),"utf8").toString("base64")].join(" ");if(process.platform==="win32"){let l={filesystem:{denyRead:e.config.filesystem.denyRead,allowRead:[],allowWrite:[],denyWrite:e.config.filesystem.denyWrite}},u=await Q.wrapWithSandboxArgv(d,"cmd",l,void 0,e.cwd),f=Ml(u.argv,a);return{executable:f[0],args:f.slice(1),env:u.env,shell:!1}}return{executable:await Q.wrapWithSandbox(d),args:[],env:a,shell:!0}}o(Ol,"wrapSandboxTarget");async function Lr(){try{Q.cleanupAfterCommand()}catch{}await Q.reset().catch(()=>{})}o(Lr,"resetSandboxManagerBestEffort");function fe(e){kl(3,`${JSON.stringify(e)}
827
827
  `)}o(fe,"writeWorkspaceSessionResponse");async function Kr(e){try{let t=JSON.parse(await Sl(e,"utf8"));await xl(e,{force:!0}),await Q.initialize(t.config,async()=>!0),fe({type:"ready",ok:!0});let n=Il.createInterface({input:process.stdin}),r=Promise.resolve();for await(let i of n){let s=JSON.parse(i);r=r.then(async()=>{try{if(s.type==="cleanup"){Q.cleanupAfterCommand(),fe({id:s.id,type:"result",ok:!0});return}if(!s.request)throw new Error("Missing workspace wrap request.");let a=s.request.targetStartedMarker??`\0KODAX_ASRT_TARGET_STARTED:${bl()}\0
828
828
  `,c=await Ol(s.request,a);fe({id:s.id,type:"result",ok:!0,invocation:c})}catch(a){fe({id:s.id,type:"result",ok:!1,error:St(a)})}})}return await r,await Lr(),0}catch(t){try{fe({type:"ready",ok:!1,error:St(t)})}catch(n){process.stderr.write(`ASRT workspace session could not report startup failure: ${St(n)}
829
829
  `)}return await Lr(),1}}o(Kr,"runAsrtWorkspaceSessionProcess");var Xr=process.argv[2];if(!Xr)throw new Error("Missing ASRT workspace session initialization file.");process.exitCode=await Kr(Xr);
package/dist/sdk-a2a.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { bg as ExternalAgentRegistration, O as AgentEffectDeclaration, W as AgentExecutorFactory, q as AgentArtifactPolicy } from './types-chunks/controller.d-C2aHqzHj.js';
1
+ import { bg as ExternalAgentRegistration, O as AgentEffectDeclaration, W as AgentExecutorFactory, q as AgentArtifactPolicy } from './types-chunks/controller.d-CYNuR2n9.js';
2
2
  import { RuntimeKodaXOptions, RuntimeWorkspaceBinding, RuntimeExecutionToolPolicy, RuntimeUserMarkdownAgentRef, KodaXRuntime, RuntimeExternalAgentsOptions } from './sdk-runtime.js';
3
3
  import { d as IntegrationConfigSnapshot, f as IntegrationConfigStatus } from './types-chunks/integration-config.d-BNowXE8k.js';
4
4
  import './types-chunks/types.d-CgrXrFrq.js';
@@ -6,19 +6,19 @@ import './types-chunks/types.d-BbtGlKZu.js';
6
6
  import './types-chunks/config.d-CJy1WENT.js';
7
7
  import './types-chunks/manager.d-B67TmPO1.js';
8
8
  import './types-chunks/capability.d-K664nHOS.js';
9
- import './types-chunks/history-retrieval.d-DImTKgO6.js';
10
- import './types-chunks/run-manager.d-C6ahvZqK.js';
11
- import './types-chunks/bash-prefix-extractor.d-DStqKIlu.js';
9
+ import './types-chunks/history-retrieval.d-BDI-ZMvY.js';
10
+ import './types-chunks/run-manager.d-CodHf6rw.js';
11
+ import './types-chunks/bash-prefix-extractor.d-CJM7OY-L.js';
12
12
  import 'vscode-languageserver-protocol';
13
13
  import './types-chunks/cost-tracker.d-BeaenODW.js';
14
14
  import './types-chunks/types-Bf3Y3mW-.js';
15
15
  import './types-chunks/base.d-DxG0m09Z.js';
16
- import './types-chunks/types.d-yuJzE82x.js';
17
- import './types-chunks/guardrail.d-DM-OK0m3.js';
16
+ import './types-chunks/types.d-DKs4tfSd.js';
17
+ import './types-chunks/guardrail.d-fM3mn4Op.js';
18
18
  import './types-chunks/side-query.d-CP1LiRiH.js';
19
- import './types-chunks/utils.d-BpACJmzt.js';
19
+ import './types-chunks/utils.d-CgITiLyc.js';
20
20
  import 'readline';
21
- import './types-chunks/public-api.d-CewTvUKV.js';
21
+ import './types-chunks/public-api.d-i10kvYFs.js';
22
22
  import 'child_process';
23
23
 
24
24
  declare const A2A_PROTOCOL_VERSION = "1.0";
package/dist/sdk-a2a.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
2
- import"./chunks/chunk-FQ7NVMSU.js";import"./chunks/chunk-IHPH3444.js";import{j as tt,p as nt}from"./chunks/chunk-CDCCTM5I.js";import"./chunks/chunk-PMKAG4SZ.js";import"./chunks/chunk-RPF5RGWZ.js";import"./chunks/chunk-VECRQTSD.js";import"./chunks/chunk-RXXKDR6Y.js";import"./chunks/chunk-HTVLCHWH.js";import"./chunks/chunk-BWX4YZX3.js";import"./chunks/chunk-GC4JBMBS.js";import"./chunks/chunk-KHEFUT6O.js";import"./chunks/chunk-TRNAWSXP.js";import"./chunks/chunk-CEB5FDND.js";import{d as V}from"./chunks/chunk-EVXIJPZ6.js";import"./chunks/chunk-E7C4DRD2.js";import"./chunks/chunk-6UENDY33.js";import{a as o}from"./chunks/chunk-ONUPGMER.js";var te="1.0",ve="kodax-a2a-v1-jsonrpc";var A=class extends Error{constructor(n,r,i=200,s,a){super(r);this.code=n;this.httpStatus=i;this.data=s;this.headers=a;this.name="A2AError"}code;httpStatus;data;headers;static{o(this,"A2AError")}};function ge(t){return t instanceof Error?t.message:String(t)}o(ge,"errorMessage");var sn=["apiKeySecurityScheme","httpAuthSecurityScheme","oauth2SecurityScheme","openIdConnectSecurityScheme","mtlsSecurityScheme"],on=["authorizationCode","clientCredentials","implicit","password","deviceCode"],an=/^[\x21\x23-\x5B\x5D-\x7E]+$/u;function re(t,e){if(!an.test(t))throw new Error(`${e} must be an RFC 6749 scope-token.`)}o(re,"assertOAuthScopeToken");function rt(t,e){let n=t.split(" ");for(let r of n)re(r,e);return[...new Set(n)]}o(rt,"parseOAuthScopeValue");function ie(t,e){if(!Array.isArray(t))throw new Error(`${e} must be an array of strings.`);let n=t.map((r,i)=>{if(typeof r!="string")throw new Error(`${e}[${i}] must be a string.`);return re(r,`${e}[${i}]`),r});if(new Set(n).size!==n.length)throw new Error(`${e} must not contain duplicates.`);return n}o(ie,"parseOAuthScopeList");function B(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}o(B,"isRecord");function P(t,e){if(typeof t!="string"||t.trim().length===0)throw new Error(`${e} must be a non-empty string.`);return t}o(P,"requireNonEmptyString");function cn(t,e){if(t!==void 0)return P(t,e)}o(cn,"optionalString");function it(t,e){return P(t,e).trim()}o(it,"trimmedUri");function dn(t){return/^[A-Za-z][A-Za-z0-9+.-]*:\/\/([^/?#]*)/u.exec(t)?.[1]?.includes("@")===!0}o(dn,"hasAuthorityUserinfo");function me(t){let e=t.toLowerCase().replace(/^\[|\]$/gu,"");return e==="localhost"||e==="127.0.0.1"||e==="::1"}o(me,"isExactOAuthLoopbackHostname");function st(t,e){let n=it(t,e);if(!/^https?:\/\/([^/?#]*)/iu.exec(n)?.[1])throw new Error(`${e} must be an absolute HTTP(S) URL.`);let i;try{i=new URL(n)}catch{throw new Error(`${e} must be an absolute HTTP(S) URL.`)}if(dn(n)||i.username||i.password||n.includes("#"))throw new Error(`${e} must not contain userinfo or a fragment.`);if(i.protocol==="http:"&&!me(i.hostname))throw new Error(`${e} must use HTTPS or exact loopback HTTP.`);return{raw:n,url:i}}o(st,"secureOAuthHttpUrl");function J(t,e){let n=st(t,e);if(n.raw.includes("?"))throw new Error(`${e} must not contain a query or fragment.`);return n.raw}o(J,"parseOAuthIssuerIdentifier");function N(t,e){return st(t,e).url}o(N,"parseOAuthEndpointUrl");function ne(t,e){let n=it(t,e);if(!/^[A-Za-z][A-Za-z0-9+.-]*:/u.test(n))throw new Error(`${e} must be an absolute URI.`);try{new URL(n)}catch{throw new Error(`${e} must be an absolute URI.`)}if(n.includes("#"))throw new Error(`${e} must not contain a fragment.`);return n}o(ne,"parseOAuthResourceIdentifier");function ot(t,e){return N(t,e).href}o(ot,"absoluteHttpUrl");function un(t,e){if(!B(t))throw new Error(`${e} must be a scope-description object.`);return Object.entries(t).map(([n,r])=>{if(n.trim().length===0||typeof r!="string")throw new Error(`${e} must map non-empty scope names to descriptions.`);return re(n,`${e}.${n}`),n})}o(un,"parseScopes");function ln(t,e){if(!B(e))throw new Error(`securitySchemes.${t}.httpAuthSecurityScheme must be an object.`);let n=P(e.scheme,`securitySchemes.${t}.httpAuthSecurityScheme.scheme`),r=cn(e.bearerFormat,`securitySchemes.${t}.httpAuthSecurityScheme.bearerFormat`);return n.toLowerCase()!=="bearer"?{name:t,kind:"unsupported",protocol:`http:${n.toLowerCase()}`}:{name:t,kind:"http-bearer",...r?{bearerFormat:r}:{}}}o(ln,"parseHttpScheme");function An(t,e){let n=e.flows;if(!B(n))throw new Error(`securitySchemes.${t}.oauth2SecurityScheme.flows must be an object.`);let r=on.filter(c=>n[c]!==void 0);if(r.length!==1)throw new Error(`securitySchemes.${t}.oauth2SecurityScheme.flows must contain exactly one OAuth flow.`);let i=r[0],s=n[i];if(!B(s))throw new Error(`securitySchemes.${t}.oauth2SecurityScheme.flows.${i} must be an object.`);let a=un(s.scopes,`securitySchemes.${t}.oauth2SecurityScheme.flows.${i}.scopes`);if(i==="clientCredentials"){let c=ot(s.tokenUrl,`securitySchemes.${t}.oauth2SecurityScheme.flows.clientCredentials.tokenUrl`);return{name:t,kind:"oauth2-client-credentials",tokenUrl:c,scopes:a}}return{name:t,kind:"unsupported",protocol:`oauth2:${i}`,oauthScopes:a}}o(An,"parseOAuthFlow");function pn(t,e,n){if(!B(n))throw new Error(`securitySchemes.${t}.${e} must be an object.`);if(e==="apiKeySecurityScheme"){let r=P(n.location,`securitySchemes.${t}.${e}.location`);if(!["query","header","cookie"].includes(r))throw new Error(`securitySchemes.${t}.${e}.location must be query, header, or cookie.`);return P(n.name,`securitySchemes.${t}.${e}.name`),{name:t,kind:"unsupported",protocol:"api-key"}}return e==="openIdConnectSecurityScheme"?(ot(n.openIdConnectUrl,`securitySchemes.${t}.${e}.openIdConnectUrl`),{name:t,kind:"unsupported",protocol:"openid-connect",acceptsOAuthScopes:!0}):{name:t,kind:"unsupported",protocol:"mutual-tls"}}o(pn,"parseUnsupportedScheme");function fn(t,e){if(!B(e))throw new Error(`securitySchemes.${t} must be an object.`);let n=sn.filter(i=>e[i]!==void 0);if(n.length!==1)throw new Error(`securitySchemes.${t} must contain exactly one security scheme.`);let r=n[0];if(r==="httpAuthSecurityScheme")return ln(t,e[r]);if(r==="oauth2SecurityScheme"){let i=e[r];if(!B(i))throw new Error(`securitySchemes.${t}.${r} must be an object.`);return An(t,i)}return pn(t,r,e[r])}o(fn,"parseScheme");function hn(t){if(t===void 0)return{};if(!B(t))throw new Error("securitySchemes must be an object.");return Object.fromEntries(Object.entries(t).map(([e,n])=>{if(e.trim().length===0)throw new Error("securitySchemes names must not be empty.");return[e,fn(e,n)]}))}o(hn,"parseSchemes");function gn(t,e){if(!B(t))throw new Error(`${e} must be a StringList object.`);if(t.list===void 0)return[];if(!Array.isArray(t.list)||!t.list.every(n=>typeof n=="string"&&n.trim().length>0))throw new Error(`${e}.list must be an array of non-empty strings.`);if(new Set(t.list).size!==t.list.length)throw new Error(`${e}.list must not contain duplicate scopes.`);for(let n of t.list)re(n,`${e}.list`);return t.list}o(gn,"parseScopeList");function mn(t,e){if(t.kind==="oauth2-client-credentials"||t.kind==="unsupported"&&t.oauthScopes!==void 0){let n=t.kind==="oauth2-client-credentials"?t.scopes:t.oauthScopes??[];for(let r of e)if(!n.includes(r))throw new Error(`scope "${r}" is not declared by security scheme "${t.name}".`);return}if(e.length>0&&!(t.kind==="unsupported"&&t.acceptsOAuthScopes))throw new Error(`security scheme "${t.name}" does not accept OAuth scopes.`)}o(mn,"validateRequiredScopes");function yn(t,e,n){if(!B(t))throw new Error(`securityRequirements[${e}] must be an object.`);let r=t.schemes;if(r!==void 0&&!B(r))throw new Error(`securityRequirements[${e}].schemes must be an object.`);return{schemes:Object.entries(r??{}).map(([a,c])=>{if(!Object.hasOwn(n,a))throw new Error(`securityRequirements[${e}] references unknown security scheme "${a}".`);let d=n[a],u=gn(c,`securityRequirements[${e}].schemes.${a}`);return mn(d,u),{scheme:d,scopes:u}})}}o(yn,"parseRequirement");function F(t,e){let n=hn(t);if(e===void 0)return{schemes:n,requirements:[]};if(!Array.isArray(e))throw new Error("securityRequirements must be an array.");return{schemes:n,requirements:e.map((r,i)=>yn(r,i,n))}}o(F,"parseA2ASecurity");function wn(t,e){let{scheme:n,scopes:r}=e;return n.kind!=="unsupported"&&t.schemeName===n.name&&t.kind===n.kind&&r.every(i=>t.scopes?.includes(i)===!0)}o(wn,"capabilityMatches");function Li(t,e){return ye(t,e)[0]??null}o(Li,"selectA2ASecurityRequirement");function ye(t,e){return(t.requirements.length===0?[{schemes:[]}]:t.requirements).filter(r=>r.schemes.every(i=>e.some(s=>wn(s,i))))}o(ye,"satisfiableA2ASecurityRequirements");var kn=new Set(["TASK_STATE_UNSPECIFIED","TASK_STATE_SUBMITTED","TASK_STATE_WORKING","TASK_STATE_COMPLETED","TASK_STATE_FAILED","TASK_STATE_CANCELED","TASK_STATE_INPUT_REQUIRED","TASK_STATE_REJECTED","TASK_STATE_AUTH_REQUIRED"]);function g(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}o(g,"isRecord");function at(t){if(t===null)return;let e=t.split(";",1)[0]?.trim().toLowerCase();return e&&!/\s/u.test(e)?e:void 0}o(at,"mediaTypeEssence");function de(t){let e=at(t);return e==="application/json"||/^application\/[!#$%&'*+\-.^_`|~0-9a-z]+\+json$/u.test(e??"")}o(de,"isJsonMediaType");function ct(t){return at(t)==="text/event-stream"}o(ct,"isEventStreamMediaType");function U(t,e,n){let r=t[e];if(typeof r!="string"||r.trim().length===0)throw new A(-32602,`${n}.${e} must be a non-empty string.`);return r}o(U,"requiredString");function x(t,e){let n=t[e];return typeof n=="string"&&n.length>0?n:void 0}o(x,"optionalString");function se(t,e){if(!Array.isArray(t)||!t.every(n=>typeof n=="string"))throw new A(-32602,`${e} must be a string array.`);return t}o(se,"stringArray");function Sn(t){if(!g(t))throw new A(-32602,"Agent Card interface is invalid.");return{url:U(t,"url","interface"),protocolBinding:U(t,"protocolBinding","interface"),protocolVersion:U(t,"protocolVersion","interface"),...x(t,"tenant")?{tenant:x(t,"tenant")}:{}}}o(Sn,"parseInterface");function dt(t,e,n){try{F(t,e)}catch(r){let i=r instanceof Error?r.message:String(r);throw new A(-32602,`${n} is invalid: ${i}`)}}o(dt,"validateSecurity");function Rn(t,e){if(!g(t))throw new A(-32602,"Agent Card skill is invalid.");return t.securityRequirements!==void 0&&dt(e,t.securityRequirements,"skill.securityRequirements"),{id:U(t,"id","skill"),name:U(t,"name","skill"),description:U(t,"description","skill"),tags:se(t.tags,"skill.tags"),...Array.isArray(t.examples)?{examples:se(t.examples,"skill.examples")}:{},...Array.isArray(t.inputModes)?{inputModes:se(t.inputModes,"skill.inputModes")}:{},...Array.isArray(t.outputModes)?{outputModes:se(t.outputModes,"skill.outputModes")}:{},...Array.isArray(t.securityRequirements)?{securityRequirements:t.securityRequirements.filter(g)}:{}}}o(Rn,"parseSkill");function En(t){if(!g(t))throw new A(-32602,"Agent Card extension is invalid.");let e=U(t,"uri","extension");try{new URL(e)}catch{throw new A(-32602,"Agent Card extension.uri must be an absolute URI.")}if(t.description!==void 0&&typeof t.description!="string")throw new A(-32602,"Agent Card extension.description must be a string.");if(t.required!==void 0&&typeof t.required!="boolean")throw new A(-32602,"Agent Card extension.required must be a boolean.");if(t.params!==void 0&&!g(t.params))throw new A(-32602,"Agent Card extension.params must be an object.");return{uri:e,...typeof t.description=="string"?{description:t.description}:{},...typeof t.required=="boolean"?{required:t.required}:{},...g(t.params)?{params:t.params}:{}}}o(En,"parseExtension");function ut(t){if(!g(t))throw new A(-32602,"Agent Card must be an object.");let e=t.supportedInterfaces,n=t.skills;if(!Array.isArray(e)||e.length===0)throw new A(-32602,"Agent Card must declare supportedInterfaces.");if(!Array.isArray(n))throw new A(-32602,"Agent Card must declare skills.");if(!g(t.capabilities))throw new A(-32602,"Agent Card capabilities are invalid.");if(t.capabilities.extensions!==void 0&&!Array.isArray(t.capabilities.extensions))throw new A(-32602,"Agent Card capabilities.extensions must be an array.");return dt(t.securitySchemes,t.securityRequirements,"Agent Card security declaration"),{name:U(t,"name","Agent Card"),description:U(t,"description","Agent Card"),supportedInterfaces:e.map(Sn),version:U(t,"version","Agent Card"),capabilities:{...typeof t.capabilities.streaming=="boolean"?{streaming:t.capabilities.streaming}:{},...typeof t.capabilities.pushNotifications=="boolean"?{pushNotifications:t.capabilities.pushNotifications}:{},...typeof t.capabilities.extendedAgentCard=="boolean"?{extendedAgentCard:t.capabilities.extendedAgentCard}:{},...Array.isArray(t.capabilities.extensions)?{extensions:t.capabilities.extensions.map(En)}:{}},...g(t.securitySchemes)?{securitySchemes:t.securitySchemes}:{},...Array.isArray(t.securityRequirements)?{securityRequirements:t.securityRequirements.filter(g)}:{},defaultInputModes:se(t.defaultInputModes,"Agent Card defaultInputModes"),defaultOutputModes:se(t.defaultOutputModes,"Agent Card defaultOutputModes"),skills:n.map(r=>Rn(r,t.securitySchemes))}}o(ut,"parseA2AAgentCard");function lt(t){if(!g(t))throw new A(-32602,"Message Part must be an object.");let e=["text","raw","url","data"].filter(r=>t[r]!==void 0);if(e.length!==1)throw new A(-32602,"Message Part must contain exactly one content field.");let n=e[0];if(n!=="data"&&typeof t[n]!="string")throw new A(-32602,`Message Part ${n} content must be a string.`);return{...typeof t.text=="string"?{text:t.text}:{},...typeof t.raw=="string"?{raw:t.raw}:{},...typeof t.url=="string"?{url:t.url}:{},...t.data!==void 0?{data:t.data}:{},...g(t.metadata)?{metadata:t.metadata}:{},...x(t,"filename")?{filename:x(t,"filename")}:{},...x(t,"mediaType")?{mediaType:x(t,"mediaType")}:{}}}o(lt,"parseA2APart");function $(t){if(!g(t))throw new A(-32602,"Message must be an object.");if(t.role!=="ROLE_USER"&&t.role!=="ROLE_AGENT")throw new A(-32602,"Message role is invalid.");if(!Array.isArray(t.parts)||t.parts.length===0)throw new A(-32602,"Message parts must not be empty.");return{messageId:U(t,"messageId","Message"),role:t.role,parts:t.parts.map(lt),...x(t,"contextId")?{contextId:x(t,"contextId")}:{},...x(t,"taskId")?{taskId:x(t,"taskId")}:{},...g(t.metadata)?{metadata:t.metadata}:{}}}o($,"parseA2AMessage");function Tn(t){if(!g(t)||!Array.isArray(t.parts)||t.parts.length===0)throw new A(-32603,"A2A artifact is invalid.");return{artifactId:U(t,"artifactId","Artifact"),parts:t.parts.map(lt),...x(t,"name")?{name:x(t,"name")}:{},...x(t,"description")?{description:x(t,"description")}:{},...g(t.metadata)?{metadata:t.metadata}:{}}}o(Tn,"parseArtifact");function H(t){if(!g(t)||!g(t.status))throw new A(-32603,"A2A task is invalid.");let e=t.status.state;if(typeof e!="string")throw new A(-32603,"A2A task state is invalid.");let n=kn.has(e)?e:"TASK_STATE_UNSPECIFIED";return{id:U(t,"id","Task"),contextId:x(t,"contextId")??"",status:{state:n,...t.status.message!==void 0?{message:$(t.status.message)}:{},...x(t.status,"timestamp")?{timestamp:x(t.status,"timestamp")}:{}},...Array.isArray(t.artifacts)?{artifacts:t.artifacts.map(Tn)}:{},...Array.isArray(t.history)?{history:t.history.map($)}:{},...g(t.metadata)?{metadata:t.metadata}:{}}}o(H,"parseA2ATask");function At(t){if(!g(t)||t.jsonrpc!=="2.0")throw new A(-32600,"Invalid JSON-RPC request.");if(typeof t.id!="string"&&typeof t.id!="number")throw new A(-32600,"JSON-RPC request id is required.");return{jsonrpc:"2.0",id:t.id,method:U(t,"method","JSON-RPC request"),...g(t.params)?{params:t.params}:{}}}o(At,"parseJsonRpcRequest");import{lookup as bn}from"node:dns/promises";import{request as xn}from"node:http";import{request as In}from"node:https";import{BlockList as Cn,isIP as pt}from"node:net";import{Readable as vn}from"node:stream";var we=new Cn;we.addSubnet("127.0.0.0",8,"ipv4");we.addAddress("::1","ipv6");function Pe(t){let e=pt(t);return e===4?we.check(t,"ipv4"):e===6&&we.check(t,"ipv6")}o(Pe,"isLoopbackAddress");function Pn(t){let e=t.toLowerCase();return e==="localhost"||e==="127.0.0.1"||e==="::1"}o(Pn,"isExactLoopbackHostname");function Oe(t){let e=t.split(".").map(Number),[n,r,i,s]=e;return e.length!==4||n===void 0||r===void 0||i===void 0||s===void 0?!0:n===0||n===10||n===127||n===100&&r>=64&&r<=127||n===169&&r===254||n===172&&r>=16&&r<=31||n===192&&r===168||n===192&&r===0&&i===0&&s!==9&&s!==10||n===192&&r===0&&i===2||n===198&&(r===18||r===19)||n===198&&r===51&&i===100||n===203&&r===0&&i===113||n>=224}o(Oe,"isPrivateIpv4");function On(t){if(Pe(t))return!0;let e=t.toLowerCase(),n=/^::ffff:(\d+\.\d+\.\d+\.\d+)$/.exec(e)?.[1];if(n)return Oe(n);let r=/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/.exec(e);if(r?.[1]&&r[2]){let i=Number.parseInt(r[1],16),s=Number.parseInt(r[2],16);return Oe(`${i>>8}.${i&255}.${s>>8}.${s&255}`)}return e==="::"||e==="::1"||e.startsWith("fc")||e.startsWith("fd")||e.startsWith("fe8")||e.startsWith("fe9")||e.startsWith("fea")||e.startsWith("feb")||e.startsWith("ff")}o(On,"isPrivateIpv6");function Un(t){let e=pt(t);return e===4?Oe(t):e===6?On(t):!0}o(Un,"isPrivateAddress");async function ft(t,e){if(t.protocol!=="https:"&&t.protocol!=="http:")throw new A(-32602,"A2A URL must use HTTP or HTTPS.");if(!e.allowedOrigins.includes(t.origin))throw new A(-32602,`A2A origin is not allowed: ${t.origin}`);if(t.username||t.password)throw new A(-32602,"A2A URL must not include credentials.");let n=t.hostname.startsWith("[")&&t.hostname.endsWith("]")?t.hostname.slice(1,-1):t.hostname,r=await bn(n,{all:!0,verbatim:!0});if(r.length===0)throw new A(-32602,"A2A hostname did not resolve.");if(n.toLowerCase()==="localhost"&&!r.every(a=>Pe(a.address)))throw new A(-32602,"A2A localhost target must resolve only to loopback addresses.");let i=Pn(n)&&r.every(a=>Pe(a.address));if(t.protocol==="http:"&&!i&&e.allowInsecureHttp!==!0)throw new A(-32602,"Non-loopback A2A targets must use HTTPS unless plaintext HTTP is explicitly allowed.");if(!e.allowPrivateAddresses&&r.some(a=>Un(a.address)))throw new A(-32602,"A2A private network targets are not allowed.");let s=r[0];if(s===void 0||s.family!==4&&s.family!==6)throw new A(-32602,"A2A hostname returned an unsupported address.");return{address:s.address,family:s.family}}o(ft,"validateA2AUrl");async function _n(t,e){await ft(t,e)}o(_n,"assertSafeA2AUrl");function Mn(t){if(t==null||typeof t=="string")return t??void 0;if(t instanceof URLSearchParams)return t.toString();if(t instanceof Uint8Array)return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new A(-32602,"A2A request body type is not supported by the safe transport.")}o(Mn,"encodeRequestBody");function Ln(t){return((e,n,r)=>{if(typeof n=="object"&&n.all){r(null,[t]);return}r(null,t.address,t.family)})}o(Ln,"pinnedLookup");function qn(t,e,n){return new Promise((r,i)=>{let s=new Headers(e.headers);s.set("accept-encoding","identity");let a=(t.protocol==="https:"?In:xn)(t,{method:e.method,headers:Object.fromEntries(s),lookup:Ln(n),signal:e.signal??void 0},c=>{let d=new Headers;for(let p=0;p<c.rawHeaders.length;p+=2){let h=c.rawHeaders[p],w=c.rawHeaders[p+1];h!==void 0&&w!==void 0&&d.append(h,w)}let u=c.statusCode??500,l=e.method!=="HEAD"&&u!==204&&u!==205&&u!==304?vn.toWeb(c):null;r(new Response(l,{status:u,statusText:c.statusMessage,headers:d}))});a.once("error",i),a.end(Mn(e.body))})}o(qn,"requestValidatedAddress");async function Ue(t,e,n,r){let i=await ft(t,n);return r!==void 0?r(t,e):qn(t,e,i)}o(Ue,"openSafeA2AResponse");async function Nn(t,e){let n=t.headers.get("content-length");if(n&&Number(n)>e)throw new A(-32603,"A2A response is too large.");if(!t.body)return new Uint8Array;let r=t.body.getReader(),i=[],s=0;for(;;){let d=await r.read();if(d.done)break;if(s+=d.value.byteLength,s>e)throw await r.cancel(),new A(-32603,"A2A response is too large.");i.push(d.value)}let a=new Uint8Array(s),c=0;for(let d of i)a.set(d,c),c+=d.byteLength;return a}o(Nn,"boundedBody");function $n(t,e){if(!t)return{signal:e,cleanup:o(()=>{},"cleanup")};let n=new AbortController,r=o(()=>n.abort(t.reason),"abortFromCaller"),i=o(()=>n.abort(e.reason),"abortFromDeadline");return t.aborted?r():t.addEventListener("abort",r,{once:!0}),e.aborted?i():e.addEventListener("abort",i,{once:!0}),{signal:n.signal,cleanup:o(()=>{t.removeEventListener("abort",r),e.removeEventListener("abort",i)},"cleanup")}}o($n,"combineAbortSignals");async function G(t,e,n,r){let i=t,s=new Headers(e.headers).get("authorization");for(let a=0;a<=n.maxRedirects;a+=1){let c=new AbortController,d=setTimeout(()=>c.abort(new Error("A2A request timed out.")),n.requestTimeoutMs),u=$n(e.signal,c.signal),f=new Headers(e.headers);s===null?f.delete("authorization"):f.set("authorization",s);try{let l=await Ue(i,{...e,headers:f,redirect:"manual",signal:u.signal},n,r);if(l.status<300||l.status>=400)return{response:l,body:await Nn(l,n.maxResponseBytes),url:i};let p=l.headers.get("location");if(!p||a===n.maxRedirects)throw new A(-32603,"A2A redirect limit exceeded.");let h=new URL(p,i);await l.body?.cancel(),h.origin!==i.origin&&(s=null),i=h}finally{clearTimeout(d),u.cleanup()}}throw new A(-32603,"A2A redirect limit exceeded.")}o(G,"safeA2AFetch");function X(t){return new TextDecoder("utf-8",{fatal:!0}).decode(t)}o(X,"decodeUtf8");import{createHash as zn,randomUUID as _e}from"node:crypto";import*as D from"oauth4webapi";var Dn=6e4,Kn=1e3,jn=.1;function Bn(t,e){return new Response(e.byteLength===0?null:X(e),{status:t.status,statusText:t.statusText,headers:t.headers})}o(Bn,"oauthResponse");function Hn(t,e){if(e===void 0||e<=0)return t;let n=e*1e3,r=Math.min(Dn,Math.max(Kn,n*jn));return t+Math.max(0,n-r)}o(Hn,"cacheExpiry");function ht(t){let e=P(t.clientId,"OAuth 2.0 clientId");if(t.clientAuthenticationMethod!=="basic"&&t.clientAuthenticationMethod!=="post")throw new Error("OAuth 2.0 clientAuthenticationMethod must be basic or post.");let n=t.clientAuthenticationMethod,r=t.scopes===void 0?void 0:ie(t.scopes,"OAuth 2.0 scopes"),i=J(t.issuer,"OAuth 2.0 issuer"),s=N(t.tokenUrl,"OAuth 2.0 token endpoint"),a=t.resource===void 0?void 0:ne(t.resource,"OAuth 2.0 resource"),c={issuer:i,token_endpoint:s.href},d={client_id:e},u={...t.networkPolicy,maxRedirects:0},f=t.now??Date.now,l,p,h=0;async function w(k){let y=n==="post"?D.ClientSecretPost(k):D.ClientSecretBasic(k),E=new URLSearchParams;r&&r.length>0&&E.set("scope",r.join(" ")),a!==void 0&&E.set("resource",a);let m={[D.customFetch]:async(R,O)=>{if(new URL(R).href!==s.href)throw new Error("OAuth 2.0 token request targeted an unexpected endpoint.");let j=await G(s,{method:O.method,headers:O.headers,body:O.body,redirect:"manual",...O.signal!==void 0?{signal:O.signal}:{}},u,t.fetch);return Bn(j.response,j.body)}};s.protocol==="http:"&&(m[D.allowInsecureRequests]=!0);let S;try{let R=await D.clientCredentialsGrantRequest(c,d,y,E,m);S=await D.processClientCredentialsResponse(c,d,R)}catch{throw new Error("OAuth 2.0 client credentials token request failed.")}if(S.token_type!=="bearer")throw new Error("OAuth 2.0 token endpoint did not return a Bearer access token.");let L=f();return{value:`Bearer ${S.access_token}`,expiresAt:Hn(L,S.expires_in)}}return o(w,"requestAuthorization"),{async getAuthorization(k){if(k.length===0)throw new Error("OAuth 2.0 client secret is required.");let y=f();if(l!==void 0&&l.expiresAt>y)return l.value;if(p!==void 0)return p;let E=h,m;return m=w(k).then(S=>(h===E&&S.expiresAt>f()&&(l=S),S.value)).finally(()=>{p===m&&(p=void 0)}),p=m,m},invalidate(k){if(k!==void 0){l?.value===k&&(l=void 0);return}h+=1,l=void 0,p=void 0}}}o(ht,"createOAuth2ClientCredentialsTokenManager");var gt=4,mt=/^[A-Za-z0-9\-._~+/=]$/u;function ke(t){return t!==void 0&&/^Bearer\s+\S+$/iu.test(t)}o(ke,"isBearerAuthorization");function Jn(t,e){let n="",r=0;for(;r<t.length;){let i=t.indexOf(e,r);if(i<0)return n+t.slice(r);let s=i===0?void 0:t[i-1],a=i+e.length,c=a===t.length?void 0:t[a],d=s===void 0||!mt.test(s),u=c===void 0||!mt.test(c);n+=t.slice(r,i),d&&u?(n+="[REDACTED]",r=a):(n+=e,r=a)}return n}o(Jn,"replaceBoundedToken");function Ae(t){return Array.isArray(t)?`[${t.map(Ae).join(",")}]`:g(t)?`{${Object.keys(t).sort().map(e=>`${JSON.stringify(e)}:${Ae(t[e])}`).join(",")}}`:JSON.stringify(t)??"null"}o(Ae,"stableJson");function yt(t){return`sha256:${zn("sha256").update(t).digest("hex")}`}o(yt,"sha256");var Le=class{static{o(this,"AuthorizationRedactor")}#e=[];#n=new Map;remember(e){if(!e)return;let n=this.#e.indexOf(e);n>=0&&this.#e.splice(n,1),this.#e.unshift(e),this.#e.length>gt&&(this.#e.length=gt)}retain(e){if(!e)return()=>{};this.remember(e),this.#n.set(e,(this.#n.get(e)??0)+1);let n=!1;return()=>{if(n)return;n=!0;let r=(this.#n.get(e)??1)-1;r===0?this.#n.delete(e):this.#n.set(e,r)}}redactText(e){let n=[...new Set([...this.#n.keys(),...this.#e])],r=n.sort((s,a)=>a.length-s.length).reduce((s,a)=>s.split(a).join("[REDACTED]"),e),i=n.flatMap(s=>{let a=/^Bearer\s+(\S+)$/iu.exec(s)?.[1];return a?[a]:[]}).sort((s,a)=>a.length-s.length);return[...new Set(i)].reduce((s,a)=>Jn(s,a),r)}redactContent(e){return typeof e=="string"?this.redactText(e):Array.isArray(e)?e.map(n=>this.redactContent(n)):g(e)?Object.fromEntries(Object.entries(e).map(([n,r])=>[n,this.redactContent(r)])):e}redactPart(e){return{...e,...e.text===void 0?{}:{text:this.redactText(e.text)},...e.raw===void 0?{}:{raw:this.redactText(e.raw)},...e.url===void 0?{}:{url:this.redactText(e.url)},...e.data===void 0?{}:{data:this.redactContent(e.data)},...e.metadata===void 0?{}:{metadata:this.redactContent(e.metadata)},...e.filename===void 0?{}:{filename:this.redactText(e.filename)}}}redactMessage(e){return{...e,parts:e.parts.map(n=>this.redactPart(n)),...e.metadata===void 0?{}:{metadata:this.redactContent(e.metadata)}}}redactArtifact(e){return{...e,...e.name===void 0?{}:{name:this.redactText(e.name)},...e.description===void 0?{}:{description:this.redactText(e.description)},parts:e.parts.map(n=>this.redactPart(n)),...e.metadata===void 0?{}:{metadata:this.redactContent(e.metadata)}}}redactTask(e){return{...e,status:{...e.status,...e.status.message===void 0?{}:{message:this.redactMessage(e.status.message)}},...e.artifacts===void 0?{}:{artifacts:e.artifacts.map(n=>this.redactArtifact(n))},...e.history===void 0?{}:{history:e.history.map(n=>this.redactMessage(n))},...e.metadata===void 0?{}:{metadata:this.redactContent(e.metadata)}}}redactError(e){let n=this.redactText(e instanceof Error?e.message:String(e));return e instanceof A?new A(e.code,n,e.httpStatus,this.redactContent(e.data),e.headers):new Error(n)}};function wt(t,e){let n=new URL(e).origin;if(!t.allowedOrigins.some(i=>new URL(i).origin===n))throw new Error(`A2A endpoint origin is not allowed by network policy: ${n}`);return{...t,allowedOrigins:[n]}}o(wt,"endpointNetworkPolicy");function Fn(t){if(t!==void 0){if(!g(t)||typeof t.scheme!="string")throw new Error("A2A registration authentication is invalid.");if(t.type==="http-bearer")return{type:"http-bearer",scheme:t.scheme};if(t.type!=="oauth2-client-credentials"||typeof t.issuer!="string"||typeof t.tokenUrl!="string"||typeof t.clientId!="string"||!Array.isArray(t.scopes)||!t.scopes.every(e=>typeof e=="string")||!["client-secret-basic","client-secret-post"].includes(String(t.clientAuthentication)))throw new Error("A2A registration OAuth2 authentication is invalid.");return{type:"oauth2-client-credentials",scheme:t.scheme,issuer:t.issuer,tokenUrl:t.tokenUrl,clientId:t.clientId,scopes:t.scopes,...typeof t.resource=="string"?{resource:t.resource}:{},clientAuthentication:t.clientAuthentication}}}o(Fn,"executorAuthentication");function Q(t){let e=t.executorConfig;if(!g(e))throw new Error("A2A registration executorConfig is missing.");if(typeof e.agentCardUrl!="string"||typeof e.interfaceUrl!="string")throw new Error("A2A registration endpoints are invalid.");let n=Fn(e.authentication);return{agentCardUrl:e.agentCardUrl,interfaceUrl:e.interfaceUrl,...typeof e.tenant=="string"?{tenant:e.tenant}:{},...n?{authentication:n}:{}}}o(Q,"executorConfig");function Wn(t,e){let n=t.supportedInterfaces.find(i=>i.protocolBinding.toUpperCase()==="JSONRPC"&&i.protocolVersion==="1.0");if(!n)throw new Error("Agent Card has no supported A2A 1.0 JSONRPC interface.");let r=new URL(n.url);if(r.username||r.password||r.hash)throw new Error("A2A interface URL must not contain credentials or a fragment.");if(r.origin!==e.origin)throw new Error("A2A interface must use the same origin as the trusted Agent Card.");return n}o(Wn,"chooseInterface");function Vn(t){if(t===void 0)return;if(!g(t))throw new Error("A2A authentication must be an object.");let e=P(t.scheme,"A2A authentication.scheme");if(t.type==="http-bearer")return{type:"http-bearer",scheme:e,credentialRef:P(t.credentialRef,"A2A authentication.credentialRef")};if(t.type!=="oauth2-client-credentials")throw new Error("A2A authentication.type must be http-bearer or oauth2-client-credentials.");if(t.clientAuthentication!=="client-secret-basic"&&t.clientAuthentication!=="client-secret-post")throw new Error("A2A authentication.clientAuthentication is invalid.");return{type:"oauth2-client-credentials",scheme:e,issuer:J(t.issuer,"Configured OAuth2 issuer"),tokenUrl:N(t.tokenUrl,"Configured OAuth2 token endpoint").href,clientId:P(t.clientId,"Configured OAuth2 clientId"),clientSecretRef:P(t.clientSecretRef,"Configured OAuth2 clientSecretRef"),scopes:ie(t.scopes,"Configured OAuth2 scopes"),...t.resource===void 0?{}:{resource:ne(t.resource,"Configured OAuth2 resource")},clientAuthentication:t.clientAuthentication}}o(Vn,"validatedClientAuthentication");function Gn(t){let e=t.credentialRef===void 0?void 0:P(t.credentialRef,"A2A credentialRef"),n=Vn(t.authentication);if(t.credentialRef!==void 0&&t.authentication!==void 0)throw new Error("A2A registration cannot combine credentialRef with structured authentication.");return{agentId:t.agentId,agentCardUrl:t.agentCardUrl,...e!==void 0?{credentialRef:e}:{},...n!==void 0?{authentication:n}:{},effects:t.effects}}o(Gn,"validatedRegistrationInput");function Xn(t,e,n){if(t.authentication)return[[{schemeName:t.authentication.scheme,kind:t.authentication.type,...t.authentication.type==="oauth2-client-credentials"?{scopes:t.authentication.scopes}:{}}]];let r=ke(n);if(!t.credentialRef&&!r)return[[]];let i=F(e.securitySchemes,e.securityRequirements);return Object.values(i.schemes).flatMap(s=>s.kind==="http-bearer"?[[{schemeName:s.name,kind:"http-bearer"}]]:[])}o(Xn,"configuredCapabilityCandidates");function kt(t,e){for(let n of t){if(n.schemes.length!==1)continue;let r=n.schemes[0].scheme;if(e.some(i=>i.schemeName===r.name&&i.kind===r.kind))return r}}o(kt,"matchingDeclaredScheme");function Qn(t,e){let n=F(t.securitySchemes,t.securityRequirements),r=ye(n,e).filter(a=>a.schemes.length<=1);if(r.length===0)return null;let i=kt(r,e),s=[];for(let a of t.skills){let c=F(t.securitySchemes,a.securityRequirements),d=ye(c,e).filter(u=>u.schemes.length<=1);d.length!==0&&(s.push(a.id),i??=kt(d,e))}return t.skills.length>0&&s.length===0?null:{skillIds:s,...i?{declaredScheme:i}:{}}}o(Qn,"evaluateSecurityCapabilities");function Zn(t,e,n){if(t.credentialRef!==void 0&&t.authentication!==void 0)throw new Error("A2A registration cannot combine credentialRef with structured authentication.");if(n!==void 0&&!ke(n))throw new Error("A2A options.authorization must be a valid Bearer authorization.");let r=ke(n),i=t.credentialRef!==void 0||t.authentication!==void 0||r,s;for(let h of Xn(t,e,n)){let w=Qn(e,h);if(w&&(!i||w.declaredScheme)){s=w;break}}if(!s)throw new Error(i?"Configured A2A authentication cannot fully satisfy the Agent Card and any advertised Skill security requirements.":"Agent Card or at least one advertised Skill requires authentication, but no compatible A2A authentication is configured.");if(!i)return{skillIds:s.skillIds};let a=s.declaredScheme,c=t.authentication;if(!c&&!t.credentialRef&&r)return{skillIds:s.skillIds};if(!c)return{credentialRef:t.credentialRef,authentication:{type:"http-bearer",scheme:a.name},skillIds:s.skillIds};if(c.type==="http-bearer")return{credentialRef:c.credentialRef,authentication:{type:"http-bearer",scheme:c.scheme},skillIds:s.skillIds};if(a.kind!=="oauth2-client-credentials")throw new Error("Configured OAuth2 authentication does not match the selected Agent Card scheme.");let d=a,u=J(c.issuer,"Configured OAuth2 issuer"),f=N(c.tokenUrl,"Configured OAuth2 token endpoint").href,l=c.resource===void 0?void 0:ne(c.resource,"Configured OAuth2 resource");if(new URL(d.tokenUrl).href!==f)throw new Error("Configured OAuth2 tokenUrl does not match the selected Agent Card security scheme.");let p=c.scopes.find(h=>!d.scopes.includes(h));if(p)throw new Error(`Configured OAuth2 scope is not declared by the Agent Card: ${p}`);return{credentialRef:c.clientSecretRef,authentication:{type:"oauth2-client-credentials",scheme:c.scheme,issuer:u,tokenUrl:f,clientId:c.clientId,scopes:c.scopes,...l?{resource:l}:{},clientAuthentication:c.clientAuthentication},skillIds:s.skillIds}}o(Zn,"planClientAuthentication");function qe(t,e){try{return JSON.parse(t)}catch{throw new Error(`${e} returned invalid JSON.`)}}o(qe,"parseJson");function Et(t){let e=t.maxTaskResponseBytes??t.networkPolicy.maxResponseBytes;if(!Number.isSafeInteger(e)||e<=0)throw new Error("A2A maxTaskResponseBytes must be a positive safe integer.");return e}o(Et,"taskResponseBytes");function Yn(t){return{...t.networkPolicy,maxResponseBytes:Et(t)}}o(Yn,"taskNetworkPolicy");async function Tt(t,e){let n=Gn(t),r=await G(new URL(n.agentCardUrl),{headers:{accept:"application/json"}},e.networkPolicy,e.fetch);if(!r.response.ok)throw new Error(`Agent Card request failed with HTTP ${r.response.status}.`);if(!de(r.response.headers.get("content-type")))throw new Error("Agent Card response is not JSON.");let i=ut(qe(X(r.body),"Agent Card")),s=i.capabilities.extensions?.filter(f=>f.required)??[];if(s.length>0)throw new Error(`Agent Card required A2A extension(s) are unsupported: ${s.map(f=>f.uri).join(", ")}`);let a=Wn(i,r.url),c=Zn(n,i,e.authorization),d=Ae({agentCardUrl:r.url.href,interfaceUrl:a.url,protocolBinding:a.protocolBinding,protocolVersion:a.protocolVersion,tenant:a.tenant??"",authentication:c.authentication??null}),u=yt(Ae({card:i,endpointIdentity:d,credentialRef:c.credentialRef??null,effects:n.effects}));return{agentCard:i,registration:{agentId:n.agentId,displayName:i.name,description:i.description,enabled:!0,executorId:ve,protocol:"a2a",configurationRevision:u,endpointIdentityHash:yt(d),...c.credentialRef?{credentialRef:c.credentialRef}:{},executorConfig:{agentCardUrl:r.url.href,interfaceUrl:a.url,...a.tenant?{tenant:a.tenant}:{},...c.authentication?{authentication:c.authentication}:{}},skills:c.skillIds,inputModalities:i.defaultInputModes,outputModalities:i.defaultOutputModes,capabilities:{streaming:i.capabilities.streaming?"supported":"unsupported",durableTasks:"supported",inputRequired:"supported",cancellation:"supported",artifacts:"supported"},effects:{remote:n.effects.remote,workspace:"proposal"},health:{status:"healthy",checkedAt:new Date().toISOString()}}}}o(Tt,"discoverA2ARegistration");function le(t){return t.metadata??{}}o(le,"metadata");function Ne(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"&&Number.isFinite(t))return t;if(Array.isArray(t))return t.map(Ne);if(g(t)){let e={};for(let[n,r]of Object.entries(t))e[n]=Ne(r);return e}throw new Error("A2A response metadata must be JSON-safe.")}o(Ne,"toAgentJsonValue");function St(t){let e=le(t).directMessage;return e===void 0?void 0:$(e)}o(St,"directMessage");function er(t){return{TASK_STATE_UNSPECIFIED:"unknown",TASK_STATE_SUBMITTED:"submitted",TASK_STATE_WORKING:"working",TASK_STATE_COMPLETED:"completed",TASK_STATE_FAILED:"failed",TASK_STATE_CANCELED:"canceled",TASK_STATE_INPUT_REQUIRED:"input-required",TASK_STATE_REJECTED:"rejected",TASK_STATE_AUTH_REQUIRED:"auth-required"}[t]??"unknown"}o(er,"taskState");function $e(t){return t.flatMap(e=>e.text===void 0?[]:[e.text]).join(`
2
+ import"./chunks/chunk-XTCDCU2Q.js";import"./chunks/chunk-JDZFNWMZ.js";import{j as tt,p as nt}from"./chunks/chunk-VQBJMNFD.js";import"./chunks/chunk-7ZN2MLVM.js";import"./chunks/chunk-ZOBNDWOA.js";import"./chunks/chunk-ZZUIO5KL.js";import"./chunks/chunk-NINELPXH.js";import"./chunks/chunk-HTVLCHWH.js";import"./chunks/chunk-KH2HED37.js";import"./chunks/chunk-GIVYTXQW.js";import"./chunks/chunk-KHEFUT6O.js";import"./chunks/chunk-TRNAWSXP.js";import"./chunks/chunk-WMYCNECP.js";import{d as V}from"./chunks/chunk-EVXIJPZ6.js";import"./chunks/chunk-E7C4DRD2.js";import"./chunks/chunk-6UENDY33.js";import{a as o}from"./chunks/chunk-ONUPGMER.js";var te="1.0",ve="kodax-a2a-v1-jsonrpc";var A=class extends Error{constructor(n,r,i=200,s,a){super(r);this.code=n;this.httpStatus=i;this.data=s;this.headers=a;this.name="A2AError"}code;httpStatus;data;headers;static{o(this,"A2AError")}};function ge(t){return t instanceof Error?t.message:String(t)}o(ge,"errorMessage");var sn=["apiKeySecurityScheme","httpAuthSecurityScheme","oauth2SecurityScheme","openIdConnectSecurityScheme","mtlsSecurityScheme"],on=["authorizationCode","clientCredentials","implicit","password","deviceCode"],an=/^[\x21\x23-\x5B\x5D-\x7E]+$/u;function re(t,e){if(!an.test(t))throw new Error(`${e} must be an RFC 6749 scope-token.`)}o(re,"assertOAuthScopeToken");function rt(t,e){let n=t.split(" ");for(let r of n)re(r,e);return[...new Set(n)]}o(rt,"parseOAuthScopeValue");function ie(t,e){if(!Array.isArray(t))throw new Error(`${e} must be an array of strings.`);let n=t.map((r,i)=>{if(typeof r!="string")throw new Error(`${e}[${i}] must be a string.`);return re(r,`${e}[${i}]`),r});if(new Set(n).size!==n.length)throw new Error(`${e} must not contain duplicates.`);return n}o(ie,"parseOAuthScopeList");function B(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}o(B,"isRecord");function P(t,e){if(typeof t!="string"||t.trim().length===0)throw new Error(`${e} must be a non-empty string.`);return t}o(P,"requireNonEmptyString");function cn(t,e){if(t!==void 0)return P(t,e)}o(cn,"optionalString");function it(t,e){return P(t,e).trim()}o(it,"trimmedUri");function dn(t){return/^[A-Za-z][A-Za-z0-9+.-]*:\/\/([^/?#]*)/u.exec(t)?.[1]?.includes("@")===!0}o(dn,"hasAuthorityUserinfo");function me(t){let e=t.toLowerCase().replace(/^\[|\]$/gu,"");return e==="localhost"||e==="127.0.0.1"||e==="::1"}o(me,"isExactOAuthLoopbackHostname");function st(t,e){let n=it(t,e);if(!/^https?:\/\/([^/?#]*)/iu.exec(n)?.[1])throw new Error(`${e} must be an absolute HTTP(S) URL.`);let i;try{i=new URL(n)}catch{throw new Error(`${e} must be an absolute HTTP(S) URL.`)}if(dn(n)||i.username||i.password||n.includes("#"))throw new Error(`${e} must not contain userinfo or a fragment.`);if(i.protocol==="http:"&&!me(i.hostname))throw new Error(`${e} must use HTTPS or exact loopback HTTP.`);return{raw:n,url:i}}o(st,"secureOAuthHttpUrl");function J(t,e){let n=st(t,e);if(n.raw.includes("?"))throw new Error(`${e} must not contain a query or fragment.`);return n.raw}o(J,"parseOAuthIssuerIdentifier");function N(t,e){return st(t,e).url}o(N,"parseOAuthEndpointUrl");function ne(t,e){let n=it(t,e);if(!/^[A-Za-z][A-Za-z0-9+.-]*:/u.test(n))throw new Error(`${e} must be an absolute URI.`);try{new URL(n)}catch{throw new Error(`${e} must be an absolute URI.`)}if(n.includes("#"))throw new Error(`${e} must not contain a fragment.`);return n}o(ne,"parseOAuthResourceIdentifier");function ot(t,e){return N(t,e).href}o(ot,"absoluteHttpUrl");function un(t,e){if(!B(t))throw new Error(`${e} must be a scope-description object.`);return Object.entries(t).map(([n,r])=>{if(n.trim().length===0||typeof r!="string")throw new Error(`${e} must map non-empty scope names to descriptions.`);return re(n,`${e}.${n}`),n})}o(un,"parseScopes");function ln(t,e){if(!B(e))throw new Error(`securitySchemes.${t}.httpAuthSecurityScheme must be an object.`);let n=P(e.scheme,`securitySchemes.${t}.httpAuthSecurityScheme.scheme`),r=cn(e.bearerFormat,`securitySchemes.${t}.httpAuthSecurityScheme.bearerFormat`);return n.toLowerCase()!=="bearer"?{name:t,kind:"unsupported",protocol:`http:${n.toLowerCase()}`}:{name:t,kind:"http-bearer",...r?{bearerFormat:r}:{}}}o(ln,"parseHttpScheme");function An(t,e){let n=e.flows;if(!B(n))throw new Error(`securitySchemes.${t}.oauth2SecurityScheme.flows must be an object.`);let r=on.filter(c=>n[c]!==void 0);if(r.length!==1)throw new Error(`securitySchemes.${t}.oauth2SecurityScheme.flows must contain exactly one OAuth flow.`);let i=r[0],s=n[i];if(!B(s))throw new Error(`securitySchemes.${t}.oauth2SecurityScheme.flows.${i} must be an object.`);let a=un(s.scopes,`securitySchemes.${t}.oauth2SecurityScheme.flows.${i}.scopes`);if(i==="clientCredentials"){let c=ot(s.tokenUrl,`securitySchemes.${t}.oauth2SecurityScheme.flows.clientCredentials.tokenUrl`);return{name:t,kind:"oauth2-client-credentials",tokenUrl:c,scopes:a}}return{name:t,kind:"unsupported",protocol:`oauth2:${i}`,oauthScopes:a}}o(An,"parseOAuthFlow");function pn(t,e,n){if(!B(n))throw new Error(`securitySchemes.${t}.${e} must be an object.`);if(e==="apiKeySecurityScheme"){let r=P(n.location,`securitySchemes.${t}.${e}.location`);if(!["query","header","cookie"].includes(r))throw new Error(`securitySchemes.${t}.${e}.location must be query, header, or cookie.`);return P(n.name,`securitySchemes.${t}.${e}.name`),{name:t,kind:"unsupported",protocol:"api-key"}}return e==="openIdConnectSecurityScheme"?(ot(n.openIdConnectUrl,`securitySchemes.${t}.${e}.openIdConnectUrl`),{name:t,kind:"unsupported",protocol:"openid-connect",acceptsOAuthScopes:!0}):{name:t,kind:"unsupported",protocol:"mutual-tls"}}o(pn,"parseUnsupportedScheme");function fn(t,e){if(!B(e))throw new Error(`securitySchemes.${t} must be an object.`);let n=sn.filter(i=>e[i]!==void 0);if(n.length!==1)throw new Error(`securitySchemes.${t} must contain exactly one security scheme.`);let r=n[0];if(r==="httpAuthSecurityScheme")return ln(t,e[r]);if(r==="oauth2SecurityScheme"){let i=e[r];if(!B(i))throw new Error(`securitySchemes.${t}.${r} must be an object.`);return An(t,i)}return pn(t,r,e[r])}o(fn,"parseScheme");function hn(t){if(t===void 0)return{};if(!B(t))throw new Error("securitySchemes must be an object.");return Object.fromEntries(Object.entries(t).map(([e,n])=>{if(e.trim().length===0)throw new Error("securitySchemes names must not be empty.");return[e,fn(e,n)]}))}o(hn,"parseSchemes");function gn(t,e){if(!B(t))throw new Error(`${e} must be a StringList object.`);if(t.list===void 0)return[];if(!Array.isArray(t.list)||!t.list.every(n=>typeof n=="string"&&n.trim().length>0))throw new Error(`${e}.list must be an array of non-empty strings.`);if(new Set(t.list).size!==t.list.length)throw new Error(`${e}.list must not contain duplicate scopes.`);for(let n of t.list)re(n,`${e}.list`);return t.list}o(gn,"parseScopeList");function mn(t,e){if(t.kind==="oauth2-client-credentials"||t.kind==="unsupported"&&t.oauthScopes!==void 0){let n=t.kind==="oauth2-client-credentials"?t.scopes:t.oauthScopes??[];for(let r of e)if(!n.includes(r))throw new Error(`scope "${r}" is not declared by security scheme "${t.name}".`);return}if(e.length>0&&!(t.kind==="unsupported"&&t.acceptsOAuthScopes))throw new Error(`security scheme "${t.name}" does not accept OAuth scopes.`)}o(mn,"validateRequiredScopes");function yn(t,e,n){if(!B(t))throw new Error(`securityRequirements[${e}] must be an object.`);let r=t.schemes;if(r!==void 0&&!B(r))throw new Error(`securityRequirements[${e}].schemes must be an object.`);return{schemes:Object.entries(r??{}).map(([a,c])=>{if(!Object.hasOwn(n,a))throw new Error(`securityRequirements[${e}] references unknown security scheme "${a}".`);let d=n[a],u=gn(c,`securityRequirements[${e}].schemes.${a}`);return mn(d,u),{scheme:d,scopes:u}})}}o(yn,"parseRequirement");function F(t,e){let n=hn(t);if(e===void 0)return{schemes:n,requirements:[]};if(!Array.isArray(e))throw new Error("securityRequirements must be an array.");return{schemes:n,requirements:e.map((r,i)=>yn(r,i,n))}}o(F,"parseA2ASecurity");function wn(t,e){let{scheme:n,scopes:r}=e;return n.kind!=="unsupported"&&t.schemeName===n.name&&t.kind===n.kind&&r.every(i=>t.scopes?.includes(i)===!0)}o(wn,"capabilityMatches");function Li(t,e){return ye(t,e)[0]??null}o(Li,"selectA2ASecurityRequirement");function ye(t,e){return(t.requirements.length===0?[{schemes:[]}]:t.requirements).filter(r=>r.schemes.every(i=>e.some(s=>wn(s,i))))}o(ye,"satisfiableA2ASecurityRequirements");var kn=new Set(["TASK_STATE_UNSPECIFIED","TASK_STATE_SUBMITTED","TASK_STATE_WORKING","TASK_STATE_COMPLETED","TASK_STATE_FAILED","TASK_STATE_CANCELED","TASK_STATE_INPUT_REQUIRED","TASK_STATE_REJECTED","TASK_STATE_AUTH_REQUIRED"]);function g(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}o(g,"isRecord");function at(t){if(t===null)return;let e=t.split(";",1)[0]?.trim().toLowerCase();return e&&!/\s/u.test(e)?e:void 0}o(at,"mediaTypeEssence");function de(t){let e=at(t);return e==="application/json"||/^application\/[!#$%&'*+\-.^_`|~0-9a-z]+\+json$/u.test(e??"")}o(de,"isJsonMediaType");function ct(t){return at(t)==="text/event-stream"}o(ct,"isEventStreamMediaType");function U(t,e,n){let r=t[e];if(typeof r!="string"||r.trim().length===0)throw new A(-32602,`${n}.${e} must be a non-empty string.`);return r}o(U,"requiredString");function x(t,e){let n=t[e];return typeof n=="string"&&n.length>0?n:void 0}o(x,"optionalString");function se(t,e){if(!Array.isArray(t)||!t.every(n=>typeof n=="string"))throw new A(-32602,`${e} must be a string array.`);return t}o(se,"stringArray");function Sn(t){if(!g(t))throw new A(-32602,"Agent Card interface is invalid.");return{url:U(t,"url","interface"),protocolBinding:U(t,"protocolBinding","interface"),protocolVersion:U(t,"protocolVersion","interface"),...x(t,"tenant")?{tenant:x(t,"tenant")}:{}}}o(Sn,"parseInterface");function dt(t,e,n){try{F(t,e)}catch(r){let i=r instanceof Error?r.message:String(r);throw new A(-32602,`${n} is invalid: ${i}`)}}o(dt,"validateSecurity");function Rn(t,e){if(!g(t))throw new A(-32602,"Agent Card skill is invalid.");return t.securityRequirements!==void 0&&dt(e,t.securityRequirements,"skill.securityRequirements"),{id:U(t,"id","skill"),name:U(t,"name","skill"),description:U(t,"description","skill"),tags:se(t.tags,"skill.tags"),...Array.isArray(t.examples)?{examples:se(t.examples,"skill.examples")}:{},...Array.isArray(t.inputModes)?{inputModes:se(t.inputModes,"skill.inputModes")}:{},...Array.isArray(t.outputModes)?{outputModes:se(t.outputModes,"skill.outputModes")}:{},...Array.isArray(t.securityRequirements)?{securityRequirements:t.securityRequirements.filter(g)}:{}}}o(Rn,"parseSkill");function En(t){if(!g(t))throw new A(-32602,"Agent Card extension is invalid.");let e=U(t,"uri","extension");try{new URL(e)}catch{throw new A(-32602,"Agent Card extension.uri must be an absolute URI.")}if(t.description!==void 0&&typeof t.description!="string")throw new A(-32602,"Agent Card extension.description must be a string.");if(t.required!==void 0&&typeof t.required!="boolean")throw new A(-32602,"Agent Card extension.required must be a boolean.");if(t.params!==void 0&&!g(t.params))throw new A(-32602,"Agent Card extension.params must be an object.");return{uri:e,...typeof t.description=="string"?{description:t.description}:{},...typeof t.required=="boolean"?{required:t.required}:{},...g(t.params)?{params:t.params}:{}}}o(En,"parseExtension");function ut(t){if(!g(t))throw new A(-32602,"Agent Card must be an object.");let e=t.supportedInterfaces,n=t.skills;if(!Array.isArray(e)||e.length===0)throw new A(-32602,"Agent Card must declare supportedInterfaces.");if(!Array.isArray(n))throw new A(-32602,"Agent Card must declare skills.");if(!g(t.capabilities))throw new A(-32602,"Agent Card capabilities are invalid.");if(t.capabilities.extensions!==void 0&&!Array.isArray(t.capabilities.extensions))throw new A(-32602,"Agent Card capabilities.extensions must be an array.");return dt(t.securitySchemes,t.securityRequirements,"Agent Card security declaration"),{name:U(t,"name","Agent Card"),description:U(t,"description","Agent Card"),supportedInterfaces:e.map(Sn),version:U(t,"version","Agent Card"),capabilities:{...typeof t.capabilities.streaming=="boolean"?{streaming:t.capabilities.streaming}:{},...typeof t.capabilities.pushNotifications=="boolean"?{pushNotifications:t.capabilities.pushNotifications}:{},...typeof t.capabilities.extendedAgentCard=="boolean"?{extendedAgentCard:t.capabilities.extendedAgentCard}:{},...Array.isArray(t.capabilities.extensions)?{extensions:t.capabilities.extensions.map(En)}:{}},...g(t.securitySchemes)?{securitySchemes:t.securitySchemes}:{},...Array.isArray(t.securityRequirements)?{securityRequirements:t.securityRequirements.filter(g)}:{},defaultInputModes:se(t.defaultInputModes,"Agent Card defaultInputModes"),defaultOutputModes:se(t.defaultOutputModes,"Agent Card defaultOutputModes"),skills:n.map(r=>Rn(r,t.securitySchemes))}}o(ut,"parseA2AAgentCard");function lt(t){if(!g(t))throw new A(-32602,"Message Part must be an object.");let e=["text","raw","url","data"].filter(r=>t[r]!==void 0);if(e.length!==1)throw new A(-32602,"Message Part must contain exactly one content field.");let n=e[0];if(n!=="data"&&typeof t[n]!="string")throw new A(-32602,`Message Part ${n} content must be a string.`);return{...typeof t.text=="string"?{text:t.text}:{},...typeof t.raw=="string"?{raw:t.raw}:{},...typeof t.url=="string"?{url:t.url}:{},...t.data!==void 0?{data:t.data}:{},...g(t.metadata)?{metadata:t.metadata}:{},...x(t,"filename")?{filename:x(t,"filename")}:{},...x(t,"mediaType")?{mediaType:x(t,"mediaType")}:{}}}o(lt,"parseA2APart");function $(t){if(!g(t))throw new A(-32602,"Message must be an object.");if(t.role!=="ROLE_USER"&&t.role!=="ROLE_AGENT")throw new A(-32602,"Message role is invalid.");if(!Array.isArray(t.parts)||t.parts.length===0)throw new A(-32602,"Message parts must not be empty.");return{messageId:U(t,"messageId","Message"),role:t.role,parts:t.parts.map(lt),...x(t,"contextId")?{contextId:x(t,"contextId")}:{},...x(t,"taskId")?{taskId:x(t,"taskId")}:{},...g(t.metadata)?{metadata:t.metadata}:{}}}o($,"parseA2AMessage");function Tn(t){if(!g(t)||!Array.isArray(t.parts)||t.parts.length===0)throw new A(-32603,"A2A artifact is invalid.");return{artifactId:U(t,"artifactId","Artifact"),parts:t.parts.map(lt),...x(t,"name")?{name:x(t,"name")}:{},...x(t,"description")?{description:x(t,"description")}:{},...g(t.metadata)?{metadata:t.metadata}:{}}}o(Tn,"parseArtifact");function H(t){if(!g(t)||!g(t.status))throw new A(-32603,"A2A task is invalid.");let e=t.status.state;if(typeof e!="string")throw new A(-32603,"A2A task state is invalid.");let n=kn.has(e)?e:"TASK_STATE_UNSPECIFIED";return{id:U(t,"id","Task"),contextId:x(t,"contextId")??"",status:{state:n,...t.status.message!==void 0?{message:$(t.status.message)}:{},...x(t.status,"timestamp")?{timestamp:x(t.status,"timestamp")}:{}},...Array.isArray(t.artifacts)?{artifacts:t.artifacts.map(Tn)}:{},...Array.isArray(t.history)?{history:t.history.map($)}:{},...g(t.metadata)?{metadata:t.metadata}:{}}}o(H,"parseA2ATask");function At(t){if(!g(t)||t.jsonrpc!=="2.0")throw new A(-32600,"Invalid JSON-RPC request.");if(typeof t.id!="string"&&typeof t.id!="number")throw new A(-32600,"JSON-RPC request id is required.");return{jsonrpc:"2.0",id:t.id,method:U(t,"method","JSON-RPC request"),...g(t.params)?{params:t.params}:{}}}o(At,"parseJsonRpcRequest");import{lookup as bn}from"node:dns/promises";import{request as xn}from"node:http";import{request as In}from"node:https";import{BlockList as Cn,isIP as pt}from"node:net";import{Readable as vn}from"node:stream";var we=new Cn;we.addSubnet("127.0.0.0",8,"ipv4");we.addAddress("::1","ipv6");function Pe(t){let e=pt(t);return e===4?we.check(t,"ipv4"):e===6&&we.check(t,"ipv6")}o(Pe,"isLoopbackAddress");function Pn(t){let e=t.toLowerCase();return e==="localhost"||e==="127.0.0.1"||e==="::1"}o(Pn,"isExactLoopbackHostname");function Oe(t){let e=t.split(".").map(Number),[n,r,i,s]=e;return e.length!==4||n===void 0||r===void 0||i===void 0||s===void 0?!0:n===0||n===10||n===127||n===100&&r>=64&&r<=127||n===169&&r===254||n===172&&r>=16&&r<=31||n===192&&r===168||n===192&&r===0&&i===0&&s!==9&&s!==10||n===192&&r===0&&i===2||n===198&&(r===18||r===19)||n===198&&r===51&&i===100||n===203&&r===0&&i===113||n>=224}o(Oe,"isPrivateIpv4");function On(t){if(Pe(t))return!0;let e=t.toLowerCase(),n=/^::ffff:(\d+\.\d+\.\d+\.\d+)$/.exec(e)?.[1];if(n)return Oe(n);let r=/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/.exec(e);if(r?.[1]&&r[2]){let i=Number.parseInt(r[1],16),s=Number.parseInt(r[2],16);return Oe(`${i>>8}.${i&255}.${s>>8}.${s&255}`)}return e==="::"||e==="::1"||e.startsWith("fc")||e.startsWith("fd")||e.startsWith("fe8")||e.startsWith("fe9")||e.startsWith("fea")||e.startsWith("feb")||e.startsWith("ff")}o(On,"isPrivateIpv6");function Un(t){let e=pt(t);return e===4?Oe(t):e===6?On(t):!0}o(Un,"isPrivateAddress");async function ft(t,e){if(t.protocol!=="https:"&&t.protocol!=="http:")throw new A(-32602,"A2A URL must use HTTP or HTTPS.");if(!e.allowedOrigins.includes(t.origin))throw new A(-32602,`A2A origin is not allowed: ${t.origin}`);if(t.username||t.password)throw new A(-32602,"A2A URL must not include credentials.");let n=t.hostname.startsWith("[")&&t.hostname.endsWith("]")?t.hostname.slice(1,-1):t.hostname,r=await bn(n,{all:!0,verbatim:!0});if(r.length===0)throw new A(-32602,"A2A hostname did not resolve.");if(n.toLowerCase()==="localhost"&&!r.every(a=>Pe(a.address)))throw new A(-32602,"A2A localhost target must resolve only to loopback addresses.");let i=Pn(n)&&r.every(a=>Pe(a.address));if(t.protocol==="http:"&&!i&&e.allowInsecureHttp!==!0)throw new A(-32602,"Non-loopback A2A targets must use HTTPS unless plaintext HTTP is explicitly allowed.");if(!e.allowPrivateAddresses&&r.some(a=>Un(a.address)))throw new A(-32602,"A2A private network targets are not allowed.");let s=r[0];if(s===void 0||s.family!==4&&s.family!==6)throw new A(-32602,"A2A hostname returned an unsupported address.");return{address:s.address,family:s.family}}o(ft,"validateA2AUrl");async function _n(t,e){await ft(t,e)}o(_n,"assertSafeA2AUrl");function Mn(t){if(t==null||typeof t=="string")return t??void 0;if(t instanceof URLSearchParams)return t.toString();if(t instanceof Uint8Array)return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new A(-32602,"A2A request body type is not supported by the safe transport.")}o(Mn,"encodeRequestBody");function Ln(t){return((e,n,r)=>{if(typeof n=="object"&&n.all){r(null,[t]);return}r(null,t.address,t.family)})}o(Ln,"pinnedLookup");function qn(t,e,n){return new Promise((r,i)=>{let s=new Headers(e.headers);s.set("accept-encoding","identity");let a=(t.protocol==="https:"?In:xn)(t,{method:e.method,headers:Object.fromEntries(s),lookup:Ln(n),signal:e.signal??void 0},c=>{let d=new Headers;for(let p=0;p<c.rawHeaders.length;p+=2){let h=c.rawHeaders[p],w=c.rawHeaders[p+1];h!==void 0&&w!==void 0&&d.append(h,w)}let u=c.statusCode??500,l=e.method!=="HEAD"&&u!==204&&u!==205&&u!==304?vn.toWeb(c):null;r(new Response(l,{status:u,statusText:c.statusMessage,headers:d}))});a.once("error",i),a.end(Mn(e.body))})}o(qn,"requestValidatedAddress");async function Ue(t,e,n,r){let i=await ft(t,n);return r!==void 0?r(t,e):qn(t,e,i)}o(Ue,"openSafeA2AResponse");async function Nn(t,e){let n=t.headers.get("content-length");if(n&&Number(n)>e)throw new A(-32603,"A2A response is too large.");if(!t.body)return new Uint8Array;let r=t.body.getReader(),i=[],s=0;for(;;){let d=await r.read();if(d.done)break;if(s+=d.value.byteLength,s>e)throw await r.cancel(),new A(-32603,"A2A response is too large.");i.push(d.value)}let a=new Uint8Array(s),c=0;for(let d of i)a.set(d,c),c+=d.byteLength;return a}o(Nn,"boundedBody");function $n(t,e){if(!t)return{signal:e,cleanup:o(()=>{},"cleanup")};let n=new AbortController,r=o(()=>n.abort(t.reason),"abortFromCaller"),i=o(()=>n.abort(e.reason),"abortFromDeadline");return t.aborted?r():t.addEventListener("abort",r,{once:!0}),e.aborted?i():e.addEventListener("abort",i,{once:!0}),{signal:n.signal,cleanup:o(()=>{t.removeEventListener("abort",r),e.removeEventListener("abort",i)},"cleanup")}}o($n,"combineAbortSignals");async function G(t,e,n,r){let i=t,s=new Headers(e.headers).get("authorization");for(let a=0;a<=n.maxRedirects;a+=1){let c=new AbortController,d=setTimeout(()=>c.abort(new Error("A2A request timed out.")),n.requestTimeoutMs),u=$n(e.signal,c.signal),f=new Headers(e.headers);s===null?f.delete("authorization"):f.set("authorization",s);try{let l=await Ue(i,{...e,headers:f,redirect:"manual",signal:u.signal},n,r);if(l.status<300||l.status>=400)return{response:l,body:await Nn(l,n.maxResponseBytes),url:i};let p=l.headers.get("location");if(!p||a===n.maxRedirects)throw new A(-32603,"A2A redirect limit exceeded.");let h=new URL(p,i);await l.body?.cancel(),h.origin!==i.origin&&(s=null),i=h}finally{clearTimeout(d),u.cleanup()}}throw new A(-32603,"A2A redirect limit exceeded.")}o(G,"safeA2AFetch");function X(t){return new TextDecoder("utf-8",{fatal:!0}).decode(t)}o(X,"decodeUtf8");import{createHash as zn,randomUUID as _e}from"node:crypto";import*as D from"oauth4webapi";var Dn=6e4,Kn=1e3,jn=.1;function Bn(t,e){return new Response(e.byteLength===0?null:X(e),{status:t.status,statusText:t.statusText,headers:t.headers})}o(Bn,"oauthResponse");function Hn(t,e){if(e===void 0||e<=0)return t;let n=e*1e3,r=Math.min(Dn,Math.max(Kn,n*jn));return t+Math.max(0,n-r)}o(Hn,"cacheExpiry");function ht(t){let e=P(t.clientId,"OAuth 2.0 clientId");if(t.clientAuthenticationMethod!=="basic"&&t.clientAuthenticationMethod!=="post")throw new Error("OAuth 2.0 clientAuthenticationMethod must be basic or post.");let n=t.clientAuthenticationMethod,r=t.scopes===void 0?void 0:ie(t.scopes,"OAuth 2.0 scopes"),i=J(t.issuer,"OAuth 2.0 issuer"),s=N(t.tokenUrl,"OAuth 2.0 token endpoint"),a=t.resource===void 0?void 0:ne(t.resource,"OAuth 2.0 resource"),c={issuer:i,token_endpoint:s.href},d={client_id:e},u={...t.networkPolicy,maxRedirects:0},f=t.now??Date.now,l,p,h=0;async function w(k){let y=n==="post"?D.ClientSecretPost(k):D.ClientSecretBasic(k),E=new URLSearchParams;r&&r.length>0&&E.set("scope",r.join(" ")),a!==void 0&&E.set("resource",a);let m={[D.customFetch]:async(R,O)=>{if(new URL(R).href!==s.href)throw new Error("OAuth 2.0 token request targeted an unexpected endpoint.");let j=await G(s,{method:O.method,headers:O.headers,body:O.body,redirect:"manual",...O.signal!==void 0?{signal:O.signal}:{}},u,t.fetch);return Bn(j.response,j.body)}};s.protocol==="http:"&&(m[D.allowInsecureRequests]=!0);let S;try{let R=await D.clientCredentialsGrantRequest(c,d,y,E,m);S=await D.processClientCredentialsResponse(c,d,R)}catch{throw new Error("OAuth 2.0 client credentials token request failed.")}if(S.token_type!=="bearer")throw new Error("OAuth 2.0 token endpoint did not return a Bearer access token.");let L=f();return{value:`Bearer ${S.access_token}`,expiresAt:Hn(L,S.expires_in)}}return o(w,"requestAuthorization"),{async getAuthorization(k){if(k.length===0)throw new Error("OAuth 2.0 client secret is required.");let y=f();if(l!==void 0&&l.expiresAt>y)return l.value;if(p!==void 0)return p;let E=h,m;return m=w(k).then(S=>(h===E&&S.expiresAt>f()&&(l=S),S.value)).finally(()=>{p===m&&(p=void 0)}),p=m,m},invalidate(k){if(k!==void 0){l?.value===k&&(l=void 0);return}h+=1,l=void 0,p=void 0}}}o(ht,"createOAuth2ClientCredentialsTokenManager");var gt=4,mt=/^[A-Za-z0-9\-._~+/=]$/u;function ke(t){return t!==void 0&&/^Bearer\s+\S+$/iu.test(t)}o(ke,"isBearerAuthorization");function Jn(t,e){let n="",r=0;for(;r<t.length;){let i=t.indexOf(e,r);if(i<0)return n+t.slice(r);let s=i===0?void 0:t[i-1],a=i+e.length,c=a===t.length?void 0:t[a],d=s===void 0||!mt.test(s),u=c===void 0||!mt.test(c);n+=t.slice(r,i),d&&u?(n+="[REDACTED]",r=a):(n+=e,r=a)}return n}o(Jn,"replaceBoundedToken");function Ae(t){return Array.isArray(t)?`[${t.map(Ae).join(",")}]`:g(t)?`{${Object.keys(t).sort().map(e=>`${JSON.stringify(e)}:${Ae(t[e])}`).join(",")}}`:JSON.stringify(t)??"null"}o(Ae,"stableJson");function yt(t){return`sha256:${zn("sha256").update(t).digest("hex")}`}o(yt,"sha256");var Le=class{static{o(this,"AuthorizationRedactor")}#e=[];#n=new Map;remember(e){if(!e)return;let n=this.#e.indexOf(e);n>=0&&this.#e.splice(n,1),this.#e.unshift(e),this.#e.length>gt&&(this.#e.length=gt)}retain(e){if(!e)return()=>{};this.remember(e),this.#n.set(e,(this.#n.get(e)??0)+1);let n=!1;return()=>{if(n)return;n=!0;let r=(this.#n.get(e)??1)-1;r===0?this.#n.delete(e):this.#n.set(e,r)}}redactText(e){let n=[...new Set([...this.#n.keys(),...this.#e])],r=n.sort((s,a)=>a.length-s.length).reduce((s,a)=>s.split(a).join("[REDACTED]"),e),i=n.flatMap(s=>{let a=/^Bearer\s+(\S+)$/iu.exec(s)?.[1];return a?[a]:[]}).sort((s,a)=>a.length-s.length);return[...new Set(i)].reduce((s,a)=>Jn(s,a),r)}redactContent(e){return typeof e=="string"?this.redactText(e):Array.isArray(e)?e.map(n=>this.redactContent(n)):g(e)?Object.fromEntries(Object.entries(e).map(([n,r])=>[n,this.redactContent(r)])):e}redactPart(e){return{...e,...e.text===void 0?{}:{text:this.redactText(e.text)},...e.raw===void 0?{}:{raw:this.redactText(e.raw)},...e.url===void 0?{}:{url:this.redactText(e.url)},...e.data===void 0?{}:{data:this.redactContent(e.data)},...e.metadata===void 0?{}:{metadata:this.redactContent(e.metadata)},...e.filename===void 0?{}:{filename:this.redactText(e.filename)}}}redactMessage(e){return{...e,parts:e.parts.map(n=>this.redactPart(n)),...e.metadata===void 0?{}:{metadata:this.redactContent(e.metadata)}}}redactArtifact(e){return{...e,...e.name===void 0?{}:{name:this.redactText(e.name)},...e.description===void 0?{}:{description:this.redactText(e.description)},parts:e.parts.map(n=>this.redactPart(n)),...e.metadata===void 0?{}:{metadata:this.redactContent(e.metadata)}}}redactTask(e){return{...e,status:{...e.status,...e.status.message===void 0?{}:{message:this.redactMessage(e.status.message)}},...e.artifacts===void 0?{}:{artifacts:e.artifacts.map(n=>this.redactArtifact(n))},...e.history===void 0?{}:{history:e.history.map(n=>this.redactMessage(n))},...e.metadata===void 0?{}:{metadata:this.redactContent(e.metadata)}}}redactError(e){let n=this.redactText(e instanceof Error?e.message:String(e));return e instanceof A?new A(e.code,n,e.httpStatus,this.redactContent(e.data),e.headers):new Error(n)}};function wt(t,e){let n=new URL(e).origin;if(!t.allowedOrigins.some(i=>new URL(i).origin===n))throw new Error(`A2A endpoint origin is not allowed by network policy: ${n}`);return{...t,allowedOrigins:[n]}}o(wt,"endpointNetworkPolicy");function Fn(t){if(t!==void 0){if(!g(t)||typeof t.scheme!="string")throw new Error("A2A registration authentication is invalid.");if(t.type==="http-bearer")return{type:"http-bearer",scheme:t.scheme};if(t.type!=="oauth2-client-credentials"||typeof t.issuer!="string"||typeof t.tokenUrl!="string"||typeof t.clientId!="string"||!Array.isArray(t.scopes)||!t.scopes.every(e=>typeof e=="string")||!["client-secret-basic","client-secret-post"].includes(String(t.clientAuthentication)))throw new Error("A2A registration OAuth2 authentication is invalid.");return{type:"oauth2-client-credentials",scheme:t.scheme,issuer:t.issuer,tokenUrl:t.tokenUrl,clientId:t.clientId,scopes:t.scopes,...typeof t.resource=="string"?{resource:t.resource}:{},clientAuthentication:t.clientAuthentication}}}o(Fn,"executorAuthentication");function Q(t){let e=t.executorConfig;if(!g(e))throw new Error("A2A registration executorConfig is missing.");if(typeof e.agentCardUrl!="string"||typeof e.interfaceUrl!="string")throw new Error("A2A registration endpoints are invalid.");let n=Fn(e.authentication);return{agentCardUrl:e.agentCardUrl,interfaceUrl:e.interfaceUrl,...typeof e.tenant=="string"?{tenant:e.tenant}:{},...n?{authentication:n}:{}}}o(Q,"executorConfig");function Wn(t,e){let n=t.supportedInterfaces.find(i=>i.protocolBinding.toUpperCase()==="JSONRPC"&&i.protocolVersion==="1.0");if(!n)throw new Error("Agent Card has no supported A2A 1.0 JSONRPC interface.");let r=new URL(n.url);if(r.username||r.password||r.hash)throw new Error("A2A interface URL must not contain credentials or a fragment.");if(r.origin!==e.origin)throw new Error("A2A interface must use the same origin as the trusted Agent Card.");return n}o(Wn,"chooseInterface");function Vn(t){if(t===void 0)return;if(!g(t))throw new Error("A2A authentication must be an object.");let e=P(t.scheme,"A2A authentication.scheme");if(t.type==="http-bearer")return{type:"http-bearer",scheme:e,credentialRef:P(t.credentialRef,"A2A authentication.credentialRef")};if(t.type!=="oauth2-client-credentials")throw new Error("A2A authentication.type must be http-bearer or oauth2-client-credentials.");if(t.clientAuthentication!=="client-secret-basic"&&t.clientAuthentication!=="client-secret-post")throw new Error("A2A authentication.clientAuthentication is invalid.");return{type:"oauth2-client-credentials",scheme:e,issuer:J(t.issuer,"Configured OAuth2 issuer"),tokenUrl:N(t.tokenUrl,"Configured OAuth2 token endpoint").href,clientId:P(t.clientId,"Configured OAuth2 clientId"),clientSecretRef:P(t.clientSecretRef,"Configured OAuth2 clientSecretRef"),scopes:ie(t.scopes,"Configured OAuth2 scopes"),...t.resource===void 0?{}:{resource:ne(t.resource,"Configured OAuth2 resource")},clientAuthentication:t.clientAuthentication}}o(Vn,"validatedClientAuthentication");function Gn(t){let e=t.credentialRef===void 0?void 0:P(t.credentialRef,"A2A credentialRef"),n=Vn(t.authentication);if(t.credentialRef!==void 0&&t.authentication!==void 0)throw new Error("A2A registration cannot combine credentialRef with structured authentication.");return{agentId:t.agentId,agentCardUrl:t.agentCardUrl,...e!==void 0?{credentialRef:e}:{},...n!==void 0?{authentication:n}:{},effects:t.effects}}o(Gn,"validatedRegistrationInput");function Xn(t,e,n){if(t.authentication)return[[{schemeName:t.authentication.scheme,kind:t.authentication.type,...t.authentication.type==="oauth2-client-credentials"?{scopes:t.authentication.scopes}:{}}]];let r=ke(n);if(!t.credentialRef&&!r)return[[]];let i=F(e.securitySchemes,e.securityRequirements);return Object.values(i.schemes).flatMap(s=>s.kind==="http-bearer"?[[{schemeName:s.name,kind:"http-bearer"}]]:[])}o(Xn,"configuredCapabilityCandidates");function kt(t,e){for(let n of t){if(n.schemes.length!==1)continue;let r=n.schemes[0].scheme;if(e.some(i=>i.schemeName===r.name&&i.kind===r.kind))return r}}o(kt,"matchingDeclaredScheme");function Qn(t,e){let n=F(t.securitySchemes,t.securityRequirements),r=ye(n,e).filter(a=>a.schemes.length<=1);if(r.length===0)return null;let i=kt(r,e),s=[];for(let a of t.skills){let c=F(t.securitySchemes,a.securityRequirements),d=ye(c,e).filter(u=>u.schemes.length<=1);d.length!==0&&(s.push(a.id),i??=kt(d,e))}return t.skills.length>0&&s.length===0?null:{skillIds:s,...i?{declaredScheme:i}:{}}}o(Qn,"evaluateSecurityCapabilities");function Zn(t,e,n){if(t.credentialRef!==void 0&&t.authentication!==void 0)throw new Error("A2A registration cannot combine credentialRef with structured authentication.");if(n!==void 0&&!ke(n))throw new Error("A2A options.authorization must be a valid Bearer authorization.");let r=ke(n),i=t.credentialRef!==void 0||t.authentication!==void 0||r,s;for(let h of Xn(t,e,n)){let w=Qn(e,h);if(w&&(!i||w.declaredScheme)){s=w;break}}if(!s)throw new Error(i?"Configured A2A authentication cannot fully satisfy the Agent Card and any advertised Skill security requirements.":"Agent Card or at least one advertised Skill requires authentication, but no compatible A2A authentication is configured.");if(!i)return{skillIds:s.skillIds};let a=s.declaredScheme,c=t.authentication;if(!c&&!t.credentialRef&&r)return{skillIds:s.skillIds};if(!c)return{credentialRef:t.credentialRef,authentication:{type:"http-bearer",scheme:a.name},skillIds:s.skillIds};if(c.type==="http-bearer")return{credentialRef:c.credentialRef,authentication:{type:"http-bearer",scheme:c.scheme},skillIds:s.skillIds};if(a.kind!=="oauth2-client-credentials")throw new Error("Configured OAuth2 authentication does not match the selected Agent Card scheme.");let d=a,u=J(c.issuer,"Configured OAuth2 issuer"),f=N(c.tokenUrl,"Configured OAuth2 token endpoint").href,l=c.resource===void 0?void 0:ne(c.resource,"Configured OAuth2 resource");if(new URL(d.tokenUrl).href!==f)throw new Error("Configured OAuth2 tokenUrl does not match the selected Agent Card security scheme.");let p=c.scopes.find(h=>!d.scopes.includes(h));if(p)throw new Error(`Configured OAuth2 scope is not declared by the Agent Card: ${p}`);return{credentialRef:c.clientSecretRef,authentication:{type:"oauth2-client-credentials",scheme:c.scheme,issuer:u,tokenUrl:f,clientId:c.clientId,scopes:c.scopes,...l?{resource:l}:{},clientAuthentication:c.clientAuthentication},skillIds:s.skillIds}}o(Zn,"planClientAuthentication");function qe(t,e){try{return JSON.parse(t)}catch{throw new Error(`${e} returned invalid JSON.`)}}o(qe,"parseJson");function Et(t){let e=t.maxTaskResponseBytes??t.networkPolicy.maxResponseBytes;if(!Number.isSafeInteger(e)||e<=0)throw new Error("A2A maxTaskResponseBytes must be a positive safe integer.");return e}o(Et,"taskResponseBytes");function Yn(t){return{...t.networkPolicy,maxResponseBytes:Et(t)}}o(Yn,"taskNetworkPolicy");async function Tt(t,e){let n=Gn(t),r=await G(new URL(n.agentCardUrl),{headers:{accept:"application/json"}},e.networkPolicy,e.fetch);if(!r.response.ok)throw new Error(`Agent Card request failed with HTTP ${r.response.status}.`);if(!de(r.response.headers.get("content-type")))throw new Error("Agent Card response is not JSON.");let i=ut(qe(X(r.body),"Agent Card")),s=i.capabilities.extensions?.filter(f=>f.required)??[];if(s.length>0)throw new Error(`Agent Card required A2A extension(s) are unsupported: ${s.map(f=>f.uri).join(", ")}`);let a=Wn(i,r.url),c=Zn(n,i,e.authorization),d=Ae({agentCardUrl:r.url.href,interfaceUrl:a.url,protocolBinding:a.protocolBinding,protocolVersion:a.protocolVersion,tenant:a.tenant??"",authentication:c.authentication??null}),u=yt(Ae({card:i,endpointIdentity:d,credentialRef:c.credentialRef??null,effects:n.effects}));return{agentCard:i,registration:{agentId:n.agentId,displayName:i.name,description:i.description,enabled:!0,executorId:ve,protocol:"a2a",configurationRevision:u,endpointIdentityHash:yt(d),...c.credentialRef?{credentialRef:c.credentialRef}:{},executorConfig:{agentCardUrl:r.url.href,interfaceUrl:a.url,...a.tenant?{tenant:a.tenant}:{},...c.authentication?{authentication:c.authentication}:{}},skills:c.skillIds,inputModalities:i.defaultInputModes,outputModalities:i.defaultOutputModes,capabilities:{streaming:i.capabilities.streaming?"supported":"unsupported",durableTasks:"supported",inputRequired:"supported",cancellation:"supported",artifacts:"supported"},effects:{remote:n.effects.remote,workspace:"proposal"},health:{status:"healthy",checkedAt:new Date().toISOString()}}}}o(Tt,"discoverA2ARegistration");function le(t){return t.metadata??{}}o(le,"metadata");function Ne(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"&&Number.isFinite(t))return t;if(Array.isArray(t))return t.map(Ne);if(g(t)){let e={};for(let[n,r]of Object.entries(t))e[n]=Ne(r);return e}throw new Error("A2A response metadata must be JSON-safe.")}o(Ne,"toAgentJsonValue");function St(t){let e=le(t).directMessage;return e===void 0?void 0:$(e)}o(St,"directMessage");function er(t){return{TASK_STATE_UNSPECIFIED:"unknown",TASK_STATE_SUBMITTED:"submitted",TASK_STATE_WORKING:"working",TASK_STATE_COMPLETED:"completed",TASK_STATE_FAILED:"failed",TASK_STATE_CANCELED:"canceled",TASK_STATE_INPUT_REQUIRED:"input-required",TASK_STATE_REJECTED:"rejected",TASK_STATE_AUTH_REQUIRED:"auth-required"}[t]??"unknown"}o(er,"taskState");function $e(t){return t.flatMap(e=>e.text===void 0?[]:[e.text]).join(`
3
3
  `)}o($e,"textFromParts");function bt(t,e){let n=t.mediaType??(t.data!==void 0?"application/json":"application/octet-stream"),r=t.raw!==void 0?`data:${n};base64,${t.raw}`:t.data!==void 0?`data:${n};base64,${Buffer.from(JSON.stringify(t.data),"utf8").toString("base64")}`:void 0,i=t.url??r;if(i)return{name:e,...t.mediaType?{mimeType:t.mediaType}:{},...t.raw!==void 0?{size:Buffer.from(t.raw,"base64").byteLength}:{},uri:i,provenance:"a2a"}}o(bt,"partArtifactReference");function tr(t){let e=t.parts.find(n=>n.url!==void 0||n.raw!==void 0||n.data!==void 0);return e?bt(e,t.name??t.artifactId):void 0}o(tr,"artifactReference");function ue(t){let e=(t.artifacts??[]).flatMap(i=>$e(i.parts)),n=t.status.message?$e(t.status.message.parts):"",r=[...e,n].filter(Boolean).join(`
4
4
  `);return{state:er(t.status.state),...r?{output:r}:{},...t.status.state==="TASK_STATE_FAILED"?{error:n||"Remote A2A task failed."}:{},...t.artifacts?.length?{artifacts:t.artifacts.flatMap(i=>tr(i)??[])}:{}}}o(ue,"snapshotFromTask");function Me(t){let e=$e(t.parts),n=t.parts.flatMap((r,i)=>{if(r.text!==void 0)return[];let s=bt(r,r.filename??`message-part-${i+1}`);return s?[s]:[]});return{state:"completed",...e?{output:e}:{},...n.length>0?{artifacts:n}:{}}}o(Me,"snapshotFromMessage");function Rt(t){return t==="completed"||t==="failed"||t==="canceled"||t==="rejected"}o(Rt,"isTerminal");function nr(t,e,n){let r=t.get(e.artifactId);t.set(e.artifactId,n&&r?{...r,...e,parts:[...r.parts,...e.parts]}:e)}o(nr,"mergeStreamArtifact");var Se=class{constructor(e,n,r,i,s){this.registration=e;this.context=n;this.options=r;this.oauthTokenManager=i;this.releaseOAuthTokenManager=s}registration;context;options;oauthTokenManager;releaseOAuthTokenManager;static{o(this,"A2AClientExecutor")}#e=!1;#n=new Set;#t=new Le;async preflight(){try{return Q(this.registration),{ok:!0}}catch(e){return{ok:!1,reasons:[e instanceof Error?e.message:String(e)]}}}async start(e,n){let r=e.idempotencyKey;if(!r)throw new Error("A2A executor requires an idempotency key.");let i=await this.sendMessage({message:{messageId:r,role:"ROLE_USER",parts:[{text:e.input??e.objective,mediaType:"text/plain"}]},configuration:{returnImmediately:!0}},n);if(g(i.task)){let s=H(i.task);return{idempotencyKey:r,remoteTaskId:s.id,...s.contextId?{metadata:{contextId:s.contextId}}:{}}}if(i.message!==void 0){let s=this.#t.redactMessage($(i.message));return{idempotencyKey:r,metadata:{directMessage:Ne(s)}}}throw new Error("A2A SendMessage returned neither task nor message.")}async*events(e){let n=St(e);if(n){yield await this.authorizeArtifacts(Me(this.#t.redactMessage(n)));return}if(this.registration.capabilities.streaming==="supported")try{yield*this.streamEvents(e);return}catch(r){if(this.#e)return;V({source:"a2a.client",level:"warn",message:"A2A event stream failed; polling fallback started.",detail:r}),yield{progress:{message:"A2A stream unavailable; polling."}}}for(;!this.#e;){let r=await this.get(e);if(yield r,Rt(r.state)||r.state==="input-required"||r.state==="auth-required")return;await new Promise(i=>setTimeout(i,this.options.pollIntervalMs))}}async get(e){let n=St(e);if(n)return this.authorizeArtifacts(Me(this.#t.redactMessage(n)));if(!e.remoteTaskId)throw new Error("A2A task reference has no remote task ID.");let r=H(await this.rpc("GetTask",this.taskParams(e)));return this.assertTaskReference(r,e),this.authorizeArtifacts(ue(this.#t.redactTask(r)))}async sendInput(e,n){if(!e.remoteTaskId)throw new Error("Direct A2A responses cannot accept input.");await this.sendMessage({message:{messageId:_e(),taskId:e.remoteTaskId,...typeof le(e).contextId=="string"?{contextId:le(e).contextId}:{},role:"ROLE_USER",parts:[{text:n.content,mediaType:"text/plain"}]},configuration:{returnImmediately:!0}})}async cancel(e){if(!e.remoteTaskId)return this.get(e);let n=H(await this.rpc("CancelTask",this.taskParams(e)));return this.assertTaskReference(n,e),this.authorizeArtifacts(ue(this.#t.redactTask(n)))}async reconcile(e){return this.get(e)}async dispose(){if(!this.#e){this.#e=!0;try{for(let e of this.#n)e.abort(new Error("A2A executor disposed."))}finally{this.releaseOAuthTokenManager?.()}}}async*streamEvents(e){if(!e.remoteTaskId)throw new Error("A2A stream requires a remote task ID.");let n=Q(this.registration),r=new URL(n.interfaceUrl),i=new Headers({accept:"text/event-stream","a2a-version":"1.0","content-type":"application/json"}),s=new AbortController,a=_e();this.#n.add(s);let c,d,u=o(()=>{d!==void 0&&clearTimeout(d),d=void 0},"disarmTimeout"),f=o(l=>{u(),d=setTimeout(()=>s.abort(new Error(l)),this.options.networkPolicy.requestTimeoutMs),d.unref?.()},"armTimeout");try{f("A2A stream connection timed out.");let l=await this.openStreamResponse(r,i,s.signal,{jsonrpc:"2.0",id:a,method:"SubscribeToTask",params:this.taskParams(e)}),p=l.response;if(c=l.releaseAuthorization,u(),!p.ok||!p.body)throw new Error(`A2A stream failed with HTTP ${p.status}.`);if(!ct(p.headers.get("content-type")))throw new Error("A2A stream returned an invalid content type.");let h=p.body.getReader(),w=new TextDecoder,k=new Map,y="",E=0;for(;!this.#e;){f("A2A stream was idle for too long.");let m=await h.read();if(u(),m.done)break;if(E+=m.value.byteLength,E>Et(this.options))throw new Error("A2A stream exceeded the response size limit.");y+=w.decode(m.value,{stream:!0});let S=y.split(/\r?\n\r?\n/);y=S.pop()??"";for(let L of S){let R=L.split(/\r?\n/).filter(j=>j.startsWith("data:")).map(j=>j.slice(5).trimStart()).join(`
5
5
  `);if(!R)continue;let O=await this.snapshotFromStreamPayload(qe(R,"A2A stream"),a,e,k);if(O&&(yield O,O.state&&(Rt(O.state)||O.state==="input-required"||O.state==="auth-required")))return}}if(!this.#e)throw new Error("A2A event stream ended before the task reached a stable state.")}catch(l){throw this.#t.redactError(l)}finally{u(),c?.(),this.#n.delete(s)}}async snapshotFromStreamPayload(e,n,r,i){if(!g(e))throw new Error("A2A stream frame is invalid.");if(e.jsonrpc!=="2.0"||e.id!==n)throw new Error("A2A stream frame has an invalid JSON-RPC version or response id.");if(e.error!==void 0){let s=g(e.error)?e.error:{},a=typeof s.message=="string"?s.message:"A2A stream error.";throw new A(typeof s.code=="number"?s.code:-32603,this.#t.redactText(a))}if(g(e.result)){if(e.result.task!==void 0){let s=H(e.result.task);this.assertTaskReference(s,r),i.clear();for(let a of s.artifacts??[])i.set(a.artifactId,a);return this.authorizeArtifacts(ue(this.#t.redactTask(s)))}if(e.result.message!==void 0){let s=$(e.result.message);if(s.taskId!==void 0&&s.taskId!==r.remoteTaskId)throw new Error("A2A stream message belongs to a different task.");return this.authorizeArtifacts(Me(this.#t.redactMessage(s)))}if(g(e.result.statusUpdate)&&g(e.result.statusUpdate.status)){this.assertStreamTaskScope(e.result.statusUpdate,r);let s=H({id:r.remoteTaskId,contextId:e.result.statusUpdate.contextId,status:e.result.statusUpdate.status,...i.size>0?{artifacts:[...i.values()]}:{}});return this.authorizeArtifacts(ue(this.#t.redactTask(s)))}if(g(e.result.artifactUpdate)&&e.result.artifactUpdate.artifact!==void 0){this.assertStreamTaskScope(e.result.artifactUpdate,r);let s=H({id:r.remoteTaskId,contextId:e.result.artifactUpdate.contextId,status:{state:"TASK_STATE_WORKING"},artifacts:[e.result.artifactUpdate.artifact]}),a=s.artifacts?.[0];if(!a)throw new Error("A2A artifact update has no artifact.");nr(i,a,e.result.artifactUpdate.append===!0);let c={...s,artifacts:[...i.values()]};return this.authorizeArtifacts(ue(this.#t.redactTask(c)))}}}async authorizeArtifacts(e){for(let n of e.artifacts??[])await this.context.authorizeArtifact(n);return e}assertTaskReference(e,n){if(e.id!==n.remoteTaskId)throw new Error("A2A response belongs to a different task id.");let r=le(n).contextId;if(typeof r=="string"&&e.contextId&&e.contextId!==r)throw new Error("A2A response belongs to a different task context.")}assertStreamTaskScope(e,n){if(typeof e.taskId!="string"||e.taskId!==n.remoteTaskId)throw new Error("A2A stream event belongs to a different task.");let r=le(n).contextId;if(typeof e.contextId!="string"||typeof r=="string"&&e.contextId!==r)throw new Error("A2A stream event belongs to a different task context.")}async openStreamResponse(e,n,r,i){let s=o(a=>{let c=new Headers(n);return a&&c.set("authorization",a),Ue(e,{method:"POST",headers:c,redirect:"manual",signal:r,body:JSON.stringify(i)},this.options.networkPolicy,this.options.fetch)},"open");return this.withAuthorization(async a=>{let c=this.#t.retain(a);try{let d=await s(a);if(d.status===401)throw await d.body?.cancel(),new A(-32600,"A2A authentication was rejected.",401);return{response:d,releaseAuthorization:c}}catch(d){throw c(),d}})}taskParams(e){let n=Q(this.registration);return{id:e.remoteTaskId,...n.tenant?{tenant:n.tenant}:{}}}async sendMessage(e,n){let r=await this.rpc("SendMessage",{...e,...Q(this.registration).tenant?{tenant:Q(this.registration).tenant}:{}},n);if(!g(r))throw new Error("A2A SendMessage result is invalid.");return r}async rpc(e,n,r){if(this.#e)throw new Error("A2A executor is disposed.");return this.withAuthorization(i=>this.rpcWithAuthorization(e,n,i,r))}redactRpcResult(e,n){return e==="GetTask"||e==="CancelTask"?this.#t.redactTask(H(n)):e!=="SendMessage"||!g(n)?n:{...n,...n.task===void 0?{}:{task:this.#t.redactTask(H(n.task))},...n.message===void 0?{}:{message:this.#t.redactMessage($(n.message))}}}async withAuthorization(e){let n=Q(this.registration).authentication;if(!n){if(this.options.authorization!==void 0&&!ke(this.options.authorization))throw new Error("A2A options.authorization must be a valid Bearer authorization.");let c=this.#t.retain(this.options.authorization);try{return await e(this.options.authorization)}catch(d){throw this.#t.redactError(d)}finally{c()}}let r=this.registration.credentialRef;if(!r)throw new Error("Authenticated A2A registration has no credential reference.");let i=o(c=>this.context.withCredential(r,async d=>{let u,f;try{return u=n.type==="http-bearer"?`Bearer ${d}`:await this.requireOAuthTokenManager().getAuthorization(d),f=this.#t.retain(u),{ok:!0,value:await e(u)}}catch(l){if(c&&n.type==="oauth2-client-credentials"&&l instanceof A&&l.httpStatus===401&&u!==void 0)return{ok:!1,rejectedAuthorization:u};throw this.#t.redactError(l)}finally{f?.()}}),"execute"),s=await i(n.type==="oauth2-client-credentials");if(s.ok)return s.value;this.requireOAuthTokenManager().invalidate(s.rejectedAuthorization);let a=await i(!1);if(!a.ok)throw new Error("A2A OAuth2 retry did not produce a result.");return a.value}requireOAuthTokenManager(){if(!this.oauthTokenManager)throw new Error("A2A OAuth2 token manager is unavailable.");return this.oauthTokenManager}async rpcWithAuthorization(e,n,r,i){let s=Q(this.registration),a=new Headers({accept:"application/json","a2a-version":"1.0","content-type":"application/json"});r&&a.set("authorization",r);let c=_e(),d=await G(new URL(s.interfaceUrl),{method:"POST",headers:a,body:JSON.stringify({jsonrpc:"2.0",id:c,method:e,params:n}),...i?{signal:i}:{}},Yn(this.options),this.options.fetch);if(d.response.status===401)throw new A(-32600,"A2A authentication was rejected.",401);if(!de(d.response.headers.get("content-type")))throw new Error("A2A JSON-RPC response has an invalid content type.");let u=qe(X(d.body),"A2A endpoint");if(!g(u))throw new Error("A2A JSON-RPC response is invalid.");if(u.jsonrpc!=="2.0"||u.id!==c)throw new Error("A2A JSON-RPC response has an invalid version or response id.");let f=Object.hasOwn(u,"result"),l=Object.hasOwn(u,"error");if(f===l)throw new Error("A2A JSON-RPC response must contain exactly one result or error.");if(l)throw!g(u.error)||typeof u.error.code!="number"||typeof u.error.message!="string"?new Error("A2A JSON-RPC error response is invalid."):new A(u.error.code,this.#t.redactText(u.error.message),d.response.status,this.#t.redactContent(u.error.data));if(!d.response.ok)throw new Error(`A2A request failed with HTTP ${d.response.status}.`);return this.redactRpcResult(e,u.result)}};function xt(t){let e=new Map;return{executorId:ve,protocol:"a2a",async create(n,r){let i=typeof t=="function"?t(n):t,s=Q(n),a=s.authentication,c={...i,networkPolicy:wt(i.networkPolicy,s.interfaceUrl)},d;if(a?.type==="oauth2-client-credentials"){let p=wt(i.networkPolicy,a.tokenUrl),h=Ae({authentication:a,credentialRef:n.credentialRef??"",networkPolicy:p}),w=e.get(n.agentId);if(d=w?.key===h&&w.fetch===i.fetch?w:void 0,!d){let k=ht({issuer:a.issuer,tokenUrl:a.tokenUrl,clientId:a.clientId,scopes:a.scopes,...a.resource?{resource:a.resource}:{},clientAuthenticationMethod:a.clientAuthentication==="client-secret-post"?"post":"basic",networkPolicy:p,...i.fetch?{fetch:i.fetch}:{}});d={key:h,fetch:i.fetch,manager:k,references:0},e.set(n.agentId,d)}}if(!d)return new Se(n,r,c);let u=d;u.references+=1;let f=!1,l=o(()=>{f||(f=!0,u.references-=1,u.references===0&&(u.manager.invalidate(),e.get(n.agentId)===u&&e.delete(n.agentId)))},"releaseOAuthTokenManager");return new Se(n,r,c,u.manager,l)}}}o(xt,"createA2AAgentExecutorFactory");import{createHash as sr,randomUUID as fe}from"node:crypto";import W from"node:fs";import{createServer as or}from"node:http";import T from"node:path";import{Readable as vt}from"node:stream";import{createHash as rr}from"node:crypto";var Z="realm-subject-tenant-v1";function It(t){return rr("sha256").update(t).digest("hex")}o(It,"sha256");function Ct(t){return It(`${t.subject}\0${t.tenant??""}`)}o(Ct,"legacyA2APrincipalKey");function Re(t){return It(JSON.stringify([t.securityRealm,t.subject,t.tenant??null]))}o(Re,"realmA2APrincipalKey");import _ from"node:fs";import De from"node:path";function Y(t){return structuredClone(t)}o(Y,"clone");function ir(t){if(!g(t))throw new Error("A2A task store record must be an object.");for(let n of["taskId","contextId","principalKey","runtimeIdentity","sessionId","createdAt","updatedAt"])if(typeof t[n]!="string")throw new Error(`A2A task store record has invalid ${n}.`);if(!g(t.messageDigests)||!Object.values(t.messageDigests).every(n=>typeof n=="string"))throw new Error("A2A task store message digests are invalid.");if(!Array.isArray(t.runIds)||!t.runIds.every(n=>typeof n=="string"))throw new Error("A2A task store run IDs are invalid.");if(!Array.isArray(t.history))throw new Error("A2A task store history is invalid.");if(t.principalKeyScheme!==void 0&&t.principalKeyScheme!==Z)throw new Error("A2A task store principal key scheme is unsupported.");if(!Number.isSafeInteger(t.eventSeq)||!Number.isSafeInteger(t.lastRuntimeEventSeq))throw new Error("A2A task store event cursors are invalid.");let e=t.pendingUserInput;if(e!==void 0&&(!g(e)||typeof e.requestId!="string"||!Number.isSafeInteger(e.revision)||typeof e.runId!="string"||typeof e.kind!="string"))throw new Error("A2A task store pending user input is invalid.");if(t.acceptedOutputModes!==void 0&&(!Array.isArray(t.acceptedOutputModes)||!t.acceptedOutputModes.every(n=>typeof n=="string")))throw new Error("A2A task store accepted output modes are invalid.");return{taskId:t.taskId,contextId:t.contextId,principalKey:t.principalKey,...t.principalKeyScheme===Z?{principalKeyScheme:Z}:{},runtimeIdentity:t.runtimeIdentity,sessionId:t.sessionId,...typeof t.workspaceRoot=="string"?{workspaceRoot:t.workspaceRoot}:{},...typeof t.executionPolicyRevision=="string"?{executionPolicyRevision:t.executionPolicyRevision}:{},messageDigests:t.messageDigests,runIds:t.runIds,task:H(t.task),history:t.history.map($),createdAt:t.createdAt,updatedAt:t.updatedAt,eventSeq:t.eventSeq,lastRuntimeEventSeq:t.lastRuntimeEventSeq,runtimeEventCount:Number.isSafeInteger(t.runtimeEventCount)?t.runtimeEventCount:0,runtimeEventBytes:Number.isSafeInteger(t.runtimeEventBytes)?t.runtimeEventBytes:0,...t.acceptedOutputModes!==void 0?{acceptedOutputModes:t.acceptedOutputModes}:{},...e!==void 0?{pendingUserInput:{requestId:e.requestId,revision:e.revision,runId:e.runId,kind:e.kind}}:{}}}o(ir,"parseRecord");var oe=class{static{o(this,"A2AFileTaskStore")}#e=new Map;#n=new Map;#t;#r;#i;constructor(e){let n=De.resolve(e);_.mkdirSync(n,{recursive:!0,mode:448}),this.#t=De.join(n,"tasks.json"),this.#r=De.join(n,".server.lock"),this.#i=this.acquireLock();try{this.load()}catch(r){throw _.closeSync(this.#i),_.rmSync(this.#r,{force:!0}),r}}get(e){let n=this.#e.get(e);return n?Y(n):void 0}findByMessage(e,n){for(let r of this.#e.values())if(r.principalKey===e&&r.messageDigests[n]!==void 0)return Y(r)}list(e){return[...this.#e.values()].filter(n=>n.principalKey===e).sort((n,r)=>r.updatedAt.localeCompare(n.updatedAt)||r.taskId.localeCompare(n.taskId)).map(Y)}all(){return[...this.#e.values()].map(Y)}save(e){let n=Y(e),r=this.#e.get(e.taskId);this.#e.set(e.taskId,n);try{this.persist()}catch(i){throw r?this.#e.set(e.taskId,r):this.#e.delete(e.taskId),i}for(let i of this.#n.get(e.taskId)??[])i(Y(n));return Y(n)}pruneTerminal(e,n){let r=[...this.#e.values()].filter(s=>s.principalKey===e).sort((s,a)=>s.updatedAt.localeCompare(a.updatedAt)),i=[];for(;r.length>n;){let s=r.findIndex(c=>c.task.status.state==="TASK_STATE_COMPLETED"||c.task.status.state==="TASK_STATE_FAILED"||c.task.status.state==="TASK_STATE_CANCELED"||c.task.status.state==="TASK_STATE_REJECTED");if(s<0)break;let[a]=r.splice(s,1);if(!a)break;this.#e.delete(a.taskId),this.#n.delete(a.taskId),i.push(Y(a))}return i.length>0&&this.persist(),i}migrateUnversionedPrincipalKeys(e){let n=0,r=0,i=0,s=[];for(let[a,c]of this.#e){if(c.principalKeyScheme!==void 0)continue;let d=e.legacyToCurrent.get(c.principalKey);d!==void 0?(n+=1,s.push([a,{...c,principalKey:d,principalKeyScheme:Z}])):e.currentKeys.has(c.principalKey)?(r+=1,s.push([a,{...c,principalKeyScheme:Z}])):i+=1}if(e.apply&&s.length>0){for(let[a,c]of s)this.#e.set(a,c);this.persist()}return{matchedLegacyTaskCount:n,matchedCurrentTaskCount:r,unmatchedUnversionedTaskCount:i}}subscribe(e,n){let r=this.#n.get(e)??new Set;return r.add(n),this.#n.set(e,r),()=>{r.delete(n),r.size===0&&this.#n.delete(e)}}close(){this.#n.clear(),_.closeSync(this.#i),_.rmSync(this.#r,{force:!0})}acquireLock(){let e=o(()=>{let n=_.openSync(this.#r,"wx",384);return _.writeFileSync(n,`${process.pid}
@@ -1,15 +1,15 @@
1
- import { eg as Span, eB as Trace, f as Agent, bs as Handoff, e2 as RunnerToolCall, e5 as RunnerToolResult, ae as AgentMessage, ad as AgentManifest, d0 as ManifestPatch, bx as InvariantId, dP as QualityInvariant, bN as KodaXInputArtifactSource, bL as KodaXImageMediaType, cl as KodaXVideoMediaType, bG as KodaXFileInputArtifact, bK as KodaXImageInputArtifact, ck as KodaXVideoInputArtifact, bM as KodaXInputArtifact, b5 as DiscoveredInstance, ee as SessionMeta, ef as SessionStateSnapshot, eo as StateWriterFs, bw as InstanceDiscoveryFs, en as StateWriter, eq as StopHookContext, es as StopHookResult, er as StopHookFn, db as MemoryContextIdentity, dk as MemoryItemRef, c1 as KodaXSessionLineage, bU as KodaXSessionArtifactLedgerEntry, dg as MemoryEvent, dD as MemoryReviewRunner, dc as MemoryController, d1 as MemoryActionProposal, d4 as MemoryApplyResult, dv as MemoryRejectResult, dt as MemoryRefFilter, d9 as MemoryBodySnapshot, dm as MemoryLifecycleOperationResult, dd as MemoryCuratorInput, dj as MemoryGovernanceReport, d7 as MemoryAutoCuratorInput, d8 as MemoryAutoCuratorResult, dq as MemoryPackInput, dn as MemoryPack, dy as MemoryReviewInput, dC as MemoryReviewPlan, bR as KodaXMemoryOutcomeDigest, dz as MemoryReviewModelInput, df as MemoryEpisodeReviewResult, d2 as MemoryApplicability, cJ as LearningActionDriver, cT as LearningQuery, cS as LearningPage, cv as LearnedCapabilityRecord, cY as LearningSurfaceSnapshot, cO as LearningEvent, cX as LearningSubscribeOptions, cQ as LearningExplicitUserAuthority, cn as LearnedAreaStore, cy as LearnedCapabilityScope, ca as KodaXSessionStorage, a_ as CompactionUpdate, bY as KodaXSessionData, bI as KodaXGoalState, bH as KodaXGoalEventType, bZ as KodaXSessionEntry, b$ as KodaXSessionGoalEntry, aV as CompactionConfig, aW as CompactionDetails, aY as CompactionResult, bE as KodaXExtensionStore, bF as KodaXExtensionStoreEntry, bO as KodaXJsonValue, fj as WorkflowRunState, eZ as WorkflowOutcome, eK as WorkflowApi, eY as WorkflowModule, eJ as WorkflowAgentBackend, eU as WorkflowLimits, eP as WorkflowEvent, eV as WorkflowLogEvent, fp as WorkflowTaskResult, a0 as AgentExecutorPlaneStore, a$ as CreateAgentExecutorPlaneOptions, Y as AgentExecutorPlane, bf as ExternalAgentProtocol, W as AgentExecutorFactory, w as AgentBudgetExhausted, aa as AgentLimitReached } from './types-chunks/controller.d-C2aHqzHj.js';
2
- export { A as ASK_USER_BACK_SIGNAL, a as ASK_USER_CUSTOM_INPUT_SIGNAL, b as AdmissionAuditOptions, c as AdmissionCtx, d as AdmissionVerdict, e as AdmittedHandle, g as AgentActor, h as AgentActorClient, i as AgentActorController, j as AgentActorOwner, k as AgentActorSnapshot, l as AgentActorSnapshotV1, m as AgentActorSnapshotV2, n as AgentActorState, o as AgentActorStore, p as AgentArtifactDescriptor, q as AgentArtifactPolicy, r as AgentArtifactPolicyDecision, s as AgentArtifactPolicyInput, t as AgentArtifactReference, u as AgentBudgetAdmission, v as AgentBudgetAdmissionInput, x as AgentBudgetPort, y as AgentCapabilities, z as AgentCapabilityDeclaration, B as AgentCapabilityRequirements, C as AgentContinuationInput, D as AgentControllerHealth, E as AgentControllerOptions, F as AgentCredentialBroker, G as AgentDataClassification, H as AgentDetail, I as AgentDispatchContext, J as AgentDispatchPolicy, K as AgentDispatchPolicyDecision, L as AgentDispatchPolicyInput, M as AgentDispatchabilitySnapshot, N as AgentDispatchabilityStatus, O as AgentEffectDeclaration, P as AgentEvent, Q as AgentEventKind, R as AgentExecutionInput, S as AgentExecutionKind, T as AgentExecutionResult, U as AgentExecutor, V as AgentExecutorEvent, X as AgentExecutorFactoryContext, Z as AgentExecutorPlaneBackgroundErrorContext, _ as AgentExecutorPlaneBackgroundErrorHandler, $ as AgentExecutorPlaneBinding, a1 as AgentExecutorPreflightResult, a2 as AgentExecutorProtocol, a3 as AgentExecutorTaskReference, a4 as AgentExecutorTaskSnapshot, a5 as AgentFollowupResult, a6 as AgentForkTurns, a7 as AgentInterruptScope, a8 as AgentJsonObject, a9 as AgentJsonValue, ab as AgentListEntry, ac as AgentMailboxMessage, af as AgentMetadataValue, ag as AgentMiddlewareDeclaration, ah as AgentMutationOptions, ai as AgentOutput, aj as AgentPreflightInput, ak as AgentPreflightResult, al as AgentProgressItem, am as AgentProgressKind, an as AgentProgressUpdate, ao as AgentReasoningProfile, ap as AgentRegistrationEnabledMutationOptions, aq as AgentRegistrationMutationOptions, ar as AgentRegistrationService, as as AgentSpanData, at as AgentSpawnInput, au as AgentTaskCancellation, av as AgentTaskCorrelation, aw as AgentTaskEvent, ax as AgentTaskFilter, ay as AgentTaskProgress, az as AgentTaskRegistrationSnapshot, aA as AgentTaskService, aB as AgentTaskSnapshot, aC as AgentTaskStartInput, aD as AgentTaskState, aE as AgentTaskUsage, aF as AgentTool, aG as AgentTreeSnapshot, aH as AgentTurn, aI as AgentTurnExecutor, aJ as AgentTurnRef, aK as AgentTurnState, aL as AgentTurnSummary, aM as AskUserAnswer, aN as AskUserCustomInputAnswer, aO as AskUserMultiOptions, aP as AskUserQuestionItem, aQ as AskUserQuestionOptions, aR as AskUserSelectionAnswer, aS as CapabilitySupport, aT as CommitLearnedSkillRevisionInput, aU as CompactionAnchor, aX as CompactionReport, aZ as CompactionSpanData, b0 as CreateLearnedSkillRecordInput, b1 as CurrentTodoSummary, b2 as DEFAULT_SYSTEM_CAP, b3 as DeclarativeSkillSpec, b4 as Deliverable, b6 as DiscoveryOptions, b7 as DispatchableAgentDescriptor, b8 as DispatchableAgentListing, b9 as DispatchableAgentOrigin, ba as DispatchableAgentQuery, bb as EvidenceSpanData, bc as ExactInvokedSkillSnapshot, bd as ExternalAgentEffectDeclaration, be as ExternalAgentHealth, bg as ExternalAgentRegistration, bh as ExternalAgentRegistrationSummary, bi as FanoutSpanData, bj as FileOperations, bk as GenerationSpanData, bl as Guardrail, bm as GuardrailBlockedError, bn as GuardrailContext, bo as GuardrailEscalateError, bp as GuardrailPermissionIntent, bq as GuardrailSpanData, br as GuardrailVerdict, bt as HandoffSpanData, bu as InMemorySessionOptions, bv as InputGuardrail, by as InvariantResult, bz as InvariantSession, bA as KodaXCompactMemoryProgress, bB as KodaXCompactMemorySeed, bC as KodaXExtensionSessionRecord, bD as KodaXExtensionSessionState, bJ as KodaXGoalStatus, bP as KodaXMemoryInfluenceRef, bQ as KodaXMemoryIntent, bS as KodaXMemoryOutcomeEvidence, bT as KodaXSessionArchiveMarkerEntry, bV as KodaXSessionBranchSummaryEntry, bW as KodaXSessionClientNoticeEntry, bX as KodaXSessionCompactionEntry, b_ as KodaXSessionEntryBase, c0 as KodaXSessionLabelEntry, c2 as KodaXSessionMemoryOutcomeDigestEntry, c3 as KodaXSessionMemoryReviewReceiptEntry, c4 as KodaXSessionMessageEntry, c5 as KodaXSessionMeta, c6 as KodaXSessionNavigationOptions, c7 as KodaXSessionRewindMarkerEntry, c8 as KodaXSessionRuntimeInfo, c9 as KodaXSessionScope, cb as KodaXSessionTreeNode, cc as KodaXSessionUiHistoryItem, cd as KodaXSessionUiHistoryItemType, ce as KodaXSessionUiTextHistoryItem, cf as KodaXSessionUiTextHistoryItemType, cg as KodaXSessionUiToolCall, ch as KodaXSessionUiToolCallStatus, ci as KodaXSessionUiToolGroupHistoryItem, cj as KodaXSessionWorkspaceKind, cm as LearnedAreaPaths, co as LearnedCapabilityArtifact, cp as LearnedCapabilityCanary, cq as LearnedCapabilityCanaryBinding, cr as LearnedCapabilityCanaryInvocation, cs as LearnedCapabilityCarrier, ct as LearnedCapabilityLifecycle, cu as LearnedCapabilityProvenance, cw as LearnedCapabilityRecordV1, cx as LearnedCapabilityRecordV2, cz as LearnedCapabilitySource, cA as LearnedSkillBindingAdmission, cB as LearnedSkillCanaryOutcome, cC as LearnedSkillDecisionDisposition, cD as LearnedSkillInvocationAdmission, cE as LearnedSkillInvokedReceipt, cF as LearnedSkillOfferedReceipt, cG as LearnedSkillOutcomeReceipt, cH as LearnedSkillUsageReceipt, cI as LearningAction, cK as LearningCapabilityError, cL as LearningCapabilityErrorCode, cM as LearningClientEventState, cN as LearningClientRecord, cP as LearningEventKind, cR as LearningNotificationState, cU as LearningReviewEvidencePacket, cV as LearningReviewQualification, cW as LearningReviewVerifierFact, cZ as LocalAgentTaskInput, c_ as LocalAgentTaskUpdate, c$ as MAX_TOOL_LOOP_ITERATIONS, d3 as MemoryApplyPreview, d5 as MemoryApproval, d6 as MemoryAuthority, da as MemoryClaimKind, de as MemoryDecisionTraceReceipt, dh as MemoryGovernanceFinding, di as MemoryGovernanceFindingKind, dl as MemoryLifecycle, dp as MemoryPackHint, dr as MemoryPackTraceMetadata, ds as MemoryProposalAction, du as MemoryRefKind, dw as MemoryReviewCandidateRef, dx as MemoryReviewDraftAction, dA as MemoryReviewPersistenceDecision, dB as MemoryReviewPersistenceKind, dE as MemoryReviewTrigger, dF as MemoryScope, dG as MemorySourceAdapter, dH as MemoryVisibility, dI as MessageEntry, dJ as NormalizedLearnedSkillDecision, dK as ObserveCtx, dL as OutputGuardrail, dM as PersistedSessionState, dN as PresetDispatcher, dO as PresetTracingContext, dQ as ReadonlyMutationTracker, dR as ReadonlyRecorder, dS as ReasoningDepth, dT as RecentlyModifiedFile, dU as RunEvent, dV as RunOptions, dW as RunResult, dX as RunnableTool, dY as Runner, dZ as RunnerEvent, d_ as RunnerIterationLimitError, d$ as RunnerLlmResult, e0 as RunnerLlmReturn, e1 as RunnerRecoveryTranscriptCarrier, e3 as RunnerToolContext, e4 as RunnerToolObserver, e6 as RunnerToolResultBatch, e7 as RunnerToolResultBatchTransform, e8 as Session, e9 as SessionDispatchResult, ea as SessionEntry, eb as SessionErrorMetadata, ec as SessionExtension, ed as SessionForkOptions, eh as SpanData, ei as SpanError, ej as SpanImpl, ek as SpanImplOptions, el as StagedLearnedSkillArtifact, em as StartTraceOptions, ep as StateWriterOptions, et as StopHookSpanData, eu as SystemCap, ev as TerminalCtx, ew as ToolBeforeOutcome, ex as ToolCallSpanData, ey as ToolCapability, ez as ToolGuardrail, eA as ToolPermission, eC as TraceOptions, eD as Tracer, eE as TracerOptions, eF as UnifiedLearningReviewModelInput, eG as UnifiedLearningReviewResult, eH as UnifiedLearningReviewRunner, eI as UserInteraction, eL as WorkflowApproval, eM as WorkflowApprovalSummary, eN as WorkflowArtifactRef, eO as WorkflowBudget, eQ as WorkflowEventCorrelation, eR as WorkflowEventRecorder, eS as WorkflowEventType, eT as WorkflowIsolation, eW as WorkflowMeta, eX as WorkflowModelHint, e_ as WorkflowOutcomeError, e$ as WorkflowOutcomeResult, f0 as WorkflowOutcomeStatus, f1 as WorkflowOutcomeUsage, f2 as WorkflowParallelOptions, f3 as WorkflowProcessArtifact, f4 as WorkflowProcessCounts, f5 as WorkflowProcessEvent, f6 as WorkflowProcessItem, f7 as WorkflowProcessItemKind, f8 as WorkflowProcessItemOrigin, f9 as WorkflowProcessItemStatus, fa as WorkflowProcessProgress, fb as WorkflowProcessSnapshot, fc as WorkflowProcessSource, fd as WorkflowProcessStatus, fe as WorkflowProcessSummaryStatus, ff as WorkflowProcessTokenUsage, fg as WorkflowProcessTracker, fh as WorkflowProcessTrackerOptions, fi as WorkflowRun, fk as WorkflowRunStatus, fl as WorkflowSpawnAgentInput, fm as WorkflowSynthesis, fn as WorkflowSynthesizeInput, fo as WorkflowTaskHandle, fq as WorkflowTaskSnapshot, fr as WorkflowTaskStatus, fs as WorkflowTaskSummaryEventUpdate, ft as WorkflowTaskSummaryKind, fu as WorkflowTaskSummaryUpdate, fv as WorkflowTaskUsage, fw as WorkflowTaskVerification, fx as WorkflowTaskVerificationResult, fy as WorkflowWaitOptions, fz as _resetAdmittedAgentBindings, fA as _resetPresetDispatchers, fB as admitAndRecordLearnedSkillInvocation, fC as admitLearnedSkillBinding, fD as asSingleSelection, fE as assertLearnedCapabilityTransition, fF as attachRunnerRecoveryTranscript, fG as buildAssistantMessageFromLlmResult, fH as buildSystemPrompt, fI as buildToolResultMessage, fJ as canTransitionLearnedCapability, fK as collectGuardrails, fL as commitLearnedSkillRevision, fM as completeLearnedSkillOutcome, fN as completeLearnedSkillSessionOutcomes, fO as createAgent, fP as createAgentActorController, fQ as createHandoff, fR as createInMemorySession, fS as createInvariantSessionForAgent, fT as createLearnedCapabilityScope, fU as createLearnedSkillRecord, fV as createStateWriter, fW as createTrace, fX as createWorkflowProcessTracker, fY as defaultTracer, fZ as detectInstructionsInjection, f_ as discoverInstances, f$ as eventFromCapability, g0 as exactInvokedSkillSnapshotForSession, g1 as executeRunnerToolCall, g2 as extractAssistantTextFromMessage, g3 as getActiveUserInteraction, g4 as getAdmittedAgentBindings, g5 as hashMemoryIdentityComponent, g6 as invokeLearnedSkillCanary, g7 as isAskUserCustomInputAnswer, g8 as isFinalWorkflowProcessStatus, g9 as isLearnedCapabilityRecordV2, ga as isRunnableTool, gb as isRunnerIterationLimitError, gc as isRunnerLlmResult, gd as isUnifiedLearningReviewModelInput, ge as learningEventIdFor, gf as learningEventKindForLifecycle, gg as listLearnedSkillUsageReceipts, gh as matchesMemoryApplicability, gi as memoryApplicabilityFingerprint, gj as normalizeHostMetadata, gk as normalizeUnifiedLearningReview, gl as quarantineLearnedSkillRevision, gm as readRunnerRecoveryTranscript, gn as reconcileLearnedSkillBindingOutcomes, go as recordLearnedSkillOffered, gp as registerPresetDispatcher, gq as releaseLearnedSkillBinding, gr as renderDeclarativeSkill, gs as resolveLearnedAreaPaths, gt as resolveProjectLearnedAreaRoot, gu as runAdmissionAudit, gv as runInputGuardrails, gw as runOutputGuardrails, gx as runToolAfterGuardrails, gy as runToolBeforeGuardrails, gz as sanitizeUnifiedLearningReviewInput, gA as setActiveUserInteraction, gB as setAdmittedAgentBindings, gC as slugifyLearnedCapabilityName, gD as stageLearnedSkillRevision, gE as validateDeclarativeSkillSpec } from './types-chunks/controller.d-C2aHqzHj.js';
3
- import { M as WorkflowScriptManifest } from './types-chunks/capsule.d-BuFJaYxA.js';
4
- export { C as CompactionContext, a as CompactionEntry, b as CompactionEntryPayload, c as CompactionPolicy, d as CreateWorkflowCapsuleInput, D as DefaultSummaryCompaction, e as DefaultSummaryCompactionOptions, K as KODAX_API_MIN_INTERVAL, f as KODAX_DEFAULT_TIMEOUT, g as KODAX_HARD_TIMEOUT, h as KODAX_MAX_INCOMPLETE_RETRIES, i as KODAX_MAX_MAXTOKENS_RETRIES, j as KODAX_MAX_RETRIES, k as KODAX_MAX_TOKENS, l as KODAX_RETRY_BASE_DELAY, m as KODAX_STAGGER_DELAY, L as LINEAGE_ENTRY_TYPES, n as LineageArtifactLedgerPayload, o as LineageCompaction, p as LineageCompactionDelegates, q as LineageEntryType, r as LineageExtension, s as LineageLabelPayload, t as LineageTreeNode, P as PROMISE_PATTERN, u as PolicyCompactionResult, W as WORKFLOW_CAPSULE_API_VERSION, v as WORKFLOW_CAPSULE_FORMAT, w as WORKFLOW_CAPSULE_VERSION, x as WORKFLOW_PATTERN_IDS, y as WorkflowCapsule, z as WorkflowCapsuleEnvironmentRequirement, A as WorkflowCapsuleInputs, B as WorkflowCapsuleIntent, E as WorkflowCapsuleProvenance, F as WorkflowCapsuleRequirements, G as WorkflowPatternId, H as WorkflowQualityLintFinding, I as WorkflowQualityLintOptions, J as WorkflowQualityLintSeverity, _ as _resetActiveRootQueueRoutesForTests, N as actorQueueId, O as appendSessionLineageLabel, Q as applyLineageTruncation, R as applySessionCompaction, S as archiveOldIslands, T as assertRestrictedWorkflowQuality, U as buildSessionTree, V as buildWorkflowCapsuleIntent, X as cleanupIncompleteToolCalls, Y as countActiveLineageMessages, Z as countTokens, $ as createSessionLineage, a0 as createWorkflowCapsule, a1 as createWorkflowModuleFromCapsule, a2 as estimateTokens, a3 as evictOldIslandMessageContent, a4 as extractArtifactLedger, a5 as extractFileOps, a6 as extractTitleFromMessages, a7 as findPreviousUserEntryId, a8 as forkSessionLineage, a9 as generateSessionId, aa as generateSessionIdSync, ab as getAgentConfigHome, ac as getAgentConfigPath, ad as getAppDataDir, ae as getSessionLineagePath, af as getSessionMessagesFromLineage, ag as isPathInsideDirectory, ah as lintRestrictedWorkflowSource, ai as mergeArtifactLedger, aj as mergeFileOps, ak as registerActiveRootQueueRoute, al as resolveActiveRootQueueRoute, am as resolveExecutionPath, an as resolveSessionLineageTarget, ao as rewindSessionLineage, ap as setAgentConfigHome, aq as setSessionLineageActiveEntry, ar as validateAndFixToolHistory, as as validateWorkflowCapsule, at as validateWorkflowScriptManifest } from './types-chunks/capsule.d-BuFJaYxA.js';
1
+ import { eg as Span, eB as Trace, f as Agent, bs as Handoff, e2 as RunnerToolCall, e5 as RunnerToolResult, ae as AgentMessage, ad as AgentManifest, d0 as ManifestPatch, bx as InvariantId, dP as QualityInvariant, bN as KodaXInputArtifactSource, bL as KodaXImageMediaType, cl as KodaXVideoMediaType, bG as KodaXFileInputArtifact, bK as KodaXImageInputArtifact, ck as KodaXVideoInputArtifact, bM as KodaXInputArtifact, b5 as DiscoveredInstance, ee as SessionMeta, ef as SessionStateSnapshot, eo as StateWriterFs, bw as InstanceDiscoveryFs, en as StateWriter, eq as StopHookContext, es as StopHookResult, er as StopHookFn, db as MemoryContextIdentity, dk as MemoryItemRef, c1 as KodaXSessionLineage, bU as KodaXSessionArtifactLedgerEntry, dg as MemoryEvent, dD as MemoryReviewRunner, dc as MemoryController, d1 as MemoryActionProposal, d4 as MemoryApplyResult, dv as MemoryRejectResult, dt as MemoryRefFilter, d9 as MemoryBodySnapshot, dm as MemoryLifecycleOperationResult, dd as MemoryCuratorInput, dj as MemoryGovernanceReport, d7 as MemoryAutoCuratorInput, d8 as MemoryAutoCuratorResult, dq as MemoryPackInput, dn as MemoryPack, dy as MemoryReviewInput, dC as MemoryReviewPlan, bR as KodaXMemoryOutcomeDigest, dz as MemoryReviewModelInput, df as MemoryEpisodeReviewResult, d2 as MemoryApplicability, cJ as LearningActionDriver, cT as LearningQuery, cS as LearningPage, cv as LearnedCapabilityRecord, cY as LearningSurfaceSnapshot, cO as LearningEvent, cX as LearningSubscribeOptions, cQ as LearningExplicitUserAuthority, cn as LearnedAreaStore, cy as LearnedCapabilityScope, ca as KodaXSessionStorage, a_ as CompactionUpdate, bY as KodaXSessionData, bI as KodaXGoalState, bH as KodaXGoalEventType, bZ as KodaXSessionEntry, b$ as KodaXSessionGoalEntry, aV as CompactionConfig, aW as CompactionDetails, aY as CompactionResult, bE as KodaXExtensionStore, bF as KodaXExtensionStoreEntry, bO as KodaXJsonValue, fj as WorkflowRunState, eZ as WorkflowOutcome, eK as WorkflowApi, eY as WorkflowModule, eJ as WorkflowAgentBackend, eU as WorkflowLimits, eP as WorkflowEvent, eV as WorkflowLogEvent, fp as WorkflowTaskResult, a0 as AgentExecutorPlaneStore, a$ as CreateAgentExecutorPlaneOptions, Y as AgentExecutorPlane, bf as ExternalAgentProtocol, W as AgentExecutorFactory, w as AgentBudgetExhausted, aa as AgentLimitReached } from './types-chunks/controller.d-CYNuR2n9.js';
2
+ export { A as ASK_USER_BACK_SIGNAL, a as ASK_USER_CUSTOM_INPUT_SIGNAL, b as AdmissionAuditOptions, c as AdmissionCtx, d as AdmissionVerdict, e as AdmittedHandle, g as AgentActor, h as AgentActorClient, i as AgentActorController, j as AgentActorOwner, k as AgentActorSnapshot, l as AgentActorSnapshotV1, m as AgentActorSnapshotV2, n as AgentActorState, o as AgentActorStore, p as AgentArtifactDescriptor, q as AgentArtifactPolicy, r as AgentArtifactPolicyDecision, s as AgentArtifactPolicyInput, t as AgentArtifactReference, u as AgentBudgetAdmission, v as AgentBudgetAdmissionInput, x as AgentBudgetPort, y as AgentCapabilities, z as AgentCapabilityDeclaration, B as AgentCapabilityRequirements, C as AgentContinuationInput, D as AgentControllerHealth, E as AgentControllerOptions, F as AgentCredentialBroker, G as AgentDataClassification, H as AgentDetail, I as AgentDispatchContext, J as AgentDispatchPolicy, K as AgentDispatchPolicyDecision, L as AgentDispatchPolicyInput, M as AgentDispatchabilitySnapshot, N as AgentDispatchabilityStatus, O as AgentEffectDeclaration, P as AgentEvent, Q as AgentEventKind, R as AgentExecutionInput, S as AgentExecutionKind, T as AgentExecutionResult, U as AgentExecutor, V as AgentExecutorEvent, X as AgentExecutorFactoryContext, Z as AgentExecutorPlaneBackgroundErrorContext, _ as AgentExecutorPlaneBackgroundErrorHandler, $ as AgentExecutorPlaneBinding, a1 as AgentExecutorPreflightResult, a2 as AgentExecutorProtocol, a3 as AgentExecutorTaskReference, a4 as AgentExecutorTaskSnapshot, a5 as AgentFollowupResult, a6 as AgentForkTurns, a7 as AgentInterruptScope, a8 as AgentJsonObject, a9 as AgentJsonValue, ab as AgentListEntry, ac as AgentMailboxMessage, af as AgentMetadataValue, ag as AgentMiddlewareDeclaration, ah as AgentMutationOptions, ai as AgentOutput, aj as AgentPreflightInput, ak as AgentPreflightResult, al as AgentProgressItem, am as AgentProgressKind, an as AgentProgressUpdate, ao as AgentReasoningProfile, ap as AgentRegistrationEnabledMutationOptions, aq as AgentRegistrationMutationOptions, ar as AgentRegistrationService, as as AgentSpanData, at as AgentSpawnInput, au as AgentTaskCancellation, av as AgentTaskCorrelation, aw as AgentTaskEvent, ax as AgentTaskFilter, ay as AgentTaskProgress, az as AgentTaskRegistrationSnapshot, aA as AgentTaskService, aB as AgentTaskSnapshot, aC as AgentTaskStartInput, aD as AgentTaskState, aE as AgentTaskUsage, aF as AgentTool, aG as AgentTreeSnapshot, aH as AgentTurn, aI as AgentTurnExecutor, aJ as AgentTurnRef, aK as AgentTurnState, aL as AgentTurnSummary, aM as AskUserAnswer, aN as AskUserCustomInputAnswer, aO as AskUserMultiOptions, aP as AskUserQuestionItem, aQ as AskUserQuestionOptions, aR as AskUserSelectionAnswer, aS as CapabilitySupport, aT as CommitLearnedSkillRevisionInput, aU as CompactionAnchor, aX as CompactionReport, aZ as CompactionSpanData, b0 as CreateLearnedSkillRecordInput, b1 as CurrentTodoSummary, b2 as DEFAULT_SYSTEM_CAP, b3 as DeclarativeSkillSpec, b4 as Deliverable, b6 as DiscoveryOptions, b7 as DispatchableAgentDescriptor, b8 as DispatchableAgentListing, b9 as DispatchableAgentOrigin, ba as DispatchableAgentQuery, bb as EvidenceSpanData, bc as ExactInvokedSkillSnapshot, bd as ExternalAgentEffectDeclaration, be as ExternalAgentHealth, bg as ExternalAgentRegistration, bh as ExternalAgentRegistrationSummary, bi as FanoutSpanData, bj as FileOperations, bk as GenerationSpanData, bl as Guardrail, bm as GuardrailBlockedError, bn as GuardrailContext, bo as GuardrailEscalateError, bp as GuardrailPermissionIntent, bq as GuardrailSpanData, br as GuardrailVerdict, bt as HandoffSpanData, bu as InMemorySessionOptions, bv as InputGuardrail, by as InvariantResult, bz as InvariantSession, bA as KodaXCompactMemoryProgress, bB as KodaXCompactMemorySeed, bC as KodaXExtensionSessionRecord, bD as KodaXExtensionSessionState, bJ as KodaXGoalStatus, bP as KodaXMemoryInfluenceRef, bQ as KodaXMemoryIntent, bS as KodaXMemoryOutcomeEvidence, bT as KodaXSessionArchiveMarkerEntry, bV as KodaXSessionBranchSummaryEntry, bW as KodaXSessionClientNoticeEntry, bX as KodaXSessionCompactionEntry, b_ as KodaXSessionEntryBase, c0 as KodaXSessionLabelEntry, c2 as KodaXSessionMemoryOutcomeDigestEntry, c3 as KodaXSessionMemoryReviewReceiptEntry, c4 as KodaXSessionMessageEntry, c5 as KodaXSessionMeta, c6 as KodaXSessionNavigationOptions, c7 as KodaXSessionRewindMarkerEntry, c8 as KodaXSessionRuntimeInfo, c9 as KodaXSessionScope, cb as KodaXSessionTreeNode, cc as KodaXSessionUiHistoryItem, cd as KodaXSessionUiHistoryItemType, ce as KodaXSessionUiTextHistoryItem, cf as KodaXSessionUiTextHistoryItemType, cg as KodaXSessionUiToolCall, ch as KodaXSessionUiToolCallStatus, ci as KodaXSessionUiToolGroupHistoryItem, cj as KodaXSessionWorkspaceKind, cm as LearnedAreaPaths, co as LearnedCapabilityArtifact, cp as LearnedCapabilityCanary, cq as LearnedCapabilityCanaryBinding, cr as LearnedCapabilityCanaryInvocation, cs as LearnedCapabilityCarrier, ct as LearnedCapabilityLifecycle, cu as LearnedCapabilityProvenance, cw as LearnedCapabilityRecordV1, cx as LearnedCapabilityRecordV2, cz as LearnedCapabilitySource, cA as LearnedSkillBindingAdmission, cB as LearnedSkillCanaryOutcome, cC as LearnedSkillDecisionDisposition, cD as LearnedSkillInvocationAdmission, cE as LearnedSkillInvokedReceipt, cF as LearnedSkillOfferedReceipt, cG as LearnedSkillOutcomeReceipt, cH as LearnedSkillUsageReceipt, cI as LearningAction, cK as LearningCapabilityError, cL as LearningCapabilityErrorCode, cM as LearningClientEventState, cN as LearningClientRecord, cP as LearningEventKind, cR as LearningNotificationState, cU as LearningReviewEvidencePacket, cV as LearningReviewQualification, cW as LearningReviewVerifierFact, cZ as LocalAgentTaskInput, c_ as LocalAgentTaskUpdate, c$ as MAX_TOOL_LOOP_ITERATIONS, d3 as MemoryApplyPreview, d5 as MemoryApproval, d6 as MemoryAuthority, da as MemoryClaimKind, de as MemoryDecisionTraceReceipt, dh as MemoryGovernanceFinding, di as MemoryGovernanceFindingKind, dl as MemoryLifecycle, dp as MemoryPackHint, dr as MemoryPackTraceMetadata, ds as MemoryProposalAction, du as MemoryRefKind, dw as MemoryReviewCandidateRef, dx as MemoryReviewDraftAction, dA as MemoryReviewPersistenceDecision, dB as MemoryReviewPersistenceKind, dE as MemoryReviewTrigger, dF as MemoryScope, dG as MemorySourceAdapter, dH as MemoryVisibility, dI as MessageEntry, dJ as NormalizedLearnedSkillDecision, dK as ObserveCtx, dL as OutputGuardrail, dM as PersistedSessionState, dN as PresetDispatcher, dO as PresetTracingContext, dQ as ReadonlyMutationTracker, dR as ReadonlyRecorder, dS as ReasoningDepth, dT as RecentlyModifiedFile, dU as RunEvent, dV as RunOptions, dW as RunResult, dX as RunnableTool, dY as Runner, dZ as RunnerEvent, d_ as RunnerIterationLimitError, d$ as RunnerLlmResult, e0 as RunnerLlmReturn, e1 as RunnerRecoveryTranscriptCarrier, e3 as RunnerToolContext, e4 as RunnerToolObserver, e6 as RunnerToolResultBatch, e7 as RunnerToolResultBatchTransform, e8 as Session, e9 as SessionDispatchResult, ea as SessionEntry, eb as SessionErrorMetadata, ec as SessionExtension, ed as SessionForkOptions, eh as SpanData, ei as SpanError, ej as SpanImpl, ek as SpanImplOptions, el as StagedLearnedSkillArtifact, em as StartTraceOptions, ep as StateWriterOptions, et as StopHookSpanData, eu as SystemCap, ev as TerminalCtx, ew as ToolBeforeOutcome, ex as ToolCallSpanData, ey as ToolCapability, ez as ToolGuardrail, eA as ToolPermission, eC as TraceOptions, eD as Tracer, eE as TracerOptions, eF as UnifiedLearningReviewModelInput, eG as UnifiedLearningReviewResult, eH as UnifiedLearningReviewRunner, eI as UserInteraction, eL as WorkflowApproval, eM as WorkflowApprovalSummary, eN as WorkflowArtifactRef, eO as WorkflowBudget, eQ as WorkflowEventCorrelation, eR as WorkflowEventRecorder, eS as WorkflowEventType, eT as WorkflowIsolation, eW as WorkflowMeta, eX as WorkflowModelHint, e_ as WorkflowOutcomeError, e$ as WorkflowOutcomeResult, f0 as WorkflowOutcomeStatus, f1 as WorkflowOutcomeUsage, f2 as WorkflowParallelOptions, f3 as WorkflowProcessArtifact, f4 as WorkflowProcessCounts, f5 as WorkflowProcessEvent, f6 as WorkflowProcessItem, f7 as WorkflowProcessItemKind, f8 as WorkflowProcessItemOrigin, f9 as WorkflowProcessItemStatus, fa as WorkflowProcessProgress, fb as WorkflowProcessSnapshot, fc as WorkflowProcessSource, fd as WorkflowProcessStatus, fe as WorkflowProcessSummaryStatus, ff as WorkflowProcessTokenUsage, fg as WorkflowProcessTracker, fh as WorkflowProcessTrackerOptions, fi as WorkflowRun, fk as WorkflowRunStatus, fl as WorkflowSpawnAgentInput, fm as WorkflowSynthesis, fn as WorkflowSynthesizeInput, fo as WorkflowTaskHandle, fq as WorkflowTaskSnapshot, fr as WorkflowTaskStatus, fs as WorkflowTaskSummaryEventUpdate, ft as WorkflowTaskSummaryKind, fu as WorkflowTaskSummaryUpdate, fv as WorkflowTaskUsage, fw as WorkflowTaskVerification, fx as WorkflowTaskVerificationResult, fy as WorkflowWaitOptions, fz as _resetAdmittedAgentBindings, fA as _resetPresetDispatchers, fB as admitAndRecordLearnedSkillInvocation, fC as admitLearnedSkillBinding, fD as asSingleSelection, fE as assertLearnedCapabilityTransition, fF as attachRunnerRecoveryTranscript, fG as buildAssistantMessageFromLlmResult, fH as buildSystemPrompt, fI as buildToolResultMessage, fJ as canTransitionLearnedCapability, fK as collectGuardrails, fL as commitLearnedSkillRevision, fM as completeLearnedSkillOutcome, fN as completeLearnedSkillSessionOutcomes, fO as createAgent, fP as createAgentActorController, fQ as createHandoff, fR as createInMemorySession, fS as createInvariantSessionForAgent, fT as createLearnedCapabilityScope, fU as createLearnedSkillRecord, fV as createStateWriter, fW as createTrace, fX as createWorkflowProcessTracker, fY as defaultTracer, fZ as detectInstructionsInjection, f_ as discoverInstances, f$ as eventFromCapability, g0 as exactInvokedSkillSnapshotForSession, g1 as executeRunnerToolCall, g2 as extractAssistantTextFromMessage, g3 as getActiveUserInteraction, g4 as getAdmittedAgentBindings, g5 as hashMemoryIdentityComponent, g6 as invokeLearnedSkillCanary, g7 as isAskUserCustomInputAnswer, g8 as isFinalWorkflowProcessStatus, g9 as isLearnedCapabilityRecordV2, ga as isRunnableTool, gb as isRunnerIterationLimitError, gc as isRunnerLlmResult, gd as isUnifiedLearningReviewModelInput, ge as learningEventIdFor, gf as learningEventKindForLifecycle, gg as listLearnedSkillUsageReceipts, gh as matchesMemoryApplicability, gi as memoryApplicabilityFingerprint, gj as normalizeHostMetadata, gk as normalizeUnifiedLearningReview, gl as quarantineLearnedSkillRevision, gm as readRunnerRecoveryTranscript, gn as reconcileLearnedSkillBindingOutcomes, go as recordLearnedSkillOffered, gp as registerPresetDispatcher, gq as releaseLearnedSkillBinding, gr as renderDeclarativeSkill, gs as resolveLearnedAreaPaths, gt as resolveProjectLearnedAreaRoot, gu as runAdmissionAudit, gv as runInputGuardrails, gw as runOutputGuardrails, gx as runToolAfterGuardrails, gy as runToolBeforeGuardrails, gz as sanitizeUnifiedLearningReviewInput, gA as setActiveUserInteraction, gB as setAdmittedAgentBindings, gC as slugifyLearnedCapabilityName, gD as stageLearnedSkillRevision, gE as validateDeclarativeSkillSpec } from './types-chunks/controller.d-CYNuR2n9.js';
3
+ import { M as WorkflowScriptManifest } from './types-chunks/capsule.d-B7yoH4dM.js';
4
+ export { C as CompactionContext, a as CompactionEntry, b as CompactionEntryPayload, c as CompactionPolicy, d as CreateWorkflowCapsuleInput, D as DefaultSummaryCompaction, e as DefaultSummaryCompactionOptions, K as KODAX_API_MIN_INTERVAL, f as KODAX_DEFAULT_TIMEOUT, g as KODAX_HARD_TIMEOUT, h as KODAX_MAX_INCOMPLETE_RETRIES, i as KODAX_MAX_MAXTOKENS_RETRIES, j as KODAX_MAX_RETRIES, k as KODAX_MAX_TOKENS, l as KODAX_RETRY_BASE_DELAY, m as KODAX_STAGGER_DELAY, L as LINEAGE_ENTRY_TYPES, n as LineageArtifactLedgerPayload, o as LineageCompaction, p as LineageCompactionDelegates, q as LineageEntryType, r as LineageExtension, s as LineageLabelPayload, t as LineageTreeNode, P as PROMISE_PATTERN, u as PolicyCompactionResult, W as WORKFLOW_CAPSULE_API_VERSION, v as WORKFLOW_CAPSULE_FORMAT, w as WORKFLOW_CAPSULE_VERSION, x as WORKFLOW_PATTERN_IDS, y as WorkflowCapsule, z as WorkflowCapsuleEnvironmentRequirement, A as WorkflowCapsuleInputs, B as WorkflowCapsuleIntent, E as WorkflowCapsuleProvenance, F as WorkflowCapsuleRequirements, G as WorkflowPatternId, H as WorkflowQualityLintFinding, I as WorkflowQualityLintOptions, J as WorkflowQualityLintSeverity, _ as _resetActiveRootQueueRoutesForTests, N as actorQueueId, O as appendSessionLineageLabel, Q as applyLineageTruncation, R as applySessionCompaction, S as archiveOldIslands, T as assertRestrictedWorkflowQuality, U as buildSessionTree, V as buildWorkflowCapsuleIntent, X as cleanupIncompleteToolCalls, Y as countActiveLineageMessages, Z as countTokens, $ as createSessionLineage, a0 as createWorkflowCapsule, a1 as createWorkflowModuleFromCapsule, a2 as estimateTokens, a3 as evictOldIslandMessageContent, a4 as extractArtifactLedger, a5 as extractFileOps, a6 as extractTitleFromMessages, a7 as findPreviousUserEntryId, a8 as forkSessionLineage, a9 as generateSessionId, aa as generateSessionIdSync, ab as getAgentConfigHome, ac as getAgentConfigPath, ad as getAppDataDir, ae as getSessionLineagePath, af as getSessionMessageEntryId, ag as getSessionMessagesFromLineage, ah as isPathInsideDirectory, ai as lintRestrictedWorkflowSource, aj as mergeArtifactLedger, ak as mergeFileOps, al as registerActiveRootQueueRoute, am as resolveActiveRootQueueRoute, an as resolveExecutionPath, ao as resolveSessionLineageTarget, ap as rewindSessionLineage, aq as setAgentConfigHome, ar as setSessionLineageActiveEntry, as as validateAndFixToolHistory, at as validateWorkflowCapsule, au as validateWorkflowScriptManifest } from './types-chunks/capsule.d-B7yoH4dM.js';
5
5
  import { i as KodaXImageBlock, k as KodaXMessage, a2 as KodaXToolDefinition, a7 as KodaXToolUseBlock, I as KodaXReasoningRequest, e as KodaXEphemeralSuffix, a1 as KodaXTokenUsage } from './types-chunks/types.d-CgrXrFrq.js';
6
6
  export { K as KodaXAssuranceIntent, c as KodaXContentBlock, f as KodaXExecutionMode, g as KodaXExecutionPattern, m as KodaXMutationSurface, r as KodaXProviderConfig, z as KodaXProviderStreamOptions, C as KodaXReasoningCapability, G as KodaXReasoningMode, J as KodaXRedactedThinkingBlock, M as KodaXRiskLevel, O as KodaXStreamResult, P as KodaXTaskActionability, Q as KodaXTaskBudgetOverrides, R as KodaXTaskComplexity, S as KodaXTaskFamily, T as KodaXTaskResultMetadata, U as KodaXTaskResultSource, V as KodaXTaskRoutingDecision, W as KodaXTaskType, X as KodaXTaskWorkIntent, Y as KodaXTextBlock, Z as KodaXThinkingBlock, _ as KodaXThinkingBudgetMap, $ as KodaXThinkingDepth, a3 as KodaXToolResultBlock } from './types-chunks/types.d-CgrXrFrq.js';
7
7
  import { C as CapabilityCache, b as CapabilityCacheSource } from './types-chunks/capability-learning.d-iPSiAmc_.js';
8
8
  export { a as CapabilityCacheEntry } from './types-chunks/capability-learning.d-iPSiAmc_.js';
9
9
  export { C as CapabilityKind, a as CapabilityProvider, b as CapabilityResult, c as CapabilitySearchFailure, d as CapabilitySearchFreshness, e as CapabilitySearchOptions, f as CapabilitySearchSnapshot } from './types-chunks/capability.d-K664nHOS.js';
10
10
  import { ChildProcess } from 'node:child_process';
11
- import { Q as QueueEventListener, c as QueuedMessage, E as EnqueueInput, D as DequeueFilter, a as MessagePriority, b as QueuedInputArtifact } from './types-chunks/types.d-BzpPDBPV.js';
12
- export { M as MessageMode } from './types-chunks/types.d-BzpPDBPV.js';
11
+ import { Q as QueueEventListener, c as QueuedMessage, E as EnqueueInput, D as DequeueFilter, a as MessagePriority, b as QueuedInputArtifact } from './types-chunks/types.d-DIXZFauU.js';
12
+ export { M as MessageMode } from './types-chunks/types.d-DIXZFauU.js';
13
13
  import { K as KodaXBaseProvider } from './types-chunks/base.d-DxG0m09Z.js';
14
14
  import { R as ResolvedSkillSource } from './types-chunks/types.d-BbtGlKZu.js';
15
15
  export { I as ISkillRegistry, a as IVariableResolver, L as LearnedSkillDiscoveryConfig, S as Skill, b as SkillArtifact, c as SkillContext, d as SkillDynamicContextExecutor, e as SkillFile, f as SkillFrontmatter, g as SkillHook, h as SkillHooks, i as SkillMetadata, j as SkillPathsConfig, k as SkillResult, l as SkillSource, m as getDefaultSkillPaths, n as getSkillPathsFlat } from './types-chunks/types.d-BbtGlKZu.js';
@@ -18,8 +18,8 @@ export { M as McpCapabilityDescriptor, a as McpCapabilityKind, b as McpCapabilit
18
18
  export { A as AuthorizationServerMetadata, D as DiscoveredOAuthEndpoints, M as McpAuthRequiredError, a as McpExpiredSessionError, b as McpTransport, c as McpTransportCleanupIncompleteError, d as McpTransportEvents, O as OAuthClientInfo, e as OAuthLoginConsent, P as PerformOAuthLoginOptions, f as ProtectedResourceMetadata, W as WwwAuthenticateChallenge, g as createMcpTransport, h as discoverAuthorizationServerMetadata, i as discoverOAuthEndpoints, j as discoverProtectedResourceMetadata, k as extractInsufficientScope, l as extractResourceMetadataUrl, m as loadValidToken, p as performOAuthLogin, r as registerOAuthClient } from './types-chunks/oauth-login.d-6i-vidxv.js';
19
19
  export { createMcpTestServerFixture } from './sdk-mcp.js';
20
20
  export { DiscoveryResult, ExecutionMode, ExecutionOptions, SkillExecutor, SkillExpansionResult, SkillRegistry, VariableResolver, clearPluginSkillPaths, createExecutor, createResolver, discoverSkills, discoverSkillsWithMonorepo, executeSkill, expandSkillForLLM, formatSkillActivationMessage, getNestedSkillPaths, getSkillRegistry, initializeSkillRegistry, listPluginSkillPaths, loadFullSkill, loadSkillFileContent, loadSkillMetadata, parseArguments, parseSkillMarkdown, registerPluginSkillPath, resetSkillRegistry, resolveSkillContent, unregisterPluginSkillPath } from './sdk-skills.js';
21
- export { K as KodaXSessionHistoryHit, a as KodaXSessionHistoryReadOptions, b as KodaXSessionHistoryReadResult, c as KodaXSessionHistoryScope, d as KodaXSessionHistorySearchOptions, e as KodaXSessionHistorySearchResult, f as KodaXSessionHistorySource, r as readSessionHistoryEntry, s as searchSessionHistory, g as searchSessionHistoryCooperatively, v as validateSessionHistorySearchQuery } from './types-chunks/history-retrieval.d-DImTKgO6.js';
22
- export { M as ManagedRunClassification, a as ManagedRunHooks, b as ManagedWorkflowRun, c as ManagedWorkflowSnapshot, d as ManagedWorkflowStatus, S as StartManagedRunInput, W as WorkflowProcessMetadata, e as WorkflowRunManager, f as createWorkflowRunManager, g as getDefaultWorkflowRunManager } from './types-chunks/run-manager.d-C6ahvZqK.js';
21
+ export { K as KodaXSessionHistoryHit, a as KodaXSessionHistoryReadOptions, b as KodaXSessionHistoryReadResult, c as KodaXSessionHistoryScope, d as KodaXSessionHistorySearchOptions, e as KodaXSessionHistorySearchResult, f as KodaXSessionHistorySource, r as readSessionHistoryEntry, s as searchSessionHistory, g as searchSessionHistoryCooperatively, v as validateSessionHistorySearchQuery } from './types-chunks/history-retrieval.d-BDI-ZMvY.js';
22
+ export { M as ManagedRunClassification, a as ManagedRunHooks, b as ManagedWorkflowRun, c as ManagedWorkflowSnapshot, d as ManagedWorkflowStatus, S as StartManagedRunInput, W as WorkflowProcessMetadata, e as WorkflowRunManager, f as createWorkflowRunManager, g as getDefaultWorkflowRunManager } from './types-chunks/run-manager.d-CodHf6rw.js';
23
23
 
24
24
  declare const CONTEXT_SAFETY_FLOOR_TOKENS = 2048;
25
25
  declare const CONTEXT_SAFETY_RATIO = 0.03;
@@ -1148,7 +1148,7 @@ type EnvelopeAggregateEnforcer = (fragments: readonly string[], context?: Envelo
1148
1148
  * `readonly KodaXMessage[]` (possibly empty). Callers must spread the
1149
1149
  * result into their next-iteration input.
1150
1150
  */
1151
- declare function composeIdleYieldUserMessage(wakeEvent: WakeEvent, drainBackgroundQueue: () => readonly QueuedMessage[], enforceAggregate?: EnvelopeAggregateEnforcer, onUserPrompts?: (prompts: readonly string[], queuedMessageIds: readonly string[], promptMessage: KodaXMessage) => void | Promise<void>, resolveTurnId?: () => string | undefined | Promise<string | undefined>, priorMessages?: readonly KodaXMessage[]): Promise<readonly KodaXMessage[]>;
1151
+ declare function composeIdleYieldUserMessage(wakeEvent: WakeEvent, drainBackgroundQueue: () => readonly QueuedMessage[], enforceAggregate?: EnvelopeAggregateEnforcer, onUserPrompts?: (prompts: readonly string[], queuedMessageIds: readonly string[], promptMessage: KodaXMessage, promptMessagesByQueuedId: ReadonlyMap<string, KodaXMessage>) => void | Promise<void>, resolveTurnId?: () => string | undefined | Promise<string | undefined>, priorMessages?: readonly KodaXMessage[]): Promise<readonly KodaXMessage[]>;
1152
1152
 
1153
1153
  /**
1154
1154
  * Generic outer loop for async fan-out + idle-yield resume.
@@ -1254,7 +1254,7 @@ interface RunWithIdleYieldOptions<TRunResult extends RunWithIdleYieldRunResult>
1254
1254
  * for a sub-agent reaches the agent (it answers) but never appears in the
1255
1255
  * transcript. Coding wires this to the same `onMidTurnUserMessages` UI sink.
1256
1256
  */
1257
- readonly onResumedUserPrompts?: (contents: readonly string[], queuedMessageIds: readonly string[], promptMessage: AgentMessage, runResult: TRunResult) => void | Promise<void>;
1257
+ readonly onResumedUserPrompts?: (contents: readonly string[], queuedMessageIds: readonly string[], promptMessage: AgentMessage, runResult: TRunResult, promptMessagesByQueuedId: ReadonlyMap<string, AgentMessage>) => void | Promise<void>;
1258
1258
  /**
1259
1259
  * Optional attribution hook for real user prompts spliced during an
1260
1260
  * idle-yield resume. The agent layer stays transport-agnostic; callers that
package/dist/sdk-agent.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // @kodax-ai/kodax — bundled distribution. See docs/ADR.md ADR-022 + ADR-024.
2
- import{$ as mo,$a as dr,$b as hp,$c as ht,$d as hx,A as F,Aa as Go,Ab as ke,Ac as Op,Ad as Ot,B as G,Ba as Ho,Bb as le,Bc as Pp,Bd as Pt,C as H,Ca as Oo,Cb as Qm,Cc as Qp,Cd as Qt,D as I,Da as Po,Db as Rm,Dc as Rp,Dd as Rt,E as J,Ea as Qo,Eb as Sm,Ec as Sp,Ed as St,F as K,Fa as Ro,Fb as Tm,Fc as Tp,Fd as Tt,G as L,Ga as So,Gb as Um,Gc as Up,Gd as Ut,H as M,Ha as To,Hb as Vm,Hc as Vp,Hd as Vt,I as N,Ia as Uo,Ib as Wm,Ic as Wp,Id as Wt,J as O,Ja as Vo,Jb as Xm,Jc as Xp,Jd as Xt,K as P,Ka as Wo,Kb as Ym,Kc as Yp,Kd as Yt,L as Q,La as Xo,Lb as Zm,Lc as Zp,Ld as Zt,M as R,Ma as Yo,Mb as _m,Mc as _p,Md as _t,N as S,Na as Zo,Nb as $m,Nc as $p,Nd as $t,O as T,Oa as _o,Ob as op,Oc as ot,Od as ox,P as U,Pa as $o,Pb as rp,Pc as rt,Pd as rx,Q as V,Qa as or,Qb as ep,Qc as et,Qd as ex,R as W,Ra as rr,Rb as fp,Rc as ft,Rd as fx,S as X,Sa as er,Sb as mp,Sc as mt,Sd as mx,T as Y,Ta as fr,Tb as pp,Tc as pt,Td as px,U as Z,Ua as mr,Ub as tp,Uc as tt,Ud as tx,V as _,Va as pr,Vb as xp,Vc as xt,Vd as xx,W as $,Wa as tr,Wb as ap,Wc as at,Wd as ax,X as oo,Xa as xr,Xb as bp,Xc as bt,Xd as bx,Y as ro,Ya as ar,Yb as cp,Yc as ct,Yd as cx,Z as eo,Za as br,Zb as dp,Zc as dt,Zd as dx,_ as fo,_a as cr,_b as gp,_c as gt,_d as gx,a as o,aa as po,ab as gr,ac as ip,ad as it,ae as ix,b as r,ba as to,bb as hr,bc as jp,bd as jt,be as jx,c as e,ca as xo,cb as ir,cc as kp,cd as kt,ce as kx,d as f,da as ao,db as jr,dc as lp,dd as lt,de as lx,e as m,ea as bo,eb as kr,ec as np,ed as nt,ee as nx,f as p,fa as co,fb as lr,fc as qp,fd as qt,fe as qx,g as t,ga as go,gb as Yr,gc as sp,gd as st,ge as sx,h as x,ha as ho,hb as Zr,hc as up,hd as ut,he as ux,i as a,ia as io,ib as _r,ic as vp,id as vt,ie as vx,j as b,ja as jo,jb as $r,jc as wp,jd as wt,je as wx,k as g,ka as ko,kb as oe,kc as yp,kd as yt,ke as yx,l as h,la as lo,lb as re,lc as zp,ld as zt,le as zx,m as i,ma as no,mb as ee,mc as Ap,md as At,me as Ax,n as j,na as qo,nb as fe,nc as Bp,nd as Bt,o as k,oa as so,ob as me,oc as Cp,od as Ct,p as l,pa as uo,pb as pe,pc as Dp,pd as Dt,q as u,qa as vo,qb as te,qc as Ep,qd as Et,r as v,ra as wo,rb as xe,rc as Fp,rd as Ft,s as w,sa as yo,sb as ae,sc as Gp,sd as Gt,t as y,ta as zo,tb as be,tc as Hp,td as Ht,u as z,ua as Ao,ub as ce,uc as Ip,ud as It,v as A,va as Bo,vb as de,vc as Jp,vd as Jt,w as B,wa as Co,wb as ge,wc as Kp,wd as Kt,x as C,xa as Do,xb as he,xc as Lp,xd as Lt,y as D,ya as Eo,yb as ie,yc as Mp,yd as Mt,z as E,za as Fo,zb as je,zc as Np,zd as Nt}from"./chunks/chunk-CEB5FDND.js";import{$ as ff,$a as mm,A as He,Aa as Ff,Ab as Em,B as Ie,Ba as Gf,Bb as Fm,C as Je,Ca as Hf,Cb as Gm,D as Ke,Da as If,Db as Hm,E as Le,Ea as Jf,Eb as Im,F as Me,Fa as Kf,Fb as Jm,G as Ne,Ga as Lf,Gb as Km,H as Oe,Ha as Mf,Hb as Lm,I as Pe,Ia as Nf,Ib as Mm,Ja as Of,Jb as Nm,Ka as Pf,Kb as Om,La as Qf,Lb as Pm,M as Qe,Ma as Rf,N as Re,Na as Sf,O as Se,Oa as Tf,P as Te,Pa as Uf,Q as Ue,Qa as Vf,R as Ve,Ra as Wf,S as We,Sa as Xf,T as Xe,Ta as Yf,U as Ye,Ua as Zf,V as Ze,Va as _f,W as _e,Wa as $f,X as $e,Xa as om,Y as of,Ya as rm,Z as rf,Za as em,_ as ef,_a as fm,a as c,aa as mf,ab as pm,b as d,ba as pf,bb as tm,c as n,ca as tf,cb as xm,d as q,da as xf,db as am,e as s,ea as af,eb as bm,f as Io,fa as bf,fb as cm,g as Jo,ga as cf,gb as dm,h as Ko,ha as df,hb as gm,i as Lo,ia as gf,ib as hm,j as Mo,ja as hf,k as No,ka as jf,kb as im,l as ne,la as kf,lb as jm,m as qe,ma as lf,mb as km,n as se,na as nf,nb as lm,o as ue,oa as qf,ob as nm,p as ve,pa as sf,pb as qm,q as we,qa as uf,qb as sm,r as ye,ra as vf,rb as um,s as ze,sa as wf,sb as vm,t as Ae,ta as yf,tb as wm,u as Be,ua as zf,ub as ym,v as Ce,va as Af,vb as zm,w as De,wa as Bf,wb as Am,x as Ee,xa as Cf,xb as Bm,y as Fe,ya as Df,yb as Cm,z as Ge,za as Ef,zb as Dm}from"./chunks/chunk-EVXIJPZ6.js";import{A as Sr,B as Tr,C as Ur,D as Vr,E as Wr,F as Xr,a as nr,b as qr,c as sr,d as ur,e as vr,f as wr,g as yr,h as zr,i as Ar,j as Br,k as Cr,l as Dr,m as Er,n as Fr,o as Gr,p as Hr,q as Ir,r as Jr,s as Kr,t as Lr,u as Mr,v as Nr,w as Or,x as Pr,y as Qr,z as Rr}from"./chunks/chunk-E7C4DRD2.js";import"./chunks/chunk-6UENDY33.js";import"./chunks/chunk-ONUPGMER.js";export{gr as ASK_USER_BACK_SIGNAL,hr as ASK_USER_CUSTOM_INPUT_SIGNAL,zx as AgentActorController,nx as AgentActorStoreConflictError,kx as AgentBudgetExhaustedError,dx as AgentCancellationUncertainError,wx as AgentControlError,jx as AgentLimitReachedError,qx as AgentOwnerConflictError,sx as AgentOwnerUnknownError,lx as AgentRevisionConflictError,ux as AgentSettlementPersistenceError,vx as AgentShutdownPersistenceError,cx as AgentStartUncertainError,yx as AgentTurnScheduler,Yo as BUN_BE_BUN_ENV,Oo as CAPABILITY_CACHE_FILENAME,Lp as COMPACTED_HISTORY_RECOVERY_GUIDANCE,Cp as COMPACTION_PROTECTION_RATIO,Kp as COMPACTION_SUMMARY_PREFIX,g as CONTEXT_SAFETY_FLOOR_TOKENS,h as CONTEXT_SAFETY_RATIO,Go as CORE_INVARIANTS,K as ConsoleTracingProcessor,i as ContextCapacityError,zp as DEFAULT_COMPACTION_TRIGGER_PERCENT,Gt as DEFAULT_CONTEXT_WINDOW,ee as DEFAULT_IDLE_YIELD_MAX_ITERATIONS,yt as DEFAULT_MICROCOMPACTION_CONFIG,Rp as DEFAULT_POST_COMPACT_CONFIG,sp as DEFAULT_SUMMARY_PROMPT,X as DEFAULT_SYSTEM_CAP,up as DEFAULT_UPDATE_SUMMARY_PROMPT,y as DefaultSummaryCompaction,Zo as ELECTRON_NODE_ENV_SCRUB_IMPORT,Xo as ELECTRON_RUN_AS_NODE_ENV,nm as EpisodeReviewBranchChangedError,lm as EpisodeReviewFailure,gx as ExternalAgentRegistrationConflictError,Ct as FileExtensionStore,zf as FileLearningCenterService,L as FileTracingProcessor,bo as GuardrailBlockedError,co as GuardrailEscalateError,Vo as HARDENED_ENV_VARS,Wo as HARDENING_OPT_OUT_ENV,Dr as ImageResizeError,ro as InvariantSession,a as KODAX_API_MIN_INTERVAL,r as KODAX_DEFAULT_TIMEOUT,Ur as KODAX_FILE_MEDIA_TYPES,e as KODAX_HARD_TIMEOUT,Sr as KODAX_IMAGE_MEDIA_TYPES,p as KODAX_MAX_INCOMPLETE_RETRIES,t as KODAX_MAX_MAXTOKENS_RETRIES,f as KODAX_MAX_RETRIES,o as KODAX_MAX_TOKENS,m as KODAX_RETRY_BASE_DELAY,x as KODAX_STAGGER_DELAY,Tr as KODAX_VIDEO_MEDIA_TYPES,Cr as KodaXMediaError,gp as LINEAGE_ENTRY_TYPES,vf as LearnedAreaStore,jf as LearningCapabilityError,ip as LineageCompaction,hp as LineageExtension,Bp as MAX_COMPACTION_TRIGGER_PERCENT,Jr as MAX_DIMENSION,Ie as MAX_ENTRYPOINT_BYTES,He as MAX_ENTRYPOINT_LINES,Xe as MAX_SKILL_MD_BYTES,Ye as MAX_SKILL_SUPPORT_FILE_BYTES,fo as MAX_TOOL_LOOP_ITERATIONS,ue as MEMORY_POLICY_VERSION,Ap as MIN_COMPACTION_TRIGGER_PERCENT,Xm as McpAuthRequiredError,ap as McpCapabilityProvider,Wm as McpExpiredSessionError,bp as McpManager,xp as McpServerRuntime,Ym as McpTransportCleanupIncompleteError,km as MemoryControlPlane,nr as MessageQueue,Or as PASTE_TMP_DIR_ENV,Pr as PASTE_TMP_TTL_MS,Qp as POST_COMPACT_MAX_TOKENS_PER_FILE,Pp as POST_COMPACT_TOKEN_BUDGET,b as PROMISE_PATTERN,Jp as PROTECTED_TOOL_NAMES,Yr as QueuedInputArtifactError,Bo as Runner,vo as RunnerIterationLimitError,xm as SkillExecutor,fm as SkillRegistry,z as SpanImpl,Kr as TARGET_RAW_SIZE_BYTES,I as Tracer,om as VariableResolver,Xt as WORKFLOW_CAPSULE_API_VERSION,Vt as WORKFLOW_CAPSULE_FORMAT,Wt as WORKFLOW_CAPSULE_VERSION,Nt as WORKFLOW_PATTERN_IDS,ox as WorkflowAbortError,ex as WorkflowBudgetError,Jt as WorkflowEventRecorder,rx as WorkflowLimitError,Rt as WorkflowScriptExecutionError,fx as WorkflowTaskFailedError,zr as YIELD_TOOL_NAMES,F as _emitSpanEnd,E as _emitSpanStart,G as _emitTraceEnd,D as _getRegisteredProcessors,yr as _resetActiveRootQueueRoutesForTests,V as _resetAdmissionMetrics,oo as _resetAdmittedAgentBindings,R as _resetInvariantRegistry,sr as _resetMessageQueueForTests,zo as _resetPresetDispatchers,ur as actorQueueId,B as addTracingProcessor,Tf as admitAndRecordLearnedSkillInvocation,Kf as admitLearnedSkillBinding,vt as appendGoalEntry,dt as appendMemoryClientNotice,at as appendMemoryOutcomeDigest,bt as appendMemoryReviewReceipt,_p as appendSessionLineageLabel,ot as applyLineageTruncation,M as applyManifestPatch,_o as applyProcessHardening,$p as applySessionCompaction,ff as applySkillLearningProposal,mf as approveStoredLearningProposal,xt as archiveOldIslands,jr as asSingleSelection,lf as assertLearnedCapabilityTransition,Qt as assertRestrictedWorkflowQuality,so as attachRunnerRecoveryTranscript,de as bootstrapTeamMode,xo as buildAssistantMessageFromLlmResult,vp as buildCompactionCacheInstruction,wp as buildCompactionPromptSnapshot,Up as buildFileContentMessages,tp as buildInitializeCapabilities,xe as buildOtherInstancesPromptBlock,Sp as buildPostCompactAttachments,Bt as buildRecoverySeed,pt as buildSessionTree,Ao as buildSystemPrompt,ao as buildToolResultMessage,$t as buildWorkflowCapsuleIntent,It as buildWorkflowOutcome,j as calculateContextSafetyMargin,l as calculateMaxContextInputTokens,Ve as canMarkCreatedByAgent,kf as canTransitionLearnedCapability,qm as captureEpisodeReviewBranchEpoch,um as claimEpisodeReview,he as cleanupIncompleteToolCalls,dr as cleanupRegisteredManagedChildren,To as clearCapabilityCache,Ne as clearPluginSkillPaths,go as collectGuardrails,Fp as collectUserQueryLedger,ym as commitEpisodeReviewAction,wm as commitEpisodeReviewDecision,Jf as commitLearnedSkillRevision,Op as compact,Hm as completeEpisodeReview,Dm as completeFencedEpisodeReview,Nf as completeLearnedSkillOutcome,Uf as completeLearnedSkillSessionOutcomes,re as composeIdleYieldUserMessage,N as composePatches,gf as computeSkillConsumerImpact,tt as countActiveLineageMessages,_r as countLastAssistantToolCalls,d as countTokens,u as createAgent,Ax as createAgentActorController,hx as createAgentExecutorPlane,am as createExecutor,Dt as createExtensionStore,Hr as createFileArtifactFromPath,v as createHandoff,Gr as createImageArtifactFromPath,w as createInMemorySession,eo as createInvariantSessionForAgent,Ef as createLearnedCapabilityScope,Qf as createLearnedSkillActionDriver,If as createLearnedSkillRecord,Af as createLearningCenterService,le as createLlmJudgedStopHook,Rm as createMcpCapabilityId,cp as createMcpManager,dp as createMcpTestServerFixture,Zm as createMcpTransport,bx as createMemoryAgentExecutorPlaneStore,jm as createMemoryControlPlane,ix as createReferenceAgentExecutorFactory,rm as createResolver,Ut as createRestrictedWorkflowModule,Vp as createSessionLineage,pe as createStateWriter,A as createTrace,Ir as createVideoArtifactFromPath,Zt as createWorkflowCapsule,_t as createWorkflowModuleFromCapsule,Mt as createWorkflowProcessTracker,xx as createWorkflowRunManager,px as createWorkflowRuntime,We as decideSkillGovernance,Qm as defaultMcpCacheDir,J as defaultTracer,Cm as deferEpisodeReview,lo as detectHandoffSignal,$r as detectIdleYield,Y as detectInstructionsInjection,Em as discardFencedEpisodeReview,rp as discoverAuthorizationServerMetadata,te as discoverInstances,ep as discoverOAuthEndpoints,op as discoverProtectedResourceMetadata,Yf as discoverSkills,_f as discoverSkillsWithMonorepo,hm as dispatchSkillCreatorTool,Mm as drainPendingEpisodeReviews,ie as editDistance,qo as emitHandoffSpan,q as emitKodaXDiagnostic,Xr as enqueueWithArtifacts,c as estimateTokens,wf as eventFromCapability,rt as evictOldIslandMessageContent,Do as evidenceTrail,Xf as exactInvokedSkillSnapshotForSession,k as exceedsContextCapacity,to as executeRunnerToolCall,bm as executeSkill,cm as expandSkillForLLM,lp as extractArtifactLedger,Co as extractAssistantTextFromMessage,jp as extractFileOps,$m as extractInsufficientScope,_m as extractResourceMetadataUrl,it as extractTitleFromMessages,Bm as failEpisodeReviewApply,Am as failEpisodeReviewAttempt,Km as fencePendingEpisodeReviewsForSession,Eo as finalOwner,je as findFuzzyToolMatch,et as findPreviousUserEntryId,mt as forkSessionLineage,s as formatKodaXDiagnostic,dm as formatSkillActivationMessage,vm as freezeEpisodeReviewInput,ht as generateSessionId,gt as generateSessionIdSync,yp as generateSummary,ct as getActiveMemoryOutcomeReviewIds,be as getActiveTeamModeWriter,lr as getActiveUserInteraction,U as getAdmissionMetricsSnapshot,$ as getAdmittedAgentBindings,Jo as getAgentConfigHome,Ko as getAgentConfigPath,No as getAppDataDir,Ro as getCachedRejectedEfforts,Po as getCapabilityCacheFile,Oe as getDefaultSkillPaths,ax as getDefaultWorkflowRunManager,P as getInvariant,Bf as getLearnedExtensionToolName,Vm as getMcpCachePaths,qr as getMessageQueue,Vr as getModelInputCapabilities,Zf as getNestedSkillPaths,Wp as getSessionLineagePath,Xp as getSessionMessagesFromLineage,Pe as getSkillPathsFlat,mm as getSkillRegistry,Ft as gracefulCompactDegradation,Fo as handoffLegality,we as hashCwd,qe as hashMemoryIdentityComponent,Er as inferImageMediaType,Fr as inferVideoMediaType,pm as initializeSkillRegistry,Tp as injectPostCompactAttachments,Fm as inspectEpisodeReviewJob,Mf as invokeLearnedSkillCanary,ke as invokeLlmJudge,W as isAdmissionDebugEnabled,ir as isAskUserCustomInputAnswer,Ce as isAutoManagedMemoryFile,er as isChildProcessExited,Mp as isEmptyLikeSummary,Kt as isFinalWorkflowProcessStatus,wt as isGoalEntry,Zr as isIdleYieldEnabled,Pf as isLearnedCapabilityRecordV2,Cf as isLearnedExtensionCommandAllowed,Lo as isPathInsideDirectory,mo as isRunnableTool,wo as isRunnerIterationLimitError,po as isRunnerLlmResult,gm as isSkillCreatorDispatchAction,Om as isUnifiedLearningReviewModelInput,ar as killChildProcessTree,br as killChildProcessTreeSync,tr as killPidTree,xr as killPidTreeSync,sf as learningEventIdFor,qf as learningEventKindForLifecycle,Pt as lintRestrictedWorkflowSource,Wf as listLearnedSkillUsageReceipts,Gm as listPendingEpisodeReviews,Me as listPluginSkillPaths,Q as listRegisteredInvariants,Qo as loadCapabilityCache,Se as loadFullSkill,Te as loadSkillFileContent,Re as loadSkillMetadata,pp as loadValidToken,ne as matchesMemoryApplicability,Br as maybeDrainMidTurn,se as memoryApplicabilityFingerprint,np as mergeArtifactLedger,kp as mergeFileOps,Gp as mergeUserQueryLedger,zt as microcompact,Ar as midTurnDrainPriority,Rf as migrateLegacyLearnedSkillsForProject,Np as needsCompaction,Dp as normalizeCompactionConfig,Lt as normalizeHostMetadata,Sm as normalizeMcpCapabilityId,Lr as normalizePastedImage,At as normalizeRecoveryPrompt,Pm as normalizeUnifiedLearningReview,mx as normalizeWorkflowLimits,$f as parseArguments,Tm as parseMcpCapabilityId,Fe as parseMemoryFile,Ee as parseMemoryType,De as parseMemoryTypeFromFilename,Ge as parseScalarFields,Qe as parseSkillMarkdown,Ip as parseUserQueryLedger,mp as performOAuthLogin,qt as persistCompactedSessionHistory,Qr as persistImageAsBlock,sm as persistPendingEpisodeReview,$o as prepareInternalNodeLaunch,or as prepareJavaScriptChildLaunch,yf as projectLearningProposals,Rr as prunePasteTmpDir,Of as quarantineLearnedSkillRevision,Nr as readAndNormalizeClipboardImage,Mr as readClipboardImage,st as readLatestGoalFromBranch,ut as readLatestGoalState,$e as readLearningProposalStore,mr as readProcessStartIdentity,uo as readRunnerRecoveryTranscript,nt as readSessionHistoryEntry,cf as readSkillTrustLedger,af as readSkillUsageLedger,Vf as reconcileLearnedSkillBindingOutcomes,hf as recordCompletedTurnLearning,Sf as recordLearnedSkillOffered,pf as recordProceduralLearning,So as recordRejectedEffort,bf as recordSkillUsage,vr as registerActiveRootQueueRoute,Ho as registerCoreInvariants,O as registerInvariant,cr as registerManagedChildProcess,fp as registerOAuthClient,Ke as registerPluginSkillPath,yo as registerPresetDispatcher,Lf as releaseLearnedSkillBinding,pr as rememberChildProcessTree,Gf as renderDeclarativeSkill,Hp as renderUserQueryLedger,no as replaceSystemMessage,Uo as resetCapabilityCacheMemoForTesting,tm as resetSkillRegistry,wr as resolveActiveRootQueueRoute,Ep as resolveCompactionPolicy,Ht as resolveContextWindow,T as resolveEffectiveInvariants,Mo as resolveExecutionPath,uf as resolveLearnedAreaPaths,rf as resolveLearningProposalStore,Ae as resolveMemoryEntrypoint,ze as resolveMemoryRoot,Df as resolveProjectLearnedAreaRoot,S as resolveRequiredInvariants,Be as resolveScopedMemoryRoot,Yp as resolveSessionLineageTarget,em as resolveSkillContent,Ze as resolveSkillSnapshotLocation,xf as resolveSkillTrustLedger,tf as resolveSkillUsageLedger,Im as rewindPendingEpisodeReviews,Jm as rewindPendingEpisodeReviewsForSession,ft as rewindSessionLineage,Z as runAdmissionAudit,me as runFanOut,ho as runInputGuardrails,io as runOutputGuardrails,Tt as runRestrictedWorkflowScript,ko as runToolAfterGuardrails,jo as runToolBeforeGuardrails,fe as runWithIdleYield,tx as runWorkflow,ve as sanitizeProjectKey,im as sanitizePromptSafeMemoryClaim,Nm as sanitizeUnifiedLearningReviewInput,Um as searchMcpCatalog,jt as searchSessionHistory,lt as searchSessionHistoryCooperatively,qp as serializeConversation,ae as setActiveTeamModeWriter,kr as setActiveUserInteraction,_ as setAdmittedAgentBindings,Io as setAgentConfigHome,n as setKodaXDiagnosticSink,Zp as setSessionLineageActiveEntry,C as setTracingProcessors,Et as shouldCompact,H as shutdownTracing,nf as slugifyLearnedCapabilityName,Hf as stageLearnedSkillRevision,rr as stripHardenedEnvVars,Ue as triageProceduralLearning,Je as truncateEntrypointContent,ye as tryGitRemote,Le as unregisterPluginSkillPath,ce as updateActiveTeamMode,ef as updateLearningProposalStatus,df as updateSkillTrustLedger,of as upsertLearningProposal,ge as validateAndFixToolHistory,Ff as validateDeclarativeSkillSpec,Wr as validateInputArtifactsForModel,St as validateRestrictedWorkflowSource,kt as validateSessionHistorySearchQuery,Yt as validateWorkflowCapsule,Ot as validateWorkflowScriptManifest,fr as waitForChildProcessExit,oe as waitForWakeEvent,zm as withEpisodeReviewClaimAuthority,_e as withKodaXFileLock,Lm as withPendingEpisodeReviewSessionFence};
2
+ import{$ as mo,$a as dr,$b as hp,$c as ht,$d as hx,A as F,Aa as Go,Ab as ke,Ac as Op,Ad as Ot,B as G,Ba as Ho,Bb as le,Bc as Pp,Bd as Pt,C as H,Ca as Oo,Cb as Qm,Cc as Qp,Cd as Qt,D as I,Da as Po,Db as Rm,Dc as Rp,Dd as Rt,E as J,Ea as Qo,Eb as Sm,Ec as Sp,Ed as St,F as K,Fa as Ro,Fb as Tm,Fc as Tp,Fd as Tt,G as L,Ga as So,Gb as Um,Gc as Up,Gd as Ut,H as M,Ha as To,Hb as Vm,Hc as Vp,Hd as Vt,I as N,Ia as Uo,Ib as Wm,Ic as Wp,Id as Wt,J as O,Ja as Vo,Jb as Xm,Jc as Xp,Jd as Xt,K as P,Ka as Wo,Kb as Ym,Kc as Yp,Kd as Yt,L as Q,La as Xo,Lb as Zm,Lc as Zp,Ld as Zt,M as R,Ma as Yo,Mb as _m,Mc as _p,Md as _t,N as S,Na as Zo,Nb as $m,Nc as $p,Nd as $t,O as T,Oa as _o,Ob as op,Oc as ot,Od as ox,P as U,Pa as $o,Pb as rp,Pc as rt,Pd as rx,Q as V,Qa as or,Qb as ep,Qc as et,Qd as ex,R as W,Ra as rr,Rb as fp,Rc as ft,Rd as fx,S as X,Sa as er,Sb as mp,Sc as mt,Sd as mx,T as Y,Ta as fr,Tb as pp,Tc as pt,Td as px,U as Z,Ua as mr,Ub as tp,Uc as tt,Ud as tx,V as _,Va as pr,Vb as xp,Vc as xt,Vd as xx,W as $,Wa as tr,Wb as ap,Wc as at,Wd as ax,X as oo,Xa as xr,Xb as bp,Xc as bt,Xd as bx,Y as ro,Ya as ar,Yb as cp,Yc as ct,Yd as cx,Z as eo,Za as br,Zb as dp,Zc as dt,Zd as dx,_ as fo,_a as cr,_b as gp,_c as gt,_d as gx,a as o,aa as po,ab as gr,ac as ip,ad as it,ae as ix,b as r,ba as to,bb as hr,bc as jp,bd as jt,be as jx,c as e,ca as xo,cb as ir,cc as kp,cd as kt,ce as kx,d as f,da as ao,db as jr,dc as lp,dd as lt,de as lx,e as m,ea as bo,eb as kr,ec as np,ed as nt,ee as nx,f as p,fa as co,fb as lr,fc as qp,fd as qt,fe as qx,g as t,ga as go,gb as Yr,gc as sp,gd as st,ge as sx,h as x,ha as ho,hb as Zr,hc as up,hd as ut,he as ux,i as a,ia as io,ib as _r,ic as vp,id as vt,ie as vx,j as b,ja as jo,jb as $r,jc as wp,jd as wt,je as wx,k as g,ka as ko,kb as oe,kc as yp,kd as yt,ke as yx,l as h,la as lo,lb as re,lc as zp,ld as zt,le as zx,m as i,ma as no,mb as ee,mc as Ap,md as At,me as Ax,n as j,na as qo,nb as fe,nc as Bp,nd as Bt,ne as Bx,o as k,oa as so,ob as me,oc as Cp,od as Ct,p as l,pa as uo,pb as pe,pc as Dp,pd as Dt,q as u,qa as vo,qb as te,qc as Ep,qd as Et,r as v,ra as wo,rb as xe,rc as Fp,rd as Ft,s as w,sa as yo,sb as ae,sc as Gp,sd as Gt,t as y,ta as zo,tb as be,tc as Hp,td as Ht,u as z,ua as Ao,ub as ce,uc as Ip,ud as It,v as A,va as Bo,vb as de,vc as Jp,vd as Jt,w as B,wa as Co,wb as ge,wc as Kp,wd as Kt,x as C,xa as Do,xb as he,xc as Lp,xd as Lt,y as D,ya as Eo,yb as ie,yc as Mp,yd as Mt,z as E,za as Fo,zb as je,zc as Np,zd as Nt}from"./chunks/chunk-WMYCNECP.js";import{$ as ff,$a as mm,A as He,Aa as Ff,Ab as Em,B as Ie,Ba as Gf,Bb as Fm,C as Je,Ca as Hf,Cb as Gm,D as Ke,Da as If,Db as Hm,E as Le,Ea as Jf,Eb as Im,F as Me,Fa as Kf,Fb as Jm,G as Ne,Ga as Lf,Gb as Km,H as Oe,Ha as Mf,Hb as Lm,I as Pe,Ia as Nf,Ib as Mm,Ja as Of,Jb as Nm,Ka as Pf,Kb as Om,La as Qf,Lb as Pm,M as Qe,Ma as Rf,N as Re,Na as Sf,O as Se,Oa as Tf,P as Te,Pa as Uf,Q as Ue,Qa as Vf,R as Ve,Ra as Wf,S as We,Sa as Xf,T as Xe,Ta as Yf,U as Ye,Ua as Zf,V as Ze,Va as _f,W as _e,Wa as $f,X as $e,Xa as om,Y as of,Ya as rm,Z as rf,Za as em,_ as ef,_a as fm,a as c,aa as mf,ab as pm,b as d,ba as pf,bb as tm,c as n,ca as tf,cb as xm,d as q,da as xf,db as am,e as s,ea as af,eb as bm,f as Io,fa as bf,fb as cm,g as Jo,ga as cf,gb as dm,h as Ko,ha as df,hb as gm,i as Lo,ia as gf,ib as hm,j as Mo,ja as hf,k as No,ka as jf,kb as im,l as ne,la as kf,lb as jm,m as qe,ma as lf,mb as km,n as se,na as nf,nb as lm,o as ue,oa as qf,ob as nm,p as ve,pa as sf,pb as qm,q as we,qa as uf,qb as sm,r as ye,ra as vf,rb as um,s as ze,sa as wf,sb as vm,t as Ae,ta as yf,tb as wm,u as Be,ua as zf,ub as ym,v as Ce,va as Af,vb as zm,w as De,wa as Bf,wb as Am,x as Ee,xa as Cf,xb as Bm,y as Fe,ya as Df,yb as Cm,z as Ge,za as Ef,zb as Dm}from"./chunks/chunk-EVXIJPZ6.js";import{A as Sr,B as Tr,C as Ur,D as Vr,E as Wr,F as Xr,a as nr,b as qr,c as sr,d as ur,e as vr,f as wr,g as yr,h as zr,i as Ar,j as Br,k as Cr,l as Dr,m as Er,n as Fr,o as Gr,p as Hr,q as Ir,r as Jr,s as Kr,t as Lr,u as Mr,v as Nr,w as Or,x as Pr,y as Qr,z as Rr}from"./chunks/chunk-E7C4DRD2.js";import"./chunks/chunk-6UENDY33.js";import"./chunks/chunk-ONUPGMER.js";export{gr as ASK_USER_BACK_SIGNAL,hr as ASK_USER_CUSTOM_INPUT_SIGNAL,Ax as AgentActorController,qx as AgentActorStoreConflictError,lx as AgentBudgetExhaustedError,gx as AgentCancellationUncertainError,yx as AgentControlError,kx as AgentLimitReachedError,sx as AgentOwnerConflictError,ux as AgentOwnerUnknownError,nx as AgentRevisionConflictError,vx as AgentSettlementPersistenceError,wx as AgentShutdownPersistenceError,dx as AgentStartUncertainError,zx as AgentTurnScheduler,Yo as BUN_BE_BUN_ENV,Oo as CAPABILITY_CACHE_FILENAME,Lp as COMPACTED_HISTORY_RECOVERY_GUIDANCE,Cp as COMPACTION_PROTECTION_RATIO,Kp as COMPACTION_SUMMARY_PREFIX,g as CONTEXT_SAFETY_FLOOR_TOKENS,h as CONTEXT_SAFETY_RATIO,Go as CORE_INVARIANTS,K as ConsoleTracingProcessor,i as ContextCapacityError,zp as DEFAULT_COMPACTION_TRIGGER_PERCENT,Ht as DEFAULT_CONTEXT_WINDOW,ee as DEFAULT_IDLE_YIELD_MAX_ITERATIONS,zt as DEFAULT_MICROCOMPACTION_CONFIG,Rp as DEFAULT_POST_COMPACT_CONFIG,sp as DEFAULT_SUMMARY_PROMPT,X as DEFAULT_SYSTEM_CAP,up as DEFAULT_UPDATE_SUMMARY_PROMPT,y as DefaultSummaryCompaction,Zo as ELECTRON_NODE_ENV_SCRUB_IMPORT,Xo as ELECTRON_RUN_AS_NODE_ENV,nm as EpisodeReviewBranchChangedError,lm as EpisodeReviewFailure,hx as ExternalAgentRegistrationConflictError,Dt as FileExtensionStore,zf as FileLearningCenterService,L as FileTracingProcessor,bo as GuardrailBlockedError,co as GuardrailEscalateError,Vo as HARDENED_ENV_VARS,Wo as HARDENING_OPT_OUT_ENV,Dr as ImageResizeError,ro as InvariantSession,a as KODAX_API_MIN_INTERVAL,r as KODAX_DEFAULT_TIMEOUT,Ur as KODAX_FILE_MEDIA_TYPES,e as KODAX_HARD_TIMEOUT,Sr as KODAX_IMAGE_MEDIA_TYPES,p as KODAX_MAX_INCOMPLETE_RETRIES,t as KODAX_MAX_MAXTOKENS_RETRIES,f as KODAX_MAX_RETRIES,o as KODAX_MAX_TOKENS,m as KODAX_RETRY_BASE_DELAY,x as KODAX_STAGGER_DELAY,Tr as KODAX_VIDEO_MEDIA_TYPES,Cr as KodaXMediaError,gp as LINEAGE_ENTRY_TYPES,vf as LearnedAreaStore,jf as LearningCapabilityError,ip as LineageCompaction,hp as LineageExtension,Bp as MAX_COMPACTION_TRIGGER_PERCENT,Jr as MAX_DIMENSION,Ie as MAX_ENTRYPOINT_BYTES,He as MAX_ENTRYPOINT_LINES,Xe as MAX_SKILL_MD_BYTES,Ye as MAX_SKILL_SUPPORT_FILE_BYTES,fo as MAX_TOOL_LOOP_ITERATIONS,ue as MEMORY_POLICY_VERSION,Ap as MIN_COMPACTION_TRIGGER_PERCENT,Xm as McpAuthRequiredError,ap as McpCapabilityProvider,Wm as McpExpiredSessionError,bp as McpManager,xp as McpServerRuntime,Ym as McpTransportCleanupIncompleteError,km as MemoryControlPlane,nr as MessageQueue,Or as PASTE_TMP_DIR_ENV,Pr as PASTE_TMP_TTL_MS,Qp as POST_COMPACT_MAX_TOKENS_PER_FILE,Pp as POST_COMPACT_TOKEN_BUDGET,b as PROMISE_PATTERN,Jp as PROTECTED_TOOL_NAMES,Yr as QueuedInputArtifactError,Bo as Runner,vo as RunnerIterationLimitError,xm as SkillExecutor,fm as SkillRegistry,z as SpanImpl,Kr as TARGET_RAW_SIZE_BYTES,I as Tracer,om as VariableResolver,Yt as WORKFLOW_CAPSULE_API_VERSION,Wt as WORKFLOW_CAPSULE_FORMAT,Xt as WORKFLOW_CAPSULE_VERSION,Ot as WORKFLOW_PATTERN_IDS,rx as WorkflowAbortError,fx as WorkflowBudgetError,Kt as WorkflowEventRecorder,ex as WorkflowLimitError,St as WorkflowScriptExecutionError,mx as WorkflowTaskFailedError,zr as YIELD_TOOL_NAMES,F as _emitSpanEnd,E as _emitSpanStart,G as _emitTraceEnd,D as _getRegisteredProcessors,yr as _resetActiveRootQueueRoutesForTests,V as _resetAdmissionMetrics,oo as _resetAdmittedAgentBindings,R as _resetInvariantRegistry,sr as _resetMessageQueueForTests,zo as _resetPresetDispatchers,ur as actorQueueId,B as addTracingProcessor,Tf as admitAndRecordLearnedSkillInvocation,Kf as admitLearnedSkillBinding,wt as appendGoalEntry,gt as appendMemoryClientNotice,bt as appendMemoryOutcomeDigest,ct as appendMemoryReviewReceipt,$p as appendSessionLineageLabel,rt as applyLineageTruncation,M as applyManifestPatch,_o as applyProcessHardening,ot as applySessionCompaction,ff as applySkillLearningProposal,mf as approveStoredLearningProposal,at as archiveOldIslands,jr as asSingleSelection,lf as assertLearnedCapabilityTransition,Rt as assertRestrictedWorkflowQuality,so as attachRunnerRecoveryTranscript,de as bootstrapTeamMode,xo as buildAssistantMessageFromLlmResult,vp as buildCompactionCacheInstruction,wp as buildCompactionPromptSnapshot,Up as buildFileContentMessages,tp as buildInitializeCapabilities,xe as buildOtherInstancesPromptBlock,Sp as buildPostCompactAttachments,Ct as buildRecoverySeed,tt as buildSessionTree,Ao as buildSystemPrompt,ao as buildToolResultMessage,ox as buildWorkflowCapsuleIntent,Jt as buildWorkflowOutcome,j as calculateContextSafetyMargin,l as calculateMaxContextInputTokens,Ve as canMarkCreatedByAgent,kf as canTransitionLearnedCapability,qm as captureEpisodeReviewBranchEpoch,um as claimEpisodeReview,he as cleanupIncompleteToolCalls,dr as cleanupRegisteredManagedChildren,To as clearCapabilityCache,Ne as clearPluginSkillPaths,go as collectGuardrails,Fp as collectUserQueryLedger,ym as commitEpisodeReviewAction,wm as commitEpisodeReviewDecision,Jf as commitLearnedSkillRevision,Op as compact,Hm as completeEpisodeReview,Dm as completeFencedEpisodeReview,Nf as completeLearnedSkillOutcome,Uf as completeLearnedSkillSessionOutcomes,re as composeIdleYieldUserMessage,N as composePatches,gf as computeSkillConsumerImpact,xt as countActiveLineageMessages,_r as countLastAssistantToolCalls,d as countTokens,u as createAgent,Bx as createAgentActorController,ix as createAgentExecutorPlane,am as createExecutor,Et as createExtensionStore,Hr as createFileArtifactFromPath,v as createHandoff,Gr as createImageArtifactFromPath,w as createInMemorySession,eo as createInvariantSessionForAgent,Ef as createLearnedCapabilityScope,Qf as createLearnedSkillActionDriver,If as createLearnedSkillRecord,Af as createLearningCenterService,le as createLlmJudgedStopHook,Rm as createMcpCapabilityId,cp as createMcpManager,dp as createMcpTestServerFixture,Zm as createMcpTransport,cx as createMemoryAgentExecutorPlaneStore,jm as createMemoryControlPlane,jx as createReferenceAgentExecutorFactory,rm as createResolver,Vt as createRestrictedWorkflowModule,Wp as createSessionLineage,pe as createStateWriter,A as createTrace,Ir as createVideoArtifactFromPath,_t as createWorkflowCapsule,$t as createWorkflowModuleFromCapsule,Nt as createWorkflowProcessTracker,ax as createWorkflowRunManager,tx as createWorkflowRuntime,We as decideSkillGovernance,Qm as defaultMcpCacheDir,J as defaultTracer,Cm as deferEpisodeReview,lo as detectHandoffSignal,$r as detectIdleYield,Y as detectInstructionsInjection,Em as discardFencedEpisodeReview,rp as discoverAuthorizationServerMetadata,te as discoverInstances,ep as discoverOAuthEndpoints,op as discoverProtectedResourceMetadata,Yf as discoverSkills,_f as discoverSkillsWithMonorepo,hm as dispatchSkillCreatorTool,Mm as drainPendingEpisodeReviews,ie as editDistance,qo as emitHandoffSpan,q as emitKodaXDiagnostic,Xr as enqueueWithArtifacts,c as estimateTokens,wf as eventFromCapability,et as evictOldIslandMessageContent,Do as evidenceTrail,Xf as exactInvokedSkillSnapshotForSession,k as exceedsContextCapacity,to as executeRunnerToolCall,bm as executeSkill,cm as expandSkillForLLM,lp as extractArtifactLedger,Co as extractAssistantTextFromMessage,jp as extractFileOps,$m as extractInsufficientScope,_m as extractResourceMetadataUrl,jt as extractTitleFromMessages,Bm as failEpisodeReviewApply,Am as failEpisodeReviewAttempt,Km as fencePendingEpisodeReviewsForSession,Eo as finalOwner,je as findFuzzyToolMatch,ft as findPreviousUserEntryId,pt as forkSessionLineage,s as formatKodaXDiagnostic,dm as formatSkillActivationMessage,vm as freezeEpisodeReviewInput,it as generateSessionId,ht as generateSessionIdSync,yp as generateSummary,dt as getActiveMemoryOutcomeReviewIds,be as getActiveTeamModeWriter,lr as getActiveUserInteraction,U as getAdmissionMetricsSnapshot,$ as getAdmittedAgentBindings,Jo as getAgentConfigHome,Ko as getAgentConfigPath,No as getAppDataDir,Ro as getCachedRejectedEfforts,Po as getCapabilityCacheFile,Oe as getDefaultSkillPaths,bx as getDefaultWorkflowRunManager,P as getInvariant,Bf as getLearnedExtensionToolName,Vm as getMcpCachePaths,qr as getMessageQueue,Vr as getModelInputCapabilities,Zf as getNestedSkillPaths,Xp as getSessionLineagePath,Vp as getSessionMessageEntryId,Yp as getSessionMessagesFromLineage,Pe as getSkillPathsFlat,mm as getSkillRegistry,Gt as gracefulCompactDegradation,Fo as handoffLegality,we as hashCwd,qe as hashMemoryIdentityComponent,Er as inferImageMediaType,Fr as inferVideoMediaType,pm as initializeSkillRegistry,Tp as injectPostCompactAttachments,Fm as inspectEpisodeReviewJob,Mf as invokeLearnedSkillCanary,ke as invokeLlmJudge,W as isAdmissionDebugEnabled,ir as isAskUserCustomInputAnswer,Ce as isAutoManagedMemoryFile,er as isChildProcessExited,Mp as isEmptyLikeSummary,Lt as isFinalWorkflowProcessStatus,yt as isGoalEntry,Zr as isIdleYieldEnabled,Pf as isLearnedCapabilityRecordV2,Cf as isLearnedExtensionCommandAllowed,Lo as isPathInsideDirectory,mo as isRunnableTool,wo as isRunnerIterationLimitError,po as isRunnerLlmResult,gm as isSkillCreatorDispatchAction,Om as isUnifiedLearningReviewModelInput,ar as killChildProcessTree,br as killChildProcessTreeSync,tr as killPidTree,xr as killPidTreeSync,sf as learningEventIdFor,qf as learningEventKindForLifecycle,Qt as lintRestrictedWorkflowSource,Wf as listLearnedSkillUsageReceipts,Gm as listPendingEpisodeReviews,Me as listPluginSkillPaths,Q as listRegisteredInvariants,Qo as loadCapabilityCache,Se as loadFullSkill,Te as loadSkillFileContent,Re as loadSkillMetadata,pp as loadValidToken,ne as matchesMemoryApplicability,Br as maybeDrainMidTurn,se as memoryApplicabilityFingerprint,np as mergeArtifactLedger,kp as mergeFileOps,Gp as mergeUserQueryLedger,At as microcompact,Ar as midTurnDrainPriority,Rf as migrateLegacyLearnedSkillsForProject,Np as needsCompaction,Dp as normalizeCompactionConfig,Mt as normalizeHostMetadata,Sm as normalizeMcpCapabilityId,Lr as normalizePastedImage,Bt as normalizeRecoveryPrompt,Pm as normalizeUnifiedLearningReview,px as normalizeWorkflowLimits,$f as parseArguments,Tm as parseMcpCapabilityId,Fe as parseMemoryFile,Ee as parseMemoryType,De as parseMemoryTypeFromFilename,Ge as parseScalarFields,Qe as parseSkillMarkdown,Ip as parseUserQueryLedger,mp as performOAuthLogin,st as persistCompactedSessionHistory,Qr as persistImageAsBlock,sm as persistPendingEpisodeReview,$o as prepareInternalNodeLaunch,or as prepareJavaScriptChildLaunch,yf as projectLearningProposals,Rr as prunePasteTmpDir,Of as quarantineLearnedSkillRevision,Nr as readAndNormalizeClipboardImage,Mr as readClipboardImage,ut as readLatestGoalFromBranch,vt as readLatestGoalState,$e as readLearningProposalStore,mr as readProcessStartIdentity,uo as readRunnerRecoveryTranscript,qt as readSessionHistoryEntry,cf as readSkillTrustLedger,af as readSkillUsageLedger,Vf as reconcileLearnedSkillBindingOutcomes,hf as recordCompletedTurnLearning,Sf as recordLearnedSkillOffered,pf as recordProceduralLearning,So as recordRejectedEffort,bf as recordSkillUsage,vr as registerActiveRootQueueRoute,Ho as registerCoreInvariants,O as registerInvariant,cr as registerManagedChildProcess,fp as registerOAuthClient,Ke as registerPluginSkillPath,yo as registerPresetDispatcher,Lf as releaseLearnedSkillBinding,pr as rememberChildProcessTree,Gf as renderDeclarativeSkill,Hp as renderUserQueryLedger,no as replaceSystemMessage,Uo as resetCapabilityCacheMemoForTesting,tm as resetSkillRegistry,wr as resolveActiveRootQueueRoute,Ep as resolveCompactionPolicy,It as resolveContextWindow,T as resolveEffectiveInvariants,Mo as resolveExecutionPath,uf as resolveLearnedAreaPaths,rf as resolveLearningProposalStore,Ae as resolveMemoryEntrypoint,ze as resolveMemoryRoot,Df as resolveProjectLearnedAreaRoot,S as resolveRequiredInvariants,Be as resolveScopedMemoryRoot,Zp as resolveSessionLineageTarget,em as resolveSkillContent,Ze as resolveSkillSnapshotLocation,xf as resolveSkillTrustLedger,tf as resolveSkillUsageLedger,Im as rewindPendingEpisodeReviews,Jm as rewindPendingEpisodeReviewsForSession,mt as rewindSessionLineage,Z as runAdmissionAudit,me as runFanOut,ho as runInputGuardrails,io as runOutputGuardrails,Ut as runRestrictedWorkflowScript,ko as runToolAfterGuardrails,jo as runToolBeforeGuardrails,fe as runWithIdleYield,xx as runWorkflow,ve as sanitizeProjectKey,im as sanitizePromptSafeMemoryClaim,Nm as sanitizeUnifiedLearningReviewInput,Um as searchMcpCatalog,kt as searchSessionHistory,nt as searchSessionHistoryCooperatively,qp as serializeConversation,ae as setActiveTeamModeWriter,kr as setActiveUserInteraction,_ as setAdmittedAgentBindings,Io as setAgentConfigHome,n as setKodaXDiagnosticSink,_p as setSessionLineageActiveEntry,C as setTracingProcessors,Ft as shouldCompact,H as shutdownTracing,nf as slugifyLearnedCapabilityName,Hf as stageLearnedSkillRevision,rr as stripHardenedEnvVars,Ue as triageProceduralLearning,Je as truncateEntrypointContent,ye as tryGitRemote,Le as unregisterPluginSkillPath,ce as updateActiveTeamMode,ef as updateLearningProposalStatus,df as updateSkillTrustLedger,of as upsertLearningProposal,ge as validateAndFixToolHistory,Ff as validateDeclarativeSkillSpec,Wr as validateInputArtifactsForModel,Tt as validateRestrictedWorkflowSource,lt as validateSessionHistorySearchQuery,Zt as validateWorkflowCapsule,Pt as validateWorkflowScriptManifest,fr as waitForChildProcessExit,oe as waitForWakeEvent,zm as withEpisodeReviewClaimAuthority,_e as withKodaXFileLock,Lm as withPendingEpisodeReviewSessionFence};