@zibby/agent-workflow 0.4.39 → 0.4.40

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.
@@ -1,4 +1,4 @@
1
- var V=Object.defineProperty;var T=(e,o)=>()=>(e&&(o=e(e=0)),o);var Y=(e,o)=>{for(var n in o)V(e,n,{get:o[n],enumerable:!0})};function $(e){return U.get(e)||null}var S,N,U,ae,v=T(()=>{S=Symbol.for("@zibby/agent-workflow.skills"),N=Symbol.for("@zibby/agent-workflow.skills.sources");globalThis[S]||(globalThis[S]=new Map);globalThis[N]||(globalThis[N]=new Map);U=globalThis[S],ae=globalThis[N]});var I,K,b,k,E=T(()=>{I=()=>{},K={debug:I,info:I,warn:(...e)=>console.warn("[workflow]",...e),error:(...e)=>console.error("[workflow]",...e)},b={impl:K},k={debug:(...e)=>b.impl.debug?.(...e),info:(...e)=>b.impl.info?.(...e),warn:(...e)=>b.impl.warn?.(...e),error:(...e)=>b.impl.error?.(...e)}});var O=T(()=>{});var L={};Y(L,{getAgentStrategy:()=>P,invokeAgent:()=>J,listStrategies:()=>W,registerStrategy:()=>H,resolveInvocationModel:()=>R});function H(e){if(!e||typeof e.getName!="function"||typeof e.invoke!="function")throw new Error("strategy must implement getName() and invoke() (AgentStrategy shape)");let o=y.findIndex(n=>n.getName()===e.getName());o>=0?y[o]=e:y.push(e)}function W(){return y.map(e=>e.getName())}function R({config:e={},options:o={},strategyName:n,envModel:r}={}){let i=e.models||{},s=o.nodeName&&i[o.nodeName]||null,t=i.default||null,a=e.agent?.[n]?.model||null,c=(typeof r=="string"?r.trim():"")||null;return s||t||a||o.model||c||null}function P(e={}){let{state:o={},preferredAgent:n=null}=e,r=n||o.agentType||process.env.AGENT_TYPE;if(!r){let s=y.map(t=>t.getName()).join(", ")||"none registered";throw new Error(`No agent specified. Set agentType in state or AGENT_TYPE env var. Available: ${s}`)}k.debug(`[workflow] agent selection: requested=${r}`);let i=y.find(s=>s.getName()===r);if(!i){let s=y.map(t=>t.getName()).join(", ")||"none registered";throw new Error(`Unknown agent '${r}'. Available: ${s}`)}if(!i.canHandle(e))throw new Error(`Agent '${r}' is not available in this environment. Check credentials/environment.`);return k.debug(`[workflow] using agent: ${i.getName()}`),i}async function J(e,o={},n={}){let r=o.state&&typeof o.state.getAll=="function"?o.state.getAll():o.state||{},i={...o,state:r},s=P(i),t=r.config||n.config||{},a=R({config:t,options:n,strategyName:s.name,envModel:process.env.MODEL}),c={...n,model:a,workspace:r.workspace||n.workspace,schema:n.schema||o.schema,images:n.images||o.images||[],skills:n.skills||o.skills||[],plugins:n.plugins||o.plugins||[],config:t},l=e,g=c.skills||[];if(g.length>0&&!n.skipPromptFragments){let h=g.map(p=>{let f=$(p)?.promptFragment;return typeof f=="function"?f():f}).filter(Boolean);h.length>0&&(l+=`
1
+ var V=Object.defineProperty;var T=(e,o)=>()=>(e&&(o=e(e=0)),o);var Y=(e,o)=>{for(var n in o)V(e,n,{get:o[n],enumerable:!0})};function $(e){return U.get(e)||null}var b,N,U,ae,v=T(()=>{b=Symbol.for("@zibby/agent-workflow.skills"),N=Symbol.for("@zibby/agent-workflow.skills.sources");globalThis[b]||(globalThis[b]=new Map);globalThis[N]||(globalThis[N]=new Map);U=globalThis[b],ae=globalThis[N]});var I,K,S,k,E=T(()=>{I=()=>{},K={debug:I,info:I,warn:(...e)=>console.warn("[workflow]",...e),error:(...e)=>console.error("[workflow]",...e)},S={impl:K},k={debug:(...e)=>S.impl.debug?.(...e),info:(...e)=>S.impl.info?.(...e),warn:(...e)=>S.impl.warn?.(...e),error:(...e)=>S.impl.error?.(...e)}});var O=T(()=>{});var M={};Y(M,{getAgentStrategy:()=>P,invokeAgent:()=>J,listStrategies:()=>W,registerStrategy:()=>H,resolveInvocationModel:()=>R});function H(e){if(!e||typeof e.getName!="function"||typeof e.invoke!="function")throw new Error("strategy must implement getName() and invoke() (AgentStrategy shape)");let o=y.findIndex(n=>n.getName()===e.getName());o>=0?y[o]=e:y.push(e)}function W(){return y.map(e=>e.getName())}function R({config:e={},options:o={},strategyName:n,envModel:r}={}){let i=e.models||{},s=o.nodeName&&i[o.nodeName]||null,t=i.default||null,a=e.agent?.[n]?.model||null,c=(typeof r=="string"?r.trim():"")||null;return s||t||a||o.model||c||null}function P(e={}){let{state:o={},preferredAgent:n=null}=e,r=n||o.agentType||process.env.AGENT_TYPE;if(!r){let s=y.map(t=>t.getName()).join(", ")||"none registered";throw new Error(`No agent specified. Set agentType in state or AGENT_TYPE env var. Available: ${s}`)}k.debug(`[workflow] agent selection: requested=${r}`);let i=y.find(s=>s.getName()===r);if(!i){let s=y.map(t=>t.getName()).join(", ")||"none registered";throw new Error(`Unknown agent '${r}'. Available: ${s}`)}if(!i.canHandle(e))throw new Error(`Agent '${r}' is not available in this environment. Check credentials/environment.`);return k.debug(`[workflow] using agent: ${i.getName()}`),i}async function J(e,o={},n={}){let r=o.state&&typeof o.state.getAll=="function"?o.state.getAll():o.state||{},i={...o,state:r},s=P(i),t=r.config||n.config||{},a=R({config:t,options:n,strategyName:s.name,envModel:process.env.MODEL}),c={...n,model:a,workspace:r.workspace||n.workspace,schema:n.schema||o.schema,images:n.images||o.images||[],skills:n.skills||o.skills||[],extraMcpServers:n.extraMcpServers||r.extraMcpServers||o.extraMcpServers||[],plugins:n.plugins||o.plugins||[],config:t},l=e,g=c.skills||[];if(g.length>0&&!n.skipPromptFragments){let h=g.map(p=>{let f=$(p)?.promptFragment;return typeof f=="function"?f():f}).filter(Boolean);h.length>0&&(l+=`
2
2
 
3
3
  ${h.join(`
4
4
 
@@ -14,7 +14,7 @@ PRIORITY OVERRIDE \u2014 THE FOLLOWING INSTRUCTIONS TAKE PRECEDENCE OVER ALL PRE
14
14
  \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
15
15
 
16
16
  ${m}
17
- `),k.debug(`[workflow] prompt length: ${l.length} chars`),s.invoke(l,c)}var x,y,M=T(()=>{O();E();v();x=Symbol.for("@zibby/agent-workflow.strategies");globalThis[x]||(globalThis[x]=[]);y=globalThis[x]});v();E();var C={};var _=Symbol.for("@zibby/agent-workflow.nodes");globalThis[_]||(globalThis[_]=new Map);var D=globalThis[_];function q(e,o){D.set(e,o)}function z(e){let o=D.get(e);return o?o.factory&&typeof o.create=="function"?o.create.toString():typeof o.execute=="function"?o.execute.toString():typeof o=="function"?o.toString():null:null}q("ai_agent",{name:"ai_agent",factory:!0,create:(e,o={})=>({name:e,_isCustomCode:!0,execute:async n=>{let r=n?._coreInvokeAgent;r||(r=(await Promise.resolve().then(()=>(M(),L))).invokeAgent);let i=o.extraPromptInstructions||"Execute the task based on the current state.",s=Z(i,n),t=await r(s,{cwd:n.workspace||process.cwd(),model:n.model,tools:o.resolvedTools||null});return{success:!0,output:{raw:t,nodeId:e},raw:typeof t=="string"?t:t.raw}}})});function Z(e,o){let n=/@([\w.]+)/g,r=new Set,i;for(;(i=n.exec(e))!==null;)r.add(i[1]);if(r.size===0)return e;let s=[],t=new Set;for(let a of r){let c=a.split(".")[0];if(t.has(c))continue;let l=a.split(".").reduce((m,h)=>m?.[h],o);if(l===void 0)continue;let g=typeof l=="string"?l:l?.raw??JSON.stringify(l,null,2),u=a.replace(/_/g," ").replace(/\b\w/g,m=>m.toUpperCase());s.push(`## ${u}
17
+ `),k.debug(`[workflow] prompt length: ${l.length} chars`),s.invoke(l,c)}var x,y,L=T(()=>{O();E();v();x=Symbol.for("@zibby/agent-workflow.strategies");globalThis[x]||(globalThis[x]=[]);y=globalThis[x]});v();E();var C={};var _=Symbol.for("@zibby/agent-workflow.nodes");globalThis[_]||(globalThis[_]=new Map);var D=globalThis[_];function q(e,o){D.set(e,o)}function z(e){let o=D.get(e);return o?o.factory&&typeof o.create=="function"?o.create.toString():typeof o.execute=="function"?o.execute.toString():typeof o=="function"?o.toString():null:null}q("ai_agent",{name:"ai_agent",factory:!0,create:(e,o={})=>({name:e,_isCustomCode:!0,execute:async n=>{let r=n?._coreInvokeAgent;r||(r=(await Promise.resolve().then(()=>(L(),M))).invokeAgent);let i=o.extraPromptInstructions||"Execute the task based on the current state.",s=Z(i,n),t=await r(s,{cwd:n.workspace||process.cwd(),model:n.model,tools:o.resolvedTools||null});return{success:!0,output:{raw:t,nodeId:e},raw:typeof t=="string"?t:t.raw}}})});function Z(e,o){let n=/@([\w.]+)/g,r=new Set,i;for(;(i=n.exec(e))!==null;)r.add(i[1]);if(r.size===0)return e;let s=[],t=new Set;for(let a of r){let c=a.split(".")[0];if(t.has(c))continue;let l=a.split(".").reduce((m,h)=>m?.[h],o);if(l===void 0)continue;let g=typeof l=="string"?l:l?.raw??JSON.stringify(l,null,2),u=a.replace(/_/g," ").replace(/\b\w/g,m=>m.toUpperCase());s.push(`## ${u}
18
18
  ${g}`),a.includes(".")||t.add(c)}return s.length===0?e:`${e}
19
19
 
20
20
  ---
@@ -22,7 +22,7 @@ ${g}`),a.includes(".")||t.add(c)}return s.length===0?e:`${e}
22
22
 
23
23
  ${s.join(`
24
24
 
25
- `)}`}function Se(e,o={}){let{nodes:n,edges:r,nodeConfigs:i={}}=e,s=new Set,t=[],a=new Map;for(let d of n){let w=d.data?.nodeType||d.type;a.set(d.id,w),w==="decision"?s.add(d.id):t.push({id:d.id,nodeType:w,label:d.data?.label||d.id})}let c=t.some(d=>{let w=i[d.id]||{};return!w.customCode&&!w.executeCode}),{toolsPerNode:l,toolIdsByVar:g}=re(t,i),{simpleEdges:u,conditionalEdges:m}=se(r,s),h=ie(t,r,s),p=[],f=o.workflowType||"workflow";return p.push(Q(o)),p.push(X(f,{usesRegisteredNodes:c})),p.push(ee(g)),p.push(oe(f)),p.push(te(t,i)),p.push(ne(t,h,u,m,l,f)),p.filter(Boolean).join(`
25
+ `)}`}function be(e,o={}){let{nodes:n,edges:r,nodeConfigs:i={}}=e,s=new Set,t=[],a=new Map;for(let d of n){let w=d.data?.nodeType||d.type;a.set(d.id,w),w==="decision"?s.add(d.id):t.push({id:d.id,nodeType:w,label:d.data?.label||d.id})}let c=t.some(d=>{let w=i[d.id]||{};return!w.customCode&&!w.executeCode}),{toolsPerNode:l,toolIdsByVar:g}=re(t,i),{simpleEdges:u,conditionalEdges:m}=se(r,s),h=ie(t,r,s),p=[],f=o.workflowType||"workflow";return p.push(Q(o)),p.push(X(f,{usesRegisteredNodes:c})),p.push(ee(g)),p.push(oe(f)),p.push(te(t,i)),p.push(ne(t,h,u,m,l,f)),p.filter(Boolean).join(`
26
26
  `)}function Ne(e){let o={};for(let[n,r]of Object.entries(e)){let{tools:i,...s}=r;Object.keys(s).length>0&&(o[n]=s)}return o}function Q(e){let o=e.workflowType||"workflow";return["// Generated workflow",`// ${e.projectId?`Project: ${e.projectId} | `:""}Type: ${o} | Version: ${e.version??0}`,`// Downloaded: ${new Date().toISOString()}`,""].join(`
27
27
  `)}function X(e,{usesRegisteredNodes:o=!0}={}){let n=["import { WorkflowGraph, invokeAgent, getResolvedToolDefinitions } from '@zibby/agent-workflow';"];return o&&n.push("// import './register-nodes.js'; // register custom node types here"),n.push("import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'node:fs';","import { join, dirname } from 'node:path';","import { fileURLToPath } from 'node:url';",""),n.join(`
28
28
  `)}function ee(e){if(e.size===0)return"";let o=["// \u2500\u2500 Tool Bindings \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"];for(let[n,r]of e)o.push(`const ${n} = getResolvedToolDefinitions(${JSON.stringify(r)}); // ${r.join(", ")}`);return o.push(""),o.join(`
@@ -31,4 +31,4 @@ ${s.join(`
31
31
  `)}function ne(e,o,n,r,i,s){let t=["// \u2500\u2500 Graph Builder \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"];t.push("export function buildGraph(options = {}) {"),t.push(" const graph = new WorkflowGraph(options);",""),t.push(" // Nodes");for(let c of e){let l=G(c.id);t.push(` graph.addNode('${c.id}', { name: '${c.id}', execute: ${l}_execute });`),t.push(` graph.setNodeType('${c.id}', '${c.nodeType}');`)}t.push("",` graph.setEntryPoint('${o}');`,""),(n.length>0||r.length>0)&&t.push(" // Edges");for(let c of n)t.push(` graph.addEdge('${c.source}', '${c.target}');`);for(let c of r){let l=c.code.split(`
32
32
  `).map((g,u)=>u===0?g:` ${g}`).join(`
33
33
  `);t.push(` graph.addConditionalEdges('${c.source}', ${l});`)}let a=[];for(let c of e){let l=i.get(c.id);l&&a.push(` '${c.id}': ${l},`)}return a.length>0&&t.push(""," graph.resolvedToolsMap = {",...a," };"),t.push(""," return graph;","}",""),t.push("export { nodeConfigs };",""),t.join(`
34
- `)}function re(e,o){let n=new Map,r=new Map;for(let i of e){let s=o[i.id]?.tools,t;if(Array.isArray(s)&&s.length>0)t=[...s].sort();else{let a=C[i.nodeType];a?.length>0&&(t=[...a].sort())}if(t){let a=`${t.map(c=>c.replace(/[^a-zA-Z0-9]/g,"")).join("And")}Tools`;n.set(i.id,a),r.has(a)||r.set(a,t)}}return{toolsPerNode:n,toolIdsByVar:r}}function se(e,o){let n=[],r=[],i=new Map,s=new Set;for(let t of e)i.has(t.source)||i.set(t.source,[]),i.get(t.source).push(t);for(let t of e)if(!o.has(t.source))if(o.has(t.target)){if(s.has(t.target))continue;s.add(t.target);let c=(i.get(t.target)||[]).find(l=>l.data?.conditionalCode||l.conditionalCode);c&&r.push({source:t.source,code:c.data?.conditionalCode||c.conditionalCode})}else n.push({source:t.source,target:t.target});return{simpleEdges:n,conditionalEdges:r}}function ie(e,o,n){let r=new Set;for(let s of o)n.has(s.target)||r.add(s.target);let i=e.find(s=>!r.has(s.id));return i?i.id:e[0]?.id}function G(e){return e.replace(/[^a-zA-Z0-9]/g,"_")}export{Ne as generateNodeConfigsJson,Se as generateWorkflowCode};
34
+ `)}function re(e,o){let n=new Map,r=new Map;for(let i of e){let s=o[i.id]?.tools,t;if(Array.isArray(s)&&s.length>0)t=[...s].sort();else{let a=C[i.nodeType];a?.length>0&&(t=[...a].sort())}if(t){let a=`${t.map(c=>c.replace(/[^a-zA-Z0-9]/g,"")).join("And")}Tools`;n.set(i.id,a),r.has(a)||r.set(a,t)}}return{toolsPerNode:n,toolIdsByVar:r}}function se(e,o){let n=[],r=[],i=new Map,s=new Set;for(let t of e)i.has(t.source)||i.set(t.source,[]),i.get(t.source).push(t);for(let t of e)if(!o.has(t.source))if(o.has(t.target)){if(s.has(t.target))continue;s.add(t.target);let c=(i.get(t.target)||[]).find(l=>l.data?.conditionalCode||l.conditionalCode);c&&r.push({source:t.source,code:c.data?.conditionalCode||c.conditionalCode})}else n.push({source:t.source,target:t.target});return{simpleEdges:n,conditionalEdges:r}}function ie(e,o,n){let r=new Set;for(let s of o)n.has(s.target)||r.add(s.target);let i=e.find(s=>!r.has(s.id));return i?i.id:e[0]?.id}function G(e){return e.replace(/[^a-zA-Z0-9]/g,"_")}export{Ne as generateNodeConfigsJson,be as generateWorkflowCode};
@@ -1,4 +1,4 @@
1
- var Wt=Object.defineProperty;var we=(o=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(o,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):o)(function(o){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+o+'" is not supported')});var ae=(o,e)=>()=>(o&&(e=o(o=0)),e);var Je=(o,e)=>{for(var t in e)Wt(o,t,{get:e[t],enumerable:!0})};var Ye,Gt,ue,b,W=ae(()=>{Ye=()=>{},Gt={debug:Ye,info:Ye,warn:(...o)=>console.warn("[workflow]",...o),error:(...o)=>console.error("[workflow]",...o)},ue={impl:Gt},b={debug:(...o)=>ue.impl.debug?.(...o),info:(...o)=>ue.impl.info?.(...o),warn:(...o)=>ue.impl.warn?.(...o),error:(...o)=>ue.impl.error?.(...o)}});var rt=ae(()=>{});var nt={};Je(nt,{clearSkills:()=>Vt,getAllSkills:()=>qt,getSkill:()=>ee,getSkillSource:()=>Zt,hasSkill:()=>zt,listSkillIds:()=>Kt,registerSkill:()=>Yt});function Yt(o,e={}){if(!o||typeof o.id!="string")throw new Error("Skill definition must include a string id");let{source:t,override:r=!1}=e,s=o.id;if(F.has(s)&&!r){let i=Q.get(s);if(!(i===t)){let a=i||"first-party",u=t||"first-party";throw new Error(`Skill id collision: "${s}" is already registered by ${a}; ${u} may not overwrite it. Ids are append-only and first-party ids cannot be shadowed. Pick a unique id (or pass { override: true } for a deliberate first-party replacement).`)}}F.set(s,Object.freeze({...o})),t===void 0?Q.delete(s):Q.set(s,t)}function ee(o){return F.get(o)||null}function zt(o){return F.has(o)}function Zt(o){return Q.get(o)||null}function qt(){return new Map(F)}function Kt(){return Array.from(F.keys())}function Vt(){F.clear(),Q.clear()}var $e,ve,F,Q,pe=ae(()=>{$e=Symbol.for("@zibby/agent-workflow.skills"),ve=Symbol.for("@zibby/agent-workflow.skills.sources");globalThis[$e]||(globalThis[$e]=new Map);globalThis[ve]||(globalThis[ve]=new Map);F=globalThis[$e],Q=globalThis[ve]});var te={};Je(te,{getAgentStrategy:()=>it,invokeAgent:()=>eo,listStrategies:()=>Qt,registerStrategy:()=>Xt,resolveInvocationModel:()=>st});function Xt(o){if(!o||typeof o.getName!="function"||typeof o.invoke!="function")throw new Error("strategy must implement getName() and invoke() (AgentStrategy shape)");let e=G.findIndex(t=>t.getName()===o.getName());e>=0?G[e]=o:G.push(o)}function Qt(){return G.map(o=>o.getName())}function st({config:o={},options:e={},strategyName:t,envModel:r}={}){let s=o.models||{},i=e.nodeName&&s[e.nodeName]||null,n=s.default||null,a=o.agent?.[t]?.model||null,u=(typeof r=="string"?r.trim():"")||null;return i||n||a||e.model||u||null}function it(o={}){let{state:e={},preferredAgent:t=null}=o,r=t||e.agentType||process.env.AGENT_TYPE;if(!r){let i=G.map(n=>n.getName()).join(", ")||"none registered";throw new Error(`No agent specified. Set agentType in state or AGENT_TYPE env var. Available: ${i}`)}b.debug(`[workflow] agent selection: requested=${r}`);let s=G.find(i=>i.getName()===r);if(!s){let i=G.map(n=>n.getName()).join(", ")||"none registered";throw new Error(`Unknown agent '${r}'. Available: ${i}`)}if(!s.canHandle(o))throw new Error(`Agent '${r}' is not available in this environment. Check credentials/environment.`);return b.debug(`[workflow] using agent: ${s.getName()}`),s}async function eo(o,e={},t={}){let r=e.state&&typeof e.state.getAll=="function"?e.state.getAll():e.state||{},s={...e,state:r},i=it(s),n=r.config||t.config||{},a=st({config:n,options:t,strategyName:i.name,envModel:process.env.MODEL}),u={...t,model:a,workspace:r.workspace||t.workspace,schema:t.schema||e.schema,images:t.images||e.images||[],skills:t.skills||e.skills||[],plugins:t.plugins||e.plugins||[],config:n},d=o,f=u.skills||[];if(f.length>0&&!t.skipPromptFragments){let y=f.map(g=>{let m=ee(g)?.promptFragment;return typeof m=="function"?m():m}).filter(Boolean);y.length>0&&(d+=`
1
+ var Wt=Object.defineProperty;var we=(o=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(o,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):o)(function(o){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+o+'" is not supported')});var ae=(o,e)=>()=>(o&&(e=o(o=0)),e);var Je=(o,e)=>{for(var t in e)Wt(o,t,{get:e[t],enumerable:!0})};var Ye,Gt,ue,b,W=ae(()=>{Ye=()=>{},Gt={debug:Ye,info:Ye,warn:(...o)=>console.warn("[workflow]",...o),error:(...o)=>console.error("[workflow]",...o)},ue={impl:Gt},b={debug:(...o)=>ue.impl.debug?.(...o),info:(...o)=>ue.impl.info?.(...o),warn:(...o)=>ue.impl.warn?.(...o),error:(...o)=>ue.impl.error?.(...o)}});var rt=ae(()=>{});var nt={};Je(nt,{clearSkills:()=>Vt,getAllSkills:()=>qt,getSkill:()=>ee,getSkillSource:()=>Zt,hasSkill:()=>zt,listSkillIds:()=>Kt,registerSkill:()=>Yt});function Yt(o,e={}){if(!o||typeof o.id!="string")throw new Error("Skill definition must include a string id");let{source:t,override:r=!1}=e,s=o.id;if(F.has(s)&&!r){let i=Q.get(s);if(!(i===t)){let a=i||"first-party",u=t||"first-party";throw new Error(`Skill id collision: "${s}" is already registered by ${a}; ${u} may not overwrite it. Ids are append-only and first-party ids cannot be shadowed. Pick a unique id (or pass { override: true } for a deliberate first-party replacement).`)}}F.set(s,Object.freeze({...o})),t===void 0?Q.delete(s):Q.set(s,t)}function ee(o){return F.get(o)||null}function zt(o){return F.has(o)}function Zt(o){return Q.get(o)||null}function qt(){return new Map(F)}function Kt(){return Array.from(F.keys())}function Vt(){F.clear(),Q.clear()}var $e,ve,F,Q,pe=ae(()=>{$e=Symbol.for("@zibby/agent-workflow.skills"),ve=Symbol.for("@zibby/agent-workflow.skills.sources");globalThis[$e]||(globalThis[$e]=new Map);globalThis[ve]||(globalThis[ve]=new Map);F=globalThis[$e],Q=globalThis[ve]});var te={};Je(te,{getAgentStrategy:()=>it,invokeAgent:()=>eo,listStrategies:()=>Qt,registerStrategy:()=>Xt,resolveInvocationModel:()=>st});function Xt(o){if(!o||typeof o.getName!="function"||typeof o.invoke!="function")throw new Error("strategy must implement getName() and invoke() (AgentStrategy shape)");let e=G.findIndex(t=>t.getName()===o.getName());e>=0?G[e]=o:G.push(o)}function Qt(){return G.map(o=>o.getName())}function st({config:o={},options:e={},strategyName:t,envModel:r}={}){let s=o.models||{},i=e.nodeName&&s[e.nodeName]||null,n=s.default||null,a=o.agent?.[t]?.model||null,u=(typeof r=="string"?r.trim():"")||null;return i||n||a||e.model||u||null}function it(o={}){let{state:e={},preferredAgent:t=null}=o,r=t||e.agentType||process.env.AGENT_TYPE;if(!r){let i=G.map(n=>n.getName()).join(", ")||"none registered";throw new Error(`No agent specified. Set agentType in state or AGENT_TYPE env var. Available: ${i}`)}b.debug(`[workflow] agent selection: requested=${r}`);let s=G.find(i=>i.getName()===r);if(!s){let i=G.map(n=>n.getName()).join(", ")||"none registered";throw new Error(`Unknown agent '${r}'. Available: ${i}`)}if(!s.canHandle(o))throw new Error(`Agent '${r}' is not available in this environment. Check credentials/environment.`);return b.debug(`[workflow] using agent: ${s.getName()}`),s}async function eo(o,e={},t={}){let r=e.state&&typeof e.state.getAll=="function"?e.state.getAll():e.state||{},s={...e,state:r},i=it(s),n=r.config||t.config||{},a=st({config:n,options:t,strategyName:i.name,envModel:process.env.MODEL}),u={...t,model:a,workspace:r.workspace||t.workspace,schema:t.schema||e.schema,images:t.images||e.images||[],skills:t.skills||e.skills||[],extraMcpServers:t.extraMcpServers||r.extraMcpServers||e.extraMcpServers||[],plugins:t.plugins||e.plugins||[],config:n},d=o,f=u.skills||[];if(f.length>0&&!t.skipPromptFragments){let y=f.map(g=>{let m=ee(g)?.promptFragment;return typeof m=="function"?m():m}).filter(Boolean);y.length>0&&(d+=`
2
2
 
3
3
  ${y.join(`
4
4
 
package/dist/graph.js CHANGED
@@ -1,4 +1,4 @@
1
- var Pe=Object.defineProperty;var st=(s,t)=>()=>(s&&(t=s(s=0)),t);var Dt=(s,t)=>{for(var e in t)Pe(s,e,{get:t[e],enumerable:!0})};var Lt,Re,it,I,V=st(()=>{Lt=()=>{},Re={debug:Lt,info:Lt,warn:(...s)=>console.warn("[workflow]",...s),error:(...s)=>console.error("[workflow]",...s)},it={impl:Re},I={debug:(...s)=>it.impl.debug?.(...s),info:(...s)=>it.impl.info?.(...s),warn:(...s)=>it.impl.warn?.(...s),error:(...s)=>it.impl.error?.(...s)}});var Vt=st(()=>{});var Kt={};Dt(Kt,{clearSkills:()=>We,getAllSkills:()=>Le,getSkill:()=>yt,getSkillSource:()=>De,hasSkill:()=>je,listSkillIds:()=>Ue,registerSkill:()=>Me});function Me(s,t={}){if(!s||typeof s.id!="string")throw new Error("Skill definition must include a string id");let{source:e,override:r=!1}=t,o=s.id;if(U.has(o)&&!r){let i=X.get(o);if(!(i===e)){let a=i||"first-party",u=e||"first-party";throw new Error(`Skill id collision: "${o}" is already registered by ${a}; ${u} may not overwrite it. Ids are append-only and first-party ids cannot be shadowed. Pick a unique id (or pass { override: true } for a deliberate first-party replacement).`)}}U.set(o,Object.freeze({...s})),e===void 0?X.delete(o):X.set(o,e)}function yt(s){return U.get(s)||null}function je(s){return U.has(s)}function De(s){return X.get(s)||null}function Le(){return new Map(U)}function Ue(){return Array.from(U.keys())}function We(){U.clear(),X.clear()}var mt,St,U,X,wt=st(()=>{mt=Symbol.for("@zibby/agent-workflow.skills"),St=Symbol.for("@zibby/agent-workflow.skills.sources");globalThis[mt]||(globalThis[mt]=new Map);globalThis[St]||(globalThis[St]=new Map);U=globalThis[mt],X=globalThis[St]});var It={};Dt(It,{getAgentStrategy:()=>Qt,invokeAgent:()=>He,listStrategies:()=>Ge,registerStrategy:()=>Fe,resolveInvocationModel:()=>Xt});function Fe(s){if(!s||typeof s.getName!="function"||typeof s.invoke!="function")throw new Error("strategy must implement getName() and invoke() (AgentStrategy shape)");let t=W.findIndex(e=>e.getName()===s.getName());t>=0?W[t]=s:W.push(s)}function Ge(){return W.map(s=>s.getName())}function Xt({config:s={},options:t={},strategyName:e,envModel:r}={}){let o=s.models||{},i=t.nodeName&&o[t.nodeName]||null,n=o.default||null,a=s.agent?.[e]?.model||null,u=(typeof r=="string"?r.trim():"")||null;return i||n||a||t.model||u||null}function Qt(s={}){let{state:t={},preferredAgent:e=null}=s,r=e||t.agentType||process.env.AGENT_TYPE;if(!r){let i=W.map(n=>n.getName()).join(", ")||"none registered";throw new Error(`No agent specified. Set agentType in state or AGENT_TYPE env var. Available: ${i}`)}I.debug(`[workflow] agent selection: requested=${r}`);let o=W.find(i=>i.getName()===r);if(!o){let i=W.map(n=>n.getName()).join(", ")||"none registered";throw new Error(`Unknown agent '${r}'. Available: ${i}`)}if(!o.canHandle(s))throw new Error(`Agent '${r}' is not available in this environment. Check credentials/environment.`);return I.debug(`[workflow] using agent: ${o.getName()}`),o}async function He(s,t={},e={}){let r=t.state&&typeof t.state.getAll=="function"?t.state.getAll():t.state||{},o={...t,state:r},i=Qt(o),n=r.config||e.config||{},a=Xt({config:n,options:e,strategyName:i.name,envModel:process.env.MODEL}),u={...e,model:a,workspace:r.workspace||e.workspace,schema:e.schema||t.schema,images:e.images||t.images||[],skills:e.skills||t.skills||[],plugins:e.plugins||t.plugins||[],config:n},p=s,h=u.skills||[];if(h.length>0&&!e.skipPromptFragments){let y=h.map(S=>{let w=yt(S)?.promptFragment;return typeof w=="function"?w():w}).filter(Boolean);y.length>0&&(p+=`
1
+ var Pe=Object.defineProperty;var st=(s,t)=>()=>(s&&(t=s(s=0)),t);var Dt=(s,t)=>{for(var e in t)Pe(s,e,{get:t[e],enumerable:!0})};var Lt,Re,it,I,V=st(()=>{Lt=()=>{},Re={debug:Lt,info:Lt,warn:(...s)=>console.warn("[workflow]",...s),error:(...s)=>console.error("[workflow]",...s)},it={impl:Re},I={debug:(...s)=>it.impl.debug?.(...s),info:(...s)=>it.impl.info?.(...s),warn:(...s)=>it.impl.warn?.(...s),error:(...s)=>it.impl.error?.(...s)}});var Vt=st(()=>{});var Kt={};Dt(Kt,{clearSkills:()=>We,getAllSkills:()=>Le,getSkill:()=>yt,getSkillSource:()=>De,hasSkill:()=>je,listSkillIds:()=>Ue,registerSkill:()=>Me});function Me(s,t={}){if(!s||typeof s.id!="string")throw new Error("Skill definition must include a string id");let{source:e,override:r=!1}=t,o=s.id;if(U.has(o)&&!r){let i=X.get(o);if(!(i===e)){let a=i||"first-party",u=e||"first-party";throw new Error(`Skill id collision: "${o}" is already registered by ${a}; ${u} may not overwrite it. Ids are append-only and first-party ids cannot be shadowed. Pick a unique id (or pass { override: true } for a deliberate first-party replacement).`)}}U.set(o,Object.freeze({...s})),e===void 0?X.delete(o):X.set(o,e)}function yt(s){return U.get(s)||null}function je(s){return U.has(s)}function De(s){return X.get(s)||null}function Le(){return new Map(U)}function Ue(){return Array.from(U.keys())}function We(){U.clear(),X.clear()}var mt,St,U,X,wt=st(()=>{mt=Symbol.for("@zibby/agent-workflow.skills"),St=Symbol.for("@zibby/agent-workflow.skills.sources");globalThis[mt]||(globalThis[mt]=new Map);globalThis[St]||(globalThis[St]=new Map);U=globalThis[mt],X=globalThis[St]});var It={};Dt(It,{getAgentStrategy:()=>Qt,invokeAgent:()=>He,listStrategies:()=>Ge,registerStrategy:()=>Fe,resolveInvocationModel:()=>Xt});function Fe(s){if(!s||typeof s.getName!="function"||typeof s.invoke!="function")throw new Error("strategy must implement getName() and invoke() (AgentStrategy shape)");let t=W.findIndex(e=>e.getName()===s.getName());t>=0?W[t]=s:W.push(s)}function Ge(){return W.map(s=>s.getName())}function Xt({config:s={},options:t={},strategyName:e,envModel:r}={}){let o=s.models||{},i=t.nodeName&&o[t.nodeName]||null,n=o.default||null,a=s.agent?.[e]?.model||null,u=(typeof r=="string"?r.trim():"")||null;return i||n||a||t.model||u||null}function Qt(s={}){let{state:t={},preferredAgent:e=null}=s,r=e||t.agentType||process.env.AGENT_TYPE;if(!r){let i=W.map(n=>n.getName()).join(", ")||"none registered";throw new Error(`No agent specified. Set agentType in state or AGENT_TYPE env var. Available: ${i}`)}I.debug(`[workflow] agent selection: requested=${r}`);let o=W.find(i=>i.getName()===r);if(!o){let i=W.map(n=>n.getName()).join(", ")||"none registered";throw new Error(`Unknown agent '${r}'. Available: ${i}`)}if(!o.canHandle(s))throw new Error(`Agent '${r}' is not available in this environment. Check credentials/environment.`);return I.debug(`[workflow] using agent: ${o.getName()}`),o}async function He(s,t={},e={}){let r=t.state&&typeof t.state.getAll=="function"?t.state.getAll():t.state||{},o={...t,state:r},i=Qt(o),n=r.config||e.config||{},a=Xt({config:n,options:e,strategyName:i.name,envModel:process.env.MODEL}),u={...e,model:a,workspace:r.workspace||e.workspace,schema:e.schema||t.schema,images:e.images||t.images||[],skills:e.skills||t.skills||[],extraMcpServers:e.extraMcpServers||r.extraMcpServers||t.extraMcpServers||[],plugins:e.plugins||t.plugins||[],config:n},p=s,h=u.skills||[];if(h.length>0&&!e.skipPromptFragments){let y=h.map(S=>{let w=yt(S)?.promptFragment;return typeof w=="function"?w():w}).filter(Boolean);y.length>0&&(p+=`
2
2
 
3
3
  ${y.join(`
4
4
 
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var uo=Object.defineProperty;var Ie=(o=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(o,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):o)(function(o){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+o+'" is not supported')});var ge=(o,e)=>()=>(o&&(e=o(o=0)),e);var nt=(o,e)=>{for(var t in e)uo(o,t,{get:e[t],enumerable:!0})};function ho(o){re.impl={...it,...o}}var st,it,re,E,F=ge(()=>{st=()=>{},it={debug:st,info:st,warn:(...o)=>console.warn("[workflow]",...o),error:(...o)=>console.error("[workflow]",...o)},re={impl:it};E={debug:(...o)=>re.impl.debug?.(...o),info:(...o)=>re.impl.info?.(...o),warn:(...o)=>re.impl.warn?.(...o),error:(...o)=>re.impl.error?.(...o)}});var Ne,Oe=ge(()=>{Ne=class{constructor(e,t,r=0){this.name=e,this.description=t,this.priority=r}async invoke(e,t={}){throw new Error(`${this.constructor.name}.invoke() must be implemented`)}canHandle(e){throw new Error(`${this.constructor.name}.canHandle() must be implemented`)}getName(){return this.name}getDescription(){return this.description}getPriority(){return this.priority}}});var bt={};nt(bt,{clearSkills:()=>_t,getAllSkills:()=>wt,getSkill:()=>q,getSkillSource:()=>yt,hasSkill:()=>mt,listSkillIds:()=>St,registerSkill:()=>gt});function gt(o,e={}){if(!o||typeof o.id!="string")throw new Error("Skill definition must include a string id");let{source:t,override:r=!1}=e,i=o.id;if(G.has(i)&&!r){let s=ie.get(i);if(!(s===t)){let a=s||"first-party",l=t||"first-party";throw new Error(`Skill id collision: "${i}" is already registered by ${a}; ${l} may not overwrite it. Ids are append-only and first-party ids cannot be shadowed. Pick a unique id (or pass { override: true } for a deliberate first-party replacement).`)}}G.set(i,Object.freeze({...o})),t===void 0?ie.delete(i):ie.set(i,t)}function q(o){return G.get(o)||null}function mt(o){return G.has(o)}function yt(o){return ie.get(o)||null}function wt(){return new Map(G)}function St(){return Array.from(G.keys())}function _t(){G.clear(),ie.clear()}var Pe,Ce,G,ie,ae=ge(()=>{Pe=Symbol.for("@zibby/agent-workflow.skills"),Ce=Symbol.for("@zibby/agent-workflow.skills.sources");globalThis[Pe]||(globalThis[Pe]=new Map);globalThis[Ce]||(globalThis[Ce]=new Map);G=globalThis[Pe],ie=globalThis[Ce]});var ce={};nt(ce,{getAgentStrategy:()=>je,invokeAgent:()=>$t,listStrategies:()=>It,registerStrategy:()=>Et,resolveInvocationModel:()=>vt});function Et(o){if(!o||typeof o.getName!="function"||typeof o.invoke!="function")throw new Error("strategy must implement getName() and invoke() (AgentStrategy shape)");let e=H.findIndex(t=>t.getName()===o.getName());e>=0?H[e]=o:H.push(o)}function It(){return H.map(o=>o.getName())}function vt({config:o={},options:e={},strategyName:t,envModel:r}={}){let i=o.models||{},s=e.nodeName&&i[e.nodeName]||null,n=i.default||null,a=o.agent?.[t]?.model||null,l=(typeof r=="string"?r.trim():"")||null;return s||n||a||e.model||l||null}function je(o={}){let{state:e={},preferredAgent:t=null}=o,r=t||e.agentType||process.env.AGENT_TYPE;if(!r){let s=H.map(n=>n.getName()).join(", ")||"none registered";throw new Error(`No agent specified. Set agentType in state or AGENT_TYPE env var. Available: ${s}`)}E.debug(`[workflow] agent selection: requested=${r}`);let i=H.find(s=>s.getName()===r);if(!i){let s=H.map(n=>n.getName()).join(", ")||"none registered";throw new Error(`Unknown agent '${r}'. Available: ${s}`)}if(!i.canHandle(o))throw new Error(`Agent '${r}' is not available in this environment. Check credentials/environment.`);return E.debug(`[workflow] using agent: ${i.getName()}`),i}async function $t(o,e={},t={}){let r=e.state&&typeof e.state.getAll=="function"?e.state.getAll():e.state||{},i={...e,state:r},s=je(i),n=r.config||t.config||{},a=vt({config:n,options:t,strategyName:s.name,envModel:process.env.MODEL}),l={...t,model:a,workspace:r.workspace||t.workspace,schema:t.schema||e.schema,images:t.images||e.images||[],skills:t.skills||e.skills||[],plugins:t.plugins||e.plugins||[],config:n},u=o,f=l.skills||[];if(f.length>0&&!t.skipPromptFragments){let y=f.map(h=>{let g=q(h)?.promptFragment;return typeof g=="function"?g():g}).filter(Boolean);y.length>0&&(u+=`
1
+ var uo=Object.defineProperty;var Ie=(o=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(o,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):o)(function(o){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+o+'" is not supported')});var ge=(o,e)=>()=>(o&&(e=o(o=0)),e);var nt=(o,e)=>{for(var t in e)uo(o,t,{get:e[t],enumerable:!0})};function ho(o){re.impl={...it,...o}}var st,it,re,E,F=ge(()=>{st=()=>{},it={debug:st,info:st,warn:(...o)=>console.warn("[workflow]",...o),error:(...o)=>console.error("[workflow]",...o)},re={impl:it};E={debug:(...o)=>re.impl.debug?.(...o),info:(...o)=>re.impl.info?.(...o),warn:(...o)=>re.impl.warn?.(...o),error:(...o)=>re.impl.error?.(...o)}});var Ne,Oe=ge(()=>{Ne=class{constructor(e,t,r=0){this.name=e,this.description=t,this.priority=r}async invoke(e,t={}){throw new Error(`${this.constructor.name}.invoke() must be implemented`)}canHandle(e){throw new Error(`${this.constructor.name}.canHandle() must be implemented`)}getName(){return this.name}getDescription(){return this.description}getPriority(){return this.priority}}});var bt={};nt(bt,{clearSkills:()=>_t,getAllSkills:()=>wt,getSkill:()=>q,getSkillSource:()=>yt,hasSkill:()=>mt,listSkillIds:()=>St,registerSkill:()=>gt});function gt(o,e={}){if(!o||typeof o.id!="string")throw new Error("Skill definition must include a string id");let{source:t,override:r=!1}=e,i=o.id;if(G.has(i)&&!r){let s=ie.get(i);if(!(s===t)){let a=s||"first-party",l=t||"first-party";throw new Error(`Skill id collision: "${i}" is already registered by ${a}; ${l} may not overwrite it. Ids are append-only and first-party ids cannot be shadowed. Pick a unique id (or pass { override: true } for a deliberate first-party replacement).`)}}G.set(i,Object.freeze({...o})),t===void 0?ie.delete(i):ie.set(i,t)}function q(o){return G.get(o)||null}function mt(o){return G.has(o)}function yt(o){return ie.get(o)||null}function wt(){return new Map(G)}function St(){return Array.from(G.keys())}function _t(){G.clear(),ie.clear()}var Pe,Ce,G,ie,ae=ge(()=>{Pe=Symbol.for("@zibby/agent-workflow.skills"),Ce=Symbol.for("@zibby/agent-workflow.skills.sources");globalThis[Pe]||(globalThis[Pe]=new Map);globalThis[Ce]||(globalThis[Ce]=new Map);G=globalThis[Pe],ie=globalThis[Ce]});var ce={};nt(ce,{getAgentStrategy:()=>je,invokeAgent:()=>$t,listStrategies:()=>It,registerStrategy:()=>Et,resolveInvocationModel:()=>vt});function Et(o){if(!o||typeof o.getName!="function"||typeof o.invoke!="function")throw new Error("strategy must implement getName() and invoke() (AgentStrategy shape)");let e=H.findIndex(t=>t.getName()===o.getName());e>=0?H[e]=o:H.push(o)}function It(){return H.map(o=>o.getName())}function vt({config:o={},options:e={},strategyName:t,envModel:r}={}){let i=o.models||{},s=e.nodeName&&i[e.nodeName]||null,n=i.default||null,a=o.agent?.[t]?.model||null,l=(typeof r=="string"?r.trim():"")||null;return s||n||a||e.model||l||null}function je(o={}){let{state:e={},preferredAgent:t=null}=o,r=t||e.agentType||process.env.AGENT_TYPE;if(!r){let s=H.map(n=>n.getName()).join(", ")||"none registered";throw new Error(`No agent specified. Set agentType in state or AGENT_TYPE env var. Available: ${s}`)}E.debug(`[workflow] agent selection: requested=${r}`);let i=H.find(s=>s.getName()===r);if(!i){let s=H.map(n=>n.getName()).join(", ")||"none registered";throw new Error(`Unknown agent '${r}'. Available: ${s}`)}if(!i.canHandle(o))throw new Error(`Agent '${r}' is not available in this environment. Check credentials/environment.`);return E.debug(`[workflow] using agent: ${i.getName()}`),i}async function $t(o,e={},t={}){let r=e.state&&typeof e.state.getAll=="function"?e.state.getAll():e.state||{},i={...e,state:r},s=je(i),n=r.config||t.config||{},a=vt({config:n,options:t,strategyName:s.name,envModel:process.env.MODEL}),l={...t,model:a,workspace:r.workspace||t.workspace,schema:t.schema||e.schema,images:t.images||e.images||[],skills:t.skills||e.skills||[],extraMcpServers:t.extraMcpServers||r.extraMcpServers||e.extraMcpServers||[],plugins:t.plugins||e.plugins||[],config:n},u=o,f=l.skills||[];if(f.length>0&&!t.skipPromptFragments){let y=f.map(h=>{let g=q(h)?.promptFragment;return typeof g=="function"?g():g}).filter(Boolean);y.length>0&&(u+=`
2
2
 
3
3
  ${y.join(`
4
4
 
@@ -1,25 +1,25 @@
1
- var G=Object.defineProperty;var w=(e,t)=>()=>(e&&(t=e(e=0)),t);var K=(e,t)=>{for(var n in t)G(e,n,{get:t[n],enumerable:!0})};var $=w(()=>{});var _,U,y,b,I=w(()=>{_=()=>{},U={debug:_,info:_,warn:(...e)=>console.warn("[workflow]",...e),error:(...e)=>console.error("[workflow]",...e)},y={impl:U},b={debug:(...e)=>y.impl.debug?.(...e),info:(...e)=>y.impl.info?.(...e),warn:(...e)=>y.impl.warn?.(...e),error:(...e)=>y.impl.error?.(...e)}});function O(e){return V.get(e)||null}var S,E,V,X,R=w(()=>{S=Symbol.for("@zibby/agent-workflow.skills"),E=Symbol.for("@zibby/agent-workflow.skills.sources");globalThis[S]||(globalThis[S]=new Map);globalThis[E]||(globalThis[E]=new Map);V=globalThis[S],X=globalThis[E]});var M={};K(M,{getAgentStrategy:()=>C,invokeAgent:()=>q,listStrategies:()=>H,registerStrategy:()=>D,resolveInvocationModel:()=>j});function D(e){if(!e||typeof e.getName!="function"||typeof e.invoke!="function")throw new Error("strategy must implement getName() and invoke() (AgentStrategy shape)");let t=f.findIndex(n=>n.getName()===e.getName());t>=0?f[t]=e:f.push(e)}function H(){return f.map(e=>e.getName())}function j({config:e={},options:t={},strategyName:n,envModel:o}={}){let l=e.models||{},r=t.nodeName&&l[t.nodeName]||null,i=l.default||null,c=e.agent?.[n]?.model||null,g=(typeof o=="string"?o.trim():"")||null;return r||i||c||t.model||g||null}function C(e={}){let{state:t={},preferredAgent:n=null}=e,o=n||t.agentType||process.env.AGENT_TYPE;if(!o){let r=f.map(i=>i.getName()).join(", ")||"none registered";throw new Error(`No agent specified. Set agentType in state or AGENT_TYPE env var. Available: ${r}`)}b.debug(`[workflow] agent selection: requested=${o}`);let l=f.find(r=>r.getName()===o);if(!l){let r=f.map(i=>i.getName()).join(", ")||"none registered";throw new Error(`Unknown agent '${o}'. Available: ${r}`)}if(!l.canHandle(e))throw new Error(`Agent '${o}' is not available in this environment. Check credentials/environment.`);return b.debug(`[workflow] using agent: ${l.getName()}`),l}async function q(e,t={},n={}){let o=t.state&&typeof t.state.getAll=="function"?t.state.getAll():t.state||{},l={...t,state:o},r=C(l),i=o.config||n.config||{},c=j({config:i,options:n,strategyName:r.name,envModel:process.env.MODEL}),g={...n,model:c,workspace:o.workspace||n.workspace,schema:n.schema||t.schema,images:n.images||t.images||[],skills:n.skills||t.skills||[],plugins:n.plugins||t.plugins||[],config:i},a=e,h=g.skills||[];if(h.length>0&&!n.skipPromptFragments){let d=h.map(k=>{let s=O(k)?.promptFragment;return typeof s=="function"?s():s}).filter(Boolean);d.length>0&&(a+=`
1
+ var G=Object.defineProperty;var w=(e,t)=>()=>(e&&(t=e(e=0)),t);var K=(e,t)=>{for(var n in t)G(e,n,{get:t[n],enumerable:!0})};var $=w(()=>{});var _,U,y,b,I=w(()=>{_=()=>{},U={debug:_,info:_,warn:(...e)=>console.warn("[workflow]",...e),error:(...e)=>console.error("[workflow]",...e)},y={impl:U},b={debug:(...e)=>y.impl.debug?.(...e),info:(...e)=>y.impl.info?.(...e),warn:(...e)=>y.impl.warn?.(...e),error:(...e)=>y.impl.error?.(...e)}});function O(e){return V.get(e)||null}var S,E,V,X,R=w(()=>{S=Symbol.for("@zibby/agent-workflow.skills"),E=Symbol.for("@zibby/agent-workflow.skills.sources");globalThis[S]||(globalThis[S]=new Map);globalThis[E]||(globalThis[E]=new Map);V=globalThis[S],X=globalThis[E]});var C={};K(C,{getAgentStrategy:()=>j,invokeAgent:()=>q,listStrategies:()=>H,registerStrategy:()=>D,resolveInvocationModel:()=>M});function D(e){if(!e||typeof e.getName!="function"||typeof e.invoke!="function")throw new Error("strategy must implement getName() and invoke() (AgentStrategy shape)");let t=f.findIndex(n=>n.getName()===e.getName());t>=0?f[t]=e:f.push(e)}function H(){return f.map(e=>e.getName())}function M({config:e={},options:t={},strategyName:n,envModel:r}={}){let l=e.models||{},o=t.nodeName&&l[t.nodeName]||null,i=l.default||null,c=e.agent?.[n]?.model||null,g=(typeof r=="string"?r.trim():"")||null;return o||i||c||t.model||g||null}function j(e={}){let{state:t={},preferredAgent:n=null}=e,r=n||t.agentType||process.env.AGENT_TYPE;if(!r){let o=f.map(i=>i.getName()).join(", ")||"none registered";throw new Error(`No agent specified. Set agentType in state or AGENT_TYPE env var. Available: ${o}`)}b.debug(`[workflow] agent selection: requested=${r}`);let l=f.find(o=>o.getName()===r);if(!l){let o=f.map(i=>i.getName()).join(", ")||"none registered";throw new Error(`Unknown agent '${r}'. Available: ${o}`)}if(!l.canHandle(e))throw new Error(`Agent '${r}' is not available in this environment. Check credentials/environment.`);return b.debug(`[workflow] using agent: ${l.getName()}`),l}async function q(e,t={},n={}){let r=t.state&&typeof t.state.getAll=="function"?t.state.getAll():t.state||{},l={...t,state:r},o=j(l),i=r.config||n.config||{},c=M({config:i,options:n,strategyName:o.name,envModel:process.env.MODEL}),g={...n,model:c,workspace:r.workspace||n.workspace,schema:n.schema||t.schema,images:n.images||t.images||[],skills:n.skills||t.skills||[],extraMcpServers:n.extraMcpServers||r.extraMcpServers||t.extraMcpServers||[],plugins:n.plugins||t.plugins||[],config:i},a=e,h=g.skills||[];if(h.length>0&&!n.skipPromptFragments){let d=h.map(k=>{let s=O(k)?.promptFragment;return typeof s=="function"?s():s}).filter(Boolean);d.length>0&&(a+=`
2
2
 
3
3
  ${d.join(`
4
4
 
5
- `)}`)}let u=o._currentNodeConfig?.stores;if(Array.isArray(u)&&u.length>0&&typeof u[0]=="object"){let d=u.length<=8,k=u.map(s=>{let x=s?.id??s?.storeId??"",L=(s?.name??"").toString().trim()||x,Y=s?.type?` \xB7 ${s.type}`:"",z=(s?.description||"").toString().replace(/\s+/g," ").trim(),v=`- ${L} \xB7 ${z||"(no description)"}${Y} (id: ${x})`;if(d&&s?.schema&&typeof s.schema=="object"){let A=s.schema.properties&&typeof s.schema.properties=="object"?Object.keys(s.schema.properties):Object.keys(s.schema);A.length&&(v+=`
6
- fields: ${A.join(", ")}`)}return v});a+=`
5
+ `)}`)}let u=r._currentNodeConfig?.stores;if(Array.isArray(u)&&u.length>0&&typeof u[0]=="object"){let d=u.length<=8,k=u.map(s=>{let T=s?.id??s?.storeId??"",L=(s?.name??"").toString().trim()||T,Y=s?.type?` \xB7 ${s.type}`:"",z=(s?.description||"").toString().replace(/\s+/g," ").trim(),N=`- ${L} \xB7 ${z||"(no description)"}${Y} (id: ${T})`;if(d&&s?.schema&&typeof s.schema=="object"){let A=s.schema.properties&&typeof s.schema.properties=="object"?Object.keys(s.schema.properties):Object.keys(s.schema);A.length&&(N+=`
6
+ fields: ${A.join(", ")}`)}return N});a+=`
7
7
 
8
8
  AVAILABLE STORES (pick a store by its description and pass its NAME to the store tool):
9
9
  ${k.join(`
10
- `)}`}let p=o._currentNodeConfig?.extraPromptInstructions?.trim();return p&&(a+=`
10
+ `)}`}let p=r._currentNodeConfig?.extraPromptInstructions?.trim();return p&&(a+=`
11
11
 
12
12
  \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
13
13
  PRIORITY OVERRIDE \u2014 THE FOLLOWING INSTRUCTIONS TAKE PRECEDENCE OVER ALL PREVIOUS CONTENT
14
14
  \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
15
15
 
16
16
  ${p}
17
- `),b.debug(`[workflow] prompt length: ${a.length} chars`),r.invoke(a,g)}var T,f,P=w(()=>{$();I();R();T=Symbol.for("@zibby/agent-workflow.strategies");globalThis[T]||(globalThis[T]=[]);f=globalThis[T]});var N=Symbol.for("@zibby/agent-workflow.nodes");globalThis[N]||(globalThis[N]=new Map);var m=globalThis[N];function F(e,t){m.set(e,t)}function re(e){return m.get(e)}function ie(e){return m.has(e)}function se(){return Array.from(m.keys())}function le(e){let t=m.get(e);return t?t.factory&&typeof t.create=="function"?t.create.toString():typeof t.execute=="function"?t.execute.toString():typeof t=="function"?t.toString():null:null}F("ai_agent",{name:"ai_agent",factory:!0,create:(e,t={})=>({name:e,_isCustomCode:!0,execute:async n=>{let o=n?._coreInvokeAgent;o||(o=(await Promise.resolve().then(()=>(P(),M))).invokeAgent);let l=t.extraPromptInstructions||"Execute the task based on the current state.",r=B(l,n),i=await o(r,{cwd:n.workspace||process.cwd(),model:n.model,tools:t.resolvedTools||null});return{success:!0,output:{raw:i,nodeId:e},raw:typeof i=="string"?i:i.raw}}})});function B(e,t){let n=/@([\w.]+)/g,o=new Set,l;for(;(l=n.exec(e))!==null;)o.add(l[1]);if(o.size===0)return e;let r=[],i=new Set;for(let c of o){let g=c.split(".")[0];if(i.has(g))continue;let a=c.split(".").reduce((p,d)=>p?.[d],t);if(a===void 0)continue;let h=typeof a=="string"?a:a?.raw??JSON.stringify(a,null,2),u=c.replace(/_/g," ").replace(/\b\w/g,p=>p.toUpperCase());r.push(`## ${u}
18
- ${h}`),c.includes(".")||i.add(g)}return r.length===0?e:`${e}
17
+ `),b.debug(`[workflow] prompt length: ${a.length} chars`),o.invoke(a,g)}var v,f,P=w(()=>{$();I();R();v=Symbol.for("@zibby/agent-workflow.strategies");globalThis[v]||(globalThis[v]=[]);f=globalThis[v]});var x=Symbol.for("@zibby/agent-workflow.nodes");globalThis[x]||(globalThis[x]=new Map);var m=globalThis[x];function F(e,t){m.set(e,t)}function oe(e){return m.get(e)}function ie(e){return m.has(e)}function se(){return Array.from(m.keys())}function le(e){let t=m.get(e);return t?t.factory&&typeof t.create=="function"?t.create.toString():typeof t.execute=="function"?t.execute.toString():typeof t=="function"?t.toString():null:null}F("ai_agent",{name:"ai_agent",factory:!0,create:(e,t={})=>({name:e,_isCustomCode:!0,execute:async n=>{let r=n?._coreInvokeAgent;r||(r=(await Promise.resolve().then(()=>(P(),C))).invokeAgent);let l=t.extraPromptInstructions||"Execute the task based on the current state.",o=B(l,n),i=await r(o,{cwd:n.workspace||process.cwd(),model:n.model,tools:t.resolvedTools||null});return{success:!0,output:{raw:i,nodeId:e},raw:typeof i=="string"?i:i.raw}}})});function B(e,t){let n=/@([\w.]+)/g,r=new Set,l;for(;(l=n.exec(e))!==null;)r.add(l[1]);if(r.size===0)return e;let o=[],i=new Set;for(let c of r){let g=c.split(".")[0];if(i.has(g))continue;let a=c.split(".").reduce((p,d)=>p?.[d],t);if(a===void 0)continue;let h=typeof a=="string"?a:a?.raw??JSON.stringify(a,null,2),u=c.replace(/_/g," ").replace(/\b\w/g,p=>p.toUpperCase());o.push(`## ${u}
18
+ ${h}`),c.includes(".")||i.add(g)}return o.length===0?e:`${e}
19
19
 
20
20
  ---
21
21
  # Referenced Context
22
22
 
23
- ${r.join(`
23
+ ${o.join(`
24
24
 
25
- `)}`}export{re as getNodeImpl,le as getNodeTemplate,ie as hasNode,se as listNodeTypes,F as registerNode};
25
+ `)}`}export{oe as getNodeImpl,le as getNodeTemplate,ie as hasNode,se as listNodeTypes,F as registerNode};
package/dist/node.js CHANGED
@@ -1,8 +1,8 @@
1
- var nt=Object.defineProperty;var N=(r,t)=>()=>(r&&(t=r(r=0)),t);var at=(r,t)=>{for(var e in t)nt(r,e,{get:t[e],enumerable:!0})};var D,lt,A,p,W=N(()=>{D=()=>{},lt={debug:D,info:D,warn:(...r)=>console.warn("[workflow]",...r),error:(...r)=>console.error("[workflow]",...r)},A={impl:lt},p={debug:(...r)=>A.impl.debug?.(...r),info:(...r)=>A.impl.info?.(...r),warn:(...r)=>A.impl.warn?.(...r),error:(...r)=>A.impl.error?.(...r)}});var z=N(()=>{});function V(r){return pt.get(r)||null}var P,C,pt,kt,q=N(()=>{P=Symbol.for("@zibby/agent-workflow.skills"),C=Symbol.for("@zibby/agent-workflow.skills.sources");globalThis[P]||(globalThis[P]=new Map);globalThis[C]||(globalThis[C]=new Map);pt=globalThis[P],kt=globalThis[C]});var tt={};at(tt,{getAgentStrategy:()=>Q,invokeAgent:()=>ht,listStrategies:()=>ft,registerStrategy:()=>dt,resolveInvocationModel:()=>X});function dt(r){if(!r||typeof r.getName!="function"||typeof r.invoke!="function")throw new Error("strategy must implement getName() and invoke() (AgentStrategy shape)");let t=y.findIndex(e=>e.getName()===r.getName());t>=0?y[t]=r:y.push(r)}function ft(){return y.map(r=>r.getName())}function X({config:r={},options:t={},strategyName:e,envModel:o}={}){let n=r.models||{},s=t.nodeName&&n[t.nodeName]||null,a=n.default||null,S=r.agent?.[e]?.model||null,u=(typeof o=="string"?o.trim():"")||null;return s||a||S||t.model||u||null}function Q(r={}){let{state:t={},preferredAgent:e=null}=r,o=e||t.agentType||process.env.AGENT_TYPE;if(!o){let s=y.map(a=>a.getName()).join(", ")||"none registered";throw new Error(`No agent specified. Set agentType in state or AGENT_TYPE env var. Available: ${s}`)}p.debug(`[workflow] agent selection: requested=${o}`);let n=y.find(s=>s.getName()===o);if(!n){let s=y.map(a=>a.getName()).join(", ")||"none registered";throw new Error(`Unknown agent '${o}'. Available: ${s}`)}if(!n.canHandle(r))throw new Error(`Agent '${o}' is not available in this environment. Check credentials/environment.`);return p.debug(`[workflow] using agent: ${n.getName()}`),n}async function ht(r,t={},e={}){let o=t.state&&typeof t.state.getAll=="function"?t.state.getAll():t.state||{},n={...t,state:o},s=Q(n),a=o.config||e.config||{},S=X({config:a,options:e,strategyName:s.name,envModel:process.env.MODEL}),u={...e,model:S,workspace:o.workspace||e.workspace,schema:e.schema||t.schema,images:e.images||t.images||[],skills:e.skills||t.skills||[],plugins:e.plugins||t.plugins||[],config:a},h=r,b=u.skills||[];if(b.length>0&&!e.skipPromptFragments){let g=b.map(E=>{let l=V(E)?.promptFragment;return typeof l=="function"?l():l}).filter(Boolean);g.length>0&&(h+=`
1
+ var nt=Object.defineProperty;var N=(r,t)=>()=>(r&&(t=r(r=0)),t);var at=(r,t)=>{for(var e in t)nt(r,e,{get:t[e],enumerable:!0})};var D,lt,v,p,A=N(()=>{D=()=>{},lt={debug:D,info:D,warn:(...r)=>console.warn("[workflow]",...r),error:(...r)=>console.error("[workflow]",...r)},v={impl:lt},p={debug:(...r)=>v.impl.debug?.(...r),info:(...r)=>v.impl.info?.(...r),warn:(...r)=>v.impl.warn?.(...r),error:(...r)=>v.impl.error?.(...r)}});var z=N(()=>{});function V(r){return pt.get(r)||null}var P,M,pt,kt,q=N(()=>{P=Symbol.for("@zibby/agent-workflow.skills"),M=Symbol.for("@zibby/agent-workflow.skills.sources");globalThis[P]||(globalThis[P]=new Map);globalThis[M]||(globalThis[M]=new Map);pt=globalThis[P],kt=globalThis[M]});var tt={};at(tt,{getAgentStrategy:()=>Q,invokeAgent:()=>ht,listStrategies:()=>ft,registerStrategy:()=>dt,resolveInvocationModel:()=>X});function dt(r){if(!r||typeof r.getName!="function"||typeof r.invoke!="function")throw new Error("strategy must implement getName() and invoke() (AgentStrategy shape)");let t=y.findIndex(e=>e.getName()===r.getName());t>=0?y[t]=r:y.push(r)}function ft(){return y.map(r=>r.getName())}function X({config:r={},options:t={},strategyName:e,envModel:o}={}){let n=r.models||{},i=t.nodeName&&n[t.nodeName]||null,a=n.default||null,w=r.agent?.[e]?.model||null,u=(typeof o=="string"?o.trim():"")||null;return i||a||w||t.model||u||null}function Q(r={}){let{state:t={},preferredAgent:e=null}=r,o=e||t.agentType||process.env.AGENT_TYPE;if(!o){let i=y.map(a=>a.getName()).join(", ")||"none registered";throw new Error(`No agent specified. Set agentType in state or AGENT_TYPE env var. Available: ${i}`)}p.debug(`[workflow] agent selection: requested=${o}`);let n=y.find(i=>i.getName()===o);if(!n){let i=y.map(a=>a.getName()).join(", ")||"none registered";throw new Error(`Unknown agent '${o}'. Available: ${i}`)}if(!n.canHandle(r))throw new Error(`Agent '${o}' is not available in this environment. Check credentials/environment.`);return p.debug(`[workflow] using agent: ${n.getName()}`),n}async function ht(r,t={},e={}){let o=t.state&&typeof t.state.getAll=="function"?t.state.getAll():t.state||{},n={...t,state:o},i=Q(n),a=o.config||e.config||{},w=X({config:a,options:e,strategyName:i.name,envModel:process.env.MODEL}),u={...e,model:w,workspace:o.workspace||e.workspace,schema:e.schema||t.schema,images:e.images||t.images||[],skills:e.skills||t.skills||[],extraMcpServers:e.extraMcpServers||o.extraMcpServers||t.extraMcpServers||[],plugins:e.plugins||t.plugins||[],config:a},h=r,b=u.skills||[];if(b.length>0&&!e.skipPromptFragments){let g=b.map(E=>{let l=V(E)?.promptFragment;return typeof l=="function"?l():l}).filter(Boolean);g.length>0&&(h+=`
2
2
 
3
3
  ${g.join(`
4
4
 
5
- `)}`)}let i=o._currentNodeConfig?.stores;if(Array.isArray(i)&&i.length>0&&typeof i[0]=="object"){let g=i.length<=8,E=i.map(l=>{let I=l?.id??l?.storeId??"",O=(l?.name??"").toString().trim()||I,w=l?.type?` \xB7 ${l.type}`:"",f=(l?.description||"").toString().replace(/\s+/g," ").trim(),_=`- ${O} \xB7 ${f||"(no description)"}${w} (id: ${I})`;if(g&&l?.schema&&typeof l.schema=="object"){let c=l.schema.properties&&typeof l.schema.properties=="object"?Object.keys(l.schema.properties):Object.keys(l.schema);c.length&&(_+=`
5
+ `)}`)}let s=o._currentNodeConfig?.stores;if(Array.isArray(s)&&s.length>0&&typeof s[0]=="object"){let g=s.length<=8,E=s.map(l=>{let I=l?.id??l?.storeId??"",O=(l?.name??"").toString().trim()||I,S=l?.type?` \xB7 ${l.type}`:"",f=(l?.description||"").toString().replace(/\s+/g," ").trim(),_=`- ${O} \xB7 ${f||"(no description)"}${S} (id: ${I})`;if(g&&l?.schema&&typeof l.schema=="object"){let c=l.schema.properties&&typeof l.schema.properties=="object"?Object.keys(l.schema.properties):Object.keys(l.schema);c.length&&(_+=`
6
6
  fields: ${c.join(", ")}`)}return _});h+=`
7
7
 
8
8
  AVAILABLE STORES (pick a store by its description and pass its NAME to the store tool):
@@ -14,10 +14,10 @@ PRIORITY OVERRIDE \u2014 THE FOLLOWING INSTRUCTIONS TAKE PRECEDENCE OVER ALL PRE
14
14
  \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
15
15
 
16
16
  ${m}
17
- `),p.debug(`[workflow] prompt length: ${h.length} chars`),s.invoke(h,u)}var M,y,et=N(()=>{z();W();q();M=Symbol.for("@zibby/agent-workflow.strategies");globalThis[M]||(globalThis[M]=[]);y=globalThis[M]});import $ from"handlebars";var T=class{constructor(t){this.schema=t}parse(t){let e=t.match(/```json\s*([\s\S]*?)\s*```/);if(e)return this.validate(JSON.parse(e[1]));let o=[t.match(/\{[\s\S]*?\}/),t.match(/\{[\s\S]*\}/)].filter(Boolean).map(n=>n[0]);for(let n of o)try{return this.validate(JSON.parse(n))}catch(s){if(!(s instanceof SyntaxError))throw s}return this.validate({result:t.trim()})}validate(t){let e=[];for(let[o,n]of Object.entries(this.schema)){if(n.required&&!(o in t)&&e.push(`Missing required field: ${o}`),o in t&&n.type){let s=typeof t[o];s!==n.type&&e.push(`Field '${o}' expected ${n.type}, got ${s}`)}if(n.validate&&o in t){let s=n.validate(t[o]);s&&e.push(`Field '${o}': ${s}`)}}if(e.length>0)throw new Error(`Output validation failed:
17
+ `),p.debug(`[workflow] prompt length: ${h.length} chars`),i.invoke(h,u)}var C,y,et=N(()=>{z();A();q();C=Symbol.for("@zibby/agent-workflow.strategies");globalThis[C]||(globalThis[C]=[]);y=globalThis[C]});import $ from"handlebars";var T=class{constructor(t){this.schema=t}parse(t){let e=t.match(/```json\s*([\s\S]*?)\s*```/);if(e)return this.validate(JSON.parse(e[1]));let o=[t.match(/\{[\s\S]*?\}/),t.match(/\{[\s\S]*\}/)].filter(Boolean).map(n=>n[0]);for(let n of o)try{return this.validate(JSON.parse(n))}catch(i){if(!(i instanceof SyntaxError))throw i}return this.validate({result:t.trim()})}validate(t){let e=[];for(let[o,n]of Object.entries(this.schema)){if(n.required&&!(o in t)&&e.push(`Missing required field: ${o}`),o in t&&n.type){let i=typeof t[o];i!==n.type&&e.push(`Field '${o}' expected ${n.type}, got ${i}`)}if(n.validate&&o in t){let i=n.validate(t[o]);i&&e.push(`Field '${o}': ${i}`)}}if(e.length>0)throw new Error(`Output validation failed:
18
18
  ${e.join(`
19
- `)}`);return t}};W();import{writeFileSync as F,readFileSync as rt,existsSync as ot,mkdirSync as mt}from"node:fs";import{join as j,dirname as gt}from"node:path";import d from"chalk";var ct="__WORKFLOW_GRAPH_LOG__",k=d.gray("\u2502"),ut=d.gray("\u250C"),G=d.gray("\u2514"),v=d.green("\u25C6"),H=d.hex("#c084fc")("\u25C6"),J=d.hex("#2dd4bf")("\u25C6"),x=d.red("\u25C6"),U=`${k} `,B=2;function K(r){return r<1e3?`${r}ms`:`${(r/1e3).toFixed(1)}s`}function Y(r,t){return(e,o,n)=>{if(typeof e!="string")return r(e,o,n);let s=process.stdout.columns||120,a="";for(let S=0;S<e.length;S++){let u=e[S];t.lineStart&&(a+=U,t.col=B,t.lineStart=!1),u===`
20
- `?(a+=u,t.lineStart=!0,t.col=0,t.inEsc=!1):u==="\x1B"?(t.inEsc=!0,a+=u):t.inEsc?(a+=u,(u>="A"&&u<="Z"||u>="a"&&u<="z")&&(t.inEsc=!1)):(t.col++,a+=u,t.col>=s&&(a+=`
19
+ `)}`);return t}};A();import{writeFileSync as F,readFileSync as rt,existsSync as ot,mkdirSync as mt}from"node:fs";import{join as j,dirname as gt}from"node:path";import d from"chalk";var ct="__WORKFLOW_GRAPH_LOG__",k=d.gray("\u2502"),ut=d.gray("\u250C"),G=d.gray("\u2514"),W=d.green("\u25C6"),H=d.hex("#c084fc")("\u25C6"),J=d.hex("#2dd4bf")("\u25C6"),x=d.red("\u25C6"),U=`${k} `,B=2;function K(r){return r<1e3?`${r}ms`:`${(r/1e3).toFixed(1)}s`}function Y(r,t){return(e,o,n)=>{if(typeof e!="string")return r(e,o,n);let i=process.stdout.columns||120,a="";for(let w=0;w<e.length;w++){let u=e[w];t.lineStart&&(a+=U,t.col=B,t.lineStart=!1),u===`
20
+ `?(a+=u,t.lineStart=!0,t.col=0,t.inEsc=!1):u==="\x1B"?(t.inEsc=!0,a+=u):t.inEsc?(a+=u,(u>="A"&&u<="Z"||u>="a"&&u<="z")&&(t.inEsc=!1)):(t.col++,a+=u,t.col>=i&&(a+=`
21
21
  ${U}`,t.col=B))}return r(a,o,n)}}var R=class{constructor(){this._currentNode=null,this._origStdoutWrite=null,this._origStderrWrite=null,this._emitWorkflowGraphMarkers=String(process.env.ZIBBY_EMIT_GRAPH_MARKERS||"").trim()==="1"||String(process.env.ZIBBY_WORKFLOW_GRAPH_LOG_MARKERS||"").trim()==="1"}get isInsideNode(){return this._currentNode!==null}_startIntercepting(){this._origStdoutWrite=process.stdout.write.bind(process.stdout),this._origStderrWrite=process.stderr.write.bind(process.stderr);let t={lineStart:!0,col:0,inEsc:!1},e={lineStart:!0,col:0,inEsc:!1};this._outState=t,this._errState=e,process.stdout.write=Y(this._origStdoutWrite,t),process.stderr.write=Y(this._origStderrWrite,e)}_stopIntercepting(){this._origStdoutWrite&&(this._outState&&!this._outState.lineStart&&this._origStdoutWrite(`
22
22
  `),process.stdout.write=this._origStdoutWrite),this._origStderrWrite&&(this._errState&&!this._errState.lineStart&&this._origStderrWrite(`
23
23
  `),process.stderr.write=this._origStderrWrite),this._origStdoutWrite=null,this._origStderrWrite=null}_rawWrite(t){(this._origStdoutWrite||process.stdout.write.bind(process.stdout))(`${t}
@@ -25,10 +25,10 @@ ${U}`,t.col=B))}return r(a,o,n)}}var R=class{constructor(){this._currentNode=nul
25
25
  `;this._origStdoutWrite?this._origStdoutWrite(e):process.stdout.write(e)}_writeDot(t,e){this._origStdoutWrite?(this._outState&&!this._outState.lineStart&&(this._origStdoutWrite(`
26
26
  `),this._outState.lineStart=!0,this._outState.col=0),this._origStdoutWrite(`${t} ${e}
27
27
  `)):process.stdout.write.bind(process.stdout)(`${t} ${e}
28
- `)}step(t){this._origStdoutWrite?this._writeDot(v,t):process.stdout.write.bind(process.stdout)(`${k} ${v} ${t}
28
+ `)}step(t){this._origStdoutWrite?this._writeDot(W,t):process.stdout.write.bind(process.stdout)(`${k} ${W} ${t}
29
29
  `)}stepInfo(t){this.step(t)}stepTool(t){this._origStdoutWrite?this._writeDot(H,t):process.stdout.write.bind(process.stdout)(`${k} ${H} ${t}
30
30
  `)}stepMemory(t){let e=d.hex("#2dd4bf")(t);this._origStdoutWrite?this._writeDot(J,e):process.stdout.write.bind(process.stdout)(`${k} ${J} ${e}
31
31
  `)}stepFail(t){this._origStdoutWrite?this._writeDot(x,d.red(t)):process.stdout.write.bind(process.stdout)(`${k} ${x} ${d.red(t)}
32
- `)}nodeStart(t){this._currentNode=t,this._emitGraphLogMarker({phase:"node_begin",node:t}),this._rawWrite(`${ut} ${t}`),this._startIntercepting()}nodeComplete(t,e={}){this._stopIntercepting();let{duration:o,details:n}=e;if(n)for(let a of n)this._rawWrite(`${v} ${a}`);let s=o?d.dim(` ${K(o)}`):"";this._rawWrite(`${G} ${d.green("done")}${s}`),this._emitGraphLogMarker({phase:"node_end",node:t}),this._rawWrite("")}nodeFailed(t,e,o={}){this._stopIntercepting();let{duration:n}=o,s=n?d.dim(` ${K(n)}`):"";this._rawWrite(`${x} ${d.red(e)}`),this._rawWrite(`${G} ${d.red("failed")}${s}`),this._emitGraphLogMarker({phase:"node_end",node:t}),this._rawWrite("")}route(t,e){this._rawWrite(d.dim(` ${t} \u2192 ${e}`)),this._rawWrite("")}graphComplete(){}},Z=new R;var L=".session-info.json";var Et=Object.freeze(["codebase-memory","code-scan","artifact"]);$.helpers.inc||$.registerHelper("inc",r=>Number(r)+1);$.helpers.json||$.registerHelper("json",r=>JSON.stringify(r,null,2));$.helpers.eq||$.registerHelper("eq",(r,t)=>r===t);var it=class{constructor(t){if(this.config=t,this.name=t.name,this.prompt=t.prompt,this.outputSchema=t.outputSchema,!this.outputSchema&&!t._isCustomCode&&!t._isRouter)throw new Error(`Node '${this.name}' must define outputSchema (Zod schema). This defines the contract for what the node returns to state.`);this.isZodSchema=this.outputSchema&&typeof this.outputSchema._def<"u",this.parser=t.outputSchema&&!this.isZodSchema?new T(t.outputSchema):null,this.retries=t.retries||0,this.onComplete=t.onComplete,this.customExecute=t.execute}async execute(t,e){if(this.config._isRouter)return p.debug(`[workflow] node '${this.name}': router passthrough (routing happens on its conditional edges)`),{success:!0,output:{},raw:null};let o=()=>e&&typeof e.getAll=="function"?e.getAll():t,n=i=>e&&typeof e.get=="function"?e.get(i):t?.[i];if(typeof this.customExecute=="function"){p.debug(`[workflow] node '${this.name}': custom execute (skipping LLM)`);try{let i=await this.customExecute(t);return typeof i=="object"&&i!==null&&i.success===!1?{success:!1,error:i.error||"Node execution failed",raw:i.raw||null}:this.isZodSchema?(p.debug(`[workflow] node '${this.name}': validating output schema`),{success:!0,output:this.outputSchema.parse(i),raw:null}):{success:!0,output:i,raw:null}}catch(i){return p.error(`[workflow] node '${this.name}' failed: ${i.message}`),i.name==="ZodError"&&p.error(`Schema errors: ${JSON.stringify(i.issues||i.errors,null,2)}`),{success:!1,error:i.message,raw:null}}}let s;typeof this.prompt=="function"?s=this.prompt(o()):typeof this.prompt=="string"&&this.prompt.includes("{{")?(this._compiledPrompt||(this._compiledPrompt=$.compile(this.prompt,{noEscape:!0})),s=this._compiledPrompt(o())):s=this.prompt;let a=n("_skillHints");a&&(s=`${a}
32
+ `)}nodeStart(t){this._currentNode=t,this._emitGraphLogMarker({phase:"node_begin",node:t}),this._rawWrite(`${ut} ${t}`),this._startIntercepting()}nodeComplete(t,e={}){this._stopIntercepting();let{duration:o,details:n}=e;if(n)for(let a of n)this._rawWrite(`${W} ${a}`);let i=o?d.dim(` ${K(o)}`):"";this._rawWrite(`${G} ${d.green("done")}${i}`),this._emitGraphLogMarker({phase:"node_end",node:t}),this._rawWrite("")}nodeFailed(t,e,o={}){this._stopIntercepting();let{duration:n}=o,i=n?d.dim(` ${K(n)}`):"";this._rawWrite(`${x} ${d.red(e)}`),this._rawWrite(`${G} ${d.red("failed")}${i}`),this._emitGraphLogMarker({phase:"node_end",node:t}),this._rawWrite("")}route(t,e){this._rawWrite(d.dim(` ${t} \u2192 ${e}`)),this._rawWrite("")}graphComplete(){}},Z=new R;var L=".session-info.json";var Et=Object.freeze(["codebase-memory","code-scan","artifact"]);$.helpers.inc||$.registerHelper("inc",r=>Number(r)+1);$.helpers.json||$.registerHelper("json",r=>JSON.stringify(r,null,2));$.helpers.eq||$.registerHelper("eq",(r,t)=>r===t);var st=class{constructor(t){if(this.config=t,this.name=t.name,this.prompt=t.prompt,this.outputSchema=t.outputSchema,!this.outputSchema&&!t._isCustomCode&&!t._isRouter)throw new Error(`Node '${this.name}' must define outputSchema (Zod schema). This defines the contract for what the node returns to state.`);this.isZodSchema=this.outputSchema&&typeof this.outputSchema._def<"u",this.parser=t.outputSchema&&!this.isZodSchema?new T(t.outputSchema):null,this.retries=t.retries||0,this.onComplete=t.onComplete,this.customExecute=t.execute}async execute(t,e){if(this.config._isRouter)return p.debug(`[workflow] node '${this.name}': router passthrough (routing happens on its conditional edges)`),{success:!0,output:{},raw:null};let o=()=>e&&typeof e.getAll=="function"?e.getAll():t,n=s=>e&&typeof e.get=="function"?e.get(s):t?.[s];if(typeof this.customExecute=="function"){p.debug(`[workflow] node '${this.name}': custom execute (skipping LLM)`);try{let s=await this.customExecute(t);return typeof s=="object"&&s!==null&&s.success===!1?{success:!1,error:s.error||"Node execution failed",raw:s.raw||null}:this.isZodSchema?(p.debug(`[workflow] node '${this.name}': validating output schema`),{success:!0,output:this.outputSchema.parse(s),raw:null}):{success:!0,output:s,raw:null}}catch(s){return p.error(`[workflow] node '${this.name}' failed: ${s.message}`),s.name==="ZodError"&&p.error(`Schema errors: ${JSON.stringify(s.issues||s.errors,null,2)}`),{success:!1,error:s.message,raw:null}}}let i;typeof this.prompt=="function"?i=this.prompt(o()):typeof this.prompt=="string"&&this.prompt.includes("{{")?(this._compiledPrompt||(this._compiledPrompt=$.compile(this.prompt,{noEscape:!0})),i=this._compiledPrompt(o())):i=this.prompt;let a=n("_skillHints");a&&(i=`${a}
33
33
 
34
- ${s}`);let S=o(),u=S.cwd||process.cwd(),h=S.sessionPath;try{if(h){let i=j(h,L);if(ot(i)){let g=JSON.parse(rt(i,"utf-8"));g.currentNode=this.name,F(i,JSON.stringify(g,null,2),"utf-8")}let m=j(h,"..",L);if(ot(m))try{let g=JSON.parse(rt(m,"utf-8"));g.currentNode=this.name,F(m,JSON.stringify(g,null,2),"utf-8")}catch{}}}catch(i){p.debug(`[workflow] could not update session info: ${i.message}`)}let b=null;for(let i=0;i<=this.retries;i++)try{p.debug(`[workflow] node '${this.name}' attempt ${i}`);let m=o().config||{},g=m.agents||{},E=this.config.agent??g[this.name]??null,l={state:o()};E&&(l.preferredAgent=E);let I={workspace:u,schema:this.isZodSchema?this.outputSchema:null,skills:this.config.skills||[],plugins:this.config.plugins||[],sessionPath:h,config:m,nodeName:this.name,timeout:this.config?.timeout||3e5},O=t?._coreInvokeAgent;O||(O=(await Promise.resolve().then(()=>(et(),tt))).invokeAgent);let w=await O(s,l,I),f,_;if(typeof w=="string"?(f=w,_=null):w.structured?(f=w.raw||JSON.stringify(w.structured,null,2),_=w.structured):(f=w.raw||JSON.stringify(w,null,2),_=w.extracted||null),h)try{let c=j(h,this.name,"raw_stream_output.txt");mt(gt(c),{recursive:!0}),F(c,typeof f=="string"?f:JSON.stringify(f),"utf-8")}catch(c){p.debug(`[workflow] could not save raw output: ${c.message}`)}if(this.isZodSchema&&_){p.info(`[workflow] node '${this.name}': output validated: ${JSON.stringify(_,null,2)}`);let c=_;if(typeof this.onComplete=="function")try{c=await this.onComplete(o(),_)}catch(st){p.warn(`[workflow] onComplete hook failed: ${st.message}`)}return{success:!0,output:c,raw:f}}if(typeof this.onComplete=="function")try{return{success:!0,output:await this.onComplete(o(),{raw:f}),raw:f}}catch(c){throw new Error(`onComplete failed: ${c.message}`,{cause:c})}if(this.parser){let c=this.parser.parse(f);return p.info(`[workflow] node '${this.name}': parsed output: ${JSON.stringify(c,null,2)}`),Z.step("Output parsed"),{success:!0,output:c,raw:f}}return{success:!0,output:f,raw:f}}catch(m){b=m,i<this.retries&&p.info(`[workflow] node '${this.name}' failed, retrying (${i+1}/${this.retries})\u2026`)}return{success:!1,error:b.message,raw:null}}};export{it as Node};
34
+ ${i}`);let w=o(),u=w.cwd||process.cwd(),h=w.sessionPath;try{if(h){let s=j(h,L);if(ot(s)){let g=JSON.parse(rt(s,"utf-8"));g.currentNode=this.name,F(s,JSON.stringify(g,null,2),"utf-8")}let m=j(h,"..",L);if(ot(m))try{let g=JSON.parse(rt(m,"utf-8"));g.currentNode=this.name,F(m,JSON.stringify(g,null,2),"utf-8")}catch{}}}catch(s){p.debug(`[workflow] could not update session info: ${s.message}`)}let b=null;for(let s=0;s<=this.retries;s++)try{p.debug(`[workflow] node '${this.name}' attempt ${s}`);let m=o().config||{},g=m.agents||{},E=this.config.agent??g[this.name]??null,l={state:o()};E&&(l.preferredAgent=E);let I={workspace:u,schema:this.isZodSchema?this.outputSchema:null,skills:this.config.skills||[],plugins:this.config.plugins||[],sessionPath:h,config:m,nodeName:this.name,timeout:this.config?.timeout||3e5},O=t?._coreInvokeAgent;O||(O=(await Promise.resolve().then(()=>(et(),tt))).invokeAgent);let S=await O(i,l,I),f,_;if(typeof S=="string"?(f=S,_=null):S.structured?(f=S.raw||JSON.stringify(S.structured,null,2),_=S.structured):(f=S.raw||JSON.stringify(S,null,2),_=S.extracted||null),h)try{let c=j(h,this.name,"raw_stream_output.txt");mt(gt(c),{recursive:!0}),F(c,typeof f=="string"?f:JSON.stringify(f),"utf-8")}catch(c){p.debug(`[workflow] could not save raw output: ${c.message}`)}if(this.isZodSchema&&_){p.info(`[workflow] node '${this.name}': output validated: ${JSON.stringify(_,null,2)}`);let c=_;if(typeof this.onComplete=="function")try{c=await this.onComplete(o(),_)}catch(it){p.warn(`[workflow] onComplete hook failed: ${it.message}`)}return{success:!0,output:c,raw:f}}if(typeof this.onComplete=="function")try{return{success:!0,output:await this.onComplete(o(),{raw:f}),raw:f}}catch(c){throw new Error(`onComplete failed: ${c.message}`,{cause:c})}if(this.parser){let c=this.parser.parse(f);return p.info(`[workflow] node '${this.name}': parsed output: ${JSON.stringify(c,null,2)}`),Z.step("Output parsed"),{success:!0,output:c,raw:f}}return{success:!0,output:f,raw:f}}catch(m){b=m,s<this.retries&&p.info(`[workflow] node '${this.name}' failed, retrying (${s+1}/${this.retries})\u2026`)}return{success:!1,error:b.message,raw:null}}};export{st as Node};
@@ -1,17 +1,17 @@
1
- var v=()=>{},_={debug:v,info:v,warn:(...e)=>console.warn("[workflow]",...e),error:(...e)=>console.error("[workflow]",...e)},m={impl:_};var d={debug:(...e)=>m.impl.debug?.(...e),info:(...e)=>m.impl.info?.(...e),warn:(...e)=>m.impl.warn?.(...e),error:(...e)=>m.impl.error?.(...e)};var w=Symbol.for("@zibby/agent-workflow.skills"),b=Symbol.for("@zibby/agent-workflow.skills.sources");globalThis[w]||(globalThis[w]=new Map);globalThis[b]||(globalThis[b]=new Map);var x=globalThis[w],P=globalThis[b];function A(e){return x.get(e)||null}var y=Symbol.for("@zibby/agent-workflow.strategies");globalThis[y]||(globalThis[y]=[]);var a=globalThis[y];function D(e){if(!e||typeof e.getName!="function"||typeof e.invoke!="function")throw new Error("strategy must implement getName() and invoke() (AgentStrategy shape)");let t=a.findIndex(r=>r.getName()===e.getName());t>=0?a[t]=e:a.push(e)}function H(){return a.map(e=>e.getName())}function R({config:e={},options:t={},strategyName:r,envModel:o}={}){let s=e.models||{},i=t.nodeName&&s[t.nodeName]||null,l=s.default||null,u=e.agent?.[r]?.model||null,p=(typeof o=="string"?o.trim():"")||null;return i||l||u||t.model||p||null}function j(e={}){let{state:t={},preferredAgent:r=null}=e,o=r||t.agentType||process.env.AGENT_TYPE;if(!o){let i=a.map(l=>l.getName()).join(", ")||"none registered";throw new Error(`No agent specified. Set agentType in state or AGENT_TYPE env var. Available: ${i}`)}d.debug(`[workflow] agent selection: requested=${o}`);let s=a.find(i=>i.getName()===o);if(!s){let i=a.map(l=>l.getName()).join(", ")||"none registered";throw new Error(`Unknown agent '${o}'. Available: ${i}`)}if(!s.canHandle(e))throw new Error(`Agent '${o}' is not available in this environment. Check credentials/environment.`);return d.debug(`[workflow] using agent: ${s.getName()}`),s}async function K(e,t={},r={}){let o=t.state&&typeof t.state.getAll=="function"?t.state.getAll():t.state||{},s={...t,state:o},i=j(s),l=o.config||r.config||{},u=R({config:l,options:r,strategyName:i.name,envModel:process.env.MODEL}),p={...r,model:u,workspace:o.workspace||r.workspace,schema:r.schema||t.schema,images:r.images||t.images||[],skills:r.skills||t.skills||[],plugins:r.plugins||t.plugins||[],config:l},c=e,k=p.skills||[];if(k.length>0&&!r.skipPromptFragments){let f=k.map(h=>{let n=A(h)?.promptFragment;return typeof n=="function"?n():n}).filter(Boolean);f.length>0&&(c+=`
1
+ var T=()=>{},O={debug:T,info:T,warn:(...e)=>console.warn("[workflow]",...e),error:(...e)=>console.error("[workflow]",...e)},m={impl:O};var d={debug:(...e)=>m.impl.debug?.(...e),info:(...e)=>m.impl.info?.(...e),warn:(...e)=>m.impl.warn?.(...e),error:(...e)=>m.impl.error?.(...e)};var w=Symbol.for("@zibby/agent-workflow.skills"),b=Symbol.for("@zibby/agent-workflow.skills.sources");globalThis[w]||(globalThis[w]=new Map);globalThis[b]||(globalThis[b]=new Map);var _=globalThis[w],P=globalThis[b];function A(e){return _.get(e)||null}var y=Symbol.for("@zibby/agent-workflow.strategies");globalThis[y]||(globalThis[y]=[]);var a=globalThis[y];function D(e){if(!e||typeof e.getName!="function"||typeof e.invoke!="function")throw new Error("strategy must implement getName() and invoke() (AgentStrategy shape)");let t=a.findIndex(n=>n.getName()===e.getName());t>=0?a[t]=e:a.push(e)}function H(){return a.map(e=>e.getName())}function M({config:e={},options:t={},strategyName:n,envModel:o}={}){let s=e.models||{},i=t.nodeName&&s[t.nodeName]||null,l=s.default||null,u=e.agent?.[n]?.model||null,p=(typeof o=="string"?o.trim():"")||null;return i||l||u||t.model||p||null}function R(e={}){let{state:t={},preferredAgent:n=null}=e,o=n||t.agentType||process.env.AGENT_TYPE;if(!o){let i=a.map(l=>l.getName()).join(", ")||"none registered";throw new Error(`No agent specified. Set agentType in state or AGENT_TYPE env var. Available: ${i}`)}d.debug(`[workflow] agent selection: requested=${o}`);let s=a.find(i=>i.getName()===o);if(!s){let i=a.map(l=>l.getName()).join(", ")||"none registered";throw new Error(`Unknown agent '${o}'. Available: ${i}`)}if(!s.canHandle(e))throw new Error(`Agent '${o}' is not available in this environment. Check credentials/environment.`);return d.debug(`[workflow] using agent: ${s.getName()}`),s}async function K(e,t={},n={}){let o=t.state&&typeof t.state.getAll=="function"?t.state.getAll():t.state||{},s={...t,state:o},i=R(s),l=o.config||n.config||{},u=M({config:l,options:n,strategyName:i.name,envModel:process.env.MODEL}),p={...n,model:u,workspace:o.workspace||n.workspace,schema:n.schema||t.schema,images:n.images||t.images||[],skills:n.skills||t.skills||[],extraMcpServers:n.extraMcpServers||o.extraMcpServers||t.extraMcpServers||[],plugins:n.plugins||t.plugins||[],config:l},c=e,k=p.skills||[];if(k.length>0&&!n.skipPromptFragments){let f=k.map(h=>{let r=A(h)?.promptFragment;return typeof r=="function"?r():r}).filter(Boolean);f.length>0&&(c+=`
2
2
 
3
3
  ${f.join(`
4
4
 
5
- `)}`)}let g=o._currentNodeConfig?.stores;if(Array.isArray(g)&&g.length>0&&typeof g[0]=="object"){let f=g.length<=8,h=g.map(n=>{let S=n?.id??n?.storeId??"",$=(n?.name??"").toString().trim()||S,I=n?.type?` \xB7 ${n.type}`:"",O=(n?.description||"").toString().replace(/\s+/g," ").trim(),N=`- ${$} \xB7 ${O||"(no description)"}${I} (id: ${S})`;if(f&&n?.schema&&typeof n.schema=="object"){let T=n.schema.properties&&typeof n.schema.properties=="object"?Object.keys(n.schema.properties):Object.keys(n.schema);T.length&&(N+=`
6
- fields: ${T.join(", ")}`)}return N});c+=`
5
+ `)}`)}let g=o._currentNodeConfig?.stores;if(Array.isArray(g)&&g.length>0&&typeof g[0]=="object"){let f=g.length<=8,h=g.map(r=>{let E=r?.id??r?.storeId??"",$=(r?.name??"").toString().trim()||E,x=r?.type?` \xB7 ${r.type}`:"",I=(r?.description||"").toString().replace(/\s+/g," ").trim(),v=`- ${$} \xB7 ${I||"(no description)"}${x} (id: ${E})`;if(f&&r?.schema&&typeof r.schema=="object"){let N=r.schema.properties&&typeof r.schema.properties=="object"?Object.keys(r.schema.properties):Object.keys(r.schema);N.length&&(v+=`
6
+ fields: ${N.join(", ")}`)}return v});c+=`
7
7
 
8
8
  AVAILABLE STORES (pick a store by its description and pass its NAME to the store tool):
9
9
  ${h.join(`
10
- `)}`}let E=o._currentNodeConfig?.extraPromptInstructions?.trim();return E&&(c+=`
10
+ `)}`}let S=o._currentNodeConfig?.extraPromptInstructions?.trim();return S&&(c+=`
11
11
 
12
12
  \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
13
13
  PRIORITY OVERRIDE \u2014 THE FOLLOWING INSTRUCTIONS TAKE PRECEDENCE OVER ALL PREVIOUS CONTENT
14
14
  \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
15
15
 
16
- ${E}
17
- `),d.debug(`[workflow] prompt length: ${c.length} chars`),i.invoke(c,p)}export{j as getAgentStrategy,K as invokeAgent,H as listStrategies,D as registerStrategy,R as resolveInvocationModel};
16
+ ${S}
17
+ `),d.debug(`[workflow] prompt length: ${c.length} chars`),i.invoke(c,p)}export{R as getAgentStrategy,K as invokeAgent,H as listStrategies,D as registerStrategy,M as resolveInvocationModel};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zibby/agent-workflow",
3
- "version": "0.4.39",
3
+ "version": "0.4.40",
4
4
  "description": "Graph-based AI agent workflow orchestration. Bring your own agent strategies.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",