@zibby/agent-workflow 0.6.2 → 0.6.4
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 +19 -19
- package/dist/graph-compiler.js +13 -13
- package/dist/graph.js +14 -14
- package/dist/index.js +17 -17
- package/dist/node-registry.js +10 -10
- package/dist/node.js +18 -18
- package/dist/strategy-registry.d.ts +13 -2
- package/dist/strategy-registry.js +7 -7
- package/package.json +1 -1
|
@@ -33,13 +33,24 @@ export declare function listStrategies(): any;
|
|
|
33
33
|
*/
|
|
34
34
|
/**
|
|
35
35
|
* The ONE place an invocation's model is resolved. Chain, most-specific first:
|
|
36
|
-
*
|
|
36
|
+
* nodeConfigModel (the operator's saved per-node pin, shipped with the run's
|
|
37
|
+
* nodeConfigs and overlaid per node — see below)
|
|
38
|
+
* > config.models[node] > config.models.default > config.agent[vendor].model
|
|
37
39
|
* > options.model (the node's explicit per-call pick, e.g. triage's cheap tier)
|
|
38
40
|
* Pure function so the contract is unit-tested — the o4-mini incident was this
|
|
39
41
|
* chain resolving to null and the strategy silently substituting its vendor
|
|
40
42
|
* default underneath us.
|
|
43
|
+
*
|
|
44
|
+
* nodeConfigModel closed the FIFTH executor-drift read-site: the dashboard's
|
|
45
|
+
* per-node model pin (workflow row nodeConfigOverrides[node].model) always
|
|
46
|
+
* SHIPPED with container runs (state.nodeConfigs → _currentNodeConfig) and this
|
|
47
|
+
* chain always honored config.models[node] — but nothing connected the two, so
|
|
48
|
+
* a pinned node silently ran the run-level MODEL instead (found live: a
|
|
49
|
+
* gitlab-kb-sync fetch node pinned to opus ran sonnet). The copilot turn
|
|
50
|
+
* runtime had the same class fixed earlier — each executor re-reading model
|
|
51
|
+
* config is one more chance to drift; this wires the last container-side one.
|
|
41
52
|
*/
|
|
42
|
-
export declare function resolveInvocationModel({ config, options, strategyName, envModel }?: any): any;
|
|
53
|
+
export declare function resolveInvocationModel({ config, options, strategyName, envModel, nodeConfigModel }?: any): any;
|
|
43
54
|
export declare function getAgentStrategy(context?: any): any;
|
|
44
55
|
/**
|
|
45
56
|
* Invoke an agent with automatic strategy selection.
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var
|
|
1
|
+
var x=()=>{},M={debug:x,info:x,warn:(...e)=>console.warn("[workflow]",...e),error:(...e)=>console.error("[workflow]",...e)},h={impl:M};var w={debug:(...e)=>h.impl.debug?.(...e),info:(...e)=>h.impl.info?.(...e),warn:(...e)=>h.impl.warn?.(...e),error:(...e)=>h.impl.error?.(...e)};var N=Symbol.for("@zibby/agent-workflow.skills"),v=Symbol.for("@zibby/agent-workflow.skills.sources");globalThis[N]||(globalThis[N]=new Map);globalThis[v]||(globalThis[v]=new Map);var P=globalThis[N],G=globalThis[v];function R(e){return P.get(e)||null}var T=Symbol.for("@zibby/agent-workflow.strategies");globalThis[T]||(globalThis[T]=[]);var m=globalThis[T];function F(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 H(){return m.map(e=>e.getName())}function j({config:e={},options:t={},strategyName:n,envModel:r,nodeConfigModel:s}={}){let i=e.models||{},c=typeof s=="string"&&s.trim()&&s.trim()!=="auto"?s.trim():null,f=t.nodeName&&i[t.nodeName]||null,y=i.default||null,b=e.agent?.[n]?.model||null,k=(typeof r=="string"?r.trim():"")||null;return c||f||y||b||t.model||k||null}function L(e={}){let{state:t={},preferredAgent:n=null}=e,r=n||t.agentType||process.env.AGENT_TYPE;if(!r){let i=m.map(c=>c.getName()).join(", ")||"none registered";throw new Error(`No agent specified. Set agentType in state or AGENT_TYPE env var. Available: ${i}`)}w.debug(`[workflow] agent selection: requested=${r}`);let s=m.find(i=>i.getName()===r);if(!s){let i=m.map(c=>c.getName()).join(", ")||"none registered";throw new Error(`Unknown agent '${r}'. Available: ${i}`)}if(!s.canHandle(e))throw new Error(`Agent '${r}' is not available in this environment. Check credentials/environment.`);return w.debug(`[workflow] using agent: ${s.getName()}`),s}async function U(e,t={},n={}){let r=t.state&&typeof t.state.getAll=="function"?t.state.getAll():t.state||{},s={...t,state:r},i=L(s),c=r.config||n.config||{},f=r._currentNodeConfig||{},y=typeof f.agent=="string"?f.agent.trim():"",b=!y||y===i.name?f.model:null,k=j({config:c,options:n,strategyName:i.name,envModel:process.env.MODEL,nodeConfigModel:b}),A={...n,model:k,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:c},u=e,I=A.skills||[];if(I.length>0&&!n.skipPromptFragments){let p=n.connectedIntegrations;if(!p){let a=process.env.WORKFLOW_CONNECTED_INTEGRATIONS;if(typeof a=="string"&&a.trim()!==""){p={};for(let l of a.split(",").map(g=>g.trim()).filter(Boolean))p[l]=!0}}let S=a=>{let l=a&&a.requiresIntegration;return!l||!p?!0:(Array.isArray(l)?l:[l]).some(E=>p[E]===!0)},o=I.map(a=>{let l=R(a);if(!S(l))return null;let g=l?.promptFragment;return typeof g=="function"?g():g}).filter(Boolean);o.length>0&&(u+=`
|
|
2
2
|
|
|
3
3
|
${o.join(`
|
|
4
4
|
|
|
5
|
-
`)}`)}let
|
|
6
|
-
fields: ${
|
|
5
|
+
`)}`)}let d=r._currentNodeConfig?.stores;if(Array.isArray(d)&&d.length>0&&typeof d[0]=="object"){let p=d.length<=8,S=d.map(o=>{let a=o?.id??o?.storeId??"",l=(o?.name??"").toString().trim()||a,g=o?.type?` \xB7 ${o.type}`:"",E=(o?.description||"").toString().replace(/\s+/g," ").trim(),$=`- ${l} \xB7 ${E||"(no description)"}${g} (id: ${a})`;if(p&&o?.schema&&typeof o.schema=="object"){let _=o.schema.properties&&typeof o.schema.properties=="object"?Object.keys(o.schema.properties):Object.keys(o.schema);_.length&&($+=`
|
|
6
|
+
fields: ${_.join(", ")}`)}return $});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
|
+
${S.join(`
|
|
10
|
+
`)}`}let O=r._currentNodeConfig?.extraPromptInstructions?.trim();return O&&(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
|
-
`),
|
|
16
|
+
${O}
|
|
17
|
+
`),w.debug(`[workflow] prompt length: ${u.length} chars`),i.invoke(u,A)}export{L as getAgentStrategy,U as invokeAgent,H as listStrategies,F as registerStrategy,j as resolveInvocationModel};
|