@oh-my-pi/pi-ai 18.1.9 → 18.1.10

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,5 +1,5 @@
1
1
  import type { CodexCompactionContext, CodexCompactionRequestContext, Context, Model, ProviderSessionState, ServiceTier, StreamFunction, StreamOptions, Tool, ToolChoice } from "../types.js";
2
- import { type CodexLiteShapedBody, type CodexReasoningContext, type RequestBody } from "./openai-codex/request-transformer.js";
2
+ import { type CodexLiteShapedBody, type CodexReasoningContext, type InputItem, type RequestBody } from "./openai-codex/request-transformer.js";
3
3
  import type { ResponseInput } from "./openai-responses-wire.js";
4
4
  export interface OpenAICodexResponsesOptions extends StreamOptions {
5
5
  reasoning?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
@@ -164,8 +164,8 @@ export declare function createOpenAICodexCompatibilityMetadata(options: OpenAICo
164
164
  export declare function resetOpenAICodexHistoryAfterCompaction(options: OpenAICodexCompactionResetOptions): void;
165
165
  /** @internal Exported for tests. */
166
166
  export declare function normalizeCodexToolChoice(choice: ToolChoice | undefined, tools?: Tool[], model?: Model<"openai-codex-responses">): string | Record<string, unknown> | undefined;
167
- /** @internal Exported for tests. */
168
- export declare function buildTransformedCodexRequestBody(model: Model<"openai-codex-responses">, context: Context, options: OpenAICodexResponsesOptions | undefined, promptCacheKey?: string | undefined): Promise<RequestBody>;
167
+ /** Serialize normal Codex turns and V2 compaction with the same cacheable prefix. */
168
+ export declare function buildTransformedCodexRequestBody(model: Model<"openai-codex-responses">, context: Context, options: OpenAICodexResponsesOptions | undefined, promptCacheKey?: string | undefined, inputPrefix?: InputItem[]): Promise<RequestBody>;
169
169
  /**
170
170
  * Open a provider-native V2 compaction stream through Codex's WebSocket-first
171
171
  * transport, replaying WebSocket transport failures over SSE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oh-my-pi/pi-ai",
3
- "version": "18.1.9",
3
+ "version": "18.1.10",
4
4
  "description": "Unified LLM API with automatic model discovery and provider configuration",
5
5
  "keywords": [
6
6
  "ai",
@@ -124,11 +124,11 @@
124
124
  "fmt": "oxfmt --no-error-on-unmatched-pattern 'src/**/*.{ts,tsx}' '{test,bench,examples,scripts}/**/*.ts' '*.ts'"
125
125
  },
126
126
  "dependencies": {
127
- "@oh-my-pi/omptype": "18.1.9",
128
- "@oh-my-pi/pi-catalog": "18.1.9",
129
- "@oh-my-pi/pi-natives": "18.1.9",
130
- "@oh-my-pi/pi-utils": "18.1.9",
131
- "@oh-my-pi/pi-wire": "18.1.9"
127
+ "@oh-my-pi/omptype": "18.1.10",
128
+ "@oh-my-pi/pi-catalog": "18.1.10",
129
+ "@oh-my-pi/pi-natives": "18.1.10",
130
+ "@oh-my-pi/pi-utils": "18.1.10",
131
+ "@oh-my-pi/pi-wire": "18.1.10"
132
132
  },
133
133
  "devDependencies": {
134
134
  "@types/bun": "^1.3.14"
@@ -1535,16 +1535,18 @@ async function buildCodexRequestContext(
1535
1535
  });
1536
1536
  }
1537
1537
 
1538
- /** @internal Exported for tests. */
1538
+ /** Serialize normal Codex turns and V2 compaction with the same cacheable prefix. */
1539
1539
  export async function buildTransformedCodexRequestBody(
1540
1540
  model: Model<"openai-codex-responses">,
1541
1541
  context: Context,
1542
1542
  options: OpenAICodexResponsesOptions | undefined,
1543
1543
  promptCacheKey = getOpenAIPromptCacheKey(options),
1544
+ inputPrefix?: InputItem[],
1544
1545
  ): Promise<RequestBody> {
1546
+ const input = convertMessages(model, context);
1545
1547
  const params: RequestBody = {
1546
1548
  model: model.requestModelId ?? model.id,
1547
- input: convertMessages(model, context),
1549
+ input: inputPrefix?.length ? [...inputPrefix, ...input] : input,
1548
1550
  stream: true,
1549
1551
  prompt_cache_key: promptCacheKey,
1550
1552
  };