@must-b/must-b 1.2.2 → 1.2.3
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/BUILD.json +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -3
package/dist/BUILD.json
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -4010,7 +4010,7 @@ ${p}${f}`+m.repeat(u)+`${p}`,I}function c(u,g,h,p){return`${g}${p}`+h.repeat(u)+
|
|
|
4010
4010
|
\u2588\u2588\u2554\u2588\u2588\u2588\u2588\u2554\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D
|
|
4011
4011
|
\u2588\u2588\u2551\u255A\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2550\u2550\u2550\u2550\u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557
|
|
4012
4012
|
\u2588\u2588\u2551 \u255A\u2550\u255D \u2588\u2588\u2551\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D
|
|
4013
|
-
\u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D `;function tEe(){try{return"1.2.
|
|
4013
|
+
\u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D `;function tEe(){try{return"1.2.3"}catch{return"1.0.0"}}function iEe(){try{return"438347a"}catch{return""}}function TB(e,A=58){let t=e.replace(/\x1b\[[0-9;]*m/g,""),i=Math.max(0,Math.floor((A-t.length)/2));return" ".repeat(i)+e}function utA(e="\u2500",A=58){return Hs(" "+e.repeat(A))}function lD(e,A){let t=tEe(),i=iEe();console.log(EtA(eEe)),console.log(""),console.log(TB($le(Xle("Must-b"))+" "+BtA("v"+t))),console.log(TB(Hs("Professional AI Operating System"))),console.log(""),console.log(TB(EtA("\u26A1 Autonomous \xB7 Precise \xB7 Always On"))),console.log(TB(Hs("Vision")+Hs(" \xB7 ")+Hs("Voice")+Hs(" \xB7 ")+Hs("OS Control")+Hs(" \xB7 ")+Hs("Multi-Agent Hierarchy"))),console.log(""),console.log(utA()),console.log("");let a=[`Node ${process.version}`,`Mode: ${e.toUpperCase()}`,`PID ${process.pid}`,i?`#${i}`:null].filter(Boolean).join(Hs(" \xB7 "));console.log(TB(Hs(a))),e==="web"&&(console.log(""),console.log(TB(AEe("\u25B6 ")+BtA(`http://localhost:${A}`))),console.log(TB(Hs("Dashboard is live \u2014 open in your browser")))),console.log(""),console.log(utA()),console.log(TB(Hs("Built by Auto Step \xB7 https://must-b.com"))),console.log("")}var htA=require("events"),dtA=require("module"),ptA=he(require("path"),1),nEe={};function aEe(e){let A=e.toLowerCase();return A.includes("401")||A.includes("unauthorized")||A.includes("api key")||A.includes("invalid key")?"auth":A.includes("429")||A.includes("rate limit")||A.includes("too many requests")?"ratelimit":A.includes("econnrefused")||A.includes("enotfound")||A.includes("fetch failed")||A.includes("network")?"network":"unknown"}async function rEe(){try{let A=(0,dtA.createRequire)(nEe.url)("dotenv"),t=ptA.default.join(process.cwd(),".env");A.config({path:t,override:!0})}catch{}}function QtA(e){let A=["OPENROUTER_API_KEY","OPENAI_API_KEY","ANTHROPIC_API_KEY","OPENROUTER_API_KEY_2","OPENROUTER_API_KEY_3","OPENAI_API_KEY_2","ANTHROPIC_API_KEY_2"],t=process.env.OPENROUTER_API_KEY??process.env.OPENAI_API_KEY??process.env.ANTHROPIC_API_KEY??"";for(let i of A){let a=process.env[i];if(a&&a!==t&&a.length>8)return i.startsWith("OPENROUTER")||i.includes("OPENROUTER_API_KEY")?process.env.OPENROUTER_API_KEY=a:i.startsWith("OPENAI")?process.env.OPENAI_API_KEY=a:i.startsWith("ANTHROPIC")&&(process.env.ANTHROPIC_API_KEY=a),e.info(`Orchestrator: Rotated to backup API key (${i}).`),!0}return!1}function gtA(e){return Math.min(1e3*Math.pow(2,e-1),3e4)}var cC=class extends htA.EventEmitter{constructor(t,i,a){super();this.MAX_REVISIONS=3;this._busy=!1;this._errorSignatures=new Map;this.logger=t,this.planner=i,this.executor=a,this.logger.info("Orchestrator: Initialized.")}get busy(){return this._busy}async run(t){this._busy=!0,this.logger.info(`Orchestrator: Goal received \u2014 "${t}"`),this.emit("planStart",{goal:t,timestamp:Date.now()});let i=0,a=t;for(;i<=this.MAX_REVISIONS;)try{let r=await this.planner.plan(a);if(this.emit("planGenerated",{goal:a,steps:r,timestamp:Date.now()}),!r.length){this.emit("planFinish",{goal:t,status:"empty",timestamp:Date.now()});break}let n=[];for(let o of r){this.emit("stepStart",{step:o,timestamp:Date.now()});let c=await this.executor.executeStep(o);n.push({description:o.description,result:c}),this.emit("stepFinish",{step:o,status:"success",result:c,timestamp:Date.now()})}let s=await this.planner.synthesize(t,n);this.emit("finalAnswer",{goal:t,answer:s,timestamp:Date.now()}),this._errorSignatures.clear(),this.logger.info(`Orchestrator: Goal completed \u2014 "${t}"`),this.emit("planFinish",{goal:t,status:"completed",answer:s,steps:r.map(o=>({description:o.description,tool:o.tool})),timestamp:Date.now()});break}catch(r){i++;let n=r?.message??String(r),s=aEe(n);if(this.logger.warn(`Orchestrator: Step failed [${s}] (revision ${i}/${this.MAX_REVISIONS}) \u2014 ${n}`),this.emit("stepFinish",{status:"error",error:n,errorKind:s,timestamp:Date.now()}),i>this.MAX_REVISIONS){this.logger.error(`Orchestrator: Max revisions hit. Aborting goal "${t}".`),this.emit("planFinish",{goal:t,status:"failed",error:n,timestamp:Date.now()});break}if(s==="auth"){this.logger.info("Orchestrator: Auth error \u2014 reloading .env and attempting key rotation."),await rEe();let E=QtA(this.logger);this.emit("agentRepair",{action:E?"key_rotation":"reload_env",reason:n,timestamp:Date.now()});continue}if(s==="ratelimit"){let E=gtA(i);this.logger.info(`Orchestrator: Rate-limit \u2014 waiting ${E}ms, then trying key rotation.`),await new Promise(Q=>setTimeout(Q,E)),QtA(this.logger),this.emit("agentRepair",{action:"backoff+rotation",waitMs:E,reason:n,timestamp:Date.now()});continue}if(s==="network"){let E=gtA(i);this.logger.info(`Orchestrator: Network error \u2014 waiting ${E}ms then re-planning.`),this.emit("agentRepair",{action:"backoff",waitMs:E,reason:n,timestamp:Date.now()}),await new Promise(Q=>setTimeout(Q,E))}let o=n.slice(0,120),c=(this._errorSignatures.get(o)??0)+1;this._errorSignatures.set(o,c),c>=2?(this.logger.warn(`Orchestrator: Recurring error (\xD7${c}) \u2014 injecting auto-repair context.`),this.emit("agentRepair",{action:"auto_repair",errorSignature:o,occurrences:c,timestamp:Date.now()}),a=[`Auto-repair attempt for: "${t}"`,`Recurring error (\xD7${c}): ${n}`,"Diagnose the root cause, attempt a different approach or skip the failing step, and complete the original goal."].join(" \u2014 ")):a=`Revised: "${t}" \u2014 previous attempt failed: ${n}`}this._busy=!1}};var Uv=he(cD(),1);Uv.default.config({override:!0});var lC=class{constructor(A){this.logger=A,this.model=process.env.OPENROUTER_MODEL||"openai/gpt-3.5-turbo",this.baseUrl="https://openrouter.ai/api/v1"}async generateJson(A){let t=await this.chat(A,{jsonMode:!0});try{let i=t.replace(/```json\n|\n```/g,"").trim();return JSON.parse(i)}catch(i){throw this.logger.error(`Provider: Failed to parse JSON response: ${i.message}`),this.logger.debug(`Raw response: ${t}`),new Error("LLM failed to produce valid JSON")}}async chat(A,t={}){Uv.default.config({override:!0});let i=process.env.OPENROUTER_API_KEY||"";i||this.logger.warn("Provider: OPENROUTER_API_KEY is not set. LLM calls will fail."),this.logger.info(`Provider: Sending request to ${this.model}...`);try{let a={Authorization:`Bearer ${i}`,"Content-Type":"application/json","HTTP-Referer":"https://must-b.ai","X-Title":"Must-b Agent"},r={model:this.model,messages:A,temperature:.1};t.jsonMode&&(r.response_format={type:"json_object"});let n=await fetch(`${this.baseUrl}/chat/completions`,{method:"POST",headers:a,body:JSON.stringify(r)});if(!n.ok){let c=await n.text();throw new Error(`OpenRouter API Error: ${n.status} - ${c}`)}let o=(await n.json()).choices[0]?.message?.content;if(!o)throw new Error("Provider: Received empty response from LLM.");return o}catch(a){throw this.logger.error(`Provider: LLM Request Failed - ${a.message}`),a}}};var EC=class{constructor(A){this.logger=A,this.provider=new lC(A)}async plan(A){this.logger.info(`Planner: Generating plan for goal: "${A}"`);let i=[{role:"system",content:`You are the Planner for Must-b, an autonomous AI agent with full browser, filesystem, terminal, and memory capabilities.
|
|
4014
4014
|
Your job is to break down a high-level user Goal into a precise, executable sequence of steps.
|
|
4015
4015
|
|
|
4016
4016
|
Available Tools:
|
package/dist/index.js
CHANGED
|
@@ -4010,7 +4010,7 @@ ${p}${f}`+m.repeat(u)+`${p}`,I}function c(u,g,h,p){return`${g}${p}`+h.repeat(u)+
|
|
|
4010
4010
|
\u2588\u2588\u2554\u2588\u2588\u2588\u2588\u2554\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D
|
|
4011
4011
|
\u2588\u2588\u2551\u255A\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2550\u2550\u2550\u2550\u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557
|
|
4012
4012
|
\u2588\u2588\u2551 \u255A\u2550\u255D \u2588\u2588\u2551\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D
|
|
4013
|
-
\u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D `;function tEe(){try{return"1.2.
|
|
4013
|
+
\u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D `;function tEe(){try{return"1.2.3"}catch{return"1.0.0"}}function iEe(){try{return"438347a"}catch{return""}}function TB(e,A=58){let t=e.replace(/\x1b\[[0-9;]*m/g,""),i=Math.max(0,Math.floor((A-t.length)/2));return" ".repeat(i)+e}function utA(e="\u2500",A=58){return Hs(" "+e.repeat(A))}function lD(e,A){let t=tEe(),i=iEe();console.log(EtA(eEe)),console.log(""),console.log(TB($le(Xle("Must-b"))+" "+BtA("v"+t))),console.log(TB(Hs("Professional AI Operating System"))),console.log(""),console.log(TB(EtA("\u26A1 Autonomous \xB7 Precise \xB7 Always On"))),console.log(TB(Hs("Vision")+Hs(" \xB7 ")+Hs("Voice")+Hs(" \xB7 ")+Hs("OS Control")+Hs(" \xB7 ")+Hs("Multi-Agent Hierarchy"))),console.log(""),console.log(utA()),console.log("");let a=[`Node ${process.version}`,`Mode: ${e.toUpperCase()}`,`PID ${process.pid}`,i?`#${i}`:null].filter(Boolean).join(Hs(" \xB7 "));console.log(TB(Hs(a))),e==="web"&&(console.log(""),console.log(TB(AEe("\u25B6 ")+BtA(`http://localhost:${A}`))),console.log(TB(Hs("Dashboard is live \u2014 open in your browser")))),console.log(""),console.log(utA()),console.log(TB(Hs("Built by Auto Step \xB7 https://must-b.com"))),console.log("")}var htA=require("events"),dtA=require("module"),ptA=he(require("path"),1),nEe={};function aEe(e){let A=e.toLowerCase();return A.includes("401")||A.includes("unauthorized")||A.includes("api key")||A.includes("invalid key")?"auth":A.includes("429")||A.includes("rate limit")||A.includes("too many requests")?"ratelimit":A.includes("econnrefused")||A.includes("enotfound")||A.includes("fetch failed")||A.includes("network")?"network":"unknown"}async function rEe(){try{let A=(0,dtA.createRequire)(nEe.url)("dotenv"),t=ptA.default.join(process.cwd(),".env");A.config({path:t,override:!0})}catch{}}function QtA(e){let A=["OPENROUTER_API_KEY","OPENAI_API_KEY","ANTHROPIC_API_KEY","OPENROUTER_API_KEY_2","OPENROUTER_API_KEY_3","OPENAI_API_KEY_2","ANTHROPIC_API_KEY_2"],t=process.env.OPENROUTER_API_KEY??process.env.OPENAI_API_KEY??process.env.ANTHROPIC_API_KEY??"";for(let i of A){let a=process.env[i];if(a&&a!==t&&a.length>8)return i.startsWith("OPENROUTER")||i.includes("OPENROUTER_API_KEY")?process.env.OPENROUTER_API_KEY=a:i.startsWith("OPENAI")?process.env.OPENAI_API_KEY=a:i.startsWith("ANTHROPIC")&&(process.env.ANTHROPIC_API_KEY=a),e.info(`Orchestrator: Rotated to backup API key (${i}).`),!0}return!1}function gtA(e){return Math.min(1e3*Math.pow(2,e-1),3e4)}var cC=class extends htA.EventEmitter{constructor(t,i,a){super();this.MAX_REVISIONS=3;this._busy=!1;this._errorSignatures=new Map;this.logger=t,this.planner=i,this.executor=a,this.logger.info("Orchestrator: Initialized.")}get busy(){return this._busy}async run(t){this._busy=!0,this.logger.info(`Orchestrator: Goal received \u2014 "${t}"`),this.emit("planStart",{goal:t,timestamp:Date.now()});let i=0,a=t;for(;i<=this.MAX_REVISIONS;)try{let r=await this.planner.plan(a);if(this.emit("planGenerated",{goal:a,steps:r,timestamp:Date.now()}),!r.length){this.emit("planFinish",{goal:t,status:"empty",timestamp:Date.now()});break}let n=[];for(let o of r){this.emit("stepStart",{step:o,timestamp:Date.now()});let c=await this.executor.executeStep(o);n.push({description:o.description,result:c}),this.emit("stepFinish",{step:o,status:"success",result:c,timestamp:Date.now()})}let s=await this.planner.synthesize(t,n);this.emit("finalAnswer",{goal:t,answer:s,timestamp:Date.now()}),this._errorSignatures.clear(),this.logger.info(`Orchestrator: Goal completed \u2014 "${t}"`),this.emit("planFinish",{goal:t,status:"completed",answer:s,steps:r.map(o=>({description:o.description,tool:o.tool})),timestamp:Date.now()});break}catch(r){i++;let n=r?.message??String(r),s=aEe(n);if(this.logger.warn(`Orchestrator: Step failed [${s}] (revision ${i}/${this.MAX_REVISIONS}) \u2014 ${n}`),this.emit("stepFinish",{status:"error",error:n,errorKind:s,timestamp:Date.now()}),i>this.MAX_REVISIONS){this.logger.error(`Orchestrator: Max revisions hit. Aborting goal "${t}".`),this.emit("planFinish",{goal:t,status:"failed",error:n,timestamp:Date.now()});break}if(s==="auth"){this.logger.info("Orchestrator: Auth error \u2014 reloading .env and attempting key rotation."),await rEe();let E=QtA(this.logger);this.emit("agentRepair",{action:E?"key_rotation":"reload_env",reason:n,timestamp:Date.now()});continue}if(s==="ratelimit"){let E=gtA(i);this.logger.info(`Orchestrator: Rate-limit \u2014 waiting ${E}ms, then trying key rotation.`),await new Promise(Q=>setTimeout(Q,E)),QtA(this.logger),this.emit("agentRepair",{action:"backoff+rotation",waitMs:E,reason:n,timestamp:Date.now()});continue}if(s==="network"){let E=gtA(i);this.logger.info(`Orchestrator: Network error \u2014 waiting ${E}ms then re-planning.`),this.emit("agentRepair",{action:"backoff",waitMs:E,reason:n,timestamp:Date.now()}),await new Promise(Q=>setTimeout(Q,E))}let o=n.slice(0,120),c=(this._errorSignatures.get(o)??0)+1;this._errorSignatures.set(o,c),c>=2?(this.logger.warn(`Orchestrator: Recurring error (\xD7${c}) \u2014 injecting auto-repair context.`),this.emit("agentRepair",{action:"auto_repair",errorSignature:o,occurrences:c,timestamp:Date.now()}),a=[`Auto-repair attempt for: "${t}"`,`Recurring error (\xD7${c}): ${n}`,"Diagnose the root cause, attempt a different approach or skip the failing step, and complete the original goal."].join(" \u2014 ")):a=`Revised: "${t}" \u2014 previous attempt failed: ${n}`}this._busy=!1}};var Uv=he(cD(),1);Uv.default.config({override:!0});var lC=class{constructor(A){this.logger=A,this.model=process.env.OPENROUTER_MODEL||"openai/gpt-3.5-turbo",this.baseUrl="https://openrouter.ai/api/v1"}async generateJson(A){let t=await this.chat(A,{jsonMode:!0});try{let i=t.replace(/```json\n|\n```/g,"").trim();return JSON.parse(i)}catch(i){throw this.logger.error(`Provider: Failed to parse JSON response: ${i.message}`),this.logger.debug(`Raw response: ${t}`),new Error("LLM failed to produce valid JSON")}}async chat(A,t={}){Uv.default.config({override:!0});let i=process.env.OPENROUTER_API_KEY||"";i||this.logger.warn("Provider: OPENROUTER_API_KEY is not set. LLM calls will fail."),this.logger.info(`Provider: Sending request to ${this.model}...`);try{let a={Authorization:`Bearer ${i}`,"Content-Type":"application/json","HTTP-Referer":"https://must-b.ai","X-Title":"Must-b Agent"},r={model:this.model,messages:A,temperature:.1};t.jsonMode&&(r.response_format={type:"json_object"});let n=await fetch(`${this.baseUrl}/chat/completions`,{method:"POST",headers:a,body:JSON.stringify(r)});if(!n.ok){let c=await n.text();throw new Error(`OpenRouter API Error: ${n.status} - ${c}`)}let o=(await n.json()).choices[0]?.message?.content;if(!o)throw new Error("Provider: Received empty response from LLM.");return o}catch(a){throw this.logger.error(`Provider: LLM Request Failed - ${a.message}`),a}}};var EC=class{constructor(A){this.logger=A,this.provider=new lC(A)}async plan(A){this.logger.info(`Planner: Generating plan for goal: "${A}"`);let i=[{role:"system",content:`You are the Planner for Must-b, an autonomous AI agent with full browser, filesystem, terminal, and memory capabilities.
|
|
4014
4014
|
Your job is to break down a high-level user Goal into a precise, executable sequence of steps.
|
|
4015
4015
|
|
|
4016
4016
|
Available Tools:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@must-b/must-b",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "Must-b v1.0 — Professional Autonomous AI Operating System by Auto Step",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/",
|
|
@@ -51,7 +51,8 @@
|
|
|
51
51
|
"socket.io": "^4.8.3",
|
|
52
52
|
"socket.io-client": "^4.8.3",
|
|
53
53
|
"vectra": "^0.12.3",
|
|
54
|
-
"winston": "^3.11.0"
|
|
54
|
+
"winston": "^3.11.0",
|
|
55
|
+
"playwright": "^1.49.0"
|
|
55
56
|
},
|
|
56
57
|
"devDependencies": {
|
|
57
58
|
"@types/express": "^4.17.21",
|
|
@@ -59,7 +60,6 @@
|
|
|
59
60
|
"@yao-pkg/pkg": "^5.11.5",
|
|
60
61
|
"esbuild": "^0.24.0",
|
|
61
62
|
"eslint": "^8",
|
|
62
|
-
"playwright": "^1.49.0",
|
|
63
63
|
"ts-node": "^10.9.2",
|
|
64
64
|
"tsx": "^4.19.2",
|
|
65
65
|
"typescript": "^5.3.3"
|