@kodax-ai/kodax 0.7.79 → 0.7.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +93 -12
- package/README.md +31 -8
- package/README_CN.md +25 -5
- package/config-templates/config.example.jsonc +14 -2
- package/dist/chunks/agent-5PHGNFW3.js +2 -0
- package/dist/chunks/argument-completer-FXRZFMTC.js +2 -0
- package/dist/chunks/{chunk-H5LLM7DB.js → chunk-6UENDY33.js} +2 -2
- package/dist/chunks/{chunk-QCZLCLFL.js → chunk-BWX4YZX3.js} +2 -2
- package/dist/chunks/{chunk-EDZ4QILG.js → chunk-CDCCTM5I.js} +17 -5
- package/dist/chunks/chunk-CEB5FDND.js +810 -0
- package/dist/chunks/{chunk-M4N2JZTZ.js → chunk-E7C4DRD2.js} +1 -1
- package/dist/chunks/{chunk-GEECPO2H.js → chunk-EVXIJPZ6.js} +66 -66
- package/dist/chunks/chunk-FQ7NVMSU.js +319 -0
- package/dist/chunks/chunk-GC4JBMBS.js +385 -0
- package/dist/chunks/{chunk-67THZRM6.js → chunk-HTVLCHWH.js} +1 -1
- package/dist/chunks/chunk-IHPH3444.js +655 -0
- package/dist/chunks/{chunk-OWQT3FTE.js → chunk-KHEFUT6O.js} +1 -1
- package/dist/chunks/{chunk-BBOVVDQJ.js → chunk-PMKAG4SZ.js} +1 -1
- package/dist/chunks/chunk-RPF5RGWZ.js +479 -0
- package/dist/chunks/{chunk-CXHEZY5G.js → chunk-RXXKDR6Y.js} +1 -1
- package/dist/chunks/{chunk-6GVQDQTQ.js → chunk-T5U4OP2N.js} +1 -1
- package/dist/chunks/{chunk-SG6P4SZS.js → chunk-TRNAWSXP.js} +21 -21
- package/dist/chunks/{chunk-CR2IF7VF.js → chunk-UZSHBQER.js} +5 -5
- package/dist/chunks/{chunk-B6UY3VHV.js → chunk-VECRQTSD.js} +44 -44
- package/dist/chunks/compaction-config-6J6XCBJS.js +2 -0
- package/dist/chunks/{construction-bootstrap-K3ZGEN5N.js → construction-bootstrap-KPCAE3VN.js} +1 -1
- package/dist/chunks/dist-RWEVZOFK.js +2 -0
- package/dist/chunks/{dist-JMO47GJV.js → dist-WWL2DNIJ.js} +1 -1
- package/dist/chunks/host-OGS2R5J4.js +2 -0
- package/dist/chunks/run-manager-2YMM3BOT.js +2 -0
- package/dist/chunks/{utils-6LEKJPQN.js → utils-2YHRUZYC.js} +1 -1
- package/dist/index.d.ts +13 -12
- package/dist/index.js +4 -4
- package/dist/kodax_bootstrap.js +1 -1
- package/dist/kodax_cli.js +1301 -1285
- package/dist/kodax_resume.js +63 -63
- package/dist/runtime-worker.js +1205 -1189
- package/dist/sandbox-workspace-session.js +43 -43
- package/dist/sdk-a2a.d.ts +8 -8
- package/dist/sdk-a2a.js +1 -1
- package/dist/sdk-agent.d.ts +15 -17
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-coding.d.ts +171 -20
- package/dist/sdk-coding.js +1 -1
- package/dist/sdk-experimental-memory.js +1 -1
- package/dist/sdk-llm.js +1 -1
- package/dist/sdk-mcp.js +1 -1
- package/dist/sdk-media.js +1 -1
- package/dist/sdk-repl.d.ts +19 -200
- package/dist/sdk-repl.js +2 -2
- package/dist/sdk-runtime.d.ts +11 -8
- package/dist/sdk-runtime.js +1 -1
- package/dist/sdk-sandbox.js +1 -1
- package/dist/sdk-session.d.ts +4 -4
- package/dist/sdk-session.js +1 -1
- package/dist/sdk-skills.js +1 -1
- package/dist/semantic-worker.js +44 -44
- package/dist/types-chunks/{bash-prefix-extractor.d-CNSidpmv.d.ts → bash-prefix-extractor.d-DStqKIlu.d.ts} +4 -2
- package/dist/types-chunks/{capsule.d-B3q98pLQ.d.ts → capsule.d-BuFJaYxA.d.ts} +6 -15
- package/dist/types-chunks/{controller.d-RGV7Pjv9.d.ts → controller.d-C2aHqzHj.d.ts} +18 -10
- package/dist/types-chunks/{guardrail.d-1NLSFTyN.d.ts → guardrail.d-DM-OK0m3.d.ts} +74 -77
- package/dist/types-chunks/{history-retrieval.d-BAegI14A.d.ts → history-retrieval.d-DImTKgO6.d.ts} +1 -1
- package/dist/types-chunks/{public-api.d-BpJhHoa7.d.ts → public-api.d-CewTvUKV.d.ts} +5 -17
- package/dist/types-chunks/{repl.d-CZ12Ow3X.d.ts → repl.d-DvXQtgr7.d.ts} +5 -5
- package/dist/types-chunks/{run-manager.d-CX3AUocA.d.ts → run-manager.d-C6ahvZqK.d.ts} +1 -1
- package/dist/types-chunks/{sdk-session-B3cfJKqF.d.ts → sdk-session-C59RUrri.d.ts} +2 -2
- package/dist/types-chunks/shell-command-sets.d-Dp4UvPLL.d.ts +297 -0
- package/dist/types-chunks/{types.d-BZ9oXvTV.d.ts → types.d-BzpPDBPV.d.ts} +1 -1
- package/dist/types-chunks/{types.d-C0_rn--1.d.ts → types.d-yuJzE82x.d.ts} +2 -2
- package/dist/types-chunks/{utils.d-CGpHavsU.d.ts → utils.d-BpACJmzt.d.ts} +15 -5
- package/docs/SDK_EMBEDDER_GUIDE.md +36 -32
- package/package.json +3 -3
- package/dist/chunks/agent-V4AC5JZD.js +0 -2
- package/dist/chunks/argument-completer-ZPC2MLES.js +0 -2
- package/dist/chunks/chunk-KLWP7POA.js +0 -467
- package/dist/chunks/chunk-Q4M7DJOD.js +0 -319
- package/dist/chunks/chunk-RQPMGRTR.js +0 -810
- package/dist/chunks/chunk-TSTVAU5E.js +0 -386
- package/dist/chunks/chunk-ZCZZUE5E.js +0 -662
- package/dist/chunks/compaction-config-AEUGVROL.js +0 -2
- package/dist/chunks/dist-GFJFRPAV.js +0 -2
- package/dist/chunks/host-23K2Q6RZ.js +0 -2
- package/dist/chunks/run-manager-PGIR6ITA.js +0 -2
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-
|
|
1
|
+
import { bg as ExternalAgentRegistration, O as AgentEffectDeclaration, W as AgentExecutorFactory, q as AgentArtifactPolicy } from './types-chunks/controller.d-C2aHqzHj.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-
|
|
10
|
-
import './types-chunks/run-manager.d-
|
|
11
|
-
import './types-chunks/bash-prefix-extractor.d-
|
|
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';
|
|
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-
|
|
17
|
-
import './types-chunks/guardrail.d-
|
|
16
|
+
import './types-chunks/types.d-yuJzE82x.js';
|
|
17
|
+
import './types-chunks/guardrail.d-DM-OK0m3.js';
|
|
18
18
|
import './types-chunks/side-query.d-CP1LiRiH.js';
|
|
19
|
-
import './types-chunks/utils.d-
|
|
19
|
+
import './types-chunks/utils.d-BpACJmzt.js';
|
|
20
20
|
import 'readline';
|
|
21
|
-
import './types-chunks/public-api.d-
|
|
21
|
+
import './types-chunks/public-api.d-CewTvUKV.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-Q4M7DJOD.js";import"./chunks/chunk-ZCZZUE5E.js";import{j as tt,p as nt}from"./chunks/chunk-EDZ4QILG.js";import"./chunks/chunk-BBOVVDQJ.js";import"./chunks/chunk-KLWP7POA.js";import"./chunks/chunk-B6UY3VHV.js";import"./chunks/chunk-CXHEZY5G.js";import"./chunks/chunk-67THZRM6.js";import"./chunks/chunk-QCZLCLFL.js";import"./chunks/chunk-TSTVAU5E.js";import"./chunks/chunk-OWQT3FTE.js";import"./chunks/chunk-SG6P4SZS.js";import"./chunks/chunk-RQPMGRTR.js";import{d as V}from"./chunks/chunk-GEECPO2H.js";import"./chunks/chunk-M4N2JZTZ.js";import"./chunks/chunk-H5LLM7DB.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-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(`
|
|
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}
|
package/dist/sdk-agent.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
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 RunnerLlmResult, d$ as RunnerLlmReturn, e0 as RunnerRecoveryTranscriptCarrier, e2 as RunnerToolContext, e3 as RunnerToolObserver, e5 as RunnerToolResultBatch, e6 as RunnerToolResultBatchTransform, e7 as Session, e8 as SessionDispatchResult, e9 as SessionEntry, ea as SessionErrorMetadata, eb as SessionExtension, ec as SessionForkOptions, eg as SpanData, eh as SpanError, ei as SpanImpl, ej as SpanImplOptions, ek as StagedLearnedSkillArtifact, el as StartTraceOptions, eo as StateWriterOptions, es as StopHookSpanData, et as SystemCap, eu as TerminalCtx, ev as ToolBeforeOutcome, ew as ToolCallSpanData, ex as ToolCapability, ey as ToolGuardrail, ez as ToolPermission, eB as TraceOptions, eC as Tracer, eD as TracerOptions, eE as UnifiedLearningReviewModelInput, eF as UnifiedLearningReviewResult, eG as UnifiedLearningReviewRunner, eH as UserInteraction, eK as WorkflowApproval, eL as WorkflowApprovalSummary, eM as WorkflowArtifactRef, eN as WorkflowBudget, eP as WorkflowEventCorrelation, eQ as WorkflowEventRecorder, eR as WorkflowEventType, eS as WorkflowIsolation, eV as WorkflowMeta, eW as WorkflowModelHint, eZ as WorkflowOutcomeError, e_ as WorkflowOutcomeResult, e$ as WorkflowOutcomeStatus, f0 as WorkflowOutcomeUsage, f1 as WorkflowParallelOptions, f2 as WorkflowProcessArtifact, f3 as WorkflowProcessCounts, f4 as WorkflowProcessEvent, f5 as WorkflowProcessItem, f6 as WorkflowProcessItemKind, f7 as WorkflowProcessItemOrigin, f8 as WorkflowProcessItemStatus, f9 as WorkflowProcessProgress, fa as WorkflowProcessSnapshot, fb as WorkflowProcessSource, fc as WorkflowProcessStatus, fd as WorkflowProcessSummaryStatus, fe as WorkflowProcessTokenUsage, ff as WorkflowProcessTracker, fg as WorkflowProcessTrackerOptions, fh as WorkflowRun, fj as WorkflowRunStatus, fk as WorkflowSpawnAgentInput, fl as WorkflowSynthesis, fm as WorkflowSynthesizeInput, fn as WorkflowTaskHandle, fp as WorkflowTaskSnapshot, fq as WorkflowTaskStatus, fr as WorkflowTaskSummaryEventUpdate, fs as WorkflowTaskSummaryKind, ft as WorkflowTaskSummaryUpdate, fu as WorkflowTaskUsage, fv as WorkflowTaskVerification, fw as WorkflowTaskVerificationResult, fx as WorkflowWaitOptions, fy as _resetAdmittedAgentBindings, fz as _resetPresetDispatchers, fA as admitAndRecordLearnedSkillInvocation, fB as admitLearnedSkillBinding, fC as asSingleSelection, fD as assertLearnedCapabilityTransition, fE as attachRunnerRecoveryTranscript, fF as buildAssistantMessageFromLlmResult, fG as buildSystemPrompt, fH as buildToolResultMessage, fI as canTransitionLearnedCapability, fJ as collectGuardrails, fK as commitLearnedSkillRevision, fL as completeLearnedSkillOutcome, fM as completeLearnedSkillSessionOutcomes, fN as createAgent, fO as createAgentActorController, fP as createHandoff, fQ as createInMemorySession, fR as createInvariantSessionForAgent, fS as createLearnedCapabilityScope, fT as createLearnedSkillRecord, fU as createStateWriter, fV as createTrace, fW as createWorkflowProcessTracker, fX as defaultTracer, fY as detectInstructionsInjection, fZ as discoverInstances, f_ as eventFromCapability, f$ as exactInvokedSkillSnapshotForSession, g0 as executeRunnerToolCall, g1 as extractAssistantTextFromMessage, g2 as getActiveUserInteraction, g3 as getAdmittedAgentBindings, g4 as hashMemoryIdentityComponent, g5 as invokeLearnedSkillCanary, g6 as isAskUserCustomInputAnswer, g7 as isFinalWorkflowProcessStatus, g8 as isLearnedCapabilityRecordV2, g9 as isRunnableTool, ga as isRunnerLlmResult, gb as isUnifiedLearningReviewModelInput, gc as learningEventIdFor, gd as learningEventKindForLifecycle, ge as listLearnedSkillUsageReceipts, gf as matchesMemoryApplicability, gg as memoryApplicabilityFingerprint, gh as normalizeHostMetadata, gi as normalizeUnifiedLearningReview, gj as quarantineLearnedSkillRevision, gk as readRunnerRecoveryTranscript, gl as reconcileLearnedSkillBindingOutcomes, gm as recordLearnedSkillOffered, gn as registerPresetDispatcher, go as releaseLearnedSkillBinding, gp as renderDeclarativeSkill, gq as resolveLearnedAreaPaths, gr as resolveProjectLearnedAreaRoot, gs as runAdmissionAudit, gt as runInputGuardrails, gu as runOutputGuardrails, gv as runToolAfterGuardrails, gw as runToolBeforeGuardrails, gx as sanitizeUnifiedLearningReviewInput, gy as setActiveUserInteraction, gz as setAdmittedAgentBindings, gA as slugifyLearnedCapabilityName, gB as stageLearnedSkillRevision, gC as validateDeclarativeSkillSpec } from './types-chunks/controller.d-RGV7Pjv9.js';
|
|
3
|
-
import { M as WorkflowScriptManifest } from './types-chunks/capsule.d-
|
|
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-
|
|
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';
|
|
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-
|
|
12
|
-
export { M as MessageMode } from './types-chunks/types.d-
|
|
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';
|
|
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-
|
|
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-
|
|
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';
|
|
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[]) => void
|
|
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[]>;
|
|
1152
1152
|
|
|
1153
1153
|
/**
|
|
1154
1154
|
* Generic outer loop for async fan-out + idle-yield resume.
|
|
@@ -1230,7 +1230,7 @@ interface RunWithIdleYieldOptions<TRunResult extends RunWithIdleYieldRunResult>
|
|
|
1230
1230
|
* targets).
|
|
1231
1231
|
*/
|
|
1232
1232
|
readonly agentId: string | undefined;
|
|
1233
|
-
/** Optional cancellation.
|
|
1233
|
+
/** Optional cancellation. Rejects with AbortError at the next boundary. */
|
|
1234
1234
|
readonly abortSignal?: AbortSignal;
|
|
1235
1235
|
/**
|
|
1236
1236
|
* Choose the agent for the next iteration after a wake. Caller has
|
|
@@ -1254,13 +1254,13 @@ 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[]) => void
|
|
1257
|
+
readonly onResumedUserPrompts?: (contents: readonly string[], queuedMessageIds: readonly string[], promptMessage: AgentMessage, runResult: TRunResult) => 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
|
|
1261
1261
|
* expose live turn IDs can stamp the generated prompt message here.
|
|
1262
1262
|
*/
|
|
1263
|
-
readonly resolveResumeTurnId?: () => string | undefined
|
|
1263
|
+
readonly resolveResumeTurnId?: (runResult: TRunResult) => string | undefined | Promise<string | undefined>;
|
|
1264
1264
|
/**
|
|
1265
1265
|
* Optional fresh runtime context inserted after the completed transcript
|
|
1266
1266
|
* and immediately before wake messages. The callback runs for every idle
|
|
@@ -1269,9 +1269,7 @@ interface RunWithIdleYieldOptions<TRunResult extends RunWithIdleYieldRunResult>
|
|
|
1269
1269
|
*/
|
|
1270
1270
|
readonly buildResumeContextMessages?: (runResult: TRunResult, wakeMessages: readonly AgentMessage[]) => readonly AgentMessage[] | Promise<readonly AgentMessage[]>;
|
|
1271
1271
|
/**
|
|
1272
|
-
* Optional hook fired
|
|
1273
|
-
* currently log here (matches v0.7.38 behavior — silent break) but
|
|
1274
|
-
* the hook exists so SDK consumers can record the prompt-bug signal.
|
|
1272
|
+
* Optional hook fired before the iteration-cap error is thrown.
|
|
1275
1273
|
*/
|
|
1276
1274
|
readonly onIterationCap?: () => void;
|
|
1277
1275
|
/**
|
|
@@ -1306,13 +1304,13 @@ interface RunWithIdleYieldOptions<TRunResult extends RunWithIdleYieldRunResult>
|
|
|
1306
1304
|
* On each iteration:
|
|
1307
1305
|
* 1. Invoke `runOnce(currentAgent, currentInput)`.
|
|
1308
1306
|
* 2. Increment the iteration counter. If it exceeds
|
|
1309
|
-
* `maxIterations`, call `onIterationCap?.()` and
|
|
1307
|
+
* `maxIterations`, call `onIterationCap?.()` and reject.
|
|
1310
1308
|
* 3. Compute the snapshot via `computeSnapshot(runResult)`.
|
|
1311
1309
|
* 4. If `detectIdleYield(snapshot)` is false (run terminal or
|
|
1312
1310
|
* handoff/verdict already emitted), break.
|
|
1313
1311
|
* 5. Fire `onIdleWaiting?.(currentAgent, runResult)`.
|
|
1314
1312
|
* 6. Park in `waitForWakeEvent({registry, messageQueue, agentId, abortSignal})`.
|
|
1315
|
-
* 7. If wake is `aborted`,
|
|
1313
|
+
* 7. If wake is `aborted`, reject with AbortError.
|
|
1316
1314
|
* 8. Build synthetic user message via `composeIdleYieldUserMessage`.
|
|
1317
1315
|
* If undefined (truly empty wake), break.
|
|
1318
1316
|
* 9. Replay: `currentInput = [...runResult.messages, syntheticUserMessage]`,
|
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 Mo,Ab as Om,Ac as Op,Ad as Ot,B as G,Ba as No,Bb as Pm,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 Wr,ec as np,ed as nt,ee as nx,f as p,fa as co,fb as Xr,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,m as i,ma as no,mb as ee,mc as Ap,md as At,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-RQPMGRTR.js";import{$ as rf,$a as em,A as Fe,Aa as Df,Ab as Cm,B as Ge,Ba as Ef,Bb as Dm,C as He,Ca as Ff,Cb as Em,D as Ie,Da as Gf,Db as Fm,E as Je,Ea as Hf,Eb as Gm,F as Ke,Fa as If,Fb as Hm,G as Le,Ga as Jf,Gb as Im,H as Me,Ha as Kf,Hb as Jm,I as Ne,Ia as Lf,Ib as Km,Ja as Mf,Jb as Lm,Ka as Nf,Kb as Mm,La as Of,Lb as Nm,M as Oe,Ma as Pf,N as Pe,Na as Qf,O as Qe,Oa as Rf,P as Re,Pa as Sf,Q as Se,Qa as Tf,R as Te,Ra as Uf,S as Ue,Sa as Vf,T as Ve,Ta as Wf,U as We,Ua as Xf,V as Xe,Va as Yf,W as Ye,Wa as Zf,X as Ze,Xa as _f,Y as _e,Ya as $f,Z as $e,Za as om,_ as of,_a as rm,a as c,aa as ef,ab as fm,b as d,ba as ff,bb as mm,c as n,ca as mf,cb as pm,d as q,da as pf,db as tm,e as s,ea as tf,eb as xm,f as Go,fa as xf,fb as am,g as Ho,ga as af,gb as bm,h as Io,ha as bf,hb as cm,i as Jo,ia as cf,ib as dm,j as Ko,ja as df,k as Lo,ka as gf,kb as gm,l as ke,la as hf,lb as hm,m as le,ma as jf,mb as im,n as ne,na as kf,nb as jm,o as qe,oa as lf,ob as km,p as se,pa as nf,pb as lm,q as ue,qa as qf,qb as nm,r as ve,ra as sf,rb as qm,s as we,sa as uf,sb as sm,t as ye,ta as vf,tb as um,u as ze,ua as wf,ub as vm,v as Ae,va as yf,vb as wm,w as Be,wa as zf,wb as ym,x as Ce,xa as Af,xb as zm,y as De,ya as Bf,yb as Am,z as Ee,za as Cf,zb as Bm}from"./chunks/chunk-GEECPO2H.js";import{A as Qr,B as Rr,C as Sr,D as Tr,E as Ur,F as Vr,a as kr,b as lr,c as nr,d as qr,e as sr,f as ur,g as vr,h as wr,i as yr,j as zr,k as Ar,l as Br,m as Cr,n as Dr,o as Er,p as Fr,q as Gr,r as Hr,s as Ir,t as Jr,u as Kr,v as Lr,w as Mr,x as Nr,y as Or,z as Pr}from"./chunks/chunk-M4N2JZTZ.js";import"./chunks/chunk-H5LLM7DB.js";import"./chunks/chunk-ONUPGMER.js";export{cr as ASK_USER_BACK_SIGNAL,dr as ASK_USER_CUSTOM_INPUT_SIGNAL,wx as AgentActorController,kx as AgentActorStoreConflictError,ix as AgentBudgetExhaustedError,bx as AgentCancellationUncertainError,ux as AgentControlError,hx as AgentLimitReachedError,lx as AgentOwnerConflictError,nx as AgentOwnerUnknownError,jx as AgentRevisionConflictError,qx as AgentSettlementPersistenceError,sx as AgentShutdownPersistenceError,ax as AgentStartUncertainError,vx as AgentTurnScheduler,Wo as BUN_BE_BUN_ENV,Mo as CAPABILITY_CACHE_FILENAME,Jp as COMPACTED_HISTORY_RECOVERY_GUIDANCE,Ap as COMPACTION_PROTECTION_RATIO,Ip as COMPACTION_SUMMARY_PREFIX,g as CONTEXT_SAFETY_FLOOR_TOKENS,h as CONTEXT_SAFETY_RATIO,Eo as CORE_INVARIANTS,K as ConsoleTracingProcessor,i as ContextCapacityError,wp as DEFAULT_COMPACTION_TRIGGER_PERCENT,Et as DEFAULT_CONTEXT_WINDOW,oe as DEFAULT_IDLE_YIELD_MAX_ITERATIONS,vt as DEFAULT_MICROCOMPACTION_CONFIG,Pp as DEFAULT_POST_COMPACT_CONFIG,np as DEFAULT_SUMMARY_PROMPT,X as DEFAULT_SYSTEM_CAP,qp as DEFAULT_UPDATE_SUMMARY_PROMPT,y as DefaultSummaryCompaction,Xo as ELECTRON_NODE_ENV_SCRUB_IMPORT,Vo as ELECTRON_RUN_AS_NODE_ENV,km as EpisodeReviewBranchChangedError,jm as EpisodeReviewFailure,cx as ExternalAgentRegistrationConflictError,At as FileExtensionStore,wf as FileLearningCenterService,L as FileTracingProcessor,bo as GuardrailBlockedError,co as GuardrailEscalateError,To as HARDENED_ENV_VARS,Uo as HARDENING_OPT_OUT_ENV,Br as ImageResizeError,ro as InvariantSession,a as KODAX_API_MIN_INTERVAL,r as KODAX_DEFAULT_TIMEOUT,Sr as KODAX_FILE_MEDIA_TYPES,e as KODAX_HARD_TIMEOUT,Qr 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,Rr as KODAX_VIDEO_MEDIA_TYPES,Ar as KodaXMediaError,cp as LINEAGE_ENTRY_TYPES,sf as LearnedAreaStore,gf as LearningCapabilityError,gp as LineageCompaction,dp as LineageExtension,zp as MAX_COMPACTION_TRIGGER_PERCENT,Hr as MAX_DIMENSION,Ge as MAX_ENTRYPOINT_BYTES,Fe as MAX_ENTRYPOINT_LINES,Ve as MAX_SKILL_MD_BYTES,We as MAX_SKILL_SUPPORT_FILE_BYTES,fo as MAX_TOOL_LOOP_ITERATIONS,qe as MEMORY_POLICY_VERSION,yp as MIN_COMPACTION_TRIGGER_PERCENT,Vm as McpAuthRequiredError,tp as McpCapabilityProvider,Um as McpExpiredSessionError,xp as McpManager,pp as McpServerRuntime,Wm as McpTransportCleanupIncompleteError,im as MemoryControlPlane,kr as MessageQueue,Mr as PASTE_TMP_DIR_ENV,Nr as PASTE_TMP_TTL_MS,Op as POST_COMPACT_MAX_TOKENS_PER_FILE,Np as POST_COMPACT_TOKEN_BUDGET,b as PROMISE_PATTERN,Hp as PROTECTED_TOOL_NAMES,Wr as QueuedInputArtifactError,zo as Runner,pm as SkillExecutor,rm as SkillRegistry,z as SpanImpl,Ir as TARGET_RAW_SIZE_BYTES,I as Tracer,_f as VariableResolver,Vt as WORKFLOW_CAPSULE_API_VERSION,Tt as WORKFLOW_CAPSULE_FORMAT,Ut as WORKFLOW_CAPSULE_VERSION,Lt as WORKFLOW_PATTERN_IDS,_t as WorkflowAbortError,ox as WorkflowBudgetError,Ht as WorkflowEventRecorder,$t as WorkflowLimitError,Pt as WorkflowScriptExecutionError,rx as WorkflowTaskFailedError,wr as YIELD_TOOL_NAMES,F as _emitSpanEnd,E as _emitSpanStart,G as _emitTraceEnd,D as _getRegisteredProcessors,vr as _resetActiveRootQueueRoutesForTests,V as _resetAdmissionMetrics,oo as _resetAdmittedAgentBindings,R as _resetInvariantRegistry,nr as _resetMessageQueueForTests,wo as _resetPresetDispatchers,qr as actorQueueId,B as addTracingProcessor,Rf as admitAndRecordLearnedSkillInvocation,If as admitLearnedSkillBinding,st as appendGoalEntry,bt as appendMemoryClientNotice,tt as appendMemoryOutcomeDigest,xt as appendMemoryReviewReceipt,Yp as appendSessionLineageLabel,_p as applyLineageTruncation,M as applyManifestPatch,Yo as applyProcessHardening,Zp as applySessionCompaction,rf as applySkillLearningProposal,ef as approveStoredLearningProposal,pt as archiveOldIslands,hr as asSingleSelection,jf as assertLearnedCapabilityTransition,Ot as assertRestrictedWorkflowQuality,so as attachRunnerRecoveryTranscript,be as bootstrapTeamMode,xo as buildAssistantMessageFromLlmResult,sp as buildCompactionCacheInstruction,up as buildCompactionPromptSnapshot,Sp as buildFileContentMessages,mp as buildInitializeCapabilities,pe as buildOtherInstancesPromptBlock,Qp as buildPostCompactAttachments,zt as buildRecoverySeed,ft as buildSessionTree,yo as buildSystemPrompt,ao as buildToolResultMessage,Zt as buildWorkflowCapsuleIntent,Gt as buildWorkflowOutcome,j as calculateContextSafetyMargin,l as calculateMaxContextInputTokens,Te as canMarkCreatedByAgent,hf as canTransitionLearnedCapability,lm as captureEpisodeReviewBranchEpoch,qm as claimEpisodeReview,de as cleanupIncompleteToolCalls,br as cleanupRegisteredManagedChildren,Ro as clearCapabilityCache,Le as clearPluginSkillPaths,go as collectGuardrails,Dp as collectUserQueryLedger,vm as commitEpisodeReviewAction,um as commitEpisodeReviewDecision,Hf as commitLearnedSkillRevision,Mp as compact,Fm as completeEpisodeReview,Bm as completeFencedEpisodeReview,Lf as completeLearnedSkillOutcome,Sf as completeLearnedSkillSessionOutcomes,$r as composeIdleYieldUserMessage,N as composePatches,cf as computeSkillConsumerImpact,mt as countActiveLineageMessages,Yr as countLastAssistantToolCalls,d as countTokens,u as createAgent,yx as createAgentActorController,dx as createAgentExecutorPlane,tm as createExecutor,Bt as createExtensionStore,Fr as createFileArtifactFromPath,v as createHandoff,Er as createImageArtifactFromPath,w as createInMemorySession,eo as createInvariantSessionForAgent,Cf as createLearnedCapabilityScope,Of as createLearnedSkillActionDriver,Gf as createLearnedSkillRecord,yf as createLearningCenterService,je as createLlmJudgedStopHook,Pm as createMcpCapabilityId,ap as createMcpManager,bp as createMcpTestServerFixture,Xm as createMcpTransport,xx as createMemoryAgentExecutorPlaneStore,hm as createMemoryControlPlane,gx as createReferenceAgentExecutorFactory,$f as createResolver,St as createRestrictedWorkflowModule,Tp as createSessionLineage,fe as createStateWriter,A as createTrace,Gr as createVideoArtifactFromPath,Xt as createWorkflowCapsule,Yt as createWorkflowModuleFromCapsule,Kt as createWorkflowProcessTracker,px as createWorkflowRunManager,fx as createWorkflowRuntime,Ue as decideSkillGovernance,Om as defaultMcpCacheDir,J as defaultTracer,Am as deferEpisodeReview,lo as detectHandoffSignal,Zr as detectIdleYield,Y as detectInstructionsInjection,Cm as discardFencedEpisodeReview,$m as discoverAuthorizationServerMetadata,me as discoverInstances,op as discoverOAuthEndpoints,_m as discoverProtectedResourceMetadata,Wf as discoverSkills,Yf as discoverSkillsWithMonorepo,dm as dispatchSkillCreatorTool,Km as drainPendingEpisodeReviews,ge as editDistance,qo as emitHandoffSpan,q as emitKodaXDiagnostic,Vr as enqueueWithArtifacts,c as estimateTokens,uf as eventFromCapability,$p as evictOldIslandMessageContent,Bo as evidenceTrail,Vf as exactInvokedSkillSnapshotForSession,k as exceedsContextCapacity,to as executeRunnerToolCall,xm as executeSkill,am as expandSkillForLLM,jp as extractArtifactLedger,Ao as extractAssistantTextFromMessage,hp as extractFileOps,Zm as extractInsufficientScope,Ym as extractResourceMetadataUrl,gt as extractTitleFromMessages,zm as failEpisodeReviewApply,ym as failEpisodeReviewAttempt,Im as fencePendingEpisodeReviewsForSession,Co as finalOwner,he as findFuzzyToolMatch,ot as findPreviousUserEntryId,et as forkSessionLineage,s as formatKodaXDiagnostic,bm as formatSkillActivationMessage,sm as freezeEpisodeReviewInput,dt as generateSessionId,ct as generateSessionIdSync,vp as generateSummary,at as getActiveMemoryOutcomeReviewIds,xe as getActiveTeamModeWriter,jr as getActiveUserInteraction,U as getAdmissionMetricsSnapshot,$ as getAdmittedAgentBindings,Ho as getAgentConfigHome,Io as getAgentConfigPath,Lo as getAppDataDir,Po as getCachedRejectedEfforts,No as getCapabilityCacheFile,Me as getDefaultSkillPaths,tx as getDefaultWorkflowRunManager,P as getInvariant,zf as getLearnedExtensionToolName,Tm as getMcpCachePaths,lr as getMessageQueue,Tr as getModelInputCapabilities,Xf as getNestedSkillPaths,Up as getSessionLineagePath,Vp as getSessionMessagesFromLineage,Ne as getSkillPathsFlat,em as getSkillRegistry,Dt as gracefulCompactDegradation,Do as handoffLegality,ue as hashCwd,le as hashMemoryIdentityComponent,Cr as inferImageMediaType,Dr as inferVideoMediaType,fm as initializeSkillRegistry,Rp as injectPostCompactAttachments,Dm as inspectEpisodeReviewJob,Kf as invokeLearnedSkillCanary,ie as invokeLlmJudge,W as isAdmissionDebugEnabled,gr as isAskUserCustomInputAnswer,Ae as isAutoManagedMemoryFile,or as isChildProcessExited,Kp as isEmptyLikeSummary,It as isFinalWorkflowProcessStatus,ut as isGoalEntry,Xr as isIdleYieldEnabled,Nf as isLearnedCapabilityRecordV2,Af as isLearnedExtensionCommandAllowed,Jo as isPathInsideDirectory,mo as isRunnableTool,po as isRunnerLlmResult,cm as isSkillCreatorDispatchAction,Mm as isUnifiedLearningReviewModelInput,tr as killChildProcessTree,xr as killChildProcessTreeSync,mr as killPidTree,pr as killPidTreeSync,nf as learningEventIdFor,lf as learningEventKindForLifecycle,Nt as lintRestrictedWorkflowSource,Uf as listLearnedSkillUsageReceipts,Em as listPendingEpisodeReviews,Ke as listPluginSkillPaths,Q as listRegisteredInvariants,Oo as loadCapabilityCache,Qe as loadFullSkill,Re as loadSkillFileContent,Pe as loadSkillMetadata,fp as loadValidToken,ke as matchesMemoryApplicability,zr as maybeDrainMidTurn,ne as memoryApplicabilityFingerprint,kp as mergeArtifactLedger,ip as mergeFileOps,Ep as mergeUserQueryLedger,wt as microcompact,yr as midTurnDrainPriority,Pf as migrateLegacyLearnedSkillsForProject,Lp as needsCompaction,Bp as normalizeCompactionConfig,Jt as normalizeHostMetadata,Qm as normalizeMcpCapabilityId,Jr as normalizePastedImage,yt as normalizeRecoveryPrompt,Nm as normalizeUnifiedLearningReview,ex as normalizeWorkflowLimits,Zf as parseArguments,Rm as parseMcpCapabilityId,De as parseMemoryFile,Ce as parseMemoryType,Be as parseMemoryTypeFromFilename,Ee as parseScalarFields,Oe as parseSkillMarkdown,Gp as parseUserQueryLedger,ep as performOAuthLogin,lt as persistCompactedSessionHistory,Or as persistImageAsBlock,nm as persistPendingEpisodeReview,Zo as prepareInternalNodeLaunch,_o as prepareJavaScriptChildLaunch,vf as projectLearningProposals,Pr as prunePasteTmpDir,Mf as quarantineLearnedSkillRevision,Lr as readAndNormalizeClipboardImage,Kr as readClipboardImage,nt as readLatestGoalFromBranch,qt as readLatestGoalState,Ze as readLearningProposalStore,er as readProcessStartIdentity,uo as readRunnerRecoveryTranscript,kt as readSessionHistoryEntry,af as readSkillTrustLedger,tf as readSkillUsageLedger,Tf as reconcileLearnedSkillBindingOutcomes,df as recordCompletedTurnLearning,Qf as recordLearnedSkillOffered,ff as recordProceduralLearning,Qo as recordRejectedEffort,xf as recordSkillUsage,sr as registerActiveRootQueueRoute,Fo as registerCoreInvariants,O as registerInvariant,ar as registerManagedChildProcess,rp as registerOAuthClient,Ie as registerPluginSkillPath,vo as registerPresetDispatcher,Jf as releaseLearnedSkillBinding,fr as rememberChildProcessTree,Ef as renderDeclarativeSkill,Fp as renderUserQueryLedger,no as replaceSystemMessage,So as resetCapabilityCacheMemoForTesting,mm as resetSkillRegistry,ur as resolveActiveRootQueueRoute,Cp as resolveCompactionPolicy,Ft as resolveContextWindow,T as resolveEffectiveInvariants,Ko as resolveExecutionPath,qf as resolveLearnedAreaPaths,$e as resolveLearningProposalStore,ye as resolveMemoryEntrypoint,we as resolveMemoryRoot,Bf as resolveProjectLearnedAreaRoot,S as resolveRequiredInvariants,ze as resolveScopedMemoryRoot,Wp as resolveSessionLineageTarget,om as resolveSkillContent,Xe as resolveSkillSnapshotLocation,pf as resolveSkillTrustLedger,mf as resolveSkillUsageLedger,Gm as rewindPendingEpisodeReviews,Hm as rewindPendingEpisodeReviewsForSession,rt as rewindSessionLineage,Z as runAdmissionAudit,ee as runFanOut,ho as runInputGuardrails,io as runOutputGuardrails,Rt as runRestrictedWorkflowScript,ko as runToolAfterGuardrails,jo as runToolBeforeGuardrails,re as runWithIdleYield,mx as runWorkflow,se as sanitizeProjectKey,gm as sanitizePromptSafeMemoryClaim,Lm as sanitizeUnifiedLearningReviewInput,Sm as searchMcpCatalog,ht as searchSessionHistory,jt as searchSessionHistoryCooperatively,lp as serializeConversation,te as setActiveTeamModeWriter,ir as setActiveUserInteraction,_ as setAdmittedAgentBindings,Go as setAgentConfigHome,n as setKodaXDiagnosticSink,Xp as setSessionLineageActiveEntry,C as setTracingProcessors,Ct as shouldCompact,H as shutdownTracing,kf as slugifyLearnedCapabilityName,Ff as stageLearnedSkillRevision,$o as stripHardenedEnvVars,Se as triageProceduralLearning,He as truncateEntrypointContent,ve as tryGitRemote,Je as unregisterPluginSkillPath,ae as updateActiveTeamMode,of as updateLearningProposalStatus,bf as updateSkillTrustLedger,_e as upsertLearningProposal,ce as validateAndFixToolHistory,Df as validateDeclarativeSkillSpec,Ur as validateInputArtifactsForModel,Qt as validateRestrictedWorkflowSource,it as validateSessionHistorySearchQuery,Wt as validateWorkflowCapsule,Mt as validateWorkflowScriptManifest,rr as waitForChildProcessExit,_r as waitForWakeEvent,wm as withEpisodeReviewClaimAuthority,Ye as withKodaXFileLock,Jm 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,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};
|