@roam-agent/roam-computer-use 0.0.0-stage → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +80 -2
- package/assets/reference/img.jpg +0 -0
- package/docs/README.md +45 -0
- package/docs/content/docs/explanation/action-pipeline.mdx +36 -0
- package/docs/content/docs/explanation/architecture.mdx +161 -0
- package/docs/content/docs/explanation/index.mdx +19 -0
- package/docs/content/docs/explanation/meta.json +5 -0
- package/docs/content/docs/explanation/observation-pipeline.mdx +37 -0
- package/docs/content/docs/explanation/platform-boundary.mdx +37 -0
- package/docs/content/docs/explanation/state-and-scheduling.mdx +35 -0
- package/docs/content/docs/how-to-guides/develop-and-validate.mdx +112 -0
- package/docs/content/docs/how-to-guides/index.mdx +12 -0
- package/docs/content/docs/how-to-guides/linux.mdx +68 -0
- package/docs/content/docs/how-to-guides/meta.json +1 -0
- package/docs/content/docs/how-to-guides/troubleshooting.mdx +126 -0
- package/docs/content/docs/index.mdx +67 -0
- package/docs/content/docs/meta.json +5 -0
- package/docs/content/docs/reference/agent/contract.mdx +162 -0
- package/docs/content/docs/reference/agent/index.mdx +8 -0
- package/docs/content/docs/reference/agent/meta.json +8 -0
- package/docs/content/docs/reference/agent/tools.mdx +221 -0
- package/docs/content/docs/reference/codebase.mdx +139 -0
- package/docs/content/docs/reference/configuration.mdx +113 -0
- package/docs/content/docs/reference/index.mdx +28 -0
- package/docs/content/docs/reference/meta.json +10 -0
- package/docs/content/docs/reference/platforms/index.mdx +18 -0
- package/docs/content/docs/reference/platforms/macos/accessibility.mdx +61 -0
- package/docs/content/docs/reference/platforms/macos/actions.mdx +63 -0
- package/docs/content/docs/reference/platforms/macos/capture.mdx +58 -0
- package/docs/content/docs/reference/platforms/macos/implementation.mdx +98 -0
- package/docs/content/docs/reference/platforms/macos/index.mdx +16 -0
- package/docs/content/docs/reference/platforms/macos/meta.json +10 -0
- package/docs/content/docs/reference/platforms/macos/root-targeting.mdx +47 -0
- package/docs/content/docs/reference/platforms/meta.json +8 -0
- package/docs/content/docs/reference/platforms/windows.mdx +75 -0
- package/docs/content/docs/tutorials/getting-started.mdx +46 -0
- package/docs/content/docs/tutorials/index.mdx +10 -0
- package/docs/content/docs/tutorials/meta.json +1 -0
- package/extensions/computer-use.ts +235 -0
- package/native/linux/bridge-rs/Cargo.lock +1204 -0
- package/native/linux/bridge-rs/Cargo.toml +21 -0
- package/native/linux/bridge-rs/src/atspi.rs +670 -0
- package/native/linux/bridge-rs/src/error.rs +65 -0
- package/native/linux/bridge-rs/src/lib.rs +11 -0
- package/native/linux/bridge-rs/src/main.rs +1110 -0
- package/native/linux/bridge-rs/src/protocol.rs +49 -0
- package/native/linux/bridge-rs/src/state.rs +293 -0
- package/native/linux/bridge-rs/src/wayland.rs +89 -0
- package/native/linux/bridge-rs/src/x11.rs +909 -0
- package/native/linux/bridge-rs/tests/protocol_tests.rs +73 -0
- package/native/macos/activity_glow.swift +169 -0
- package/native/macos/bridge.swift +3968 -0
- package/native/windows/bridge-rs/Cargo.lock +396 -0
- package/native/windows/bridge-rs/Cargo.toml +30 -0
- package/native/windows/bridge-rs/src/capture.rs +561 -0
- package/native/windows/bridge-rs/src/error.rs +81 -0
- package/native/windows/bridge-rs/src/input.rs +501 -0
- package/native/windows/bridge-rs/src/lib.rs +85 -0
- package/native/windows/bridge-rs/src/main.rs +1683 -0
- package/native/windows/bridge-rs/src/protocol.rs +53 -0
- package/native/windows/bridge-rs/src/refs.rs +237 -0
- package/native/windows/bridge-rs/src/state.rs +55 -0
- package/native/windows/bridge-rs/src/uia.rs +1252 -0
- package/native/windows/bridge-rs/src/window.rs +718 -0
- package/native/windows/bridge-rs/tests/protocol_tests.rs +252 -0
- package/native/windows/bridge-rs/tests/refs_tests.rs +86 -0
- package/native/windows/bridge-rs/tests/state_tests.rs +33 -0
- package/package.json +105 -5
- package/prebuilt/macos/arm64/bridge +0 -0
- package/prebuilt/macos/x64/bridge +0 -0
- package/roam/README.md +52 -0
- package/roam/bridge/macos/arm64/bridge +0 -0
- package/roam/bridge/macos/x64/bridge +0 -0
- package/roam/bridge/manifest.json +20 -0
- package/roam/helper-path.d.mts +9 -0
- package/roam/helper-path.mjs +36 -0
- package/roam/identity.d.mts +16 -0
- package/roam/identity.mjs +64 -0
- package/roam/index.ts +51 -0
- package/roam/redirect.ts +51 -0
- package/roam/repair.ts +120 -0
- package/scripts/build-native.mjs +286 -0
- package/scripts/lib/roam-bridge.mjs +98 -0
- package/scripts/setup-helper.mjs +635 -0
- package/src/actions.ts +130 -0
- package/src/bridge.ts +2594 -0
- package/src/cdp.ts +658 -0
- package/src/config.ts +226 -0
- package/src/contract.ts +107 -0
- package/src/extension/index.ts +9 -0
- package/src/find-params.ts +21 -0
- package/src/note.ts +195 -0
- package/src/outline.ts +702 -0
- package/src/output.ts +134 -0
- package/src/permissions.ts +111 -0
- package/src/platform/architecture.ts +23 -0
- package/src/platform/coerce.ts +16 -0
- package/src/platform/index.ts +61 -0
- package/src/platform/linux/backend.ts +186 -0
- package/src/platform/linux/helper.ts +238 -0
- package/src/platform/macos/backend.ts +147 -0
- package/src/platform/macos/browser.ts +110 -0
- package/src/platform/macos/helper.ts +369 -0
- package/src/platform/macos/permissions.ts +146 -0
- package/src/platform/types.ts +229 -0
- package/src/platform/windows/backend.ts +142 -0
- package/src/platform/windows/helper.ts +140 -0
- package/src/root-selection.ts +25 -0
- package/src/runtime.ts +129 -0
- package/src/state.ts +146 -0
- package/src/view.ts +147 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single source of truth for the roam fork's shipped identity.
|
|
3
|
+
*
|
|
4
|
+
* Every artifact name, bundle id, socket location, and signing identity the fork
|
|
5
|
+
* installs or publishes is defined here and imported by `roam/` and `scripts/`.
|
|
6
|
+
* Nothing else in the repository may spell these values out; `npm run
|
|
7
|
+
* test:identity` fails if a duplicate literal reappears outside this module.
|
|
8
|
+
*
|
|
9
|
+
* `UPSTREAM_*` names are the values still compiled into or resolved by
|
|
10
|
+
* upstream-owned code (`src/`, `native/`, `extensions/`). They stay here so the
|
|
11
|
+
* deferred part of the identifier rename can be completed in one place.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** Product name without the scope or the `.app` suffix. */
|
|
15
|
+
export const ROAM_APP_NAME = "roam-computer-use";
|
|
16
|
+
|
|
17
|
+
/** macOS helper app bundle name. */
|
|
18
|
+
export const ROAM_APP_BUNDLE_NAME = `${ROAM_APP_NAME}.app`;
|
|
19
|
+
|
|
20
|
+
/** npm package name. */
|
|
21
|
+
export const ROAM_PACKAGE_NAME = "@roam-agent/roam-computer-use";
|
|
22
|
+
|
|
23
|
+
/** macOS helper bundle identifier written into `Info.plist`. */
|
|
24
|
+
export const ROAM_BUNDLE_ID = "com.roam-agent.roam-computer-use";
|
|
25
|
+
|
|
26
|
+
/** Organization tag used inside the local code-signing identity. */
|
|
27
|
+
export const ROAM_SIGNING_ORG = "roam-agent";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Common name of the self-signed code-signing identity.
|
|
31
|
+
*
|
|
32
|
+
* X.509 caps `commonName` at 64 characters, so this names the app and its
|
|
33
|
+
* organization instead of repeating the full bundle id: an over-long value makes
|
|
34
|
+
* the identity fail to create and silently falls back to ad-hoc signing.
|
|
35
|
+
*/
|
|
36
|
+
export const ROAM_LOCAL_SIGNING_COMMON_NAME = `${ROAM_APP_NAME} Local Signing (${ROAM_SIGNING_ORG})`;
|
|
37
|
+
|
|
38
|
+
/** File name of the signed helper release asset. */
|
|
39
|
+
export const ROAM_RELEASE_ASSET = `${ROAM_APP_BUNDLE_NAME}.zip`;
|
|
40
|
+
|
|
41
|
+
/** Directory below `~/Library/Caches/` that holds the helper socket. */
|
|
42
|
+
export const ROAM_SOCKET_DIR_NAME = ROAM_APP_NAME;
|
|
43
|
+
export const ROAM_BRIDGE_PLATFORM = "macos";
|
|
44
|
+
|
|
45
|
+
/** Socket file name inside {@link ROAM_SOCKET_DIR_NAME}. */
|
|
46
|
+
export const ROAM_SOCKET_FILE_NAME = "bridge.sock";
|
|
47
|
+
|
|
48
|
+
/** Prefix for user-facing helper log lines. */
|
|
49
|
+
export const ROAM_LOG_PREFIX = `[${ROAM_APP_NAME}]`;
|
|
50
|
+
|
|
51
|
+
/** GitHub repository slug of the fork. */
|
|
52
|
+
export const ROAM_REPO_SLUG = "roam-agent/roam-computer-use";
|
|
53
|
+
|
|
54
|
+
/** GitHub repository URL of the fork. */
|
|
55
|
+
export const ROAM_REPO_URL = `https://github.com/${ROAM_REPO_SLUG}`;
|
|
56
|
+
|
|
57
|
+
/** npm package name upstream still publishes. */
|
|
58
|
+
export const UPSTREAM_PACKAGE_NAME = "@injaneity/pi-computer-use";
|
|
59
|
+
|
|
60
|
+
/** GitHub repository slug of the upstream project. */
|
|
61
|
+
export const UPSTREAM_REPO_SLUG = "injaneity/pi-computer-use";
|
|
62
|
+
|
|
63
|
+
/** GitHub repository URL of the upstream project. */
|
|
64
|
+
export const UPSTREAM_REPO_URL = `https://github.com/${UPSTREAM_REPO_SLUG}`;
|
package/roam/index.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Roam fork overlay entry.
|
|
3
|
+
*
|
|
4
|
+
* This folder is this fork's *extension* surface, mirroring how the pi repo
|
|
5
|
+
* keeps fork-local behavior under its own `.roam/` folder and how the `plus`
|
|
6
|
+
* packages layer over upstream: upstream `src/` stays boring, and every
|
|
7
|
+
* deliberate override is reachable from here.
|
|
8
|
+
*
|
|
9
|
+
* Two concerns live here today:
|
|
10
|
+
* - `identity.ts` — the shipped identity: app bundle, bundle id, socket, signing
|
|
11
|
+
* identity, package and repository names. The only place these values exist.
|
|
12
|
+
* - `redirect.ts` — redirection wiring: which helper app/executable/socket.
|
|
13
|
+
* - `repair.ts` — defect fixing: protocol/executable mismatch repair.
|
|
14
|
+
*/
|
|
15
|
+
export {
|
|
16
|
+
ROAM_APP_BUNDLE_NAME,
|
|
17
|
+
ROAM_APP_NAME,
|
|
18
|
+
ROAM_BUNDLE_ID,
|
|
19
|
+
ROAM_LOCAL_SIGNING_COMMON_NAME,
|
|
20
|
+
ROAM_LOG_PREFIX,
|
|
21
|
+
ROAM_PACKAGE_NAME,
|
|
22
|
+
ROAM_RELEASE_ASSET,
|
|
23
|
+
ROAM_REPO_SLUG,
|
|
24
|
+
ROAM_REPO_URL,
|
|
25
|
+
ROAM_SIGNING_ORG,
|
|
26
|
+
ROAM_SOCKET_DIR_NAME,
|
|
27
|
+
ROAM_SOCKET_FILE_NAME,
|
|
28
|
+
UPSTREAM_PACKAGE_NAME,
|
|
29
|
+
UPSTREAM_REPO_SLUG,
|
|
30
|
+
UPSTREAM_REPO_URL,
|
|
31
|
+
} from "./identity.mjs";
|
|
32
|
+
export {
|
|
33
|
+
ROAM_HELPER_APP_EXECUTABLE_PATH,
|
|
34
|
+
ROAM_HELPER_APP_PATH,
|
|
35
|
+
ROAM_HELPER_BUNDLE_ID,
|
|
36
|
+
ROAM_HELPER_SOCKET_PATH,
|
|
37
|
+
daemonResolvesToRedirectedExecutable,
|
|
38
|
+
isExecutable,
|
|
39
|
+
usingRedirectedHelperSocket,
|
|
40
|
+
} from "./redirect.ts";
|
|
41
|
+
export {
|
|
42
|
+
ROAM_HELPER_PROTOCOL_VERSION,
|
|
43
|
+
ROAM_HELPER_SETUP_TIMEOUT_MS,
|
|
44
|
+
createHelperRepair,
|
|
45
|
+
describeHelperDefect,
|
|
46
|
+
detectHelperDefect,
|
|
47
|
+
type RoamHelperDefect,
|
|
48
|
+
type RoamHelperDefectKind,
|
|
49
|
+
type RoamHelperRepairHost,
|
|
50
|
+
} from "./repair.ts";
|
|
51
|
+
export { resolveMacosHelperAppPath, type MacosHelperPathOptions } from "./helper-path.mjs";
|
package/roam/redirect.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Roam fork overlay — redirection wiring.
|
|
3
|
+
*
|
|
4
|
+
* Everything that decides *which* helper app, executable, and socket a request
|
|
5
|
+
* is redirected to lives here, so upstream `src/platform/*` stays a pure
|
|
6
|
+
* transport. Keep this module free of transport concerns.
|
|
7
|
+
*/
|
|
8
|
+
import { constants as fsConstants } from "node:fs";
|
|
9
|
+
import { access, realpath } from "node:fs/promises";
|
|
10
|
+
import os from "node:os";
|
|
11
|
+
import path from "node:path";
|
|
12
|
+
import { resolveMacosHelperAppPath } from "./helper-path.mjs";
|
|
13
|
+
import { ROAM_BUNDLE_ID, ROAM_SOCKET_DIR_NAME, ROAM_SOCKET_FILE_NAME } from "./identity.mjs";
|
|
14
|
+
|
|
15
|
+
export const ROAM_HELPER_BUNDLE_ID = ROAM_BUNDLE_ID;
|
|
16
|
+
|
|
17
|
+
/** Resolved app bundle: explicit override > legacy system install > per-user. */
|
|
18
|
+
export const ROAM_HELPER_APP_PATH = resolveMacosHelperAppPath();
|
|
19
|
+
|
|
20
|
+
/** The exact executable inside the resolved bundle, never a LaunchServices guess. */
|
|
21
|
+
export const ROAM_HELPER_APP_EXECUTABLE_PATH = path.join(ROAM_HELPER_APP_PATH, "Contents", "MacOS", "bridge");
|
|
22
|
+
|
|
23
|
+
const DEFAULT_ROAM_HELPER_SOCKET_PATH = path.join(os.homedir(), "Library", "Caches", ROAM_SOCKET_DIR_NAME, ROAM_SOCKET_FILE_NAME);
|
|
24
|
+
|
|
25
|
+
/** Socket redirection: an external daemon can be addressed for tests and shared use. */
|
|
26
|
+
export const ROAM_HELPER_SOCKET_PATH = process.env.PI_CU_SOCKET_PATH ?? DEFAULT_ROAM_HELPER_SOCKET_PATH;
|
|
27
|
+
|
|
28
|
+
/** True when an externally mounted socket was requested, so install/repair must stand down. */
|
|
29
|
+
export const usingRedirectedHelperSocket = ROAM_HELPER_SOCKET_PATH !== DEFAULT_ROAM_HELPER_SOCKET_PATH;
|
|
30
|
+
|
|
31
|
+
export async function isExecutable(filePath: string): Promise<boolean> {
|
|
32
|
+
try {
|
|
33
|
+
await access(filePath, fsConstants.X_OK);
|
|
34
|
+
return true;
|
|
35
|
+
} catch {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Does the daemon running behind the socket come from the redirect we resolved?
|
|
42
|
+
* A legacy bundle with the same bundle id must not pass this check.
|
|
43
|
+
*/
|
|
44
|
+
export async function daemonResolvesToRedirectedExecutable(reportedExecutablePath?: string): Promise<boolean> {
|
|
45
|
+
if (!reportedExecutablePath) return true;
|
|
46
|
+
const [actualPath, expectedPath] = await Promise.all([
|
|
47
|
+
realpath(reportedExecutablePath).catch(() => path.resolve(reportedExecutablePath)),
|
|
48
|
+
realpath(ROAM_HELPER_APP_EXECUTABLE_PATH).catch(() => path.resolve(ROAM_HELPER_APP_EXECUTABLE_PATH)),
|
|
49
|
+
]);
|
|
50
|
+
return actualPath === expectedPath;
|
|
51
|
+
}
|
package/roam/repair.ts
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Roam fork overlay — helper defect fixing.
|
|
3
|
+
*
|
|
4
|
+
* The helper daemon outlives Pi: a stale daemon, a stale installed bundle, or a
|
|
5
|
+
* bundle launched from the legacy system location all survive a Pi restart and
|
|
6
|
+
* surface as a protocol/executable mismatch. This module owns the repair policy
|
|
7
|
+
* (detect -> reinstall -> relaunch -> re-verify) and fails closed when the
|
|
8
|
+
* mismatch persists.
|
|
9
|
+
*/
|
|
10
|
+
import type { PlatformDiagnostics } from "../src/platform/types.ts";
|
|
11
|
+
import { ROAM_APP_NAME } from "./identity.mjs";
|
|
12
|
+
import {
|
|
13
|
+
ROAM_HELPER_APP_EXECUTABLE_PATH,
|
|
14
|
+
ROAM_HELPER_APP_PATH,
|
|
15
|
+
ROAM_HELPER_SOCKET_PATH,
|
|
16
|
+
daemonResolvesToRedirectedExecutable,
|
|
17
|
+
isExecutable,
|
|
18
|
+
usingRedirectedHelperSocket,
|
|
19
|
+
} from "./redirect.ts";
|
|
20
|
+
|
|
21
|
+
/** Protocol this checkout's tools speak; the native helpers must match it exactly. */
|
|
22
|
+
export const ROAM_HELPER_PROTOCOL_VERSION = 7;
|
|
23
|
+
|
|
24
|
+
export const ROAM_HELPER_SETUP_TIMEOUT_MS = 60_000;
|
|
25
|
+
|
|
26
|
+
export type RoamHelperDefectKind = "protocol" | "executable";
|
|
27
|
+
|
|
28
|
+
export interface RoamHelperDefect {
|
|
29
|
+
kind: RoamHelperDefectKind;
|
|
30
|
+
expectedProtocol: number;
|
|
31
|
+
gotProtocol: number;
|
|
32
|
+
expectedExecutable: string;
|
|
33
|
+
gotExecutable?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface RoamHelperRepairHost {
|
|
37
|
+
/** Install or reinstall the local helper bundle, then verify its executable. */
|
|
38
|
+
reinstall(signal?: AbortSignal): Promise<void>;
|
|
39
|
+
/** Stop the daemon through the backwards-compatible channel and relaunch the resolved bundle. */
|
|
40
|
+
restart(signal?: AbortSignal): Promise<void>;
|
|
41
|
+
readDiagnostics(signal?: AbortSignal): Promise<PlatformDiagnostics>;
|
|
42
|
+
/** Record that the daemon must be considered gone. */
|
|
43
|
+
markDaemonUnavailable(): void;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function detectHelperDefect(diagnostics: PlatformDiagnostics, executableMatches: boolean): RoamHelperDefect | undefined {
|
|
47
|
+
const protocolStale = diagnostics.protocolVersion !== ROAM_HELPER_PROTOCOL_VERSION;
|
|
48
|
+
if (!protocolStale && executableMatches) return undefined;
|
|
49
|
+
return {
|
|
50
|
+
kind: protocolStale ? "protocol" : "executable",
|
|
51
|
+
expectedProtocol: ROAM_HELPER_PROTOCOL_VERSION,
|
|
52
|
+
gotProtocol: diagnostics.protocolVersion,
|
|
53
|
+
expectedExecutable: ROAM_HELPER_APP_EXECUTABLE_PATH,
|
|
54
|
+
gotExecutable: diagnostics.executablePath,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Actionable, fail-closed text: names the mismatch, then the remedy that applies to this path. */
|
|
59
|
+
export function describeHelperDefect(defect: RoamHelperDefect, remedy: string): string {
|
|
60
|
+
return (
|
|
61
|
+
`${ROAM_APP_NAME} helper mismatch (${defect.kind}): expected protocol ${defect.expectedProtocol} and executable ` +
|
|
62
|
+
`${defect.expectedExecutable}; got protocol ${defect.gotProtocol} and executable ${defect.gotExecutable ?? "unknown"}. ${remedy}`
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function createHelperRepair(host: RoamHelperRepairHost) {
|
|
67
|
+
async function inspect(signal?: AbortSignal) {
|
|
68
|
+
const diagnostics = await host.readDiagnostics(signal);
|
|
69
|
+
const executableMatches = await daemonResolvesToRedirectedExecutable(diagnostics.executablePath);
|
|
70
|
+
return { diagnostics, defect: detectHelperDefect(diagnostics, executableMatches) };
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
/**
|
|
75
|
+
* Install on demand. Installation is a deployment/repair operation, not
|
|
76
|
+
* part of every new agent process's hot path.
|
|
77
|
+
*/
|
|
78
|
+
async ensureInstalled(signal?: AbortSignal): Promise<void> {
|
|
79
|
+
if (usingRedirectedHelperSocket) return;
|
|
80
|
+
if (await isExecutable(ROAM_HELPER_APP_EXECUTABLE_PATH)) return;
|
|
81
|
+
await host.reinstall(signal);
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
/** Protocol/executable compatibility gate, with repair before failing closed. */
|
|
85
|
+
async ensureProtocol(signal?: AbortSignal): Promise<PlatformDiagnostics> {
|
|
86
|
+
const { diagnostics, defect } = await inspect(signal);
|
|
87
|
+
if (!defect) return diagnostics;
|
|
88
|
+
|
|
89
|
+
// Stop the stale daemon through the command channel and relaunch the
|
|
90
|
+
// exact bundle resolved by the redirection wiring.
|
|
91
|
+
await host.restart(signal);
|
|
92
|
+
const relaunched = await inspect(signal);
|
|
93
|
+
if (!relaunched.defect) return relaunched.diagnostics;
|
|
94
|
+
|
|
95
|
+
// Defect fixing: a stale *installed* bundle cannot be fixed by a
|
|
96
|
+
// relaunch, so reinstall from the prebuilt helper and try once more.
|
|
97
|
+
if (usingRedirectedHelperSocket) {
|
|
98
|
+
host.markDaemonUnavailable();
|
|
99
|
+
throw new Error(
|
|
100
|
+
describeHelperDefect(
|
|
101
|
+
relaunched.defect,
|
|
102
|
+
`An external helper socket is redirected (${ROAM_HELPER_SOCKET_PATH}), so this checkout cannot reinstall it; point PI_CU_SOCKET_PATH at a helper that speaks protocol ${ROAM_HELPER_PROTOCOL_VERSION}.`,
|
|
103
|
+
),
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
await host.reinstall(signal);
|
|
107
|
+
await host.restart(signal);
|
|
108
|
+
const repaired = await inspect(signal);
|
|
109
|
+
if (!repaired.defect) return repaired.diagnostics;
|
|
110
|
+
|
|
111
|
+
host.markDaemonUnavailable();
|
|
112
|
+
throw new Error(
|
|
113
|
+
describeHelperDefect(
|
|
114
|
+
repaired.defect,
|
|
115
|
+
`Repair already reinstalled ${ROAM_HELPER_APP_PATH} from the prebuilt helper and relaunched it (socket ${ROAM_HELPER_SOCKET_PATH}), and it is still stale; rebuild the prebuilt binary (npm run build:native) and reinstall.`,
|
|
116
|
+
),
|
|
117
|
+
);
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawn } from "node:child_process";
|
|
4
|
+
import fs from "node:fs/promises";
|
|
5
|
+
import os from "node:os";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
import { ROAM_APP_NAME, ROAM_BUNDLE_ID } from "../roam/identity.mjs";
|
|
9
|
+
import { refreshRoamBridgeSet } from "./lib/roam-bridge.mjs";
|
|
10
|
+
|
|
11
|
+
const rootDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
12
|
+
const macosSourcePaths = [
|
|
13
|
+
"activity_glow.swift",
|
|
14
|
+
"agent_cursor.swift",
|
|
15
|
+
"agent_cursor_motion.swift",
|
|
16
|
+
"bridge.swift",
|
|
17
|
+
].map((file) => path.join(rootDir, "native", "macos", file));
|
|
18
|
+
const windowsCrateDir = path.join(rootDir, "native", "windows", "bridge-rs");
|
|
19
|
+
const linuxCrateDir = path.join(rootDir, "native", "linux", "bridge-rs");
|
|
20
|
+
const linuxTargets = { x64: "x86_64-unknown-linux-gnu", arm64: "aarch64-unknown-linux-gnu" };
|
|
21
|
+
const archTriples = {
|
|
22
|
+
arm64: "arm64-apple-macosx",
|
|
23
|
+
x64: "x86_64-apple-macosx",
|
|
24
|
+
};
|
|
25
|
+
const deploymentTarget = "14.0";
|
|
26
|
+
const frameworks = ["ApplicationServices", "AppKit", "ScreenCaptureKit", "Foundation", "SwiftUI"];
|
|
27
|
+
const defaultCodeSignIdentifier = ROAM_BUNDLE_ID;
|
|
28
|
+
|
|
29
|
+
async function exists(filePath) {
|
|
30
|
+
try {
|
|
31
|
+
await fs.access(filePath);
|
|
32
|
+
return true;
|
|
33
|
+
} catch {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function getArg(name) {
|
|
39
|
+
const index = process.argv.indexOf(name);
|
|
40
|
+
if (index >= 0 && index + 1 < process.argv.length) {
|
|
41
|
+
return process.argv[index + 1];
|
|
42
|
+
}
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function hasArg(name) {
|
|
47
|
+
return process.argv.includes(name);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function normalizeArch(arch) {
|
|
51
|
+
if (arch === "universal" || arch === "all") return arch;
|
|
52
|
+
if (arch === "arm64" || arch === "x64") return arch;
|
|
53
|
+
throw new Error(`Unsupported architecture '${arch}'. Supported: arm64, x64, universal, all.`);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async function run(command, args) {
|
|
57
|
+
await new Promise((resolve, reject) => {
|
|
58
|
+
const child = spawn(command, args, { stdio: "inherit" });
|
|
59
|
+
child.on("error", reject);
|
|
60
|
+
child.on("close", (code) => {
|
|
61
|
+
if (code === 0) {
|
|
62
|
+
resolve();
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
reject(new Error(`Command failed (${code}): ${command} ${args.join(" ")}`));
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function defaultOutputPath(arch) {
|
|
71
|
+
return path.join(rootDir, "prebuilt", "macos", arch, "bridge");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function moduleCachePath(arch) {
|
|
75
|
+
return path.join(os.tmpdir(), `${ROAM_APP_NAME}-swift-module-cache-${arch}`);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function swiftArgsForArch(arch, outputPath) {
|
|
79
|
+
const args = [
|
|
80
|
+
"swiftc",
|
|
81
|
+
"-target",
|
|
82
|
+
`${archTriples[arch]}${deploymentTarget}`,
|
|
83
|
+
"-module-cache-path",
|
|
84
|
+
moduleCachePath(arch),
|
|
85
|
+
"-O",
|
|
86
|
+
];
|
|
87
|
+
for (const framework of frameworks) args.push("-framework", framework);
|
|
88
|
+
args.push(...macosSourcePaths, "-o", outputPath);
|
|
89
|
+
return args;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async function signBinary(outputPath) {
|
|
93
|
+
if (hasArg("--no-sign") || process.env.PI_COMPUTER_USE_NO_SIGN === "1") {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const identity = getArg("--sign-identity") ?? process.env.PI_COMPUTER_USE_CODESIGN_IDENTITY ?? "-";
|
|
98
|
+
const identifier = getArg("--sign-identifier") ?? process.env.PI_COMPUTER_USE_CODESIGN_IDENTIFIER ?? defaultCodeSignIdentifier;
|
|
99
|
+
const args = ["--force", "-i", identifier];
|
|
100
|
+
if (hasArg("--hardened-runtime")) {
|
|
101
|
+
args.push("--options", "runtime");
|
|
102
|
+
}
|
|
103
|
+
if (hasArg("--timestamp")) {
|
|
104
|
+
args.push("--timestamp");
|
|
105
|
+
} else {
|
|
106
|
+
args.push("--timestamp=none");
|
|
107
|
+
}
|
|
108
|
+
args.push("--sign", identity, outputPath);
|
|
109
|
+
await run("codesign", args);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
async function buildForArch(arch, outputPath) {
|
|
113
|
+
await fs.mkdir(path.dirname(outputPath), { recursive: true });
|
|
114
|
+
console.log(`Building native helper for ${arch}...`);
|
|
115
|
+
await run("xcrun", swiftArgsForArch(arch, outputPath));
|
|
116
|
+
await fs.chmod(outputPath, 0o755);
|
|
117
|
+
await signBinary(outputPath);
|
|
118
|
+
console.log(`Built helper at ${outputPath}`);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
async function buildUniversal(outputPath) {
|
|
122
|
+
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), `${ROAM_APP_NAME}-build-`));
|
|
123
|
+
const x64Output = path.join(tempDir, "bridge-x64");
|
|
124
|
+
const arm64Output = path.join(tempDir, "bridge-arm64");
|
|
125
|
+
await buildForArch("x64", x64Output);
|
|
126
|
+
await buildForArch("arm64", arm64Output);
|
|
127
|
+
await fs.mkdir(path.dirname(outputPath), { recursive: true });
|
|
128
|
+
await run("lipo", ["-create", "-output", outputPath, x64Output, arm64Output]);
|
|
129
|
+
await fs.chmod(outputPath, 0o755);
|
|
130
|
+
await signBinary(outputPath);
|
|
131
|
+
console.log(`Built universal helper at ${outputPath}`);
|
|
132
|
+
await fs.rm(tempDir, { recursive: true, force: true });
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Return the actual cargo binary path, handling platform suffix differences.
|
|
137
|
+
* On Windows, the binary is named "windows-bridge.exe"; on other platforms it's "windows-bridge".
|
|
138
|
+
*/
|
|
139
|
+
function windowsBinaryPath(crateDir, target) {
|
|
140
|
+
const releaseDir = target
|
|
141
|
+
? path.join(crateDir, "target", target, "release")
|
|
142
|
+
: path.join(crateDir, "target", "release");
|
|
143
|
+
return path.join(releaseDir, "windows-bridge.exe");
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
async function buildWindowsHelper(prebuiltOutput) {
|
|
147
|
+
const target = getArg("--target");
|
|
148
|
+
if (process.platform !== "win32" && !target?.includes("windows")) {
|
|
149
|
+
throw new Error("Refusing to label a host binary as Windows. Build on Windows or pass an explicit Windows --target triple.");
|
|
150
|
+
}
|
|
151
|
+
const prebuiltDir = prebuiltOutput
|
|
152
|
+
? path.resolve(process.cwd(), prebuiltOutput, "..")
|
|
153
|
+
: path.join(rootDir, "prebuilt", "windows");
|
|
154
|
+
const manifestPath = path.join(windowsCrateDir, "Cargo.toml");
|
|
155
|
+
|
|
156
|
+
console.log("Building Windows helper with cargo...");
|
|
157
|
+
const cargoArgs = [
|
|
158
|
+
"build",
|
|
159
|
+
"--release",
|
|
160
|
+
"--manifest-path",
|
|
161
|
+
manifestPath,
|
|
162
|
+
];
|
|
163
|
+
if (target) cargoArgs.push("--target", target);
|
|
164
|
+
await run("cargo", cargoArgs);
|
|
165
|
+
|
|
166
|
+
await fs.mkdir(prebuiltDir, { recursive: true });
|
|
167
|
+
|
|
168
|
+
const cargoOutput = windowsBinaryPath(windowsCrateDir, target);
|
|
169
|
+
const handle = await fs.open(cargoOutput, "r");
|
|
170
|
+
try {
|
|
171
|
+
const signature = Buffer.alloc(2);
|
|
172
|
+
await handle.read(signature, 0, 2, 0);
|
|
173
|
+
if (signature.toString("ascii") !== "MZ") {
|
|
174
|
+
throw new Error(`Cargo output is not a Windows PE executable: ${cargoOutput}`);
|
|
175
|
+
}
|
|
176
|
+
} finally {
|
|
177
|
+
await handle.close();
|
|
178
|
+
}
|
|
179
|
+
const prebuiltDest = path.join(prebuiltDir, "windows-bridge.exe");
|
|
180
|
+
await fs.copyFile(cargoOutput, prebuiltDest);
|
|
181
|
+
await fs.chmod(prebuiltDest, 0o755);
|
|
182
|
+
console.log(`Built Windows helper at ${prebuiltDest}`);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function linuxBinaryPath(crateDir, target) {
|
|
186
|
+
const targetDir = target ? path.join("target", target) : "target";
|
|
187
|
+
return path.join(crateDir, targetDir, "release", "linux-bridge");
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function defaultLinuxOutputPath(arch) {
|
|
191
|
+
return path.join(rootDir, "prebuilt", "linux", arch, "linux-bridge");
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
async function buildLinuxForArch(arch, outputPath) {
|
|
195
|
+
const explicitTarget = getArg("--target");
|
|
196
|
+
if (explicitTarget && !explicitTarget.includes("linux")) throw new Error(`Linux builds require a Linux --target triple, got ${explicitTarget}.`);
|
|
197
|
+
const target = explicitTarget ?? (process.platform === "linux" && process.arch === arch ? undefined : linuxTargets[arch]);
|
|
198
|
+
console.log(`Building Linux helper for ${arch} with cargo...`);
|
|
199
|
+
const cargoArgs = ["build", "--release", "--manifest-path", path.join(linuxCrateDir, "Cargo.toml")];
|
|
200
|
+
if (target) cargoArgs.push("--target", target);
|
|
201
|
+
await run("cargo", cargoArgs);
|
|
202
|
+
const cargoOutput = linuxBinaryPath(linuxCrateDir, target);
|
|
203
|
+
const header = await fs.readFile(cargoOutput).then((data) => data.subarray(0, 20));
|
|
204
|
+
if (header.length < 20 || !header.subarray(0, 4).equals(Buffer.from([0x7f, 0x45, 0x4c, 0x46]))) throw new Error(`Cargo output is not a Linux ELF executable: ${cargoOutput}`);
|
|
205
|
+
const machine = header.readUInt16LE(18);
|
|
206
|
+
const expectedMachine = arch === "x64" ? 0x3e : 0xb7;
|
|
207
|
+
if (machine !== expectedMachine) throw new Error(`Cargo output architecture does not match ${arch}: ${cargoOutput}`);
|
|
208
|
+
await fs.mkdir(path.dirname(outputPath), { recursive: true });
|
|
209
|
+
await fs.copyFile(cargoOutput, outputPath);
|
|
210
|
+
await fs.chmod(outputPath, 0o755);
|
|
211
|
+
console.log(`Built Linux helper at ${outputPath}`);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
async function buildLinuxHelper() {
|
|
215
|
+
const arch = normalizeArch(getArg("--arch") ?? process.arch);
|
|
216
|
+
if (arch === "universal") throw new Error("Linux does not support --arch universal. Use x64, arm64, or all.");
|
|
217
|
+
const outputArg = getArg("--output");
|
|
218
|
+
if (arch === "all") {
|
|
219
|
+
if (outputArg) throw new Error("--output is not supported with --arch all. Use a single architecture for one output.");
|
|
220
|
+
for (const nextArch of ["x64", "arm64"]) await buildLinuxForArch(nextArch, defaultLinuxOutputPath(nextArch));
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
await buildLinuxForArch(arch, outputArg ? path.resolve(process.cwd(), outputArg) : defaultLinuxOutputPath(arch));
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
async function main() {
|
|
227
|
+
const explicitPlatform = getArg("--platform");
|
|
228
|
+
|
|
229
|
+
if (explicitPlatform === "windows") {
|
|
230
|
+
await buildWindowsHelper(getArg("--output"));
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
if (explicitPlatform === "linux") {
|
|
235
|
+
await buildLinuxHelper();
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
if (explicitPlatform === "darwin") {
|
|
240
|
+
// Fall through to macOS build logic below.
|
|
241
|
+
} else if (process.platform === "win32") {
|
|
242
|
+
await buildWindowsHelper(getArg("--output"));
|
|
243
|
+
return;
|
|
244
|
+
} else if (process.platform === "linux") {
|
|
245
|
+
await buildLinuxHelper();
|
|
246
|
+
return;
|
|
247
|
+
} else if (process.platform !== "darwin") {
|
|
248
|
+
console.log(
|
|
249
|
+
`Skipping native build: unsupported platform "${process.platform}". ` +
|
|
250
|
+
"Use --platform windows or --platform linux to build a helper, or run on macOS for the macOS helper.",
|
|
251
|
+
);
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
const arch = normalizeArch(getArg("--arch") ?? process.arch);
|
|
256
|
+
const outputArg = getArg("--output");
|
|
257
|
+
|
|
258
|
+
if (arch === "all") {
|
|
259
|
+
if (outputArg) {
|
|
260
|
+
throw new Error("--output is not supported with --arch all. Use a single architecture for one output.");
|
|
261
|
+
}
|
|
262
|
+
for (const nextArch of ["x64", "arm64"]) {
|
|
263
|
+
await buildForArch(nextArch, defaultOutputPath(nextArch));
|
|
264
|
+
}
|
|
265
|
+
await refreshRoamBridgeSet();
|
|
266
|
+
console.log("Refreshed roam/bridge from the fresh builds.");
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
const outputPath = outputArg ? path.resolve(process.cwd(), outputArg) : defaultOutputPath(arch);
|
|
271
|
+
if (arch === "universal") {
|
|
272
|
+
await buildUniversal(outputPath);
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
await buildForArch(arch, outputPath);
|
|
277
|
+
if (!outputArg && arch !== "universal") {
|
|
278
|
+
await refreshRoamBridgeSet({ arches: [arch] });
|
|
279
|
+
console.log(`Refreshed roam/bridge for ${arch}.`);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
main().catch((error) => {
|
|
284
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
285
|
+
process.exit(1);
|
|
286
|
+
});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The fork-owned set of macOS helper binaries shipped from `roam/bridge/`.
|
|
3
|
+
*
|
|
4
|
+
* Upstream tracks its own builds under `prebuilt/macos/<arch>/bridge`, which is
|
|
5
|
+
* replaced wholesale whenever upstream ships a release. The fork keeps a second,
|
|
6
|
+
* rename-consistent set under `roam/bridge/` so an upstream sync cannot silently
|
|
7
|
+
* reinstate upstream artifacts, and so installs resolve a helper the fork owns.
|
|
8
|
+
*
|
|
9
|
+
* `roam/bridge/manifest.json` records the protocol version and a SHA-256 per
|
|
10
|
+
* artifact; `npm run test:bridge-set` fails if an artifact drifts from its
|
|
11
|
+
* manifest, from its architecture, or from the protocol the extension requires.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { createHash } from "node:crypto";
|
|
15
|
+
import fs from "node:fs/promises";
|
|
16
|
+
import path from "node:path";
|
|
17
|
+
import { fileURLToPath } from "node:url";
|
|
18
|
+
|
|
19
|
+
import { ROAM_BRIDGE_PLATFORM, ROAM_PACKAGE_NAME } from "../../roam/identity.mjs";
|
|
20
|
+
|
|
21
|
+
export const rootDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
|
|
22
|
+
export const ROAM_BRIDGE_DIR = path.join(rootDir, "roam", "bridge");
|
|
23
|
+
export const ROAM_BRIDGE_MANIFEST = path.join(ROAM_BRIDGE_DIR, "manifest.json");
|
|
24
|
+
|
|
25
|
+
export const PLATFORM = ROAM_BRIDGE_PLATFORM;
|
|
26
|
+
export const ARCHES = ["arm64", "x64"];
|
|
27
|
+
|
|
28
|
+
/** Where the fork ships a helper binary for `arch`. */
|
|
29
|
+
export function roamBridgePathForArch(arch) {
|
|
30
|
+
return path.join(ROAM_BRIDGE_DIR, PLATFORM, arch, "bridge");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Where upstream ships a helper binary for `arch`. */
|
|
34
|
+
export function upstreamBridgePathForArch(arch) {
|
|
35
|
+
return path.join(rootDir, "prebuilt", PLATFORM, arch, "bridge");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Protocol version the extension requires, read from the overlay that owns the
|
|
40
|
+
* repair policy. The overlay is TypeScript, so this parses rather than imports.
|
|
41
|
+
*/
|
|
42
|
+
export async function helperProtocolVersion() {
|
|
43
|
+
const source = await fs.readFile(path.join(rootDir, "roam", "repair.ts"), "utf8");
|
|
44
|
+
const match = /export const ROAM_HELPER_PROTOCOL_VERSION\s*=\s*(\d+)\s*;/.exec(source);
|
|
45
|
+
if (!match) throw new Error("roam/repair.ts does not declare ROAM_HELPER_PROTOCOL_VERSION");
|
|
46
|
+
return Number(match[1]);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export async function sha256File(file) {
|
|
50
|
+
const hash = createHash("sha256");
|
|
51
|
+
hash.update(await fs.readFile(file));
|
|
52
|
+
return hash.digest("hex");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Copy each architecture's fresh build from `prebuilt/` into `roam/bridge/` and
|
|
57
|
+
* rewrite the manifest. Returns the manifest that was written.
|
|
58
|
+
*/
|
|
59
|
+
export async function refreshRoamBridgeSet({ arches = ARCHES, source = "prebuilt" } = {}) {
|
|
60
|
+
const protocolVersion = await helperProtocolVersion();
|
|
61
|
+
let previous = [];
|
|
62
|
+
try {
|
|
63
|
+
previous = (await readRoamBridgeManifest()).artifacts ?? [];
|
|
64
|
+
} catch {
|
|
65
|
+
previous = [];
|
|
66
|
+
}
|
|
67
|
+
const artifacts = previous.filter((artifact) => !arches.includes(artifact.arch));
|
|
68
|
+
|
|
69
|
+
for (const arch of arches) {
|
|
70
|
+
const from = source === "prebuilt" ? upstreamBridgePathForArch(arch) : source[arch];
|
|
71
|
+
const to = roamBridgePathForArch(arch);
|
|
72
|
+
await fs.mkdir(path.dirname(to), { recursive: true });
|
|
73
|
+
await fs.copyFile(from, to);
|
|
74
|
+
await fs.chmod(to, 0o755);
|
|
75
|
+
const bytes = (await fs.stat(to)).size;
|
|
76
|
+
artifacts.push({
|
|
77
|
+
path: `${PLATFORM}/${arch}/bridge`,
|
|
78
|
+
arch,
|
|
79
|
+
bytes,
|
|
80
|
+
sha256: await sha256File(to),
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
artifacts.sort((a, b) => ARCHES.indexOf(a.arch) - ARCHES.indexOf(b.arch));
|
|
85
|
+
const manifest = {
|
|
86
|
+
generatedBy: "scripts/refresh-roam-bridge.mjs",
|
|
87
|
+
packageName: ROAM_PACKAGE_NAME,
|
|
88
|
+
source: "native/macos/bridge.swift",
|
|
89
|
+
protocolVersion,
|
|
90
|
+
artifacts,
|
|
91
|
+
};
|
|
92
|
+
await fs.writeFile(ROAM_BRIDGE_MANIFEST, `${JSON.stringify(manifest, null, "\t")}\n`);
|
|
93
|
+
return manifest;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export async function readRoamBridgeManifest() {
|
|
97
|
+
return JSON.parse(await fs.readFile(ROAM_BRIDGE_MANIFEST, "utf8"));
|
|
98
|
+
}
|