@peer2peer/codex-bridge 0.1.1 → 0.1.3

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/dist/p2p.d.ts CHANGED
@@ -20,7 +20,7 @@ export type Outcome<T> = {
20
20
  reason: string;
21
21
  };
22
22
  /** Exec over node's child_process with the given environment. */
23
- export declare function nodeExec(env?: NodeJS.ProcessEnv): Exec;
23
+ export declare function nodeExec(env?: NodeJS.ProcessEnv | (() => NodeJS.ProcessEnv)): Exec;
24
24
  /** The JSON object a `--json` command printed (its last line), or null. */
25
25
  export declare function parseJson<T>(stdout: string): T | null;
26
26
  export type Whoami = {
@@ -172,5 +172,7 @@ export declare class P2P {
172
172
  messages: HistoryRecord[];
173
173
  truncated: boolean;
174
174
  }>>;
175
+ /** `p2p extensions`, read only: what it says about Ix (optional; recommended when not installed and not declined). */
176
+ ixAdvice(): Promise<Outcome<unknown>>;
175
177
  held(): Promise<Outcome<HeldItem[]>>;
176
178
  }
package/dist/p2p.js CHANGED
@@ -18,7 +18,8 @@ const TIMEOUT_MS = 30_000;
18
18
  export function nodeExec(env = process.env) {
19
19
  return {
20
20
  run: (argv, init) => new Promise((resolve, reject) => {
21
- const child = spawn(argv[0], argv.slice(1), { env, stdio: ["pipe", "pipe", "pipe"], windowsHide: true });
21
+ // A function: worked out again for every run (the server's reads the person token each time).
22
+ const child = spawn(argv[0], argv.slice(1), { env: typeof env === "function" ? env() : env, stdio: ["pipe", "pipe", "pipe"], windowsHide: true });
22
23
  let stdout = "";
23
24
  let stderr = "";
24
25
  const timer = setTimeout(() => child.kill("SIGKILL"), init?.timeoutMs ?? TIMEOUT_MS);
@@ -137,6 +138,11 @@ export class P2P {
137
138
  const messages = Array.isArray(r.value.messages) ? r.value.messages.filter((m) => m && typeof m.text === "string" && typeof m.at === "number" && (m.dir === "in" || m.dir === "out")) : [];
138
139
  return { ok: true, value: { messages, truncated: r.value.truncated === true } };
139
140
  }
141
+ /** `p2p extensions`, read only: what it says about Ix (optional; recommended when not installed and not declined). */
142
+ async ixAdvice() {
143
+ const r = await this.call(["extensions"]);
144
+ return r.ok ? { ok: true, value: r.value.ix } : r;
145
+ }
140
146
  async held() {
141
147
  const r = await this.call(["held"]);
142
148
  return r.ok ? { ok: true, value: Array.isArray(r.value.held) ? r.value.held : [] } : r;
package/dist/server.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { Readable, Writable } from "node:stream";
2
2
  import { type HookReport, type WatchRunner } from "./bridge.js";
3
- export declare const BRIDGE_VERSION = "0.1.1";
3
+ export declare const BRIDGE_VERSION = "0.1.3";
4
4
  export type Env = Record<string, string | undefined>;
5
5
  export declare function resolveHome(env: Env): string;
6
6
  /** `p2p watch` as a child: stdout lines as they come; killed when `signal` aborts. */
package/dist/server.js CHANGED
@@ -18,7 +18,7 @@ import { RolloutReader } from "./trusted.js";
18
18
  import { lineFeeder, McpServer } from "./mcp.js";
19
19
  import { nodeExec, P2P } from "./p2p.js";
20
20
  import { makeTools, refuseMutating, serverInstructions } from "./tools.js";
21
- export const BRIDGE_VERSION = "0.1.1";
21
+ export const BRIDGE_VERSION = "0.1.3";
22
22
  export function resolveHome(env) {
23
23
  const h = env.P2P_HOME?.trim();
24
24
  return h ? h : join(userHome(), ".p2p");
@@ -169,12 +169,18 @@ export async function runMcpServer(o) {
169
169
  const bin = p2pBin && isAbsolute(p2pBin) ? [p2pBin] : o.bin;
170
170
  // The person token (projects.ts): this bridge speaks for the person's session, so its p2p runs pass it
171
171
  // (the session is registered, its sends are its own). The model's shell never has it.
172
- // Only `p2p` and `p2p watch` get it (`extra`); childEnv never passes one through (CHILD_P2P_DENY), so
173
- // `codex queue` and anything else this bridge runs can't.
174
- const token = personTokenOf(home);
175
- const front = token ? { P2P_PERSON_TOKEN: token } : {};
172
+ // Only the short `p2p` runs get it (`extra`, below), never the long-lived `p2p watch` (childWatch); and
173
+ // childEnv never passes one through from this bridge's own environment (CHILD_P2P_DENY), so `codex
174
+ // queue` and anything else this bridge runs can't.
175
+ // Read for every run, never kept: the CLI derives it from the identity's device key and the home's salt,
176
+ // replaces person.key when an identity is created or restored on this home (a join in the person's
177
+ // terminal while this session runs), and refuses the old one.
178
+ const front = () => {
179
+ const token = personTokenOf(home);
180
+ return token ? { P2P_PERSON_TOKEN: token } : {};
181
+ };
176
182
  // Every `p2p` child runs without project-settable node/loader variables (NODE_OPTIONS, DYLD_*, ...).
177
- const p2p = new P2P(nodeExec(childEnv(env, front)), bin);
183
+ const p2p = new P2P(nodeExec(() => childEnv(env, front())), bin);
178
184
  let entry = null;
179
185
  const bridge = new Bridge({
180
186
  p2p,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peer2peer/codex-bridge",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Peer2Peer for OpenAI Codex: an MCP server, Codex hooks and an installer over the `p2p` CLI",
5
5
  "keywords": [
6
6
  "peer2peer",
@@ -46,5 +46,8 @@
46
46
  "access": "public",
47
47
  "provenance": true,
48
48
  "registry": "https://registry.npmjs.org/"
49
+ },
50
+ "overrides": {
51
+ "minimatch": "^11.0.8"
49
52
  }
50
53
  }