@rizom/brain 0.2.0-alpha.762 → 0.2.0-alpha.763
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/brain.js +133 -133
- package/dist/chunks/app-sm2em526.js +5 -0
- package/dist/chunks/{index-5gwnbhh0.js → index-2eznbxjq.js} +2 -2
- package/dist/chunks/{index-9vwdkez5.js → index-66z3zrmq.js} +3 -3
- package/dist/chunks/{index-9vwdkez5.js.map → index-66z3zrmq.js.map} +1 -1
- package/dist/chunks/{index-7yry6pk2.js → index-8pxh95mr.js} +2 -2
- package/dist/chunks/{index-fzb4mr0f.js → index-91xp5wy6.js} +21 -21
- package/dist/chunks/{index-fzb4mr0f.js.map → index-91xp5wy6.js.map} +4 -4
- package/dist/chunks/{index-y849n0xb.js → index-g9h8t0x7.js} +2 -2
- package/dist/chunks/{index-eedmt1sv.js → index-j13gczzx.js} +2 -2
- package/dist/chunks/{package-pewz17e7.js → package-n2ztkfa2.js} +3 -3
- package/dist/chunks/{package-pewz17e7.js.map → package-n2ztkfa2.js.map} +1 -1
- package/dist/entities.js +1 -1
- package/dist/git-broker.js +10 -10
- package/dist/index.js +1 -1
- package/dist/interfaces.js +1 -1
- package/dist/model.js +4 -4
- package/dist/model.js.map +1 -1
- package/dist/services.js +1 -1
- package/dist/testing.js +1 -1
- package/dist/ui/{studio-app-qd0hk5dv.js → studio-app-hcg2rfyy.js} +2 -2
- package/dist/ui/studio-asset-manifest.json +13 -13
- package/dist/ui/studio-chunks/{account-view-pgy2e6j6.js → account-view-jwgh7b9e.js} +1 -1
- package/dist/ui/studio-chunks/{main-k6jsh4n9.js → main-e4qk2bwv.js} +12 -12
- package/dist/ui/studio-chunks/{main-k6jsh4n9.js.map → main-e4qk2bwv.js.map} +2 -2
- package/dist/ui/studio-chunks/{main-fxrm4ssk.js → main-k6q9va58.js} +1 -1
- package/dist/ui/studio-chunks/{main-6a06q2ax.js → main-rhzszne9.js} +1 -1
- package/dist/ui/studio-chunks/{studio-chat-workspace-x5rxvgae.js → studio-chat-workspace-m8qqpajr.js} +1 -1
- package/package.json +1 -1
- package/dist/chunks/app-95na3rzh.js +0 -5
- /package/dist/chunks/{app-95na3rzh.js.map → app-sm2em526.js.map} +0 -0
- /package/dist/chunks/{index-5gwnbhh0.js.map → index-2eznbxjq.js.map} +0 -0
- /package/dist/chunks/{index-7yry6pk2.js.map → index-8pxh95mr.js.map} +0 -0
- /package/dist/chunks/{index-y849n0xb.js.map → index-g9h8t0x7.js.map} +0 -0
- /package/dist/chunks/{index-eedmt1sv.js.map → index-j13gczzx.js.map} +0 -0
- /package/dist/ui/{studio-app-qd0hk5dv.js.map → studio-app-hcg2rfyy.js.map} +0 -0
- /package/dist/ui/studio-chunks/{account-view-pgy2e6j6.js.map → account-view-jwgh7b9e.js.map} +0 -0
- /package/dist/ui/studio-chunks/{main-fxrm4ssk.js.map → main-k6q9va58.js.map} +0 -0
- /package/dist/ui/studio-chunks/{main-6a06q2ax.js.map → main-rhzszne9.js.map} +0 -0
- /package/dist/ui/studio-chunks/{studio-chat-workspace-x5rxvgae.js.map → studio-chat-workspace-m8qqpajr.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{a as j,b as T}from"./index-8tbdzaj6.js";import{d as g,e as m}from"./index-9fv0t4ft.js";import"./index-e84v85w3.js";import{L as Z}from"./index-4mffgwx9.js";import"./index-x8e40qwv.js";import"./index-bttj9f2n.js";import{$h as P,Ij as E,Uh as N,Vh as F,Zi as H,_h as I,ai as R,bi as L,ci as B,jj as w,kj as M,nj as D,uj as O}from"./index-
|
|
2
|
+
import{a as j,b as T}from"./index-8tbdzaj6.js";import{d as g,e as m}from"./index-9fv0t4ft.js";import"./index-e84v85w3.js";import{L as Z}from"./index-4mffgwx9.js";import"./index-x8e40qwv.js";import"./index-bttj9f2n.js";import{$h as P,Ij as E,Uh as N,Vh as F,Zi as H,_h as I,ai as R,bi as L,ci as B,jj as w,kj as M,nj as D,uj as O}from"./index-91xp5wy6.js";import{um as A,yl as S}from"./index-rp80h99d.js";import"./index-tmmhpkks.js";import"./index-w3fkvmpp.js";import{cy as v}from"./index-p7r4yhgz.js";import"./index-ncwvncs8.js";import{ly as b}from"./index-k148qr6g.js";var x=v.object({theme:v.object({primaryColor:v.string().describe("Primary color for the CLI theme").default("#0066cc"),accentColor:v.string().describe("Accent color for the CLI theme").default("#ff6600")}).describe("Theme configuration for the CLI interface").default({primaryColor:"#0066cc",accentColor:"#ff6600"})});var V={completed:"\u2713",declined:"\u25CB",failed:"\u2717"},q={deniedCardIds:void 0,resolveUrl:(r)=>r,isHiddenUrl:()=>!1,eventActionUnavailableLabel:void 0},y="cli",k={identity:{kind:"external",externalActorId:S("cli","operator")},interfaceType:"cli",role:"user"};function _(){return{inkApp:null,removeSignalHandlers:void 0,responseCallback:void 0,systemMessageCallback:void 0}}function z(r,e){let{logger:t}=r,o=new D({loadMessages:async(i)=>r.conversations.getMessages(i,{limit:50}),onRestoreError:(i,s)=>{t.debug("Failed to restore pending CLI approvals",{error:i,conversationId:s})}}),n=(i)=>{e.responseCallback?.(i)},a=()=>r.permissions.isAnchor("cli","local"),u=async(i,s)=>{let l=new Set(s);if(!M(i,l))return!1;let c=w({message:Y(i,s),approvalIds:l});if(c.kind==="not-confirmation")return!1;if(c.kind==="notice")return n(`_${c.message}_`),!0;o.removeApproval(y,c.approvalId);let C=await r.agent.confirmPendingAction(y,c.confirmed,c.approvalId,{userPermissionLevel:"admin",isAnchor:a(),interfaceType:"cli",actor:k});return o.syncFromResponse(y,C,c.approvalId),n(K(C.text,C.cards)),!0};return{async processInput(i){r.messages.startProcessingInput();try{let s=[...await o.getApprovalIds(y)];if(s.length>0){if(await u(i,s))return}let l=await r.agent.chat(i,y,{userPermissionLevel:"admin",isAnchor:a(),interfaceType:"cli",channelId:"cli",channelName:"CLI Terminal",actor:k}),c=P(l.cards),C=c.length>0?c.map((p)=>p.id):l.pendingConfirmations?.map((p)=>p.id)??[];o.replaceApprovals(y,C);let h=G(l);t.debug("Agent response received",{textLength:l.text.length,toolResultsCount:l.toolResults?.length??0,toolResults:l.toolResults?.map((p)=>({toolName:p.toolName,hasData:p.data!==void 0}))}),n(h)}catch(s){t.error("Error processing input",{error:s,input:i});let l=A(s,"An unknown error occurred");n(`**Error:** ${l}`)}finally{r.messages.endProcessingInput()}}}}function G(r){let e=O(r,{deniedCardIds:void 0}),t=[],o=[],n="";for(let a of e.directives)switch(a.kind){case"text":n=a.text;break;case"approvals":t.push(...a.cards);break;default:if(a.card.kind==="tool-approval"&&a.card.state==="approval-requested"){t.push(a.card);break}o.push(E(a.card,q))}return[J(n,t),...o].filter((a)=>a.trim().length>0).join(`
|
|
3
3
|
|
|
4
4
|
`)}function J(r,e){if(e.length===0)return r;let t=L(r,e);if(e.length===1){let n=e[0];if(!n)return r;let a=n.preview?`
|
|
5
5
|
|
|
@@ -16,4 +16,4 @@ _Please reply with **yes 1** / **no 1** for the matching action._`}function K(r,
|
|
|
16
16
|
${o.error}`:`${n} ${o.summary}`}function Y(r,e){let t=/^(.*?)\s+#?(\d+)$/.exec(r.trim());if(!t?.[1]||!t[2])return r;let o=e[Number(t[2])-1];return o?`${t[1]} ${o}`:r}var Q=H({id:"cli",config:x,setup:(r)=>(I(r).logger.debug("CLI interface registered with AgentService"),_())}),W=N(Q,(r)=>{let{state:e}=r,t=I(r),{logger:o,messages:n}=t,a=z(t,e),u=()=>{e.responseCallback=void 0,e.systemMessageCallback=void 0},i=()=>{if(n.unregisterProgressCallback(),u(),e.removeSignalHandlers?.(),e.removeSignalHandlers=void 0,e.inkApp)e.inkApp.unmount(),e.inkApp=null};return{id:"cli",start:async()=>{o.debug("Starting CLI interface");try{let[s,l,c]=await Promise.all([import("./index-5dpvryvs.js"),import("react"),import("./EnhancedApp-kgfga75j.js")]),h=l.default.createElement(c.default,{interface:a,registerProgressCallback:(p)=>{n.registerProgressCallback(p)},unregisterProgressCallback:()=>{n.unregisterProgressCallback()},registerResponseCallback:(p)=>{e.responseCallback=p},registerSystemMessageCallback:(p)=>{e.systemMessageCallback=p},unregisterMessageCallbacks:u});e.inkApp=s.render(h),e.removeSignalHandlers=Z(["SIGINT","SIGTERM"],()=>{o.debug("Received termination signal, stopping CLI"),i()})}catch(s){throw o.error("Failed to start CLI interface",{error:s}),s}},stop:async()=>{o.debug("Stopping CLI interface"),i()},healthCheck:async()=>{let s=e.inkApp!==null;return{status:s?"healthy":"error",message:s?"CLI interface is running":"CLI interface not running",lastCheck:new Date,details:{hasInkApp:e.inkApp!==null,hasCallbacks:n.hasProgressCallback()}}}}}),X=F(W,({state:r})=>({send:({message:e})=>{let t=typeof e==="string"?e:e.fallbackText??"";if(!t)return;(r.systemMessageCallback??r.responseCallback)?.(t)}})),ee=X;import{jsx as d,jsxs as f}from"react/jsx-runtime";function re({batchStatus:r,showDetails:e=!0}){let{batchId:t,totalOperations:o,completedOperations:n,failedOperations:a,currentOperation:u,errors:i,status:s}=r,l=s==="processing",c=s==="completed",C=s==="failed",h=n-a;return f(g,{flexDirection:"column",marginY:1,children:[d(g,{marginBottom:1,children:f(m,{bold:!0,color:"cyan",children:["Batch Operation: ",t.slice(0,8),"..."]})}),d(g,{marginBottom:1,children:d(T,{current:n,total:o,message:"Overall Progress:",color:C?"red":c?"green":"yellow"})}),l&&u&&f(g,{marginBottom:1,children:[d(m,{color:"green",children:d(j,{type:"dots"})}),f(m,{color:"gray",children:[" ",u]})]}),e&&f(g,{flexDirection:"column",marginLeft:2,children:[h>0&&f(g,{children:[d(m,{color:"green",children:"\u2713 "}),f(m,{color:"gray",children:[h," successful"]})]}),a>0&&f(g,{children:[d(m,{color:"red",children:"\u2717 "}),f(m,{color:"gray",children:[a," failed"]})]}),i.length>0&&f(g,{flexDirection:"column",marginTop:1,children:[d(m,{color:"red",bold:!0,children:"Errors:"}),i.slice(0,3).map((p,U)=>f(g,{marginLeft:2,children:[d(m,{color:"red",children:"\u2022 "}),d(m,{color:"gray",children:p})]},U)),i.length>3&&d(g,{marginLeft:2,children:f(m,{color:"gray",children:["... and ",i.length-3," more"]})})]})]}),c&&d(g,{marginTop:1,children:d(m,{color:"green",bold:!0,children:"\u2713 Batch completed successfully"})}),C&&d(g,{marginTop:1,children:d(m,{color:"red",bold:!0,children:"\u2717 Batch failed"})})]})}export{re as BatchProgress,T as ProgressBar,x as cliConfigSchema,ee as default};
|
|
17
17
|
|
|
18
18
|
//# debugId=0E1009CC4E95A9CC64756E2164756E21
|
|
19
|
-
//# sourceMappingURL=index-
|
|
19
|
+
//# sourceMappingURL=index-g9h8t0x7.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{L as p}from"./index-4mffgwx9.js";import{Ga as m,La as d,Oa as v,Pa as S}from"./index-
|
|
2
|
+
import{L as p}from"./index-4mffgwx9.js";import{Ga as m,La as d,Oa as v,Pa as S}from"./index-2eznbxjq.js";import{Zg as h}from"./index-91xp5wy6.js";import{Jo as n,Lo as a}from"./index-tmmhpkks.js";import{ct as f,qw as s,rt as l}from"./index-w3fkvmpp.js";import{ly as g}from"./index-k148qr6g.js";async function u(i){let[{default:e},{default:t}]=await Promise.all([import("./index-g9h8t0x7.js"),import("./package-n2ztkfa2.js")]);return h(e,i??{},{name:t.name,version:t.version},{pluginId:"cli"})}class c{shell=null;config;signalScope=null;signalShutdownFiber=null;stopPromise=null;migrationPromise=null;hasCLI=!1;static create(i,e){return new c(v(i),e)}constructor(i,e){if(this.config=i,this.hasCLI=process.argv.slice(2).includes("--cli"),e)this.shell=e}async migrate(){let i=a.getInstance();await new d(i).runAllMigrations({database:this.config.shellConfig?.database?.url??this.config.database,jobQueueDatabase:this.config.shellConfig?.jobQueueDatabase?.url,conversationDatabase:this.config.shellConfig?.conversationDatabase?.url,runtimeStateDatabase:this.config.shellConfig?.runtimeStateDatabase?.url})}createShell(i,e){this.shell=m.createFresh(S(this.config,i),void 0,{...e?.processRole&&{processRole:e.processRole},...e?.peerChannel&&{peerChannel:e.peerChannel}})}wantsCLI(i){return this.hasCLI||i?.cli===!0}async registerCLIInterface(i){if(!this.wantsCLI(i))return;let e=this.getShell().getPluginManager();for(let t of await u(this.config.cliConfig))e.registerPlugin(t)}async initialize(i,e){if(!this.shell){if(!e?.migrationsCompleted){this.migrationPromise=this.migrate();try{await this.migrationPromise}finally{this.migrationPromise=null}}if(this.stopPromise)return;this.createShell(i,e)}if(await this.registerCLIInterface(e),this.stopPromise)return;await this.getShell().initialize(i)}async start(){if(this.stopPromise)return;this.setupSignalHandlers()}stop(){return this.stopPromise??=this.stopApp(),this.stopPromise}async stopApp(){if(await this.closeSignalScope(),this.migrationPromise)await this.migrationPromise.catch(()=>{return});await this.shell?.shutdown()}async run(i){let t={debug:n.DEBUG,info:n.INFO,warn:n.WARN,error:n.ERROR}[this.config.logLevel??"info"]??n.INFO,o=this.wantsCLI(i),r=a.createFresh({level:t,context:this.config.name,useStderr:o});if(o)a.getInstance().setUseStderr(!0);r.info(`\uD83D\uDE80 Starting ${this.config.name} v${this.config.version}...`),this.setupSignalHandlers();try{if(await this.initialize(void 0,i),this.stopPromise)return;await this.start(),i?.onRuntimeReady?.(),r.info(`\u2705 ${this.config.name} v${this.config.version} ready`),process.stdin.resume()}catch(C){r.error(`\u274C Failed to start ${this.config.name}:`,C),process.exit(1)}}static async run(i,e,t){await c.create(i,e).run(t)}setupSignalHandlers(){if(this.signalScope)return;let i=s.runSync(l.make()),e=()=>{this.requestGracefulShutdown("SIGINT")},t=()=>{this.requestGracefulShutdown("SIGTERM")},o=p(["SIGINT"],e),r=p(["SIGTERM"],t);s.runSync(l.addFinalizer(i,s.sync(()=>{r(),o()}))),this.signalScope=i}requestGracefulShutdown(i){if(this.signalShutdownFiber)return;let e=a.getInstance();e.info(`
|
|
3
3
|
Received ${i}, shutting down gracefully...`);let t=s.tryPromise({try:()=>this.stop(),catch:(o)=>o}).pipe(s.match({onFailure:(o)=>{e.error("Error during shutdown:",o),process.exit(1)},onSuccess:()=>{process.exit(0)}}));this.signalShutdownFiber=s.runFork(t)}async closeSignalScope(){let i=this.signalScope;if(this.signalScope=null,i)await s.runPromise(l.close(i,f.void))}getShell(){if(!this.shell)throw Error("Shell not initialized. Call initialize() first.");return this.shell}}
|
|
4
4
|
export{c as B};
|
|
5
5
|
|
|
6
6
|
//# debugId=C01ADF37A0E1321B64756E2164756E21
|
|
7
|
-
//# sourceMappingURL=index-
|
|
7
|
+
//# sourceMappingURL=index-j13gczzx.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./index-k148qr6g.js";var n="@brains/chat-repl",i="AGPL-3.0-only",t="0.2.0-alpha.
|
|
2
|
+
import"./index-k148qr6g.js";var n="@brains/chat-repl",i="AGPL-3.0-only",t="0.2.0-alpha.763",r={"@brains/contracts":"workspace:*","@brains/sdk":"workspace:*","@brains/utils":"workspace:*",chalk:"^5.4.1",ink:"^7.0.6","ink-spinner":"^5.0.0","ink-text-input":"^6.0.0",marked:"^18.0.5",react:"^19.2.7"},a={"@brains/eslint-config":"workspace:*","@brains/plugins":"workspace:*","@brains/typescript-config":"workspace:*","@types/bun":"^1.4.0","@types/react":"^19.2.17",typescript:"^7.0.2"},c=["src"],p="./src/index.ts",l="./src/index.ts",o=!0,k={dev:"tsc --watch",lint:"eslint . --max-warnings 0","lint:fix":"eslint . --max-warnings 0 --fix",test:"bun test",typecheck:"tsc --noEmit"},d="module",b="./src/index.ts",w={name:n,license:i,version:t,dependencies:r,devDependencies:a,files:c,main:p,module:l,private:o,scripts:k,type:d,types:b};export{w as default,r as dependencies,a as devDependencies,c as files,i as license,p as main,l as module,n as name,o as private,k as scripts,d as type,b as types,t as version};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=package-
|
|
4
|
+
//# debugId=587AA57BC96DB5D664756E2164756E21
|
|
5
|
+
//# sourceMappingURL=package-n2ztkfa2.js.map
|
package/dist/entities.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunks/index-624fhq2j.js";import{Ah as d,Bh as g,Ic as m,fe as p,sh as t,wh as x,xh as a,yh as b,zh as c}from"./chunks/index-
|
|
2
|
+
import"./chunks/index-624fhq2j.js";import{Ah as d,Bh as g,Ic as m,fe as p,sh as t,wh as x,xh as a,yh as b,zh as c}from"./chunks/index-91xp5wy6.js";import{Om as f}from"./chunks/index-rp80h99d.js";import"./chunks/index-tmmhpkks.js";import"./chunks/index-w3fkvmpp.js";import{cy as e}from"./chunks/index-p7r4yhgz.js";import"./chunks/index-ncwvncs8.js";import"./chunks/index-k148qr6g.js";export{m as ProjectionJsonObjectSchema,f as defineChannel,t as defineDashboardWidget,x as defineDataSource,a as defineEntity,b as defineEntityAnalyticsReport,c as defineEntityJob,g as defineEntityPackage,d as defineProjection,p as defineProjectionRule,e as z};
|
|
3
3
|
|
|
4
4
|
//# debugId=B1D6627240F76D3B64756E2164756E21
|
|
5
5
|
//# sourceMappingURL=entities.js.map
|