pi-distill 1.1.0 → 1.1.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/README.md CHANGED
@@ -24,7 +24,7 @@ The screenshot reports character reduction, not an exact tokenizer measurement.
24
24
 
25
25
  ## Prompt language
26
26
 
27
- The distillation prompt strictly follows the current locale selected by `/pi-language`. Changing the persisted locale is picked up on the next tool call, including when the language command and `pi-distill` are loaded from separate package instances. `PI_EXTENSIONS_LOCALE` remains the explicit environment-variable override. The original user message is included only as language context and never overrides the selected locale.
27
+ The distillation prompt strictly follows the current locale selected by `/config:language`. Changing the persisted locale is picked up on the next tool call, including when the language command and `pi-distill` are loaded from separate package instances. `PI_EXTENSIONS_LOCALE` remains the explicit environment-variable override. The original user message is included only as language context and never overrides the selected locale.
28
28
 
29
29
  ## How it works
30
30
 
@@ -44,7 +44,7 @@ It does not register a second `bash`, `read`, `grep`, or `find` tool.
44
44
  pi install npm:pi-distill
45
45
  ```
46
46
 
47
- The package manifest also loads the shared `pi-extensions-tool-display` dependency as one extension entry; no separate host package is required.
47
+ The package manifest also loads the shared `pi-extensions-i18n` and `pi-extensions-tool-display` dependencies as extension entries; no separate package installation is required. This makes `/config:language` available after installing `pi-distill`.
48
48
 
49
49
  Reload Pi after installation:
50
50
 
@@ -55,7 +55,7 @@ Reload Pi after installation:
55
55
  Open the interactive configuration command with:
56
56
 
57
57
  ```text
58
- /pi-distill
58
+ /config:distill
59
59
  ```
60
60
 
61
61
  ## The idea
@@ -125,7 +125,7 @@ Agent consumes a result suited to the current decision, with auditable diagnosti
125
125
 
126
126
  ## Prompt language
127
127
 
128
- The distillation prompt strictly follows the locale selected by `/pi-language`:
128
+ The distillation prompt strictly follows the locale selected by `/config:language`:
129
129
 
130
130
  - the next tool call reads the newly persisted locale after a language switch;
131
131
  - separate package instances still synchronize through the shared locale setting;
@@ -178,7 +178,9 @@ Configuration-file fields take precedence over environment variables. Unspecifie
178
178
  | `timeoutSeconds` | Maximum time allowed for the distillation model call. |
179
179
  | `missedCompressionRatio` | Long-output threshold for a diagnostic when no summary prompt was supplied. |
180
180
  | `summarizeErrors` | Whether error results that meet `minChars` should still be sent to the distillation model. |
181
- | `tools.<name>.enabled` | Enables or disables `outputRequest` injection and result distillation for one tool. `edit` and `write` default to disabled; other unconfigured tools default to enabled. It can also be changed from `/pi-distill`. |
181
+ | `tools.<name>.enabled` | Enables or disables `outputRequest` injection and result distillation for one tool. `edit` and `write` default to disabled; other unconfigured tools default to enabled. It can also be changed from `/config:distill`. |
182
+
183
+ `/pi-distill` remains available as a compatibility alias.
182
184
  | `render.*` | Controls the audit card, prompt preview, and result preview. |
183
185
 
184
186
  The main environment variables are `PI_DISTILL_MODEL`, `PI_DISTILL_MIN_CHARS`, `PI_DISTILL_MAX_CHARS`, `PI_DISTILL_TIMEOUT_SECONDS`, `PI_DISTILL_MISSED_COMPRESSION_RATIO`, and `PI_DISTILL_SUMMARIZE_ERRORS`. The legacy `maxOutputChars` / `PI_DISTILL_MAX_OUTPUT_CHARS` option is still parsed for backward compatibility but no longer has any effect.
package/README.zh-CN.md CHANGED
@@ -24,7 +24,7 @@
24
24
 
25
25
  ## Prompt 语言
26
26
 
27
- 提炼 prompt 会严格跟随 `/pi-language` 当前选择的语言。持久化语言发生变化后,下一次工具调用会读取新设置,即使语言命令和 `pi-distill` 来自不同的包实例也可以同步。`PI_EXTENSIONS_LOCALE` 仍然是显式的环境变量覆盖项。原始用户消息只作为语言上下文传入,不能覆盖已选择的语言。
27
+ 提炼 prompt 会严格跟随 `/config:language` 当前选择的语言。持久化语言发生变化后,下一次工具调用会读取新设置,即使语言命令和 `pi-distill` 来自不同的包实例也可以同步。`PI_EXTENSIONS_LOCALE` 仍然是显式的环境变量覆盖项。原始用户消息只作为语言上下文传入,不能覆盖已选择的语言。
28
28
 
29
29
  ## 工作方式
30
30
 
@@ -44,7 +44,7 @@
44
44
  pi install npm:pi-distill
45
45
  ```
46
46
 
47
- 包清单会把共享依赖 `pi-extensions-tool-display` 作为一个扩展入口加载,不需要额外安装宿主包。
47
+ 包清单会把共享依赖 `pi-extensions-i18n` 和 `pi-extensions-tool-display` 作为扩展入口加载,不需要额外安装这些包。安装 `pi-distill` 后即可使用 `/config:language`。
48
48
 
49
49
  安装后重新加载 Pi:
50
50
 
@@ -55,7 +55,7 @@ pi install npm:pi-distill
55
55
  交互式配置命令:
56
56
 
57
57
  ```text
58
- /pi-distill
58
+ /config:distill
59
59
  ```
60
60
 
61
61
  ## 核心思想
@@ -127,10 +127,10 @@ Agent 消费更适合当前决策的结果,并获得可审计的处理诊断
127
127
 
128
128
  ## Prompt 语言
129
129
 
130
- 提炼 prompt 完全跟随 `/pi-language` 当前选择的语言:
130
+ 提炼 prompt 完全跟随 `/config:language` 当前选择的语言:
131
131
 
132
132
  - 切换语言后,下一次工具调用读取新的持久化语言设置;
133
- - 即使 `/pi-language` 和 `pi-distill` 来自不同的包实例,也通过共享 locale 设置同步;
133
+ - 即使 `/config:language` 和 `pi-distill` 来自不同的包实例,也通过共享 locale 设置同步;
134
134
  - `PI_EXTENSIONS_LOCALE` 可以作为显式环境变量覆盖;
135
135
  - 原始用户消息只作为任务上下文传入,不会把中文用户消息误判成中文 prompt。
136
136
 
@@ -181,7 +181,9 @@ Agent 消费更适合当前决策的结果,并获得可审计的处理诊断
181
181
  | `timeoutSeconds` | 提炼模型调用的最长等待时间。 |
182
182
  | `missedCompressionRatio` | 没有提供摘要 prompt 时,用于长输出诊断的倍数阈值。 |
183
183
  | `summarizeErrors` | 工具返回错误且达到 `minChars` 时,是否仍发送给提炼模型。 |
184
- | `tools.<name>.enabled` | 按工具开启或关闭 `outputRequest` 注入和结果提炼。`edit` 和 `write` 默认关闭,其他未配置工具默认开启,也可以通过 `/pi-distill` 修改。 |
184
+ | `tools.<name>.enabled` | 按工具开启或关闭 `outputRequest` 注入和结果提炼。`edit` 和 `write` 默认关闭,其他未配置工具默认开启,也可以通过 `/config:distill` 修改。 |
185
+
186
+ `/pi-distill` 仍作为兼容别名保留。
185
187
  | `render.*` | 控制审计卡片、prompt 预览和结果预览。 |
186
188
 
187
189
  主要环境变量包括 `PI_DISTILL_MODEL`、`PI_DISTILL_MIN_CHARS`、`PI_DISTILL_MAX_CHARS`、`PI_DISTILL_TIMEOUT_SECONDS`、`PI_DISTILL_MISSED_COMPRESSION_RATIO` 和 `PI_DISTILL_SUMMARIZE_ERRORS`。旧配置中的 `maxOutputChars` / `PI_DISTILL_MAX_OUTPUT_CHARS` 仍会被解析以兼容旧文件,但不再生效。
@@ -56,8 +56,8 @@
56
56
  "en-US": " • Ctrl+O to expand"
57
57
  },
58
58
  "header": {
59
- "zh-CN": " Distill {status}",
60
- "en-US": " Distill {status}"
59
+ "zh-CN": " Distill {status}",
60
+ "en-US": " Distill {status}"
61
61
  },
62
62
  "summary": {
63
63
  "zh-CN": "摘要",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-distill",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Pi tool-output distillation with file-first configuration",
5
5
  "type": "module",
6
6
  "main": "./index.ts",
@@ -25,6 +25,7 @@
25
25
  "pi": {
26
26
  "extensions": [
27
27
  "./index.ts",
28
+ "../pi-extensions-i18n/index.ts",
28
29
  "../pi-extensions-tool-display/index.ts"
29
30
  ]
30
31
  },
@@ -53,11 +54,11 @@
53
54
  "peerDependencies": {
54
55
  "@earendil-works/pi-ai": ">=0.80.0 <0.81.0",
55
56
  "@earendil-works/pi-coding-agent": ">=0.80.0 <0.81.0",
56
- "@earendil-works/pi-tui": ">=0.80.0 <0.81.0",
57
- "pi-extensions-i18n": "^0.3.0"
57
+ "@earendil-works/pi-tui": ">=0.80.0 <0.81.0"
58
58
  },
59
59
  "dependencies": {
60
- "pi-extensions-tool-display": "^1.0.0"
60
+ "pi-extensions-i18n": "^0.3.1",
61
+ "pi-extensions-tool-display": "^1.0.1"
61
62
  },
62
63
  "devDependencies": {
63
64
  "@earendil-works/pi-ai": "0.80.10",
@@ -58,8 +58,8 @@ function formatCount(value: number): string {
58
58
 
59
59
  function renderDistillAuditLine(audit: DistillAuditView, line: string, index: number, theme: RenderTheme): string {
60
60
  if (index === 0) {
61
- const title = theme.fg("accent", theme.bold(" Distill"));
62
- const afterTitle = line.slice(" Distill".length);
61
+ const title = theme.fg("accent", theme.bold(" Distill"));
62
+ const afterTitle = line.slice(" Distill".length);
63
63
  const statusIndex = afterTitle.indexOf(audit.statusLabel);
64
64
  if (statusIndex < 0) return `${title}${theme.fg("muted", afterTitle)}`;
65
65
  const beforeStatus = afterTitle.slice(0, statusIndex);
package/src/index.ts CHANGED
@@ -449,7 +449,7 @@ export async function processToolResult(
449
449
  outputSummaryAdvice: loaded.warnings.length > 0
450
450
  ? `Distill is disabled: ${loaded.warnings.join(" ")}`
451
451
  : loaded.enabled
452
- ? "Distill is disabled: invalid configuration. Check /pi-distill."
452
+ ? "Distill is disabled: invalid configuration. Check /config:distill."
453
453
  : "Distill is disabled by configuration.",
454
454
  };
455
455
  const agentDiagnostic = buildAgentDiagnosticText(diagnostics);
@@ -941,7 +941,7 @@ async function runDistillConfigUi(
941
941
  }
942
942
 
943
943
  function registerDistillConfigCommand(pi: ExtensionAPI, onSaved: () => void): void {
944
- pi.registerCommand("pi-distill", {
944
+ const command = {
945
945
  description: i18n.t("commandDescription"),
946
946
  handler: async (_args: string, ctx: ExtensionCommandContext) => {
947
947
  if (!ctx.hasUI) {
@@ -950,7 +950,10 @@ function registerDistillConfigCommand(pi: ExtensionAPI, onSaved: () => void): vo
950
950
  }
951
951
  await runDistillConfigUi(ctx, pi, getDistillConfigPath(), onSaved);
952
952
  },
953
- });
953
+ };
954
+ for (const name of ["config:distill", "pi-distill"] as const) {
955
+ pi.registerCommand(name, command);
956
+ }
954
957
  }
955
958
 
956
959
  export default function piDistillExtension(pi: ExtensionAPI) {