diff options
| author | Julián Díaz <[email protected]> | 2025-09-17 20:27:37 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-09-17 23:27:37 -0400 |
| commit | 71076d5c6837d2bb7df21efd7c5cc130f0fd94db (patch) | |
| tree | e7d238efb982b390c64cec9d7947f3158da1c2f3 | |
| parent | 0319043b492677c93d0c6985db8b3dd515410128 (diff) | |
| download | opencode-71076d5c6837d2bb7df21efd7c5cc130f0fd94db.tar.gz opencode-71076d5c6837d2bb7df21efd7c5cc130f0fd94db.zip | |
fix: add synthetic user prompt after session compaction (#2659)
Co-authored-by: Julián Díaz <[email protected]>
| -rw-r--r-- | packages/opencode/src/session/prompt.ts | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/packages/opencode/src/session/prompt.ts b/packages/opencode/src/session/prompt.ts index 062a99695..9270d5b5b 100644 --- a/packages/opencode/src/session/prompt.ts +++ b/packages/opencode/src/session/prompt.ts @@ -346,12 +346,37 @@ export namespace SessionPrompt { model: input.model, }) ) { - const msg = await SessionCompaction.run({ + const summaryMsg = await SessionCompaction.run({ sessionID: input.sessionID, providerID: input.providerID, modelID: input.model.id, }) - msgs = [msg] + const resumeMsgID = Identifier.ascending("message") + const resumeMsg = { + info: await Session.updateMessage({ + id: resumeMsgID, + role: "user", + sessionID: input.sessionID, + time: { + created: Date.now(), + }, + }), + parts: [ + await Session.updatePart({ + type: "text", + sessionID: input.sessionID, + messageID: resumeMsgID, + id: Identifier.ascending("part"), + text: "Use the above summary generated from your last session to resume from where you left off.", + time: { + start: Date.now(), + end: Date.now(), + }, + synthetic: true, + }), + ], + } + msgs = [summaryMsg, resumeMsg] } return msgs } |
