[pull] main from claude-code-best:main#10
Merged
Conversation
- 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>
- 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>
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>
- 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>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
## 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>
- 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>
- 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>
* 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>
feat: enable /schedule by adding AGENT_TRIGGERS_REMOTE to default features
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>
* feat: 完成 openai 接口兼容 * feat: 完成 openai 协议兼容 * fix: 修复测试用例
These two exported functions in src/utils/path.ts lacked unit tests. toRelativePath wraps Node's path.relative() and keeps the absolute path when the result would start with '..' (i.e. the target is outside the CWD). Four tests cover: child-of-cwd, outside-cwd, cwd-itself, and the type-safety invariant. getDirectoryForPath uses statSync to distinguish directories from files, falling back to dirname() for non-existent paths and bypassing the filesystem for UNC paths (NTLM credential-leak prevention). Three tests cover: existing directory, known file, and non-existent path. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )