@gencode/agents 0.13.0 → 0.15.0
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 +26 -0
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.js +1 -1
- package/dist/{default-provider-QJ5I3qOU.js → default-provider-DchVtHkL.js} +21 -21
- package/dist/{goal-events-vnNkQVzi.js → goal-events-BtFriEK5.js} +1 -1
- package/dist/{goal-store-Clnnb4f2.js → goal-store-CmMXXTIZ.js} +1 -1
- package/dist/{host-CFCi5RZa.js → host-BC9sAhdH.js} +3 -3
- package/dist/index.d.ts +11 -228
- package/dist/index.js +114 -117
- package/dist/{loader-DWYoarsH.d.ts → loader-CVsd42rJ.d.ts} +11 -0
- package/dist/loader-CkdBGDtW.js +1 -0
- package/dist/pi-extensions/index.d.ts +1 -1
- package/dist/pi-extensions/index.js +1 -1
- package/dist/provider-registry-DPbmbWqS.js +1 -0
- package/dist/{session-DIkujhuw.js → session-CvZsdTZJ.js} +2 -2
- package/dist/{session-store-D8wJoo7a.js → session-store-BaH2Dvmo.js} +1 -1
- package/dist/system-runtime-De6fo44S.d.ts +239 -0
- package/dist/system-runtime-DfAhRq2L.js +4 -0
- package/dist/system-runtime.d.ts +2 -0
- package/dist/system-runtime.js +1 -0
- package/package.json +5 -1
- /package/dist/{config-DYv0xUdi.js → config-DDlWxQf7.js} +0 -0
- /package/dist/{index-DGdf27gv.d.ts → index-BNCxlrCH.d.ts} +0 -0
- /package/dist/{kc-DVYWmNeY.js → kc-Omw-bmtO.js} +0 -0
|
@@ -1115,6 +1115,17 @@ type AgentRunParamsBase = {
|
|
|
1115
1115
|
*/
|
|
1116
1116
|
env?: Record<string, string>; /** Optional IM-style topic segmentation prefilter. Enabled by default unless enabled=false. */
|
|
1117
1117
|
topicSegmentation?: TopicSegmentationConfig;
|
|
1118
|
+
/**
|
|
1119
|
+
* Session title generation. Enabled by default.
|
|
1120
|
+
* - `enabled: true` (default): generate an LLM title via the flash model for new sessions;
|
|
1121
|
+
* falls back to a truncated first-message title when `flashModel` is unset.
|
|
1122
|
+
* - `enabled: false`: skip LLM title generation entirely; the title becomes a truncated
|
|
1123
|
+
* first message (no token cost, no network call). Useful for batch/one-shot/embedded runs.
|
|
1124
|
+
* Does not affect topic segmentation.
|
|
1125
|
+
*/
|
|
1126
|
+
titleGeneration?: {
|
|
1127
|
+
enabled: boolean;
|
|
1128
|
+
};
|
|
1118
1129
|
/**
|
|
1119
1130
|
* Goal to create when this run establishes a new session (CLI `run --goal` without --session-id).
|
|
1120
1131
|
* Applied in runner after sessionId is assigned; not passed to the model as a tool.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"node:fs/promises";import t from"node:path";import n from"node:crypto";import{createJiti as r}from"jiti";function i(e,t){return{id:`pi:${e}`,name:e,version:`0.0.0-${n.createHash(`sha256`).update(t).digest(`hex`).slice(0,8)}`,description:`Pi extension ${e}`,configSchema:{}}}function a(e){return(e.split(/[/\\]/).pop()??`extension`).replace(/\.(ts|js|mts|cts)$/i,``)}const o=[`.js`,`.ts`,`.mjs`,`.mts`,`.cjs`,`.cts`],s=[`index.js`,`index.mjs`,`index.cjs`,`index.ts`,`index.mts`,`index.cts`];let c,l=null;async function u(e){return l||(l=await p(e),console.log(`[PiExtensionLoader] Pre-loaded ${l.length} extension(s)`),l)}async function d(e){return l||(!e||e.length===0?[]:(console.log(`[PiExtensionLoader] No pre-loaded cache, loading now (cold start)`),await p(e)))}function f(){return c||=r(import.meta.url,{interopDefault:!0,requireCache:!0}),c}async function p(e){let t=new Set;for(let n of e)await m(n,t);let n=f(),r=[];for(let e of[...t].sort()){let t;try{t=n(e)}catch(t){console.warn(`[PiExtensionLoader] Failed to load extension from ${e}:`,t);continue}let i=typeof t==`function`?t:t&&typeof t==`object`&&`default`in t?t.default:void 0;if(typeof i!=`function`){console.warn(`[PiExtensionLoader] Skipping ${e}: no default function export`);continue}r.push({factory:i,sourcePath:e,name:a(e)})}return r}async function m(n,r){let i;try{i=await e.readdir(n,{withFileTypes:!0})}catch{return}for(let e of s)if(i.find(t=>t.isFile()&&String(t.name)===e)){r.add(t.join(n,e));return}for(let e of i){let i=t.join(n,String(e.name));if(e.isDirectory()){await m(i,r);continue}if(!e.isFile())continue;let a=String(e.name);o.some(e=>a.endsWith(e))&&r.add(i)}}export{i,d as n,u as r,p as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as TranscriptEntry, Hn as PluginHookRegistry, i as preloadExtensions, ln as RunEventDispatcher, mn as PluginHookAgentContext, n as discoverPiExtensions, o as PluginToolRegistry, r as getExtensions, t as DiscoveredPiExtension } from "../loader-
|
|
1
|
+
import { C as TranscriptEntry, Hn as PluginHookRegistry, i as preloadExtensions, ln as RunEventDispatcher, mn as PluginHookAgentContext, n as discoverPiExtensions, o as PluginToolRegistry, r as getExtensions, t as DiscoveredPiExtension } from "../loader-CVsd42rJ.js";
|
|
2
2
|
import { Agent, AgentTool } from "@earendil-works/pi-agent-core";
|
|
3
3
|
|
|
4
4
|
//#region src/pi-extensions/tool-adapter.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{n as e,r as t,t as n}from"../loader-CkdBGDtW.js";import{n as r,t as i}from"../host-BC9sAhdH.js";export{i as PiExtensionHost,r as PiExtensionSidecar,n as discoverPiExtensions,e as getExtensions,t as preloadExtensions};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=new class{providers=new Map;byPluginId=new Map;register(e){this.providers.set(e.id,e),e.pluginId&&this.byPluginId.set(e.pluginId,e.id)}getById(e){return this.providers.get(e)}getByPluginId(e){let t=this.byPluginId.get(e);return t?this.providers.get(t):void 0}clear(){this.providers.clear(),this.byPluginId.clear()}};function t(t){let n=t.id?.trim()||t.pluginId;return e.register({id:n,pluginId:t.pluginId,create:t.create,config:t.config,rootDir:t.rootDir,source:t.source}),n}function n(t){let n=t.providerId?.trim(),r=t.pluginId?.trim(),i=(n?e.getById(n):void 0)??(r?e.getByPluginId(r):void 0);return i?{provider:i.create({dataDir:t.dataDir,memoryDir:t.memoryDir,pluginId:i.pluginId,config:i.config,rootDir:i.rootDir,source:i.source}),registration:i}:null}function r(){e.clear()}const i=new class{providers=new Map;byPluginId=new Map;register(e){this.providers.set(e.id,e),e.pluginId&&this.byPluginId.set(e.pluginId,e.id)}getById(e){return this.providers.get(e)}getByPluginId(e){let t=this.byPluginId.get(e);return t?this.providers.get(t):void 0}clear(){this.providers.clear(),this.byPluginId.clear()}};function a(e){let t=e.id?.trim()||e.pluginId;return i.register({id:t,pluginId:e.pluginId,create:e.create,config:e.config,rootDir:e.rootDir,source:e.source}),t}function o(e){let t=e.providerId?.trim(),n=e.pluginId?.trim(),r=(t?i.getById(t):void 0)??(n?i.getByPluginId(n):void 0);if(!r)return null;let a={dataDir:e.dataDir,memoryDir:e.memoryDir,sessionId:e.sessionId,sessionStoreName:e.sessionStoreName,pluginId:r.pluginId,config:r.config,rootDir:r.rootDir,source:r.source};return{provider:r.create(a),registration:r}}function s(){i.clear()}export{r as a,t as i,s as n,n as o,o as r,a as t};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import e from"node:fs/promises";import t from"node:path";import{randomUUID as n}from"node:crypto";async function r(t){try{return await e.readFile(t,`utf-8`)}catch(e){if(e.code===`ENOENT`)return null;throw e}}async function i(t,n,r){await e.writeFile(t,n,`utf-8`)}async function a(t,n,a){if(!a){await e.appendFile(t,n,`utf-8`);return}let o=await r(t);await i(t,o?o+n:n,!0)}async function o(t,n,r){let i=`${t}.${process.pid}.${Date.now()}.tmp`;await e.writeFile(i,n,`utf-8`),await e.rename(i,t)}async function s(e){return r(e)}const c=`sessions`,l=2e3,u=new Map;function d(e){let t=e?.trim()||c;if(!/^[A-Za-z0-9_-]+$/.test(t))throw Error(`Invalid session store name: ${e}. Must match /^[A-Za-z0-9_-]+$/`);return t}function f(e,t){let n=t.trim();if(!/^[A-Za-z0-9_-]+$/.test(n))throw Error(`Invalid ${e}: ${t}. Must match /^[A-Za-z0-9_-]+$/`);return n}function p(e){if(e.includes(`..`)||e.startsWith(`/`))throw Error(`Invalid session id: ${e}`)}function m(e,n){return t.join(e,`.aimax`,d(n?.storeName))}function h(e,n,r){let i=r?.subagent?f(`subagent session id`,n):n;if(r?.subagent){if(r.subagent.parentDir)return t.join(r.subagent.parentDir,`subagents`,i);let n=f(`parent session id`,r.subagent.parentSessionId);return t.join(m(e,r),n,`subagents`,i)}return t.join(m(e,r),i)}function g(e,n,r){return p(n),t.join(h(e,n,r),`transcript.jsonl`)}function _(e,n,r){return p(n),t.join(h(e,n,r),`system-prompt.txt`)}async function v(e,t,n){return r(_(e,t,n))}function y(e,n,r){return t.join(h(e,n,r),`artifacts.json`)}function b(e,n,r){return t.join(h(e,n,r),`session.json`)}function x(e,n,r){return t.join(h(e,n,r),`context.json`)}function S(e,n,r){return t.join(h(e,n,r),`session-memory.json`)}function C(e,n,r){return t.join(h(e,n,r),`collapse-log.jsonl`)}function w(e,n,r){return t.join(h(e,n,r),`tool-results`)}function T(e,n,r){return t.join(h(e,n,r),`cron-executions.jsonl`)}const E={version:2,updatedAt:new Date(0).toISOString(),readStates:[],toolResults:[],compaction:{budgets:[],snips:[],collapseSpans:[],consecutiveAutocompactFailures:0}};async function D(r,i,a){let o=a?.sessionId??n(),s=h(r,o,a);await e.mkdir(s,{recursive:!0});let c=t.join(s,`.channel`);return await e.writeFile(c,i,`utf-8`),o}async function O(t,n,r){let i=h(t,n,r);await e.mkdir(i,{recursive:!0})}async function k(e,t,n){let i=await r(g(e,t,n));if(i===null)return[];let a=[];for(let e of i.split(`
|
|
2
2
|
`)){let t=e.trim();if(t)try{a.push(JSON.parse(t))}catch{}}return a}async function A(e,t,n,r){await O(e,t,r);let i=y(e,t,r),a=r?.encryptSessions??!1;await I(i,async()=>{let e=await N(i);await F(i,{version:1,updatedAt:new Date().toISOString(),operations:[...e.operations,M(n)]},a)})}async function j(e,t,n){return(await N(y(e,t,n))).operations}function M(e){let t=e.content.length,n=t>l;return{...e,content:n?`${e.content.slice(0,Math.max(0,l-3))}...`:e.content,timestamp:new Date().toISOString(),truncated:n,originalChars:t}}async function N(e){let t=await r(e);if(t===null)return P();try{let e=JSON.parse(t);return e.version!==1||!Array.isArray(e.operations)?P():{version:1,updatedAt:typeof e.updatedAt==`string`?e.updatedAt:new Date(0).toISOString(),operations:e.operations}}catch{return P()}}function P(){return{version:1,updatedAt:new Date(0).toISOString(),operations:[]}}async function F(n,r,i){await e.mkdir(t.dirname(n),{recursive:!0}),await o(n,`${JSON.stringify(r,null,2)}\n`,i)}async function I(e,t){let n=(u.get(e)??Promise.resolve()).catch(()=>{}).then(t);u.set(e,n);try{await n}finally{u.get(e)===n&&u.delete(e)}}async function L(e,n,r,i){await O(e,n,i);let o=g(e,n,i);await a(o,JSON.stringify(r)+`
|
|
3
|
-
`,i?.encryptSessions??!1);try{let{resolveMemoryProviderOrDefault:n}=await import(`./default-provider-
|
|
4
|
-
`),l=a?.encryptSessions??!1;await i(o,c.length>0?`${c}\n`:``,l);try{let{resolveMemoryProviderOrDefault:n}=await import(`./default-provider-
|
|
3
|
+
`,i?.encryptSessions??!1);try{let{resolveMemoryProviderOrDefault:n}=await import(`./default-provider-DchVtHkL.js`).then(e=>e.n),r=t.join(e,`.aimax`),a=n({providerId:i?.providerId,pluginId:i?.pluginId,dataDir:e,memoryDir:r,sessionStoreName:i?.storeName});a.provider.noteSessionUpdate&&a.provider.noteSessionUpdate(o)}catch{}i?.onMemoryChanged&&await Promise.resolve(i.onMemoryChanged({reason:`transcript-append`,files:[t.join(d(i.storeName),n,`transcript.jsonl`).replace(/\\/g,`/`)],source:`sessions`,sessionId:n,providerId:i.providerId??i.pluginId,timestamp:new Date().toISOString()})).catch(()=>{})}async function R(e,n,r,a){await O(e,n,a);let o=g(e,n,a),s=r(await k(e,n,a)),c=s.map(e=>JSON.stringify(e)).join(`
|
|
4
|
+
`),l=a?.encryptSessions??!1;await i(o,c.length>0?`${c}\n`:``,l);try{let{resolveMemoryProviderOrDefault:n}=await import(`./default-provider-DchVtHkL.js`).then(e=>e.n),r=t.join(e,`.aimax`),i=n({providerId:a?.providerId,pluginId:a?.pluginId,dataDir:e,memoryDir:r,sessionStoreName:a?.storeName});i.provider.noteSessionUpdate&&i.provider.noteSessionUpdate(o)}catch{}return a?.onMemoryChanged&&await Promise.resolve(a.onMemoryChanged({reason:`transcript-rewrite`,files:[t.join(d(a.storeName),n,`transcript.jsonl`).replace(/\\/g,`/`)],source:`sessions`,sessionId:n,providerId:a.providerId??a.pluginId,timestamp:new Date().toISOString()})).catch(()=>{}),s}async function z(e,t,n,r){await O(e,t,r),await a(T(e,t,r),JSON.stringify(n)+`
|
|
5
5
|
`,r?.encryptSessions??!1)}async function B(e,t,n){let i=await r(T(e,t,n));if(i===null)return[];let a=[];for(let e of i.split(`
|
|
6
6
|
`)){let t=e.trim();if(t)try{a.push(JSON.parse(t))}catch{}}return a}async function V(t,n){let r=m(t,n);try{return(await e.readdir(r,{withFileTypes:!0})).filter(e=>e.isDirectory()).map(e=>e.name).sort()}catch(e){if(e.code===`ENOENT`)return[];throw e}}async function H(e,t,n){await O(e,t.id,n);let r=b(e,t.id,n),a=n?.encryptSessions??!1;await i(r,JSON.stringify(t,null,2),a)}async function U(e,t,n,r){let i=await W(e,t,r);if(!i)return null;let a={...i,...n,id:i.id,createdAt:i.createdAt,updatedAt:new Date().toISOString()};return await H(e,a,r),a}async function W(n,i,a){let o=await r(b(n,i,a));if(o===null)return null;try{let r=JSON.parse(o);if(!r.channel){let o=t.join(h(n,i,a),`.channel`);try{r.channel=(await e.readFile(o,`utf-8`)).trim()}catch{r.channel=`WEB`}}return r}catch{return null}}async function G(e,t,n){let r=await V(e,n),i=await Promise.all(r.map(async t=>{let r=await W(e,t,n);return{id:t,title:r?.title??t,channel:r?.channel??`WEB`,createdAt:r?.createdAt??``,updatedAt:r?.updatedAt??``}}));return t?i.filter(e=>e.channel===t):i}async function K(e,t,n){let i=await r(x(e,t,n));if(i===null)return E;try{let e=JSON.parse(i),t=typeof e.version==`number`?e.version:void 0;return t!==1&&t!==2?E:{version:2,updatedAt:typeof e.updatedAt==`string`?e.updatedAt:E.updatedAt,readStates:Array.isArray(e.readStates)?e.readStates:[],toolResults:Array.isArray(e.toolResults)?e.toolResults:[],compaction:{sessionMemory:e.compaction?.sessionMemory,modelUsage:e.compaction?.modelUsage,budgets:Array.isArray(e.compaction?.budgets)?e.compaction.budgets:[],snips:Array.isArray(e.compaction?.snips)?e.compaction.snips:[],collapseSpans:Array.isArray(e.compaction?.collapseSpans)?e.compaction.collapseSpans:[],consecutiveAutocompactFailures:typeof e.compaction?.consecutiveAutocompactFailures==`number`?e.compaction.consecutiveAutocompactFailures:0,lastCompactionAt:typeof e.compaction?.lastCompactionAt==`string`?e.compaction.lastCompactionAt:void 0,lastCompactionLayer:e.compaction?.lastCompactionLayer===`L1`||e.compaction?.lastCompactionLayer===`L2`||e.compaction?.lastCompactionLayer===`L3`||e.compaction?.lastCompactionLayer===`L4`||e.compaction?.lastCompactionLayer===`L5`||e.compaction?.lastCompactionLayer===`L6`?e.compaction.lastCompactionLayer:void 0}}}catch{return E}}async function q(t,n,r){let i=h(t,n,r);try{return(await e.stat(i)).isDirectory()}catch(e){if(e.code===`ENOENT`)return!1;throw e}}async function J(t,n,r){let i=b(t,n,r);try{return(await e.stat(i)).isFile()}catch(e){if(e.code===`ENOENT`)return!1;throw e}}async function Y(e,t,n){let[r,i,a]=await Promise.all([W(e,t,n),k(e,t,n),K(e,t,n)]);return{id:t,metadata:r,transcriptPath:g(e,t,n),contextSnapshotPath:x(e,t,n),sessionMemoryPath:S(e,t,n),collapseLogPath:C(e,t,n),toolResultsDir:w(e,t,n),transcriptEntryCount:i.length,readStateCount:a.readStates.length,toolResultRefCount:a.toolResults.length,transcriptEntries:i,context:a}}async function X(e,t,n){let r=await Y(e,t,n);return{id:r.id,metadata:r.metadata,transcript:r.transcriptEntries,context:r.context,paths:{transcriptPath:r.transcriptPath,contextSnapshotPath:r.contextSnapshotPath,sessionMemoryPath:r.sessionMemoryPath,collapseLogPath:r.collapseLogPath,toolResultsDir:r.toolResultsDir}}}export{m as A,d as C,q as D,h as E,a as F,o as I,r as L,w as M,g as N,S as O,U as P,s as R,b as S,H as T,B as _,L as a,v as b,x as c,O as d,X as f,j as g,V as h,z as i,_ as j,J as k,D as l,G as m,l as n,y as o,Y as p,A as r,C as s,c as t,T as u,K as v,R as w,k as x,W as y,i as z};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{t as e}from"./rolldown-runtime-CNxR59P3.js";import{E as t,F as n,L as r,z as i}from"./session-
|
|
1
|
+
import{t as e}from"./rolldown-runtime-CNxR59P3.js";import{E as t,F as n,L as r,z as i}from"./session-CvZsdTZJ.js";import a from"node:fs/promises";import o from"node:path";var s=e({appendHitlHistory:()=>d,clearPendingHitl:()=>_,createPendingHitl:()=>m,findResolvedHitlState:()=>g,hitlHistoryPath:()=>l,pendingHitlPath:()=>c,readHitlHistory:()=>p,readPendingHitl:()=>f,transitionHitlStatus:()=>h,writePendingHitl:()=>u});function c(e,n,r){return o.join(t(e,n,r),`pending-hitl.json`)}function l(e,n,r){return o.join(t(e,n,r),`hitl-history.jsonl`)}async function u(e,n,r,o){let s=t(e,n,o);await a.mkdir(s,{recursive:!0});let l=c(e,n,o),u=o?.encryptSessions??!1;await i(l,JSON.stringify(r,null,2),u)}async function d(e,r,i,o){let s=t(e,r,o);await a.mkdir(s,{recursive:!0}),await n(l(e,r,o),JSON.stringify(i)+`
|
|
2
2
|
`,o?.encryptSessions??!1)}async function f(e,t,n){let i=await r(c(e,t,n));if(i===null)return null;try{return JSON.parse(i)}catch{return null}}async function p(e,t,n){let i=await r(l(e,t,n));if(i===null)return[];let a=[];for(let e of i.split(`
|
|
3
3
|
`)){let t=e.trim();if(t)try{a.push(JSON.parse(t))}catch{}}return a}async function m(e,t,n,r,i,a,o){let s=new Date().toISOString(),c={version:1,sessionId:t,request:n,status:`pending`,checkpoint:r,context:i,toolContext:a,createdAt:s,updatedAt:s};return await u(e,t,c,o),await d(e,t,{requestId:n.requestId,sessionId:t,action:`requested`,payload:n,timestamp:s},o),c}async function h(e,t,n,r,i,a){let o=await f(e,t,a);if(!o||o.request.requestId!==n||o.status!==`pending`)return null;let s=new Date().toISOString(),c={...o,status:r,resolution:i,updatedAt:s};await u(e,t,c,a);let l={resolved:`resolved`,expired:`expired`,cancelled:`cancelled`}[r];return await d(e,t,{requestId:n,sessionId:t,action:l,payload:i??o.request,timestamp:s},a),c}async function g(e,t,n,r){let i=await f(e,t,r);return!i||i.request.requestId!==n?null:i.status===`resolved`?i:null}async function _(e,t,n){let r=c(e,t,n);try{await a.unlink(r)}catch(e){if(e.code===`ENOENT`)return;throw e}}export{c as a,s as c,l as i,h as l,m as n,p as o,g as r,f as s,_ as t};
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { $t as PluginManifestRegistry, Bn as PluginHookName, Hn as PluginHookRegistry, Pn as PluginHookHandlerMap, Yt as PluginsConfig, c as PluginUiToolOptions, cn as PluginOrigin, ir as MemoryProviderFactory, it as LlmApiFormat, mn as PluginHookAgentContext, o as PluginToolRegistry, qt as NormalizedPluginsConfig, rn as PluginDiagnostic, s as PluginUiToolDescriptor, t as DiscoveredPiExtension } from "./loader-CVsd42rJ.js";
|
|
2
|
+
import { AgentProgressEvent } from "@gencode/shared";
|
|
3
|
+
|
|
4
|
+
//#region src/plugins/runtime.d.ts
|
|
5
|
+
type PluginRuntime = {
|
|
6
|
+
version: string;
|
|
7
|
+
logging: {
|
|
8
|
+
getLogger: (name: string) => {
|
|
9
|
+
info: (message: string) => void;
|
|
10
|
+
warn: (message: string) => void;
|
|
11
|
+
error: (message: string) => void;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Read-only view of session-scoped state. Exposed to plugins so they can
|
|
16
|
+
* discover per-run configuration (e.g. environment variables passed via
|
|
17
|
+
* `AgentRunParams.env`) without re-plumbing the data through config.
|
|
18
|
+
*/
|
|
19
|
+
session: {
|
|
20
|
+
env: Record<string, string>;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
type CreatePluginRuntimeOptions = {
|
|
24
|
+
pluginId: string;
|
|
25
|
+
/**
|
|
26
|
+
* Session-scoped env map mirrored from the current run. Frozen to
|
|
27
|
+
* prevent plugins from mutating shared state.
|
|
28
|
+
*/
|
|
29
|
+
env?: Record<string, string>;
|
|
30
|
+
};
|
|
31
|
+
declare function createPluginRuntime(options: CreatePluginRuntimeOptions): PluginRuntime;
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/plugins/progress-runtime.d.ts
|
|
34
|
+
type PluginCustomProgressInput = {
|
|
35
|
+
name: string;
|
|
36
|
+
label?: string;
|
|
37
|
+
data?: Record<string, unknown>;
|
|
38
|
+
};
|
|
39
|
+
type PluginProgressEmitter = {
|
|
40
|
+
emit(event: PluginCustomProgressInput): Promise<void>;
|
|
41
|
+
};
|
|
42
|
+
declare function createPluginProgressEmitter(pluginId: string): PluginProgressEmitter;
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/llm/client.d.ts
|
|
45
|
+
type LlmChatMessage = {
|
|
46
|
+
role: "system" | "user" | "assistant";
|
|
47
|
+
content: string;
|
|
48
|
+
};
|
|
49
|
+
type LlmChatParams = {
|
|
50
|
+
system?: string;
|
|
51
|
+
user?: string;
|
|
52
|
+
messages?: LlmChatMessage[];
|
|
53
|
+
model?: string;
|
|
54
|
+
temperature?: number;
|
|
55
|
+
maxTokens?: number;
|
|
56
|
+
timeoutMs?: number;
|
|
57
|
+
signal?: AbortSignal;
|
|
58
|
+
};
|
|
59
|
+
type LlmChatResult = {
|
|
60
|
+
text: string;
|
|
61
|
+
usage: {
|
|
62
|
+
input: number;
|
|
63
|
+
output: number;
|
|
64
|
+
total: number;
|
|
65
|
+
};
|
|
66
|
+
raw?: unknown;
|
|
67
|
+
};
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/plugins/runtime-context.d.ts
|
|
70
|
+
type PluginRuntimeContext = {
|
|
71
|
+
llm?: {
|
|
72
|
+
apiFormat?: LlmApiFormat;
|
|
73
|
+
baseUrl: string;
|
|
74
|
+
apiKey: string;
|
|
75
|
+
model: string;
|
|
76
|
+
contextWindow?: number;
|
|
77
|
+
};
|
|
78
|
+
hookCtx?: PluginHookAgentContext;
|
|
79
|
+
llmAllowlist?: string[];
|
|
80
|
+
/**
|
|
81
|
+
* Session-scoped environment variables supplied via `AgentRunParams.env`.
|
|
82
|
+
* Plugins that spawn child processes (e.g. via the `exec` tool) should
|
|
83
|
+
* merge this map into the child process environment. Plugins may also
|
|
84
|
+
* read values from this map to discover session-scoped configuration.
|
|
85
|
+
*
|
|
86
|
+
* The map is held in memory only for the duration of the run and is
|
|
87
|
+
* never written to disk; it does not cross session boundaries.
|
|
88
|
+
*/
|
|
89
|
+
env?: Record<string, string>;
|
|
90
|
+
};
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region src/memory/embeddings.d.ts
|
|
93
|
+
type EmbeddingProvider = {
|
|
94
|
+
id: string;
|
|
95
|
+
model: string;
|
|
96
|
+
embedQuery: (text: string) => Promise<number[]>;
|
|
97
|
+
embedBatch: (texts: string[]) => Promise<number[][]>;
|
|
98
|
+
};
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/memory/embedding-registry.d.ts
|
|
101
|
+
type EmbeddingProviderContext = {
|
|
102
|
+
dataDir: string;
|
|
103
|
+
memoryDir: string;
|
|
104
|
+
pluginId?: string;
|
|
105
|
+
config?: Record<string, unknown>;
|
|
106
|
+
rootDir?: string;
|
|
107
|
+
source?: string;
|
|
108
|
+
};
|
|
109
|
+
type EmbeddingProviderFactory = (ctx: EmbeddingProviderContext) => EmbeddingProvider;
|
|
110
|
+
type EmbeddingProviderRegistration = {
|
|
111
|
+
id: string;
|
|
112
|
+
pluginId?: string;
|
|
113
|
+
create: EmbeddingProviderFactory;
|
|
114
|
+
config?: Record<string, unknown>;
|
|
115
|
+
rootDir?: string;
|
|
116
|
+
source?: string;
|
|
117
|
+
};
|
|
118
|
+
declare function registerEmbeddingProvider(params: {
|
|
119
|
+
pluginId: string;
|
|
120
|
+
create: EmbeddingProviderFactory;
|
|
121
|
+
id?: string;
|
|
122
|
+
config?: Record<string, unknown>;
|
|
123
|
+
rootDir?: string;
|
|
124
|
+
source?: string;
|
|
125
|
+
}): string;
|
|
126
|
+
declare function resolveEmbeddingProvider(params: {
|
|
127
|
+
providerId?: string;
|
|
128
|
+
pluginId?: string;
|
|
129
|
+
dataDir: string;
|
|
130
|
+
memoryDir: string;
|
|
131
|
+
}): {
|
|
132
|
+
provider: EmbeddingProvider;
|
|
133
|
+
registration: EmbeddingProviderRegistration;
|
|
134
|
+
} | null;
|
|
135
|
+
declare function resetEmbeddingProviderRegistryForTests(): void;
|
|
136
|
+
//#endregion
|
|
137
|
+
//#region src/plugins/loader.d.ts
|
|
138
|
+
type PluginRecord = {
|
|
139
|
+
id: string;
|
|
140
|
+
source: string;
|
|
141
|
+
origin: PluginOrigin;
|
|
142
|
+
enabled: boolean;
|
|
143
|
+
status: "loaded" | "disabled" | "error";
|
|
144
|
+
error?: string;
|
|
145
|
+
durationMs?: number;
|
|
146
|
+
toolCount: number;
|
|
147
|
+
hookCount: number;
|
|
148
|
+
skills: string[];
|
|
149
|
+
configSchema: boolean;
|
|
150
|
+
};
|
|
151
|
+
type PluginRegistry = {
|
|
152
|
+
plugins: PluginRecord[];
|
|
153
|
+
diagnostics: PluginDiagnostic[];
|
|
154
|
+
tools: PluginToolRegistry;
|
|
155
|
+
hooks: PluginHookRegistry;
|
|
156
|
+
skills: string[];
|
|
157
|
+
};
|
|
158
|
+
type PluginLoadOptions = {
|
|
159
|
+
registry: PluginManifestRegistry;
|
|
160
|
+
plugins: NormalizedPluginsConfig;
|
|
161
|
+
workspaceDir?: string;
|
|
162
|
+
runtime?: PluginRuntimeContext;
|
|
163
|
+
};
|
|
164
|
+
type PluginApi = {
|
|
165
|
+
id: string;
|
|
166
|
+
source: string;
|
|
167
|
+
rootDir: string;
|
|
168
|
+
config: Record<string, unknown> | undefined;
|
|
169
|
+
runtime: ReturnType<typeof createPluginRuntime>;
|
|
170
|
+
llm: {
|
|
171
|
+
chat: (params: LlmChatParams) => Promise<LlmChatResult>;
|
|
172
|
+
};
|
|
173
|
+
registerTool: (tool: Parameters<PluginToolRegistry["register"]>[1], opts?: Parameters<PluginToolRegistry["register"]>[2]) => void;
|
|
174
|
+
/**
|
|
175
|
+
* Register a UI tool that pauses the agent and collects structured user
|
|
176
|
+
* input through a front-end form.
|
|
177
|
+
*
|
|
178
|
+
* Unlike `registerTool`, the plugin only provides the form schema and
|
|
179
|
+
* metadata — session binding, pause/resume control flow, and result
|
|
180
|
+
* validation are handled automatically by the framework.
|
|
181
|
+
*/
|
|
182
|
+
registerUiTool: (descriptor: PluginUiToolDescriptor, opts?: PluginUiToolOptions) => void;
|
|
183
|
+
registerEmbeddingProvider: (params: {
|
|
184
|
+
id?: string;
|
|
185
|
+
create: EmbeddingProviderFactory;
|
|
186
|
+
}) => void;
|
|
187
|
+
registerMemoryProvider: (params: {
|
|
188
|
+
id?: string;
|
|
189
|
+
create: MemoryProviderFactory;
|
|
190
|
+
}) => void;
|
|
191
|
+
registerHook: <K extends PluginHookName>(hookName: K, handler: PluginHookHandlerMap[K], opts?: {
|
|
192
|
+
priority?: number;
|
|
193
|
+
}) => void;
|
|
194
|
+
registerSkillDir: (dir: string) => void;
|
|
195
|
+
createProgressEmitter: () => PluginProgressEmitter;
|
|
196
|
+
};
|
|
197
|
+
declare function loadPlugins(options: PluginLoadOptions): PluginRegistry;
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region src/plugins/manager.d.ts
|
|
200
|
+
/**
|
|
201
|
+
* Pre-load plugin system at container startup time.
|
|
202
|
+
* Blocks ~1.8s (jiti compile) but runs BEFORE any user request arrives.
|
|
203
|
+
* Multiple calls are idempotent — won't recompile.
|
|
204
|
+
*/
|
|
205
|
+
declare function preloadPluginSystem(options: PluginSystemOptions): PluginSystem;
|
|
206
|
+
/**
|
|
207
|
+
* Get pre-loaded plugin system if available, otherwise cold-start.
|
|
208
|
+
* Session creation should use this (returns instantly if pre-warmed).
|
|
209
|
+
*/
|
|
210
|
+
declare function getPluginSystem(options: PluginSystemOptions): PluginSystem;
|
|
211
|
+
type PluginSystemOptions = {
|
|
212
|
+
config?: PluginsConfig;
|
|
213
|
+
dataDir?: string;
|
|
214
|
+
workspaceDir?: string;
|
|
215
|
+
bundledDir?: string;
|
|
216
|
+
ownershipUid?: number | null;
|
|
217
|
+
toolAllowlist?: string[];
|
|
218
|
+
runtime?: PluginRuntimeContext; /** Extra paths for pi community extensions (plugins.piExtensions.paths). */
|
|
219
|
+
piExtensionPaths?: string[];
|
|
220
|
+
};
|
|
221
|
+
type PluginSystem = {
|
|
222
|
+
registry: PluginRegistry;
|
|
223
|
+
diagnostics: PluginDiagnostic[];
|
|
224
|
+
normalizedConfig: NormalizedPluginsConfig;
|
|
225
|
+
piExtensions: DiscoveredPiExtension[];
|
|
226
|
+
};
|
|
227
|
+
declare function initializePluginSystem(options?: PluginSystemOptions): PluginSystem;
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/system-runtime.d.ts
|
|
230
|
+
type SystemWarmState = {
|
|
231
|
+
runtimeInitialized: true;
|
|
232
|
+
pluginSystem: PluginSystem;
|
|
233
|
+
loadedAt: string;
|
|
234
|
+
version: 1;
|
|
235
|
+
};
|
|
236
|
+
type PrepareSystemRuntimeOptions = Pick<PluginSystemOptions, "bundledDir" | "config" | "ownershipUid" | "piExtensionPaths">;
|
|
237
|
+
declare function prepareSystemRuntime(options?: PrepareSystemRuntimeOptions): SystemWarmState;
|
|
238
|
+
//#endregion
|
|
239
|
+
export { createPluginProgressEmitter as C, PluginProgressEmitter as S, createPluginRuntime as T, resetEmbeddingProviderRegistryForTests as _, PluginSystemOptions as a, PluginRuntimeContext as b, preloadPluginSystem as c, PluginRegistry as d, loadPlugins as f, registerEmbeddingProvider as g, EmbeddingProviderRegistration as h, PluginSystem as i, PluginApi as l, EmbeddingProviderFactory as m, SystemWarmState as n, getPluginSystem as o, EmbeddingProviderContext as p, prepareSystemRuntime as r, initializePluginSystem as s, PrepareSystemRuntimeOptions as t, PluginRecord as u, resolveEmbeddingProvider as v, PluginRuntime as w, PluginCustomProgressInput as x, EmbeddingProvider as y };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{i as e,t}from"./provider-registry-DPbmbWqS.js";import{n}from"./loader-CkdBGDtW.js";import{validateUiToolResult as r}from"@gencode/shared";import i from"node:path";import a from"node:os";import{AsyncLocalStorage as o}from"node:async_hooks";import s from"node:fs";import c from"log4js";import{Type as l}from"@earendil-works/pi-ai";import u from"ajv";import{createJiti as d}from"jiti";function f(e){return e??`openai-completions`}function p(e,t,n){let r={"Client-Code":`AIMax`,"X-Session-Id":e};return t&&(r[`X-Message-Id`]=t),n&&(r[`X-Channel`]=n),r}function m(e){let t=e?.input??e?.prompt_tokens??0,n=e?.output??e?.completion_tokens??0;return{input:t,output:n,total:e?.total??e?.total_tokens??t+n}}const h={apiFormat:`anthropic-messages`,createModel:g,buildRequest:v,normalizeResponse:ee};function g(e,t,n,r){return{id:e.model,name:e.model,api:`anthropic-messages`,provider:`anthropic`,baseUrl:_(e.baseUrl),reasoning:!1,input:[`text`,`image`],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:e.contextWindow??2e5,maxTokens:e.maxTokens??32768,headers:p(t,n,r)}}function _(e){return e.replace(/\/+$/,``).replace(/\/v1$/,``)}function v(e,t,n,r){let i=e.baseUrl.replace(/\/+$/,``),a=[],o=[];for(let e of n){if(e.role===`system`){e.content.trim()&&o.push(e.content);continue}a.push({role:e.role,content:e.content})}let s={model:t,messages:a.length>0?a:[{role:`user`,content:``}],max_tokens:r.maxTokens??2048,stream:!1};return o.length>0&&(s.system=o.join(`
|
|
2
|
+
|
|
3
|
+
`)),typeof r.temperature==`number`&&(s.temperature=r.temperature),{url:i.endsWith(`/v1`)?`${i}/messages`:`${i}/v1/messages`,headers:{"content-type":`application/json`,"x-api-key":e.apiKey,"anthropic-version":`2023-06-01`,"Client-Code":`AIMax`},body:s}}function ee(e){let t=e,n=t.content?.filter(e=>e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(``)??``,r=(t.usage?.input_tokens??0)+(t.usage?.cache_read_input_tokens??0)+(t.usage?.cache_creation_input_tokens??0),i=t.usage?.output_tokens??0;return{text:n,usage:{input:r,output:i,total:r+i},raw:e}}const y={apiFormat:`openai-completions`,createModel:te,buildRequest:ne,normalizeResponse:re};function te(e,t,n,r){let i=e.baseUrl.includes(`deepseek.com`),a=e.thinking;return{id:e.model,name:e.model,api:`openai-completions`,provider:i?`deepseek`:`openai`,baseUrl:e.baseUrl,reasoning:i||!!a,...i&&{thinkingLevelMap:{high:`high`,xhigh:`max`}},...a&&!i&&{thinkingLevelMap:{high:`high`,xhigh:`high`}},input:[`text`],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:e.contextWindow??2e5,maxTokens:e.maxTokens??32768,headers:p(t,n,r),compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!!(a&&!i),supportsUsageInStreaming:!0,...a&&!i&&{thinkingFormat:`deepseek`}}}}function ne(e,t,n,r){let i={model:t,messages:n,stream:!1};return typeof r.temperature==`number`&&(i.temperature=r.temperature),typeof r.maxTokens==`number`&&(i.max_tokens=r.maxTokens),{url:`${e.baseUrl.replace(/\/+$/,``)}/chat/completions`,headers:{"content-type":`application/json`,authorization:`Bearer ${e.apiKey}`,"Client-Code":`AIMax`},body:i}}function re(e){let t=e;return{text:t.choices?.[0]?.message?.content??t.choices?.[0]?.text??``,usage:m(t.usage),raw:e}}const ie={"openai-completions":y,"anthropic-messages":h};function ae(e){return ie[e]}const b=new o;async function x(e,t){return await b.run(e,t)}function S(e){return{async emit(t){let n=b.getStore();if(!n||n.pluginId!==e)throw Error(`Plugin ${e} cannot emit progress outside its runtime context`);if(!n.hookContext.sessionId)throw Error(`Plugin ${e} cannot emit progress without an active session`);await n.eventDispatcher.dispatchProgress(n.hookContext.sessionId,{type:`custom`,pluginId:e,name:t.name,label:t.label,data:t.data})}}}const oe={before_prompt_build:`before_agent_start`,after_tool_call:`tool_result (for mutable results) or before_tool_call (for blocking)`};var C=class{hooks=new Map;deprecatedWarned=new Set;register(e){let t=oe[e.hookName];t&&!this.deprecatedWarned.has(e.hookName)&&(this.deprecatedWarned.add(e.hookName),console.warn(`[PluginHookRegistry] Hook "${e.hookName}" is deprecated. Use "${t}" instead. (plugin: ${e.pluginId})`));let n=this.hooks.get(e.hookName)??[];n.push(e),n.sort((e,t)=>(e.priority??0)-(t.priority??0)),this.hooks.set(e.hookName,n)}async dispatch(e,t,n,r){return(await this.dispatchWithMetadata(e,t,n,r)).map(e=>e.result)}async dispatchWithMetadata(e,t,n,r){let i=this.hooks.get(e)??[],a=[];for(let e of i){let i=async()=>await e.handler(t,n),o=r?await x({pluginId:e.pluginId,hookContext:n,eventDispatcher:r.eventDispatcher},i):await i();a.push({pluginId:e.pluginId,source:e.source,result:o})}return a}};function se(e){let t=new Intl.DateTimeFormat(`en-CA`,{timeZone:`Asia/Shanghai`,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}).formatToParts(e);return Object.fromEntries(t.map(e=>[e.type,e.value]))}function ce(e=new Date){let t=se(e),n=String(e.getMilliseconds()).padStart(3,`0`);return`${t.year}-${t.month}-${t.day} ${t.hour}:${t.minute}:${t.second}.${n}`}let w=function(e){return e.INFO=`INFO`,e.WARN=`WARN`,e.ERROR=`ERROR`,e}({});const T=new o;function le(e,t){return T.run(e,t)}let E=null,D=[];function ue(){return ce()}function de(e){if(!e)return``;let t=Object.entries(e).filter(([,e])=>e!==void 0).map(([e,t])=>`${e}=${JSON.stringify(t)}`);return t.length>0?` ${t.join(` `)}`:``}function fe(e){return i.join(e,`.aimax`)}function pe(e){let t=e?.trim();return t&&t.replace(/[^A-Za-z0-9_.-]/g,`_`)||`no-message-${process.pid}`}function me(e,t){let n=t?.sessionStoreName?.trim()||`sessions`,r=pe(t?.messageId);return t?.sessionDir?{runLogId:r,logDir:i.join(t.sessionDir,`logs`,r)}:t?.sessionId?{runLogId:r,logDir:i.join(fe(e),n,t.sessionId,`logs`,r)}:{runLogId:r,logDir:i.join(fe(e),`logs`,r)}}function he(e){return{appLogPath:i.join(e,`app.log`),errorLogPath:i.join(e,`errors.log`)}}function ge(e){let{appLogPath:t,errorLogPath:n}=he(e);c.configure({appenders:{appFile:{type:`file`,filename:t,maxLogSize:5*1024*1024,backups:3,compress:!0,keepFileExt:!0,layout:{type:`messagePassThrough`}},errorFile:{type:`file`,filename:n,maxLogSize:5*1024*1024,backups:3,compress:!0,keepFileExt:!0,layout:{type:`messagePassThrough`}},errorsOnly:{type:`logLevelFilter`,appender:`errorFile`,level:`error`,maxLevel:`fatal`}},categories:{default:{appenders:[`appFile`,`errorsOnly`],level:`info`}}})}function O(e,t,n){return`[${ue()}] [${e}] ${t}${de(n)}`}function _e(e,t,n){let r=T.getStore();if(r){r({level:e,message:t,context:n,formatted:O(e,t,n)});return}try{process.stderr.write(`${O(e,t,n)}\n`)}catch{}}function k(e,t,n){if(!E){D.push({level:e,message:t,context:n}),D.length>200&&(D=D.slice(-200)),_e(e,t,n);return}let r=O(e,t,n),i=c.getLogger();e===w.ERROR?i.error(r):e===w.WARN?i.warn(r):i.info(r);let a=T.getStore();a&&a({level:e,message:t,context:n,formatted:r})}function ve(e,t){let{logDir:n,runLogId:r}=me(e,t);if(E?.dataDir===e&&E.runLogId===r&&E.logDir===n)return;s.mkdirSync(n,{recursive:!0}),ge(n),E={dataDir:e,logDir:n,runLogId:r};let i=D;D=[];for(let e of i)k(e.level,e.message,e.context)}const A={info:(e,t)=>k(w.INFO,e,t),warn:(e,t)=>k(w.WARN,e,t),error:(e,t)=>k(w.ERROR,e,t)};function ye(e,t){if(e===void 0)return;let n=e.replace(/\s+/g,` `).trim();return t===void 0||n.length<=t?n:`${n.slice(0,Math.max(0,t-3))}...`}var j=class extends Error{code;statusCode;statusText;providerMessage;providerCode;providerType;retryable;constructor(e){super(e.message,{cause:e.cause}),this.name=`LlmRequestError`,this.code=e.code,this.statusCode=e.statusCode,this.statusText=e.statusText,this.providerMessage=e.providerMessage,this.providerCode=e.providerCode,this.providerType=e.providerType,this.retryable=e.retryable}};function M(e){return{async chat(t){let n=xe(t),r=t.model??e.defaultModel;if(!r)throw Error(`LLM model is required`);await N(e.hooks,`llm_input`,{sessionId:e.hookCtx?.sessionId??`unknown`,model:r,prompt:Se(n),historyMessages:n},e.hookCtx);let i=ae(f(e.apiFormat)),a=i.buildRequest(e,r,n,t),{signal:o,clear:s,didTimeout:c}=Ce(t.signal,t.timeoutMs);try{let t;try{t=await fetch(a.url,{method:`POST`,headers:a.headers,body:JSON.stringify(a.body),signal:o})}catch(e){throw Te(e,c())}if(!t.ok){let e=await we(t)||void 0,n=t.statusText?.trim()||void 0,r=[t.status,n].filter(Boolean).join(` `);throw new j({message:e?`LLM upstream returned HTTP ${r}: ${e}`:`LLM upstream returned HTTP ${r}`,code:`http_error`,statusCode:t.status,statusText:n,providerMessage:e,retryable:Ee(t.status)})}let n=Date.now(),s;try{s=await t.json()}catch(e){throw be(e,c())}let{text:l,usage:u}=i.normalizeResponse(s),d=Math.max(0,Date.now()-n);return await N(e.hooks,`llm_output`,{sessionId:e.hookCtx?.sessionId??`unknown`,model:r,assistantTexts:l?[l]:[],durationMs:d,usage:u},e.hookCtx),{text:l,usage:u,raw:s}}finally{s()}}}}function be(e,t){return P(e)&&t?new j({message:`LLM request timed out`,code:`timeout`,retryable:!0,cause:e}):P(e)?new j({message:`LLM request was aborted`,code:`aborted`,retryable:!0,cause:e}):new j({message:`LLM upstream returned an invalid JSON response`,code:`invalid_response`,retryable:!1,cause:e})}function xe(e){if(Array.isArray(e.messages)&&e.messages.length>0)return e.messages;let t=[];if(e.system?.trim()&&t.push({role:`system`,content:e.system}),e.user?.trim()&&t.push({role:`user`,content:e.user}),t.length===0)throw Error(`LLM messages are required`);return t}function Se(e){return e.map(e=>`${e.role}: ${e.content}`).join(`
|
|
4
|
+
`)}async function N(e,t,n,r){!e||!r||await e.dispatch(t,n,r)}function Ce(e,t){if(!e&&(!t||t<=0))return{signal:void 0,clear:()=>{},didTimeout:()=>!1};let n=new AbortController,r,i=!1;return e&&(e.aborted?n.abort():e.addEventListener(`abort`,()=>n.abort(),{once:!0})),t&&t>0&&(r=setTimeout(()=>{i=!0,n.abort()},t)),{signal:n.signal,clear:()=>{r&&clearTimeout(r)},didTimeout:()=>i}}async function we(e){try{let t=await e.text();return t?t.trim().slice(0,200):``}catch{return``}}function Te(e,t){return e instanceof j?e:P(e)?t?new j({message:`LLM request timed out`,code:`timeout`,retryable:!0,cause:e}):e:new j({message:`LLM network request failed: ${e instanceof Error?e.message:String(e)}`,code:`network_error`,retryable:!0,cause:e})}function P(e){return e instanceof Error&&e.name===`AbortError`}function Ee(e){return e===408||e===409||e===425||e===429||e>=500}var F=class extends Error{isUiToolPause=!0;request;constructor(e,t,n,r,i,a,o){super(`UI_TOOL_PAUSED`),this.toolArgs=o,this.name=`UiToolPauseSignal`,this.request={requestId:e,sessionId:t,toolName:n,toolCallId:r,outputSchema:i,extra:a,createdAt:new Date().toISOString()}}};function De(e){return!!(e instanceof F||typeof e==`object`&&e&&`isUiToolPause`in e&&e.isUiToolPause===!0)}const I=new o;function Oe(){return{}}async function ke(e,t){return await I.run(e,t)}function Ae(e){let t=I.getStore();!t||t.signal||(t.signal=e)}const je=l.Object({reason:l.String({description:`A brief explanation of why user input is needed through this UI form.`})});function Me(e){let{name:t,label:n,description:i,sessionId:a,inputSchema:o,outputSchema:s,extra:c,validate:l,resume:u}=e;return{name:t,label:n,description:i,parameters:o??je,async execute(e,n){if(u&&u.toolCallId===e&&u.toolName===t&&u.sessionId===a){let e=r(s,u.values);if(!e.valid){let t=e.errors;return{content:[{type:`text`,text:JSON.stringify({error:`validation_failed`,errors:t})}],details:{}}}if(l){let e=await l(u.values);if(!e.valid){let t=e.errors;return{content:[{type:`text`,text:JSON.stringify({error:`validation_failed`,errors:t})}],details:{}}}}return{content:[{type:`text`,text:JSON.stringify({submitted:!0,values:u.values})}],details:{}}}let i=new F(e,a,t,e,s,c,n);throw Ae(i),i}}}const L=Symbol(`pluginToolOwner`);var Ne=class{tools=[];uiTools=[];register(e,t,n){let r=t.name,i=n?.names??(n?.name?[n.name]:r?[r]:[]);Object.defineProperty(t,L,{value:e,enumerable:!1,configurable:!1,writable:!1}),this.tools.push({pluginId:e,tool:t,optional:n?.optional??!1,names:i})}registerUiTool(e,t,n){this.uiTools.push({pluginId:e,descriptor:t,optional:n?.optional??!1})}list(){return[...this.tools]}listUiTools(){return[...this.uiTools]}namesForPlugin(e){let t=this.tools.filter(t=>t.pluginId===e).flatMap(e=>e.names),n=this.uiTools.filter(t=>t.pluginId===e).map(e=>e.descriptor.name);return[...t,...n]}resolveEnabled(e){let t=new Set((e??[]).map(e=>e.trim()).filter(Boolean));return this.tools.filter(e=>{if(!e.optional)return!0;if(t.size===0)return!1;if(t.has(e.pluginId))return!0;for(let n of e.names)if(t.has(n))return!0;return!1}).map(e=>e.tool)}resolveUiTools(e,t,n){let r=new Set((n??[]).map(e=>e.trim()).filter(Boolean));return this.uiTools.filter(e=>e.optional?r.size===0?!1:!!(r.has(e.pluginId)||r.has(e.descriptor.name)):!0).map(n=>{let r=Me({name:n.descriptor.name,label:n.descriptor.label,description:n.descriptor.description,sessionId:e,inputSchema:n.descriptor.inputSchema,outputSchema:n.descriptor.outputSchema,extra:n.descriptor.extra,validate:n.descriptor.validate,resume:t});return Object.defineProperty(r,L,{value:n.pluginId,enumerable:!1,configurable:!1,writable:!1}),r})}};function Pe(e){return e[L]}function R(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function z(e){return Array.isArray(e)?e.map(e=>typeof e==`string`?e.trim():``).filter(Boolean):[]}function Fe(){let e=a.homedir();if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function Ie(e){let t=e.trim(),n=Fe();return t===`~`?n:t.startsWith(`~/`)||t.startsWith(`~\\`)?n?i.join(n,t.slice(2)):void 0:i.resolve(t)}const Le=new u({allErrors:!0,strict:!1}),Re=new Map;function ze(e,t){let n=Re.get(t);if(n)return n;let r=Le.compile(e);return Re.set(t,r),r}function Be(e){let t=e.cacheKey??JSON.stringify(e.schema),n=ze(e.schema,t);return n(e.value)?{ok:!0}:{ok:!1,errors:(n.errors??[]).map(e=>({path:e.instancePath||`/`,message:e.message??`invalid`}))}}function Ve(e){let t=z(e?.allow),n=z(e?.deny),r=z(e?.load?.paths),i=z(e?.piExtensions?.paths),a=e?.entries??{},o=e?.slots??{};return{enabled:e?.enabled??!0,allow:Array.from(new Set(t)),deny:Array.from(new Set(n)),loadPaths:Array.from(new Set(r)),piExtensionPaths:Array.from(new Set(i)),entries:a,slots:o}}function He(e){let t=[],{config:n,registry:r}=e,i=new Set(r.manifests.keys()),a=(e,n)=>i.has(e)?!0:(t.push({level:`error`,message:`unknown plugin id in ${n}: ${e}`,pluginId:e}),!1);for(let e of n.allow)a(e,`plugins.allow`);for(let e of n.deny)a(e,`plugins.deny`);for(let e of Object.keys(n.entries))a(e,`plugins.entries`);let o=n.slots??{};for(let[e,n]of Object.entries(o)){if(!n||n===`none`||!a(n,`plugins.slots.${e}`))continue;let i=r.manifests.get(n);i?.manifest.kind?i.manifest.kind!==e&&t.push({level:`error`,message:`plugin ${n} does not declare kind ${e}`,pluginId:n}):t.push({level:`error`,message:`plugin ${n} does not declare kind ${e}`,pluginId:n})}for(let[e,i]of Object.entries(n.entries)){let n=r.manifests.get(e);if(!n)continue;let a=n.manifest.configSchema,o=Be({schema:a,cacheKey:`${e}:${n.manifestPath}`,value:i?.config??{}});if(!o.ok)for(let n of o.errors)t.push({level:`error`,message:`plugin config invalid (${e}) at ${n.path}: ${n.message}`,pluginId:e});i?.enabled===!1&&i?.config&&t.push({level:`warn`,message:`plugin config set while disabled: ${e}`,pluginId:e})}return{ok:t.every(e=>e.level!==`error`),diagnostics:t}}function B(e){try{return s.realpathSync(e)}catch{return null}}function Ue(e){try{return s.statSync(e)}catch{return null}}function V(e,t){let n=i.relative(e,t);return n===``?!0:n.startsWith(`..`)?!1:!i.isAbsolute(n)}function We(e){return`0o${e.toString(8).padStart(3,`0`)}`}const H=new Set([`.ts`,`.js`,`.mts`,`.cts`,`.mjs`,`.cjs`]),Ge=[`index.js`,`index.mjs`,`index.cjs`,`index.ts`,`index.mts`,`index.cts`];function Ke(e){let t=i.join(e,`package.json`);if(s.existsSync(t))try{let e=JSON.parse(s.readFileSync(t,`utf-8`));return R(e)?e:void 0}catch{return}}function qe(e){let t=e?.aimax?.extensions;if(!Array.isArray(t))return{status:`missing`,entries:[]};let n=t.map(e=>typeof e==`string`?e.trim():``).filter(Boolean);return n.length===0?{status:`empty`,entries:[]}:{status:`ok`,entries:n}}function Je(e){return e===void 0?process.platform===`win32`||typeof process.getuid!=`function`?null:process.getuid():e}function Ye(e){let t=B(e.source),n=B(e.rootDir);return!t||!n||V(n,t)?null:{reason:`source_escapes_root`,sourcePath:e.source,rootPath:e.rootDir,targetPath:e.source,sourceRealPath:t,rootRealPath:n}}function Xe(e){if(process.platform===`win32`)return null;let t=[e.rootDir,e.source],n=new Set;for(let r of t){let t=i.resolve(r);if(n.has(t))continue;n.add(t);let a=Ue(r);if(!a)return{reason:`path_stat_failed`,sourcePath:e.source,rootPath:e.rootDir,targetPath:r};let o=a.mode&511;if(o&2)return{reason:`path_world_writable`,sourcePath:e.source,rootPath:e.rootDir,targetPath:r,modeBits:o};if(e.origin!==`bundled`&&e.uid!==null&&typeof a.uid==`number`&&a.uid!==e.uid&&a.uid!==0)return{reason:`path_suspicious_ownership`,sourcePath:e.source,rootPath:e.rootDir,targetPath:r,foundUid:a.uid,expectedUid:e.uid}}return null}function Ze(e){return Ye({source:e.source,rootDir:e.rootDir})||Xe({source:e.source,rootDir:e.rootDir,origin:e.origin,uid:Je(e.ownershipUid)})}function Qe(e){return e.reason===`source_escapes_root`?`blocked plugin candidate: source escapes plugin root (${e.sourcePath} -> ${e.sourceRealPath}; root=${e.rootRealPath})`:e.reason===`path_stat_failed`?`blocked plugin candidate: cannot stat path (${e.targetPath})`:e.reason===`path_world_writable`?`blocked plugin candidate: world-writable path (${e.targetPath}, mode=${We(e.modeBits??0)})`:`blocked plugin candidate: suspicious ownership (${e.targetPath}, uid=${e.foundUid}, expected uid=${e.expectedUid} or root)`}function U(e){let t=Ze({source:e.source,rootDir:e.rootDir,origin:e.origin,ownershipUid:e.ownershipUid});return t?(e.diagnostics.push({level:`warn`,message:Qe(t),source:e.source}),!0):!1}function W(e){return i.basename(e,i.extname(e))}function G(e){return{idHint:e.idHint,source:e.source,rootDir:e.rootDir,origin:e.origin,workspaceDir:e.workspaceDir,packageName:e.packageName,packageVersion:e.packageVersion,packageDescription:e.packageDescription,packageDir:e.packageDir,packageManifest:e.packageManifest}}function $e(e){for(let t of Ge){let n=i.join(e,t);if(s.existsSync(n))return n}return null}function K(e){let t;try{t=s.readdirSync(e.rootDir,{withFileTypes:!0})}catch{return}for(let n of t){let t=i.join(e.rootDir,n.name);if(n.isFile()){if(!H.has(i.extname(n.name)))continue;let r=i.dirname(t);if(U({source:t,rootDir:r,origin:e.origin,diagnostics:e.diagnostics,ownershipUid:e.ownershipUid}))continue;e.candidates.push(G({idHint:W(t),source:t,rootDir:r,origin:e.origin,workspaceDir:e.workspaceDir}));continue}if(!n.isDirectory())continue;let r=Ke(t),a=qe(r);if(a.status===`ok`){for(let n of a.entries){let a=i.resolve(t,n);if(!V(t,a)){e.diagnostics.push({level:`warn`,message:`blocked plugin candidate: package entry escapes package root (${n})`,source:a});continue}if(!s.existsSync(a)){e.diagnostics.push({level:`warn`,message:`plugin entry missing: ${a}`,source:a});continue}if(!H.has(i.extname(a))){e.diagnostics.push({level:`warn`,message:`plugin entry not a supported extension: ${a}`,source:a});continue}if(U({source:a,rootDir:t,origin:e.origin,diagnostics:e.diagnostics,ownershipUid:e.ownershipUid}))continue;let o=r?.name?.trim(),c=o?`${o}/${W(a)}`:W(a);e.candidates.push(G({idHint:c,source:a,rootDir:t,origin:e.origin,workspaceDir:e.workspaceDir,packageName:r?.name,packageVersion:r?.version,packageDescription:r?.description,packageDir:t,packageManifest:r?.aimax}))}continue}let o=$e(t);o&&(U({source:o,rootDir:t,origin:e.origin,diagnostics:e.diagnostics,ownershipUid:e.ownershipUid})||e.candidates.push(G({idHint:i.basename(t),source:o,rootDir:t,origin:e.origin,workspaceDir:e.workspaceDir})))}}function et(e){return e?e.map(Ie).filter(e=>typeof e==`string`&&e.length>0):[]}function tt(){let e=Fe();if(e)return i.join(e,`.aimax`,`extensions`)}function nt(e){return i.join(e,`.aimax`,`extensions`)}function rt(e){return i.join(e,`.aimax`,`extensions`)}function it(e={}){let t=[],n=[],r=et(e.extraPaths);for(let a of r){if(!s.existsSync(a)){n.push({level:`warn`,message:`plugin path not found: ${a}`,source:a});continue}let r=Ue(a);if(!r){n.push({level:`warn`,message:`plugin path not readable: ${a}`,source:a});continue}if(r.isFile()){if(!H.has(i.extname(a))){n.push({level:`warn`,message:`plugin file has unsupported extension: ${a}`,source:a});continue}let r=i.dirname(a);if(U({source:a,rootDir:r,origin:`config`,diagnostics:n,ownershipUid:e.ownershipUid}))continue;t.push(G({idHint:W(a),source:a,rootDir:r,origin:`config`,workspaceDir:e.workspaceDir}));continue}r.isDirectory()&&K({rootDir:a,origin:`config`,workspaceDir:e.workspaceDir,diagnostics:n,candidates:t,ownershipUid:e.ownershipUid})}e.dataDir?K({rootDir:nt(e.dataDir),origin:`workspace`,workspaceDir:e.workspaceDir,diagnostics:n,candidates:t,ownershipUid:e.ownershipUid}):e.workspaceDir&&K({rootDir:rt(e.workspaceDir),origin:`workspace`,workspaceDir:e.workspaceDir,diagnostics:n,candidates:t,ownershipUid:e.ownershipUid});let a=tt();return a?K({rootDir:a,origin:`global`,workspaceDir:e.workspaceDir,diagnostics:n,candidates:t,ownershipUid:e.ownershipUid}):n.push({level:`warn`,message:`skipping global plugin discovery: home directory is unavailable`}),e.bundledDir&&K({rootDir:e.bundledDir,origin:`bundled`,workspaceDir:e.workspaceDir,diagnostics:n,candidates:t,ownershipUid:e.ownershipUid}),{candidates:t,diagnostics:n}}function at(e){let t=e.rejectHardlinks??!0,n=B(e.rootPath),r=B(e.absolutePath);if(!n||!r)return{ok:!1,reason:`path`};if(!V(n,r))return{ok:!1,reason:`unsafe`};let i;try{i=s.lstatSync(r)}catch{return{ok:!1,reason:`stat`}}if(t&&typeof i.nlink==`number`&&i.nlink>1)return{ok:!1,reason:`hardlink`};try{return{ok:!0,fd:s.openSync(r,`r`)}}catch{return{ok:!1,reason:`path`}}}const q=`aimax.plugin.json`,ot=[q];function st(e){for(let t of ot){let n=i.join(e,t);if(s.existsSync(n))return n}return i.join(e,q)}function ct(e,t=!0){let n=st(e),r=at({absolutePath:n,rootPath:e,rejectHardlinks:t});if(!r.ok){let e=r.reason;return e===`path`?{ok:!1,error:`plugin manifest not found: ${n}`,manifestPath:n}:{ok:!1,error:`unsafe plugin manifest path: ${n} (${e})`,manifestPath:n}}let i;try{i=JSON.parse(s.readFileSync(r.fd,`utf-8`))}catch(e){return{ok:!1,error:`failed to parse plugin manifest: ${String(e)}`,manifestPath:n}}finally{s.closeSync(r.fd)}if(!R(i))return{ok:!1,error:`plugin manifest must be an object`,manifestPath:n};let a=typeof i.id==`string`?i.id.trim():``;if(!a)return{ok:!1,error:`plugin manifest requires id`,manifestPath:n};let o=R(i.configSchema)?i.configSchema:null;if(!o)return{ok:!1,error:`plugin manifest requires configSchema`,manifestPath:n};let c=typeof i.kind==`string`?i.kind:void 0,l=typeof i.name==`string`?i.name.trim():void 0,u=typeof i.description==`string`?i.description.trim():void 0,d=typeof i.version==`string`?i.version.trim():void 0,f=z(i.skills),p;return R(i.uiHints)&&(p=i.uiHints),{ok:!0,manifest:{id:a,configSchema:o,kind:c,name:l,description:u,version:d,skills:f,uiHints:p},manifestPath:n}}function lt(e){let t=new Map,n=[];for(let r of e){let e=ct(r.rootDir);if(!e.ok){n.push({level:`error`,message:e.error,source:r.source,pluginId:r.idHint});continue}let i=e.manifest.id;if(t.has(i)){n.push({level:`warn`,message:`duplicate plugin id ignored: ${i}`,source:r.source,pluginId:i});continue}t.set(i,{id:i,rootDir:r.rootDir,source:r.source,origin:r.origin,manifestPath:e.manifestPath,manifest:e.manifest})}return{manifests:t,diagnostics:n}}let J=function(e){return e.INFO=`INFO`,e.WARN=`WARN`,e.ERROR=`ERROR`,e}({});function Y(e,t,n,r){let i=`[plugin:${t}][logger:${n}] ${r}`;if(e===J.ERROR){A.error(i);return}if(e===J.WARN){A.warn(i);return}A.info(i)}function ut(e){return{version:`0.1.0`,logging:{getLogger:t=>({info:n=>Y(J.INFO,e.pluginId,t,n),warn:n=>Y(J.WARN,e.pluginId,t,n),error:n=>Y(J.ERROR,e.pluginId,t,n)})},session:{env:Object.freeze({...e.env??{}})}}}let dt;function ft(){return dt||=d(import.meta.url,{interopDefault:!0,requireCache:!0}),dt}function pt(e){if(!e.config.enabled)return!1;let t=e.config.entries[e.pluginId];if(t?.enabled===!1||e.config.deny.includes(e.pluginId)||e.config.allow.length>0&&!e.config.allow.includes(e.pluginId)||e.origin===`bundled`&&t?.enabled!==!0)return!1;if(e.kind&&e.config.slots?.[e.kind]){let t=e.config.slots[e.kind];if(t&&t!==`none`&&t!==e.pluginId)return!1}return!0}function mt(e){return{id:e.id,source:e.source,origin:e.origin,enabled:e.enabled,status:e.enabled?`loaded`:`disabled`,toolCount:0,hookCount:0,skills:e.skills,configSchema:e.configSchema}}function ht(n){let r=[...n.registry.diagnostics],a=new Ne,o=new C,s=[],c=[],l=n.runtime?.llm?M({apiFormat:n.runtime.llm.apiFormat,baseUrl:n.runtime.llm.baseUrl,apiKey:n.runtime.llm.apiKey,defaultModel:n.runtime.llm.model,hooks:o,hookCtx:n.runtime.hookCtx}):void 0,u=gt(n.runtime?.llmAllowlist),d=ft();for(let f of n.registry.manifests.values()){let p=pt({config:n.plugins,pluginId:f.id,origin:f.origin,kind:f.manifest.kind}),m=mt({id:f.id,source:f.source,origin:f.origin,enabled:p,configSchema:!0,skills:f.manifest.skills??[]});if(!p){c.push(m);continue}let h=Date.now(),g;try{g=d(f.source)}catch(e){m.status=`error`,m.error=String(e),m.durationMs=Math.max(0,Date.now()-h),r.push({level:`error`,message:`failed to load plugin ${f.id}: ${String(e)}`,pluginId:f.id,source:f.source}),c.push(m);continue}let _=g&&typeof g==`object`&&`default`in g?g.default:g,v=typeof _==`function`?_:_&&typeof _==`object`&&typeof _.register==`function`?_.register:void 0;if(!v){m.status=`error`,m.error=`plugin module does not export a register function`,m.durationMs=Math.max(0,Date.now()-h),r.push({level:`error`,message:`plugin ${f.id} has no register function`,pluginId:f.id,source:f.source}),c.push(m);continue}let ee=ut({pluginId:f.id,env:n.runtime?.env}),y=n.plugins.entries[f.id]?.config,te={id:f.id,source:f.source,rootDir:f.rootDir,config:y,runtime:ee,llm:{chat:async e=>{if(!l)throw Error(`LLM client is not configured`);if(!_t(f.id,a,u))throw Error(`Plugin ${f.id} is not allowed to use LLM`);return l.chat(e)}},registerTool:(e,t)=>{a.register(f.id,e,t),m.toolCount+=1},registerUiTool:(e,t)=>{a.registerUiTool(f.id,e,t),m.toolCount+=1},registerEmbeddingProvider:t=>{if(f.manifest.kind!==`memory`)throw Error(`Plugin ${f.id} is not allowed to register embedding providers`);e({pluginId:f.id,id:t.id,create:t.create,config:y,rootDir:f.rootDir,source:f.source})},registerMemoryProvider:e=>{if(f.manifest.kind!==`memory`)throw Error(`Plugin ${f.id} is not allowed to register memory providers`);t({pluginId:f.id,id:e.id,create:e.create,config:y,rootDir:f.rootDir,source:f.source})},registerHook:(e,t,n)=>{o.register({pluginId:f.id,hookName:e,handler:t,priority:n?.priority,source:f.source}),m.hookCount+=1},registerSkillDir:e=>{let t=i.isAbsolute(e)?e:i.resolve(f.rootDir,e);s.push(t)},createProgressEmitter:()=>S(f.id)};try{v(te)}catch(e){m.status=`error`,m.error=String(e),r.push({level:`error`,message:`plugin ${f.id} registration failed: ${String(e)}`,pluginId:f.id,source:f.source})}if(f.manifest.skills&&f.manifest.skills.length>0)for(let e of f.manifest.skills){let t=i.isAbsolute(e)?e:i.resolve(f.rootDir,e);s.push(t)}m.durationMs=Math.max(0,Date.now()-h),c.push(m)}return{plugins:c,diagnostics:r,tools:a,hooks:o,skills:s}}function gt(e){return(e??[]).map(e=>e.trim()).filter(Boolean)}function _t(e,t,n){return n.length===0?!1:n.includes(e)?!0:t.namesForPlugin(e).some(e=>n.includes(e))}let X=null,Z=null;function vt(e){let{dataDir:t,bundledDir:n,workspaceDir:r}=e,i=e.config?JSON.stringify({allow:e.config.allow,deny:e.config.deny,enabled:e.config.enabled,piExtensions:e.config.piExtensions}):``;return`${t??``}|${n??``}|${r??``}|${i}`}function yt(e){let t=vt(e);return X&&Z===t?X:(X=Q(e),Z=t,X)}function bt(e){return X&&Z===vt(e)?X:Q(e)}function Q(e={}){let t=Ve(e.config),n=it({dataDir:e.dataDir,workspaceDir:e.workspaceDir,extraPaths:t.loadPaths,bundledDir:e.bundledDir,ownershipUid:e.ownershipUid}),r=lt(n.candidates),i=He({config:t,registry:r}),a=ht({registry:r,plugins:t,workspaceDir:e.workspaceDir,runtime:e.runtime});return{registry:a,diagnostics:[...n.diagnostics,...r.diagnostics,...i.diagnostics,...a.diagnostics],normalizedConfig:t,piExtensions:[]}}function $(e,t){return Array.from(new Set([...t?.piExtensionPaths??[],...e.piExtensionPaths]))}async function xt(e,t){let r=$(e,t);return r.length===0?[]:n(r)}function St(e={}){return{runtimeInitialized:!0,pluginSystem:yt({bundledDir:e.bundledDir,config:e.config,ownershipUid:e.ownershipUid,piExtensionPaths:e.piExtensionPaths}),loadedAt:new Date().toISOString(),version:1}}export{le as A,F as C,A as D,M as E,f as F,S as M,x as N,ve as O,ae as P,ke as S,j as T,Ne as _,yt as a,je as b,ut as c,ot as d,ct as f,He as g,Ve as h,Q as i,C as j,ye as k,lt as l,it as m,xt as n,$ as o,st as p,bt as r,ht as s,St as t,q as u,Pe as v,De as w,Oe as x,Me as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./system-runtime-DfAhRq2L.js";import"./provider-registry-DPbmbWqS.js";import"./loader-CkdBGDtW.js";export{e as prepareSystemRuntime};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gencode/agents",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
10
|
"default": "./dist/index.js"
|
|
11
11
|
},
|
|
12
|
+
"./system-runtime": {
|
|
13
|
+
"types": "./dist/system-runtime.d.ts",
|
|
14
|
+
"default": "./dist/system-runtime.js"
|
|
15
|
+
},
|
|
12
16
|
"./config": {
|
|
13
17
|
"types": "./dist/config/index.d.ts",
|
|
14
18
|
"default": "./dist/config/index.js"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|