mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-19 17:04:41 +00:00
feat(coding-agent): add session naming via /name command and extension API
- Add SessionInfoEntry type for session metadata - Add /name <name> command to set session display name - Add pi.setSessionName() and pi.getSessionName() extension API - Session selector shows name (in warning color) instead of first message when set - Session name included in fuzzy search - /session command displays name when set closes #650
This commit is contained in:
parent
7a41975e9e
commit
8f95a13e07
14 changed files with 173 additions and 5 deletions
|
|
@ -797,6 +797,25 @@ pi.on("session_start", async (_event, ctx) => {
|
|||
|
||||
**Examples:** [plan-mode.ts](../examples/extensions/plan-mode.ts), [preset.ts](../examples/extensions/preset.ts), [snake.ts](../examples/extensions/snake.ts), [tools.ts](../examples/extensions/tools.ts)
|
||||
|
||||
### pi.setSessionName(name)
|
||||
|
||||
Set the session display name (shown in session selector instead of first message).
|
||||
|
||||
```typescript
|
||||
pi.setSessionName("Refactor auth module");
|
||||
```
|
||||
|
||||
### pi.getSessionName()
|
||||
|
||||
Get the current session name, if set.
|
||||
|
||||
```typescript
|
||||
const name = pi.getSessionName();
|
||||
if (name) {
|
||||
console.log(`Session: ${name}`);
|
||||
}
|
||||
```
|
||||
|
||||
### pi.registerCommand(name, options)
|
||||
|
||||
Register a command.
|
||||
|
|
|
|||
|
|
@ -138,6 +138,16 @@ User-defined bookmark/marker on an entry.
|
|||
|
||||
Set `label` to `undefined` to clear a label.
|
||||
|
||||
### SessionInfoEntry
|
||||
|
||||
Session metadata (e.g., user-defined display name). Set via `/name` command or `pi.setSessionName()` in extensions.
|
||||
|
||||
```json
|
||||
{"type":"session_info","id":"k1l2m3n4","parentId":"j0k1l2m3","timestamp":"2024-12-03T14:35:00.000Z","name":"Refactor auth module"}
|
||||
```
|
||||
|
||||
The session name is displayed in the session selector (`/resume`) instead of the first message when set.
|
||||
|
||||
## Tree Structure
|
||||
|
||||
Entries form a tree:
|
||||
|
|
@ -222,6 +232,7 @@ Key methods for working with sessions programmatically:
|
|||
- `appendModelChange(provider, modelId)` - Record model change
|
||||
- `appendCompaction(summary, firstKeptEntryId, tokensBefore, details?, fromHook?)` - Add compaction
|
||||
- `appendCustomEntry(customType, data?)` - Extension state (not in context)
|
||||
- `appendSessionInfo(name)` - Set session display name
|
||||
- `appendCustomMessageEntry(customType, content, display, details?)` - Extension message (in context)
|
||||
- `appendLabelChange(targetId, label)` - Set/clear label
|
||||
|
||||
|
|
@ -241,3 +252,4 @@ Key methods for working with sessions programmatically:
|
|||
- `buildSessionContext()` - Get messages for LLM
|
||||
- `getEntries()` - All entries (excluding header)
|
||||
- `getHeader()` - Session metadata
|
||||
- `getSessionName()` - Get display name from latest session_info entry
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue