-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Fixture/langfuse record auto mode data error #308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5f7bd2c
d229171
2cc37de
4180cd3
bd18ed9
dd36b3a
5333244
99e24fe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,6 +58,7 @@ | |
| "postinstall": "node scripts/run-parallel.mjs scripts/postinstall.cjs scripts/setup-chrome-mcp.mjs", | ||
| "docs:dev": "npx mintlify dev", | ||
| "typecheck": "tsc --noEmit", | ||
| "test:all": "bun run typecheck && bun test", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The script omits lint, while docs/CI messaging treat it as full validation. This can let lint regressions pass when developers run only Suggested fix- "test:all": "bun run typecheck && bun test",
+ "test:all": "bun run typecheck && bun run lint && bun test",🤖 Prompt for AI Agents |
||
| "rcs": "bun run scripts/rcs.ts" | ||
| }, | ||
| "dependencies": { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,9 @@ | ||
| import { createRequire } from 'node:module' | ||
|
|
||
| // createRequire works in both Bun and Node.js ESM contexts. | ||
| // Needed because this package is "type": "module" but uses require() for | ||
| // loading native .node addons — bare require is not available in Node.js ESM. | ||
| const nodeRequire = createRequire(import.meta.url) | ||
|
Comment on lines
+1
to
+6
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Description: Inspect native addon require handling and build-time defines.
# Expectation: build scripts/comments indicate import.meta.require/direct require
# is the supported analyzable form; createRequire/nodeRequire aliases should be
# explicitly handled before keeping this change.
rg -n -C4 'AUDIO_CAPTURE_NODE_PATH|audio-capture\.node|import\.meta\.require|createRequire|nodeRequire|require\(process\.env' \
--glob '*.ts' \
--glob '*.js'Repository: claude-code-best/claude-code Length of output: 13385 Bun static analysis requires a direct native addon require call, not one hidden behind a The native addon path at line 42-46 documents that Use -import { createRequire } from 'node:module'
-
-// createRequire works in both Bun and Node.js ESM contexts.
-// Needed because this package is "type": "module" but uses require() for
-// loading native .node addons — bare require is not available in Node.js ESM.
-const nodeRequire = createRequire(import.meta.url)
+// Bun API; build.ts post-processes import.meta.require to Node.js compatibility.
+const nodeRequire = import.meta.require🤖 Prompt for AI Agents |
||
|
|
||
| type AudioCaptureNapi = { | ||
| startRecording( | ||
|
|
@@ -41,7 +47,7 @@ function loadModule(): AudioCaptureNapi | null { | |
| if (process.env.AUDIO_CAPTURE_NODE_PATH) { | ||
| try { | ||
| // eslint-disable-next-line @typescript-eslint/no-require-imports | ||
| cachedModule = require( | ||
| cachedModule = nodeRequire( | ||
| process.env.AUDIO_CAPTURE_NODE_PATH, | ||
| ) as AudioCaptureNapi | ||
| return cachedModule | ||
|
|
@@ -63,7 +69,7 @@ function loadModule(): AudioCaptureNapi | null { | |
| for (const p of fallbacks) { | ||
| try { | ||
| // eslint-disable-next-line @typescript-eslint/no-require-imports | ||
| cachedModule = require(p) as AudioCaptureNapi | ||
| cachedModule = nodeRequire(p) as AudioCaptureNapi | ||
| return cachedModule | ||
| } catch { | ||
| // try next | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,3 +1,4 @@ | ||||||||||||||
| import { readFileSync, unlinkSync } from 'node:fs' | ||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Description: Check for node:fs usage patterns and verify if Bun APIs are available
# Search for other node:fs imports in the codebase
echo "=== Checking for node:fs imports ==="
rg -n "from ['\"]node:fs['\"]" --type=ts
# Search for Bun.file usage patterns
echo -e "\n=== Checking Bun.file usage patterns ==="
rg -n "Bun\.file\(" --type=ts -A 2
# Check for readFileSync usage
echo -e "\n=== Checking readFileSync usage ==="
rg -n "readFileSync" --type=tsRepository: claude-code-best/claude-code Length of output: 17530 Remove the unused Line 65 creates a Relevant code context🤖 Prompt for AI Agents |
||||||||||||||
| import sharpModule from 'sharp' | ||||||||||||||
|
|
||||||||||||||
| export const sharp = sharpModule | ||||||||||||||
|
|
@@ -62,13 +63,11 @@ return "${tmpPath}" | |||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| const file = Bun.file(tmpPath) | ||||||||||||||
| // Use synchronous read via Node compat | ||||||||||||||
| const fs = require('fs') | ||||||||||||||
| const buffer: Buffer = fs.readFileSync(tmpPath) | ||||||||||||||
| const buffer: Buffer = readFileSync(tmpPath) | ||||||||||||||
|
Comment on lines
65
to
+66
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove unused Line 65 declares 🧹 Proposed fix to remove dead codeOption 1: Remove the unused line (recommended for this synchronous context) - const file = Bun.file(tmpPath)
const buffer: Buffer = readFileSync(tmpPath)Option 2: Use Bun APIs consistently (if Bun has sync file reading) If Bun provides synchronous file reading APIs, consider using them instead to align with coding guidelines: const file = Bun.file(tmpPath)
const buffer = Buffer.from(/* appropriate Bun sync API */)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
|
|
||||||||||||||
| // Clean up temp file | ||||||||||||||
| try { | ||||||||||||||
| fs.unlinkSync(tmpPath) | ||||||||||||||
| unlinkSync(tmpPath) | ||||||||||||||
| } catch { | ||||||||||||||
| // ignore cleanup errors | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -16,3 +16,52 @@ export function getMacroDefines(): Record<string, string> { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "MACRO.VERSION_CHANGELOG": JSON.stringify(""), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Default feature flags enabled in both Bun.build and Vite builds. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Additional features can be enabled via FEATURE_<NAME>=1 env vars. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Used by: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * - build.ts (Bun.build) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * - scripts/vite-plugin-feature-flags.ts (Vite/Rollup) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * - scripts/dev.ts (bun run dev) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const DEFAULT_BUILD_FEATURES = [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'BUDDY', 'TRANSCRIPT_CLASSIFIER', 'BRIDGE_MODE', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'AGENT_TRIGGERS_REMOTE', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'CHICAGO_MCP', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'VOICE_MODE', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'SHOT_STATS', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'PROMPT_CACHE_BREAK_DETECTION', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'TOKEN_BUDGET', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // P0: local features | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'AGENT_TRIGGERS', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'ULTRATHINK', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'BUILTIN_EXPLORE_PLAN_AGENTS', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'LODESTONE', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // P1: API-dependent features | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'EXTRACT_MEMORIES', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'VERIFICATION_AGENT', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'KAIROS_BRIEF', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'AWAY_SUMMARY', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'ULTRAPLAN', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // P2: daemon + remote control server | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'DAEMON', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // ACP (Agent Client Protocol) agent mode | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'ACP', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // PR-package restored features | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'WORKFLOW_SCRIPTS', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'HISTORY_SNIP', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'CONTEXT_COLLAPSE', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'MONITOR_TOOL', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'FORK_SUBAGENT', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 'UDS_INBOX', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'KAIROS', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'COORDINATOR_MODE', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'LAN_PIPES', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'BG_SESSIONS', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'TEMPLATES', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 'REVIEW_ARTIFACT', // API 请求无响应,需进一步排查 schema 兼容性 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // P3: poor mode (disable extract_memories + prompt_suggestion) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'POOR', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ] as const; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+29
to
+67
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Preserve the previous dev-only feature defaults.
Suggested direction export const DEFAULT_BUILD_FEATURES = [
'BUDDY', 'TRANSCRIPT_CLASSIFIER', 'BRIDGE_MODE',
@@
'POOR',
] as const;
+
+export const DEFAULT_DEV_FEATURES = [
+ ...DEFAULT_BUILD_FEATURES,
+ 'UDS_INBOX',
+] as const;Then have Based on learnings: Dev mode enables all feature flags by default via 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| export { initLangfuse, shutdownLangfuse, isLangfuseEnabled, getLangfuseProcessor } from './client.js' | ||
| export { createTrace, createSubagentTrace, recordLLMObservation, recordToolObservation, endTrace, createToolBatchSpan, endToolBatchSpan } from './tracing.js' | ||
| export { createTrace, createSubagentTrace, createChildSpan, recordLLMObservation, recordToolObservation, endTrace, createToolBatchSpan, endToolBatchSpan } from './tracing.js' | ||
| export type { LangfuseSpan } from './tracing.js' | ||
| export { sanitizeToolInput, sanitizeToolOutput, sanitizeGlobal } from './sanitize.js' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix command description mismatch with actual script behavior.
Line 61 says
test:allincludes lint, butbun run test:allcurrently runs only typecheck + test. Please either update the description or include lint in the script to avoid misleading contributors.🤖 Prompt for AI Agents