pi-naming 0.3.1 → 0.4.0

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.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/src/index.ts +9 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-naming",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "Configurable Pi session naming and manual terminal workspace/tab renaming",
5
5
  "type": "module",
6
6
  "main": "./index.ts",
@@ -57,8 +57,8 @@
57
57
  "workspace"
58
58
  ],
59
59
  "dependencies": {
60
- "pi-extensions-i18n": "^0.4.1",
61
- "pi-terminal-mux": "^0.6.1"
60
+ "pi-extensions-i18n": "^0.5.0",
61
+ "pi-terminal-mux": "^0.6.2"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "@earendil-works/pi-coding-agent": ">=0.80.0",
@@ -67,7 +67,7 @@
67
67
  "devDependencies": {
68
68
  "@earendil-works/pi-coding-agent": "0.85.1",
69
69
  "@types/node": "24.12.4",
70
- "pi-terminal-mux": "^0.6.1",
70
+ "pi-terminal-mux": "^0.6.2",
71
71
  "tsx": "4.23.1",
72
72
  "typescript": "5.9.3",
73
73
  "@earendil-works/pi-ai": "0.85.1"
package/src/index.ts CHANGED
@@ -2,6 +2,14 @@ import type { ExtensionAPI, ExtensionCommandContext, ExtensionContext } from "@e
2
2
  import type { TerminalRenameOutcome, TerminalRenameTarget, ResolveRenameOptions } from "pi-terminal-mux";
3
3
  import { configPath, loadConfig, parseConfig, saveConfig, type NamingConfig } from "./config.ts";
4
4
  import { i18n } from "./i18n.ts";
5
+ import { notifyWithSource, type NoticeColor, type NoticeSource } from "pi-extensions-i18n";
6
+
7
+ /** 本扩展的提示标签;短且唯一,便于在会话里定位来源。 */
8
+ const NOTICE_TAG = "naming";
9
+ /** 提示标签颜色;与其它扩展错开,避免看起来像同一条消息。 */
10
+ const NOTICE_COLOR: NoticeColor = "toolTitle";
11
+ /** 本扩展的提示来源。 */
12
+ const NOTICE_SOURCE: NoticeSource = { tag: NOTICE_TAG, color: NOTICE_COLOR };
5
13
  import { getCurrentSessionUserMessages, requestSessionNameWithTimeout, type SessionNameRequester } from "./session-name.ts";
6
14
 
7
15
  const RENAME_COMMAND = "rename";
@@ -44,7 +52,7 @@ function errorMessage(error: unknown): string {
44
52
  /** 无交互 UI 时仍通过 Pi 消息报告结果,不静默吞错。 */
45
53
  function report(pi: ExtensionAPI, ctx: ExtensionContext, notice: { message: string; level: "info" | "warning" | "error" }): void {
46
54
  const { message, level } = notice;
47
- if (ctx.hasUI) ctx.ui.notify(message, level);
55
+ if (ctx.hasUI) notifyWithSource({ ctx, source: NOTICE_SOURCE, level, message });
48
56
  else pi.sendMessage({ customType: MESSAGE_TYPE, content: message, display: true }, { triggerTurn: false });
49
57
  }
50
58