Skip to content

Commit 2247026

Browse files
unraidclaude
andcommitted
chore: 添加脚本与构建配置更新
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent eec9613 commit 2247026

13 files changed

Lines changed: 393 additions & 86 deletions

File tree

scripts/defines.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,23 @@ export const DEFAULT_BUILD_FEATURES = [
5555
'CONTEXT_COLLAPSE',
5656
'MONITOR_TOOL',
5757
'FORK_SUBAGENT',
58-
// 'UDS_INBOX',
58+
'UDS_INBOX',
5959
'KAIROS',
6060
'COORDINATOR_MODE',
6161
'LAN_PIPES',
6262
'BG_SESSIONS',
6363
'TEMPLATES',
64-
// 'REVIEW_ARTIFACT', // API 请求无响应,需进一步排查 schema 兼容性
65-
// P3: poor mode (disable extract_memories + prompt_suggestion)
64+
// 'REVIEW_ARTIFACT', // API 请求无响应,需进一步排查 schema 兼容性
65+
// API content block types
66+
'CONNECTOR_TEXT',
67+
// Attribution tracking
68+
'COMMIT_ATTRIBUTION',
69+
// Server mode (claude server / claude open)
70+
'DIRECT_CONNECT',
71+
// Skill search
72+
'EXPERIMENTAL_SKILL_SEARCH',
73+
// P3: poor mode (disable extract_memories + prompt_suggestion)
6674
'POOR',
67-
] as const;
75+
// Team Memory (shared memory files between agent teammates)
76+
'TEAMMEM',
77+
]as const;

scripts/dump-prompt.ts

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
/**
2+
* dump-prompt.ts — 生成完整 system prompt 用于人工检查格式和内容。
3+
* Usage: bun run scripts/dump-prompt.ts
4+
*/
5+
import { mock } from 'bun:test'
6+
7+
// --- Mock chain (block side-effects) ---
8+
mock.module('src/bootstrap/state.js', () => ({
9+
getIsNonInteractiveSession: () => false,
10+
sessionId: 'test-session',
11+
getCwd: () => '/test/project',
12+
}))
13+
mock.module('src/utils/cwd.js', () => ({ getCwd: () => '/test/project' }))
14+
mock.module('src/utils/git.js', () => ({ getIsGit: async () => true }))
15+
mock.module('src/utils/worktree.js', () => ({
16+
getCurrentWorktreeSession: () => null,
17+
}))
18+
mock.module('src/constants/common.js', () => ({
19+
getSessionStartDate: () => '2026-04-22',
20+
}))
21+
mock.module('src/utils/settings/settings.js', () => ({
22+
getInitialSettings: () => ({ language: undefined }),
23+
}))
24+
mock.module('src/commands/poor/poorMode.js', () => ({
25+
isPoorModeActive: () => false,
26+
}))
27+
mock.module('src/utils/env.js', () => ({ env: { platform: 'linux' } }))
28+
mock.module('src/utils/envUtils.js', () => ({ isEnvTruthy: () => false }))
29+
mock.module('src/utils/model/model.js', () => ({
30+
getCanonicalName: (id: string) => id,
31+
getMarketingNameForModel: (id: string) => {
32+
if (id.includes('opus-4-7')) return 'Claude Opus 4.7'
33+
if (id.includes('opus-4-6')) return 'Claude Opus 4.6'
34+
if (id.includes('sonnet-4-6')) return 'Claude Sonnet 4.6'
35+
return null
36+
},
37+
}))
38+
mock.module('src/commands.js', () => ({
39+
getSkillToolCommands: async () => [],
40+
}))
41+
mock.module('src/constants/outputStyles.js', () => ({
42+
getOutputStyleConfig: async () => null,
43+
}))
44+
mock.module('src/utils/embeddedTools.js', () => ({
45+
hasEmbeddedSearchTools: () => false,
46+
}))
47+
mock.module('src/utils/permissions/filesystem.js', () => ({
48+
isScratchpadEnabled: () => false,
49+
getScratchpadDir: () => '/tmp/scratchpad',
50+
}))
51+
mock.module('src/utils/betas.js', () => ({
52+
shouldUseGlobalCacheScope: () => false,
53+
}))
54+
mock.module('src/utils/undercover.js', () => ({ isUndercover: () => false }))
55+
mock.module('src/utils/model/antModels.js', () => ({
56+
getAntModelOverrideConfig: () => null,
57+
}))
58+
mock.module('src/utils/mcpInstructionsDelta.js', () => ({
59+
isMcpInstructionsDeltaEnabled: () => false,
60+
}))
61+
mock.module('src/memdir/memdir.js', () => ({
62+
loadMemoryPrompt: async () => null,
63+
}))
64+
mock.module('src/utils/debug.js', () => ({ logForDebugging: () => {} }))
65+
mock.module('src/services/analytics/growthbook.js', () => ({
66+
getFeatureValue_CACHED_MAY_BE_STALE: () => false,
67+
}))
68+
mock.module('bun:bundle', () => ({ feature: (_name: string) => false }))
69+
mock.module('src/constants/systemPromptSections.js', () => ({
70+
systemPromptSection: (_name: string, fn: () => any) => ({
71+
__deferred: true,
72+
fn,
73+
}),
74+
DANGEROUS_uncachedSystemPromptSection: (
75+
_name: string,
76+
fn: () => any,
77+
) => ({ __deferred: true, fn }),
78+
resolveSystemPromptSections: async (sections: any[]) => {
79+
const results = await Promise.all(
80+
sections.map((s: any) => (s?.__deferred ? s.fn() : s)),
81+
)
82+
return results.filter((s: any) => s !== null)
83+
},
84+
}))
85+
86+
// Tool name mocks
87+
mock.module(
88+
'@claude-code-best/builtin-tools/tools/BashTool/toolName.js',
89+
() => ({ BASH_TOOL_NAME: 'Bash' }),
90+
)
91+
mock.module(
92+
'@claude-code-best/builtin-tools/tools/FileReadTool/prompt.js',
93+
() => ({ FILE_READ_TOOL_NAME: 'Read' }),
94+
)
95+
mock.module(
96+
'@claude-code-best/builtin-tools/tools/FileEditTool/constants.js',
97+
() => ({ FILE_EDIT_TOOL_NAME: 'Edit' }),
98+
)
99+
mock.module(
100+
'@claude-code-best/builtin-tools/tools/FileWriteTool/prompt.js',
101+
() => ({ FILE_WRITE_TOOL_NAME: 'Write' }),
102+
)
103+
mock.module(
104+
'@claude-code-best/builtin-tools/tools/GlobTool/prompt.js',
105+
() => ({ GLOB_TOOL_NAME: 'Glob' }),
106+
)
107+
mock.module(
108+
'@claude-code-best/builtin-tools/tools/GrepTool/prompt.js',
109+
() => ({ GREP_TOOL_NAME: 'Grep' }),
110+
)
111+
mock.module(
112+
'@claude-code-best/builtin-tools/tools/AgentTool/constants.js',
113+
() => ({ AGENT_TOOL_NAME: 'Agent', VERIFICATION_AGENT_TYPE: 'verification' }),
114+
)
115+
mock.module(
116+
'@claude-code-best/builtin-tools/tools/AgentTool/forkSubagent.js',
117+
() => ({ isForkSubagentEnabled: () => false }),
118+
)
119+
mock.module(
120+
'@claude-code-best/builtin-tools/tools/AgentTool/builtInAgents.js',
121+
() => ({ areExplorePlanAgentsEnabled: () => false }),
122+
)
123+
mock.module(
124+
'@claude-code-best/builtin-tools/tools/AgentTool/built-in/exploreAgent.js',
125+
() => ({
126+
EXPLORE_AGENT: { agentType: 'explore' },
127+
EXPLORE_AGENT_MIN_QUERIES: 5,
128+
}),
129+
)
130+
mock.module(
131+
'@claude-code-best/builtin-tools/tools/AskUserQuestionTool/prompt.js',
132+
() => ({ ASK_USER_QUESTION_TOOL_NAME: 'AskUserQuestion' }),
133+
)
134+
mock.module(
135+
'@claude-code-best/builtin-tools/tools/TodoWriteTool/constants.js',
136+
() => ({ TODO_WRITE_TOOL_NAME: 'TodoWrite' }),
137+
)
138+
mock.module(
139+
'@claude-code-best/builtin-tools/tools/TaskCreateTool/constants.js',
140+
() => ({ TASK_CREATE_TOOL_NAME: 'TaskCreate' }),
141+
)
142+
mock.module(
143+
'@claude-code-best/builtin-tools/tools/DiscoverSkillsTool/prompt.js',
144+
() => ({ DISCOVER_SKILLS_TOOL_NAME: 'DiscoverSkills' }),
145+
)
146+
mock.module(
147+
'@claude-code-best/builtin-tools/tools/SkillTool/constants.js',
148+
() => ({ SKILL_TOOL_NAME: 'Skill' }),
149+
)
150+
mock.module(
151+
'@claude-code-best/builtin-tools/tools/SleepTool/prompt.js',
152+
() => ({ SLEEP_TOOL_NAME: 'Sleep' }),
153+
)
154+
mock.module(
155+
'@claude-code-best/builtin-tools/tools/REPLTool/constants.js',
156+
() => ({ isReplModeEnabled: () => false }),
157+
)
158+
159+
// MACRO globals
160+
;(globalThis as any).MACRO = {
161+
VERSION: '2.1.888',
162+
BUILD_TIME: '2026-04-22T00:00:00Z',
163+
FEEDBACK_CHANNEL: '',
164+
ISSUES_EXPLAINER: 'report issues on GitHub',
165+
NATIVE_PACKAGE_URL: '',
166+
PACKAGE_URL: '',
167+
VERSION_CHANGELOG: '',
168+
}
169+
170+
// --- Import and dump ---
171+
const { getSystemPrompt } = await import('src/constants/prompts.js')
172+
173+
const tools = [
174+
{ name: 'Bash' },
175+
{ name: 'Read' },
176+
{ name: 'Edit' },
177+
{ name: 'Write' },
178+
{ name: 'Glob' },
179+
{ name: 'Grep' },
180+
{ name: 'Agent' },
181+
{ name: 'AskUserQuestion' },
182+
{ name: 'TaskCreate' },
183+
] as any
184+
185+
const sections = await getSystemPrompt(tools, 'claude-opus-4-7')
186+
const full = sections.join('\n\n')
187+
188+
const outputPath = 'scripts/system-prompt-dump.txt'
189+
await Bun.write(outputPath, full)
190+
console.log(`Written to ${outputPath}`)
191+
console.log(`Sections: ${sections.length} | Chars: ${full.length} | Lines: ${full.split('\n').length}`)

src/constants/figures.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ export const LIGHTNING_BOLT = '↯' // \u21af - used for fast mode indicator
1010
export const EFFORT_LOW = '○' // \u25cb - effort level: low
1111
export const EFFORT_MEDIUM = '◐' // \u25d0 - effort level: medium
1212
export const EFFORT_HIGH = '●' // \u25cf - effort level: high
13-
export const EFFORT_MAX = '◉' // \u25c9 - effort level: max (Opus 4.6 only)
13+
export const EFFORT_XHIGH = '⦿' // \u29bf - effort level: xhigh (Opus 4.7 only)
14+
export const EFFORT_MAX = '◉' // \u25c9 - effort level: max (Opus 4.6/4.7 only)
1415

1516
// Media/trigger status indicators
1617
export const PLAY_ICON = '\u25b6' // ▶

0 commit comments

Comments
 (0)