pi-agent-extensions 0.4.2 → 0.4.3
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.
|
@@ -80,7 +80,7 @@ Implementing the `/handoff` command as specified in `docs/spec_handoff.md`. Foll
|
|
|
80
80
|
| 3 | LLM extraction | Done | - | extraction.ts with retry logic |
|
|
81
81
|
| 3 | Loader UI | Done | - | progress.ts with ProgressLoader + BorderedLoader fallback |
|
|
82
82
|
| 4 | Editor review | Done | - | Using ctx.ui.editor() |
|
|
83
|
-
| 4 | Session creation | Done | - | Using ctx.newSession() with parent tracking |
|
|
83
|
+
| 4 | Session creation | Done | - | Using ctx.newSession() with parent tracking and withSession |
|
|
84
84
|
| 5 | Non-UI mode | Done | - | Print to stdout |
|
|
85
85
|
| 5 | Documentation | Done | - | docs/handoff.md |
|
|
86
86
|
| 5 | Edge cases | Done | - | Error handling, model resolution |
|
package/docs/dev/handoff/spec.md
CHANGED
|
@@ -124,8 +124,8 @@ When goal is too short or vague (e.g., “continue”, “fix”):
|
|
|
124
124
|
- Optionally prepend `/skill:<name>` if a skill was used last.
|
|
125
125
|
- Optionally prepend a short handoff preamble to set expectations in the new thread.
|
|
126
126
|
5. **Create new session**:
|
|
127
|
-
- `ctx.newSession({ parentSession: currentSessionFile })`
|
|
128
|
-
- `
|
|
127
|
+
- `ctx.newSession({ parentSession: currentSessionFile, withSession })`
|
|
128
|
+
- inside `withSession(newCtx)`, call `newCtx.ui.setEditorText(compiledPrompt)`
|
|
129
129
|
|
|
130
130
|
## Output Schema (LLM → Extension)
|
|
131
131
|
```json
|
|
@@ -441,8 +441,8 @@ The following decisions were made during implementation planning:
|
|
|
441
441
|
- **Why**: Provides valuable context about the codebase state at handoff time
|
|
442
442
|
|
|
443
443
|
#### Session Creation Flow
|
|
444
|
-
- **Decision**: Use `ctx.newSession({ parentSession })`
|
|
445
|
-
- **Why**: Creates proper session lineage tracking; setEditorText prefills the prompt for user
|
|
444
|
+
- **Decision**: Use `ctx.newSession({ parentSession, withSession })` and perform editor setup inside `withSession(newCtx)`
|
|
445
|
+
- **Why**: Creates proper session lineage tracking and avoids using a stale command context after session replacement; `newCtx.ui.setEditorText()` prefills the prompt for user review and submission
|
|
446
446
|
|
|
447
447
|
#### Documentation
|
|
448
448
|
- **Decision**: Create `docs/handoff.md` with usage and examples
|
|
@@ -196,19 +196,21 @@ async function runHandoffCommand(
|
|
|
196
196
|
return;
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
-
// Create new session with parent tracking
|
|
199
|
+
// Create new session with parent tracking.
|
|
200
|
+
// Any post-session-replacement work must happen inside withSession,
|
|
201
|
+
// using the fresh ctx passed by Pi.
|
|
200
202
|
const newSessionResult = await ctx.newSession({
|
|
201
203
|
parentSession: currentSessionFile,
|
|
204
|
+
withSession: async (newCtx) => {
|
|
205
|
+
newCtx.ui.setEditorText(editedPrompt);
|
|
206
|
+
newCtx.ui.notify("Handoff ready. Press Enter to send.", "info");
|
|
207
|
+
},
|
|
202
208
|
});
|
|
203
209
|
|
|
204
210
|
if (newSessionResult.cancelled) {
|
|
205
211
|
ctx.ui.notify("New session cancelled", "info");
|
|
206
212
|
return;
|
|
207
213
|
}
|
|
208
|
-
|
|
209
|
-
// Set the edited prompt in the editor for submission
|
|
210
|
-
ctx.ui.setEditorText(editedPrompt);
|
|
211
|
-
ctx.ui.notify("Handoff ready. Press Enter to send.", "info");
|
|
212
214
|
}
|
|
213
215
|
|
|
214
216
|
/**
|