File tree Expand file tree Collapse file tree 2 files changed +20
-6
lines changed
dotfiles/pi/.pi/agent/extensions Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Original file line number Diff line number Diff line change 66 * using the last message as the branch summary instead of
77 * generating one with the LLM.
88 *
9- * This is a fast, zero-cost alternative to /fold. Compatible with fold's
10- * anchor system (uses the same "fold" label).
9+ * This is a fast, zero-cost alternative to /fold. Does not create a fold
10+ * marker, so the next /fold will reach back past the drop point and include
11+ * the drop's branch summary in its summarization.
1112 *
1213 * Usage:
1314 * /drop
@@ -94,7 +95,6 @@ export default function (pi: ExtensionAPI) {
9495 // Navigate tree back to anchor with the last message as summary
9596 const navResult = await ctx . navigateTree ( anchorId , {
9697 summarize : true ,
97- label : "fold" ,
9898 } ) ;
9999
100100 if ( navResult . cancelled ) {
Original file line number Diff line number Diff line change @@ -88,9 +88,23 @@ export default function (pi: ExtensionAPI) {
8888 // Gather messages after anchor for summarization
8989 const anchorIndex = branch . findIndex ( ( e ) => e . id === anchorId ) ;
9090 const entriesAfterAnchor = branch . slice ( anchorIndex + 1 ) ;
91- const messages = entriesAfterAnchor
92- . filter ( ( entry ) : entry is SessionEntry & { type : "message" } => entry . type === "message" )
93- . map ( ( entry ) => entry . message ) ;
91+ const messages : Parameters < typeof convertToLlm > [ 0 ] = [ ] ;
92+ for ( const entry of entriesAfterAnchor ) {
93+ if ( entry . type === "message" ) {
94+ messages . push ( entry . message ) ;
95+ } else if ( entry . type === "branch_summary" ) {
96+ // Include drop summaries (unlabeled) but skip fold summaries (labeled "fold")
97+ const label = ctx . sessionManager . getLabel ( entry . id ) ;
98+ if ( label !== "fold" ) {
99+ messages . push ( {
100+ role : "branchSummary" as const ,
101+ summary : entry . summary ,
102+ fromId : entry . fromId ,
103+ timestamp : Date . parse ( entry . timestamp ) ,
104+ } ) ;
105+ }
106+ }
107+ }
94108
95109 if ( messages . length === 0 ) {
96110 ctx . ui . notify ( "No conversation to fold" , "error" ) ;
You can’t perform that action at this time.
0 commit comments