borgmcp 1.1.3 → 1.1.5

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.
@@ -10,11 +10,10 @@ interface ConnectDeps {
10
10
  */
11
11
  export declare function connectOpenCodeDrone(deps: ConnectDeps): Promise<void>;
12
12
  /**
13
- * Inject the initial kickoff prompt into the TUI's session. This is the
14
- * equivalent of passing the kickoff as a CLI arg (which opencode doesn't
15
- * support). Polls until the TUI server and a session are available, then
16
- * sends the prompt WITHOUT noReply so the agent processes it as its first
17
- * task. Best-effort — never throws.
13
+ * Inject the initial kickoff prompt into the TUI's session. Fills the
14
+ * TUI input with the kickoff text and submits it, triggering the agent
15
+ * to process it as its first task. Polls until the TUI server and a
16
+ * session are available. Best-effort never throws.
18
17
  */
19
18
  export declare function injectInitialKickoff(text: string): Promise<boolean>;
20
19
  /**
@@ -1 +1,13 @@
1
- import{createOpencodeClient as f}from"@opencode-ai/sdk";let e=null;async function y(t){try{e={client:f({baseUrl:t.serverUrl}),serverUrl:t.serverUrl,sessionId:null,directory:t.directory,connected:!0,totalEntriesInjected:0}}catch{e=null}}async function c(t=15,n=1e3){if(!e?.connected)return null;for(let r=0;r<t;r++){try{const o=(await e.client.session.list()).data??[];if(o.length===0)continue;const a=e.directory,l=a?o.filter(i=>i.directory===a):o;if(l.length===0)continue;const u=l.reduce((i,d)=>i.time.created>d.time.created?i:d);return e.sessionId=u.id,u.id}catch{}await new Promise(s=>setTimeout(s,n))}return null}async function h(t){if(!e?.connected)return!1;try{const n=await c();return n?(await e.client.session.prompt({path:{id:n},body:{parts:[{type:"text",text:t}]}}),e.totalEntriesInjected++,!0):!1}catch{return!1}}async function I(t){if(!e?.connected)return!1;try{const n=e.sessionId??await c(5,500);return n?(await e.client.session.prompt({path:{id:n},body:{noReply:!0,parts:[{type:"text",text:t}]}}),e.totalEntriesInjected++,!0):!1}catch{return e.sessionId=null,!1}}async function m(){if(!e?.connected)return null;try{const t=e.sessionId??await c(3,500);return t?(await e.client.session.get({path:{id:t}})).response.status===200:!1}catch{return!1}}function w(){e=null}function x(){return{connected:e?.connected??!1,sessionId:e?.sessionId??null,totalEntriesInjected:e?.totalEntriesInjected??0}}function C(t,n=14096){let r=0;for(let s=0;s<t.length;s++){const o=t.charCodeAt(s);r=(r<<5)-r+o,r|=0}return n+Math.abs(r)%1024}export{C as computeOpenCodePort,y as connectOpenCodeDrone,w as disconnectOpenCodeDrone,x as getOpenCodeConnectionState,h as injectInitialKickoff,I as injectOpenCodeEntry,m as probeOpenCodeDroneArmed};
1
+ import{createOpencodeClient as d}from"@opencode-ai/sdk";let e=null;async function f(t){try{e={client:d({baseUrl:t.serverUrl}),serverUrl:t.serverUrl,sessionId:null,directory:t.directory,connected:!0,totalEntriesInjected:0},process.stderr.write(`[borg] opencode drone connected to ${t.serverUrl} for dir ${t.directory}
2
+ `)}catch(r){process.stderr.write(`[borg] opencode drone connect failed: ${r}
3
+ `),e=null}}async function l(t=15,r=1e3){if(!e?.connected)return!1;for(let n=0;n<t;n++){try{if((await e.client.session.list()).response.status===200)return!0}catch(s){process.stderr.write(`[borg] waitForServer attempt ${n+1}: ${s}
4
+ `)}await new Promise(s=>setTimeout(s,r))}return process.stderr.write(`[borg] server not ready after ${t} retries
5
+ `),!1}async function c(){if(!e?.connected)return null;try{const r=(await e.client.session.list()).data??[],n=e.directory,s=n?r.filter(i=>i.directory===n):r;if(s.length===0)return null;const o=s.reduce((i,a)=>i.time.created>a.time.created?i:a);return process.stderr.write(`[borg] found session ${o.id.slice(0,8)}\u2026
6
+ `),e.sessionId=o.id,o.id}catch{return null}}async function p(t){if(!e?.connected)return process.stderr.write(`[borg] injectInitialKickoff: not connected
7
+ `),!1;try{if(!await l())return process.stderr.write(`[borg] injectInitialKickoff: server not ready
8
+ `),!1;process.stderr.write(`[borg] appendPrompt text.length=${t.length}\u2026
9
+ `),await e.client.tui.appendPrompt({body:{text:t}}),process.stderr.write(`[borg] submitPrompt\u2026
10
+ `),await e.client.tui.submitPrompt({query:{directory:e.directory}});const n=await c();return n?(process.stderr.write(`[borg] kickoff injected, session ${n.slice(0,8)}\u2026
11
+ `),e.totalEntriesInjected++,!0):(process.stderr.write(`[borg] injectInitialKickoff: session not created after submit
12
+ `),!0)}catch(r){return process.stderr.write(`[borg] injectInitialKickoff error: ${r}
13
+ `),!1}}async function y(t){if(!e?.connected)return!1;try{const r=e.sessionId??await c();return r?(await e.client.session.prompt({path:{id:r},body:{noReply:!0,parts:[{type:"text",text:t}]}}),e.totalEntriesInjected++,!0):!1}catch{return e.sessionId=null,!1}}async function w(){if(!e?.connected)return null;try{const t=e.sessionId??await c();return t?(await e.client.session.get({path:{id:t}})).response.status===200:!1}catch{return!1}}function b(){e=null}function I(){return{connected:e?.connected??!1,sessionId:e?.sessionId??null,totalEntriesInjected:e?.totalEntriesInjected??0}}function g(t,r=14096){let n=0;for(let s=0;s<t.length;s++){const o=t.charCodeAt(s);n=(n<<5)-n+o,n|=0}return r+Math.abs(n)%1024}export{g as computeOpenCodePort,f as connectOpenCodeDrone,b as disconnectOpenCodeDrone,I as getOpenCodeConnectionState,p as injectInitialKickoff,y as injectOpenCodeEntry,w as probeOpenCodeDroneArmed};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "borgmcp",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "Coordinate AI coding agents in shared cubes. Works with Claude Code and Codex. Create projects, assign roles, and share a live activity log.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",