@opengeni/codex 0.2.13 → 0.2.16

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.
@@ -1,4 +1,4 @@
1
- import type { FetchLike } from "./fetch";
1
+ import type { FetchLike } from "./fetch.js";
2
2
  /**
3
3
  * Maps connector tool names to a Responses-API-legal charset and back. One
4
4
  * instance per codex_apps transport (i.e. per turn): tools/list populates it,
@@ -18,7 +18,7 @@
18
18
  * runtime request seam and the database history boundary call the same pure
19
19
  * function, so replayed conversation truth is identical to live model input.
20
20
  */
21
- export { MODEL_TOOL_OUTPUT_OVERSIZED_IMAGE_CARD_DATA_URL } from "./oversized-image-card";
21
+ export { MODEL_TOOL_OUTPUT_OVERSIZED_IMAGE_CARD_DATA_URL } from "./oversized-image-card.js";
22
22
  export type ModelHistoryItem = Record<string, unknown>;
23
23
  export declare const CODEX_MODEL_TOOL_OUTPUT_TRUNCATION_TOKENS = 10000;
24
24
  export declare const CODEX_TOOL_OUTPUT_SERIALIZATION_ALLOWANCE = 1.2;
@@ -1,5 +1,11 @@
1
1
  /** Mutates a parsed Responses request body in place and returns it. Pure + synchronous + unit-testable. */
2
2
  export declare function normalizeCodexRequestBody(body: Record<string, unknown>, resolveModel: (slug: string) => string): Record<string, unknown>;
3
+ /**
4
+ * Copy-on-write form for model clients that may retain converted input items.
5
+ * Only records the mutable normalizer can touch are copied; large content,
6
+ * tools, and unchanged protocol items remain shared immutable values.
7
+ */
8
+ export declare function normalizedCodexRequestBody(body: Readonly<Record<string, unknown>>, resolveModel: (slug: string) => string): Record<string, unknown>;
3
9
  /**
4
10
  * Build a longest-prefix model resolver. Catalog slugs come from GET /models
5
11
  * (api-client.ts). One leading `namespace/` segment is stripped first; an
@@ -1,7 +1,7 @@
1
- import { type CodexAuthHeaders } from "./api-client";
2
- import { CODEX_REALTIME_MODEL, CODEX_REALTIME_VERSION } from "./constants";
3
- import type { CodexFetch } from "./device-code";
4
- import { type CodexRealtimeInitialItem } from "./realtime-v3";
1
+ import { type CodexAuthHeaders } from "./api-client.js";
2
+ import { CODEX_REALTIME_MODEL, CODEX_REALTIME_VERSION } from "./constants.js";
3
+ import type { CodexFetch } from "./device-code.js";
4
+ import { type CodexRealtimeInitialItem } from "./realtime-v3.js";
5
5
  export declare const CODEX_REALTIME_VOICES: readonly ["juniper", "maple", "spruce", "ember", "vale", "breeze", "arbor", "sol", "cove"];
6
6
  export type CodexRealtimeVoice = (typeof CODEX_REALTIME_VOICES)[number];
7
7
  export type CodexRealtimeCallInput = {
package/dist/refresh.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { CodexFetch } from "./device-code";
1
+ import type { CodexFetch } from "./device-code.js";
2
2
  /** Permanent — the workspace must reconnect (status => needs_relogin). */
3
3
  export declare class CodexReloginRequired extends Error {
4
4
  constructor(message: string);
@@ -83,6 +83,12 @@ export type CodexRequestContext = {
83
83
  onUsageHeaders?: (snapshot: CodexUsageHeaderSnapshot) => void;
84
84
  /** Optional per-run override, primarily for deterministic transport tests. */
85
85
  responseTimeoutPolicy?: Partial<CodexResponseTimeoutPolicy>;
86
+ /**
87
+ * Synchronous, best-effort diagnostics for the request lifecycle. This hook
88
+ * runs before the durable audit sink and MUST remain non-blocking: a throw is
89
+ * swallowed by the transport and it must never receive request bodies/auth.
90
+ */
91
+ onModelRequestDiagnostic?: (event: CodexModelRequestEvent) => void;
86
92
  /** Worker-owned durable audit sink; payloads never contain request bodies or auth. */
87
93
  onModelRequestEvent?: (event: CodexModelRequestEvent) => Promise<void> | void;
88
94
  /** Exact opaque artifacts on the normalized wire request, never their ciphertext. */
@@ -1,4 +1,4 @@
1
- import type { CodexResponseTimeoutClass, CodexResponseTimeoutPolicy } from "./request-context";
1
+ import type { CodexResponseTimeoutClass, CodexResponseTimeoutPolicy } from "./request-context.js";
2
2
  export declare const CODEX_RESPONSE_TIMEOUT_ERROR_TYPE = "opengeni_codex_response_timeout";
3
3
  export declare const DEFAULT_CODEX_RESPONSE_TIMEOUT_POLICY: CodexResponseTimeoutPolicy;
4
4
  export declare function resolveCodexResponseTimeoutPolicy(override: Partial<CodexResponseTimeoutPolicy> | undefined): CodexResponseTimeoutPolicy;
@@ -1,4 +1,4 @@
1
- import { type CodexRateLimitResetCreditsSummary } from "./reset-credits";
1
+ import { type CodexRateLimitResetCreditsSummary } from "./reset-credits.js";
2
2
  /** The 5-hour (primary) window's `limit_window_seconds`. */
3
3
  export declare const CODEX_FIVE_HOUR_WINDOW_SECONDS = 18000;
4
4
  /** The weekly (secondary) window's `limit_window_seconds`. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeni/codex",
3
- "version": "0.2.13",
3
+ "version": "0.2.16",
4
4
  "description": "ChatGPT/Codex subscription auth + transport: device-code login, token refresh, and the Responses-backend fetch. Pure HTTP + transforms; no database dependency.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -41,6 +41,7 @@
41
41
  "prepublishOnly": "bash ../../scripts/prepublish-guard"
42
42
  },
43
43
  "dependencies": {
44
+ "@opengeni/network": "^0.2.2",
44
45
  "zod": "^4.2.1"
45
46
  },
46
47
  "engines": {