pi-distill 1.9.2 → 1.9.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/package.json +3 -1
- package/src/index.ts +8 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-distill",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.3",
|
|
4
4
|
"description": "Pi tool-output distillation with file-first configuration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.ts",
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"pi-extensions-i18n": "^0.8.0",
|
|
65
|
+
"pi-model-request": "^0.1.1",
|
|
65
66
|
"pi-extensions-tool-display": "^1.3.2"
|
|
66
67
|
},
|
|
67
68
|
"devDependencies": {
|
|
@@ -69,6 +70,7 @@
|
|
|
69
70
|
"@earendil-works/pi-coding-agent": "0.85.1",
|
|
70
71
|
"@earendil-works/pi-tui": "0.85.1",
|
|
71
72
|
"@types/node": "24.12.4",
|
|
73
|
+
"pi-model-request": "^0.1.1",
|
|
72
74
|
"tsx": "4.23.1",
|
|
73
75
|
"typescript": "5.9.3"
|
|
74
76
|
}
|
package/src/index.ts
CHANGED
|
@@ -44,6 +44,7 @@ import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
|
44
44
|
import { tmpdir } from "node:os";
|
|
45
45
|
import { dirname, join } from "node:path";
|
|
46
46
|
import { NOTICE_TAG_COLOR, createTranslator, installNoticeRenderer, loadCatalog, notifyWithSource, type NoticeColor, type NoticeSource } from "pi-extensions-i18n";
|
|
47
|
+
import { createModelRequester } from "pi-model-request";
|
|
47
48
|
import {
|
|
48
49
|
buildSummaryPrompt,
|
|
49
50
|
buildSummarySystemPrompt,
|
|
@@ -788,19 +789,19 @@ async function summarizeOutput(
|
|
|
788
789
|
);
|
|
789
790
|
}
|
|
790
791
|
|
|
791
|
-
|
|
792
|
-
|
|
792
|
+
// 摘要请求由扩展自己发出:鉴权与 provider 会话头交给共享请求器,与 Pi 核心行为一致。
|
|
793
|
+
const request = createModelRequester(context.ctx, {
|
|
794
|
+
base: completion,
|
|
795
|
+
authError: (error) => new Error(`Summarizer authentication failed: ${error}`),
|
|
796
|
+
});
|
|
793
797
|
|
|
794
798
|
const completionOptions = {
|
|
795
|
-
apiKey: auth.apiKey,
|
|
796
|
-
headers: auth.headers,
|
|
797
|
-
env: auth.env,
|
|
798
799
|
maxTokens: Math.max(256, Math.ceil(config.maxChars / 2)),
|
|
799
800
|
onPayload: addSummaryJsonResponseFormat,
|
|
800
801
|
signal,
|
|
801
802
|
} satisfies SummaryCompletionOptions;
|
|
802
803
|
const { text: rawResponse, usage } = await completeSummaryMessage(
|
|
803
|
-
|
|
804
|
+
request,
|
|
804
805
|
model,
|
|
805
806
|
[
|
|
806
807
|
buildSummarySystemPrompt(),
|
|
@@ -824,7 +825,7 @@ async function summarizeOutput(
|
|
|
824
825
|
let repaired: { text: string; usage: SummaryUsage | undefined };
|
|
825
826
|
try {
|
|
826
827
|
repaired = await completeSummaryMessage(
|
|
827
|
-
|
|
828
|
+
request,
|
|
828
829
|
model,
|
|
829
830
|
buildJsonRepairPrompt(rawResponse, error.message),
|
|
830
831
|
completionOptions,
|