@ccpocket/bridge 1.81.2 → 1.81.4

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 CHANGED
@@ -42,6 +42,7 @@ ccpocket-bridge --version
42
42
  | `BRIDGE_HOST` | `0.0.0.0` | Bind address |
43
43
  | `BRIDGE_API_KEY` | (none) | API key authentication (enabled when set) |
44
44
  | `BRIDGE_ALLOWED_DIRS` | `$HOME` | Comma-separated list of project directories the Bridge may access; set exactly to `*` to allow any directory |
45
+ | `BRIDGE_FILE_DOWNLOAD_ALLOW_ALL_PATHS` | unset (project only) | Set exactly to `1` to allow sharing/downloading any regular file readable by the Bridge process, including paths outside `BRIDGE_ALLOWED_DIRS`. Absolute and relative paths within the selected project work by default. |
45
46
  | `BRIDGE_PUBLIC_WS_URL` | (none) | Public `ws://` / `wss://` URL used for startup deep link and QR code |
46
47
  | `BRIDGE_CODEX_APP_SERVER_MODE` | `private` | Experimental Codex app-server mode: `private`, `managed`, or `external` |
47
48
  | `BRIDGE_CODEX_SHARED_APP_SERVER_URL` | `ws://127.0.0.1:8767` in `managed` mode | Experimental shared Codex app-server URL for Codex CLI co-presence |
@@ -224,6 +225,7 @@ that affect startup:
224
225
  - `BRIDGE_HOST` / `--host`
225
226
  - `BRIDGE_API_KEY` / `--api-key`
226
227
  - `BRIDGE_ALLOWED_DIRS`
228
+ - `BRIDGE_FILE_DOWNLOAD_ALLOW_ALL_PATHS`
227
229
  - `BRIDGE_PUBLIC_WS_URL` / `--public-ws-url`
228
230
  - `BRIDGE_DISABLE_MDNS` / `--no-mdns`
229
231
  - `BRIDGE_ALLOW_CLAUDE_OAUTH`
@@ -325,3 +327,22 @@ The bridge server spawns and manages Claude Code CLI processes, translating WebS
325
327
 
326
328
  This package is MIT licensed as part of CC Pocket. See [LICENSE](./LICENSE) and
327
329
  the repository root [LICENSE](../../LICENSE).
330
+
331
+ ### Sharing files by absolute path
332
+
333
+ Sharing accepts both project-relative and absolute file paths. By default, the
334
+ resolved file (including symlink targets) must stay inside the selected project
335
+ and `BRIDGE_ALLOWED_DIRS`.
336
+
337
+ To explicitly allow sharing files from any location:
338
+
339
+ ```bash
340
+ BRIDGE_FILE_DOWNLOAD_ALLOW_ALL_PATHS=1 npx @ccpocket/bridge@latest
341
+ ```
342
+
343
+ This opt-in grants connected clients download access to all regular files readable
344
+ by the Bridge process. The selected project must still be an allowed, existing
345
+ directory. Authentication, download size limits, and capability URLs remain in
346
+ place. Uploads and other file access operations retain their existing rules.
347
+ Set the variable when running `setup` to persist it in launchd/systemd, or update
348
+ the service environment and restart the Bridge. No mobile app update is needed.
@@ -1,6 +1,7 @@
1
1
  import { EventEmitter } from "node:events";
2
2
  import type { CodexGoal, CodexGoalStatus, ServerMessage, ProcessStatus } from "./parser.js";
3
3
  import { buildCodexSpawnSpec } from "./codex-transport.js";
4
+ import type { CodexRateLimitsResponse } from "./usage.js";
4
5
  export { buildCodexSpawnSpec };
5
6
  export interface CodexStartOptions {
6
7
  threadId?: string;
@@ -245,7 +246,8 @@ export declare class CodexProcess extends EventEmitter<CodexProcessEvents> {
245
246
  listAvailableModels(): Promise<string[]>;
246
247
  listAvailableModelMetadata(): Promise<CodexModelMetadata[]>;
247
248
  start(projectPath: string, options?: CodexStartOptions): void;
248
- initializeOnly(projectPath: string): Promise<void>;
249
+ initializeOnly(projectPath: string, timeoutMs?: number): Promise<void>;
250
+ readRateLimits(timeoutMs?: number): Promise<CodexRateLimitsResponse>;
249
251
  waitUntilReady(): Promise<void>;
250
252
  stop(): void;
251
253
  private prepareLaunch;
@@ -415,7 +415,7 @@ export class CodexProcess extends EventEmitter {
415
415
  this.launchAppServer(projectPath, options);
416
416
  void this.bootstrap(projectPath, options);
417
417
  }
418
- async initializeOnly(projectPath) {
418
+ async initializeOnly(projectPath, timeoutMs) {
419
419
  if (this.transport) {
420
420
  this.stop();
421
421
  }
@@ -423,7 +423,7 @@ export class CodexProcess extends EventEmitter {
423
423
  try {
424
424
  this.prepareLaunch(projectPath);
425
425
  this.launchAppServer(projectPath);
426
- await this.initializeRpcConnection();
426
+ await this.initializeRpcConnection(timeoutMs);
427
427
  this.setStatus("idle");
428
428
  this.resolveReadiness();
429
429
  }
@@ -432,6 +432,9 @@ export class CodexProcess extends EventEmitter {
432
432
  throw error;
433
433
  }
434
434
  }
435
+ async readRateLimits(timeoutMs = 10_000) {
436
+ return (await this.request("account/rateLimits/read", undefined, timeoutMs));
437
+ }
435
438
  waitUntilReady() {
436
439
  if (this.readiness === "ready")
437
440
  return Promise.resolve();
@@ -1175,7 +1178,7 @@ export class CodexProcess extends EventEmitter {
1175
1178
  });
1176
1179
  return extractPermissionsFromConfigRead(response, projectLookupPaths, this.platform, profile);
1177
1180
  }
1178
- async initializeRpcConnection() {
1181
+ async initializeRpcConnection(timeoutMs) {
1179
1182
  await this.request("initialize", {
1180
1183
  clientInfo: {
1181
1184
  name: "ccpocket_bridge",
@@ -1185,7 +1188,7 @@ export class CodexProcess extends EventEmitter {
1185
1188
  capabilities: {
1186
1189
  experimentalApi: true,
1187
1190
  },
1188
- });
1191
+ }, timeoutMs);
1189
1192
  this.notify("initialized", {});
1190
1193
  }
1191
1194
  async readProfileConfig(cwd) {