@oh-my-pi/pi-ai 18.10.3 → 18.10.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/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [18.10.4] - 2026-10-13
6
+
7
+ ### Fixed
8
+
9
+ - Fixed Codex cybersecurity policy errors incorrectly retrying without Daybreak and disabling it for subsequent requests, while preserving retries without Daybreak when access is rejected ([#15472](https://github.com/can1357/oh-my-pi/pull/15472) by [@taibenvenuti](https://github.com/taibenvenuti))
10
+
11
+ ### Removed
12
+
13
+ - Removed the `toolNamespacesInfo` stream option; Codex requests no longer send `tool_namespaces_info` turn metadata, and `code_mode_tool_names`/`tool_namespaces_info` are no longer reserved client metadata keys.
14
+
5
15
  ## [18.10.3] - 2026-10-12
6
16
 
7
17
  ### Breaking Changes
@@ -398,8 +398,6 @@ export interface StreamOptions {
398
398
  liveSteering?: LiveSteering;
399
399
  /** Canonical Codex compaction classification; ignored by other providers. */
400
400
  codexCompaction?: CodexCompactionRequestContext;
401
- /** Codex Code Mode tool exposure snapshot emitted as `tool_namespaces_info` turn metadata; ignored by other providers. */
402
- toolNamespacesInfo?: unknown;
403
401
  /**
404
402
  * Optional per-provider concurrent request cap for LLM stream calls. Keys are
405
403
  * provider ids (`model.provider`); positive numeric values cap in-flight
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oh-my-pi/pi-ai",
3
- "version": "18.10.3",
3
+ "version": "18.10.4",
4
4
  "description": "Unified LLM API with automatic model discovery and provider configuration",
5
5
  "keywords": [
6
6
  "ai",
@@ -155,11 +155,11 @@
155
155
  "fmt": "oxfmt --no-error-on-unmatched-pattern 'src/**/*.{ts,tsx}' '{test,bench,examples,scripts}/**/*.ts' '*.ts'"
156
156
  },
157
157
  "dependencies": {
158
- "@oh-my-pi/omptype": "18.10.3",
159
- "@oh-my-pi/pi-catalog": "18.10.3",
160
- "@oh-my-pi/pi-natives": "18.10.3",
161
- "@oh-my-pi/pi-utils": "18.10.3",
162
- "@oh-my-pi/pi-wire": "18.10.3"
158
+ "@oh-my-pi/omptype": "18.10.4",
159
+ "@oh-my-pi/pi-catalog": "18.10.4",
160
+ "@oh-my-pi/pi-natives": "18.10.4",
161
+ "@oh-my-pi/pi-utils": "18.10.4",
162
+ "@oh-my-pi/pi-wire": "18.10.4"
163
163
  },
164
164
  "devDependencies": {
165
165
  "@types/bun": "^1.3.14"
@@ -65,6 +65,7 @@ export function dropRejectedCodexAccessPrograms(
65
65
  function isAccessProgramRejection(error: unknown): boolean {
66
66
  if (!(error instanceof Error)) return false;
67
67
  const code = "code" in error && typeof error.code === "string" ? error.code : undefined;
68
- if (code !== undefined && Object.hasOwn(REJECTION_CODES, code)) return true;
68
+ // HTTP parsing promotes generic error.type to code; only specific codes rule out message fallback.
69
+ if (code !== undefined && code !== "invalid_request_error") return Object.hasOwn(REJECTION_CODES, code);
69
70
  return REJECTION_PATTERN.test(error.message);
70
71
  }
@@ -498,15 +498,12 @@ interface CodexCompatibilityIdentity {
498
498
  affinitySessionId?: string;
499
499
  threadId: string;
500
500
  windowId: string;
501
- /** Header projection: identity fields only, never the Code Mode snapshot. */
502
- turnMetadataHeaderJson?: string;
501
+ turnMetadataJson?: string;
503
502
  }
504
503
 
505
504
  interface CodexRequestMetadata extends CodexCompatibilityIdentity {
506
505
  turnId: string;
507
- /** Canonical body projection, including `tool_namespaces_info` when present. */
508
506
  turnMetadataJson: string;
509
- turnMetadataHeaderJson: string;
510
507
  clientMetadata: Record<string, string>;
511
508
  }
512
509
 
@@ -523,11 +520,6 @@ const CODEX_RESERVED_METADATA_KEYS: Record<string, true> = {
523
520
  [OPENAI_HEADERS.SUBAGENT]: true,
524
521
  request_kind: true,
525
522
  compaction: true,
526
- // codex-rs retired `code_mode_tool_names` in favor of `tool_namespaces_info`
527
- // for its Responses Lite Code Mode mapping; both stay reserved so callers
528
- // cannot smuggle them in as extras.
529
- code_mode_tool_names: true,
530
- tool_namespaces_info: true,
531
523
  turn_started_at_unix_ms: true,
532
524
  forked_from_thread_id: true,
533
525
  parent_thread_id: true,
@@ -633,7 +625,6 @@ function createCodexRequestMetadata(
633
625
  clientMetadata?: Readonly<Record<string, string>>;
634
626
  parentTurnId?: string;
635
627
  compaction?: CodexCompactionRequestContext;
636
- toolNamespacesInfo?: unknown;
637
628
  affinitySessionId?: string;
638
629
  },
639
630
  ): CodexRequestMetadata {
@@ -674,17 +665,7 @@ function createCodexRequestMetadata(
674
665
  turnMetadata.turn_started_at_unix_ms = session.turnStartedAtUnixMs;
675
666
  }
676
667
  for (const key in extra) turnMetadata[key] = extra[key];
677
- // The `x-codex-turn-metadata` header is capped at 100KB by the Codex
678
- // backend, while `tool_namespaces_info` grows with the session's tool count
679
- // (409 tools ~ 100KB on its own). The body's `client_metadata` is the
680
- // canonical envelope, so the snapshot rides there only and the header keeps
681
- // the fixed-size identity projection.
682
- const turnMetadataHeaderJson = toAsciiJsonString(turnMetadata);
683
- let turnMetadataJson = turnMetadataHeaderJson;
684
- if (options.toolNamespacesInfo !== undefined) {
685
- turnMetadata.tool_namespaces_info = options.toolNamespacesInfo;
686
- turnMetadataJson = toAsciiJsonString(turnMetadata);
687
- }
668
+ const turnMetadataJson = toAsciiJsonString(turnMetadata);
688
669
  const clientMetadata: Record<string, string> = {
689
670
  [OPENAI_HEADERS.INSTALLATION_ID]: identity.installationId,
690
671
  session_id: identity.sessionId,
@@ -701,7 +682,6 @@ function createCodexRequestMetadata(
701
682
  affinitySessionId: options.affinitySessionId,
702
683
  turnId: session.turnId,
703
684
  turnMetadataJson,
704
- turnMetadataHeaderJson,
705
685
  clientMetadata,
706
686
  };
707
687
  }
@@ -710,8 +690,8 @@ function applyCodexCompatibilityHeaders(headers: Headers, metadata: CodexCompati
710
690
  headers.set(OPENAI_HEADERS.SCOPED_SESSION_ID, metadata.affinitySessionId ?? metadata.sessionId);
711
691
  headers.set(OPENAI_HEADERS.THREAD_ID, metadata.threadId);
712
692
  headers.set(OPENAI_HEADERS.WINDOW_ID, metadata.windowId);
713
- if (metadata.turnMetadataHeaderJson) {
714
- headers.set(OPENAI_HEADERS.TURN_METADATA, metadata.turnMetadataHeaderJson);
693
+ if (metadata.turnMetadataJson) {
694
+ headers.set(OPENAI_HEADERS.TURN_METADATA, metadata.turnMetadataJson);
715
695
  } else {
716
696
  headers.delete(OPENAI_HEADERS.TURN_METADATA);
717
697
  }
@@ -1531,7 +1511,6 @@ function createCodexRequestContext(
1531
1511
  clientMetadata: transformedBody.client_metadata,
1532
1512
  parentTurnId: options?.parentTurnId,
1533
1513
  compaction,
1534
- toolNamespacesInfo: options?.toolNamespacesInfo,
1535
1514
  affinitySessionId: normalizeOpenAIPromptCacheKey(options?.parentSessionId),
1536
1515
  });
1537
1516
  transformedBody.client_metadata = requestMetadata.clientMetadata;
package/src/stream.ts CHANGED
@@ -1835,7 +1835,6 @@ function mapOptionsForApi<TApi extends Api>(
1835
1835
  minimizeEffort: options?.minimizeEffort,
1836
1836
  liveSteering: options?.liveSteering,
1837
1837
  maxInFlightRequests: options?.maxInFlightRequests,
1838
- toolNamespacesInfo: options?.toolNamespacesInfo,
1839
1838
  onPayload: options?.onPayload,
1840
1839
  onResponse: options?.onResponse,
1841
1840
  onSseEvent: options?.onSseEvent,
package/src/types.ts CHANGED
@@ -628,8 +628,6 @@ export interface StreamOptions {
628
628
  liveSteering?: LiveSteering;
629
629
  /** Canonical Codex compaction classification; ignored by other providers. */
630
630
  codexCompaction?: CodexCompactionRequestContext;
631
- /** Codex Code Mode tool exposure snapshot emitted as `tool_namespaces_info` turn metadata; ignored by other providers. */
632
- toolNamespacesInfo?: unknown;
633
631
  /**
634
632
  * Optional per-provider concurrent request cap for LLM stream calls. Keys are
635
633
  * provider ids (`model.provider`); positive numeric values cap in-flight