@devries-cameron20 / composio Mirror · read-only / commits / 422700a14
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 22:15 UTC

fix(cli): patch iMessage binary build for macOS 15 (#3346)

## Summary - Patch the resolved BetterSwiftAX checkout before building `imessage-cli` sidecars. - Replace newer macOS SDK AX subrole constants with equivalent `CFString` literals so GitHub `macos-15` runners can build the Beeper iMessage binary. - Keep the patch local to the generated build checkout; no native binary blobs are committed. ## Why The CLI binary release job failed in `Build local-tool sidecar binaries` on `macos-15` because BetterSwiftAX references AXWebConstants available in newer SDKs but missing from the runner SDK, e.g. `kAXLandmarkComplementarySubrole` and `kAXMathFenceOperatorSubrole`. ## Validation - `pnpm exec eslint ts/packages/cli-local-tools/scripts/build-beeper-imessage-binaries.ts --quiet` - `pnpm --filter @composio/cli-local-tools build:beeper-imessage -- --target darwin-arm64` - `pnpm --filter @composio/cli-local-tools build:beeper-imessage -- --target darwin-x64` - `pnpm --filter @composio/cli-local-tools typecheck:tsc` - `pnpm --filter @composio/cli-local-tools test`

Rahul Tarak committed May 5, 2026 at 01:23 UTC 422700a1416694a749217b2de145c36714a5c380
1 file changed +68
ts/packages/cli-local-tools/scripts/build-beeper-imessage-binaries.ts
+68
@@ -38,6 +38,47 @@ const exists = async (filePath: string): Promise<boolean> =>
38 const readJson = async <T>(filePath: string): Promise<T> =>
39 JSON.parse(await fs.readFile(filePath, 'utf8')) as T;
40
41 +// BetterSwiftAX 0.1.0 references AXWebConstants added in newer macOS SDKs.
42 +// The constants are plain CFString subrole names, so patch the resolved package
43 +// checkout to string literals before building on GitHub macos-15 runners.
44 +const betterSwiftAxSubroleFallbacks = [
45 + ['kAXLandmarkComplementarySubrole', 'AXLandmarkComplementary'],
46 + ['kAXLandmarkContentInfoSubrole', 'AXLandmarkContentInfo'],
47 + ['kAXLandmarkMainSubrole', 'AXLandmarkMain'],
48 + ['kAXLandmarkNavigationSubrole', 'AXLandmarkNavigation'],
49 + ['kAXLandmarkRegionSubrole', 'AXLandmarkRegion'],
50 + ['kAXLandmarkSearchSubrole', 'AXLandmarkSearch'],
51 + ['kAXMathFenceOperatorSubrole', 'AXMathFenceOperator'],
52 + ['kAXMathFencedSubrole', 'AXMathFenced'],
53 + ['kAXMathFractionSubrole', 'AXMathFraction'],
54 + ['kAXMathIdentifierSubrole', 'AXMathIdentifier'],
55 + ['kAXMathMultiscriptSubrole', 'AXMathMultiscript'],
56 + ['kAXMathNumberSubrole', 'AXMathNumber'],
57 + ['kAXMathOperatorSubrole', 'AXMathOperator'],
58 + ['kAXMathRootSubrole', 'AXMathRoot'],
59 + ['kAXMathRowSubrole', 'AXMathRow'],
60 + ['kAXMathSeparatorOperatorSubrole', 'AXMathSeparatorOperator'],
61 + ['kAXMathSquareRootSubrole', 'AXMathSquareRoot'],
62 + ['kAXMathSubscriptSuperscriptSubrole', 'AXMathSubscriptSuperscript'],
63 + ['kAXMathTableCellSubrole', 'AXMathTableCell'],
64 + ['kAXMathTableRowSubrole', 'AXMathTableRow'],
65 + ['kAXMathTableSubrole', 'AXMathTable'],
66 + ['kAXMathTextSubrole', 'AXMathText'],
67 + ['kAXMathUnderOverSubrole', 'AXMathUnderOver'],
68 + ['kAXMeterSubrole', 'AXMeter'],
69 + ['kAXRubyInlineSubrole', 'AXRubyInline'],
70 + ['kAXRubyTextSubrole', 'AXRubyText'],
71 + ['kAXSubscriptStyleGroupSubrole', 'AXSubscriptStyleGroup'],
72 + ['kAXSummarySubrole', 'AXSummary'],
73 + ['kAXSuperscriptStyleGroupSubrole', 'AXSuperscriptStyleGroup'],
74 + ['kAXTabPanelSubrole', 'AXTabPanel'],
75 + ['kAXTermSubrole', 'AXTerm'],
76 + ['kAXTimeGroupSubrole', 'AXTimeGroup'],
77 + ['kAXUserInterfaceTooltipSubrole', 'AXUserInterfaceTooltip'],
78 + ['kAXVideoSubrole', 'AXVideo'],
79 + ['kAXWebApplicationSubrole', 'AXWebApplication'],
80 +] as const;
81 +
82 const ensurePlatform = () => {
83 if (process.platform !== 'darwin') {
84 throw new Error(
@@ -81,8 +122,35 @@ const copyLicense = async () => {
122 throw new Error('No upstream license file found in platform-imessage submodule.');
123 };
124
125 +const patchBetterSwiftAxForCurrentSdk = async () => {
126 + await $`swift package resolve`.cwd(submodulePath);
127 +
128 + const sourcePath = path.join(
129 + submodulePath,
130 + '.build/checkouts/BetterSwiftAX/Sources/AccessibilityControl/Accessibility+Subrole.swift'
131 + );
132 + if (!(await exists(sourcePath))) {
133 + throw new Error(
134 + 'Swift package resolution completed but BetterSwiftAX Accessibility+Subrole.swift was not found.'
135 + );
136 + }
137 +
138 + const source = await fs.readFile(sourcePath, 'utf8');
139 + let patched = source;
140 + for (const [constantName, stringValue] of betterSwiftAxSubroleFallbacks) {
141 + patched = patched.replaceAll(`= ${constantName}`, `= ("${stringValue}" as CFString)`);
142 + }
143 +
144 + if (patched !== source) {
145 + await fs.chmod(sourcePath, 0o644).catch(() => undefined);
146 + await fs.writeFile(sourcePath, patched, 'utf8');
147 + console.log('Patched BetterSwiftAX subrole constants for older macOS SDKs.');
148 + }
149 +};
150 +
151 const buildTarget = async (target: Target) => {
152 console.log(`Building imessage-cli for ${target.platform} (${target.swiftArch})...`);
153 + await patchBetterSwiftAxForCurrentSdk();
154 await $`swift build -c release --product imessage-cli --arch ${target.swiftArch}`.cwd(
155 submodulePath
156 );