pi-requesty-discover 3.1.1 → 3.2.0
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 +4 -4
- package/src/discovery.ts +3 -3
- package/src/health-check.ts +3 -3
- package/src/models-json.ts +11 -1
- package/src/requesty-api.ts +4 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-requesty-discover",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Discover available Requesty models for the Pi Coding Agent",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
]
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@earendil-works/pi-coding-agent": "^0.
|
|
54
|
-
"@earendil-works/pi-tui": "^0.
|
|
53
|
+
"@earendil-works/pi-coding-agent": "^1.0.0",
|
|
54
|
+
"@earendil-works/pi-tui": "^1.0.0",
|
|
55
55
|
"@eslint/js": "^10.0.1",
|
|
56
56
|
"@types/node": "^26.1.0",
|
|
57
57
|
"@vitest/coverage-v8": "^4.1.9",
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
"vitest": "^4.1.9"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"openai": "^7.10.0",
|
|
71
70
|
"json5": "^2.2.3",
|
|
71
|
+
"openai": "^7.10.0",
|
|
72
72
|
"zod": "^4.4.3"
|
|
73
73
|
}
|
|
74
74
|
}
|
package/src/discovery.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ChatModelConfig } from './models-json'
|
|
2
2
|
import { type Env } from './env'
|
|
3
3
|
import {
|
|
4
4
|
type GetApiKey,
|
|
@@ -38,7 +38,7 @@ export type DiscoveryEvaluation = {
|
|
|
38
38
|
modelCount: number
|
|
39
39
|
failedCount: number
|
|
40
40
|
warningCount: number
|
|
41
|
-
passing:
|
|
41
|
+
passing: ChatModelConfig[]
|
|
42
42
|
diff: ModelsDiff
|
|
43
43
|
healthCheckSummary: string
|
|
44
44
|
logNote: string
|
|
@@ -73,7 +73,7 @@ export async function evaluateDiscovery(
|
|
|
73
73
|
let diff: ModelsDiff
|
|
74
74
|
let failedCount = 0
|
|
75
75
|
let warningCount = 0
|
|
76
|
-
let passing:
|
|
76
|
+
let passing: ChatModelConfig[] = []
|
|
77
77
|
let logNote = ''
|
|
78
78
|
let healthCheckSummary = ''
|
|
79
79
|
|
package/src/health-check.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ChatModelConfig } from './models-json'
|
|
2
2
|
import fs from 'node:fs'
|
|
3
3
|
import path from 'node:path'
|
|
4
4
|
import OpenAI from 'openai'
|
|
@@ -59,7 +59,7 @@ type ResolvedHealthCheckOptions = Required<Omit<HealthCheckOptions, 'onProgress'
|
|
|
59
59
|
|
|
60
60
|
export async function checkModels(
|
|
61
61
|
provider: Provider,
|
|
62
|
-
models:
|
|
62
|
+
models: ChatModelConfig[],
|
|
63
63
|
checkReasoning: boolean,
|
|
64
64
|
options: HealthCheckOptions = {},
|
|
65
65
|
): Promise<HealthCheckResult[]> {
|
|
@@ -248,7 +248,7 @@ async function verifyFirstStreamChunk(
|
|
|
248
248
|
|
|
249
249
|
async function checkModel(
|
|
250
250
|
provider: Provider,
|
|
251
|
-
model:
|
|
251
|
+
model: ChatModelConfig,
|
|
252
252
|
checkReasoning: boolean,
|
|
253
253
|
options: ResolvedHealthCheckOptions,
|
|
254
254
|
): Promise<ModelCheckResult> {
|
package/src/models-json.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { ProviderConfig, ProviderModelConfig } from '@earendil-works/pi-coding-agent'
|
|
2
|
+
|
|
3
|
+
// chat-only model shape; the package only exports the mixed chat/image/classifier union type
|
|
4
|
+
export type ChatModelConfig = Extract<ProviderModelConfig, { type?: 'chat' }>
|
|
2
5
|
import fs from 'node:fs'
|
|
3
6
|
import path from 'node:path'
|
|
4
7
|
import { z } from 'zod'
|
|
@@ -23,9 +26,15 @@ const ProviderSchema = z
|
|
|
23
26
|
|
|
24
27
|
const ModelsJsonSchema = z
|
|
25
28
|
.object({
|
|
29
|
+
$schema: z.string().optional(),
|
|
26
30
|
providers: z.record(z.string(), ProviderSchema),
|
|
27
31
|
})
|
|
28
32
|
.catchall(z.unknown())
|
|
33
|
+
.transform(({ $schema, providers, ...rest }) => ({
|
|
34
|
+
...($schema !== undefined ? { $schema } : {}),
|
|
35
|
+
...rest,
|
|
36
|
+
providers,
|
|
37
|
+
}))
|
|
29
38
|
|
|
30
39
|
export type ModelsJson = z.infer<typeof ModelsJsonSchema>
|
|
31
40
|
type ModelsJsonProvider = z.infer<typeof ProviderSchema>
|
|
@@ -95,7 +104,7 @@ export function formatModelsDiffSummary(diff: ModelsDiff): string {
|
|
|
95
104
|
|
|
96
105
|
export function updateModelsJson(
|
|
97
106
|
data: ModelsJson,
|
|
98
|
-
models:
|
|
107
|
+
models: ChatModelConfig[],
|
|
99
108
|
settings: DiscoverySettings,
|
|
100
109
|
envConfig = getEnv(),
|
|
101
110
|
): void {
|
|
@@ -111,6 +120,7 @@ export function updateModelsJson(
|
|
|
111
120
|
id: model.id,
|
|
112
121
|
name: model.name,
|
|
113
122
|
reasoning: model.reasoning,
|
|
123
|
+
...(model.thinkingLevelMap ? { thinkingLevelMap: model.thinkingLevelMap } : {}),
|
|
114
124
|
input: model.input,
|
|
115
125
|
cost: model.cost,
|
|
116
126
|
contextWindow: model.contextWindow,
|
package/src/requesty-api.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ChatModelConfig } from './models-json'
|
|
2
2
|
import { z } from 'zod'
|
|
3
3
|
|
|
4
4
|
const DEFAULT_CONTEXT_WINDOW = 128000
|
|
@@ -34,7 +34,7 @@ type Provider = {
|
|
|
34
34
|
export async function discoverModels(
|
|
35
35
|
provider: Provider,
|
|
36
36
|
options: { timeoutMs?: number } = {},
|
|
37
|
-
): Promise<
|
|
37
|
+
): Promise<ChatModelConfig[]> {
|
|
38
38
|
const timeoutMs = options.timeoutMs ?? 5_000
|
|
39
39
|
const response = await fetch(`${provider.baseUrl}/models`, {
|
|
40
40
|
headers: { Authorization: `Bearer ${provider.apiKey}` },
|
|
@@ -56,6 +56,8 @@ export async function discoverModels(
|
|
|
56
56
|
id: model.id,
|
|
57
57
|
name: model.name && model.name.length > 0 ? model.name : model.id,
|
|
58
58
|
reasoning: model.supports_reasoning === true,
|
|
59
|
+
// Requesty rejects the 'minimal' reasoning effort; null marks the level unsupported
|
|
60
|
+
...(model.supports_reasoning === true ? { thinkingLevelMap: { minimal: null } } : {}),
|
|
59
61
|
input: model.supports_vision === true ? ['text', 'image'] : ['text'],
|
|
60
62
|
cost: {
|
|
61
63
|
input: pricePerMillionTokens(model.input_price),
|