@skydiveai/pi-server 0.1.251-beta.1 → 0.1.251-beta.3

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/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Logger, Logger as Logger$1 } from "pino";
2
- import { Api, KnownProvider, Model } from "@earendil-works/pi-ai";
3
2
  import { z } from "zod";
3
+ import { Api, KnownProvider, Model } from "@earendil-works/pi-ai";
4
4
  import { SessionManager, ToolDefinition, createAgentSession } from "@earendil-works/pi-coding-agent";
5
5
  import { AgentExecutor } from "@a2a-js/sdk/server";
6
6
  import { AgentCard } from "@a2a-js/sdk";
@@ -8,7 +8,7 @@ import { IncomingMessage, ServerResponse } from "node:http";
8
8
 
9
9
  //#region src/constants.d.ts
10
10
  declare const DEFAULT_PROVIDER = "anthropic";
11
- declare const DEFAULT_MODEL = "claude-opus-4-7";
11
+ declare const DEFAULT_MODEL = "claude-opus-5";
12
12
  declare const DEFAULT_THINKING_LEVEL = "medium";
13
13
  declare const VALID_THINKING_LEVELS: readonly ["off", "minimal", "low", "medium", "high", "xhigh"];
14
14
  declare const PI_AGENT_DIR: string;
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { randomBytes, randomUUID } from "node:crypto";
2
2
  import { pino } from "pino";
3
3
  import { AsyncLocalStorage } from "node:async_hooks";
4
- import { getModel } from "@earendil-works/pi-ai";
4
+ import { getBuiltinModel } from "@earendil-works/pi-ai/providers/all";
5
5
  import { z } from "zod";
6
6
  import { homedir } from "node:os";
7
7
  import { join } from "node:path";
@@ -180,7 +180,7 @@ function createPrewarm({ paths, chatCompletions }) {
180
180
  //#endregion
181
181
  //#region src/constants.ts
182
182
  const DEFAULT_PROVIDER = "anthropic";
183
- const DEFAULT_MODEL = "claude-opus-4-7";
183
+ const DEFAULT_MODEL = "claude-opus-5";
184
184
  const DEFAULT_THINKING_LEVEL = "medium";
185
185
  const VALID_THINKING_LEVELS = [
186
186
  "off",
@@ -322,7 +322,7 @@ function resolveModel(modelString, log) {
322
322
  let name = raw;
323
323
  const sep = raw.match(/[:/]/);
324
324
  if (sep) [provider, name] = raw.split(sep[0], 2);
325
- const found = getModel(provider, name);
325
+ const found = getBuiltinModel(provider, name);
326
326
  if (found) return found;
327
327
  log.warn({
328
328
  event: "model_unknown",
@@ -331,7 +331,7 @@ function resolveModel(modelString, log) {
331
331
  fallback_provider: DEFAULT_PROVIDER,
332
332
  fallback_model: DEFAULT_MODEL
333
333
  }, "unknown model, falling back to default");
334
- return getModel(DEFAULT_PROVIDER, DEFAULT_MODEL);
334
+ return getBuiltinModel(DEFAULT_PROVIDER, DEFAULT_MODEL);
335
335
  }
336
336
  const contextWindowSchema = z.number().int().positive();
337
337
  function applyContextWindowOverride(model, contextWindow) {
@@ -978,13 +978,17 @@ function isModelProviderError(err) {
978
978
  if (numericStatus(e) !== null) return true;
979
979
  if (e.error && typeof e.error === "object") return true;
980
980
  const msg = messageText(err);
981
- return /prompt is too long|context[_ ]length[_ ]exceeded|exceeds maximum token limit|input token count|rate[_ ]limit|overloaded|no healthy upstream|upstream request timeout|insufficient credits|requires more credits|credit balance is too low|payment required|purchase more credits/i.test(msg) || CONTENT_FILTER_MESSAGE.test(msg);
981
+ return /^\s*4\d{2}\s|invalid_request_error|\bINVALID_ARGUMENT\b|prompt is too long|context[_ ]length[_ ]exceeded|exceeds maximum token limit|input token count|rate[_ ]limit|overloaded|no healthy upstream|upstream request timeout|insufficient credits|requires more credits|credit balance is too low|payment required|purchase more credits/i.test(msg) || CONTENT_FILTER_MESSAGE.test(msg);
982
982
  }
983
983
  /** Build the structured, forwardable error from a thrown model-provider error. */
984
984
  function toModelProviderError(err) {
985
985
  const e = err ?? {};
986
- const status = numericStatus(e);
986
+ let status = numericStatus(e);
987
987
  const message = messageText(err);
988
+ if (status === null) {
989
+ const m = /^\s*(4\d{2}|5\d{2}|529)\b/.exec(message);
990
+ if (m) status = Number(m[1]);
991
+ }
988
992
  return {
989
993
  code: classifyCode(status, message, machineCode(e)),
990
994
  message,
@@ -1145,7 +1149,7 @@ async function handleMessages(request, ctx, registry) {
1145
1149
  defaultModel: ctx.defaultModel,
1146
1150
  log
1147
1151
  });
1148
- const modelName = model.id ?? "claude-opus-4-7";
1152
+ const modelName = model.id ?? "claude-opus-5";
1149
1153
  const baseSystemPrompt = extractSystemPrompt(system);
1150
1154
  const { sessionId } = parseSessionId(request);
1151
1155
  const shellEnv = parseShellEnv(request);
@@ -1925,7 +1929,7 @@ async function handleChatCompletions(request, ctx, registry, pendingSteerIds) {
1925
1929
  prefixes: ctx.passthroughHeaderPrefixes ?? []
1926
1930
  });
1927
1931
  const thinkingLevel = resolveThinkingLevel(thinkingInput);
1928
- const modelName = model.id ?? "claude-opus-4-7";
1932
+ const modelName = model.id ?? "claude-opus-5";
1929
1933
  const requestSystemPrompts = [];
1930
1934
  for (const m of messages) if (m?.role === "system") {
1931
1935
  const text = extractAssistantText(m.content);
@@ -2685,7 +2689,7 @@ async function handleResponses(request, ctx, registry) {
2685
2689
  defaultModel: ctx.defaultModel,
2686
2690
  log
2687
2691
  });
2688
- const modelName = model.id ?? "claude-opus-4-7";
2692
+ const modelName = model.id ?? "claude-opus-5";
2689
2693
  const { sessionId } = parseSessionId(request);
2690
2694
  const shellEnv = parseShellEnv(request);
2691
2695
  const { session } = await ctx.createSession({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skydiveai/pi-server",
3
- "version": "0.1.251-beta.1",
3
+ "version": "0.1.251-beta.3",
4
4
  "homepage": "https://skydive.com",
5
5
  "license": "MIT",
6
6
  "author": "Create, Inc.",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@a2a-js/sdk": "^0.3.13",
30
- "@earendil-works/pi-ai": "0.74.0",
30
+ "@earendil-works/pi-ai": "0.84.2",
31
31
  "pino": "^9.6.0",
32
32
  "zod": "^3.25.0"
33
33
  },