@agentdeploymentco/bishop 0.1.0 → 0.3.0
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/README.md +138 -10
- package/dist/agent-dir.js +1 -1
- package/dist/attachments.js +2 -2
- package/dist/cli.js +18 -15
- package/dist/config.js +4 -4
- package/dist/db.js +91 -2
- package/dist/env.js +4 -4
- package/dist/files.js +2 -2
- package/dist/gc.js +2 -2
- package/dist/gmail/api.js +1 -1
- package/dist/gmail/etiquette.js +1 -0
- package/dist/gmail/fake.js +4 -4
- package/dist/gmail/history.js +1 -1
- package/dist/gmail/identity.js +1 -0
- package/dist/gmail/interface.js +2 -2
- package/dist/gmail/labels.js +1 -1
- package/dist/gmail/message.js +7 -10
- package/dist/gmail/presence.js +3 -3
- package/dist/gmail/route.js +1 -1
- package/dist/harness/claude.js +5 -5
- package/dist/harness/codex.js +5 -5
- package/dist/harness/principal.js +9 -8
- package/dist/ids.js +1 -0
- package/dist/interface/attachments.js +1 -1
- package/dist/interface/format.js +4 -0
- package/dist/{slack → interface}/phrases.js +1 -1
- package/dist/interface/state.js +1 -1
- package/dist/interface/verbosity.js +1 -0
- package/dist/log.js +1 -1
- package/dist/schedule/runner.js +3 -3
- package/dist/sessions/store.js +10 -26
- package/dist/setup.js +1 -1
- package/dist/slack/commands/run.js +1 -1
- package/dist/slack/format.js +1 -4
- package/dist/slack/handlers.js +1 -1
- package/dist/slack/interface.js +2 -2
- package/dist/slack/presence.js +2 -2
- package/dist/slack/tasks.js +1 -1
- package/dist/slack/verbosity.js +1 -1
- package/dist/teams/api.js +1 -0
- package/dist/teams/authorize.js +1 -0
- package/dist/teams/create.js +1 -0
- package/dist/teams/entra.js +3 -0
- package/dist/teams/fake.js +1 -0
- package/dist/teams/files.js +1 -0
- package/dist/teams/graph.js +1 -0
- package/dist/teams/interface.js +2 -0
- package/dist/teams/logger.js +1 -0
- package/dist/teams/presence.js +7 -0
- package/dist/teams/progress.js +1 -0
- package/dist/teams/provision.js +10 -0
- package/dist/teams/route.js +1 -0
- package/dist/teams/server.js +1 -0
- package/dist/teams/setup.js +190 -0
- package/dist/teams/thread.js +1 -0
- package/dist/teams/verify.js +2 -0
- package/dist/tools/files.js +1 -1
- package/dist/tools/server.js +1 -1
- package/dist/turn.js +1 -1
- package/dist/worktrees.js +2 -2
- package/package.json +3 -1
- /package/dist/{slack → interface}/etiquette.js +0 -0
- /package/dist/{slack → interface}/status.js +0 -0
package/dist/turn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{log as
|
|
1
|
+
import{log as o}from"./log.js";import{worktreeName as b}from"./worktrees.js";function v(i){const s=new Map,l=new Set;async function y(e){const r=i.sharedDirNotice;if(!(!r||l.has(e.thread.threadKey))){l.add(e.thread.threadKey);try{await e.notify(r)}catch(n){o.debug({thread:e.thread.threadKey,err:n},"could not deliver the shared-directory notice")}}}function w(e,r){if(!(!i.tools||e.tools===!1))return i.tools.grant({thread:e.thread,principal:r,origin:e.origin,destination:()=>e.destination()})}async function m(e){await y(e);const r=new AbortController,n=e.presence();let d;try{s.set(e.thread.threadKey,r);const a=e.freshSession?void 0:await i.sessions.get(e.thread.id),h=await i.cwd(e.thread),[p,f]=await Promise.all([e.messages(),a?void 0:e.history?.().catch(t=>{o.warn({thread:e.thread.threadKey,err:t},"could not read the history")})]),[c,...g]=p;if(!c)throw new Error("a turn with no messages");const K=g.at(-1)?.principal??c.principal;if(r.signal.aborted){o.info({thread:e.thread.threadKey},"turn stopped before the agent started");return}d=w(e,K);for await(const t of i.harness.runTurn({messages:[c,...g],cwd:h,threadKey:e.thread.threadKey,worktree:b(e.thread.dirKey),...a?{sessionId:a}:{},...e.note?{note:e.note}:{},...f?.length?{history:f}:{},origin:e.origin,...d?{tools:d.access}:{},signal:r.signal}))t.type==="session"&&t.sessionId!==a&&await i.sessions.set(e.thread.id,t.sessionId),t.type==="text"&&o.debug({thread:e.thread.threadKey,chars:t.text.length},"agent said something"),t.type==="tool"&&o.debug({thread:e.thread.threadKey,tool:t.name,detail:t.summary??t.detail},"tool activity"),t.type==="done"&&o.info({thread:e.thread.threadKey,...t.usage},"turn complete"),t.type==="error"&&o.error({thread:e.thread.threadKey,kind:t.kind,err:t.message},"turn errored"),await n.handle(t)}catch(a){const h=a instanceof Error?a.message:String(a);throw o.error({thread:e.thread.threadKey,err:a},"turn failed before the agent answered"),await n.handle({type:"error",kind:"turn_failed",message:h}),a}finally{d?.revoke(),s.get(e.thread.threadKey)===r&&s.delete(e.thread.threadKey),await n.finish()}}return{run:m,stop(e){const r=s.get(e);return r?(r.abort(),!0):!1}}}export{v as makeTurnRunner};
|
package/dist/worktrees.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createHash as w}from"node:crypto";import{existsSync as u,mkdirSync as
|
|
2
|
-
and, retrying with the existing branch: ${o}`}function f(t,r){if(!r)return t;const e=s(t,r);return
|
|
1
|
+
import{createHash as w}from"node:crypto";import{existsSync as u,mkdirSync as h}from"node:fs";import{join as p,resolve as s}from"node:path";import{BishopError as d}from"./errors.js";import{exec as n}from"./exec.js";const l=64,c="bishop-",m=".claude/worktrees";function b(t){const r=t.replaceAll(/[^a-zA-Z0-9]+/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-+|-+$/g,""),e=`${c}${r}`;if(e.length<=l)return e;const o=w("sha256").update(t).digest("hex").slice(0,8),i=l-c.length-o.length-1;return`${c}${r.slice(0,i)}-${o}`}function g(t,r){return s(t,m,r)}function I(t){return`\`${t}\` isn't a git repository, so I'm working in it directly. Another thread changing the same files at the same time can conflict.`}function N(t){return!!(t?.enabled&&t.isRepo)}function x(t){return u(p(t,".git"))}async function y(t){const r=await n("git",["rev-parse","--show-prefix"],{cwd:t});return r.code===0?r.stdout.trim():""}async function M(t,r){const e=g(t,r),o=await y(t);if(x(e))return f(e,o);if(u(e))throw new d(`${e} exists but is not a git worktree, which usually means an earlier attempt failed partway. Remove the directory and this thread will get a fresh one.`);const i=await n("git",["worktree","add","-b",r,e,"HEAD"],{cwd:t});if(i.code!==0){await n("git",["worktree","prune"],{cwd:t});const a=await n("git",["worktree","add",e,r],{cwd:t});if(a.code!==0)throw new d(`Couldn't create a git worktree for this thread at ${e}: ${k(i,a)}`)}return f(e,o)}function k(t,r){const e=t.stderr.trim(),o=r.stderr.trim();return!o||o===e?e:`${e}
|
|
2
|
+
and, retrying with the existing branch: ${o}`}function f(t,r){if(!r)return t;const e=s(t,r);return h(e,{recursive:!0}),e}async function P(t){const r=await n("git",["rev-parse","--git-common-dir"],{cwd:t}),e=r.stdout.trim();if(!(r.code!==0||!e))return s(t,e)}async function W(t){return(await n("git",["rev-parse","--show-toplevel"],{cwd:t})).code===0}async function _(t){const r=await n("git",["config","--get","user.email"],{cwd:t}),e=await n("git",["config","--get","user.name"],{cwd:t});return r.code===0&&r.stdout.trim()!==""&&e.code===0&&e.stdout.trim()!==""}export{m as WORKTREE_DIR,M as ensureWorktree,P as gitCommonDir,_ as hasGitIdentity,W as isGitRepo,N as isolates,I as sharedDirNotice,b as worktreeName,g as worktreePath};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentdeploymentco/bishop",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "An agent gateway. Connects an agent to Slack and email.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -25,12 +25,14 @@
|
|
|
25
25
|
"typecheck": "tsc --noEmit",
|
|
26
26
|
"test": "vitest run",
|
|
27
27
|
"test:watch": "vitest",
|
|
28
|
+
"eval:etiquette": "tsx test/etiquette-eval.ts",
|
|
28
29
|
"lint": "biome check src test",
|
|
29
30
|
"format": "biome check --write src test",
|
|
30
31
|
"check": "npm run lint && npm run typecheck && npm test"
|
|
31
32
|
},
|
|
32
33
|
"dependencies": {
|
|
33
34
|
"@anthropic-ai/claude-agent-sdk": "^0.3",
|
|
35
|
+
"@microsoft/teams.apps": "^2.0.16",
|
|
34
36
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
35
37
|
"@openai/codex-sdk": "^0.149.1",
|
|
36
38
|
"@slack/bolt": "^5.0.0",
|
|
File without changes
|
|
File without changes
|