惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

大猫的无限游戏
大猫的无限游戏
aimingoo的专栏
aimingoo的专栏
I
InfoQ
B
Blog RSS Feed
D
DataBreaches.Net
S
SegmentFault 最新的问题
P
Proofpoint News Feed
A
About on SuperTechFans
WordPress大学
WordPress大学
Hugging Face - Blog
Hugging Face - Blog
博客园 - 司徒正美
小众软件
小众软件
博客园 - Franky
有赞技术团队
有赞技术团队
D
Docker
T
Tailwind CSS Blog
雷峰网
雷峰网
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Blog — PlanetScale
Blog — PlanetScale
酷 壳 – CoolShell
酷 壳 – CoolShell
B
Blog
V
Visual Studio Blog
宝玉的分享
宝玉的分享
爱范儿
爱范儿

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(crabbox): preflight macOS Swift toolchain · openclaw/...
vincentkoc · 2026-06-22 · via Recent Commits to openclaw:main

@@ -141,6 +141,14 @@ const jsRuntimeEntrypoints = new Set([

141141

const awsMacosCorepackEntrypoints = new Set(["pnpm", "yarn", "corepack"]);

142142

const awsMacosBunEntrypoints = new Set(["bun", "bunx"]);

143143

const awsMacosBunVersion = "1.3.14";

144+

const awsMacosSwiftEntrypoints = new Set(["swift", "xcodebuild"]);

145+

const awsMacosSwiftScriptTargets = new Set([

146+

"mac:package",

147+

"mac:restart",

148+

"scripts/build-and-run-mac.sh",

149+

"scripts/package-mac-app.sh",

150+

"scripts/restart-mac.sh",

151+

]);

144152

const minimumBlacksmithCrabboxVersion = [0, 22, 0];

145153

const shellControlCommandPrefixes = new Set([

146154

"if",

@@ -955,6 +963,89 @@ function commandNeedsAwsMacosBun(commandArgs) {

955963

return commandNeedsEntrypoint(commandArgs, awsMacosBunEntrypoints);

956964

}

957965966+

function commandNeedsAwsMacosSwiftToolchain(commandArgs) {

967+

if (commandArgs.length === 1) {

968+

return shellCommandWordCandidates(commandArgs[0]).some(commandWordsNeedAwsMacosSwiftToolchain);

969+

}

970+

return commandWordsNeedAwsMacosSwiftToolchain(normalizedCommandWords(commandArgs));

971+

}

972+973+

function commandWordsNeedAwsMacosSwiftToolchain(wordsInput) {

974+

let words = wordsInput;

975+

words = normalizeExecutableWords(words);

976+

const first = (words[0] ?? "").split("/").pop();

977+

if (isSupportedSystemEnvCommand(first)) {

978+

const targetWords = [...words];

979+

if (stripEnvCommandOptions(targetWords, { canShimIgnoreEnvironment: true })) {

980+

return commandWordsNeedAwsMacosSwiftToolchain(targetWords);

981+

}

982+

}

983+

if (awsMacosSwiftEntrypoints.has(first)) {

984+

return true;

985+

}

986+987+

if (first === "pnpm") {

988+

const scriptName = words[1] === "run" ? words[2] : words[1];

989+

if (awsMacosSwiftScriptTargets.has(scriptName)) {

990+

return true;

991+

}

992+

}

993+994+

if (isAwsMacosSwiftScriptTarget(words[0])) {

995+

return true;

996+

}

997+998+

if (commandWordsRunAwsMacosSwiftScript(words)) {

999+

return true;

1000+

}

1001+1002+

const inlineCommand = shellInlineCommand(words);

1003+

if (!inlineCommand) {

1004+

return false;

1005+

}

1006+

return shellCommandWordCandidates(inlineCommand).some(commandWordsNeedAwsMacosSwiftToolchain);

1007+

}

1008+1009+

function isAwsMacosSwiftScriptTarget(word) {

1010+

if (!word) {

1011+

return false;

1012+

}

1013+

const normalized = word.replace(/^\.\//u, "");

1014+

return (

1015+

awsMacosSwiftScriptTargets.has(normalized) ||

1016+

awsMacosSwiftScriptTargets.has(normalized.split("/").pop() ?? "")

1017+

);

1018+

}

1019+1020+

function commandWordsRunAwsMacosSwiftScript(words) {

1021+

const first = (words[0] ?? "").split("/").pop();

1022+

if (!shellInlineCommandInterpreters.has(first)) {

1023+

return false;

1024+

}

1025+1026+

for (let index = 1; index < words.length; index += 1) {

1027+

const word = words[index] ?? "";

1028+

if (!word) {

1029+

return false;

1030+

}

1031+

if (word === "--") {

1032+

continue;

1033+

}

1034+

if (word === "-c" || /^-[^-]*c/u.test(word)) {

1035+

return false;

1036+

}

1037+

if (shellInlineCommandOptionConsumesNextValue(word)) {

1038+

index += 1;

1039+

continue;

1040+

}

1041+

if (word.startsWith("-") || word.startsWith("+")) {

1042+

continue;

1043+

}

1044+

return isAwsMacosSwiftScriptTarget(word);

1045+

}

1046+

return false;

1047+

}

1048+9581049

function commandNeedsEntrypoint(commandArgs, entrypoints) {

9591050

if (commandArgs.length === 1) {

9601051

return shellCommandWordCandidates(commandArgs[0]).some((words) =>

@@ -2078,6 +2169,62 @@ function injectRemoteAwsMacosJsBootstrap(commandArgs, providerName) {

20782169

return normalizedArgs;

20792170

}

208021712172+

function remoteAwsMacosSwiftBootstrap() {

2173+

return [

2174+

"openclaw_crabbox_require_macos_swift_62() {",

2175+

'openclaw_xcode="";',

2176+

'for openclaw_candidate in /Applications/Xcode_26.1.app /Applications/Xcode_26*.app /Applications/Xcode-26*.app; do if [ -d "$openclaw_candidate" ]; then openclaw_xcode="$openclaw_candidate"; fi; done;',

2177+

'if [ -n "$openclaw_xcode" ]; then openclaw_developer="$openclaw_xcode/Contents/Developer"; if [ ! -d "$openclaw_developer" ]; then openclaw_developer="$openclaw_xcode"; fi; sudo xcode-select -s "$openclaw_developer" || return 1; fi;',

2178+

'openclaw_swift_version="$(swift --version 2>&1)" || { status=$?; printf "%s\\n" "$openclaw_swift_version" >&2; return "$status"; };',

2179+

'printf "%s\\n" "$openclaw_swift_version" >&2;',

2180+

'openclaw_swift_major_minor="$(printf "%s\\n" "$openclaw_swift_version" | sed -nE "s/.*Apple Swift version ([0-9]+)\\.([0-9]+).*/\\1 \\2/p" | head -n 1)";',

2181+

'if [ -z "$openclaw_swift_major_minor" ]; then echo "[crabbox] OpenClaw macOS app proof requires Swift tools 6.2+; unable to parse swift --version." >&2; return 2; fi;',

2182+

"set -- $openclaw_swift_major_minor;",

2183+

'if [ "$1" -lt 6 ] || { [ "$1" -eq 6 ] && [ "$2" -lt 2 ]; }; then',

2184+

'echo "[crabbox] OpenClaw macOS app proof requires Swift tools 6.2+ (Xcode 26.x)." >&2;',

2185+

'echo "[crabbox] current Swift is $1.$2; select/install Xcode 26.x or use a Blacksmith macOS runner with Xcode_26.1.app." >&2;',

2186+

"return 2;",

2187+

"fi;",

2188+

"};",

2189+

"openclaw_crabbox_require_macos_swift_62",

2190+

].join(" ");

2191+

}

2192+2193+

function injectRemoteAwsMacosSwiftBootstrap(commandArgs, providerName, force = false) {

2194+

const runArgs = runCommandArgs(commandArgs);

2195+

if (

2196+

!isAwsMacosRemoteTarget(commandArgs, providerName) ||

2197+

(!force && !commandNeedsAwsMacosSwiftToolchain(runArgs))

2198+

) {

2199+

return commandArgs;

2200+

}

2201+2202+

const { start, optionEnd } = runCommandBounds(commandArgs);

2203+

if (start < 0) {

2204+

return commandArgs;

2205+

}

2206+2207+

const normalizedArgs = [...commandArgs];

2208+

const remoteCommand = normalizedArgs.slice(start);

2209+

const originalShellCommand =

2210+

hasOption(normalizedArgs, "--shell") && remoteCommand.length === 1

2211+

? remoteCommand[0]

2212+

: shellJoin(remoteCommand);

2213+

const shellCommand = `${remoteAwsMacosSwiftBootstrap()} && { ${originalShellCommand}\n}`;

2214+2215+

if (!hasOption(normalizedArgs, "--shell")) {

2216+

normalizedArgs.splice(optionEnd, 0, "--shell");

2217+

}

2218+2219+

const updatedBounds = runCommandBounds(normalizedArgs);

2220+

normalizedArgs.splice(

2221+

updatedBounds.start,

2222+

normalizedArgs.length - updatedBounds.start,

2223+

shellCommand,

2224+

);

2225+

return normalizedArgs;

2226+

}

2227+20812228

function hasRunOption(commandArgs, name) {

20822229

if (commandArgs[0] !== "run") {

20832230

return false;

@@ -2136,11 +2283,11 @@ function prepareAwsMacosScriptStdinBootstrap(commandArgs, providerName) {

21362283

function createAwsMacosScriptStdinWrapper(script) {

21372284

const requirements = awsMacosScriptBootstrapRequirements(script);

21382285

if (!script.startsWith("#!")) {

2139-

return `${remoteAwsMacosJsBootstrap(requirements)} || exit $?\n${script}`;

2286+

return `${remoteAwsMacosScriptBootstrap(requirements)} || exit $?\n${script}`;

21402287

}

21412288

const delimiterValue = uniqueHereDocDelimiter(script);

21422289

return [

2143-

`${remoteAwsMacosJsBootstrap(requirements)} || exit $?`,

2290+

`${remoteAwsMacosScriptBootstrap(requirements)} || exit $?`,

21442291

'tmp_script="$(mktemp "${TMPDIR:-/tmp}/openclaw-crabbox-script.XXXXXX")" || exit $?',

21452292

'cleanup_openclaw_crabbox_script() { rm -f "$tmp_script"; }',

21462293

"trap cleanup_openclaw_crabbox_script EXIT",

@@ -2153,22 +2300,33 @@ function createAwsMacosScriptStdinWrapper(script) {

21532300

].join("\n");

21542301

}

215523022303+

function remoteAwsMacosScriptBootstrap(requirements) {

2304+

const bootstraps = [remoteAwsMacosJsBootstrap(requirements)];

2305+

if (requirements.swift) {

2306+

bootstraps.push(remoteAwsMacosSwiftBootstrap());

2307+

}

2308+

return bootstraps.join(" && ");

2309+

}

2310+21562311

function awsMacosScriptBootstrapRequirements(script) {

2157-

const requirements = { packageManager: false, bun: false };

2312+

const requirements = { packageManager: false, bun: false, swift: false };

21582313

const firstLine = script.match(/^[^\r\n]*/u)?.[0] ?? "";

21592314

if (firstLine.startsWith("#!")) {

21602315

const words = firstLine.slice(2).trim().split(/\s+/u).filter(Boolean);

21612316

requirements.packageManager = commandWordsNeedEntrypoint(words, awsMacosCorepackEntrypoints);

21622317

requirements.bun = commandWordsNeedEntrypoint(words, awsMacosBunEntrypoints);

2318+

requirements.swift = commandWordsNeedAwsMacosSwiftToolchain(words);

21632319

if (commandWordsShellEntrypoint(words)) {

21642320

const body = script.slice(firstLine.length).replace(/^\r?\n/u, "");

21652321

requirements.packageManager ||= commandNeedsAwsMacosPackageManager([body]);

21662322

requirements.bun ||= commandNeedsAwsMacosBun([body]);

2323+

requirements.swift ||= commandNeedsAwsMacosSwiftToolchain([body]);

21672324

}

21682325

return requirements;

21692326

}

21702327

requirements.packageManager = commandNeedsAwsMacosPackageManager([script]);

21712328

requirements.bun = commandNeedsAwsMacosBun([script]);

2329+

requirements.swift = commandNeedsAwsMacosSwiftToolchain([script]);

21722330

return requirements;

21732331

}

21742332

@@ -2677,15 +2835,26 @@ if (

26772835

}

2678283626792837

const remoteMarkedArgs = injectRemoteChangedGateEnvironment(normalizedArgs);

2838+

const remoteMarkedNeedsAwsMacosSwift =

2839+

isAwsMacosRemoteTarget(remoteMarkedArgs, provider) &&

2840+

commandNeedsAwsMacosSwiftToolchain(runCommandArgs(remoteMarkedArgs));

26802841

const childArgs =

26812842

childCwd === repoRoot

26822843

? injectRemoteWindowsHydratedNodeModulesBootstrap(

2683-

injectRemoteAwsMacosJsBootstrap(remoteMarkedArgs, provider),

2844+

injectRemoteAwsMacosSwiftBootstrap(

2845+

injectRemoteAwsMacosJsBootstrap(remoteMarkedArgs, provider),

2846+

provider,

2847+

remoteMarkedNeedsAwsMacosSwift,

2848+

),

26842849

provider,

26852850

)

26862851

: injectRemoteChangedGateGitBootstrap(

26872852

injectRemoteWindowsHydratedNodeModulesBootstrap(

2688-

injectRemoteAwsMacosJsBootstrap(absolutizeLocalRunPaths(remoteMarkedArgs), provider),

2853+

injectRemoteAwsMacosSwiftBootstrap(

2854+

injectRemoteAwsMacosJsBootstrap(absolutizeLocalRunPaths(remoteMarkedArgs), provider),

2855+

provider,

2856+

remoteMarkedNeedsAwsMacosSwift,

2857+

),

26892858

provider,

26902859

),

26912860

remoteChangedGateBase,