@zibby/agent-workflow 0.6.6 → 2.0.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/dist/code-generator.js +10 -10
- package/dist/graph-compiler.js +10 -10
- package/dist/graph.js +10 -10
- package/dist/index.d.ts +1 -1
- package/dist/index.js +21 -21
- package/dist/node-registry.js +7 -7
- package/dist/node.js +8 -8
- package/dist/strategy-registry.d.ts +25 -0
- package/dist/strategy-registry.js +6 -6
- package/package.json +1 -1
|
@@ -51,6 +51,31 @@ export declare function listStrategies(): any;
|
|
|
51
51
|
* config is one more chance to drift; this wires the last container-side one.
|
|
52
52
|
*/
|
|
53
53
|
export declare function resolveInvocationModel({ config, options, strategyName, envModel, nodeConfigModel }?: any): any;
|
|
54
|
+
/**
|
|
55
|
+
* The per-invocation PASSTHROUGH options — the fields a strategy needs that are
|
|
56
|
+
* sourced from (in order) the explicit per-call options, the run state, then the
|
|
57
|
+
* node context. ONE implementation, imported by every invokeAgent.
|
|
58
|
+
*
|
|
59
|
+
* WHY IT IS A SHARED FUNCTION: this package's invokeAgent (the engine path) and
|
|
60
|
+
* @zibby/core's invokeAgent (what a template CODE NODE imports) each built this
|
|
61
|
+
* object by hand, and the two lists drifted — core's never carried
|
|
62
|
+
* `extraMcpServers` at all, so an agent's custom MCP servers reached prompt
|
|
63
|
+
* nodes and silently vanished for every code node. Found live 2026-08-18: a
|
|
64
|
+
* browser MCP server attached to frontend-specialist, resolved by the executor,
|
|
65
|
+
* delivered into the run container, parsed by the CLI onto
|
|
66
|
+
* state.extraMcpServers — and then dropped one line before the strategy, so the
|
|
67
|
+
* QA node reported "no browser tools". Same executor-drift class as the model
|
|
68
|
+
* chain (resolveInvocationModel, above), same cure: derive, don't duplicate.
|
|
69
|
+
* A field added here now reaches BOTH paths by construction.
|
|
70
|
+
*/
|
|
71
|
+
export declare function resolveInvocationExtras({ options, stateView, context }?: any): {
|
|
72
|
+
workspace: any;
|
|
73
|
+
schema: any;
|
|
74
|
+
images: any;
|
|
75
|
+
skills: any;
|
|
76
|
+
extraMcpServers: any;
|
|
77
|
+
plugins: any;
|
|
78
|
+
};
|
|
54
79
|
export declare function getAgentStrategy(context?: any): any;
|
|
55
80
|
/**
|
|
56
81
|
* Invoke an agent with automatic strategy selection.
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var
|
|
1
|
+
var _=()=>{},M={debug:_,info:_,warn:(...e)=>console.warn("[workflow]",...e),error:(...e)=>console.error("[workflow]",...e)},k={impl:M};var S={debug:(...e)=>k.impl.debug?.(...e),info:(...e)=>k.impl.info?.(...e),warn:(...e)=>k.impl.warn?.(...e),error:(...e)=>k.impl.error?.(...e)};var T=Symbol.for("@zibby/agent-workflow.skills"),A=Symbol.for("@zibby/agent-workflow.skills.sources");globalThis[T]||(globalThis[T]=new Map);globalThis[A]||(globalThis[A]=new Map);var P=globalThis[T],D=globalThis[A];function R(e){return P.get(e)||null}var I=Symbol.for("@zibby/agent-workflow.strategies");globalThis[I]||(globalThis[I]=[]);var m=globalThis[I];function U(e){if(!e||typeof e.getName!="function"||typeof e.invoke!="function")throw new Error("strategy must implement getName() and invoke() (AgentStrategy shape)");let t=m.findIndex(n=>n.getName()===e.getName());t>=0?m[t]=e:m.push(e)}function V(){return m.map(e=>e.getName())}function j({config:e={},options:t={},strategyName:n,envModel:r,nodeConfigModel:l}={}){let i=e.models||{},g=typeof l=="string"&&l.trim()&&l.trim()!=="auto"?l.trim():null,f=t.nodeName&&i[t.nodeName]||null,y=i.default||null,E=e.agent?.[n]?.model||null,v=(typeof r=="string"?r.trim():"")||null;return g||f||y||E||t.model||v||null}function L({options:e={},stateView:t={},context:n={}}={}){return{workspace:t.workspace||e.workspace,schema:e.schema||n.schema,images:e.images||n.images||[],skills:e.skills||n.skills||[],extraMcpServers:e.extraMcpServers||t.extraMcpServers||n.extraMcpServers||[],plugins:e.plugins||n.plugins||[]}}function C(e={}){let{state:t={},preferredAgent:n=null}=e,r=n||t.agentType||process.env.AGENT_TYPE;if(!r){let i=m.map(g=>g.getName()).join(", ")||"none registered";throw new Error(`No agent specified. Set agentType in state or AGENT_TYPE env var. Available: ${i}`)}S.debug(`[workflow] agent selection: requested=${r}`);let l=m.find(i=>i.getName()===r);if(!l){let i=m.map(g=>g.getName()).join(", ")||"none registered";throw new Error(`Unknown agent '${r}'. Available: ${i}`)}if(!l.canHandle(e))throw new Error(`Agent '${r}' is not available in this environment. Check credentials/environment.`);return S.debug(`[workflow] using agent: ${l.getName()}`),l}async function B(e,t={},n={}){let r=t.state&&typeof t.state.getAll=="function"?t.state.getAll():t.state||{},l={...t,state:r},i=C(l),g=r.config||n.config||{},f=r._currentNodeConfig||{},y=typeof f.agent=="string"?f.agent.trim():"",E=!y||y===i.name?f.model:null,v=j({config:g,options:n,strategyName:i.name,envModel:process.env.MODEL,nodeConfigModel:E}),O={...n,model:v,...L({options:n,stateView:r,context:t}),config:g},u=e,$=O.skills||[];if($.length>0&&!n.skipPromptFragments){let p=n.connectedIntegrations;if(!p){let s=process.env.WORKFLOW_CONNECTED_INTEGRATIONS;if(typeof s=="string"&&s.trim()!==""){p={};for(let a of s.split(",").map(c=>c.trim()).filter(Boolean))p[a]=!0}}let N=s=>{let a=s&&s.requiresIntegration;return!a||!p?!0:(Array.isArray(a)?a:[a]).some(b=>p[b]===!0)},o=i.name==="assistant",h=s=>s?.inProcessOnly!==!0||o,w=$.map(s=>{let a=R(s);if(!N(a)||!h(a))return null;let c=a?.promptFragment;return typeof c=="function"?c():c}).filter(Boolean);w.length>0&&(u+=`
|
|
2
2
|
|
|
3
3
|
${w.join(`
|
|
4
4
|
|
|
5
|
-
`)}`)}let d=r._currentNodeConfig?.stores;if(Array.isArray(d)&&d.length>0&&typeof d[0]=="object"){let
|
|
5
|
+
`)}`)}let d=r._currentNodeConfig?.stores;if(Array.isArray(d)&&d.length>0&&typeof d[0]=="object"){let p=d.length<=8,N=d.map(o=>{let h=o?.id??o?.storeId??"",w=(o?.name??"").toString().trim()||h,s=o?.type?` \xB7 ${o.type}`:"",a=(o?.description||"").toString().replace(/\s+/g," ").trim(),c=`- ${w} \xB7 ${a||"(no description)"}${s} (id: ${h})`;if(p&&o?.schema&&typeof o.schema=="object"){let b=o.schema.properties&&typeof o.schema.properties=="object"?Object.keys(o.schema.properties):Object.keys(o.schema);b.length&&(c+=`
|
|
6
6
|
fields: ${b.join(", ")}`)}return c});u+=`
|
|
7
7
|
|
|
8
8
|
AVAILABLE STORES (pick a store by its description and pass its NAME to the store tool):
|
|
9
|
-
${
|
|
10
|
-
`)}`}let
|
|
9
|
+
${N.join(`
|
|
10
|
+
`)}`}let x=r._currentNodeConfig?.extraPromptInstructions?.trim();return x&&(u+=`
|
|
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
|
-
${
|
|
17
|
-
`),S.debug(`[workflow] prompt length: ${u.length} chars`),i.invoke(u,O)}export{
|
|
16
|
+
${x}
|
|
17
|
+
`),S.debug(`[workflow] prompt length: ${u.length} chars`),i.invoke(u,O)}export{C as getAgentStrategy,B as invokeAgent,V as listStrategies,U as registerStrategy,L as resolveInvocationExtras,j as resolveInvocationModel};
|