Skip to content
Source
Sign inSign up
pingdotgg/t3code

Add provider handoff compaction on model switches #1911

Closedjuliusmarmingewants to merge 2 commits intomain fromt3code/provider-switch-compactionopened View on GitHub

Showing 26 changed files with 12 additions and 0 deletions (loading 24).

x
0 of 26 viewed, 26 left
10 additions and 0 deletionsapps/server/integration/TestProviderAdapter.integration.tsModified
View file
@@ -472,6 +472,15 @@
sessions.clear();
});
​
+ const compactThread: ProviderAdapterShape<ProviderAdapterError>["compactThread"] = (threadId) =>
+ readThread(threadId).pipe(
+ Effect.map((snapshot) => {
+ const latestTurn = snapshot.turns.at(-1);
+ const latestItem = latestTurn?.items.at(-1);
+ return typeof latestItem === "string" ? latestItem : null;
+ }),
+ );
+​
const adapter: ProviderAdapterShape<ProviderAdapterError> = {
provider,
capabilities: {
@@ -486,6 +495,7 @@
listSessions,
hasSession,
readThread,
+ compactThread,
rollbackThread,
stopAll,
streamEvents: Stream.fromQueue(runtimeEvents),
2 additions and 0 deletionsapps/server/src/orchestration/Layers/CheckpointReactor.test.tsModified
View file
@@ -95,8 +95,10 @@