@narumitw/pi-btw 0.4.1 → 0.4.2
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/package.json +4 -4
- package/src/btw.ts +6 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@narumitw/pi-btw",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "Pi extension that adds a /btw side-question command.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@biomejs/biome": "2.4.14",
|
|
32
|
-
"@
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
32
|
+
"@earendil-works/pi-ai": "0.74.0",
|
|
33
|
+
"@earendil-works/pi-coding-agent": "0.74.0",
|
|
34
|
+
"@earendil-works/pi-tui": "0.74.0",
|
|
35
35
|
"typescript": "6.0.3"
|
|
36
36
|
},
|
|
37
37
|
"repository": {
|
package/src/btw.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { complete, type UserMessage } from "@
|
|
1
|
+
import { complete, type UserMessage } from "@earendil-works/pi-ai";
|
|
2
2
|
import {
|
|
3
3
|
BorderedLoader,
|
|
4
4
|
DynamicBorder,
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
type ExtensionAPI,
|
|
7
7
|
type ExtensionCommandContext,
|
|
8
8
|
type Theme,
|
|
9
|
-
} from "@
|
|
9
|
+
} from "@earendil-works/pi-coding-agent";
|
|
10
10
|
import {
|
|
11
11
|
Key,
|
|
12
12
|
Markdown,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
visibleWidth,
|
|
16
16
|
type Component,
|
|
17
17
|
type TUI,
|
|
18
|
-
} from "@
|
|
18
|
+
} from "@earendil-works/pi-tui";
|
|
19
19
|
|
|
20
20
|
const MAX_CONTEXT_CHARS = 40_000;
|
|
21
21
|
const ANSWER_CHROME_LINES = 4;
|
|
@@ -279,7 +279,7 @@ class BtwAnswerPager implements Component {
|
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
-
function sanitizeSingleLine(text: string) {
|
|
282
|
+
export function sanitizeSingleLine(text: string) {
|
|
283
283
|
return text
|
|
284
284
|
.replace(/[\r\n\t]/g, " ")
|
|
285
285
|
.replace(/[\u0000-\u001f\u007f-\u009f]/g, "")
|
|
@@ -287,7 +287,7 @@ function sanitizeSingleLine(text: string) {
|
|
|
287
287
|
.trim();
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
-
function buildUserPrompt(question: string, conversationContext: string) {
|
|
290
|
+
export function buildUserPrompt(question: string, conversationContext: string) {
|
|
291
291
|
return [
|
|
292
292
|
"Answer this side question without modifying the main conversation.",
|
|
293
293
|
"",
|
|
@@ -301,7 +301,7 @@ function buildUserPrompt(question: string, conversationContext: string) {
|
|
|
301
301
|
].join("\n");
|
|
302
302
|
}
|
|
303
303
|
|
|
304
|
-
function buildConversationContext(entries: readonly SessionEntry[]) {
|
|
304
|
+
export function buildConversationContext(entries: readonly SessionEntry[]) {
|
|
305
305
|
const sections: string[] = [];
|
|
306
306
|
|
|
307
307
|
for (const entry of entries) {
|