@zibby/agent-workflow 0.4.36 → 0.4.37
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 +13 -13
- package/dist/constants.d.ts +8 -38
- package/dist/constants.js +1 -1
- package/dist/graph-compiler.js +18 -18
- package/dist/graph.js +20 -20
- package/dist/index.d.ts +2 -2
- package/dist/index.js +27 -27
- package/dist/node-registry.js +8 -8
- package/dist/node.js +16 -16
- package/dist/skill-registry.d.ts +18 -0
- package/dist/skill-registry.js +1 -1
- package/dist/strategy-registry.js +8 -8
- package/dist/tool-resolver.js +1 -1
- package/package.json +1 -1
package/dist/skill-registry.d.ts
CHANGED
|
@@ -11,6 +11,13 @@
|
|
|
11
11
|
* @param {string} [skill.cursorKey] - Override key for ~/.cursor/mcp.json
|
|
12
12
|
* @param {Function} [skill.promptFragment] - () => string | string injected into agent prompt
|
|
13
13
|
* @param {Function} [skill.middleware] - async () => middlewareFn | null
|
|
14
|
+
* @param {Object} [opts]
|
|
15
|
+
* @param {string} [opts.source] - Provenance (package name) registering this skill.
|
|
16
|
+
* The Phase-3 loader tags each package's skills with
|
|
17
|
+
* its name; first-party callers omit it (trusted).
|
|
18
|
+
* @param {boolean} [opts.override] - Explicit escape hatch: replace an existing id even
|
|
19
|
+
* across sources. First-party / intentional only.
|
|
20
|
+
* @throws if a DIFFERENT source tries to overwrite an already-registered id (collision).
|
|
14
21
|
*/
|
|
15
22
|
export function registerSkill(skill: {
|
|
16
23
|
id: string;
|
|
@@ -23,11 +30,22 @@ export function registerSkill(skill: {
|
|
|
23
30
|
cursorKey?: string;
|
|
24
31
|
promptFragment?: Function;
|
|
25
32
|
middleware?: Function;
|
|
33
|
+
}, opts?: {
|
|
34
|
+
source?: string;
|
|
35
|
+
override?: boolean;
|
|
26
36
|
}): void;
|
|
27
37
|
/** @returns {object|null} */
|
|
28
38
|
export function getSkill(id: any): object | null;
|
|
29
39
|
/** @returns {boolean} */
|
|
30
40
|
export function hasSkill(id: any): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* The provenance (package name) that registered an id, or `null` for a
|
|
43
|
+
* first-party (untagged) registration / an unknown id. Lets the runtime decide
|
|
44
|
+
* secret-scoping: a skill with a non-null third-party source must NOT receive
|
|
45
|
+
* ambient tenant tokens / the egress JWT (Phase-3 secret-scoping prereq).
|
|
46
|
+
* @returns {string|null}
|
|
47
|
+
*/
|
|
48
|
+
export function getSkillSource(id: any): string | null;
|
|
31
49
|
/** @returns {Map<string, object>} shallow copy */
|
|
32
50
|
export function getAllSkills(): Map<string, object>;
|
|
33
51
|
/** @returns {string[]} */
|
package/dist/skill-registry.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var n=Symbol.for("@zibby/agent-workflow.skills"),s=Symbol.for("@zibby/agent-workflow.skills.sources");globalThis[n]||(globalThis[n]=new Map);globalThis[s]||(globalThis[s]=new Map);var r=globalThis[n],i=globalThis[s];function g(e,a={}){if(!e||typeof e.id!="string")throw new Error("Skill definition must include a string id");let{source:o,override:c=!1}=a,t=e.id;if(r.has(t)&&!c){let l=i.get(t);if(!(l===o)){let f=l||"first-party",u=o||"first-party";throw new Error(`Skill id collision: "${t}" is already registered by ${f}; ${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).`)}}r.set(t,Object.freeze({...e})),o===void 0?i.delete(t):i.set(t,o)}function p(e){return r.get(e)||null}function b(e){return r.has(e)}function y(e){return i.get(e)||null}function S(){return new Map(r)}function w(){return Array.from(r.keys())}function h(){r.clear(),i.clear()}export{h as clearSkills,S as getAllSkills,p as getSkill,y as getSkillSource,b as hasSkill,w as listSkillIds,g as registerSkill};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var
|
|
1
|
+
var A=()=>{},P={debug:A,info:A,warn:(...e)=>console.warn("[workflow]",...e),error:(...e)=>console.error("[workflow]",...e)},f={impl:P};var m={debug:(...e)=>f.impl.debug?.(...e),info:(...e)=>f.impl.info?.(...e),warn:(...e)=>f.impl.warn?.(...e),error:(...e)=>f.impl.error?.(...e)};var u=Symbol.for("@zibby/agent-workflow.skills"),h=Symbol.for("@zibby/agent-workflow.skills.sources");globalThis[u]||(globalThis[u]=new Map);globalThis[h]||(globalThis[h]=new Map);var C=globalThis[u],G=globalThis[h];function $(e){return C.get(e)||null}var w=Symbol.for("@zibby/agent-workflow.strategies");globalThis[w]||(globalThis[w]=[]);var l=globalThis[w];function q(e){if(!e||typeof e.getName!="function"||typeof e.invoke!="function")throw new Error("strategy must implement getName() and invoke() (AgentStrategy shape)");let r=l.findIndex(n=>n.getName()===e.getName());r>=0?l[r]=e:l.push(e)}function D(){return l.map(e=>e.getName())}function L(e={}){let{state:r={},preferredAgent:n=null}=e,o=n||r.agentType||process.env.AGENT_TYPE;if(!o){let i=l.map(s=>s.getName()).join(", ")||"none registered";throw new Error(`No agent specified. Set agentType in state or AGENT_TYPE env var. Available: ${i}`)}m.debug(`[workflow] agent selection: requested=${o}`);let a=l.find(i=>i.getName()===o);if(!a){let i=l.map(s=>s.getName()).join(", ")||"none registered";throw new Error(`Unknown agent '${o}'. Available: ${i}`)}if(!a.canHandle(e))throw new Error(`Agent '${o}' is not available in this environment. Check credentials/environment.`);return m.debug(`[workflow] using agent: ${a.getName()}`),a}async function F(e,r={},n={}){let o=r.state&&typeof r.state.getAll=="function"?r.state.getAll():r.state||{},a={...r,state:o},i=L(a),s=o.config||n.config||{},b=s.models||{},v=n.nodeName&&b[n.nodeName]||null,I=b.default||null,O=s.agent?.[i.name]?.model||null,_=v||I||O||n.model||null,y={...n,model:_,workspace:o.workspace||n.workspace,schema:n.schema||r.schema,images:n.images||r.images||[],skills:n.skills||r.skills||[],plugins:n.plugins||r.plugins||[],config:s},c=e,k=y.skills||[];if(k.length>0&&!n.skipPromptFragments){let p=k.map(d=>{let t=$(d)?.promptFragment;return typeof t=="function"?t():t}).filter(Boolean);p.length>0&&(c+=`
|
|
2
2
|
|
|
3
|
-
${
|
|
3
|
+
${p.join(`
|
|
4
4
|
|
|
5
|
-
`)}`)}let g=
|
|
6
|
-
fields: ${N.join(", ")}`)}return
|
|
5
|
+
`)}`)}let g=o._currentNodeConfig?.stores;if(Array.isArray(g)&&g.length>0&&typeof g[0]=="object"){let p=g.length<=8,d=g.map(t=>{let E=t?.id??t?.storeId??"",x=(t?.name??"").toString().trim()||E,R=t?.type?` \xB7 ${t.type}`:"",j=(t?.description||"").toString().replace(/\s+/g," ").trim(),T=`- ${x} \xB7 ${j||"(no description)"}${R} (id: ${E})`;if(p&&t?.schema&&typeof t.schema=="object"){let N=t.schema.properties&&typeof t.schema.properties=="object"?Object.keys(t.schema.properties):Object.keys(t.schema);N.length&&(T+=`
|
|
6
|
+
fields: ${N.join(", ")}`)}return T});c+=`
|
|
7
7
|
|
|
8
8
|
AVAILABLE STORES (pick a store by its description and pass its NAME to the store tool):
|
|
9
|
-
${
|
|
10
|
-
`)}`}let
|
|
9
|
+
${d.join(`
|
|
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
|
-
${
|
|
17
|
-
`),
|
|
16
|
+
${S}
|
|
17
|
+
`),m.debug(`[workflow] prompt length: ${c.length} chars`),i.invoke(c,y)}export{L as getAgentStrategy,F as invokeAgent,D as listStrategies,q as registerStrategy};
|
package/dist/tool-resolver.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var a=Symbol.for("@zibby/agent-workflow.skills"),c=Symbol.for("@zibby/agent-workflow.skills.sources");globalThis[a]||(globalThis[a]=new Map);globalThis[c]||(globalThis[c]=new Map);var w=globalThis[a],k=globalThis[c];function p(e){return w.get(e)||null}var g=()=>{},y={debug:g,info:g,warn:(...e)=>console.warn("[workflow]",...e),error:(...e)=>console.error("[workflow]",...e)},s={impl:y};var d={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 b={};function T(e,t){if(Array.isArray(t))return m(t);let n=b[e];return!n||n.length===0?null:m(n)}function m(e){if(!Array.isArray(e)||e.length===0)return null;let t=[],n={},l=[];for(let i of e){let o=p(i);if(!o){d.warn(`[workflow] unknown skill "${i}" \u2014 skipping`);continue}l.push(i);for(let r of o.tools||[])t.push({name:r.name,description:r.description,input_schema:r.input_schema||{type:"object",properties:{}}});if(!n[o.serverName])if(typeof o.resolve=="function"){let r=o.resolve();r&&(n[o.serverName]={...r,toolPrefix:i})}else{let r={};for(let f of o.envKeys||[]){let u=process.env[f];u&&(r[f]=u)}n[o.serverName]={command:o.command,args:[...o.args||[]],env:r,toolPrefix:i}}}return l.length===0?null:{toolIds:l,claudeTools:t,mcpServers:n}}export{b as NODE_DEFAULT_TOOLS,m as getResolvedToolDefinitions,T as resolveNodeTools};
|