dsh-axonhub-tracing 0.2.1 → 0.2.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/CHANGELOG.md +4 -0
- package/README.en.md +8 -6
- package/README.md +8 -6
- package/package.json +1 -1
- package/src/identity.js +4 -1
package/CHANGELOG.md
CHANGED
package/README.en.md
CHANGED
|
@@ -60,12 +60,14 @@ The settings file is owned by a single DSH process. If two DSH processes are run
|
|
|
60
60
|
|
|
61
61
|
## Grouping Rules
|
|
62
62
|
|
|
63
|
-
A thread represents a conversation, and a trace represents a single interaction turn or
|
|
63
|
+
A thread represents a conversation, and a trace represents a single interaction turn or task. By default, requests use the current session as their thread. Some request types can use a separate thread.
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
On its Responses path, AxonHub appends `-` and a 16-digit hexadecimal fingerprint to the trace ID to build a `prompt_cache_key` with a 64-character limit. With the default setting `hashIds: false`, the plugin sends the trace IDs described below as-is when they are at most 47 characters long. If a trace ID is longer, the plugin replaces the entire value with a stable 16-digit hexadecimal hash. This length rule does not affect thread IDs.
|
|
66
|
+
|
|
67
|
+
1. Regular chat and turn tracing: "Turn tracing" (轮次追踪) is on by default. Each turn has a separate trace, built as `<session>:t<turn>` before the length rule. With a standard `session-<uuid>` ID, turns 1–9 keep that format and turn 10 onward uses a hash. Tool calls and retries in the same turn share a trace. Turn off "Turn tracing" to use a single trace for the whole session. The thread ID stays the same, so session stickiness is unaffected.
|
|
66
68
|
2. Compaction summaries: Context compaction summaries always share the current turn's trace. Because compaction requests operate on the same context as the active conversation, keeping them in the same trace preserves a continuous context history while still distinguishing them from regular calls via the kind header.
|
|
67
|
-
3. Titles and approvals: Title generation and auto-approval each have an independent setting, both defaulting to separate mode.
|
|
68
|
-
4. Subagents:
|
|
69
|
+
3. Titles and approvals: Title generation and auto-approval each have an independent setting, both defaulting to separate mode. Their thread IDs are `<session>#title` and `<session>#review` in separate mode, keeping them out of the main session timeline. Their raw trace IDs are `<session>:title` and `<session>:review`; both are hashed with a standard session ID. These tasks do not share the main conversation's cache prefix, so separate threads incur no cache penalty. To merge either thread back into the main session, switch its setting to follow the main session.
|
|
70
|
+
4. Subagents: By default, a subagent uses its own session ID as its thread ID. Its raw trace ID is `<parent-session>:c<name>.<short-code>:t<turn>`, which is hashed with a standard session ID. The short code comes from the child session ID and distinguishes subagents launched under the same name by the same parent. The plugin reads the parent-child relationship from DSH without extra configuration. Separate threads may be routed to a different channel. If sharing the parent's prefix cache is more important, set subagents to follow the parent session.
|
|
69
71
|
|
|
70
72
|
## Relationship with Caching
|
|
71
73
|
|
|
@@ -97,7 +99,7 @@ After installation, you can verify that tracing is working as expected with the
|
|
|
97
99
|
2. Open the Traces page in AxonHub, confirm that a record for the current turn appears, and open it to verify that all model calls from that turn are grouped inside.
|
|
98
100
|
3. Check the Threads page in AxonHub and confirm that multiple turns from the same conversation are grouped under the same thread.
|
|
99
101
|
4. Start a new conversation to trigger automatic title generation, then check the thread list to confirm that a separate thread ending in `#title` appears with a title request type, without mixing into the regular chat thread.
|
|
100
|
-
5. Launch a subagent to run a task, then check
|
|
102
|
+
5. Launch a subagent to run a task, then check that a separate thread appears with the `subagent` request kind. With standard session IDs, the trace ID should be a 16-digit hexadecimal hash.
|
|
101
103
|
6. Turn off the plugin's master toggle, send another message, and inspect the request headers via a packet capture tool or gateway logs to confirm that no headers starting with `AH` are present.
|
|
102
104
|
|
|
103
105
|
You can also use the recent requests list at the bottom of the plugin settings page for a quick check; it displays the request type and trace ID for each call that had headers attached.
|
|
@@ -126,7 +128,7 @@ The plugin does not write to any database or modify channel configurations. Once
|
|
|
126
128
|
|
|
127
129
|
1. Channel coverage: The plugin uses `llm-pi-ai/request-headers` and only covers channels routed through `pi-ai`. DSH's native DeepSeek endpoint and subscription account endpoints are not supported, and the plugin cannot intercept those requests.
|
|
128
130
|
2. External backend subagents: If a subagent runs on an external backend such as Claude Code or Codex, its requests bypass DSH's model layer and therefore will not carry headers from this plugin. This is expected behavior.
|
|
129
|
-
3. Privacy and identifier hashing:
|
|
131
|
+
3. Privacy and identifier hashing: Unhashed thread and trace IDs may contain session IDs or subagent names, but never conversation content. To hide the original identifiers, set `hashIds` to `true` in the settings file. This hashes all thread and trace IDs regardless of length, so the gateway UI will no longer show the original values. The underlying model library may still send its own session IDs under some protocols. The plugin does not write those IDs, and `hashIds` does not affect them.
|
|
130
132
|
|
|
131
133
|
## Troubleshooting
|
|
132
134
|
|
package/README.md
CHANGED
|
@@ -60,12 +60,14 @@ dsh plugin --profile desktop add /path/to/dsh-axonhub-tracing
|
|
|
60
60
|
|
|
61
61
|
## 分组规则
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
线程代表一段对话,追踪代表一轮交互或一项具体任务。默认情况下,所有请求都以当前会话本身作为线程,只有特定类型的请求会按配置拆分到独立线程。
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
AxonHub 的 Responses 路径会在追踪号后加上 `-` 和 16 位十六进制指纹,生成最多 64 字符的 `prompt_cache_key`。因此,在默认设置 `hashIds: false` 下,下述格式生成的追踪号不超过 47 字符时原样发送;超过 47 字符时,插件将整条追踪号替换为 16 位十六进制哈希。同一个原始值总是得到同一个哈希,线程号不受此长度规则影响。
|
|
66
|
+
|
|
67
|
+
1. 普通对话与轮次追踪:普通对话默认开启「轮次追踪」,每轮对话生成一条独立追踪,原始格式为 `<会话>:t<轮次>`。使用标准 `session-<uuid>` 时,第 1 至 9 轮保留原样,第 10 轮起使用哈希。同一轮内的工具调用和重试共用同一追踪号。关闭「轮次追踪」后,整段会话共用一个追踪号,不再区分轮次;线程号不变,因此不影响会话粘性。
|
|
66
68
|
2. 压缩摘要:上下文压缩摘要始终与当前轮次共用同一条追踪。压缩请求与正常对话使用同一段上下文,归入同一条追踪便于保持上下文记录连续,同时仍可通过类型标识将其与普通调用区分开。
|
|
67
|
-
3.
|
|
68
|
-
4.
|
|
69
|
+
3. 标题与审批:生成标题和自动审批各有一个独立开关,默认均为独立模式。独立模式的线程分别为 `<会话>#title` 和 `<会话>#review`,不会占用主会话的时间线。原始追踪号分别为 `<会话>:title` 和 `<会话>:review`,使用标准会话编号时两者都会被哈希。标题和审批原本就不与主对话共享缓存前缀,拆分线程不会造成缓存损失。要并回主会话,分别切换对应的开关即可。
|
|
70
|
+
4. 子代理:子代理默认使用自己的会话编号作线程号。原始追踪号格式为 `<父会话>:c<名字>.<短码>:t<轮次>`,使用标准会话编号时会被哈希。`<短码>` 由子会话编号计算,用于区分同一父会话启动的同名子代理。插件直接读取 DSH 记录的父子关系,无需额外配置。独立线程可能被分配到其他渠道;如果更看重与父会话共享前缀缓存,可以在设置中将子代理改为跟父会话。
|
|
69
71
|
|
|
70
72
|
## 和缓存的关系
|
|
71
73
|
|
|
@@ -97,7 +99,7 @@ DSH 原生 DeepSeek 接口和订阅账号接口不支持。这两类接口只发
|
|
|
97
99
|
2. 打开 AxonHub 的追踪页面,确认能看到当前轮次对应的记录,点击进入后能看到该轮对话包含的所有模型调用。
|
|
98
100
|
3. 查看 AxonHub 的线程页面,确认同一段对话的多个轮次都挂在同一个线程下面。
|
|
99
101
|
4. 新开一段对话并触发自动生成标题,查看线程列表,确认多出一条名称带 `#title` 的独立线程,内部请求类型为标题,且没有混入正常对话。
|
|
100
|
-
5.
|
|
102
|
+
5. 启动一个子代理执行任务,随后查看线程列表,确认多出一条子代理线程,请求类型为 `subagent`。使用标准会话编号时,追踪号应是 16 位十六进制哈希。
|
|
101
103
|
6. 关闭插件总开关后再发送一条消息,使用抓包工具或查看网关日志检查请求头,确认请求中不再包含任何以 `AH` 开头的请求头。
|
|
102
104
|
|
|
103
105
|
此外,插件设置页面最下方的最近请求列表也可用于快速自查,列表中会显示每一条已附加请求头的调用所使用的请求类型和追踪号。
|
|
@@ -126,7 +128,7 @@ dsh plugin --profile desktop remove dsh-axonhub-tracing
|
|
|
126
128
|
|
|
127
129
|
1. 渠道支持范围:插件走 `llm-pi-ai/request-headers`,只覆盖走 `pi-ai` 的渠道,DSH 原生 DeepSeek 接口和订阅账号接口不支持,插件无法介入这些请求。
|
|
128
130
|
2. 外部后端子代理:如果子代理使用的是 Claude Code 或 Codex 等外部后端,这类请求不经过 DSH 的模型层,因此也不会带有本插件的请求头,这属于预期行为。
|
|
129
|
-
3.
|
|
131
|
+
3. 隐私与标识处理:未哈希的线程号和追踪号可能包含会话编号或子代理名称,不包含对话内容。要隐藏原始标识,可将设置文件中的 `hashIds` 改为 `true`。开启后,线程号和追踪号全部使用哈希,不论原始长度;网关后台也不再能直接读出原始含义。模型库在某些协议下可能自行发送会话标识,那部分并非本插件写入,不受 `hashIds` 控制。
|
|
130
132
|
|
|
131
133
|
## 排查
|
|
132
134
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-axonhub-tracing",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "DeepSeek Harness plugin that tags outbound LLM requests with AxonHub tracing headers, with per-provider opt-in and separate branches for subagents, titles, reviews and compaction.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|
package/src/identity.js
CHANGED
|
@@ -10,6 +10,9 @@ import { createHash } from 'node:crypto'
|
|
|
10
10
|
|
|
11
11
|
const MAX_LABEL = 24
|
|
12
12
|
const MAX_DEPTH = 32
|
|
13
|
+
// AxonHub's Responses path appends '-' and 16 hex digits to the trace for
|
|
14
|
+
// prompt_cache_key, leaving 64 - 17 = 47 characters for the trace.
|
|
15
|
+
const MAX_TRACE = 47
|
|
13
16
|
// Header values must stay inside printable ASCII. Labels are restricted to the
|
|
14
17
|
// same set so a localized agent preset can never make the fetch layer throw.
|
|
15
18
|
const SAFE_LABEL = /[^A-Za-z0-9._-]+/gu
|
|
@@ -113,6 +116,6 @@ export function deriveIdentity({ sessionId, purpose, settings, getSession }) {
|
|
|
113
116
|
return {
|
|
114
117
|
kind,
|
|
115
118
|
thread: settings.hashIds ? hashValue(thread) : thread,
|
|
116
|
-
trace: settings.hashIds ? hashValue(trace) : trace,
|
|
119
|
+
trace: settings.hashIds || trace.length > MAX_TRACE ? hashValue(trace) : trace,
|
|
117
120
|
}
|
|
118
121
|
}
|