@chatpanel/bridge 0.7.0 → 0.9.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chatpanel/bridge",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "type": "module",
5
5
  "description": "Local bridge that exposes the AI coding agents installed on your machine — Claude Code (CLI), Codex (CLI), and Gemini CLI — to the ChatPanel Chrome extension over a localhost SSE endpoint. Bring your own agent.",
6
6
  "keywords": [
@@ -115,6 +115,7 @@ export async function chat({ messages, system, options, images }, emit) {
115
115
  const args = ['-p', prompt];
116
116
  if (options.model) args.push('--model', options.model);
117
117
  if (options.permissionMode === 'bypassPermissions') args.push('--dangerously-skip-permissions');
118
+ if (options.extraArgs) args.push(...String(options.extraArgs).split(/\s+/).filter(Boolean));
118
119
 
119
120
  await new Promise((resolve, reject) => {
120
121
  let child;
@@ -244,6 +244,7 @@ export async function chat({ messages, system, options, images }, emit) {
244
244
  }: ${imageFiles.join(', ')}`;
245
245
  }
246
246
 
247
+ if (options.extraArgs) args.push(...String(options.extraArgs).split(/\s+/).filter(Boolean));
247
248
  const run = runClaude({ prompt, args, cwd, emit });
248
249
  if (run === null) {
249
250
  cleanup(); // SDK fallback doesn't take images yet
@@ -133,18 +133,18 @@ export async function chat({ messages, system, options, images }, emit) {
133
133
  const cleanupImages = () => imageFiles.forEach((f) => unlink(f).catch(() => {}));
134
134
 
135
135
  const cwd = options.workingDir ? path.resolve(options.workingDir) : SCRATCH;
136
- const sandbox =
137
- options.permissionMode === 'bypassPermissions'
138
- ? 'danger-full-access'
139
- : options.permissionMode === 'acceptEdits'
140
- ? 'workspace-write'
141
- : 'read-only';
142
-
143
- const args = ['exec', '--json', '--skip-git-repo-check', '-s', sandbox, '-o', outFile];
144
- // Headless exec has no human to approve commands. Auto-run within the sandbox
145
- // so skill/startup reads don't get "approval declined" (and skills can load in
146
- // local-config mode). The sandbox above still bounds what can actually happen.
147
- args.push('-c', 'approval_policy=never');
136
+ const args = ['exec', '--json', '--skip-git-repo-check', '-o', outFile];
137
+ // Headless exec has no human to approve actions. With MCP/browser tools armed
138
+ // Codex would otherwise raise an approval prompt it can't show — and cancel the
139
+ // tool call. So in bypassPermissions (full autonomy, what "Act on page" needs)
140
+ // use the all-in bypass flag, which also clears MCP-tool approval. Lower modes
141
+ // keep the sandbox + never-ask, which auto-runs within bounds.
142
+ if (options.permissionMode === 'bypassPermissions') {
143
+ args.push('--dangerously-bypass-approvals-and-sandbox');
144
+ } else {
145
+ const sandbox = options.permissionMode === 'acceptEdits' ? 'workspace-write' : 'read-only';
146
+ args.push('-s', sandbox, '-c', 'approval_policy=never');
147
+ }
148
148
  if (REASONING) args.push('-c', `model_reasoning_effort=${REASONING}`);
149
149
  // Browser tools: register the bridge's MCP server as a stdio MCP server (the
150
150
  // bridge binary in --mcp-stdio mode), so Codex can call our page-action tools.
@@ -156,6 +156,7 @@ export async function chat({ messages, system, options, images }, emit) {
156
156
  args.push('-c', `mcp_servers.${name}.args=${JSON.stringify(pargs)}`);
157
157
  }
158
158
  if (options.model) args.push('-m', options.model);
159
+ if (options.extraArgs) args.push(...String(options.extraArgs).split(/\s+/).filter(Boolean));
159
160
  for (const f of imageFiles) args.push('-i', f); // attach images to the initial prompt
160
161
  args.push('-');
161
162
 
@@ -171,6 +171,10 @@ export async function runSpec(spec, { messages, system, options = {}, images },
171
171
  : spec.args
172
172
  ? String(spec.args).split(/\s+/).filter(Boolean)
173
173
  : [];
174
+ // User-supplied extra CLI flags (Settings → agent → "Extra arguments"), placed
175
+ // right after the base args/subcommand — e.g. opencode `run --format json
176
+ // --dangerously-skip-permissions`. Applies to every built-in & custom CLI agent.
177
+ if (options.extraArgs) args.push(...String(options.extraArgs).split(/\s+/).filter(Boolean));
174
178
  // Inject the selected model via the agent's CONFIGURED model-arg template
175
179
  // (e.g. "--model {model}" or, for opencode, "-m {model}" with provider/model).
176
180
  // Without a template we can't know how this CLI takes a model, so options.model
package/src/server.js CHANGED
@@ -30,7 +30,7 @@ import { callLocalMcp } from './mcp-local.js';
30
30
  // Hardcoded (not read from package.json) so it survives Bun's single-file
31
31
  // --compile, where package.json isn't on a readable FS. CI fails the publish if
32
32
  // this drifts from package.json, so the two can't silently diverge.
33
- const VERSION = '0.7.0';
33
+ const VERSION = '0.9.0';
34
34
  const HOST = process.env.CHATPANEL_BRIDGE_HOST || '127.0.0.1';
35
35
  const PORT = Number(process.env.CHATPANEL_BRIDGE_PORT) || 4319;
36
36