snow-flow 10.0.205 → 10.0.207
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
package/src/session/llm.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Installation } from "@/installation"
|
|
|
3
3
|
import { Provider } from "@/provider/provider"
|
|
4
4
|
import { Log } from "@/util/log"
|
|
5
5
|
import {
|
|
6
|
+
NoOutputGeneratedError,
|
|
6
7
|
streamText,
|
|
7
8
|
wrapLanguageModel,
|
|
8
9
|
type ModelMessage,
|
|
@@ -189,6 +190,10 @@ export namespace LLM {
|
|
|
189
190
|
|
|
190
191
|
return streamText({
|
|
191
192
|
onError(error) {
|
|
193
|
+
if (NoOutputGeneratedError.isInstance(error.error)) {
|
|
194
|
+
l.debug("stream aborted before output was generated")
|
|
195
|
+
return
|
|
196
|
+
}
|
|
192
197
|
l.error("stream error", {
|
|
193
198
|
error,
|
|
194
199
|
})
|
|
@@ -2,7 +2,14 @@ import { BusEvent } from "@/bus/bus-event"
|
|
|
2
2
|
import { Bus } from "@/bus"
|
|
3
3
|
import z from "zod"
|
|
4
4
|
import { NamedError } from "@opencode-ai/util/error"
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
APICallError,
|
|
7
|
+
convertToModelMessages,
|
|
8
|
+
LoadAPIKeyError,
|
|
9
|
+
NoOutputGeneratedError,
|
|
10
|
+
type ModelMessage,
|
|
11
|
+
type UIMessage,
|
|
12
|
+
} from "ai"
|
|
6
13
|
import { Identifier } from "../id/id"
|
|
7
14
|
import { LSP } from "../lsp"
|
|
8
15
|
import { Snapshot } from "@/snapshot"
|
|
@@ -805,6 +812,13 @@ export namespace MessageV2 {
|
|
|
805
812
|
cause: e,
|
|
806
813
|
},
|
|
807
814
|
).toObject()
|
|
815
|
+
case NoOutputGeneratedError.isInstance(e):
|
|
816
|
+
return new MessageV2.AbortedError(
|
|
817
|
+
{ message: e.message || "Stream interrupted before any output was generated" },
|
|
818
|
+
{
|
|
819
|
+
cause: e,
|
|
820
|
+
},
|
|
821
|
+
).toObject()
|
|
808
822
|
case MessageV2.OutputLengthError.isInstance(e):
|
|
809
823
|
return e
|
|
810
824
|
case LoadAPIKeyError.isInstance(e):
|
package/src/session/processor.ts
CHANGED
|
@@ -270,7 +270,7 @@ export namespace SessionProcessor {
|
|
|
270
270
|
SessionSummary.summarize({
|
|
271
271
|
sessionID: input.sessionID,
|
|
272
272
|
messageID: input.assistantMessage.parentID,
|
|
273
|
-
})
|
|
273
|
+
}).catch((err) => log.warn("summarize failed", { error: err }))
|
|
274
274
|
if (
|
|
275
275
|
!input.assistantMessage.summary &&
|
|
276
276
|
(await SessionCompaction.isOverflow({ tokens: usage.tokens, model: input.model }))
|
package/src/session/prompt.ts
CHANGED
|
@@ -581,7 +581,7 @@ export namespace SessionPrompt {
|
|
|
581
581
|
SessionSummary.summarize({
|
|
582
582
|
sessionID: sessionID,
|
|
583
583
|
messageID: lastUser.id,
|
|
584
|
-
})
|
|
584
|
+
}).catch((err) => log.warn("summarize failed", { error: err }))
|
|
585
585
|
}
|
|
586
586
|
|
|
587
587
|
// Ephemerally wrap queued user messages with a reminder to stay on track.
|
|
@@ -56,7 +56,13 @@ export namespace SessionSuggestion {
|
|
|
56
56
|
retries: 2,
|
|
57
57
|
})
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
let result: string
|
|
60
|
+
try {
|
|
61
|
+
result = (await stream.text).trim()
|
|
62
|
+
} catch (err) {
|
|
63
|
+
log.warn("suggestion generation failed", { error: err })
|
|
64
|
+
return
|
|
65
|
+
}
|
|
60
66
|
if (!result) return
|
|
61
67
|
|
|
62
68
|
log.info("suggestion", { sessionID: input.sessionID, suggestion: result })
|
package/src/session/summary.ts
CHANGED
|
@@ -159,7 +159,14 @@ export namespace SessionSummary {
|
|
|
159
159
|
system: [],
|
|
160
160
|
retries: 3,
|
|
161
161
|
})
|
|
162
|
-
|
|
162
|
+
let result: string
|
|
163
|
+
try {
|
|
164
|
+
result = await stream.text
|
|
165
|
+
} catch (err) {
|
|
166
|
+
log.warn("title generation failed", { error: err })
|
|
167
|
+
return
|
|
168
|
+
}
|
|
169
|
+
if (!result) return
|
|
163
170
|
log.info("title", { title: result })
|
|
164
171
|
userMsg.summary.title = result
|
|
165
172
|
await Session.updateMessage(userMsg)
|