@henryqw/pi-herdr-rename 5.0.2 → 5.0.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.
- package/README.md +1 -1
- package/extensions/rename.ts +10 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ A semantic branch is a Git-safe branch name made from a task type and the displa
|
|
|
44
44
|
|
|
45
45
|
### Model route
|
|
46
46
|
|
|
47
|
-
The task `pi-herdr-rename/rename`
|
|
47
|
+
The task `pi-herdr-rename/rename` uses `fast` only when it has no explicit assignment. To use another configured profile, assign the task to that profile in `/task-models`; the shared [`pi-task-models` config](https://pi.henry.wang/extensions/pi-task-models#config) stores the assignment under `tasks` at `~/.pi/agent/config/pi-task-models/config.json`.
|
|
48
48
|
|
|
49
49
|
The extension tries the assigned profile's primary route, then its fallback, while honoring the configured thinking level. It never substitutes the current session model.
|
|
50
50
|
|
package/extensions/rename.ts
CHANGED
|
@@ -124,15 +124,18 @@ function latestSessionUserText(ctx: ExtensionContext): string | undefined {
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
function recentUserMessages(ctx: ExtensionContext, fallback?: string): string | undefined {
|
|
127
|
-
const
|
|
128
|
-
|
|
127
|
+
const branch = ctx.sessionManager.getBranch();
|
|
128
|
+
const recentMessages: string[] = [];
|
|
129
|
+
for (let index = branch.length - 1; index >= 0 && recentMessages.length < MAX_CONTEXT_MESSAGES; index--) {
|
|
130
|
+
const entry = branch[index];
|
|
131
|
+
if (entry.type !== "message" || entry.message.role !== "user") continue;
|
|
129
132
|
const text = messageText(entry.message.content).trim();
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
if (!
|
|
133
|
-
if (!
|
|
133
|
+
if (text) recentMessages.push(`user: ${text.slice(0, MAX_MESSAGE_CHARS)}`);
|
|
134
|
+
}
|
|
135
|
+
if (!recentMessages.length && fallback?.trim()) recentMessages.push(`user: ${fallback.trim().slice(0, MAX_MESSAGE_CHARS)}`);
|
|
136
|
+
if (!recentMessages.length) return undefined;
|
|
134
137
|
|
|
135
|
-
|
|
138
|
+
recentMessages.reverse();
|
|
136
139
|
const selected: string[] = [];
|
|
137
140
|
let remaining = MAX_CONTEXT_CHARS;
|
|
138
141
|
for (let index = recentMessages.length - 1; index >= 0 && remaining > 0; index--) {
|