Compare commits

..
Author SHA1 Message Date
yiling 0899a7e59d feat(provider): refresh models from the public Pi catalog 2026-11-29 18:49:27 +08:00
21 changed files with 374 additions and 319 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
### Changed ### Changed
- **provider**: Refresh and add new models from individual AI providers in Settings, and see which providers have credentials configured. - **provider**: Refresh models for individual AI providers in Settings and choose which models to add. Use Add Provider to set up a new provider.
## [0.7.2] - 2026-11-27 ## [0.7.2] - 2026-11-27
-1
View File
@@ -8,7 +8,6 @@ WORKDIR /app
COPY package.json bun.lock ./ COPY package.json bun.lock ./
COPY --parents packages/*/package.json ./ COPY --parents packages/*/package.json ./
COPY --parents apps/*/package.json ./ COPY --parents apps/*/package.json ./
COPY patches ./patches
# Install dependencies (including devDependencies for build tools) # Install dependencies (including devDependencies for build tools)
RUN bun install --frozen-lockfile RUN bun install --frozen-lockfile
-1
View File
@@ -8,7 +8,6 @@ WORKDIR /app
COPY package.json bun.lock ./ COPY package.json bun.lock ./
COPY --parents packages/*/package.json ./ COPY --parents packages/*/package.json ./
COPY --parents apps/*/package.json ./ COPY --parents apps/*/package.json ./
COPY patches ./patches
# Install dependencies (including devDependencies for build tools) # Install dependencies (including devDependencies for build tools)
RUN bun install --frozen-lockfile RUN bun install --frozen-lockfile
@@ -31,7 +31,6 @@ test('provider cards show credential status and open a scrollable preview for th
const models = Array.from({ length: 48 }, (_, index): RefreshedProviderModel => ({ const models = Array.from({ length: 48 }, (_, index): RefreshedProviderModel => ({
modelId: `test-model-${index + 1}`, modelId: `test-model-${index + 1}`,
name: `Test Model ${index + 1}`, name: `Test Model ${index + 1}`,
selectionToken: `preview-token-${index + 1}`,
config: { config: {
reasoning: false, reasoning: false,
input: ['text'], input: ['text'],
@@ -46,7 +45,9 @@ test('provider cards show credential status and open a scrollable preview for th
`**/api/teams/${teamId}/providers/${provider.id}/models/refresh`, `**/api/teams/${teamId}/providers/${provider.id}/models/refresh`,
async (route) => { async (route) => {
await releasePreview.promise await releasePreview.promise
await route.fulfill({ json: { status: 'ready', models } }) await route.fulfill({
json: { status: 'ready', providerUpdatedAt: provider.updatedAt.toISOString(), models },
})
}, },
) )
await page.goto(`/teams/${teamId}/settings#providers`) await page.goto(`/teams/${teamId}/settings#providers`)
@@ -57,8 +58,8 @@ test('provider cards show credential status and open a scrollable preview for th
const refresh = openai.getByRole('button', { name: /Refresh models for OpenAI production/ }) const refresh = openai.getByRole('button', { name: /Refresh models for OpenAI production/ })
await expect(cards.first()).toContainText(provider.name) await expect(cards.first()).toContainText(provider.name)
await expect(openai.getByText('Configured', { exact: true })).toBeVisible() await expect(openai.getByText('Configured', { exact: true })).toBeVisible()
await expect(anthropic.getByText('Set an API key to refresh models.')).toBeVisible() await expect(anthropic.getByText('Configured', { exact: true })).toHaveCount(0)
await expect(anthropic.getByRole('button', { name: /Refresh models/ })).toBeDisabled() await expect(anthropic.getByRole('button', { name: /Refresh models/ })).toBeEnabled()
await refresh.focus() await refresh.focus()
await page.keyboard.press('Enter') await page.keyboard.press('Enter')
+2 -46
View File
@@ -216,7 +216,6 @@
"@better-auth/oauth-provider": "1.7.12", "@better-auth/oauth-provider": "1.7.12",
"@earendil-works/chord": "1.7.0", "@earendil-works/chord": "1.7.0",
"@earendil-works/pi-ai": "1.7.0", "@earendil-works/pi-ai": "1.7.0",
"@earendil-works/pi-coding-agent": "1.7.0",
"@earendil-works/pi-durable": "1.7.0", "@earendil-works/pi-durable": "1.7.0",
"@google/genai": "2.28.0", "@google/genai": "2.28.0",
"@modelcontextprotocol/client": "2.0.0", "@modelcontextprotocol/client": "2.0.0",
@@ -432,9 +431,6 @@
}, },
}, },
}, },
"patchedDependencies": {
"@earendil-works/pi-coding-agent@1.7.0": "patches/@earendil-works%2Fpi-coding-agent@1.7.0.patch",
},
"packages": { "packages": {
"@adobe/premierepro": ["@adobe/premierepro@26.3.0", "", {}, "sha512-J84zEX8R4L5EU5EVVs3AWkd4LRoXPKueo28jPNfwwDAo69TOSNsAblImtsAmJR4HGDDazsvHkMQE3JBJqIcB9Q=="], "@adobe/premierepro": ["@adobe/premierepro@26.3.0", "", {}, "sha512-J84zEX8R4L5EU5EVVs3AWkd4LRoXPKueo28jPNfwwDAo69TOSNsAblImtsAmJR4HGDDazsvHkMQE3JBJqIcB9Q=="],
@@ -624,24 +620,16 @@
"@earendil-works/chord": ["@earendil-works/chord@1.7.0", "", { "dependencies": { "@earendil-works/pi-schema": "1.7.0", "@earendil-works/pi-telemetry": "1.7.0" }, "peerDependencies": { "esbuild": "^0.28.2", "react": "^19.3.0", "ws": "^8.21.0" }, "optionalPeers": ["esbuild", "react", "ws"] }, "sha512-/zBlRrJkNbw0dJ4OrUzk08PC48mzOIFZQKTUE1qxQUWoPlf/xms95lEigzC30MllS+k5qqih7Clg0cTzYgPs1w=="], "@earendil-works/chord": ["@earendil-works/chord@1.7.0", "", { "dependencies": { "@earendil-works/pi-schema": "1.7.0", "@earendil-works/pi-telemetry": "1.7.0" }, "peerDependencies": { "esbuild": "^0.28.2", "react": "^19.3.0", "ws": "^8.21.0" }, "optionalPeers": ["esbuild", "react", "ws"] }, "sha512-/zBlRrJkNbw0dJ4OrUzk08PC48mzOIFZQKTUE1qxQUWoPlf/xms95lEigzC30MllS+k5qqih7Clg0cTzYgPs1w=="],
"@earendil-works/pi-agent-core": ["@earendil-works/pi-agent-core@1.7.0", "", { "dependencies": { "@earendil-works/pi-ai": "1.7.0", "@earendil-works/pi-schema": "1.7.0" } }, "sha512-pLs/wTAcrUnKDILPHjnd7RiDZSotAhJ965LwVc8x37TeWF+k+vKPMmAW6Z1T8XMQuICbIYusjkT7K0lmjgQwrg=="],
"@earendil-works/pi-ai": ["@earendil-works/pi-ai@1.7.0", "", { "dependencies": { "@anthropic-ai/sdk": "0.129.0", "@aws-sdk/client-bedrock-runtime": "3.1127.0", "@aws-sdk/credential-provider-node": "3.972.82", "@earendil-works/pi-schema": "1.7.0", "@earendil-works/pi-telemetry": "1.7.0", "@google/genai": "3.6.1", "@smithy/node-http-handler": "4.12.1", "http-proxy-agent": "9.1.0", "https-proxy-agent": "9.1.0", "openai": "7.59.0", "partial-json": "0.1.7" }, "bin": { "pi-ai": "dist/cli.js" } }, "sha512-iKryMlUYniwWbU7YU0uS7W0+cGd9c6oJ6PzRLOn8j4+1njG4c+BQq1cNawctx/npDqGeOx8ME7Gkgl6K6arPuw=="], "@earendil-works/pi-ai": ["@earendil-works/pi-ai@1.7.0", "", { "dependencies": { "@anthropic-ai/sdk": "0.129.0", "@aws-sdk/client-bedrock-runtime": "3.1127.0", "@aws-sdk/credential-provider-node": "3.972.82", "@earendil-works/pi-schema": "1.7.0", "@earendil-works/pi-telemetry": "1.7.0", "@google/genai": "3.6.1", "@smithy/node-http-handler": "4.12.1", "http-proxy-agent": "9.1.0", "https-proxy-agent": "9.1.0", "openai": "7.59.0", "partial-json": "0.1.7" }, "bin": { "pi-ai": "dist/cli.js" } }, "sha512-iKryMlUYniwWbU7YU0uS7W0+cGd9c6oJ6PzRLOn8j4+1njG4c+BQq1cNawctx/npDqGeOx8ME7Gkgl6K6arPuw=="],
"@earendil-works/pi-codemode": ["@earendil-works/pi-codemode@1.7.0", "", { "dependencies": { "quickjs-wasi": "3.6.2" } }, "sha512-fhCoh8TLxhdRTOWSEplwp39Uv+JTsu9pCqtgu9gorO8zcaw92vsbVI/G89yFs92csTo2+yB7EsJq/+725Vj+eA=="], "@earendil-works/pi-codemode": ["@earendil-works/pi-codemode@1.7.0", "", { "dependencies": { "quickjs-wasi": "3.6.2" } }, "sha512-fhCoh8TLxhdRTOWSEplwp39Uv+JTsu9pCqtgu9gorO8zcaw92vsbVI/G89yFs92csTo2+yB7EsJq/+725Vj+eA=="],
"@earendil-works/pi-coding-agent": ["@earendil-works/pi-coding-agent@1.7.0", "", { "dependencies": { "@earendil-works/pi-agent-core": "1.7.0", "@earendil-works/pi-ai": "1.7.0", "@earendil-works/pi-codemode": "1.7.0", "@earendil-works/pi-mcp": "1.7.0", "@earendil-works/pi-tui": "1.7.0", "@silvia-odwyer/photon-node": "0.3.4", "brace-expansion": "5.0.12", "chalk": "6.0.0", "cross-spawn": "7.0.6", "diff": "8.0.4", "highlight.js": "10.7.3", "hosted-git-info": "9.0.3", "ignore": "7.0.8", "jiti": "2.7.0", "lovely-mermaid": "0.3.3", "minimatch": "11.0.3", "proper-lockfile": "4.1.2", "quickjs-wasi": "3.6.2", "semver": "7.8.5", "typebox": "1.3.27", "undici": "8.12.4", "yaml": "2.9.0" }, "bin": { "pi": "dist/bundle/cli.js" } }, "sha512-opRelA1oqV/o+cByICMYU87oiHuICeCkghHMqsZsDwDz9F6qo8HFhoH4J/wZkr6tBeFor7ryOSwEmpZsusYrbA=="],
"@earendil-works/pi-durable": ["@earendil-works/pi-durable@1.7.0", "", { "dependencies": { "@earendil-works/chord": "1.7.0", "@earendil-works/pi-ai": "1.7.0", "@earendil-works/pi-codemode": "1.7.0", "@earendil-works/pi-schema": "1.7.0", "@earendil-works/pi-telemetry": "1.7.0", "@silvia-odwyer/photon": "0.3.3", "diff": "8.0.4" } }, "sha512-qL9PlFfXrirBNt7QR2bjZfviN6ZVcsGTHEqaj6U4Lxqqx9Vtth7LyIuGNlG2chDKMr3/ABamH8qZ9ggMgTGDOQ=="], "@earendil-works/pi-durable": ["@earendil-works/pi-durable@1.7.0", "", { "dependencies": { "@earendil-works/chord": "1.7.0", "@earendil-works/pi-ai": "1.7.0", "@earendil-works/pi-codemode": "1.7.0", "@earendil-works/pi-schema": "1.7.0", "@earendil-works/pi-telemetry": "1.7.0", "@silvia-odwyer/photon": "0.3.3", "diff": "8.0.4" } }, "sha512-qL9PlFfXrirBNt7QR2bjZfviN6ZVcsGTHEqaj6U4Lxqqx9Vtth7LyIuGNlG2chDKMr3/ABamH8qZ9ggMgTGDOQ=="],
"@earendil-works/pi-mcp": ["@earendil-works/pi-mcp@1.7.0", "", { "dependencies": { "cross-spawn": "7.0.6" } }, "sha512-ScsDjuFXjT9eKioD5oyZqofDXtaWCMhCBa+1aDSh7WmRACLsohfGQJtAX1rv5OmEbaerrRPgyD5jgwJFBjTFNw=="],
"@earendil-works/pi-schema": ["@earendil-works/pi-schema@1.7.0", "", {}, "sha512-skji4McLg9jum3NFWzFa/4QRGEZhMGnSi3QL8b9VljJkc/QopH2/BFuGKI+VcEwYzKGwsd0I8RzvXGnZGfGltQ=="], "@earendil-works/pi-schema": ["@earendil-works/pi-schema@1.7.0", "", {}, "sha512-skji4McLg9jum3NFWzFa/4QRGEZhMGnSi3QL8b9VljJkc/QopH2/BFuGKI+VcEwYzKGwsd0I8RzvXGnZGfGltQ=="],
"@earendil-works/pi-telemetry": ["@earendil-works/pi-telemetry@1.7.0", "", {}, "sha512-QZkngqktohuFZ2TZuJSXDuUntld4sCMW1tkUPaD4moMEX/z1lwcjycXnd9ChO9HNxm/Jfo+UTiC+N2hkAF9b0w=="], "@earendil-works/pi-telemetry": ["@earendil-works/pi-telemetry@1.7.0", "", {}, "sha512-QZkngqktohuFZ2TZuJSXDuUntld4sCMW1tkUPaD4moMEX/z1lwcjycXnd9ChO9HNxm/Jfo+UTiC+N2hkAF9b0w=="],
"@earendil-works/pi-tui": ["@earendil-works/pi-tui@1.7.0", "", { "dependencies": { "get-east-asian-width": "1.6.0", "marked": "18.0.11", "marked-cjk-friendly": "0.1.2" } }, "sha512-C6vkUYGTeDdl/cMIbFOabSEPMRy9HuaUV76PS2BhvSmWifO5y8Rz8/LgFWqGIIFS7RMqu0gdeEpdXfH8jIp05g=="],
"@electric-sql/pglite": ["@electric-sql/pglite@0.4.3", "", {}, "sha512-ichuWTgtd4mOM1G4SpyGJa5trT03lWbMypDV0fUXUCXg5hiHqVAz/bZyV68NqmkLB7WcYmj1RMJVSp8HV/v/ZQ=="], "@electric-sql/pglite": ["@electric-sql/pglite@0.4.3", "", {}, "sha512-ichuWTgtd4mOM1G4SpyGJa5trT03lWbMypDV0fUXUCXg5hiHqVAz/bZyV68NqmkLB7WcYmj1RMJVSp8HV/v/ZQ=="],
"@electric-sql/pglite-socket": ["@electric-sql/pglite-socket@0.1.3", "", { "peerDependencies": { "@electric-sql/pglite": "0.4.3" }, "bin": { "pglite-server": "dist/scripts/server.js" } }, "sha512-LAciWM0M1dCL8hlsxu2venbVZcdxema0BtDfpWYVqr+Y468UADw0pFWidhKw1M8sfJ8rdLT71tjMmnirf/IZRQ=="], "@electric-sql/pglite-socket": ["@electric-sql/pglite-socket@0.1.3", "", { "peerDependencies": { "@electric-sql/pglite": "0.4.3" }, "bin": { "pglite-server": "dist/scripts/server.js" } }, "sha512-LAciWM0M1dCL8hlsxu2venbVZcdxema0BtDfpWYVqr+Y468UADw0pFWidhKw1M8sfJ8rdLT71tjMmnirf/IZRQ=="],
@@ -760,8 +748,6 @@
"@isaacs/cliui": ["@isaacs/cliui@8.0.2", "", { "dependencies": { "string-width": "^5.1.2", "string-width-cjs": "npm:string-width@^4.2.0", "strip-ansi": "^7.0.1", "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", "wrap-ansi": "^8.1.0", "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" } }, "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA=="], "@isaacs/cliui": ["@isaacs/cliui@8.0.2", "", { "dependencies": { "string-width": "^5.1.2", "string-width-cjs": "npm:string-width@^4.2.0", "strip-ansi": "^7.0.1", "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", "wrap-ansi": "^8.1.0", "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" } }, "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA=="],
"@isaacs/nonrecursive-glob-match": ["@isaacs/nonrecursive-glob-match@1.1.0", "", {}, "sha512-GPm/Dbvk5RLmhRnxXIa7nTpK0xtl4E0wj0MslsuNiJ1FIROU+2+9lgUC/dgF7Ey4QCWhfEsgxilMRMCdHPfDfw=="],
"@jridgewell/gen-mapping": ["@jridgewell/gen-mapping@0.3.13", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA=="], "@jridgewell/gen-mapping": ["@jridgewell/gen-mapping@0.3.13", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA=="],
"@jridgewell/remapping": ["@jridgewell/remapping@2.3.5", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ=="], "@jridgewell/remapping": ["@jridgewell/remapping@2.3.5", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ=="],
@@ -1156,8 +1142,6 @@
"@silvia-odwyer/photon": ["@silvia-odwyer/photon@0.3.3", "", {}, "sha512-8BhUjEch4slwRe8uXnaA4vcA5uiiOTT90UMsxulOj2gN98X1p0q9Z4Ysk4DkD05uNgbR9XoSqtZ37w+33w4QKQ=="], "@silvia-odwyer/photon": ["@silvia-odwyer/photon@0.3.3", "", {}, "sha512-8BhUjEch4slwRe8uXnaA4vcA5uiiOTT90UMsxulOj2gN98X1p0q9Z4Ysk4DkD05uNgbR9XoSqtZ37w+33w4QKQ=="],
"@silvia-odwyer/photon-node": ["@silvia-odwyer/photon-node@0.3.4", "", {}, "sha512-bnly4BKB3KDTFxrUIcgCLbaeVVS8lrAkri1pEzskpmxu9MdfGQTy8b8EgcD83ywD3RPMsIulY8xJH5Awa+t9fA=="],
"@sinclair/typebox": ["@sinclair/typebox@0.34.52", "", {}, "sha512-XiMQh7qqVlxZzcVD+kkGMNGMzcTrDMLWI7S4x7z1MkCkbDPrekpZXEUK0eZqZFMuHQg2a2DZOcDIh9o5v3Gonw=="], "@sinclair/typebox": ["@sinclair/typebox@0.34.52", "", {}, "sha512-XiMQh7qqVlxZzcVD+kkGMNGMzcTrDMLWI7S4x7z1MkCkbDPrekpZXEUK0eZqZFMuHQg2a2DZOcDIh9o5v3Gonw=="],
"@sindresorhus/is": ["@sindresorhus/is@4.6.0", "", {}, "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw=="], "@sindresorhus/is": ["@sindresorhus/is@4.6.0", "", {}, "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw=="],
@@ -1718,7 +1702,7 @@
"bowser": ["bowser@2.14.1", "", {}, "sha512-tzPjzCxygAKWFOJP011oxFHs57HzIhOEracIgAePE4pqB3LikALKnSzUyU4MGs9/iCEUuHlAJTjTc5M+u7YEGg=="], "bowser": ["bowser@2.14.1", "", {}, "sha512-tzPjzCxygAKWFOJP011oxFHs57HzIhOEracIgAePE4pqB3LikALKnSzUyU4MGs9/iCEUuHlAJTjTc5M+u7YEGg=="],
"brace-expansion": ["brace-expansion@5.0.12", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ=="], "brace-expansion": ["brace-expansion@5.0.9", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg=="],
"brotli": ["brotli@1.3.3", "", { "dependencies": { "base64-js": "^1.1.2" } }, "sha512-oTKjJdShmDuGW94SyyaoQvAjf30dZaHnjJ8uAF+u2/vGJkJbJPJAT1gDiOJP5v1Zb6f9KEyW/1HpuaWIXtGHPg=="], "brotli": ["brotli@1.3.3", "", { "dependencies": { "base64-js": "^1.1.2" } }, "sha512-oTKjJdShmDuGW94SyyaoQvAjf30dZaHnjJ8uAF+u2/vGJkJbJPJAT1gDiOJP5v1Zb6f9KEyW/1HpuaWIXtGHPg=="],
@@ -1758,8 +1742,6 @@
"chai": ["chai@6.2.2", "", {}, "sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg=="], "chai": ["chai@6.2.2", "", {}, "sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg=="],
"chalk": ["chalk@6.0.0", "", {}, "sha512-2uNTXIuTTxk7ciZgAU1BQcgnchcG0xXnrs6jzkQfj9SsRa9M2s5zE8WT96hS6KmG4MzWHSrvH43DF1m4XRkrFg=="],
"char-regex": ["char-regex@1.0.2", "", {}, "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw=="], "char-regex": ["char-regex@1.0.2", "", {}, "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw=="],
"character-entities": ["character-entities@2.0.2", "", {}, "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ=="], "character-entities": ["character-entities@2.0.2", "", {}, "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ=="],
@@ -2104,8 +2086,6 @@
"get-caller-file": ["get-caller-file@2.0.5", "", {}, "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="], "get-caller-file": ["get-caller-file@2.0.5", "", {}, "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="],
"get-east-asian-width": ["get-east-asian-width@1.6.0", "", {}, "sha512-QRbvDIbx6YklUe6RxeTeleMR0yv3cYH6PsPZHcnVn7xv7zO1BHN8r0XETu8n6Ye3Q+ahtSarc3WgtNWmehIBfA=="],
"get-intrinsic": ["get-intrinsic@1.3.0", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.2", "es-define-property": "^1.0.1", "es-errors": "^1.3.0", "es-object-atoms": "^1.1.1", "function-bind": "^1.1.2", "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-symbols": "^1.1.0", "hasown": "^2.0.2", "math-intrinsics": "^1.1.0" } }, "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ=="], "get-intrinsic": ["get-intrinsic@1.3.0", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.2", "es-define-property": "^1.0.1", "es-errors": "^1.3.0", "es-object-atoms": "^1.1.1", "function-bind": "^1.1.2", "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-symbols": "^1.1.0", "hasown": "^2.0.2", "math-intrinsics": "^1.1.0" } }, "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ=="],
"get-nonce": ["get-nonce@1.0.1", "", {}, "sha512-FJhYRoDaiatfEkUK8HKlicmu/3SGFD51q3itKDGoSTysQJBnfOcxU5GxnhE1E6soB76MbT0MBtnKJuXyAx+96Q=="], "get-nonce": ["get-nonce@1.0.1", "", {}, "sha512-FJhYRoDaiatfEkUK8HKlicmu/3SGFD51q3itKDGoSTysQJBnfOcxU5GxnhE1E6soB76MbT0MBtnKJuXyAx+96Q=="],
@@ -2166,14 +2146,10 @@
"help-me": ["help-me@5.0.0", "", {}, "sha512-7xgomUX6ADmcYzFik0HzAxh/73YlKR9bmFzf51CZwR+b6YtzU2m0u49hQCqV6SvlqIqsaxovfwdvbnsw3b/zpg=="], "help-me": ["help-me@5.0.0", "", {}, "sha512-7xgomUX6ADmcYzFik0HzAxh/73YlKR9bmFzf51CZwR+b6YtzU2m0u49hQCqV6SvlqIqsaxovfwdvbnsw3b/zpg=="],
"highlight.js": ["highlight.js@10.7.3", "", {}, "sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A=="],
"hls.js": ["hls.js@1.7.3", "", {}, "sha512-MsPlx6yVW4Qv4C7mEVou4/gk/5cN2dVxOTnrNjPSmyH2f0Ln+/UkG10Ax1PE6OvrmTVPKgQYozTtBaPOuCzq7A=="], "hls.js": ["hls.js@1.7.3", "", {}, "sha512-MsPlx6yVW4Qv4C7mEVou4/gk/5cN2dVxOTnrNjPSmyH2f0Ln+/UkG10Ax1PE6OvrmTVPKgQYozTtBaPOuCzq7A=="],
"hono": ["hono@4.13.5", "", {}, "sha512-O6+/eCYRkzzzy0rPWwKLiGBR1nFuUPZynnwjxN1MBA62NNqbT0wQEzQyK2gSO5yDIDB336sXQleAhOHrzlYyKw=="], "hono": ["hono@4.13.5", "", {}, "sha512-O6+/eCYRkzzzy0rPWwKLiGBR1nFuUPZynnwjxN1MBA62NNqbT0wQEzQyK2gSO5yDIDB336sXQleAhOHrzlYyKw=="],
"hosted-git-info": ["hosted-git-info@9.0.3", "", { "dependencies": { "lru-cache": "^11.1.0" } }, "sha512-Hc+ghLoSt6QaYZUv0WBiIvmMDZuZZ7oaDvdH8MbfOO4lOsxdXLEvuC6ePoGs9H1X9oCLyq6+NVN0MKqD+ydxyg=="],
"html-url-attributes": ["html-url-attributes@3.0.1", "", {}, "sha512-ol6UPyBWqsrO6EJySPz2O7ZSr856WDrEzM5zMqp+FJJLGMW35cLYmmZnl0vztAZxRUoNZJFTCohfjuIJ8I4QBQ=="], "html-url-attributes": ["html-url-attributes@3.0.1", "", {}, "sha512-ol6UPyBWqsrO6EJySPz2O7ZSr856WDrEzM5zMqp+FJJLGMW35cLYmmZnl0vztAZxRUoNZJFTCohfjuIJ8I4QBQ=="],
"http-proxy-agent": ["http-proxy-agent@9.1.0", "", { "dependencies": { "agent-base": "9.0.0", "debug": "^4.3.4", "proxy-agent-negotiate": "1.1.0" } }, "sha512-2NxoveTT58mjYT4n3RPTEfCZGLMbidoO8XEieXfpSYxu+PQJ1qpx4ypwH6N+uF9twBPIvRRgvkvW5HUTYWENig=="], "http-proxy-agent": ["http-proxy-agent@9.1.0", "", { "dependencies": { "agent-base": "9.0.0", "debug": "^4.3.4", "proxy-agent-negotiate": "1.1.0" } }, "sha512-2NxoveTT58mjYT4n3RPTEfCZGLMbidoO8XEieXfpSYxu+PQJ1qpx4ypwH6N+uF9twBPIvRRgvkvW5HUTYWENig=="],
@@ -2380,9 +2356,7 @@
"loose-envify": ["loose-envify@1.4.0", "", { "dependencies": { "js-tokens": "^3.0.0 || ^4.0.0" }, "bin": { "loose-envify": "cli.js" } }, "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q=="], "loose-envify": ["loose-envify@1.4.0", "", { "dependencies": { "js-tokens": "^3.0.0 || ^4.0.0" }, "bin": { "loose-envify": "cli.js" } }, "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q=="],
"lovely-mermaid": ["lovely-mermaid@0.3.3", "", {}, "sha512-EMLJS934qwt2MLO/a5o+T/89HGbuXZPwmCpHIhHO+DVrm+y5tHlEHgpZzlC2o4yW/rFPHRFO9xSMafzqH4wH5A=="], "lru-cache": ["lru-cache@5.1.1", "", { "dependencies": { "yallist": "^3.0.2" } }, "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w=="],
"lru-cache": ["lru-cache@11.5.3", "", {}, "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg=="],
"lru.min": ["lru.min@1.1.4", "", {}, "sha512-DqC6n3QQ77zdFpCMASA1a3Jlb64Hv2N2DciFGkO/4L9+q/IpIAuRlKOvCXabtRW6cQf8usbmM6BE/TOPysCdIA=="], "lru.min": ["lru.min@1.1.4", "", {}, "sha512-DqC6n3QQ77zdFpCMASA1a3Jlb64Hv2N2DciFGkO/4L9+q/IpIAuRlKOvCXabtRW6cQf8usbmM6BE/TOPysCdIA=="],
@@ -2394,10 +2368,6 @@
"magic-string": ["magic-string@0.30.21", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ=="], "magic-string": ["magic-string@0.30.21", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ=="],
"marked": ["marked@18.0.11", "", { "bin": { "marked": "bin/marked.js" } }, "sha512-HnslJfsZkRPBDJRHvVtAaWlZHEpSu7u8LgQuJCELjRKuWR+hpq4A7sLq3p8HaI9ypVoXDXxV34CsQJEe1+J5Aw=="],
"marked-cjk-friendly": ["marked-cjk-friendly@0.1.2", "", { "peerDependencies": { "marked": ">=15.0.0" } }, "sha512-GUj8HjiEbur9yhgUo52FBgKizggF1QtT6gVdrYdWW6ZB4lVVjgS3EyyXPyfyRD0V4ghGRPlO7MO80rgSWbm0eA=="],
"math-intrinsics": ["math-intrinsics@1.1.0", "", {}, "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g=="], "math-intrinsics": ["math-intrinsics@1.1.0", "", {}, "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g=="],
"mdast-util-from-markdown": ["mdast-util-from-markdown@2.0.3", "", { "dependencies": { "@types/mdast": "^4.0.0", "@types/unist": "^3.0.0", "decode-named-character-reference": "^1.0.0", "devlop": "^1.0.0", "mdast-util-to-string": "^4.0.0", "micromark": "^4.0.0", "micromark-util-decode-numeric-character-reference": "^2.0.0", "micromark-util-decode-string": "^2.0.0", "micromark-util-normalize-identifier": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0", "unist-util-stringify-position": "^4.0.0" } }, "sha512-W4mAWTvSlKvf8L6J+VN9yLSqQ9AOAAvHuoDAmPkz4dHf553m5gVj2ejadHJhoJmcmxEnOv6Pa8XJhpxE93kb8Q=="], "mdast-util-from-markdown": ["mdast-util-from-markdown@2.0.3", "", { "dependencies": { "@types/mdast": "^4.0.0", "@types/unist": "^3.0.0", "decode-named-character-reference": "^1.0.0", "devlop": "^1.0.0", "mdast-util-to-string": "^4.0.0", "micromark": "^4.0.0", "micromark-util-decode-numeric-character-reference": "^2.0.0", "micromark-util-decode-string": "^2.0.0", "micromark-util-normalize-identifier": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0", "unist-util-stringify-position": "^4.0.0" } }, "sha512-W4mAWTvSlKvf8L6J+VN9yLSqQ9AOAAvHuoDAmPkz4dHf553m5gVj2ejadHJhoJmcmxEnOv6Pa8XJhpxE93kb8Q=="],
@@ -3158,8 +3128,6 @@
"@aws-sdk/nested-clients/@smithy/node-http-handler": ["@smithy/node-http-handler@4.11.3", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-2jY1tSpERfPfWqyBV2pH+iGFaghVsIJszJNsT7hxtQYhVJpWDyc0LqOWI+nXOxOAHaEfZ4PXXtp1wW1TGpHhkA=="], "@aws-sdk/nested-clients/@smithy/node-http-handler": ["@smithy/node-http-handler@4.11.3", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-2jY1tSpERfPfWqyBV2pH+iGFaghVsIJszJNsT7hxtQYhVJpWDyc0LqOWI+nXOxOAHaEfZ4PXXtp1wW1TGpHhkA=="],
"@babel/helper-compilation-targets/lru-cache": ["lru-cache@5.1.1", "", { "dependencies": { "yallist": "^3.0.2" } }, "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w=="],
"@base-ui/utils/reselect": ["reselect@5.3.0", "", {}, "sha512-XGoLeRAVzUTcJ1qkxPQhDJyIZ5d6zzZD9nT7AEZOaaU9UbWclhycElmhO+VD5bFeLuzhPBaOV2oXC8uG35ZSpg=="], "@base-ui/utils/reselect": ["reselect@5.3.0", "", {}, "sha512-XGoLeRAVzUTcJ1qkxPQhDJyIZ5d6zzZD9nT7AEZOaaU9UbWclhycElmhO+VD5bFeLuzhPBaOV2oXC8uG35ZSpg=="],
"@dbos-inc/dbos-sdk/commander": ["commander@12.1.0", "", {}, "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA=="], "@dbos-inc/dbos-sdk/commander": ["commander@12.1.0", "", {}, "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA=="],
@@ -3168,16 +3136,6 @@
"@earendil-works/pi-ai/@google/genai": ["@google/genai@3.6.1", "", { "dependencies": { "google-auth-library": "^10.3.0", "p-retry": "^4.6.2", "protobufjs": "^7.6.5", "ws": "^8.21.0" }, "peerDependencies": { "@modelcontextprotocol/sdk": "^1.25.2" }, "optionalPeers": ["@modelcontextprotocol/sdk"] }, "sha512-DQIkZkl+VoZc+RUSaJ41vRuywjQDpP0t/oUf5/ddQhNW6JsPjVULW2EgHmuJ1mrr6ACtrmUdPlqtNXF1yfKySg=="], "@earendil-works/pi-ai/@google/genai": ["@google/genai@3.6.1", "", { "dependencies": { "google-auth-library": "^10.3.0", "p-retry": "^4.6.2", "protobufjs": "^7.6.5", "ws": "^8.21.0" }, "peerDependencies": { "@modelcontextprotocol/sdk": "^1.25.2" }, "optionalPeers": ["@modelcontextprotocol/sdk"] }, "sha512-DQIkZkl+VoZc+RUSaJ41vRuywjQDpP0t/oUf5/ddQhNW6JsPjVULW2EgHmuJ1mrr6ACtrmUdPlqtNXF1yfKySg=="],
"@earendil-works/pi-coding-agent/ignore": ["ignore@7.0.8", "", {}, "sha512-YYNsSlXBjMk92SKnkwvB5LOVSa6OznlFUGcsvrFgNJbJCd0M1XKeFVRc8ZByeCqz32FivYNHJVooLmdqrmvp/Q=="],
"@earendil-works/pi-coding-agent/minimatch": ["minimatch@11.0.3", "", { "dependencies": { "@isaacs/nonrecursive-glob-match": "^1.0.3", "brace-expansion": "^5.0.12" } }, "sha512-iny/40PEGkNJQ5/Pv6z3nm6FbRAby32GeZRjCUJk2WnNDbgPSTcdI+DDvLqsgBdD4cD5sMtMheqPPnehCCa8Nw=="],
"@earendil-works/pi-coding-agent/semver": ["semver@7.8.5", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA=="],
"@earendil-works/pi-coding-agent/typebox": ["typebox@1.3.27", "", {}, "sha512-zu+jc1pcy4UiNThxikUr36f0Rybk9PEeCg/NE6adeWr/SKsdNO4EzZHYRDlv2YCVAfj3Odq3dESSo/jNyoBXzA=="],
"@earendil-works/pi-coding-agent/undici": ["undici@8.12.4", "", {}, "sha512-8Mx+uNKKER2bA4AdtedkqRbwUCIJFr2nJckXRe5yrDqzePqwLP7VNcctN8/XdmDSbF7mS+jJKIszlL+vbam1VA=="],
"@eslint-community/eslint-utils/eslint-visitor-keys": ["eslint-visitor-keys@3.4.3", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="], "@eslint-community/eslint-utils/eslint-visitor-keys": ["eslint-visitor-keys@3.4.3", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="],
"@google/genai/ws": ["ws@8.21.3", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-201TZ/kPWxoPr/OKWjquZR1SWKXcvxdH+e1xrx89b3YbmzLMFCLfnaG1HFIgWzJOEWZ7MvpK++odZufgYR50Rw=="], "@google/genai/ws": ["ws@8.21.3", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-201TZ/kPWxoPr/OKWjquZR1SWKXcvxdH+e1xrx89b3YbmzLMFCLfnaG1HFIgWzJOEWZ7MvpK++odZufgYR50Rw=="],
@@ -3400,8 +3358,6 @@
"lit-element/@lit/reactive-element": ["@lit/reactive-element@1.6.3", "", { "dependencies": { "@lit-labs/ssr-dom-shim": "^1.0.0" } }, "sha512-QuTgnG52Poic7uM1AN5yJ09QMe0O28e10XzSvWDz02TJiiKee4stsiownEIadWm8nYzyDAyT+gKzUoZmiWQtsQ=="], "lit-element/@lit/reactive-element": ["@lit/reactive-element@1.6.3", "", { "dependencies": { "@lit-labs/ssr-dom-shim": "^1.0.0" } }, "sha512-QuTgnG52Poic7uM1AN5yJ09QMe0O28e10XzSvWDz02TJiiKee4stsiownEIadWm8nYzyDAyT+gKzUoZmiWQtsQ=="],
"minimatch/brace-expansion": ["brace-expansion@5.0.9", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg=="],
"npm-run-path/path-key": ["path-key@4.0.0", "", {}, "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ=="], "npm-run-path/path-key": ["path-key@4.0.0", "", {}, "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ=="],
"p-retry/retry": ["retry@0.13.1", "", {}, "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg=="], "p-retry/retry": ["retry@0.13.1", "", {}, "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg=="],
+1 -1
View File
@@ -11,7 +11,7 @@ When creating agents for chat or metadata autofill, you must select an underlyin
## Built-In Providers ## Built-In Providers
Shumai ships with pre-configured configurations for major LLM providers. Because Shumai uses [Pi](https://github.com/earendil-works/pi) as its core agent framework, the supported provider and model configurations are automatically synchronized with Pi's capabilities. Shumai seeds new teams with provider and model configurations bundled with [Pi](https://github.com/earendil-works/pi). In **Settings → Providers**, choose **Refresh models** on a provider card, select compatible models, then choose **Add selected**. Refresh looks up the public catalog and preserves your saved settings and models. Use **Add Provider** to set up another provider.
Team Owner can freely edit, delete, or add new providers. All configured provider and model settings are injected directly into the Pi framework at runtime. Team Owner can freely edit, delete, or add new providers. All configured provider and model settings are injected directly into the Pi framework at runtime.
+1 -1
View File
@@ -11,7 +11,7 @@ description: 将 Shumai 连接至 OpenAI、Anthropic、Gemini 或自定义 LLM
## 内置模型服务商 ## 内置模型服务商
Shumai 预置了主流 LLM 服务商的配置。由于 Shumai 采用 [Pi](https://github.com/earendil-works/pi) 作为底层核心智能体框架,系统支持的服务商与模型配置会自动与 Pi 的功能生态保持同步。 Shumai 使用 [Pi](https://github.com/earendil-works/pi) 随附的服务商与模型配置初始化新团队。在**设置 → 服务商**中,点击服务商卡片上的**刷新模型**,选择兼容的模型,然后点击**添加所选**。刷新会查询公开模型目录,并保留现有设置和模型。若要设置其他服务商,请点击**添加服务商**。
团队所有者可自由编辑、删除或添加新服务商。所有已配置的服务商与模型参数均会在运行时直接注入 Pi 框架。 团队所有者可自由编辑、删除或添加新服务商。所有已配置的服务商与模型参数均会在运行时直接注入 Pi 框架。
-3
View File
@@ -68,8 +68,5 @@
"typescript-eslint": "8.68.0", "typescript-eslint": "8.68.0",
"vite-tsconfig-paths": "6.1.1", "vite-tsconfig-paths": "6.1.1",
"vitest": "4.1.11" "vitest": "4.1.11"
},
"patchedDependencies": {
"@earendil-works/pi-coding-agent@1.7.0": "patches/@earendil-works%2Fpi-coding-agent@1.7.0.patch"
} }
} }
+12 -20
View File
@@ -323,22 +323,10 @@ describe('provider api', () => {
}) })
const modelsPath = '/teams/t1/providers/p1/models' const modelsPath = '/teams/t1/providers/p1/models'
const providerUpdatedAt = '2026-11-29T09:15:00.000Z'
const selection = { const selection = {
models: [ providerUpdatedAt,
{ modelIds: ['test-model'],
modelId: 'test-model',
name: 'Test Model',
selectionToken: 'selected-model-token',
config: {
api: 'openai-responses',
reasoning: true,
input: ['text'],
contextWindow: 128000,
maxTokens: 4096,
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
},
},
],
} }
const importRequest = { const importRequest = {
method: 'POST', method: 'POST',
@@ -347,12 +335,16 @@ describe('provider api', () => {
} }
it('previews refresh results for the requested provider as a team admin', async () => { it('previews refresh results for the requested provider as a team admin', async () => {
vi.mocked(providerService.refreshModels).mockResolvedValue({ status: 'ready', models: [] }) vi.mocked(providerService.refreshModels).mockResolvedValue({
status: 'ready',
providerUpdatedAt,
models: [],
})
const res = await app.request(modelsPath + '/refresh', { method: 'POST' }) const res = await app.request(modelsPath + '/refresh', { method: 'POST' })
expect(res.status).toBe(200) expect(res.status).toBe(200)
expect(res.headers.get('Cache-Control')).toBe('no-store') expect(res.headers.get('Cache-Control')).toBe('no-store')
expect(await res.json()).toEqual({ status: 'ready', models: [] }) expect(await res.json()).toEqual({ status: 'ready', providerUpdatedAt, models: [] })
expect(providerService.refreshModels).toHaveBeenCalledWith('t1', 'p1') expect(providerService.refreshModels).toHaveBeenCalledWith('t1', 'p1')
expect(authzService.hasPermission).toHaveBeenCalledWith({ expect(authzService.hasPermission).toHaveBeenCalledWith({
user: expect.anything(), user: expect.anything(),
@@ -366,12 +358,12 @@ describe('provider api', () => {
it('returns the server reason for an unavailable refresh', async () => { it('returns the server reason for an unavailable refresh', async () => {
vi.mocked(providerService.refreshModels).mockResolvedValue({ vi.mocked(providerService.refreshModels).mockResolvedValue({
status: 'unavailable', status: 'unavailable',
reason: 'missing_credentials', reason: 'catalog_unavailable',
}) })
const res = await app.request(modelsPath + '/refresh', { method: 'POST' }) const res = await app.request(modelsPath + '/refresh', { method: 'POST' })
expect(res.status).toBe(200) expect(res.status).toBe(200)
expect(await res.json()).toEqual({ status: 'unavailable', reason: 'missing_credentials' }) expect(await res.json()).toEqual({ status: 'unavailable', reason: 'catalog_unavailable' })
}) })
it('imports the selection into the scoped provider and records its audit entry', async () => { it('imports the selection into the scoped provider and records its audit entry', async () => {
@@ -417,7 +409,7 @@ describe('provider api', () => {
it('rejects an empty import selection before performing a write', async () => { it('rejects an empty import selection before performing a write', async () => {
const res = await app.request(modelsPath + '/import', { const res = await app.request(modelsPath + '/import', {
...importRequest, ...importRequest,
body: JSON.stringify({ models: [] }), body: JSON.stringify({ providerUpdatedAt, modelIds: [] }),
}) })
expect(res.status).toBe(400) expect(res.status).toBe(400)
-1
View File
@@ -30,7 +30,6 @@
"@better-auth/oauth-provider": "1.7.12", "@better-auth/oauth-provider": "1.7.12",
"@earendil-works/chord": "1.7.0", "@earendil-works/chord": "1.7.0",
"@earendil-works/pi-ai": "1.7.0", "@earendil-works/pi-ai": "1.7.0",
"@earendil-works/pi-coding-agent": "1.7.0",
"@earendil-works/pi-durable": "1.7.0", "@earendil-works/pi-durable": "1.7.0",
"@google/genai": "2.28.0", "@google/genai": "2.28.0",
"@modelcontextprotocol/client": "2.0.0", "@modelcontextprotocol/client": "2.0.0",
+150 -123
View File
@@ -1,170 +1,197 @@
import { createHmac, randomBytes, timingSafeEqual } from 'node:crypto' import { PI_AI_VERSION } from '@earendil-works/pi-ai'
import { InMemoryCredentialStore } from '@earendil-works/pi-ai'
import { getBuiltinModels, getBuiltinProviders } from '@earendil-works/pi-ai/providers/all' import { getBuiltinModels, getBuiltinProviders } from '@earendil-works/pi-ai/providers/all'
import { CompatSchemasByApi } from '@earendil-works/pi-ai/providers/compat-schema'
import { ThinkingLevelMapSchema } from '@earendil-works/pi-ai/providers/model-schema'
import { import {
providerConfigSchema,
providerModelConfigSchema, providerModelConfigSchema,
type ProviderConfigSerializable, type ProviderConfigSerializable,
type ProviderRefreshUnavailableReason, type ProviderRefreshUnavailableReason,
type RefreshedProviderModel, type RefreshedProviderModel,
} from '@shumai/dtos' } from '@shumai/dtos'
import { HTTPException } from 'hono/http-exception' import { HTTPException } from 'hono/http-exception'
import { z } from 'zod'
import { ENV_MAP } from './builtin'
type RefreshConnection = type RefreshConnection =
| { configured: boolean; unavailableReason: ProviderRefreshUnavailableReason } | { unavailableReason: ProviderRefreshUnavailableReason }
| { configured: true; unavailableReason: null; piProviderId: string; apiKey: string } | { unavailableReason: null; piProviderId: string }
type SelectionProvider = { type CatalogResult =
id: string | { status: 'unavailable'; reason: 'catalog_unavailable' }
teamId: string | { status: 'ready'; models: RefreshedProviderModel[] }
updatedAt: Date
}
type ModelCandidate = Omit<RefreshedProviderModel, 'selectionToken'> const REFRESH_TIMEOUT_MS = 10_000
const PREVIEW_LIFETIME_MS = 15 * 60 * 1000
const REFRESH_TIMEOUT_MS = 30_000
const localSigningKey = randomBytes(32)
const builtinConnections = new Map<string, Set<string>>( const builtinConnections = new Map<string, Set<string>>(
getBuiltinProviders().map((id) => [ getBuiltinProviders().map((id) => [
id, id,
new Set(getBuiltinModels(id).map((model) => connectionKey(model.api, model.baseUrl))), new Set(getBuiltinModels(id).map(({ api, baseUrl }) => connectionKey(api, baseUrl))),
]), ]),
) )
const catalogSchema = z.record(
z.string(),
z.looseObject({
id: z.string().min(1),
provider: z.string(),
api: z.string(),
baseUrl: z.string(),
type: z.string().optional(),
}),
)
const compatSchemas = new Map(
Object.entries(CompatSchemasByApi).map(([api, schema]) => [api, z.fromJSONSchema(schema)]),
)
const thinkingLevelMapSchema = z.fromJSONSchema(ThinkingLevelMapSchema)
const catalogHeaderNames = new Set([
'user-agent',
'editor-version',
'editor-plugin-version',
'copilot-integration-id',
'nvcf-poll-seconds',
])
const catalogHeadersSchema = z.record(
z.string().refine((name) => catalogHeaderNames.has(name.toLowerCase())),
z.string().regex(/^[\t\x20-\x7E]*$/),
)
function connectionKey(api: string, baseUrl: string | undefined): string { function normalizeBaseUrl(baseUrl?: string): string {
return JSON.stringify([api, (baseUrl ?? '').replace(/\/+$/, '')]) return baseUrl?.trim().replace(/\/+$/, '') ?? ''
} }
function resolveSavedKey(value: string | undefined): string | undefined { function connectionKey(api: string, baseUrl?: string): string {
const key = value?.trim() return JSON.stringify([api, normalizeBaseUrl(baseUrl)])
if (!key) return undefined }
const envValue = process.env[key]?.trim()
if (envValue) return envValue function piProviderName(name: string): string {
if (/^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)+$/.test(key) || Object.hasOwn(process.env, key)) { return name === 'azure-openai-responses' ? 'azure' : name
return undefined }
export function isProviderConfigured(name: string, config: ProviderConfigSerializable): boolean {
const key = config.apiKey?.trim()
if (key) {
const envValue = process.env[key]
if (envValue !== undefined) return Boolean(envValue.trim())
// Existing forms accept literal keys and names such as OPENAI_API_KEY in the same field.
return !/^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)+$/.test(key)
} }
return key
const envName = ENV_MAP[piProviderName(name)]
if (envName && process.env[envName]?.trim()) return true
if (name === 'amazon-bedrock' && config.api === 'bedrock-converse-stream') {
return Boolean(
process.env.AWS_BEARER_TOKEN_BEDROCK ||
process.env.AWS_PROFILE ||
(process.env.AWS_ACCESS_KEY_ID && process.env.AWS_SECRET_ACCESS_KEY) ||
process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI ||
process.env.AWS_CONTAINER_CREDENTIALS_FULL_URI ||
process.env.AWS_WEB_IDENTITY_TOKEN_FILE,
)
}
const url = URL.parse(config.baseUrl ?? '')
return Boolean(
url &&
config.api === 'openai-completions' &&
(config.authHeader === false ||
/^(?:localhost|127\.\d+\.\d+\.\d+|\[::1\])$/.test(url.hostname)),
)
}
function azureDeploymentIds(): Set<string> {
// Pi uses model-id=deployment-name mappings for Azure's deployment-specific API.
const entries = process.env.AZURE_OPENAI_DEPLOYMENT_NAME_MAP?.split(',') ?? []
return new Set(
entries.flatMap((entry) => {
const [modelId, deployment] = entry.split('=', 2).map((value) => value.trim())
return modelId && deployment ? [modelId] : []
}),
)
} }
export function getRefreshConnection( export function getRefreshConnection(
name: string, name: string,
config: ProviderConfigSerializable, config: ProviderConfigSerializable,
): RefreshConnection { ): RefreshConnection {
const apiKey = resolveSavedKey(config.apiKey) const providerId = piProviderName(name)
if (!apiKey) return { configured: false, unavailableReason: 'missing_credentials' } if (providerId === 'azure' && config.api === 'azure-openai-responses') {
if (!providerConfigSchema.shape.api.safeParse(config.api).success) { const endpoint =
return { configured: true, unavailableReason: 'unsupported_connection' } config.baseUrl || process.env.AZURE_OPENAI_BASE_URL || process.env.AZURE_OPENAI_RESOURCE_NAME
return endpoint && azureDeploymentIds().size > 0
? { unavailableReason: null, piProviderId: providerId }
: { unavailableReason: 'azure_deployment_required' }
}
if (
providerId === 'kimi-coding' &&
config.api === 'anthropic-messages' &&
normalizeBaseUrl(config.baseUrl) === 'https://api.kimi.com/coding'
) {
return { unavailableReason: 'legacy_kimi_connection' }
} }
const key = connectionKey(config.api, config.baseUrl) const key = connectionKey(config.api, config.baseUrl)
const providerName = name === 'azure-openai-responses' ? 'azure' : name const namedConnections = builtinConnections.get(providerId)
const namedConnections = builtinConnections.get(providerName) if (namedConnections?.has(key)) return { unavailableReason: null, piProviderId: providerId }
if (namedConnections?.has(key)) { // A renamed provider can still be resolved if its protocol and endpoint identify one catalog.
return { configured: true, unavailableReason: null, piProviderId: providerName, apiKey }
}
// A renamed provider can still be recognized when its saved connection uniquely identifies it.
if (!namedConnections && config.baseUrl) { if (!namedConnections && config.baseUrl) {
const matches = [...builtinConnections].filter(([, connections]) => connections.has(key)) const matches = [...builtinConnections].filter(([, connections]) => connections.has(key))
if (matches.length === 1) { if (matches.length === 1) return { unavailableReason: null, piProviderId: matches[0][0] }
return { configured: true, unavailableReason: null, piProviderId: matches[0][0], apiKey }
}
} }
return { configured: true, unavailableReason: 'unsupported_connection' } return { unavailableReason: 'unsupported_connection' }
} }
export async function discoverProviderModels( export async function discoverProviderModels(
connection: Extract<RefreshConnection, { unavailableReason: null }>, piProviderId: string,
config: ProviderConfigSerializable, config: ProviderConfigSerializable,
): Promise<ModelCandidate[]> { ): Promise<CatalogResult> {
const { piProviderId, apiKey } = connection const url = new URL(`/api/models/providers/${encodeURIComponent(piProviderId)}`, 'https://pi.dev')
const { ModelRuntime } = await import('@earendil-works/pi-coding-agent') url.searchParams.set('pi-version', PI_AI_VERSION)
const credentials = new InMemoryCredentialStore() let catalog: z.infer<typeof catalogSchema>
await credentials.modify(piProviderId, async () => ({ type: 'api_key', key: apiKey })) try {
const runtime = await ModelRuntime.create({ const response = await fetch(url, {
credentials, headers: { Accept: 'application/json' },
modelsPath: null, redirect: 'error',
refreshOnCreate: false, signal: AbortSignal.timeout(REFRESH_TIMEOUT_MS),
}) })
const result = await runtime.refresh({ if (response.status === 404 || response.status === 501) {
providers: [piProviderId], return { status: 'unavailable', reason: 'catalog_unavailable' }
allowNetwork: true, }
force: true, if (!response.ok) throw new Error(`Pi catalog returned HTTP ${response.status}`)
signal: AbortSignal.timeout(REFRESH_TIMEOUT_MS), catalog = catalogSchema.parse(await response.json())
}) } catch (cause) {
if (result.aborted || result.errors.has(piProviderId)) { throw new HTTPException(502, { message: 'Could not refresh provider models', cause })
throw new HTTPException(502, { message: 'Could not refresh provider models' })
} }
const key = connectionKey(config.api, config.baseUrl) const key = connectionKey(config.api, config.baseUrl)
return runtime.getModels(piProviderId).flatMap((model) => { const azureDeployments = piProviderId === 'azure' ? azureDeploymentIds() : undefined
const models = Object.entries(catalog).flatMap(([id, model]) => {
if ( if (
typeof model.id !== 'string' || model.id !== id ||
!model.id || model.provider !== piProviderId ||
typeof model.baseUrl !== 'string' || (model.type && model.type !== 'chat')
connectionKey(model.api, model.baseUrl) !== key
) { ) {
return [] return []
} }
const modelConfig = providerModelConfigSchema.safeParse({ const matches = azureDeployments
api: model.api, ? model.api === config.api && model.baseUrl === '' && azureDeployments.has(id)
reasoning: model.reasoning, : connectionKey(model.api, model.baseUrl) === key
input: model.input, if (!matches) return []
contextWindow: model.contextWindow, if (
maxTokens: model.maxTokens, model.compat !== undefined &&
cost: model.cost, !compatSchemas.get(model.api)?.safeParse(model.compat).success
})
if (!modelConfig.success) return []
const name = typeof model.name === 'string' && model.name ? model.name : model.id
return [{ modelId: model.id, name, config: modelConfig.data }]
})
}
function signSelection(
provider: SelectionProvider,
apiKey: string,
model: ModelCandidate,
expiresAt: number,
): Buffer {
const key = process.env.BETTER_AUTH_SECRET || localSigningKey
return createHmac('sha256', key)
.update(
JSON.stringify([
'shumai-provider-model-refresh:v1',
provider.teamId,
provider.id,
provider.updatedAt,
apiKey,
expiresAt,
model.modelId,
model.name,
providerModelConfigSchema.parse(model.config),
]),
) )
.digest() return []
} if (
model.thinkingLevelMap !== undefined &&
!thinkingLevelMapSchema.safeParse(model.thinkingLevelMap).success
)
return []
if (model.headers !== undefined && !catalogHeadersSchema.safeParse(model.headers).success)
return []
export function signModelPreview( // Keep omitted flags absent so Pi can apply model- and endpoint-specific defaults.
provider: SelectionProvider, const modelConfig = providerModelConfigSchema.safeParse(model)
apiKey: string, if (!modelConfig.success) return []
models: ModelCandidate[], const name = typeof model.name === 'string' && model.name ? model.name : id
): RefreshedProviderModel[] { return [{ modelId: id, name, config: modelConfig.data }]
const expiresAt = Date.now() + PREVIEW_LIFETIME_MS })
return models.map((model) => ({ return { status: 'ready', models }
...model,
selectionToken: `${expiresAt}.${signSelection(provider, apiKey, model, expiresAt).toString('base64url')}`,
}))
}
export function isCurrentModelSelection(
provider: SelectionProvider,
apiKey: string,
model: RefreshedProviderModel,
): boolean {
const match = /^(\d{13})\.([\w-]{43})$/.exec(model.selectionToken)
if (!match) return false
const expiresAt = Number(match[1])
if (expiresAt <= Date.now()) return false
const signature = Buffer.from(match[2], 'base64url')
return timingSafeEqual(signature, signSelection(provider, apiKey, model, expiresAt))
} }
+113 -57
View File
@@ -7,7 +7,6 @@ import { afterEach, describe, expect, it, vi } from 'vitest'
import { ProviderConfigSerializable, providerModelSchema } from '@shumai/dtos' import { ProviderConfigSerializable, providerModelSchema } from '@shumai/dtos'
import { getBuiltinProvidersMap } from '@shumai/core/src/provider/builtin' import { getBuiltinProvidersMap } from '@shumai/core/src/provider/builtin'
import { z } from 'zod' import { z } from 'zod'
import type { RefreshedProviderModel } from '@shumai/dtos'
const openaiConfig = { const openaiConfig = {
api: 'openai-responses', api: 'openai-responses',
@@ -24,8 +23,15 @@ const candidateConfig = {
cost: { input: 1, output: 2, cacheRead: 0, cacheWrite: 0 }, cost: { input: 1, output: 2, cacheRead: 0, cacheWrite: 0 },
} satisfies ProviderModel['config'] } satisfies ProviderModel['config']
function catalogModel(id: string, options?: { api?: string; baseUrl?: string }) { function catalogModel(id: string, options?: Record<string, unknown>) {
return { ...candidateConfig, baseUrl: openaiConfig.baseUrl, id, name: id, ...options } return {
...candidateConfig,
provider: 'openai',
baseUrl: openaiConfig.baseUrl,
id,
name: id,
...options,
}
} }
function mockCatalog(models: ReturnType<typeof catalogModel>[]) { function mockCatalog(models: ReturnType<typeof catalogModel>[]) {
@@ -36,16 +42,14 @@ function mockCatalog(models: ReturnType<typeof catalogModel>[]) {
if (new URL(request.url).origin !== 'https://pi.dev') { if (new URL(request.url).origin !== 'https://pi.dev') {
throw new Error('Unexpected catalog host') throw new Error('Unexpected catalog host')
} }
return Response.json(models, { return Response.json(Object.fromEntries(models.map((model) => [model.id, model])))
headers: { 'Last-Modified': 'Wed, 01 Jan 2031 00:00:00 GMT' },
})
}) })
return requests return requests
} }
function readyModels(result: Awaited<ReturnType<typeof providerService.refreshModels>>) { function readyPreview(result: Awaited<ReturnType<typeof providerService.refreshModels>>) {
if (result.status !== 'ready') throw new Error('Expected refreshed models') if (result.status !== 'ready') throw new Error('Expected refreshed models')
return result.models return result
} }
type ProviderModel = z.infer<typeof providerModelSchema> type ProviderModel = z.infer<typeof providerModelSchema>
@@ -413,8 +417,16 @@ describe('ProviderService', () => {
apiKey: 'literal-kimi-key', apiKey: 'literal-kimi-key',
} satisfies ProviderConfigSerializable } satisfies ProviderConfigSerializable
const legacy = await providerService.create(team.id, 'kimi-coding', legacyConfig) const legacy = await providerService.create(team.id, 'kimi-coding', legacyConfig)
const local = await providerService.create(team.id, 'Local Ollama', {
api: 'openai-completions',
baseUrl: 'http://localhost:11434/v1',
})
vi.stubEnv('AWS_PROFILE', 'test-profile')
const bedrock = await providerService.create(team.id, 'amazon-bedrock', {
api: 'bedrock-converse-stream',
})
const providers = await providerService.listByTeam(team.id) const providers = await providerService.listByTeam(team.id)
expect(providers).toHaveLength(3) expect(providers).toHaveLength(5)
expect(providers).toEqual( expect(providers).toEqual(
expect.arrayContaining([ expect.arrayContaining([
expect.objectContaining({ expect.objectContaining({
@@ -426,26 +438,34 @@ describe('ProviderService', () => {
expect.objectContaining({ expect.objectContaining({
id: unconfigured.id, id: unconfigured.id,
configured: false, configured: false,
refreshUnavailableReason: 'missing_credentials', refreshUnavailableReason: null,
}), }),
expect.objectContaining({ expect.objectContaining({
id: legacy.id, id: legacy.id,
configured: true, configured: true,
refreshUnavailableReason: 'legacy_kimi_connection',
}),
expect.objectContaining({
id: local.id,
configured: true,
refreshUnavailableReason: 'unsupported_connection', refreshUnavailableReason: 'unsupported_connection',
}), }),
expect.objectContaining({ id: bedrock.id, configured: true }),
]), ]),
) )
const requests = mockCatalog([]) const requests = mockCatalog([])
await expect(providerService.refreshModels(team.id, unconfigured.id)).resolves.toEqual({ await expect(providerService.refreshModels(team.id, unconfigured.id)).resolves.toMatchObject({
status: 'unavailable', status: 'ready',
reason: 'missing_credentials', models: [],
}) })
await expect(providerService.refreshModels(team.id, legacy.id)).resolves.toEqual({ await expect(providerService.refreshModels(team.id, legacy.id)).resolves.toEqual({
status: 'unavailable', status: 'unavailable',
reason: 'unsupported_connection', reason: 'legacy_kimi_connection',
}) })
expect(requests).toHaveLength(0) expect(requests.map(({ url }) => new URL(url).pathname)).toEqual([
'/api/models/providers/anthropic',
])
expect(await providerService.getById(legacy.id)).toMatchObject({ config: legacyConfig }) expect(await providerService.getById(legacy.id)).toMatchObject({ config: legacyConfig })
}) })
@@ -457,15 +477,31 @@ describe('ProviderService', () => {
const existingModels = await providerService.listModelsByProvider(team.id, openai.id) const existingModels = await providerService.listModelsByProvider(team.id, openai.id)
const requests = mockCatalog([ const requests = mockCatalog([
catalogModel(existingModels[0].modelId), catalogModel(existingModels[0].modelId),
catalogModel('new-model'), catalogModel('new-model', {
compat: { supportsStrictMode: true },
thinkingLevelMap: { low: 'low' },
}),
catalogModel('wrong-api', { api: 'openai-completions' }), catalogModel('wrong-api', { api: 'openai-completions' }),
catalogModel('wrong-url', { baseUrl: 'https://other.example/v1' }), catalogModel('wrong-url', { baseUrl: 'https://other.example/v1' }),
catalogModel('wrong-provider', { provider: 'anthropic' }),
catalogModel('not-chat', { type: 'image' }),
catalogModel('invalid-compat', { compat: { supportsStrictMode: 'yes' } }),
]) ])
const result = await providerService.refreshModels(team.id, openai.id) const result = await providerService.refreshModels(team.id, openai.id)
expect(result).toMatchObject({ expect(result).toMatchObject({
status: 'ready', status: 'ready',
models: [{ modelId: 'new-model', name: 'new-model', config: candidateConfig }], models: [
{
modelId: 'new-model',
name: 'new-model',
config: {
...candidateConfig,
compat: { supportsStrictMode: true },
thinkingLevelMap: { low: 'low' },
},
},
],
}) })
expect(requests.map(({ url }) => new URL(url).pathname)).toEqual([ expect(requests.map(({ url }) => new URL(url).pathname)).toEqual([
'/api/models/providers/openai', '/api/models/providers/openai',
@@ -476,7 +512,7 @@ describe('ProviderService', () => {
expect(await providerService.listByTeam(team.id)).toEqual(providers) expect(await providerService.listByTeam(team.id)).toEqual(providers)
}) })
it('passes the saved key to OpenRouter and confines the refresh to its trusted endpoint', async () => { it('uses the versioned public OpenRouter catalog without sending saved credentials', async () => {
const openRouterKey = 'saved-openrouter-test-key' const openRouterKey = 'saved-openrouter-test-key'
vi.stubEnv('SHUMAI_TEST_OPENROUTER_KEY', openRouterKey) vi.stubEnv('SHUMAI_TEST_OPENROUTER_KEY', openRouterKey)
const team = await prisma.team.create({ data: { name: 'OpenRouter' } }) const team = await prisma.team.create({ data: { name: 'OpenRouter' } })
@@ -488,28 +524,21 @@ describe('ProviderService', () => {
apiKey: 'SHUMAI_TEST_OPENROUTER_KEY', apiKey: 'SHUMAI_TEST_OPENROUTER_KEY',
}) })
const modelId = 'org/new-openrouter-model' const modelId = 'org/new-openrouter-model'
const requestedUrls: string[] = [] const requests: Request[] = []
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input, init) => { vi.spyOn(globalThis, 'fetch').mockImplementation(async (input, init) => {
const request = new Request(input, init) const request = new Request(input, init)
const url = new URL(request.url) requests.push(request)
requestedUrls.push(url.origin + url.pathname) return Response.json({
if (url.hostname === 'pi.dev') { [modelId]: { ...catalogModel(modelId, { api, baseUrl }), provider: 'openrouter' },
expect(request.headers.has('Authorization')).toBe(false) })
return Response.json([catalogModel(modelId, { api, baseUrl })], {
headers: { 'Last-Modified': 'Wed, 01 Jan 2031 00:00:00 GMT' },
})
}
expect(url.href).toBe(baseUrl + '/models/user')
expect(request.headers.get('Authorization')).toBe('Bearer ' + openRouterKey)
return Response.json({ data: [{ id: modelId }] })
}) })
const models = readyModels(await providerService.refreshModels(team.id, provider.id)) const { models } = readyPreview(await providerService.refreshModels(team.id, provider.id))
expect(models.map(({ modelId }) => modelId)).toEqual([modelId]) expect(models.map(({ modelId }) => modelId)).toEqual([modelId])
expect(requestedUrls).toEqual([ expect(requests.map(({ url }) => url)).toEqual([
'https://pi.dev/api/models/providers/openrouter', 'https://pi.dev/api/models/providers/openrouter?pi-version=1.7.0',
baseUrl + '/models/user',
]) ])
expect(requests[0].headers.has('Authorization')).toBe(false)
const customProvider = await providerService.update(team.id, provider.id, { const customProvider = await providerService.update(team.id, provider.id, {
...provider.config, ...provider.config,
@@ -519,7 +548,7 @@ describe('ProviderService', () => {
status: 'unavailable', status: 'unavailable',
reason: 'unsupported_connection', reason: 'unsupported_connection',
}) })
expect(requestedUrls).toHaveLength(2) expect(requests).toHaveLength(1)
}) })
it('distinguishes a successful empty preview from an upstream error', async () => { it('distinguishes a successful empty preview from an upstream error', async () => {
@@ -529,14 +558,22 @@ describe('ProviderService', () => {
({ name }) => name === 'openai', ({ name }) => name === 'openai',
)! )!
mockCatalog([]) mockCatalog([])
await expect(providerService.refreshModels(team.id, provider.id)).resolves.toEqual({ await expect(providerService.refreshModels(team.id, provider.id)).resolves.toMatchObject({
status: 'ready', status: 'ready',
models: [], models: [],
}) })
vi.restoreAllMocks() vi.restoreAllMocks()
vi.spyOn(globalThis, 'fetch').mockImplementation( const fetchMock = vi.spyOn(globalThis, 'fetch')
async () => new Response(null, { status: 400 }), fetchMock.mockResolvedValueOnce(new Response(null, { status: 404 }))
) await expect(providerService.refreshModels(team.id, provider.id)).resolves.toEqual({
status: 'unavailable',
reason: 'catalog_unavailable',
})
fetchMock.mockResolvedValueOnce(Response.json({ error: 'malformed catalog' }))
await expect(providerService.refreshModels(team.id, provider.id)).rejects.toMatchObject({
status: 502,
})
fetchMock.mockRejectedValueOnce(new DOMException('Timed out', 'TimeoutError'))
await expect(providerService.refreshModels(team.id, provider.id)).rejects.toMatchObject({ await expect(providerService.refreshModels(team.id, provider.id)).rejects.toMatchObject({
status: 502, status: 502,
@@ -552,8 +589,8 @@ describe('ProviderService', () => {
const original = await providerService.getById(provider.id) const original = await providerService.getById(provider.id)
const existing = await providerService.listModelsByProvider(team.id, provider.id) const existing = await providerService.listModelsByProvider(team.id, provider.id)
mockCatalog([catalogModel('new-model'), catalogModel('unselected-model')]) mockCatalog([catalogModel('new-model'), catalogModel('unselected-model')])
const preview = readyModels(await providerService.refreshModels(team.id, provider.id)) const preview = readyPreview(await providerService.refreshModels(team.id, provider.id))
const selection = { models: preview.filter(({ modelId }) => modelId === 'new-model') } const selection = { providerUpdatedAt: preview.providerUpdatedAt, modelIds: ['new-model'] }
await expect(providerService.importModels(team.id, provider.id, selection)).resolves.toEqual({ await expect(providerService.importModels(team.id, provider.id, selection)).resolves.toEqual({
addedModels: 1, addedModels: 1,
@@ -568,7 +605,7 @@ describe('ProviderService', () => {
expect(await providerService.getById(provider.id)).toEqual(original) expect(await providerService.getById(provider.id)).toEqual(original)
}) })
it('rejects out-of-team, tampered, and stale selections without adding models', async () => { it('rejects out-of-team, unknown, and stale selections without adding models', async () => {
const team = await prisma.team.create({ data: { name: 'Refresh Team' } }) const team = await prisma.team.create({ data: { name: 'Refresh Team' } })
const otherTeam = await prisma.team.create({ data: { name: 'Other Team' } }) const otherTeam = await prisma.team.create({ data: { name: 'Other Team' } })
const provider = await providerService.create(team.id, 'openai', openaiConfig) const provider = await providerService.create(team.id, 'openai', openaiConfig)
@@ -578,28 +615,47 @@ describe('ProviderService', () => {
}) })
expect(requests).toHaveLength(0) expect(requests).toHaveLength(0)
const preview = readyModels(await providerService.refreshModels(team.id, provider.id)) const preview = readyPreview(await providerService.refreshModels(team.id, provider.id))
const candidate = preview.find(({ modelId }) => modelId === 'new-model')! const selection = { providerUpdatedAt: preview.providerUpdatedAt, modelIds: ['new-model'] }
const expectRejected = (models: RefreshedProviderModel[]) =>
expect(
providerService.importModels(team.id, provider.id, { models }),
).rejects.toMatchObject({
status: 409,
})
await expect( await expect(
providerService.importModels(otherTeam.id, provider.id, { models: [candidate] }), providerService.importModels(otherTeam.id, provider.id, selection),
).rejects.toMatchObject({ status: 404 }) ).rejects.toMatchObject({ status: 404 })
await expectRejected([{ ...candidate, name: 'Changed metadata' }])
const secondProvider = await providerService.create(team.id, 'Other OpenAI', openaiConfig)
await expect( await expect(
providerService.importModels(team.id, secondProvider.id, { models: [candidate] }), providerService.importModels(team.id, provider.id, {
...selection,
modelIds: ['new-model', 'unknown'],
}),
).rejects.toMatchObject({ status: 409 }) ).rejects.toMatchObject({ status: 409 })
await providerService.update(team.id, provider.id, { ...openaiConfig, apiKey: 'changed-key' }) await providerService.update(team.id, provider.id, { ...openaiConfig, apiKey: 'changed-key' })
await expectRejected([candidate]) await expect(
providerService.importModels(team.id, provider.id, selection),
).rejects.toMatchObject({ status: 409 })
expect(await providerService.listModelsByProvider(team.id, provider.id)).toEqual([]) expect(await providerService.listModelsByProvider(team.id, provider.id)).toEqual([])
expect(await providerService.listModelsByProvider(team.id, secondProvider.id)).toEqual([]) })
it('refreshes legacy Azure connections using only configured deployment mappings', async () => {
vi.stubEnv('AZURE_OPENAI_DEPLOYMENT_NAME_MAP', undefined)
const team = await prisma.team.create({ data: { name: 'Azure models' } })
const provider = await providerService.create(team.id, 'azure-openai-responses', {
api: 'azure-openai-responses',
baseUrl: 'https://example.openai.azure.com/openai/v1',
})
const azure = { provider: 'azure', api: 'azure-openai-responses', baseUrl: '' }
const requests = mockCatalog([
catalogModel('gpt-deployed', azure),
catalogModel('gpt-unmapped', azure),
])
await expect(providerService.refreshModels(team.id, provider.id)).resolves.toEqual({
status: 'unavailable',
reason: 'azure_deployment_required',
})
vi.stubEnv('AZURE_OPENAI_DEPLOYMENT_NAME_MAP', 'gpt-deployed=team-deployment')
const preview = readyPreview(await providerService.refreshModels(team.id, provider.id))
expect(preview.models.map(({ modelId }) => modelId)).toEqual(['gpt-deployed'])
expect(requests.map(({ url }) => new URL(url).pathname)).toEqual([
'/api/models/providers/azure',
])
}) })
}) })
}) })
+35 -26
View File
@@ -10,12 +10,7 @@ import {
import { getBuiltinProvidersMap } from '@shumai/core/src/provider/builtin' import { getBuiltinProvidersMap } from '@shumai/core/src/provider/builtin'
import { HTTPException } from 'hono/http-exception' import { HTTPException } from 'hono/http-exception'
import { z } from 'zod' import { z } from 'zod'
import { import { discoverProviderModels, getRefreshConnection, isProviderConfigured } from './model-refresh'
discoverProviderModels,
getRefreshConnection,
isCurrentModelSelection,
signModelPreview,
} from './model-refresh'
type ProviderModel = z.infer<typeof providerModelSchema> type ProviderModel = z.infer<typeof providerModelSchema>
@@ -81,7 +76,7 @@ export class ProviderService {
createdAt, createdAt,
updatedAt, updatedAt,
modelsCount: _count.models, modelsCount: _count.models,
configured: connection.configured, configured: isProviderConfigured(name, config),
refreshUnavailableReason: connection.unavailableReason, refreshUnavailableReason: connection.unavailableReason,
} }
}, },
@@ -324,34 +319,48 @@ export class ProviderService {
if (connection.unavailableReason) { if (connection.unavailableReason) {
return { status: 'unavailable', reason: connection.unavailableReason } return { status: 'unavailable', reason: connection.unavailableReason }
} }
const models = await discoverProviderModels(connection, provider.config) const catalog = await discoverProviderModels(connection.piProviderId, provider.config)
if (catalog.status === 'unavailable') return catalog
const existingIds = new Set(provider.models.map(({ modelId }) => modelId)) const existingIds = new Set(provider.models.map(({ modelId }) => modelId))
return { return {
status: 'ready', status: 'ready',
models: signModelPreview( providerUpdatedAt: provider.updatedAt.toISOString(),
provider, models: catalog.models.filter(({ modelId }) => !existingIds.has(modelId)),
connection.apiKey,
models.filter(({ modelId }) => !existingIds.has(modelId)),
),
} }
} }
async importModels(teamId: string, providerId: string, { models }: ImportProviderModelsRequest) { async importModels(
teamId: string,
providerId: string,
{ modelIds, providerUpdatedAt }: ImportProviderModelsRequest,
) {
const provider = await this.prismaClient.provider.findUnique({
where: { id: providerId, teamId },
include: { models: { where: { modelId: { in: modelIds } }, select: { modelId: true } } },
})
if (!provider) throw new HTTPException(404, { message: 'Provider not found' })
const staleSelection = () =>
new HTTPException(409, { message: 'Refresh the model list before importing' })
if (provider.updatedAt.toISOString() !== providerUpdatedAt) throw staleSelection()
const existingIds = new Set(provider.models.map(({ modelId }) => modelId))
const newIds = new Set(modelIds.filter((modelId) => !existingIds.has(modelId)))
if (newIds.size === 0) return { addedModels: 0 }
const connection = getRefreshConnection(provider.name, provider.config)
if (connection.unavailableReason) throw staleSelection()
const catalog = await discoverProviderModels(connection.piProviderId, provider.config)
if (catalog.status === 'unavailable') throw staleSelection()
const models = catalog.models.filter(({ modelId }) => newIds.has(modelId))
if (models.length !== newIds.size) throw staleSelection()
return this.prismaClient.$transaction(async (tx) => { return this.prismaClient.$transaction(async (tx) => {
// Keep the connection stable until the validated selection has been inserted. // The network request finishes before we lock the connection for the insert.
const [locked] = await tx.$queryRaw<{ id: string }[]>` const [locked] = await tx.$queryRaw<{ updatedAt: Date }[]>`
SELECT id FROM providers WHERE id = ${providerId} AND team_id = ${teamId} FOR NO KEY UPDATE SELECT updated_at AS "updatedAt" FROM providers
WHERE id = ${providerId} AND team_id = ${teamId} FOR NO KEY UPDATE
` `
if (!locked) throw new HTTPException(404, { message: 'Provider not found' }) if (!locked) throw new HTTPException(404, { message: 'Provider not found' })
const provider = await tx.provider.findUniqueOrThrow({ where: { id: providerId } }) if (locked.updatedAt.toISOString() !== providerUpdatedAt) throw staleSelection()
const connection = getRefreshConnection(provider.name, provider.config)
if (
connection.unavailableReason ||
!models.every((model) => isCurrentModelSelection(provider, connection.apiKey, model))
) {
throw new HTTPException(409, { message: 'Refresh the model list before importing' })
}
const { count } = await tx.model.createMany({ const { count } = await tx.model.createMany({
data: models.map(({ modelId, name, config }) => ({ providerId, modelId, name, config })), data: models.map(({ modelId, name, config }) => ({ providerId, modelId, name, config })),
+21 -8
View File
@@ -13,6 +13,10 @@ export const KNOWN_APIS = [
'google-vertex', 'google-vertex',
] as const ] as const
const jsonObjectSchema = z
.record(z.string(), z.unknown())
.refine((value) => z.json().safeParse(value).success)
// We define a serializable version of ProviderConfig for our API and DB // We define a serializable version of ProviderConfig for our API and DB
// as the original ProviderConfig interface includes non-serializable fields (functions) // as the original ProviderConfig interface includes non-serializable fields (functions)
export const providerModelConfigSchema = z.object({ export const providerModelConfigSchema = z.object({
@@ -21,6 +25,9 @@ export const providerModelConfigSchema = z.object({
input: z.array(z.enum(['text', 'image'])).default(['text']), input: z.array(z.enum(['text', 'image'])).default(['text']),
contextWindow: z.number().int().positive().default(128000), contextWindow: z.number().int().positive().default(128000),
maxTokens: z.number().int().positive().default(4096), maxTokens: z.number().int().positive().default(4096),
compat: jsonObjectSchema.optional(),
thinkingLevelMap: jsonObjectSchema.optional(),
headers: z.record(z.string(), z.string()).optional(),
cost: z.object({ cost: z.object({
input: z.number().nonnegative().default(0), input: z.number().nonnegative().default(0),
output: z.number().nonnegative().default(0), output: z.number().nonnegative().default(0),
@@ -79,8 +86,10 @@ export const updateModelRequestSchema = z.object({
export type UpdateModelRequest = z.infer<typeof updateModelRequestSchema> export type UpdateModelRequest = z.infer<typeof updateModelRequestSchema>
export const providerRefreshUnavailableReasonSchema = z.enum([ export const providerRefreshUnavailableReasonSchema = z.enum([
'missing_credentials',
'unsupported_connection', 'unsupported_connection',
'legacy_kimi_connection',
'azure_deployment_required',
'catalog_unavailable',
]) ])
export type ProviderRefreshUnavailableReason = z.infer< export type ProviderRefreshUnavailableReason = z.infer<
@@ -103,17 +112,20 @@ export const providerResponseSchema = z.object({
export type ProviderResponse = z.infer<typeof providerResponseSchema> export type ProviderResponse = z.infer<typeof providerResponseSchema>
export const refreshedProviderModelSchema = z.object({ export const refreshedProviderModelSchema = createModelRequestSchema.pick({
modelId: z.string().min(1), modelId: true,
name: z.string().default(''), name: true,
config: providerModelConfigSchema, config: true,
selectionToken: z.string().min(1).max(100),
}) })
export type RefreshedProviderModel = z.infer<typeof refreshedProviderModelSchema> export type RefreshedProviderModel = z.infer<typeof refreshedProviderModelSchema>
export const providerModelRefreshResponseSchema = z.discriminatedUnion('status', [ export const providerModelRefreshResponseSchema = z.discriminatedUnion('status', [
z.object({ status: z.literal('ready'), models: z.array(refreshedProviderModelSchema) }), z.object({
status: z.literal('ready'),
providerUpdatedAt: z.iso.datetime(),
models: z.array(refreshedProviderModelSchema),
}),
z.object({ z.object({
status: z.literal('unavailable'), status: z.literal('unavailable'),
reason: providerRefreshUnavailableReasonSchema, reason: providerRefreshUnavailableReasonSchema,
@@ -123,7 +135,8 @@ export const providerModelRefreshResponseSchema = z.discriminatedUnion('status',
export type ProviderModelRefreshResponse = z.infer<typeof providerModelRefreshResponseSchema> export type ProviderModelRefreshResponse = z.infer<typeof providerModelRefreshResponseSchema>
export const importProviderModelsRequestSchema = z.object({ export const importProviderModelsRequestSchema = z.object({
models: z.array(refreshedProviderModelSchema).min(1), providerUpdatedAt: z.iso.datetime(),
modelIds: z.array(z.string().min(1)).min(1),
}) })
export type ImportProviderModelsRequest = z.infer<typeof importProviderModelsRequestSchema> export type ImportProviderModelsRequest = z.infer<typeof importProviderModelsRequestSchema>
@@ -90,9 +90,16 @@ interface ProvidersSettingsProps {
} }
function refreshUnavailableText(reason: ProviderRefreshUnavailableReason) { function refreshUnavailableText(reason: ProviderRefreshUnavailableReason) {
return reason === 'missing_credentials' switch (reason) {
? m.provider_refresh_missing_credentials() case 'legacy_kimi_connection':
: m.provider_refresh_unsupported_connection() return m.provider_refresh_legacy_kimi_connection()
case 'azure_deployment_required':
return m.provider_refresh_azure_deployment_required()
case 'catalog_unavailable':
return m.provider_refresh_catalog_unavailable()
case 'unsupported_connection':
return m.provider_refresh_unsupported_connection()
}
} }
export function ProvidersSettings({ teamId }: ProvidersSettingsProps) { export function ProvidersSettings({ teamId }: ProvidersSettingsProps) {
@@ -104,6 +111,7 @@ export function ProvidersSettings({ teamId }: ProvidersSettingsProps) {
const [providerToDelete, setProviderToDelete] = useState<Provider | null>(null) const [providerToDelete, setProviderToDelete] = useState<Provider | null>(null)
const [preview, setPreview] = useState<{ const [preview, setPreview] = useState<{
provider: Provider provider: Provider
providerUpdatedAt: string
models: RefreshedProviderModel[] models: RefreshedProviderModel[]
trigger: HTMLButtonElement trigger: HTMLButtonElement
} | null>(null) } | null>(null)
@@ -126,7 +134,12 @@ export function ProvidersSettings({ teamId }: ProvidersSettingsProps) {
toast.info(m.provider_refresh_no_new_models({ name: provider.name })) toast.info(m.provider_refresh_no_new_models({ name: provider.name }))
return return
} }
setPreview({ provider, models: data.models, trigger }) setPreview({
provider,
providerUpdatedAt: data.providerUpdatedAt,
models: data.models,
trigger,
})
}, },
onError: () => { onError: () => {
toast.error(m.provider_refresh_failed()) toast.error(m.provider_refresh_failed())
@@ -336,6 +349,7 @@ export function ProvidersSettings({ teamId }: ProvidersSettingsProps) {
<RefreshProviderModelsDialog <RefreshProviderModelsDialog
teamId={teamId} teamId={teamId}
providerId={preview.provider.id} providerId={preview.provider.id}
providerUpdatedAt={preview.providerUpdatedAt}
providerName={preview.provider.name} providerName={preview.provider.name}
models={preview.models} models={preview.models}
onClose={() => setPreview(null)} onClose={() => setPreview(null)}
@@ -384,10 +398,7 @@ function ProviderCard({
{provider.name} {provider.name}
</button> </button>
{provider.configured && ( {provider.configured && (
<Badge <Badge variant="secondary" className="px-2 text-xs font-medium">
variant="secondary"
className="border-transparent bg-green-500/10 px-2 text-xs font-medium text-green-800 dark:text-green-300"
>
{m.provider_configured_badge()} {m.provider_configured_badge()}
</Badge> </Badge>
)} )}
@@ -22,7 +22,6 @@ vi.mock('@/ui/api/client', () => ({
const models = Array.from({ length: 6 }, (_, index): RefreshedProviderModel => ({ const models = Array.from({ length: 6 }, (_, index): RefreshedProviderModel => ({
modelId: `model-${index + 1}`, modelId: `model-${index + 1}`,
name: `Model ${index + 1}`, name: `Model ${index + 1}`,
selectionToken: `model-token-${index + 1}`,
config: { config: {
api: 'openai-responses', api: 'openai-responses',
reasoning: false, reasoning: false,
@@ -42,6 +41,7 @@ function renderDialog() {
<RefreshProviderModelsDialog <RefreshProviderModelsDialog
teamId="team-1" teamId="team-1"
providerId="provider-1" providerId="provider-1"
providerUpdatedAt="2026-11-29T09:15:00.000Z"
providerName="OpenAI" providerName="OpenAI"
models={models} models={models}
onClose={onClose} onClose={onClose}
@@ -92,7 +92,7 @@ describe('RefreshProviderModelsDialog', () => {
expect(onImported).toHaveBeenCalledOnce() expect(onImported).toHaveBeenCalledOnce()
expect(importModels).toHaveBeenCalledWith({ expect(importModels).toHaveBeenCalledWith({
param: { teamId: 'team-1', providerId: 'provider-1' }, param: { teamId: 'team-1', providerId: 'provider-1' },
json: { models: [models[1]] }, json: { providerUpdatedAt: '2026-11-29T09:15:00.000Z', modelIds: ['model-2'] },
}) })
}) })
@@ -22,6 +22,7 @@ import { m } from '@/ui/paraglide/messages.js'
interface RefreshProviderModelsDialogProps { interface RefreshProviderModelsDialogProps {
teamId: string teamId: string
providerId: string providerId: string
providerUpdatedAt: string
providerName: string providerName: string
models: RefreshedProviderModel[] models: RefreshedProviderModel[]
onClose: () => void onClose: () => void
@@ -32,6 +33,7 @@ interface RefreshProviderModelsDialogProps {
export function RefreshProviderModelsDialog({ export function RefreshProviderModelsDialog({
teamId, teamId,
providerId, providerId,
providerUpdatedAt,
providerName, providerName,
models, models,
onClose, onClose,
@@ -52,7 +54,7 @@ export function RefreshProviderModelsDialog({
mutationFn: async () => { mutationFn: async () => {
const res = await client.api.teams[':teamId'].providers[':providerId'].models.import.$post({ const res = await client.api.teams[':teamId'].providers[':providerId'].models.import.$post({
param: { teamId, providerId }, param: { teamId, providerId },
json: { models: models.filter(({ modelId }) => selectedIds.has(modelId)) }, json: { providerUpdatedAt, modelIds: [...selectedIds] },
}) })
if (res.status === 409) throw new Error(m.provider_refresh_stale()) if (res.status === 409) throw new Error(m.provider_refresh_stale())
if (!res.ok) throw new Error(m.provider_refresh_import_failed()) if (!res.ok) throw new Error(m.provider_refresh_import_failed())
+3 -1
View File
@@ -464,7 +464,9 @@
"provider_refresh_models": "Refresh models", "provider_refresh_models": "Refresh models",
"provider_refresh_action": "Refresh models for {name}", "provider_refresh_action": "Refresh models for {name}",
"provider_refresh_loading": "Refreshing…", "provider_refresh_loading": "Refreshing…",
"provider_refresh_missing_credentials": "Set an API key to refresh models.", "provider_refresh_legacy_kimi_connection": "The public Kimi catalog uses Chat Completions. You can still add models manually to this Anthropic Messages connection.",
"provider_refresh_azure_deployment_required": "Set an Azure endpoint and map deployed model IDs to refresh models.",
"provider_refresh_catalog_unavailable": "Pi does not publish a model catalog for this provider.",
"provider_refresh_unsupported_connection": "Refresh is unavailable for this endpoint or API.", "provider_refresh_unsupported_connection": "Refresh is unavailable for this endpoint or API.",
"provider_refresh_failed": "Could not refresh models. Try again.", "provider_refresh_failed": "Could not refresh models. Try again.",
"provider_refresh_no_new_models": "No new models for {name}.", "provider_refresh_no_new_models": "No new models for {name}.",
+3 -1
View File
@@ -449,7 +449,9 @@
"provider_refresh_models": "모델 새로 고침", "provider_refresh_models": "모델 새로 고침",
"provider_refresh_action": "{name}의 모델 새로 고침", "provider_refresh_action": "{name}의 모델 새로 고침",
"provider_refresh_loading": "새로 고치는 중…", "provider_refresh_loading": "새로 고치는 중…",
"provider_refresh_missing_credentials": "모델을 새로 고치려면 API 키를 설정하세요.", "provider_refresh_legacy_kimi_connection": "Kimi 공개 카탈로그는 Chat Completions를 사용합니다. 이 Anthropic Messages 연결에 모델을 직접 추가할 수 있습니다.",
"provider_refresh_azure_deployment_required": "모델을 새로 고치려면 Azure 엔드포인트를 설정하고 배포된 모델 ID를 매핑하세요.",
"provider_refresh_catalog_unavailable": "Pi에서 이 제공업체의 모델 카탈로그를 제공하지 않습니다.",
"provider_refresh_unsupported_connection": "이 엔드포인트 또는 API에서는 모델을 새로 고칠 수 없습니다.", "provider_refresh_unsupported_connection": "이 엔드포인트 또는 API에서는 모델을 새로 고칠 수 없습니다.",
"provider_refresh_failed": "모델을 새로 고침할 수 없습니다. 다시 시도하세요.", "provider_refresh_failed": "모델을 새로 고침할 수 없습니다. 다시 시도하세요.",
"provider_refresh_no_new_models": "{name}에 새 모델이 없습니다.", "provider_refresh_no_new_models": "{name}에 새 모델이 없습니다.",
+3 -1
View File
@@ -464,7 +464,9 @@
"provider_refresh_models": "刷新模型", "provider_refresh_models": "刷新模型",
"provider_refresh_action": "刷新 {name} 的模型", "provider_refresh_action": "刷新 {name} 的模型",
"provider_refresh_loading": "正在刷新…", "provider_refresh_loading": "正在刷新…",
"provider_refresh_missing_credentials": "设置 API 密钥后即可刷新模型。", "provider_refresh_legacy_kimi_connection": "Kimi 的公开目录使用 Chat Completions。你仍然可以为此 Anthropic Messages 连接手动添加模型。",
"provider_refresh_azure_deployment_required": "设置 Azure 端点和已部署模型的 ID 映射后,即可刷新模型。",
"provider_refresh_catalog_unavailable": "Pi 未发布此提供商的模型目录。",
"provider_refresh_unsupported_connection": "此端点或 API 不支持刷新模型。", "provider_refresh_unsupported_connection": "此端点或 API 不支持刷新模型。",
"provider_refresh_failed": "无法刷新模型,请重试。", "provider_refresh_failed": "无法刷新模型,请重试。",
"provider_refresh_no_new_models": "{name} 暂无新模型。", "provider_refresh_no_new_models": "{name} 暂无新模型。",
@@ -1,12 +0,0 @@
diff --git a/dist/core/remote-catalog-provider.js b/dist/core/remote-catalog-provider.js
index debdf90cb230159dc3ad344fb5ebd0af3dbd91e1..9466f1d1a5b9475e18eb8c6376b11cc4a87fff24 100644
--- a/dist/core/remote-catalog-provider.js
+++ b/dist/core/remote-catalog-provider.js
@@ -1,5 +1,5 @@
-import { getModelType, isModelType, } from "@earendil-works/pi-ai";
-import { VERSION } from "../config.js";
+// Embedded builds cannot locate the coding-agent package.json at runtime.
+import { getModelType, isModelType, PI_AI_VERSION as VERSION } from "@earendil-works/pi-ai";
import { fetchWithRetry } from "../utils/management-http.js";
import { getPiUserAgent } from "../utils/pi-user-agent.js";
const DEFAULT_CATALOG_BASE_URL = "https://pi.dev";