@zhushanwen/pi-system-prompt-trace 0.1.6 → 0.1.7
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 +2 -1
- package/src/baseline.ts +3 -1
- package/src/types.ts +1 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhushanwen/pi-system-prompt-trace",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "System prompt trace extension: appends xyz:system-prompt entries to the session JSONL whenever the effective system prompt is established or changes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.ts",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"vitest": "^4.1.8"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
+
"@zhushanwen/pi-ext-guards": "0.4.0",
|
|
36
37
|
"@zhushanwen/pi-extension-logger": "0.6.0"
|
|
37
38
|
},
|
|
38
39
|
"scripts": {
|
package/src/baseline.ts
CHANGED
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
|
|
13
13
|
import { readFileSync } from "node:fs";
|
|
14
14
|
|
|
15
|
-
import { isRecord
|
|
15
|
+
import { isRecord } from "@zhushanwen/pi-ext-guards";
|
|
16
|
+
|
|
17
|
+
import { isSystemPromptTraceEntryData, SYSTEM_PROMPT_CUSTOM_TYPE } from "./types.js";
|
|
16
18
|
import type { PromptBaseline } from "./types.js";
|
|
17
19
|
|
|
18
20
|
/**
|
package/src/types.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* 数据形状见 SystemPromptTraceEntryData。
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import { isRecord } from "@zhushanwen/pi-ext-guards";
|
|
8
9
|
import type { SessionStartEvent } from "@earendil-works/pi-coding-agent";
|
|
9
10
|
|
|
10
11
|
/** 留痕 entry 的 customType(xyz: 前缀 = xyz-agent 自定义命名空间)。 */
|
|
@@ -46,11 +47,6 @@ export interface SwitchStash {
|
|
|
46
47
|
pending: PromptBaseline | null;
|
|
47
48
|
}
|
|
48
49
|
|
|
49
|
-
/** 运行时类型 guard(taste/no-unsafe-cast:断言必须有运行时 guard,这里干脆不用断言)。 */
|
|
50
|
-
export function isRecord(value: unknown): value is Record<string, unknown> {
|
|
51
|
-
return typeof value === "object" && value !== null;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
50
|
/** 留痕 entry data 的运行时 guard(读 JSONL / 测试断言复用)。 */
|
|
55
51
|
export function isSystemPromptTraceEntryData(value: unknown): value is SystemPromptTraceEntryData {
|
|
56
52
|
if (!isRecord(value)) return false;
|