@f5-sales-demo/pi-ai 19.51.2 → 19.51.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 +2 -2
- package/src/auth-storage.ts +1 -1
- package/src/cli.ts +9 -9
- package/src/model-cache.ts +1 -1
- package/src/providers/amazon-bedrock.ts +1 -1
- package/src/providers/anthropic.ts +1 -1
- package/src/providers/azure-openai-responses.ts +2 -2
- package/src/providers/cursor.ts +1 -1
- package/src/providers/google-gemini-cli.ts +1 -1
- package/src/providers/google-vertex.ts +1 -1
- package/src/providers/openai-codex-responses.ts +1 -1
- package/src/providers/openai-completions.ts +1 -1
- package/src/providers/openai-responses-shared.ts +1 -1
- package/src/providers/openai-responses.ts +2 -2
- package/src/stream.ts +1 -1
- package/src/usage/kimi.ts +1 -1
- package/src/utils/anthropic-auth.ts +1 -1
- package/src/utils/discovery/gemini.ts +1 -1
- package/src/utils/discovery/openai-compatible.ts +1 -1
- package/src/utils/http-inspector.ts +1 -1
- package/src/utils/idle-iterator.ts +1 -1
- package/src/utils/oauth/github-copilot.ts +1 -1
- package/src/utils/oauth/google-gemini-cli.ts +1 -1
- package/src/utils/oauth/kimi.ts +1 -1
- package/src/utils/oauth/perplexity.ts +1 -1
- package/src/utils/schema/normalize-cca.ts +1 -1
- package/src/utils/schema/strict-mode.ts +1 -1
- package/src/utils/validation.ts +1 -1
- package/src/utils.ts +2 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@f5-sales-demo/pi-ai",
|
|
4
|
-
"version": "19.51.
|
|
4
|
+
"version": "19.51.4",
|
|
5
5
|
"description": "Unified LLM API with automatic model discovery and provider configuration",
|
|
6
6
|
"homepage": "https://github.com/f5-sales-demo/xcsh",
|
|
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
|
-
"@f5-sales-demo/pi-utils": "
|
|
48
|
+
"@f5-sales-demo/pi-utils": "19.51.4",
|
|
49
49
|
"@sinclair/typebox": "^0.34",
|
|
50
50
|
"@smithy/node-http-handler": "^4.4",
|
|
51
51
|
"ajv": "^8.20",
|
package/src/auth-storage.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { Database, type Statement } from "bun:sqlite";
|
|
11
11
|
import * as fs from "node:fs/promises";
|
|
12
12
|
import * as path from "node:path";
|
|
13
|
-
import { getAgentDbPath, logger } from "@
|
|
13
|
+
import { getAgentDbPath, logger } from "@f5-sales-demo/pi-utils";
|
|
14
14
|
import { getEnvApiKey } from "./stream";
|
|
15
15
|
import type { Provider } from "./types";
|
|
16
16
|
import type {
|
package/src/cli.ts
CHANGED
|
@@ -323,7 +323,7 @@ async function main(): Promise<void> {
|
|
|
323
323
|
const command = args[0];
|
|
324
324
|
|
|
325
325
|
if (!command || command === "help" || command === "--help" || command === "-h") {
|
|
326
|
-
console.log(`Usage: bunx @
|
|
326
|
+
console.log(`Usage: bunx @f5-sales-demo/pi-ai <command> [provider]
|
|
327
327
|
|
|
328
328
|
Commands:
|
|
329
329
|
login [provider] Login to a provider
|
|
@@ -349,11 +349,11 @@ Providers:
|
|
|
349
349
|
zenmux ZenMux
|
|
350
350
|
|
|
351
351
|
Examples:
|
|
352
|
-
bunx @
|
|
353
|
-
bunx @
|
|
354
|
-
bunx @
|
|
355
|
-
bunx @
|
|
356
|
-
bunx @
|
|
352
|
+
bunx @f5-sales-demo/pi-ai login # interactive provider selection
|
|
353
|
+
bunx @f5-sales-demo/pi-ai login anthropic # login to specific provider
|
|
354
|
+
bunx @f5-sales-demo/pi-ai logout anthropic # logout from specific provider
|
|
355
|
+
bunx @f5-sales-demo/pi-ai status # show logged-in providers
|
|
356
|
+
bunx @f5-sales-demo/pi-ai list # list providers
|
|
357
357
|
`);
|
|
358
358
|
return;
|
|
359
359
|
}
|
|
@@ -364,7 +364,7 @@ Examples:
|
|
|
364
364
|
const providers = storage.listProviders();
|
|
365
365
|
if (providers.length === 0) {
|
|
366
366
|
console.log("No credentials stored.");
|
|
367
|
-
console.log(`Use 'bunx @
|
|
367
|
+
console.log(`Use 'bunx @f5-sales-demo/pi-ai login' to authenticate.`);
|
|
368
368
|
} else {
|
|
369
369
|
console.log("Logged-in providers:\n");
|
|
370
370
|
for (const provider of providers) {
|
|
@@ -473,7 +473,7 @@ Examples:
|
|
|
473
473
|
|
|
474
474
|
if (!PROVIDERS.some(p => p.id === provider)) {
|
|
475
475
|
console.error(`Unknown provider: ${provider}`);
|
|
476
|
-
console.error(`Use 'bunx @
|
|
476
|
+
console.error(`Use 'bunx @f5-sales-demo/pi-ai list' to see available providers`);
|
|
477
477
|
process.exit(1);
|
|
478
478
|
}
|
|
479
479
|
|
|
@@ -483,7 +483,7 @@ Examples:
|
|
|
483
483
|
}
|
|
484
484
|
|
|
485
485
|
console.error(`Unknown command: ${command}`);
|
|
486
|
-
console.error(`Use 'bunx @
|
|
486
|
+
console.error(`Use 'bunx @f5-sales-demo/pi-ai --help' for usage`);
|
|
487
487
|
process.exit(1);
|
|
488
488
|
}
|
|
489
489
|
|
package/src/model-cache.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Replaces per-provider JSON files with a single cache.db.
|
|
4
4
|
*/
|
|
5
5
|
import { Database } from "bun:sqlite";
|
|
6
|
-
import { getModelDbPath } from "@
|
|
6
|
+
import { getModelDbPath } from "@f5-sales-demo/pi-utils";
|
|
7
7
|
import type { Api, Model } from "./types";
|
|
8
8
|
|
|
9
9
|
const CACHE_SCHEMA_VERSION = 2;
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
type ToolConfiguration,
|
|
20
20
|
ToolResultStatus,
|
|
21
21
|
} from "@aws-sdk/client-bedrock-runtime";
|
|
22
|
-
import { $env, $flag } from "@
|
|
22
|
+
import { $env, $flag } from "@f5-sales-demo/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";
|
|
@@ -7,7 +7,7 @@ import type {
|
|
|
7
7
|
MessageCreateParamsStreaming,
|
|
8
8
|
MessageParam,
|
|
9
9
|
} from "@anthropic-ai/sdk/resources/messages";
|
|
10
|
-
import { $env, abortableSleep, isEnoent } from "@
|
|
10
|
+
import { $env, abortableSleep, isEnoent } from "@f5-sales-demo/pi-utils";
|
|
11
11
|
import { mapEffortToAnthropicAdaptiveEffort } from "../model-thinking";
|
|
12
12
|
import { calculateCost } from "../models";
|
|
13
13
|
import { getEnvApiKey, OUTPUT_FALLBACK_BUFFER } from "../stream";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $env } from "@
|
|
1
|
+
import { $env } from "@f5-sales-demo/pi-utils";
|
|
2
2
|
import { AzureOpenAI } from "openai";
|
|
3
3
|
import type {
|
|
4
4
|
Tool as OpenAITool,
|
|
@@ -313,7 +313,7 @@ function buildParams(
|
|
|
313
313
|
// Always request encrypted reasoning content so reasoning items can be
|
|
314
314
|
// replayed in multi-turn conversations when store is false (items aren't
|
|
315
315
|
// persisted server-side, so we must include the full content).
|
|
316
|
-
// See: https://github.com/
|
|
316
|
+
// See: https://github.com/f5-sales-demo/xcsh/issues/41
|
|
317
317
|
params.include = ["reasoning.encrypted_content"];
|
|
318
318
|
|
|
319
319
|
if (options?.reasoning || options?.reasoningSummary) {
|
package/src/providers/cursor.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as fs from "node:fs/promises";
|
|
|
3
3
|
import http2 from "node:http2";
|
|
4
4
|
import { create, fromBinary, fromJson, type JsonValue, toBinary, toJson } from "@bufbuild/protobuf";
|
|
5
5
|
import { ValueSchema } from "@bufbuild/protobuf/wkt";
|
|
6
|
-
import { $env } from "@
|
|
6
|
+
import { $env } from "@f5-sales-demo/pi-utils";
|
|
7
7
|
import { calculateCost } from "../models";
|
|
8
8
|
import type {
|
|
9
9
|
Api,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Uses the Cloud Code Assist API endpoint to access Gemini and Claude models.
|
|
5
5
|
*/
|
|
6
6
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
7
|
-
import { abortableSleep, readSseJson } from "@
|
|
7
|
+
import { abortableSleep, readSseJson } from "@f5-sales-demo/pi-utils";
|
|
8
8
|
import type { Content, FunctionCallingConfigMode, ThinkingConfig } from "@google/genai";
|
|
9
9
|
import { calculateCost } from "../models";
|
|
10
10
|
import type {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $env, structuredCloneJSON } from "@
|
|
1
|
+
import { $env, structuredCloneJSON } from "@f5-sales-demo/pi-utils";
|
|
2
2
|
import OpenAI from "openai";
|
|
3
3
|
import type {
|
|
4
4
|
Tool as OpenAITool,
|
|
@@ -381,7 +381,7 @@ function buildParams(
|
|
|
381
381
|
// Always request encrypted reasoning content so reasoning items can be
|
|
382
382
|
// replayed in multi-turn conversations when store is false (items aren't
|
|
383
383
|
// persisted server-side, so we must include the full content).
|
|
384
|
-
// See: https://github.com/
|
|
384
|
+
// See: https://github.com/f5-sales-demo/xcsh/issues/41
|
|
385
385
|
params.include = ["reasoning.encrypted_content"];
|
|
386
386
|
|
|
387
387
|
if (options?.reasoning || options?.reasoningSummary) {
|
package/src/stream.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
2
|
import * as os from "node:os";
|
|
3
3
|
import * as path from "node:path";
|
|
4
|
-
import { $env, $pickenv } from "@
|
|
4
|
+
import { $env, $pickenv } from "@f5-sales-demo/pi-utils";
|
|
5
5
|
import { getCustomApi } from "./api-registry";
|
|
6
6
|
import type { Effort } from "./model-thinking";
|
|
7
7
|
import {
|
package/src/usage/kimi.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* 6. Anthropic provider credentials from models.yml
|
|
11
11
|
* 7. LiteLLM passthrough (LITELLM_BASE_URL / LITELLM_API_KEY)
|
|
12
12
|
*/
|
|
13
|
-
import { $env, getAgentDbPath, readProviderFromModelsYml } from "@
|
|
13
|
+
import { $env, getAgentDbPath, readProviderFromModelsYml } from "@f5-sales-demo/pi-utils";
|
|
14
14
|
import { type AuthCredential, AuthCredentialStore } from "../auth-storage";
|
|
15
15
|
import {
|
|
16
16
|
buildAnthropicHeaders as buildProviderAnthropicHeaders,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UNK_CONTEXT_WINDOW, UNK_MAX_TOKENS } from "@
|
|
1
|
+
import { UNK_CONTEXT_WINDOW, UNK_MAX_TOKENS } from "@f5-sales-demo/pi-ai";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { getBundledModels } from "../../models";
|
|
4
4
|
import type { Model } from "../../types";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as path from "node:path";
|
|
2
|
-
import { getLogsDir } from "@
|
|
2
|
+
import { getLogsDir } from "@f5-sales-demo/pi-utils";
|
|
3
3
|
import { extractHttpStatusFromError } from "./retry.js";
|
|
4
4
|
import { formatErrorMessageWithRetryAfter } from "./retry-after.js";
|
|
5
5
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GitHub Copilot OAuth flow (opencode OAuth app)
|
|
3
3
|
*/
|
|
4
|
-
import { abortableSleep } from "@
|
|
4
|
+
import { abortableSleep } from "@f5-sales-demo/pi-utils";
|
|
5
5
|
import { getBundledModels } from "../../models";
|
|
6
6
|
import type { OAuthCredentials } from "./types";
|
|
7
7
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Standard Gemini models only (gemini-2.0-flash, gemini-2.5-*)
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { $env } from "@
|
|
6
|
+
import { $env } from "@f5-sales-demo/pi-utils";
|
|
7
7
|
import { getGeminiCliHeaders } from "../../providers/google-gemini-cli";
|
|
8
8
|
import { OAuthCallbackFlow } from "./callback-server";
|
|
9
9
|
import type { OAuthController, OAuthCredentials } from "./types";
|
package/src/utils/oauth/kimi.ts
CHANGED
|
@@ -6,7 +6,7 @@ import * as crypto from "node:crypto";
|
|
|
6
6
|
import * as fs from "node:fs/promises";
|
|
7
7
|
import * as os from "node:os";
|
|
8
8
|
import * as path from "node:path";
|
|
9
|
-
import { $env, abortableSleep, getAgentDir, isEnoent } from "@
|
|
9
|
+
import { $env, abortableSleep, getAgentDir, isEnoent } from "@f5-sales-demo/pi-utils";
|
|
10
10
|
import packageJson from "../../../package.json" with { type: "json" };
|
|
11
11
|
import type { OAuthController, OAuthCredentials } from "./types";
|
|
12
12
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* Architecture reverse-engineered from Perplexity macOS app (ai.perplexity.mac).
|
|
13
13
|
*/
|
|
14
14
|
import * as os from "node:os";
|
|
15
|
-
import { $env } from "@
|
|
15
|
+
import { $env } from "@f5-sales-demo/pi-utils";
|
|
16
16
|
import { $ } from "bun";
|
|
17
17
|
import type { OAuthController, OAuthCredentials } from "./types";
|
|
18
18
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $flag } from "@
|
|
1
|
+
import { $flag } from "@f5-sales-demo/pi-utils";
|
|
2
2
|
import { type TUnsafe, Type } from "@sinclair/typebox";
|
|
3
3
|
import { areJsonValuesEqual } from "./equality";
|
|
4
4
|
import { COMBINATOR_KEYS, NON_STRUCTURAL_SCHEMA_KEYS } from "./fields";
|
package/src/utils/validation.ts
CHANGED
package/src/utils.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { $env } from "@
|
|
1
|
+
import { $env } from "@f5-sales-demo/pi-utils";
|
|
2
2
|
import type { ResponseInput } from "openai/resources/responses/responses";
|
|
3
3
|
import type { CacheRetention, OpenAIResponsesHistoryPayload, ProviderPayload } from "./types";
|
|
4
4
|
|
|
5
5
|
type OpenAIResponsesReplayItem = ResponseInput[number];
|
|
6
6
|
|
|
7
|
-
export { isRecord } from "@
|
|
7
|
+
export { isRecord } from "@f5-sales-demo/pi-utils";
|
|
8
8
|
|
|
9
9
|
export function toNumber(value: unknown): number | undefined {
|
|
10
10
|
if (typeof value === "number" && Number.isFinite(value)) return value;
|