Commit Graph

152 Commits

Author SHA1 Message Date
unraid
ca086b045a fix: resolve Windows Computer Use request_access and screenshot errors
Two root causes fixed:

1. swiftLoader.ts: require('@ant/computer-use-swift') returns a module
   with { ComputerUseAPI } class, not an instance. macOS native .node
   exports a plain object. Fixed by detecting class export and calling
   new ComputerUseAPI().

2. executor.ts resolvePrepareCapture: toolCalls.ts expects result to have
   { hidden: string[], displayId: number } fields. Our ComputerUseAPI
   returns { base64, width, height } only. Fixed by backfilling missing
   fields with defaults.

Verified: request_access → screenshot → left_click all work on Windows.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 00:09:51 +08:00
unraid
3707c3c0ba feat: Windows Computer Use enhancement — PrintWindow, UI Automation, OCR
New Windows-native capabilities:
- windowCapture.ts: PrintWindow API for per-window screenshot (works on
  occluded/background windows)
- windowEnum.ts: EnumWindows for precise window enumeration with HWND
- uiAutomation.ts: IUIAutomation for UI tree reading, element clicking,
  text input, and coordinate-based element identification
- ocr.ts: Windows.Media.Ocr for screen text recognition (en-US + zh-CN)

Updated win32.ts backend to use EnumWindows for listRunning() and added
captureWindowTarget() for window-specific screenshots.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 00:00:02 +08:00
unraid
e3264a1691 feat: enable Computer Use with macOS + Windows + Linux support
Phase 1: Replace @ant/computer-use-mcp stub (12 files, 6517 lines).

Phase 2: Remove 8 macOS-only guards in src/:
- main.tsx: remove getPlatform()==='macos' check
- swiftLoader.ts: remove darwin-only throw
- executor.ts: extend platform guard, clipboard dispatch, paste key
- drainRunLoop.ts: skip CFRunLoop pump on non-darwin
- escHotkey.ts: non-darwin returns false (Ctrl+C fallback)
- hostAdapter.ts: non-darwin permissions granted
- common.ts: dynamic platform + screenshotFiltering
- gates.ts: enabled:true, subscription check removed

Phase 3: Add Linux backends (xdotool/scrot/xrandr/wmctrl):
- computer-use-input/backends/linux.ts (173 lines)
- computer-use-swift/backends/linux.ts (278 lines)

Verified on Windows x64: mouse, screenshot, displays, foreground app.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 23:17:14 +08:00
JiayuWang(王嘉宇)
465e9f01c6 test: add coverage for formatRelativeTimeAgo and formatLogMetadata (#94)
These two exported functions in src/utils/format.ts had no test
coverage. formatRelativeTimeAgo wraps formatRelativeTime and forces
numeric:'always' for past dates; formatLogMetadata assembles parts
(time, branch, size/count, tag, agentSetting, prNumber) into a
' · '-separated string.

Added 8 tests for formatRelativeTimeAgo covering past dates, future
dates, equal-to-now, and the no-'ago'-for-future invariant. Added
9 tests for formatLogMetadata covering all optional fields and the
separator format.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 22:17:58 +08:00
claude-code-best
29db9d99de docs: 添加文本好使一些 2026-04-03 20:57:33 +08:00
claude-code-best
9e6fe9b410 feat: 添加 discord 群 2026-04-03 20:55:58 +08:00
claude-code-best
4a9e9185b1 docs: 更新文档 2026-04-03 20:23:51 +08:00
claude-code-best
2cc626c1c3 fix: 修复测试文件 2026-04-03 20:11:09 +08:00
Dosion
eb86e34094 Merge pull request #88 from amDosion/feat/enable-schedule-remote-agents
feat: enable /schedule by adding AGENT_TRIGGERS_REMOTE to default features
2026-04-03 20:07:21 +08:00
claude-code-best
4c5a12228c docs: 调整文档 2026-04-03 19:56:35 +08:00
claude-code-best
a6bef45113 fix: 修复 rg 文件的传入 2026-04-03 19:45:43 +08:00
claude-code-best
7e888ce38d feat: 添加 测试 agent 及一些文档 2026-04-03 19:27:23 +08:00
claude-code-best
5a7d06fe99 refactor(buddy): align companion system with official CLI (#82)
* refactor(buddy): align companion system with official CLI

## Summary

Reverse-engineered the official Claude Code CLI (v2.1.91) buddy/companion
system and aligned our implementation to match.

## Changes (7 files)

### Added
- `src/buddy/CompanionCard.tsx` (+109)
  JSX bordered card matching official vc8: rarity header, colored sprite,
  name, personality, 10-bar stats, last reaction in nested border.

- `src/buddy/companionReact.ts` (+156)
  Reaction system matching official ZUK+Dc8: 45s rate limiting, @-mention
  detection, transcript builder (12 msgs, 5000 chars), POST buddy_react API.

### Modified
- `src/commands/buddy/index.ts`
  type: local -> local-jsx, description/argumentHint/immediate/isHidden.

- `src/commands/buddy/buddy.ts`
  LocalCommandCall -> LocalJSXCommandCall signature (onDone, context, args).
  Removed mute/unmute/rehatch (official uses off/on only).
  /buddy show returns CompanionCard JSX instead of plain text.
  Pet auto-unmutes. companionMuted writes globalConfig (matches UI read source).

- `src/screens/REPL.tsx` (line 2808)
  globalThis.fireCompanionObserver -> import triggerCompanionReaction.

- `src/state/AppStateStore.ts` — comment fix.
- `src/types/global.d.ts` — removed fireCompanionObserver declaration.

## Data flow (verified consistent)
- companionMuted: saveGlobalConfig() <-> getGlobalConfig() (6 read sites)
- companionReaction: setAppState() <-> useAppState() (4 sites)
- companionPetAt: setAppState() <-> useAppState() (2 sites)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(buddy): address CodeRabbit review findings

- buddy.ts: return type Promise<null> → Promise<React.ReactNode>
  to match LocalJSXCommandCall interface (CompanionCard path returns
  ReactElement, not null).
- CompanionCard.tsx: clamp stat value to 0..100 before .repeat()
  to prevent negative count runtime error on out-of-range values.

Import path alias suggestions (src/ vs ../) dismissed — project
convention uses relative paths (verified against color.ts, help.ts).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(buddy): address second round CodeRabbit findings

- buddy.ts:105: remove unsafe (context as any).messages cast.
  ToolUseContext already declares messages: Message[] at Tool.ts:250,
  so context.messages is properly typed. Other commands (feedback,
  copy, export) access it the same way without cast.

- companionReact.ts:154: wrap resp.json() in try/catch for defensive
  JSON parsing. Malformed 200 responses now return null instead of
  propagating to the outer catch.

Rate-limit timing (set before API call) kept as-is — matches official
ZUK pattern: prevents retry-storm on transient failures.

src/ path alias suggestions dismissed — project uses relative paths.
Auto-unmute on /buddy view kept — matches official behavior.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: unraid <local@unraid.local>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 17:22:54 +08:00
claude-code-best
cf44cc32e4 Merge branch 'pr/amDosion/60' 2026-04-03 17:21:09 +08:00
unraid
e74d1f0836 fix(buddy): address second round CodeRabbit findings
- buddy.ts:105: remove unsafe (context as any).messages cast.
  ToolUseContext already declares messages: Message[] at Tool.ts:250,
  so context.messages is properly typed. Other commands (feedback,
  copy, export) access it the same way without cast.

- companionReact.ts:154: wrap resp.json() in try/catch for defensive
  JSON parsing. Malformed 200 responses now return null instead of
  propagating to the outer catch.

Rate-limit timing (set before API call) kept as-is — matches official
ZUK pattern: prevents retry-storm on transient failures.

src/ path alias suggestions dismissed — project uses relative paths.
Auto-unmute on /buddy view kept — matches official behavior.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 17:16:16 +08:00
claude-code-best
9dd180dcd3 Merge branch 'pr/amDosion/82' 2026-04-03 17:14:14 +08:00
unraid
7d4adce1b6 fix(buddy): address CodeRabbit review findings
- buddy.ts: return type Promise<null> → Promise<React.ReactNode>
  to match LocalJSXCommandCall interface (CompanionCard path returns
  ReactElement, not null).
- CompanionCard.tsx: clamp stat value to 0..100 before .repeat()
  to prevent negative count runtime error on out-of-range values.

Import path alias suggestions (src/ vs ../) dismissed — project
convention uses relative paths (verified against color.ts, help.ts).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 17:00:01 +08:00
claude-code-best
c9c14c816f feat: 简化 debug 方式 2026-04-03 16:47:24 +08:00
unraid
991119491c refactor(buddy): align companion system with official CLI
## Summary

Reverse-engineered the official Claude Code CLI (v2.1.91) buddy/companion
system and aligned our implementation to match.

## Changes (7 files)

### Added
- `src/buddy/CompanionCard.tsx` (+109)
  JSX bordered card matching official vc8: rarity header, colored sprite,
  name, personality, 10-bar stats, last reaction in nested border.

- `src/buddy/companionReact.ts` (+156)
  Reaction system matching official ZUK+Dc8: 45s rate limiting, @-mention
  detection, transcript builder (12 msgs, 5000 chars), POST buddy_react API.

### Modified
- `src/commands/buddy/index.ts`
  type: local -> local-jsx, description/argumentHint/immediate/isHidden.

- `src/commands/buddy/buddy.ts`
  LocalCommandCall -> LocalJSXCommandCall signature (onDone, context, args).
  Removed mute/unmute/rehatch (official uses off/on only).
  /buddy show returns CompanionCard JSX instead of plain text.
  Pet auto-unmutes. companionMuted writes globalConfig (matches UI read source).

- `src/screens/REPL.tsx` (line 2808)
  globalThis.fireCompanionObserver -> import triggerCompanionReaction.

- `src/state/AppStateStore.ts` — comment fix.
- `src/types/global.d.ts` — removed fireCompanionObserver declaration.

## Data flow (verified consistent)
- companionMuted: saveGlobalConfig() <-> getGlobalConfig() (6 read sites)
- companionReaction: setAppState() <-> useAppState() (4 sites)
- companionPetAt: setAppState() <-> useAppState() (2 sites)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 16:36:22 +08:00
claude-code-best
7935bfb4b8 fix: 修复debug启动方式 2026-04-03 14:40:45 +08:00
claude-code-best
a7604f6591 feat: /login 命令新增自定义 anthropic 终端登陆 2026-04-03 14:22:47 +08:00
claude-code-best
a02a9fc4c2 fix: 修复定义导入缺失的问题 2026-04-03 14:14:35 +08:00
claude-code-best
e944633dd8 fix: 修复 ERROR getAntModels is not defined
Fixes #69
2026-04-03 11:56:49 +08:00
claude-code-best
cb046b4df0 docs: 添加文档 2026-04-03 11:52:14 +08:00
unraid
67caa5d017 docs: add Remote Control (BRIDGE_MODE) entry to DEV-LOG
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 11:30:58 +08:00
claude-code-best
8e4aea45a8 docs: 维护两个新的文档 2026-04-03 11:01:17 +08:00
claude-code-best
5278ce1f3a docs: 新增两份文档 2026-04-03 10:56:52 +08:00
claude-code-best
e74c009e02 feat: 添加 GrowthBook 自定义服务器适配器
通过 CLAUDE_GB_ADAPTER_URL/KEY 环境变量连接自定义 GrowthBook 实例,
无配置时所有 feature 读取返回代码默认值。支持 GrowthBook Cloud(非 remoteEval),
含完整文档和 feature key 列表。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-03 10:37:15 +08:00
claude-code-best
78144b4dba feat: 关闭 Datadog 日志发送 2026-04-03 09:49:59 +08:00
claude-code-best
e32c159f35 feat: 关闭自动更新 2026-04-03 09:39:32 +08:00
claude-code-best
119518599e feat: 更新 sentry 错误上报 2026-04-03 09:39:25 +08:00
unraid
e784f231d4 fix: validate and encode target sessionId in peer messages
- Trim and normalize target before use
- Validate with validateBridgeId allowlist (same as bridgeApi.ts)
- URL-encode compatTarget to prevent path traversal/injection

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 04:23:32 +08:00
unraid
8645d37b25 fix: add Authorization header to peer message requests
getBridgeAccessToken() provides the OAuth Bearer token, matching
the auth pattern used by bridgeApi.ts and codeSessionApi.ts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 04:15:24 +08:00
unraid
1d38eae536 fix: address CodeRabbit review findings
- webhookSanitizer: redact before truncate to avoid split secrets at boundary
- webhookSanitizer: return safe placeholder on error instead of raw content
- peerSessions: use discriminated union return type for type safety

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 04:08:04 +08:00
unraid
74e51e7e73 feat: enable Remote Control (BRIDGE_MODE) with stub completions
- Add BRIDGE_MODE to DEFAULT_FEATURES in dev.ts
- Implement peerSessions.ts: cross-session messaging via bridge API
- Implement webhookSanitizer.ts: redact secrets from webhook payloads
- Replace any stubs in controlTypes.ts with Zod schema-inferred types
- Fix tengu_bridge_system_init default to true for app "active" status

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 03:50:36 +08:00
claude-code-best
1f0a2e44c8 feat: 完成 debug 配置 2026-04-03 01:11:14 +08:00
claude-code-best
e48da3956c feat: 修正 web search 工具 2026-04-03 00:47:37 +08:00
claude-code-best
d04e00fc2c feat: 调整预先检查的代码 2026-04-02 23:00:48 +08:00
claude-code-best
c252294dd7 feat: 移除反蒸馏代码 2026-04-02 22:56:23 +08:00
claude-code-best
5ee49fd106 docs: 添加一大堆 feature 的描述 2026-04-02 22:52:32 +08:00
claude-code-best
22ca3a1181 Merge remote-tracking branch 'origin/main' 2026-04-02 21:57:12 +08:00
claude-code-best
919cf55591 feat: 添加开发者默认开启的 feature 2026-04-02 21:48:50 +08:00
mingyangxu46-prog
b6f37082cf Learn/20260401 (#39)
* docs: 添加 Claude Code 源码学习笔记(第一、二阶段)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 21:47:49 +08:00
claude-code-best
4337b82e6c Merge branch 'pr/programming-pupil/33' 2026-04-02 21:41:55 +08:00
claude-code-best
7dfbcd0e79 feat: 更新 buddy 的一些功能 2026-04-02 21:41:19 +08:00
claude-code-best
0d0304d6a5 Merge branch 'pr/smallflyingpig/36' 2026-04-02 21:38:12 +08:00
claude-code-best
47d88478c9 docs: 修正 feature 的正确用法 2026-04-02 21:37:30 +08:00
claude-code-best
70f32e25f3 Merge branch 'main' into pr/smallflyingpig/36
# Conflicts:
#	src/entrypoints/cli.tsx
2026-04-02 21:25:53 +08:00
claude-code-best
87fdd455cc chore: 删除调试代码 2026-04-02 21:23:36 +08:00
claude-code-best
991ccc673c chore: 删除 src 下面的 src 2026-04-02 21:22:31 +08:00