@bill10/agent-007 0.12.1001 → 0.12.2000

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.12.1.1
1
+ 0.12.2.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bill10/agent-007",
3
- "version": "0.12.1001",
3
+ "version": "0.12.2000",
4
4
  "description": "From web terminals for your coding agents to a self-running agent company: Claude Code and Codex in parallel git worktrees, a job board they pick work from, and one agent that runs the board from a goal.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -91,6 +91,10 @@ export function writeMcpConfig(sessionId, agentToken) {
91
91
  // server/permission-hook.js with this session's MCP config. Claude Code only;
92
92
  // Codex takes its hook differently and is not wired yet (docs/BILLION.md).
93
93
  const PERMISSION_HOOK = fileURLToPath(new URL('./permission-hook.js', import.meta.url));
94
+ // The two board tools the job prompt tells a worker on Billion's card to use:
95
+ // finishing its card, and asking Billion. Asking permission for those would
96
+ // only send Billion (or the owner) a request to approve its own instructions.
97
+ export const WORKER_BOARD_TOOLS = ['finish_job', 'send_message'];
94
98
  const shellQuote = (s) => `"${String(s).replace(/(["\\$`])/g, '\\$1')}"`;
95
99
  // Forward slashes on Windows, which node takes as well: a backslash means
96
100
  // something different to each shell a hook might run under (doubled by the
@@ -99,10 +103,7 @@ export const hookPath = (p, platform = process.platform) => (platform === 'win32
99
103
  export function withApprovalHook(file, args, configPath) {
100
104
  if (!configPath || agentName(file) !== 'claude' || args.includes('--settings')) return args;
101
105
  const settings = {
102
- // The two board tools the job prompt tells the worker to use: finishing
103
- // its card, and asking Billion. Asking permission for those would only
104
- // send Billion a request to approve its own instructions.
105
- permissions: { allow: ['finish_job', 'send_message'].map(tool => `mcp__${MCP_SERVER_NAME}__${tool}`) },
106
+ permissions: { allow: WORKER_BOARD_TOOLS.map(tool => `mcp__${MCP_SERVER_NAME}__${tool}`) },
106
107
  hooks: {
107
108
  PermissionRequest: [{
108
109
  matcher: '*',
@@ -113,6 +114,18 @@ export function withApprovalHook(file, args, configPath) {
113
114
  return ['--settings', JSON.stringify(settings), ...args];
114
115
  }
115
116
 
117
+ // The Codex side of the same pre-allow: per-run -c overrides, one separate argv
118
+ // element each, so ~/.codex/config.toml is never touched. Only these tools;
119
+ // everything else on the server keeps Codex's default (ask). Must come after
120
+ // withMcpConfig's server table on the command line, which replaces the table.
121
+ export function withCodexWorkerTools(file, args, configPath) {
122
+ if (!configPath || agentName(file) !== 'codex') return args;
123
+ return [
124
+ ...WORKER_BOARD_TOOLS.flatMap(tool => ['-c', `mcp_servers.${MCP_SERVER_NAME}.tools.${tool}.approval_mode="approve"`]),
125
+ ...args,
126
+ ];
127
+ }
128
+
116
129
  export function removeMcpConfig(sessionId) {
117
130
  try {
118
131
  rmSync(mcpConfigPath(sessionId), { force: true });
package/server/pty.js CHANGED
@@ -10,7 +10,7 @@ export { trackSyncFrames } from '../lib/helpers.js';
10
10
  import { resolveExecutable, isUsableCwd, commandExists, missingCommandMessage } from './command-path.js';
11
11
  import { RING_BUFFER_MAX } from './state.js';
12
12
  import { mintAgentToken, authEnabled } from './auth.js';
13
- import { writeMcpConfig, removeMcpConfig, withMcpConfig, takesMcpConfig, withApprovalHook } from './agent-mcp.js';
13
+ import { writeMcpConfig, removeMcpConfig, withMcpConfig, takesMcpConfig, withApprovalHook, withCodexWorkerTools } from './agent-mcp.js';
14
14
  import { broadcastJobs, requestDispatch } from './jobs.js';
15
15
  import { flushMessages, dropMessages } from './messages.js';
16
16
  import { sessionAgentFromCommand, permissionFlagsFromCommand } from '../lib/jobs.js';
@@ -244,7 +244,11 @@ export function createSessionFromConfig({ sessionId, name, color, command, repoP
244
244
  // use it — a plain `bash` tab does not need one.
245
245
  const mcpConfigPath = takesMcpConfig(file) ? writeMcpConfig(sessionId, agentToken) : null;
246
246
  const codexTrust = autoTrust && sessionAgentFromCommand(command) === 'codex';
247
- const mcpArgs = withMcpConfig(file, codexTrust ? [...codexTrustArgs(worktreePath), ...args] : args, mcpConfigPath);
247
+ const ownArgs = codexTrust ? [...codexTrustArgs(worktreePath), ...args] : args;
248
+ // Codex has no hook yet, but its worker on Billion's card still gets the
249
+ // same board tools pre-allowed. Inside withMcpConfig, whose server table
250
+ // override would otherwise replace them.
251
+ const mcpArgs = withMcpConfig(file, approvalsToBillion ? withCodexWorkerTools(file, ownArgs, mcpConfigPath) : ownArgs, mcpConfigPath);
248
252
  // A worker on one of Billion's cards asks Billion before it asks a person
249
253
  // (server/approvals.js) — where the CLI can be hooked, which today is
250
254
  // Claude Code only. Recorded as whether the hook actually went in.