Skip to content

Commit fb7f3a5

Browse files
author
SqlRush
committed
Show bridge status summaries
1 parent b5e1f57 commit fb7f3a5

4 files changed

Lines changed: 62 additions & 5 deletions

File tree

docs/cc-100-roadmap.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1456,7 +1456,7 @@ M7 补充:terminal input parser 和 configurable keybinding name parser 现在
14561456
- Chrome/computer-use/voice/native integrations。
14571457
- enterprise/gated/platform-specific behavior。
14581458

1459-
当前状态:已新增 `advanced` settings gate 地基,覆盖 bridge/LSP/telemetry/Chrome/voice/computer-use/native integrations 的独立 bool 开关解析、settings merge、headless `/config show advanced` 和 `/config search` 审计;`advanced.telemetry=true` 时会在 session 目录写入安全摘要 JSONL 诊断事件,记录事件类型、session/model、tool/progress keys、token/compact/error 摘要,不写入用户/助手正文或工具结果内容,并已有安全 JSONL 读取、类型/模型过滤、汇总统计和 headless `/status show telemetry` 地基;`advanced.lsp=true` 时才向模型暴露只读 `LSPDiagnostics` 工具,用于读取 session-scoped diagnostics snapshot,并支持 file/severity/limit 过滤,底层已能解析 LSP `textDocument/publishDiagnostics` params/notification payload、按文件替换 snapshot,并按 LSP 空 diagnostics 语义清空旧文件诊断;`advanced.bridge=true` 时会写出 session-scoped bridge manifest,列出 bridge-safe slash/local command 元数据,并提供 command/display/alias 安全解析;未启用时仍不注册或泄露 gated 工具 schema。实际 repl bridge server、session websocket/direct connect、LSP server manager、diagnostic producer、telemetry exporter/tracing、Chrome/voice/computer-use/native runtime 仍未完成。
1459+
当前状态:已新增 `advanced` settings gate 地基,覆盖 bridge/LSP/telemetry/Chrome/voice/computer-use/native integrations 的独立 bool 开关解析、settings merge、headless `/config show advanced` 和 `/config search` 审计;`advanced.telemetry=true` 时会在 session 目录写入安全摘要 JSONL 诊断事件,记录事件类型、session/model、tool/progress keys、token/compact/error 摘要,不写入用户/助手正文或工具结果内容,并已有安全 JSONL 读取、类型/模型过滤、汇总统计和 headless `/status show telemetry` 地基;`advanced.lsp=true` 时才向模型暴露只读 `LSPDiagnostics` 工具,用于读取 session-scoped diagnostics snapshot,并支持 file/severity/limit 过滤,底层已能解析 LSP `textDocument/publishDiagnostics` params/notification payload、按文件替换 snapshot,并按 LSP 空 diagnostics 语义清空旧文件诊断;`advanced.bridge=true` 时会写出 session-scoped bridge manifest,列出 bridge-safe slash/local command 元数据,提供 command/display/alias 安全解析,并可通过 headless `/status show bridge` 审计;未启用时仍不注册或泄露 gated 工具 schema。实际 repl bridge server、session websocket/direct connect、LSP server manager、diagnostic producer、telemetry exporter/tracing、Chrome/voice/computer-use/native runtime 仍未完成。
14601460

14611461
## Recommended Next Steps
14621462

docs/claude-code-go-rewrite-plan.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ test/parity/ # golden tests against TS/official behavior
745745
- 每个 gated feature 独立开关测试。
746746
- 不启用 feature 时二进制行为和可见 schema 不泄露 gated 工具/命令。
747747

748-
- 本轮补充:新增 `advanced` settings gate 地基,覆盖 bridge/LSP/telemetry/Chrome/voice/computer-use/native integrations 的独立 bool 开关解析、settings merge、headless `/config show advanced` 和 `/config search` 审计;`advanced.telemetry=true` 时会在 session 目录写入安全摘要 JSONL 诊断事件,记录事件类型、session/model、tool/progress keys、token/compact/error 摘要,不写入用户/助手正文或工具结果内容,并已有安全 JSONL 读取、类型/模型过滤、汇总统计和 headless `/status show telemetry` 地基;`advanced.lsp=true` 时才向模型暴露只读 `LSPDiagnostics` 工具,用于读取 session-scoped diagnostics snapshot,并支持 file/severity/limit 过滤,底层已能解析 LSP `textDocument/publishDiagnostics` params/notification payload、按文件替换 snapshot,并按 LSP 空 diagnostics 语义清空旧文件诊断;`advanced.bridge=true` 时会写出 session-scoped bridge manifest,列出 bridge-safe slash/local command 元数据,并提供 command/display/alias 安全解析;未启用时仍不注册或泄露 gated 工具 schema。实际 repl bridge server、session websocket/direct connect、LSP server manager、diagnostic producer、telemetry exporter/tracing、Chrome/voice/computer-use/native runtime 仍未完成。
748+
- 本轮补充:新增 `advanced` settings gate 地基,覆盖 bridge/LSP/telemetry/Chrome/voice/computer-use/native integrations 的独立 bool 开关解析、settings merge、headless `/config show advanced` 和 `/config search` 审计;`advanced.telemetry=true` 时会在 session 目录写入安全摘要 JSONL 诊断事件,记录事件类型、session/model、tool/progress keys、token/compact/error 摘要,不写入用户/助手正文或工具结果内容,并已有安全 JSONL 读取、类型/模型过滤、汇总统计和 headless `/status show telemetry` 地基;`advanced.lsp=true` 时才向模型暴露只读 `LSPDiagnostics` 工具,用于读取 session-scoped diagnostics snapshot,并支持 file/severity/limit 过滤,底层已能解析 LSP `textDocument/publishDiagnostics` params/notification payload、按文件替换 snapshot,并按 LSP 空 diagnostics 语义清空旧文件诊断;`advanced.bridge=true` 时会写出 session-scoped bridge manifest,列出 bridge-safe slash/local command 元数据,提供 command/display/alias 安全解析,并可通过 headless `/status show bridge` 审计;未启用时仍不注册或泄露 gated 工具 schema。实际 repl bridge server、session websocket/direct connect、LSP server manager、diagnostic producer、telemetry exporter/tracing、Chrome/voice/computer-use/native runtime 仍未完成。
749749

750750
### M12: Parity hardening
751751

internal/conversation/run.go

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"time"
1313

1414
"ccgo/internal/api/anthropic"
15+
bridgepkg "ccgo/internal/bridge"
1516
"ccgo/internal/commands"
1617
compactpkg "ccgo/internal/compact"
1718
"ccgo/internal/config"
@@ -579,10 +580,10 @@ func (r Runner) formatStatusSummary(raw string) string {
579580
switch args[0] {
580581
case "show", "info":
581582
if len(args) < 2 || strings.TrimSpace(args[1]) == "" {
582-
return "Usage: /status " + args[0] + " <session|model|auth|tools|mcp|plugins|telemetry>"
583+
return "Usage: /status " + args[0] + " <session|model|auth|tools|mcp|plugins|telemetry|bridge>"
583584
}
584585
return r.formatStatusShow(args[1])
585-
case "session", "model", "auth", "tools", "mcp", "plugins", "telemetry":
586+
case "session", "model", "auth", "tools", "mcp", "plugins", "telemetry", "bridge":
586587
return r.formatStatusShow(args[0])
587588
default:
588589
return "Status section is not implemented in the Go runtime yet: " + strings.Join(args, " ")
@@ -723,8 +724,10 @@ func (r Runner) formatStatusShow(raw string) string {
723724
return strings.Join(lines, "\n")
724725
case "telemetry":
725726
return r.formatStatusTelemetry()
727+
case "bridge":
728+
return r.formatStatusBridge()
726729
default:
727-
return "Unknown status section " + strings.TrimSpace(raw) + ". Available sections: session, model, auth, tools, mcp, plugins, telemetry"
730+
return "Unknown status section " + strings.TrimSpace(raw) + ". Available sections: session, model, auth, tools, mcp, plugins, telemetry, bridge"
728731
}
729732
}
730733

@@ -747,11 +750,49 @@ func normalizeStatusSection(raw string) string {
747750
return "plugins"
748751
case "telemetry", "telemetry-events", "diagnostics", "trace", "tracing":
749752
return "telemetry"
753+
case "bridge", "repl-bridge", "remote-control", "control":
754+
return "bridge"
750755
default:
751756
return compact
752757
}
753758
}
754759

760+
func (r Runner) formatStatusBridge() string {
761+
settings := r.mergedSettings()
762+
enabled := settings.Advanced != nil && advancedBoolEnabled(settings.Advanced.Bridge)
763+
path := bridgepkg.SessionManifestPath(r.SessionPath, r.SessionID)
764+
lines := []string{
765+
"Status bridge",
766+
"Enabled: " + boolEnabledText(enabled),
767+
}
768+
if path == "" {
769+
return strings.Join(append(lines, "Manifest path: (not configured)", "Bridge-safe commands: 0"), "\n")
770+
}
771+
manifest, err := bridgepkg.LoadManifest(path)
772+
if err != nil {
773+
return strings.Join(append(lines, "Manifest path: "+path, "Bridge error: "+err.Error()), "\n")
774+
}
775+
lines = append(lines,
776+
"Manifest path: "+path,
777+
fmt.Sprintf("Bridge-safe commands: %d", len(manifest.Commands)),
778+
)
779+
if manifest.GeneratedAt != "" {
780+
lines = append(lines, "Generated at: "+manifest.GeneratedAt)
781+
}
782+
if len(manifest.Commands) > 0 {
783+
names := make([]string, 0, len(manifest.Commands))
784+
for _, command := range manifest.Commands {
785+
names = append(names, command.Name)
786+
}
787+
sort.Strings(names)
788+
lines = append(lines, "Command names: "+strings.Join(firstStrings(names, 40), ", "))
789+
if len(names) > 40 {
790+
lines = append(lines, fmt.Sprintf("Showing 40 of %d bridge-safe commands.", len(names)))
791+
}
792+
}
793+
return strings.Join(lines, "\n")
794+
}
795+
755796
func (r Runner) formatStatusTelemetry() string {
756797
path := telemetrypkg.SessionPath(r.SessionPath, r.SessionID)
757798
lines := []string{

internal/conversation/run_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1837,6 +1837,16 @@ func TestRunnerExecutesStatusShowSectionsWithoutQuery(t *testing.T) {
18371837
}); err != nil {
18381838
t.Fatal(err)
18391839
}
1840+
if err := bridgepkg.WriteManifest(bridgepkg.SessionManifestPath(transcriptPath, "sess_status_show"), bridgepkg.Manifest{
1841+
SessionID: "sess_status_show",
1842+
WorkingDirectory: "/tmp/project",
1843+
Commands: []bridgepkg.Command{
1844+
{Name: "compact", Type: contracts.CommandLocal},
1845+
{Name: "ask", Type: contracts.CommandPrompt, Aliases: []string{"question"}},
1846+
},
1847+
}); err != nil {
1848+
t.Fatal(err)
1849+
}
18401850
runner := Runner{
18411851
Client: client,
18421852
Tools: tool.NewExecutor(registry),
@@ -1921,6 +1931,12 @@ func TestRunnerExecutesStatusShowSectionsWithoutQuery(t *testing.T) {
19211931
"Models:",
19221932
"- sonnet: 1",
19231933
}, []string{"tool failed"})
1934+
assertStatusShow("/status show bridge", []string{
1935+
"Status bridge",
1936+
"Enabled: disabled",
1937+
"Bridge-safe commands: 2",
1938+
"Command names: ask, compact",
1939+
}, nil)
19241940
assertStatusShow("/status show unknown", []string{
19251941
"Unknown status section unknown.",
19261942
"Available sections:",

0 commit comments

Comments
 (0)