@zhushanwen/pi-msg-id-mapper 1.0.4 → 1.0.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhushanwen/pi-msg-id-mapper",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Client UUID ↔ user entry ID mapping extension for Pi — enables metadata preservation across sessions",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -33,7 +33,7 @@
33
33
  "vitest": "^4.1.8"
34
34
  },
35
35
  "dependencies": {
36
- "@zhushanwen/pi-extension-logger": "0.3.1"
36
+ "@zhushanwen/pi-extension-logger": "0.4.1"
37
37
  },
38
38
  "scripts": {
39
39
  "typecheck": "npx tsc --noEmit",
@@ -19,7 +19,6 @@ const { loggerMock } = vi.hoisted(() => ({
19
19
  }))
20
20
  vi.mock('@zhushanwen/pi-extension-logger', () => ({
21
21
  getLogger: () => loggerMock,
22
- createLogger: () => loggerMock,
23
22
  }))
24
23
 
25
24
  import createMapper from '../index'
@@ -153,7 +152,7 @@ describe('input hook · clientUuid 提取(extractClientUuid)', () => {
153
152
  })
154
153
  })
155
154
 
156
- it('畸形 event(handler 内抛错)→ 兜底 return undefined 不外抛(console.error 可观测)', () => {
155
+ it('畸形 event(handler 内抛错)→ 兜底 return undefined 不外抛(logger.error 可观测)', () => {
157
156
  const h = createHarness()
158
157
  const errSpy = loggerMock.error
159
158
  // event 为 null → 取 event.source 即 throw,走 catch 兜底
package/src/index.ts CHANGED
@@ -24,8 +24,9 @@
24
24
  * Missing mapping doesn't affect the agent main flow.
25
25
  *
26
26
  * Same package shape as @zhushanwen/pi-system-prompt (extensions/taiji/system-prompt/):
27
- * TypeScript source with no build step and no runtime deps (peer dep on pi only),
28
- * bundled as a builtin extension by scripts/bundle-extensions.mjs.
27
+ * TypeScript source with no build step, bundled as a builtin extension by
28
+ * scripts/bundle-extensions.mjs. Runtime dependency: @zhushanwen/pi-extension-logger
29
+ * (inlined into the builtin bundle at bundle time; pi remains a peer dep).
29
30
  */
30
31
 
31
32
  import type { ExtensionAPI, ExtensionContext, InputEvent, MessageEndEvent, MessageStartEvent, TurnEndEvent, AgentEndEvent } from '@earendil-works/pi-coding-agent'
@@ -92,7 +93,7 @@ export default function (pi: ExtensionAPI): void {
92
93
  /** 写映射并清空 pending 状态。leafId 未就绪时静默返回,等下一个 hook 重试。 */
93
94
  const writeMapping = (ctx: ExtensionContext): void => {
94
95
  if (!pendingClientUuid) return
95
- // 类型已保证 sessionManager.getLeafId 必有(pi 0.84.1 ReadonlySessionManager,
96
+ // 类型已保证 sessionManager.getLeafId 必有(pi 0.84.4 ReadonlySessionManager,
96
97
  // 返回 string | null);运行时异常由 flush 的 catch 兜底。
97
98
  const userEntryId = ctx.sessionManager.getLeafId()
98
99
  if (!userEntryId) return // leafId 还没更新,等下一个 hook