pi-spark 0.17.0 → 0.18.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/README.md +1 -1
- package/package.json +1 -1
- package/src/config/model.ts +1 -1
- package/src/features/recap/manager.ts +11 -1
- package/src/features/title/manager.ts +11 -1
package/README.md
CHANGED
|
@@ -166,7 +166,7 @@ All fields are optional. If the title model configuration is incomplete, pi-spar
|
|
|
166
166
|
|
|
167
167
|
#### `ModelThinkingLevel`
|
|
168
168
|
|
|
169
|
-
Valid values: `off`, `minimal`, `low`, `medium`, `high`, `xhigh`.
|
|
169
|
+
Valid values: `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max`.
|
|
170
170
|
|
|
171
171
|
### Turn off the features you don't like
|
|
172
172
|
|
package/package.json
CHANGED
package/src/config/model.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as z from "zod";
|
|
|
2
2
|
|
|
3
3
|
import type { ModelThinkingLevel } from "@earendil-works/pi-ai";
|
|
4
4
|
|
|
5
|
-
const THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh"] as const satisfies readonly ModelThinkingLevel[];
|
|
5
|
+
const THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"] as const satisfies readonly ModelThinkingLevel[];
|
|
6
6
|
|
|
7
7
|
export const modelSchema = z.object({
|
|
8
8
|
provider: z.string().min(1),
|
|
@@ -85,7 +85,13 @@ export class RecapManager {
|
|
|
85
85
|
const auth = await ctx.modelRegistry.getApiKeyAndHeaders(model);
|
|
86
86
|
if (!auth.ok) throw new Error(auth.error);
|
|
87
87
|
|
|
88
|
-
const options: SimpleStreamOptions = {
|
|
88
|
+
const options: SimpleStreamOptions = {
|
|
89
|
+
maxTokens: MAX_TOKENS,
|
|
90
|
+
// Codex uses the session ID for request routing; without it, background calls may be
|
|
91
|
+
// routed to an unavailable model.
|
|
92
|
+
sessionId: ctx.sessionManager.getSessionId(),
|
|
93
|
+
signal,
|
|
94
|
+
};
|
|
89
95
|
if (auth.apiKey) options.apiKey = auth.apiKey;
|
|
90
96
|
if (auth.headers) options.headers = auth.headers;
|
|
91
97
|
if (thinkingLevel !== "off") options.reasoning = thinkingLevel;
|
|
@@ -99,6 +105,10 @@ export class RecapManager {
|
|
|
99
105
|
}],
|
|
100
106
|
}, options);
|
|
101
107
|
|
|
108
|
+
if (response.stopReason === "error") {
|
|
109
|
+
throw new Error(response.errorMessage ?? "Recap generation failed");
|
|
110
|
+
}
|
|
111
|
+
|
|
102
112
|
const content = response.content
|
|
103
113
|
.filter((block) => block.type === "text")
|
|
104
114
|
.map((block) => block.text)
|
|
@@ -68,7 +68,13 @@ export class TitleManager {
|
|
|
68
68
|
const auth = await ctx.modelRegistry.getApiKeyAndHeaders(model);
|
|
69
69
|
if (!auth.ok) throw new Error(auth.error);
|
|
70
70
|
|
|
71
|
-
const options: SimpleStreamOptions = {
|
|
71
|
+
const options: SimpleStreamOptions = {
|
|
72
|
+
maxTokens: MAX_TOKENS,
|
|
73
|
+
// Codex uses the session ID for request routing; without it, background calls may be
|
|
74
|
+
// routed to an unavailable model.
|
|
75
|
+
sessionId: ctx.sessionManager.getSessionId(),
|
|
76
|
+
signal,
|
|
77
|
+
};
|
|
72
78
|
if (auth.apiKey) options.apiKey = auth.apiKey;
|
|
73
79
|
if (auth.headers) options.headers = auth.headers;
|
|
74
80
|
if (thinkingLevel !== "off") options.reasoning = thinkingLevel;
|
|
@@ -82,6 +88,10 @@ export class TitleManager {
|
|
|
82
88
|
}],
|
|
83
89
|
}, options);
|
|
84
90
|
|
|
91
|
+
if (response.stopReason === "error") {
|
|
92
|
+
throw new Error(response.errorMessage ?? "Title generation failed");
|
|
93
|
+
}
|
|
94
|
+
|
|
85
95
|
const content = response.content
|
|
86
96
|
.filter((block) => block.type === "text")
|
|
87
97
|
.map((block) => block.text)
|