File tree Expand file tree Collapse file tree
apps/server/src/orchestration-v2/Adapters
packages/provider-acp/src/server Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2248,7 +2248,7 @@ describe("AcpAdapterV2", () => {
22482248 } ) . pipe ( Effect . provide ( layerTest ) , Effect . scoped ) ,
22492249 ) ;
22502250
2251- it . live . each ( [ "native" , "protocol" ] as const ) (
2251+ it . live . each ( [ "native" , "focused" , " protocol"] as const ) (
22522252 "retains ACP instructions across reopen but reinjects after %s compaction" ,
22532253 ( compaction ) =>
22542254 Effect . gen ( function * ( ) {
@@ -2264,7 +2264,13 @@ describe("AcpAdapterV2", () => {
22642264 ( yield * runTurn ( "Continue work." , "completed" , true ) ) [ 0 ] ?. text ,
22652265 "Continue work." ,
22662266 ) ;
2267- yield * runTurn ( compaction === "native" ? "/compact" : "Compact while working." ) ;
2267+ yield * runTurn (
2268+ compaction === "native"
2269+ ? "/compact"
2270+ : compaction === "focused"
2271+ ? "/compact keep the plan"
2272+ : "Compact while working." ,
2273+ ) ;
22682274 assertReinjectedInstructions (
22692275 yield * runTurn ( "Continue after compact." , "completed" , true ) ,
22702276 "Continue after compact." ,
Original file line number Diff line number Diff line change @@ -826,6 +826,11 @@ function isCompactionMessage(message: ProviderAdapter.ProviderAdapterV2TurnMessa
826826 return message . text . trim ( ) === "/compact" && message . attachments . length === 0 ;
827827}
828828
829+ // Agents also accept `/compact <focus>`; it compacts history even though it is sent as a prompt.
830+ function isCompactionCommand ( message : ProviderAdapter . ProviderAdapterV2TurnMessage ) : boolean {
831+ return / ^ \/ c o m p a c t (?: \s | $ ) / . test ( message . text . trim ( ) ) && message . attachments . length === 0 ;
832+ }
833+
829834function negotiatedCapabilities (
830835 base : OrchestrationV2ProviderCapabilities ,
831836 started : AcpSessionRuntime . AcpSessionRuntimeStartResult ,
@@ -7822,7 +7827,7 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
78227827 }
78237828 if (
78247829 ( flavor . supportsCompaction === true || flavor . compactSession !== undefined ) &&
7825- isCompactionMessage ( context . input . message ) &&
7830+ isCompactionCommand ( context . input . message ) &&
78267831 settledStatus === "completed"
78277832 ) {
78287833 const nativeItemId = `${ context . nativeTurnId } :compaction` ;
You can’t perform that action at this time.
0 commit comments