pi-spark 0.17.0 → 0.17.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-spark",
3
- "version": "0.17.0",
3
+ "version": "0.17.1",
4
4
  "description": "Pi package that polishes your daily experience.",
5
5
  "keywords": [
6
6
  "pi-coding-agent",
@@ -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 = { maxTokens: MAX_TOKENS, signal };
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 = { maxTokens: MAX_TOKENS, signal };
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)