@tencent-ai/agent-sdk 0.3.157 → 0.3.159

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 (65) hide show
  1. package/cli/CHANGELOG.md +58 -0
  2. package/cli/README.md +2 -0
  3. package/cli/dist/codebuddy-headless.js +862 -790
  4. package/cli/dist/web-ui/assets/index-DOB9MrWi.css +32 -0
  5. package/cli/dist/web-ui/assets/{index-bVNRRvKC.js → index-DlV6l3G1.js} +191 -168
  6. package/cli/dist/web-ui/assets/workbox-window.prod.es5-BBnX5xw4.js +2 -0
  7. package/cli/dist/web-ui/docs/cn/cli/goal.md +161 -0
  8. package/cli/dist/web-ui/docs/cn/cli/hooks.md +12 -4
  9. package/cli/dist/web-ui/docs/cn/cli/monitoring.md +117 -29
  10. package/cli/dist/web-ui/docs/cn/cli/release-notes/README.md +3 -0
  11. package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.98.0.md +48 -0
  12. package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.98.1.md +19 -0
  13. package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.99.0.md +39 -0
  14. package/cli/dist/web-ui/docs/cn/cli/slash-commands.md +1 -0
  15. package/cli/dist/web-ui/docs/en/cli/goal.md +161 -0
  16. package/cli/dist/web-ui/docs/en/cli/hooks.md +10 -2
  17. package/cli/dist/web-ui/docs/en/cli/monitoring.md +118 -30
  18. package/cli/dist/web-ui/docs/en/cli/release-notes/README.md +3 -0
  19. package/cli/dist/web-ui/docs/en/cli/release-notes/v2.98.0.md +48 -0
  20. package/cli/dist/web-ui/docs/en/cli/release-notes/v2.98.1.md +19 -0
  21. package/cli/dist/web-ui/docs/en/cli/release-notes/v2.99.0.md +39 -0
  22. package/cli/dist/web-ui/docs/en/cli/slash-commands.md +1 -0
  23. package/cli/dist/web-ui/docs/search-index-en.json +1 -1
  24. package/cli/dist/web-ui/docs/search-index-zh.json +1 -1
  25. package/cli/dist/web-ui/docs/sidebar-en.json +1 -1
  26. package/cli/dist/web-ui/docs/sidebar-zh.json +1 -1
  27. package/cli/dist/web-ui/index.html +2 -2
  28. package/cli/dist/web-ui/sw.js +1 -1
  29. package/cli/dist/web-ui/{workbox-e082a648.js → workbox-fed2bdfe.js} +1 -1
  30. package/cli/package.json +3 -2
  31. package/cli/product.cloudhosted.json +4 -3
  32. package/cli/product.internal.json +6 -3
  33. package/cli/product.ioa.json +25 -3
  34. package/cli/product.json +31 -7
  35. package/cli/product.selfhosted.json +4 -3
  36. package/cli/vendor/sandbox/sandbox-cli +0 -0
  37. package/lib/auth.js +3 -2
  38. package/lib/auth.js.map +1 -1
  39. package/lib/connect.js +3 -2
  40. package/lib/connect.js.map +1 -1
  41. package/lib/index.js +1 -1
  42. package/lib/mcp/create-sdk-mcp-server.js +3 -2
  43. package/lib/mcp/create-sdk-mcp-server.js.map +1 -1
  44. package/lib/plugin.js +13 -22
  45. package/lib/plugin.js.map +1 -1
  46. package/lib/query.d.ts.map +1 -1
  47. package/lib/query.js +2 -2
  48. package/lib/query.js.map +1 -1
  49. package/lib/session.js +4 -4
  50. package/lib/session.js.map +1 -1
  51. package/lib/transport/index.js +2 -2
  52. package/lib/transport/index.js.map +1 -1
  53. package/lib/transport/process-transport.js +7 -17
  54. package/lib/transport/process-transport.js.map +1 -1
  55. package/lib/utils/cli-resolver.js +6 -6
  56. package/lib/utils/cli-resolver.js.map +1 -1
  57. package/lib/utils/env-utils.js +2 -1
  58. package/lib/utils/env-utils.js.map +1 -1
  59. package/lib/utils/process.js +2 -1
  60. package/lib/utils/process.js.map +1 -1
  61. package/lib/utils/type-guards.js +2 -1
  62. package/lib/utils/type-guards.js.map +1 -1
  63. package/package.json +1 -1
  64. package/cli/dist/web-ui/assets/index-CY6b2fbj.css +0 -32
  65. package/cli/dist/web-ui/assets/workbox-window.prod.es5-BIl4cyR9.js +0 -2
@@ -0,0 +1,161 @@
1
+ # Keep CodeBuddy Working Until a Goal Is Met
2
+
3
+ > Use `/goal` to set a completion condition. CodeBuddy will keep working across multiple turns until the condition is satisfied before handing control back to you.
4
+
5
+ > **Version requirement**: The `/goal` command requires `@tencent-ai/codebuddy-code` with the goal feature included (the `GoalService` module in agent-cli).
6
+
7
+ `/goal` sets a completion condition that CodeBuddy continuously works toward without you prompting it step by step. At the end of each turn, a small-fast model evaluator checks whether the condition holds — if not, CodeBuddy automatically starts the next turn rather than returning control to you. Once the condition is met, the goal is automatically cleared.
8
+
9
+ `/goal` is suitable for tracking substantial work that has a verifiable end state:
10
+
11
+ - Migrating a module to a new API until all call sites compile and tests pass
12
+ - Implementing a design doc until all acceptance criteria are met
13
+ - Splitting a large file into focused modules until each one is within the size budget
14
+ - Processing a list of issues with a certain label until the queue is empty
15
+
16
+ This document covers:
17
+
18
+ - [Comparison with other autonomous workflows](#comparison-with-other-autonomous-workflows): choosing between `/goal`, `/loop`, and Stop hooks
19
+ - [Setting a goal](#setting-a-goal) and [tips for writing effective conditions](#writing-an-effective-condition)
20
+ - [Checking status](#checking-status), [clearing early](#clearing-a-goal-early), [running in non-interactive mode](#running-in-non-interactive-mode)
21
+ - [How the evaluator works](#how-the-evaluator-works)
22
+ - [Implementation notes and known limitations](#implementation-notes-and-known-limitations)
23
+
24
+
25
+ ## Using `/goal`
26
+
27
+ Each session can only have one active goal at a time. The same command takes on the role of "set / view / clear" depending on the arguments.
28
+
29
+ ### Setting a Goal
30
+
31
+ Follow `/goal` with the condition you want to satisfy. If there is already an active goal, the new one replaces it (the old goal's hook is automatically unregistered).
32
+
33
+ ```text
34
+ /goal all tests in test/auth pass and the lint step is clean
35
+ ```
36
+
37
+ Once set, CodeBuddy **immediately starts a turn**, passing "the condition itself" as the instruction to the main agent — you don't need to send an additional prompt. A `⊚ /goal active (Xs)` indicator also appears at the bottom-right of the input box, refreshing every second with the elapsed time, so you always know when goal mode is active.
38
+
39
+ After each turn, the evaluator returns a short reason explaining "why the condition is / is not yet met." This reason is injected into the conversation history as an `isMeta=true` internal message, allowing the model to see the evaluator's perspective on the next turn and precisely address what is missing — this is the key mechanism for the model to "know what steps remain."
40
+
41
+ > **Session-level behavior**: The goal keeps running until the condition is met or you run `/goal clear`. Run `/goal` (no arguments) to see stats like turns and tokens.
42
+
43
+ ### Writing an Effective Condition
44
+
45
+ The [evaluator](#how-the-evaluator-works) judges the condition based solely on what CodeBuddy has **already expressed** in the conversation — it does not run commands or read files itself. So the condition should be phrased in a form that "CodeBuddy's own output can prove." "All tests in `test/auth` pass" works because CodeBuddy will run the tests itself, and the results will be in the transcript for the evaluator to read.
46
+
47
+ A condition that robustly supports multi-turn work typically includes:
48
+
49
+ - **A measurable end state**: test results, build exit codes, file counts, an empty queue…
50
+ - **A provable method**: e.g., ``\`npm test\` exits 0`` or ``\`git status\` is clean``
51
+ - **Inviolable constraints**: things that must not be changed along the way, e.g., "no other test file is modified"
52
+
53
+ The condition length limit is **4000 characters**.
54
+
55
+ If you want to set a fallback upper bound for the goal, add a turn/time clause to the condition, e.g., `or stop after 20 turns`. CodeBuddy will check progress against this clause each turn, and the evaluator can also read it from the conversation.
56
+
57
+ ### Checking Status
58
+
59
+ Run `/goal` without arguments:
60
+
61
+ ```text
62
+ /goal
63
+ ```
64
+
65
+ In the TUI this opens a goal recap panel; in Web UI / ACP clients it opens an equivalent panel via ACP broadcast; in headless / SDK environments without a UI it falls back to plain text output.
66
+
67
+ Panel contents include:
68
+ - The condition
69
+ - Elapsed time
70
+ - Number of evaluated turns
71
+ - Token consumption (incremental during goal)
72
+ - The most recent reason from the evaluator
73
+
74
+ If there is no active goal but a goal was previously achieved in this session, the panel shows that goal's condition, duration, turn count, and token count.
75
+
76
+ ### Clearing a Goal Early
77
+
78
+ ```text
79
+ /goal clear
80
+ ```
81
+
82
+ The following tokens are all treated as synonyms for `clear`: `stop`, `off`, `reset`, `none`, `cancel`. These are only recognized as clear commands on **exact single-token match** — `/goal stop using deprecated API` is still treated as "set a new condition" and won't be consumed.
83
+
84
+ Running `/clear` to restart the session also removes the active goal (hook unregistered + meta cleaned up).
85
+
86
+ ### Resuming a Session with a Goal
87
+
88
+ When resuming a session via `--resume` / `--continue`, an unfinished goal is restored (both condition and scope are preserved).
89
+
90
+ > **Current limitation**: On resume, the original goal's createdAt / turnCount / token starting point are carried over — the timer and counters are not reset. If you want to "restart the clock," first run `/goal clear` and then `/goal <condition>` again. Goals that were already achieved or cleared will not be restored (meta has been deleted).
91
+
92
+ ### Running in Non-Interactive Mode
93
+
94
+ `/goal` works in [non-interactive (headless) mode](./headless.md) and [Remote Control](./remote-control.md). In `-p` mode, setting a goal causes the evaluator loop to run until completion:
95
+
96
+ ```bash
97
+ codebuddy -p "/goal CHANGELOG.md has an entry for every PR merged this week"
98
+ ```
99
+
100
+ To terminate early before the condition is met, press `Ctrl+C`.
101
+
102
+ ---
103
+
104
+ ## How the Evaluator Works
105
+
106
+ `/goal` is a wrapper around a session-level [prompt-based Stop hook](./hooks.md). Whenever CodeBuddy's main agent finishes a turn, **the current condition + the current conversation** are sent together to the configured small-model evaluator. The evaluator returns a three-state result (yes / no / unreachable) with a short reason:
107
+
108
+ - **Yes (`ok: true`)**: Clears the goal, logs an "achieved" event, and the UI shows a `✔ Goal achieved` status bar.
109
+ - **No (`ok: false`)**: Injects the reason as an `isMeta=true` user message into the history (so the main model sees what to work on next), and lets CodeBuddy continue working. Also writes a `goal-progress` UI status bar: `◯ Goal not yet met… continuing`.
110
+ - **Unreachable (`ok: false, impossible: true`)**: Used when the evaluator determines that "this goal simply cannot be completed in the current session" (the condition is self-contradictory, required capabilities/resources are unavailable, or the model has exhausted reasonable attempts). The goal is immediately cleared, and the UI shows `✕ Goal could not be achieved`, preventing the loop from getting stuck.
111
+
112
+ The evaluator uses the small model bound to the **`lite` slot** in the product configuration (mapped to `gpt-5.1-codex-mini` / `gemini-2.5-flash` / DeepSeek `deepseek-v4-flash` etc. depending on the model provider). Evaluation only reads the existing transcript without invoking tools, so using a small model is both fast and cheap.
113
+
114
+ > **Billing**: Tokens consumed by the evaluator are billed to the small model account and are typically negligible compared to the main turn.
115
+
116
+ ### Evaluation Window Constraint
117
+
118
+ To prevent "achieved immediately after setting" — where a previously achieved goal in the same session leaves a success response in the transcript — we inject the current goal's `createdAt` (ISO 8601) into the evaluator's user prompt with an explicit instruction:
119
+
120
+ > Evaluate ONLY the conversation that happened AFTER this timestamp. Earlier messages MUST NOT be used as evidence.
121
+
122
+ If no qualifying activity has occurred since the goal was set, the evaluator must return `{"ok": false, "reason": "Goal was just set; no work has been done yet against the new condition."}`.
123
+
124
+ ### History Sanitization for the Evaluator
125
+
126
+ Before feeding history to the evaluator, we filter out the following extended item types (they are project-specific and unrecognized by the SDK):
127
+
128
+ - `goal-result` / `goal-progress` (goal's own UI status items)
129
+ - `summary` / `topic` / `ai-title` / `custom-title`
130
+ - `file-history-snapshot`
131
+
132
+ These items are neither user input nor assistant responses, have no value for the evaluator's judgment, and would trigger `Unknown item type` warnings from the SDK.
133
+
134
+ ---
135
+
136
+ ## Implementation Notes and Known Limitations
137
+
138
+ The following table summarizes key behaviors and known limitations of the current implementation for debugging reference:
139
+
140
+ | Behavior | Status | Notes |
141
+ | :--- | :--- | :--- |
142
+ | Set / replace / kick-off | ✅ | Immediately starts a turn after setting; auto-replaces when there's already an active goal |
143
+ | `/goal clear` aliases | ✅ | Supports five single-token synonyms: stop / off / reset / none / cancel |
144
+ | `/clear` also clears active goal | ✅ | Unregisters goal hook and cleans meta on session restart |
145
+ | Condition limit | ✅ | 4000 characters |
146
+ | Reason feedback into history | ✅ | Injection format: `Stop hook feedback: [<condition>]: <reason>` |
147
+ | Three-state semantics (ok / not-yet / impossible) | ✅ | Immediately clears goal on unreachable, preventing infinite loops |
148
+ | Evaluator uses small model | ✅ | Uses the model bound to `lite` slot (mapped per provider) |
149
+ | `/goal` no-arg → status view | ✅ | TUI / Web UI panel + headless text fallback |
150
+ | Persistent running indicator `⊚ /goal active (Xs)` | ✅ | Always visible at bottom-right of input box, 1Hz refresh |
151
+ | `--resume` turn / timer / token reset | ❌ Pending | Currently carries over original createdAt / turnCount; use `/goal clear` + re-set to restart |
152
+
153
+ ---
154
+
155
+ ## See Also
156
+
157
+ - [`/loop` for scheduled tasks](./scheduled-tasks.md#使用-loop-创建循环任务): Triggers repeatedly on a time interval, rather than until a condition is met
158
+ - [Hooks Guide](./hooks-guide.md) / [Hooks Reference](./hooks.md): Understand the underlying mechanism of prompt-based Stop hooks; write your own when you need more complex evaluation logic
159
+ - [Non-interactive (headless) mode](./headless.md): Run `/goal` in CI / scripts via `-p`
160
+ - [Remote Control](./remote-control.md): Trigger goals in Web UI / WeChat channels
161
+ - [Slash Commands Overview](./slash-commands.md): Index of all built-in slash commands
@@ -142,11 +142,13 @@ Besides shell commands (`type: "command"`), CodeBuddy Code also supports prompt-
142
142
 
143
143
  > **Supported events**: Currently only `Stop`, `UserPromptSubmit`, and `PreToolUse` events are supported.
144
144
 
145
+ > **Session-level shortcut**: The built-in slash command [`/goal`](./goal.md) is a ready-to-use wrapper around prompt-based Stop hooks — simply type `/goal <condition>` to have CodeBuddy keep working until the condition is met, without writing hook configuration manually. If your evaluation logic can be expressed as a condition string, prefer `/goal`; only fall back to writing your own prompt hook when you need more complex prompt orchestration or cross-event coordination.
146
+
145
147
  ### How Prompt Hooks Work
146
148
 
147
149
  Instead of running a bash command, the hook:
148
150
 
149
- 1. Sends the hook input plus your prompt to a fast LLM (Haiku).
151
+ 1. Sends the hook input plus your prompt to a fast small model (bound to the `lite` slot, mapped per model provider).
150
152
  2. Receives a structured JSON decision.
151
153
  3. Lets CodeBuddy Code enforce that decision.
152
154
 
@@ -201,7 +203,8 @@ The LLM must return JSON:
201
203
  ```jsonc
202
204
  {
203
205
  "ok": true | false,
204
- "reason": "Explanation for the decision" // Required when ok is false
206
+ "reason": "Explanation for the decision", // Required when ok is false
207
+ "impossible": false // Optional, only effective for Stop events
205
208
  }
206
209
  ```
207
210
 
@@ -209,6 +212,9 @@ The LLM must return JSON:
209
212
 
210
213
  - `ok`: `true` to allow the operation, `false` to block it
211
214
  - `reason`: Required when `ok` is `false`, explanation shown to CodeBuddy
215
+ - `impossible`: Optional boolean, only meaningful for `Stop` hooks. `{ok: false, impossible: true}` indicates that the evaluator has determined "this goal is fundamentally impossible to achieve within the current session" (contradictory conditions, unavailable resources, or the model has exhausted all reasonable attempts). CodeBuddy will stop looping and the UI displays a "cannot be achieved" terminal state. A plain `{ok: false}` still means "not yet achieved, keep working".
216
+
217
+ **`reason` injection into history semantics**: When a `Stop` hook returns `{ok: false}`, the `reason` text is not simply "shown to CodeBuddy" — it is injected as an internal user message with `isMeta=true` into the conversation history, so that the main model sees the evaluator's perspective in the next turn and can precisely address the outstanding gaps. This is the core mechanism that allows prompt-based Stop hooks to drive multi-turn iterative convergence (the `/goal` command relies on this pipeline under the hood).
212
218
 
213
219
  ### Example: Smart Stop Hook
214
220
 
@@ -360,6 +366,8 @@ Runs after the user submits a prompt but before CodeBuddy processes it. Useful f
360
366
 
361
367
  Runs when the primary CodeBuddy agent finishes responding (skipped if the user manually interrupts).
362
368
 
369
+ > **Session-level shortcut**: The built-in slash command [`/goal`](./goal.md) is a wrapper around session-scoped prompt-based Stop hooks — `/goal <condition>` is all it takes to register a Stop hook that keeps CodeBuddy working until the condition is met, automatically handling three-state evaluation (achieved / not yet achieved, keep working / impossible to achieve), turn counting, token statistics, and `/resume` auto-recovery. When you need a session-level "keep working until X" behavior, prefer `/goal` instead of writing hook configuration manually.
370
+
363
371
  ### SubagentStop
364
372
 
365
373
  Runs when a CodeBuddy sub-agent (Task tool) finishes.
@@ -1,44 +1,117 @@
1
1
  # Monitoring CodeBuddy Code with OpenTelemetry
2
2
 
3
- CodeBuddy Code supports exporting internal traces to your own OpenTelemetry Collector via the standard OTLP protocol, making it easy to integrate with self-hosted observability platforms.
3
+ CodeBuddy Code supports exporting traces to your own OpenTelemetry Collector via the standard OTLP protocol, making it easy to integrate with self-hosted observability platforms.
4
4
 
5
- > **MVP Scope**: Currently only **traces** (distributed tracing) are supported; custom export of metrics and logs is not yet available. Support will be expanded as needed.
5
+ > **Current Scope**: Supports **traces** (distributed tracing) + 4 privacy opt-in switches. Custom export of metrics and logs is not yet supported.
6
6
 
7
- ## How to Enable
8
-
9
- Once the enable switch is set, traces will be exported using OTel standard environment variables:
7
+ ## Quick Start
10
8
 
11
9
  ```bash
10
+ # 1. Enable telemetry
12
11
  export CODEBUDDY_CODE_ENABLE_TELEMETRY=1
13
- export OTEL_EXPORTER_OTLP_ENDPOINT=https://otel-collector.example.com
12
+
13
+ # 2. Configure OTLP endpoint
14
+ export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
15
+
16
+ # 3. (Optional) Enable privacy opt-in content recording
17
+ export OTEL_LOG_USER_PROMPTS=1
18
+ export OTEL_LOG_TOOL_DETAILS=1
19
+ export OTEL_LOG_TOOL_CONTENT=1
20
+
21
+ # 4. Run
14
22
  codebuddy
15
23
  ```
16
24
 
17
- > A legacy alias `CLAUDE_CODE_ENABLE_TELEMETRY` is also accepted for backward compatibility and is equivalent to `CODEBUDDY_CODE_ENABLE_TELEMETRY`.
25
+ > Claude Code compatibility: `CLAUDE_CODE_ENABLE_TELEMETRY` is equivalent to `CODEBUDDY_CODE_ENABLE_TELEMETRY`.
18
26
 
19
- ## Key Environment Variables
27
+ ## Configuration Variables
20
28
 
21
- For the full list, see [env-vars.md](env-vars.md#opentelemetry-custom-export-traces). Common ones:
29
+ ### Basic Configuration
22
30
 
23
- | Variable | Purpose |
24
- |----------|---------|
25
- | `CODEBUDDY_CODE_ENABLE_TELEMETRY=1` | Enable the OTel export switch |
26
- | `OTEL_TRACES_EXPORTER` | `otlp` (default) / `console` / `none` |
27
- | `OTEL_EXPORTER_OTLP_ENDPOINT` | OTLP Collector address; `/v1/traces` is appended automatically |
28
- | `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` | Full URL specific to traces; takes higher priority |
29
- | `OTEL_EXPORTER_OTLP_HEADERS` | Request headers `k1=v1,k2=v2`; values support URL encoding |
30
- | `OTEL_SERVICE_NAME` | Override the default `service.name` |
31
- | `OTEL_RESOURCE_ATTRIBUTES` | Additional resource attributes |
31
+ | Variable | Purpose | Example |
32
+ |----------|---------|---------|
33
+ | `CODEBUDDY_CODE_ENABLE_TELEMETRY` | Enable OTel export (required) | `1` |
34
+ | `OTEL_TRACES_EXPORTER` | Exporter type | `otlp` (default), `console`, `none` |
35
+ | `OTEL_EXPORTER_OTLP_ENDPOINT` | OTLP Collector address; `/v1/traces` is appended automatically | `http://localhost:4318` |
36
+ | `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` | Full URL specific to traces; takes higher priority | `http://localhost:4318/v1/traces` |
37
+ | `OTEL_EXPORTER_OTLP_HEADERS` | Request headers `k1=v1,k2=v2`; values support URL encoding | `Authorization=Bearer%20token` |
38
+ | `OTEL_EXPORTER_OTLP_TRACES_PROTOCOL` | Transport protocol | `http/protobuf` (only supported) |
39
+ | `OTEL_SERVICE_NAME` | Override the default `service.name` | `codebuddy-code` |
40
+ | `OTEL_RESOURCE_ATTRIBUTES` | Additional resource attributes | `team=platform,env=prod` |
32
41
 
33
- ## Protocol Support
42
+ ### Privacy Opt-in Switches
34
43
 
35
- Only **`http/protobuf`** (OTLP/HTTP + Protobuf encoding) is supported, consistent with the CodeBuddy Code default.
44
+ Spans do not record any sensitive information by default (prompt content, tool parameters, tool output, etc.). You need to opt in progressively via the following environment variables:
45
+
46
+ | Variable | Purpose | Recorded Content |
47
+ |----------|---------|-----------------|
48
+ | `OTEL_LOG_USER_PROMPTS=1` | Record user prompts | `user_prompt` attribute (not recorded by default; only `user_prompt_length` is recorded) |
49
+ | `OTEL_LOG_TOOL_DETAILS=1` | Record tool parameters | `tool_input` attribute (~4KB truncation) + tool-specific attributes (`file.path`, `command`, etc.) |
50
+ | `OTEL_LOG_TOOL_CONTENT=1` | Record full tool input/output | `tool_input`/`tool_result` span events (60KB truncation) |
51
+ | `OTEL_LOG_RAW_API_BODIES=1` | Record full API request/response bodies | Reserved, not yet implemented |
52
+
53
+ ## Span Structure
54
+
55
+ Each user prompt produces a `codebuddy_code.interaction` root span. Tool calls are recorded as child spans:
56
+
57
+ ```
58
+ codebuddy_code.interaction
59
+ ├── codebuddy_code.tool (Read)
60
+ ├── codebuddy_code.tool (Bash)
61
+ └── codebuddy_code.tool (Agent -> child agent tool spans)
62
+ ```
36
63
 
37
- Setting `OTEL_EXPORTER_OTLP_PROTOCOL=grpc` or `http/json` will be ignored with a warning logged, and will fall back to the default protobuf.
64
+ ### Span Attributes
65
+
66
+ All spans include a `span.type` attribute to identify the type.
67
+
68
+ **`codebuddy_code.interaction`**
69
+
70
+ | Attribute | Description | Controlled By |
71
+ |-----------|-------------|---------------|
72
+ | `span.type` | Fixed value `"interaction"` | |
73
+ | `conversation.id` | Conversation ID | |
74
+ | `conversation.agent` | Agent name | |
75
+ | `user_prompt` | User prompt content (not recorded when disabled) | `OTEL_LOG_USER_PROMPTS` |
76
+ | `user_prompt_length` | Prompt length (always recorded) | |
77
+ | `conversation.cancelled` | `true` when conversation is cancelled | |
78
+
79
+ **`codebuddy_code.tool`**
80
+
81
+ | Attribute | Description | Controlled By |
82
+ |-----------|-------------|---------------|
83
+ | `span.type` | Fixed value `"tool"` | |
84
+ | `tool_name` | Tool name | |
85
+ | `tool.call_id` | Tool call ID (always recorded) | |
86
+ | `file.path` | File path (Read/Write/Edit) | `OTEL_LOG_TOOL_DETAILS` |
87
+ | `command` | Bash command | `OTEL_LOG_TOOL_DETAILS` |
88
+ | `command.timeout` | Command timeout (milliseconds) | `OTEL_LOG_TOOL_DETAILS` |
89
+ | `glob.pattern` | Glob search pattern | `OTEL_LOG_TOOL_DETAILS` |
90
+ | `grep.pattern` | Grep regex pattern | `OTEL_LOG_TOOL_DETAILS` |
91
+ | `http.url` | WebFetch URL | `OTEL_LOG_TOOL_DETAILS` |
92
+ | `search.query` | WebSearch query | `OTEL_LOG_TOOL_DETAILS` |
93
+ | `agent.prompt` | Sub-agent prompt | `OTEL_LOG_TOOL_DETAILS` |
94
+ | `agent.type` | Sub-agent type | `OTEL_LOG_TOOL_DETAILS` |
95
+ | `mcp.server` | MCP server name | `OTEL_LOG_TOOL_DETAILS` |
96
+ | `mcp.tool` | MCP tool name | `OTEL_LOG_TOOL_DETAILS` |
97
+ | `tool_input` | Tool input JSON (~4KB truncation) | `OTEL_LOG_TOOL_DETAILS` |
98
+ | `tool_input_truncated` | Whether input was truncated | `OTEL_LOG_TOOL_DETAILS` |
99
+ | `tool_input_original_length` | Original length before truncation | `OTEL_LOG_TOOL_DETAILS` |
100
+
101
+ **`codebuddy_code.tool` span events** (requires `OTEL_LOG_TOOL_CONTENT=1`)
102
+
103
+ | Event Name | Attribute | Description |
104
+ |------------|-----------|-------------|
105
+ | `tool_input` | `content` | Full tool input (60KB truncation) |
106
+ | `tool_input` | `content_truncated` | Whether truncated |
107
+ | `tool_input` | `content_original_length` | Length before truncation |
108
+ | `tool_result` | `content` | Full tool output (60KB truncation) |
109
+ | `tool_result` | `content_truncated` | Whether truncated |
110
+ | `tool_result` | `content_original_length` | Length before truncation |
38
111
 
39
112
  ## Typical Scenarios
40
113
 
41
- ### 1. Export to a Self-Hosted Enterprise Collector
114
+ ### Export to a Self-Hosted Enterprise Collector
42
115
 
43
116
  ```bash
44
117
  export CODEBUDDY_CODE_ENABLE_TELEMETRY=1
@@ -48,16 +121,17 @@ export OTEL_SERVICE_NAME=codebuddy-code
48
121
  export OTEL_RESOURCE_ATTRIBUTES=deployment.environment=prod,team=copilot
49
122
  ```
50
123
 
51
- ### 2. Local Debug Trace Output
52
-
53
- For debugging, send traces directly to stdout:
124
+ ### Local Debugging (Console Output)
54
125
 
55
126
  ```bash
56
127
  export CODEBUDDY_CODE_ENABLE_TELEMETRY=1
57
128
  export OTEL_TRACES_EXPORTER=console
129
+ export OTEL_LOG_USER_PROMPTS=1
130
+ export OTEL_LOG_TOOL_DETAILS=1
131
+ export OTEL_LOG_TOOL_CONTENT=1
58
132
  ```
59
133
 
60
- ### 3. Temporarily Disable
134
+ ### Disable Telemetry
61
135
 
62
136
  ```bash
63
137
  export OTEL_TRACES_EXPORTER=none
@@ -68,15 +142,25 @@ export DISABLE_TELEMETRY=1
68
142
  ## Priority and Fallback
69
143
 
70
144
  1. `DISABLE_TELEMETRY=1` has the highest priority and disables all telemetry.
71
- 2. Enable evaluation: enabled in the built-in product configuration **or** `CODEBUDDY_CODE_ENABLE_TELEMETRY` (or its legacy alias `CLAUDE_CODE_ENABLE_TELEMETRY`) is set to a truthy value (`1` / `true` / `yes` / `on`).
145
+ 2. Enable evaluation: enabled in the built-in product configuration **or** `CODEBUDDY_CODE_ENABLE_TELEMETRY` / `CLAUDE_CODE_ENABLE_TELEMETRY` is set to a truthy value (`1` / `true` / `yes` / `on`).
72
146
  3. Endpoint priority: `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` > `OTEL_EXPORTER_OTLP_ENDPOINT` > `telemetry.tracing.url` in the built-in product configuration.
73
147
  4. Headers: env and product configuration are merged; env keys with the same name override product configuration.
74
148
 
75
- ## FAQ
149
+ ## Protocol Support
150
+
151
+ Only **`http/protobuf`** (OTLP/HTTP + Protobuf encoding) is supported, consistent with the Claude Code default.
76
152
 
77
- ### Will prompts or code content be written into traces?
153
+ Setting `OTEL_EXPORTER_OTLP_PROTOCOL=grpc` or `http/json` will be ignored with a warning logged, falling back to the default protobuf.
78
154
 
79
- No. CodeBuddy Code traces only record structured metrics such as tool calls, model calls, and durations. They do not contain user conversation content or source code. If you need to record code snippets, you must separately enable the standard reporting channel (which is outside the scope of this feature).
155
+ ## Security and Privacy
156
+
157
+ - Spans only record tool names and call IDs by default, **excluding** user prompts, tool parameters, file content, or source code
158
+ - `user_prompt_length` is always recorded (length only); prompt text requires `OTEL_LOG_USER_PROMPTS=1` to be written
159
+ - Tool parameters (file paths, commands, etc.) require `OTEL_LOG_TOOL_DETAILS=1`; individual values exceeding 512 characters are truncated, with a total limit of ~4KB
160
+ - Full tool input/output requires `OTEL_LOG_TOOL_CONTENT=1`, recorded via span events, truncated at 60KB
161
+ - All opt-in switches are disabled by default; enterprise administrators can configure them uniformly via managed settings
162
+
163
+ ## FAQ
80
164
 
81
165
  ### Does it conflict with the internal enterprise reporting channel?
82
166
 
@@ -85,3 +169,7 @@ No conflict. OTel custom export and the built-in standard reporting (`telemetry.
85
169
  ### Is metrics / logs supported?
86
170
 
87
171
  Not yet supported, but planned. If you have a strong need, please provide feedback on the corresponding Issue.
172
+
173
+ ### Is it compatible with Claude Code's OTEL format?
174
+
175
+ Yes. Span naming, attribute naming, and truncation strategies are aligned with Claude Code's conventions (`{product}.interaction` / `{product}.tool`), ensuring upstream analysis platforms can process them uniformly.
@@ -17,6 +17,9 @@ Difference from CHANGELOG.md:
17
17
 
18
18
  <!-- New versions are automatically added here -->
19
19
 
20
+ - [v2.99.0](./v2.99.0.md) - 2026-05-27
21
+ - [v2.98.1](./v2.98.1.md) - 2026-05-25
22
+ - [v2.98.0](./v2.98.0.md) - 2026-05-24
20
23
  - [v2.97.5](./v2.97.5.md) - 2026-05-22
21
24
  - [v2.97.4](./v2.97.4.md) - 2026-05-21
22
25
  - [v2.97.3](./v2.97.3.md) - 2026-05-19
@@ -0,0 +1,48 @@
1
+ # 🚀 CodeBuddy Code v2.98.0 Release
2
+
3
+ ## 📦 Version Info
4
+
5
+ | Component | Version |
6
+ |------|------|
7
+ | CodeBuddy Code CLI | v2.98.0 |
8
+ | Agent SDK JS | v0.3.156 |
9
+ | Agent SDK Python | v0.3.155 |
10
+
11
+ ## ✨ New Features
12
+
13
+ ### OpenTelemetry Custom Reporting (Traces)
14
+
15
+ Support exporting internal traces to your own Collector via standard OTel environment variables, enabling integration with enterprise observability platforms:
16
+
17
+ ```bash
18
+ export CODEBUDDY_CODE_ENABLE_TELEMETRY=1
19
+ export OTEL_EXPORTER_OTLP_ENDPOINT=https://otel.corp.example.com
20
+ export OTEL_EXPORTER_OTLP_HEADERS=Authorization=Bearer%20<TOKEN>
21
+ ```
22
+
23
+ Supports standard variables such as `OTEL_TRACES_EXPORTER` / `OTEL_SERVICE_NAME` / `OTEL_RESOURCE_ATTRIBUTES`. See `docs/monitoring.md` for details.
24
+
25
+ ### Sandbox Ecosystem Asset Directory Allowlist
26
+
27
+ The sandbox security policy now allows write access to WorkBuddy ecosystem asset directories and cross-platform skill directories by default, reducing access restriction issues for plugins, skills, and connectors in sandbox environments.
28
+
29
+ ## 🔧 Improvements
30
+
31
+ - **Auto-compact window increase**: For models without `maxInputTokens` configured, the default auto-compact window has been raised from 100k to 200k tokens
32
+ - **Hooks inject agent_id / agent_type**: All hook event payloads now include trigger source identifiers, making it easier to distinguish between main sessions and sub-agents in global hooks
33
+ - **Hook deduplication refinement**: Resolved "same event triggered twice" issue — same command across settings scopes is collapsed into one, while different plugin/sub-agent scopes each retain their own copy
34
+ - **Multi-source hook hit observability**: When a single event matches ≥ 2 different hooks, logs now list all matched commands for easier conflict debugging
35
+ - **CLI documentation updates**: Added `monitoring.md` and `codebuddy-dir.md`, completed v2.96.1 ~ v2.97.5 release notes bilingual sync and navigation updates
36
+
37
+ ## 🐛 Bug Fixes
38
+
39
+ - **Background Bash zombie processes**: Fixed zombie processes left by background commands like `nohup`. stdout/stderr now write directly to file descriptors; added 50MB output watchdog (`CODEBUDDY_BASH_BG_MAX_OUTPUT_BYTES` configurable) and `CODEBUDDY_BASH_BG_PIPE_MODE=1` rollback switch
40
+ - **Official Copilot gateway retains thinking field**: Fixed an issue where the thinking field was prematurely cleared when requests with `auto` model thinking enabled were sent to the official gateway
41
+ - **Compact type passthrough**: Fixed an issue where auto-compact and manual `/compact` could not be distinguished in ACP `_meta`
42
+ - **Process termination reliability**: Fixed issues where `kill()` was blocked by `_disposed` flag after `dispose()`, and `disposeAll()` exit event routing was lost
43
+
44
+ ## 📝 Documentation Updates
45
+
46
+ - **CLI Monitoring Documentation**: Added `monitoring.md` covering OpenTelemetry custom reporting
47
+ - **Directory Structure Guide**: Added `codebuddy-dir.md` explaining `~/.codebuddy/` and `.codebuddy/` directory structure, configuration priority, and memory loading order
48
+ - **Release Notes Index**: Added bilingual release notes for 7 versions from v2.96.1 ~ v2.97.5
@@ -0,0 +1,19 @@
1
+ # 🚀 CodeBuddy Code v2.98.1 Release
2
+
3
+ ## 📦 Version Info
4
+
5
+ | Component | Version |
6
+ |------|------|
7
+ | CodeBuddy Code CLI | v2.98.1 |
8
+ | Agent SDK JS | v0.3.157 |
9
+ | Agent SDK Python | v0.3.156 |
10
+
11
+ ## 📌 Overview
12
+
13
+ v2.98.0 failed to publish to npm due to an OOM issue in the release pipeline. This version is a re-release as v2.98.1. **It is functionally identical to v2.98.0** — all new features, improvements, and fixes from v2.98.0 are included in this version. If you previously attempted to install v2.98.0 and it failed, please upgrade directly to v2.98.1.
14
+
15
+ For full change details, refer to the [v2.98.0 Release Notes](./v2.98.0.md).
16
+
17
+ ## 🐛 Bug Fixes
18
+
19
+ - **Fix agent-cli release pipeline OOM**: Increased the Node heap memory limit to 8GB during the release build stage, resolving the issue where v2.98.0 was terminated by the OOM Killer during `yarn build`, preventing the npm package from being published, and ensuring stable publishing for subsequent versions.
@@ -0,0 +1,39 @@
1
+ # 🚀 CodeBuddy Code v2.99.0 Release
2
+
3
+ ## 📦 Version Information
4
+
5
+ | Component | Version |
6
+ |-----------|---------|
7
+ | CodeBuddy Code CLI | v2.99.0 |
8
+ | Agent SDK JS | v0.3.158 |
9
+ | Agent SDK Python | v0.3.157 |
10
+
11
+ ## ✨ New Features
12
+
13
+ ### `/goal` Command: Keep CodeBuddy Working Until Goal is Achieved
14
+
15
+ New `/goal` slash command that lets you set a completion condition, after which CodeBuddy will continue working across multiple turns until the condition is met:
16
+
17
+ - `/goal all tests pass` — At the end of each turn, a lightweight model evaluator checks whether the condition is met; if not, it automatically continues
18
+ - `/goal` — View current goal status (elapsed time, turn count, token consumption)
19
+ - `/goal clear` — End the goal early
20
+
21
+ Supports tri-state evaluation: achieved (stop), not achieved (continue working), unachievable (avoid infinite loops). Goals are automatically reloaded when resuming a session via `/resume`. Web UI supports progress bars and terminal state overlays.
22
+
23
+ ### Credit Consumption Push
24
+
25
+ Attaches `usage` details with a `credit` field to the standard ACP `usage_update`, enabling upstream systems to accumulate and display consumed Credits per turn.
26
+
27
+ ### Gemini-3.5-Flash Model
28
+
29
+ Added Gemini-3.5-Flash model support with million-token context window, balanced reasoning capabilities, suitable for everyday use.
30
+
31
+ ## 🐛 Bug Fixes
32
+
33
+ - **Security Fix (RCE)**: Fixed a remote code execution vulnerability where `apiKeyHelper` configuration was executed before the directory trust dialog appeared; project-scoped configurations now must wait for directory trust completion before execution
34
+ - **Hook Input Fix**: `agent_type` now correctly reflects the configured agent name; SubagentStop's `agent_transcript_path` now points to the correct path
35
+ - **Plan Mode Permission Restore**: Fixed an issue where ExitPlanMode incorrectly downgraded permissions when the session had already exited Plan Mode
36
+ - **Team Task Stop Reliability**: Fixed occasional inability to stop members immediately after startup, and members still showing as running after being force-terminated
37
+ - **Plugin Hot-Watch Infinite Loop**: Fixed an infinite loop issue with change events in PluginsProductProvider
38
+ - **Multi-line Input Arrow Keys**: Fixed down arrow key being intercepted by shortcuts after multi-line input while background tasks are running
39
+ - **Custom Model Tool Call**: Added `SkipToolCallSupportCheck` switch; dedicated editions no longer remove tools/tool_choice fields
@@ -30,6 +30,7 @@ These commands are used to manage your CodeBuddy Code sessions. Here is the curr
30
30
  | `/model:image-to-image` | `[list \| model-id]` | ✅ Supported | Switch or view the currently used image-to-image model. Opens an interactive selection interface when used without parameters, `list` lists available models, or directly switches to the specified model when provided with a model ID. |
31
31
  | `/permissions` | | ✅ Supported | Manage tool permissions and workspace directory access permissions. |
32
32
  | `/plan` | | ✅ Supported | Preview the plan file content in the current plan mode. |
33
+ | `/goal` | `<condition> \| clear` | ✅ Supported | Keep working until a condition is met. `/goal <condition>` sets a goal condition (e.g., `/goal all tests pass`), registering a session-level prompt-based Stop hook. Each time the model wants to stop, a small-model evaluator checks whether the condition is satisfied; if not, it injects the reason into history so the model continues working. `/goal` without arguments opens the recap panel. `/goal clear` (aliases: `stop` / `off` / `reset` / `none` / `cancel`) ends the goal early. See [Goal Documentation](./goal.md). |
33
34
  | `/upgrade` | | ✅ Supported | Open the upgrade page in your browser to view premium features and subscription options. |
34
35
  | `/bashes` | | ✅ Supported | List and manage background tasks. |
35
36
  | `/terminal-setup` | | ✅ Supported | Configure Shift+Enter keyboard shortcut binding for inserting line breaks in the input box. |