@zibby/core 0.5.9 → 0.5.11

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/LICENSE CHANGED
@@ -1,21 +1,5 @@
1
- MIT License
1
+ Copyright (c) 2026 Zentron AI / Zibby. All rights reserved.
2
2
 
3
- Copyright (c) 2026 Zibby
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
3
+ Proprietary and confidential. Unauthorized copying, distribution, or use of
4
+ this software, in whole or in part, via any medium, is strictly prohibited
5
+ without the express prior written permission of Zentron AI / Zibby.
package/dist/index.js CHANGED
@@ -132,7 +132,7 @@ ${JSON.stringify(a,null,2)}
132
132
  ${"=".repeat(80)}`),console.log(`\u{1F3AF} SINGLE NODE EXECUTION: ${e}`),console.log(`\u{1F4C1} Session: ${i.split("/").pop()}${r.sessionPath?" (reusing)":""}`),console.log(`${"=".repeat(80)}
133
133
  `);let m=await Io.loadContext(r.specPath||"",o,r.contextConfig||{}),d=new Po({...r,sessionPath:i,sessionTimestamp:c,context:m}),g=await new Co(n).execute(this,d);return console.log(`
134
134
  ${"=".repeat(80)}`),console.log(`\u2705 Node ${e} completed`),console.log(`${"=".repeat(80)}
135
- `),{success:!0,output:g.output,outputPath:r.outputPath,state:g}}calculateOutputPath(e){let{specs:t,generated:r}=this.paths;if(!e)return`${r}/generated-test.spec.js`;let n=e.replace(new RegExp(`^${t}/`),"").replace(/\.[^.]+$/,".spec.js");return`${r}/${n}`.replace(/\/+/g,"/")}};function Ro(s,e={}){let t=new we(e);return t.buildGraph=function(){let r=new Oo;return s(r),r},e.onComplete&&(t.onComplete=e.onComplete),t}import{WorkflowGraph as yp,resolveWorkflowSession as bp,generateWorkflowSessionId as Sp,clearInheritedSessionEnvForFreshRun as wp,shouldTrustInheritedSessionEnv as xp,readPinnedSessionPathFromEnv as _p,syncProcessEnvToSession as Ep}from"@zibby/agent-workflow";import{writeFileSync as xr,existsSync as Lo,mkdirSync as Mo}from"node:fs";import{join as vt}from"node:path";var Tt=class s{static saveTitle(e,t){let r=e.state.sessionPath;if(!r)return;let n=s._findInState(e.state,"title")||s._findInState(e.state,"result");if(!(!n||typeof n!="string"))try{let o=vt(r,"title.txt");xr(o,n,"utf-8"),p.info(`Saved title to session: "${n}"`)}catch(o){console.warn("\u26A0\uFE0F Could not save title file:",o.message)}}static _findInState(e,t){for(let[,r]of Object.entries(e))if(r&&typeof r=="object"&&r[t]!==void 0)return r[t]}static async saveExecutionData(e){let t=e.state.sessionPath;if(t)for(let[r,n]of Object.entries(e.state)){if(!n||typeof n!="object")continue;let o=Array.isArray(n.actions)&&n.actions.length>0,i=typeof n.scriptPath=="string"&&n.scriptPath.trim().length>0;if(!(!o&&!i))try{let c=vt(t,r);Lo(c)||Mo(c,{recursive:!0});let a=vt(c,"result.json");xr(a,JSON.stringify(n,null,2),"utf-8"),p.info(`Saved execution data to ${r} folder`),await this.onNodeSaved(c,n)}catch(c){console.warn(`\u26A0\uFE0F Could not save execution data for ${r}:`,c.message)}}}static async onNodeSaved(e,t){}static logResult(e,t){let r=Object.entries(e.state).filter(([,i])=>i&&typeof i=="object"&&i.success!==void 0),n=r.length>0&&r.every(([,i])=>i.success),o=r.some(([,i])=>i.success===!1);if(n)p.info("Workflow completed successfully."),t&&p.info(`Output: ${t}`);else if(o){let i=r.filter(([,c])=>!c.success).map(([c])=>c);p.info(`Workflow completed with failures in: ${i.join(", ")}`),t&&p.info(`Output: ${t}`)}return n}static handle(e,t,r){return this.saveTitle(e,t),this.saveExecutionData(e),this.logResult(e,r)}};import{z as Ap}from"zod/v3";import{AgentStrategy as Do}from"@zibby/agent-workflow";var _r=[new ce,new re,new oe,new se,new ae];function Er(s={}){let{state:e={},preferredAgent:t=null}=s,r=t||e.agentType||process.env.AGENT_TYPE;if(!r)throw new Error("No agent specified. Set agent.claude, agent.cursor, agent.codex, or agent.gemini in .zibby.config.js");p.debug(`Agent selection: requested=${r}`);let n=_r.find(o=>o.getName()===r);if(!n)throw new Error(`Unknown agent '${r}'. Available: ${_r.map(o=>o.getName()).join(", ")}`);if(p.debug(`Checking if ${r} can handle this environment...`),!n.canHandle(s)){let i={assistant:"Run `zibby login` to authenticate",claude:"Set ANTHROPIC_API_KEY in .env",cursor:"Install cursor-agent CLI or set CURSOR_API_KEY",codex:"Install codex CLI (npm i -g @openai/codex) and set OPENAI_API_KEY in .env",gemini:"Install gemini CLI (npm i -g @google/gemini-cli) and set GEMINI_API_KEY in .env"}[r]||"Check your environment configuration";throw new Error(`Agent '${r}' is not available. ${i}`)}return p.debug(`Using agent: ${n.getName()}`),n}async function Uo(s,e={},t={}){try{await import("@zibby/skills")}catch{}let r=Er(e),n=e.state?.config||t.config||{},o=n.models||{},i=t.nodeName&&o[t.nodeName]||null,c=o.default||null,a=r.name,l=n.agent?.[a]?.model||null,u=i||c||l||t.model||null,m={...t,model:u,workspace:e.state?.workspace||t.workspace,schema:t.schema||e.schema,images:t.images||e.images||[],skills:t.skills||e.skills||[],config:n},d=m.skills||[],f=s;if(d.length>0&&!t.skipPromptFragments){let{getSkill:y}=await import("@zibby/agent-workflow"),h=d.map(b=>{let w=y(b)?.promptFragment;return typeof w=="function"?w():w}).filter(Boolean);h.length>0&&(f+=`
135
+ `),{success:!0,output:g.output,outputPath:r.outputPath,state:g}}calculateOutputPath(e){let{specs:t,generated:r}=this.paths;if(!e)return`${r}/generated-test.spec.js`;let n=e.replace(new RegExp(`^${t}/`),"").replace(/\.[^.]+$/,".spec.js");return`${r}/${n}`.replace(/\/+/g,"/")}};function Ro(s,e={}){let t=new we(e);return t.buildGraph=function(){let r=new Oo;return s(r),r},e.onComplete&&(t.onComplete=e.onComplete),t}import{WorkflowGraph as yp,resolveWorkflowSession as bp,generateWorkflowSessionId as Sp,clearInheritedSessionEnvForFreshRun as wp,shouldTrustInheritedSessionEnv as xp,readPinnedSessionPathFromEnv as _p,syncProcessEnvToSession as Ep}from"@zibby/agent-workflow";import{writeFileSync as xr,existsSync as Lo,mkdirSync as Mo}from"node:fs";import{join as vt}from"node:path";var Tt=class s{static saveTitle(e,t){let r=e.state.sessionPath;if(!r)return;let n=s._findInState(e.state,"title")||s._findInState(e.state,"result");if(!(!n||typeof n!="string"))try{let o=vt(r,"title.txt");xr(o,n,"utf-8"),p.info(`Saved title to session: "${n}"`)}catch(o){console.warn("\u26A0\uFE0F Could not save title file:",o.message)}}static _findInState(e,t){for(let[,r]of Object.entries(e))if(r&&typeof r=="object"&&r[t]!==void 0)return r[t]}static async saveExecutionData(e){let t=e.state.sessionPath;if(t)for(let[r,n]of Object.entries(e.state)){if(!n||typeof n!="object")continue;let o=Array.isArray(n.actions)&&n.actions.length>0,i=typeof n.scriptPath=="string"&&n.scriptPath.trim().length>0;if(!(!o&&!i))try{let c=vt(t,r);Lo(c)||Mo(c,{recursive:!0});let a=vt(c,"result.json");xr(a,JSON.stringify(n,null,2),"utf-8"),p.info(`Saved execution data to ${r} folder`),await this.onNodeSaved(c,n)}catch(c){console.warn(`\u26A0\uFE0F Could not save execution data for ${r}:`,c.message)}}}static async onNodeSaved(e,t){}static logResult(e,t){let r=Object.entries(e.state).filter(([,i])=>i&&typeof i=="object"&&i.success!==void 0),n=r.length>0&&r.every(([,i])=>i.success),o=r.some(([,i])=>i.success===!1);if(n)p.info("Workflow completed successfully."),t&&p.info(`Output: ${t}`);else if(o){let i=r.filter(([,c])=>!c.success).map(([c])=>c);p.info(`Workflow completed with failures in: ${i.join(", ")}`),t&&p.info(`Output: ${t}`)}return n}static handle(e,t,r){return this.saveTitle(e,t),this.saveExecutionData(e),this.logResult(e,r)}};import{z as Ap}from"zod/v3";import{AgentStrategy as Do}from"@zibby/agent-workflow";var _r=[new ce,new re,new oe,new se,new ae];function Er(s={}){let{state:e={},preferredAgent:t=null}=s,r=t||e.agentType||process.env.AGENT_TYPE;if(!r)throw new Error("No agent specified. Set agent.claude, agent.cursor, agent.codex, or agent.gemini in .zibby.config.js");p.debug(`Agent selection: requested=${r}`);let n=_r.find(o=>o.getName()===r);if(!n)throw new Error(`Unknown agent '${r}'. Available: ${_r.map(o=>o.getName()).join(", ")}`);if(p.debug(`Checking if ${r} can handle this environment...`),!n.canHandle(s)){let i={assistant:"Run `zibby login` to authenticate",claude:"Set ANTHROPIC_API_KEY in .env",cursor:"Install cursor-agent CLI or set CURSOR_API_KEY",codex:"Install codex CLI (npm i -g @openai/codex) and set OPENAI_API_KEY in .env",gemini:"Install gemini CLI (npm i -g @google/gemini-cli) and set GEMINI_API_KEY in .env"}[r]||"Check your environment configuration";throw new Error(`Agent '${r}' is not available. ${i}`)}return p.debug(`Using agent: ${n.getName()}`),n}async function Uo(s,e={},t={}){try{await import("@zibby/skills")}catch{}try{await import("@zibby/skills-internal")}catch{}let r=Er(e),n=e.state?.config||t.config||{},o=n.models||{},i=t.nodeName&&o[t.nodeName]||null,c=o.default||null,a=r.name,l=n.agent?.[a]?.model||null,u=i||c||l||t.model||null,m={...t,model:u,workspace:e.state?.workspace||t.workspace,schema:t.schema||e.schema,images:t.images||e.images||[],skills:t.skills||e.skills||[],config:n},d=m.skills||[],f=s;if(d.length>0&&!t.skipPromptFragments){let{getSkill:y}=await import("@zibby/agent-workflow"),h=d.map(b=>{let w=y(b)?.promptFragment;return typeof w=="function"?w():w}).filter(Boolean);h.length>0&&(f+=`
136
136
 
137
137
  ${h.join(`
138
138
 
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zibby/core",
3
- "version": "0.5.9",
3
+ "version": "0.5.11",
4
4
  "description": "Core test automation engine with multi-agent and multi-MCP support",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -46,7 +46,7 @@
46
46
  "mcp"
47
47
  ],
48
48
  "author": "Zibby",
49
- "license": "MIT",
49
+ "license": "UNLICENSED",
50
50
  "homepage": "https://zibby.dev",
51
51
  "repository": {
52
52
  "type": "git",
@@ -99,7 +99,7 @@ ${f.slice(0,1e3)}`),R=fo(f)),!R)throw T||(l.error("[Gemini] Failed to extract va
99
99
  \u{1F4D6} get_skill_context("${d}") \u2192 ${y.length} chars (fragment: ${h.length} chars)`),console.log(` tools: [${m.join(", ")}]`),console.log(` fragment preview: ${h.slice(0,200).replace(/\n/g,"\\n")}\u2026
100
100
  `)),y}let a=r?.get(e.name)||null;if(!a)return`Unknown tool: ${e.name}`;let c=$e(a.skillId);if(!c)return`Skill "${a.skillId}" not found for tool "${e.name}"`;if(a.mode==="handler")try{return c.handleToolCall(e.name,e.args,t)}catch(d){return`Error in ${e.name}: ${d.message}`}if(a.mode==="mcp")try{if(!this.#o.isRunning(c.serverName)){let u=c.resolve(o);if(!u)return`Skill "${a.skillId}" is not available (cannot start server)`;await this.#o.ensureServer(c.serverName,u)}let d=await this.#o.callTool(c.serverName,e.name,e.args);return d.text||(d.isError?"Tool call failed":"Done")}catch(d){return`MCP error (${c.serverName}): ${d.message}`}return`Skill "${a.skillId}" owns tool "${e.name}" but has no execution mode`}async#a(e,t,n){return this.#t.fetchStreamingCompletion(e,t,{...n,onBudget:({beforeBytes:o,meta:r})=>{se()&&console.log(`payload bytes (stream) before=${o} after=${r.bytes} trimmed=${r.trimmed} messages=${r.messageCount}`)}})}async#s(e,t,n){return this.#t.fetchCompletion(e,t,{...n,onBudget:({beforeBytes:o,meta:r})=>{se()&&console.log(`payload bytes before=${o} after=${r.bytes} trimmed=${r.trimmed} messages=${r.messageCount}`)}})}async#c(e,t,n,o){let{zodToJson:r}=await Promise.resolve().then(()=>(fe(),st)),i=typeof o.schema?.parse=="function",a=i?r(o.schema,{}):o.schema;delete a.$schema,ie(a);let c={model:e,messages:t,stream:!1,response_format:{type:"json_schema",json_schema:{name:"extract",schema:a,strict:!0}}},d=await this.#s(c,n,o),u=this.#e.getTextContent(d),h=JSON.parse(u),m=i?o.schema.parse(h):h;return{raw:u,structured:m}}#u(e={}){let t=e?.config?.agent?.assistant?.payloadCompaction||{};return{maxBytes:Number(t.maxBytes||e.maxPayloadBytes||yt.maxBytes),systemMaxChars:Number(t.systemMaxChars||yt.systemMaxChars)}}#d(e={}){let t=e?.config?.agent?.assistant?.toolPolicy||{};return{allowTools:Ce(t.allowTools||e.allowTools),denyTools:Ce(t.denyTools||e.denyTools),denyPrefixes:Co(t.denyPrefixes||e.denyToolPrefixes),includeSkills:Ce(t.includeSkills||e.includeSkills),excludeSkills:Ce(t.excludeSkills||e.excludeSkills),disableSkillContextTool:!!(t.disableSkillContextTool||e.disableSkillContextTool)}}#f(e,t){let n=t?.includeSkills||new Set,o=t?.excludeSkills||new Set;return n.size===0&&o.size===0?e:e.filter(r=>!(n.size>0&&!n.has(r)||o.has(r)))}#n(e,t){let n=String(e||"").trim();if(!n)return!1;let o=t?.allowTools;if(o&&o.size>0&&!o.has(n))return!1;let r=t?.denyTools;return!(r&&r.has(n)||(t?.denyPrefixes||[]).some(a=>n.startsWith(a)))}#p(e){let t=new Map,n=[];for(let o of e){let r=$e(o);if(!r?.tools?.length)continue;let i=typeof r.handleToolCall=="function"?"handler":r.serverName&&typeof r.resolve=="function"?"mcp":null;if(i)for(let a of r.tools){let c=String(a?.name||"").trim();if(c){if(t.has(c)){n.push({tool:c,winner:t.get(c).skillId,skipped:o});continue}t.set(c,{skillId:o,mode:i})}}}if(n.length>0&&se()){let o=n.slice(0,5).map(r=>`${r.tool}:${r.winner}>${r.skipped}`).join(", ");console.log(`tool registry collisions: ${o}${n.length>5?" ...":""}`)}return t}async#m(e,t,n,o){console.log(`
101
101
  \u25C6 Model: ${t} | proxy: ${n} | token: ${o||"none"}
102
- `);let r=(await import("chalk")).default;console.log(r.bold("Prompt sent to LLM:")),console.log(r.dim("\u2500".repeat(60)));let i=!1;for(let a of e)if(a.role==="system")console.log(r.dim(`[System] ${a.content||""}`));else{i||(console.log(r.dim("\u2500\u2500\u2500 chat history \u2500\u2500\u2500")),i=!0);let c=a.role==="user"?"Human":"AI",d=a.content?.length>200?`${a.content.slice(0,200)}...`:a.content||"";console.log(r.dim(`[${c}] ${d}`))}console.log(r.dim("\u2500".repeat(60)))}};import{AgentStrategy as Gr}from"@zibby/agent-workflow";var _t=[new ke,new be,new Oe,new Ee,new Ae];function ko(s={}){let{state:e={},preferredAgent:t=null}=s,n=t||e.agentType||process.env.AGENT_TYPE;if(!n)throw new Error("No agent specified. Set agent.claude, agent.cursor, agent.codex, or agent.gemini in .zibby.config.js");l.debug(`Agent selection: requested=${n}`);let o=_t.find(r=>r.getName()===n);if(!o)throw new Error(`Unknown agent '${n}'. Available: ${_t.map(r=>r.getName()).join(", ")}`);if(l.debug(`Checking if ${n} can handle this environment...`),!o.canHandle(s)){let i={assistant:"Run `zibby login` to authenticate",claude:"Set ANTHROPIC_API_KEY in .env",cursor:"Install cursor-agent CLI or set CURSOR_API_KEY",codex:"Install codex CLI (npm i -g @openai/codex) and set OPENAI_API_KEY in .env",gemini:"Install gemini CLI (npm i -g @google/gemini-cli) and set GEMINI_API_KEY in .env"}[n]||"Check your environment configuration";throw new Error(`Agent '${n}' is not available. ${i}`)}return l.debug(`Using agent: ${o.getName()}`),o}async function Kr(s,e={},t={}){try{await import("@zibby/skills")}catch{}let n=ko(e),o=e.state?.config||t.config||{},r=o.models||{},i=t.nodeName&&r[t.nodeName]||null,a=r.default||null,c=n.name,d=o.agent?.[c]?.model||null,u=i||a||d||t.model||null,h={...t,model:u,workspace:e.state?.workspace||t.workspace,schema:t.schema||e.schema,images:t.images||e.images||[],skills:t.skills||e.skills||[],config:o},m=h.skills||[],y=s;if(m.length>0&&!t.skipPromptFragments){let{getSkill:D}=await import("@zibby/agent-workflow"),_=m.map(b=>{let A=D(b)?.promptFragment;return typeof A=="function"?A():A}).filter(Boolean);_.length>0&&(y+=`
102
+ `);let r=(await import("chalk")).default;console.log(r.bold("Prompt sent to LLM:")),console.log(r.dim("\u2500".repeat(60)));let i=!1;for(let a of e)if(a.role==="system")console.log(r.dim(`[System] ${a.content||""}`));else{i||(console.log(r.dim("\u2500\u2500\u2500 chat history \u2500\u2500\u2500")),i=!0);let c=a.role==="user"?"Human":"AI",d=a.content?.length>200?`${a.content.slice(0,200)}...`:a.content||"";console.log(r.dim(`[${c}] ${d}`))}console.log(r.dim("\u2500".repeat(60)))}};import{AgentStrategy as Gr}from"@zibby/agent-workflow";var _t=[new ke,new be,new Oe,new Ee,new Ae];function ko(s={}){let{state:e={},preferredAgent:t=null}=s,n=t||e.agentType||process.env.AGENT_TYPE;if(!n)throw new Error("No agent specified. Set agent.claude, agent.cursor, agent.codex, or agent.gemini in .zibby.config.js");l.debug(`Agent selection: requested=${n}`);let o=_t.find(r=>r.getName()===n);if(!o)throw new Error(`Unknown agent '${n}'. Available: ${_t.map(r=>r.getName()).join(", ")}`);if(l.debug(`Checking if ${n} can handle this environment...`),!o.canHandle(s)){let i={assistant:"Run `zibby login` to authenticate",claude:"Set ANTHROPIC_API_KEY in .env",cursor:"Install cursor-agent CLI or set CURSOR_API_KEY",codex:"Install codex CLI (npm i -g @openai/codex) and set OPENAI_API_KEY in .env",gemini:"Install gemini CLI (npm i -g @google/gemini-cli) and set GEMINI_API_KEY in .env"}[n]||"Check your environment configuration";throw new Error(`Agent '${n}' is not available. ${i}`)}return l.debug(`Using agent: ${o.getName()}`),o}async function Kr(s,e={},t={}){try{await import("@zibby/skills")}catch{}try{await import("@zibby/skills-internal")}catch{}let n=ko(e),o=e.state?.config||t.config||{},r=o.models||{},i=t.nodeName&&r[t.nodeName]||null,a=r.default||null,c=n.name,d=o.agent?.[c]?.model||null,u=i||a||d||t.model||null,h={...t,model:u,workspace:e.state?.workspace||t.workspace,schema:t.schema||e.schema,images:t.images||e.images||[],skills:t.skills||e.skills||[],config:o},m=h.skills||[],y=s;if(m.length>0&&!t.skipPromptFragments){let{getSkill:D}=await import("@zibby/agent-workflow"),_=m.map(b=>{let A=D(b)?.promptFragment;return typeof A=="function"?A():A}).filter(Boolean);_.length>0&&(y+=`
103
103
 
104
104
  ${_.join(`
105
105
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zibby/core",
3
- "version": "0.5.9",
3
+ "version": "0.5.11",
4
4
  "description": "Core test automation engine with multi-agent and multi-MCP support",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -46,7 +46,7 @@
46
46
  "mcp"
47
47
  ],
48
48
  "author": "Zibby",
49
- "license": "MIT",
49
+ "license": "UNLICENSED",
50
50
  "homepage": "https://zibby.dev",
51
51
  "repository": {
52
52
  "type": "git",