@oh-my-pi/pi-ai 14.0.3 → 14.0.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@oh-my-pi/pi-ai",
4
- "version": "14.0.3",
4
+ "version": "14.0.4",
5
5
  "description": "Unified LLM API with automatic model discovery and provider configuration",
6
6
  "homepage": "https://github.com/can1357/oh-my-pi",
7
7
  "author": "Can Boluk",
@@ -45,7 +45,7 @@
45
45
  "@aws-sdk/client-bedrock-runtime": "^3",
46
46
  "@bufbuild/protobuf": "^2.11",
47
47
  "@google/genai": "^1.43",
48
- "@oh-my-pi/pi-utils": "14.0.3",
48
+ "@oh-my-pi/pi-utils": "14.0.4",
49
49
  "@sinclair/typebox": "^0.34",
50
50
  "@smithy/node-http-handler": "^4.4",
51
51
  "ajv": "^8.18",
@@ -19,7 +19,7 @@ import {
19
19
  type ToolConfiguration,
20
20
  ToolResultStatus,
21
21
  } from "@aws-sdk/client-bedrock-runtime";
22
- import { $env } from "@oh-my-pi/pi-utils";
22
+ import { $env, $flag } from "@oh-my-pi/pi-utils";
23
23
  import { NodeHttpHandler } from "@smithy/node-http-handler";
24
24
  import type { Effort } from "../model-thinking";
25
25
  import { mapEffortToAnthropicAdaptiveEffort, requireSupportedEffort } from "../model-thinking";
@@ -102,14 +102,14 @@ export const streamBedrock: StreamFunction<"bedrock-converse-stream"> = (
102
102
  config.region = config.region || $env.AWS_REGION || $env.AWS_DEFAULT_REGION;
103
103
 
104
104
  // Support proxies that don't need authentication
105
- if ($env.AWS_BEDROCK_SKIP_AUTH === "1") {
105
+ if ($flag("AWS_BEDROCK_SKIP_AUTH")) {
106
106
  config.credentials = {
107
107
  accessKeyId: "dummy-access-key",
108
108
  secretAccessKey: "dummy-secret-key",
109
109
  };
110
110
  }
111
111
 
112
- if ($env.AWS_BEDROCK_FORCE_HTTP1 === "1") {
112
+ if ($flag("AWS_BEDROCK_FORCE_HTTP1")) {
113
113
  config.requestHandler = new NodeHttpHandler();
114
114
  }
115
115
  }
@@ -379,7 +379,7 @@ function supportsPromptCaching(model: Model<"bedrock-converse-stream">): boolean
379
379
  if (id.includes("claude-haiku")) return true;
380
380
  // Application inference profiles don't contain the model name in the ARN.
381
381
  // Allow users to force cache points via environment variable.
382
- if (typeof process !== "undefined" && process.env.AWS_BEDROCK_FORCE_CACHE === "1") return true;
382
+ if (typeof process !== "undefined" && $flag("AWS_BEDROCK_FORCE_CACHE")) return true;
383
383
  return false;
384
384
  }
385
385
 
@@ -1,5 +1,5 @@
1
1
  import * as os from "node:os";
2
- import { $env, abortableSleep, asRecord, logger, readSseJson, structuredCloneJSON } from "@oh-my-pi/pi-utils";
2
+ import { $env, $flag, abortableSleep, asRecord, logger, readSseJson, structuredCloneJSON } from "@oh-my-pi/pi-utils";
3
3
  import type OpenAI from "openai";
4
4
  import type {
5
5
  ResponseFunctionToolCall,
@@ -90,7 +90,7 @@ export function buildCodexSystemPrompt(args: { userSystemPrompt?: string }): Cod
90
90
  };
91
91
  }
92
92
 
93
- const CODEX_DEBUG = $env.PI_CODEX_DEBUG === "1" || $env.PI_CODEX_DEBUG === "true";
93
+ const CODEX_DEBUG = $flag("PI_CODEX_DEBUG");
94
94
  const CODEX_MAX_RETRIES = 5;
95
95
  const CODEX_RETRYABLE_STATUS = new Set([408, 429, 500, 502, 503, 504]);
96
96
  const CODEX_RETRY_DELAY_MS = 500;
@@ -197,7 +197,7 @@ function parseCodexPositiveInteger(value: string | undefined, fallback: number):
197
197
  }
198
198
 
199
199
  function isCodexWebSocketEnvEnabled(): boolean {
200
- return $env.PI_CODEX_WEBSOCKET === "1" || $env.PI_CODEX_WEBSOCKET === "true";
200
+ return $flag("PI_CODEX_WEBSOCKET");
201
201
  }
202
202
 
203
203
  function getCodexWebSocketRetryBudget(): number {
@@ -1,3 +1,4 @@
1
+ import { $flag } from "@oh-my-pi/pi-utils";
1
2
  import { type TUnsafe, Type } from "@sinclair/typebox";
2
3
  import { areJsonValuesEqual } from "./equality";
3
4
  import { COMBINATOR_KEYS, NON_STRUCTURAL_SCHEMA_KEYS } from "./fields";
@@ -26,7 +27,7 @@ export function StringEnum<const T extends readonly string[]>(
26
27
  });
27
28
  }
28
29
 
29
- export const NO_STRICT = Bun.env.PI_NO_STRICT === "1";
30
+ export const NO_STRICT = $flag("PI_NO_STRICT");
30
31
 
31
32
  const strictSchemaCache = new WeakMap<Record<string, unknown>, { schema: Record<string, unknown>; strict: boolean }>();
32
33
  function hasUnrepresentableStrictObjectMap(schema: Record<string, unknown>, seen?: WeakSet<object>): boolean {