@juicesharp/rpiv-btw 2.13.5 → 2.13.7
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/btw.ts +16 -1
- package/docs/context-model.md +2 -1
- package/package.json +1 -1
package/btw.ts
CHANGED
|
@@ -83,9 +83,24 @@ interface BtwState {
|
|
|
83
83
|
* applied — exactly the context the main model receives and the usage anchor
|
|
84
84
|
* meters. Filtering the branch's raw messages instead re-sent every summarized
|
|
85
85
|
* message (#274).
|
|
86
|
+
*
|
|
87
|
+
* The main agent's callable tool declarations are dropped: Pi >= 1.0 records the
|
|
88
|
+
* tool loadout as `toolsAdded`/`toolsRemoved` on transcript `system` messages,
|
|
89
|
+
* and providers resolve the request's tools from them, so `tools: []` alone
|
|
90
|
+
* would leave /btw able to stop on `toolUse` with no answer (#295). The prompt
|
|
91
|
+
* text stays.
|
|
86
92
|
*/
|
|
87
93
|
export function branchToContextMessages(branch: SessionEntry[]): Message[] {
|
|
88
|
-
return convertToLlm(buildSessionContext(branch).messages);
|
|
94
|
+
return stripToolDeclarations(convertToLlm(buildSessionContext(branch).messages));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function stripToolDeclarations(messages: Message[]): Message[] {
|
|
98
|
+
if (!messages.some((m) => m.role === "system" && (m.toolsAdded || m.toolsRemoved))) return messages;
|
|
99
|
+
return messages.map((m) => {
|
|
100
|
+
if (m.role !== "system" || (!m.toolsAdded && !m.toolsRemoved)) return m;
|
|
101
|
+
const { toolsAdded: _added, toolsRemoved: _removed, ...rest } = m;
|
|
102
|
+
return rest;
|
|
103
|
+
});
|
|
89
104
|
}
|
|
90
105
|
|
|
91
106
|
/** The /btw snapshot: the main agent's context messages, plus its context entries
|
package/docs/context-model.md
CHANGED
|
@@ -95,7 +95,8 @@ whitespace-collapsed and truncated to 200 characters.
|
|
|
95
95
|
- **No disk writes.** History and snapshots live on `globalThis[Symbol.for("rpiv-btw")]`.
|
|
96
96
|
The package's only filesystem access is one read of its own bundled prompt file
|
|
97
97
|
at module init.
|
|
98
|
-
- **No tool use.** The call runs with `tools: []`,
|
|
98
|
+
- **No tool use.** The call runs with `tools: []`, and the main agent's tool
|
|
99
|
+
declarations are removed from the cloned context, so a side question cannot edit
|
|
99
100
|
a file or run a command even if it wanted to.
|
|
100
101
|
- **No effect on the main session.** `Esc` aborts the `/btw` controller only; the
|
|
101
102
|
main agent's signal is never touched.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juicesharp/rpiv-btw",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.7",
|
|
4
4
|
"description": "Pi extension. The /btw slash command, for putting a one-off side question to the same primary model without polluting the main conversation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|