diff --git a/apps/desktop/launcher/tron-node.mjs b/apps/desktop/launcher/tron-node.mjs new file mode 100644 index 0000000..06d56e0 --- /dev/null +++ b/apps/desktop/launcher/tron-node.mjs @@ -0,0 +1,26 @@ +// Generic launcher for shipped Node bins that import @tronbrowser/* packages by +// bare specifier (e.g. analyze-bin -> @tronbrowser/browser-core). Registers the +// resolver hook that maps those specifiers to the sibling dist trees in the +// launcher payload, then runs the target entry. +// +// node tron-node.mjs [args...] +import { register } from 'node:module'; +import { dirname, join } from 'node:path'; +import { fileURLToPath, pathToFileURL } from 'node:url'; + +const here = dirname(fileURLToPath(import.meta.url)); +register(pathToFileURL(join(here, 'tron-run-hooks.mjs')), import.meta.url, { + data: { + '@tronbrowser/browser-core': pathToFileURL(join(here, 'automate', 'index.js')).href, + '@tronbrowser/agent-runtime': pathToFileURL(join(here, 'analyze', 'index.js')).href, + '@tronbrowser/sdk': pathToFileURL(join(here, 'sdk', 'index.js')).href, + }, +}); + +const entry = process.argv[2]; +if (!entry) { + process.stderr.write('tron-node: missing entry\n'); + process.exit(2); +} +process.argv = [process.argv[0], entry, ...process.argv.slice(3)]; +await import(pathToFileURL(entry).href); diff --git a/apps/desktop/launcher/tron-run.mjs b/apps/desktop/launcher/tron-run.mjs index 4111e3e..4c0bd9f 100644 --- a/apps/desktop/launcher/tron-run.mjs +++ b/apps/desktop/launcher/tron-run.mjs @@ -10,6 +10,7 @@ import { fileURLToPath, pathToFileURL } from 'node:url'; const here = dirname(fileURLToPath(import.meta.url)); const sdkEntry = join(here, 'sdk', 'index.js'); const coreEntry = join(here, 'automate', 'index.js'); +const agentEntry = join(here, 'analyze', 'index.js'); const argv = process.argv.slice(2); let script; @@ -43,6 +44,7 @@ register(pathToFileURL(join(here, 'tron-run-hooks.mjs')), import.meta.url, { data: { '@tronbrowser/sdk': pathToFileURL(sdkEntry).href, '@tronbrowser/browser-core': pathToFileURL(coreEntry).href, + '@tronbrowser/agent-runtime': pathToFileURL(agentEntry).href, }, }); diff --git a/apps/desktop/scripts/build-release.sh b/apps/desktop/scripts/build-release.sh index b8a1304..98a50f1 100755 --- a/apps/desktop/scripts/build-release.sh +++ b/apps/desktop/scripts/build-release.sh @@ -61,15 +61,17 @@ stage_automation() { # dest dir local s="$1" command -v node >/dev/null 2>&1 && command -v pnpm >/dev/null 2>&1 || { echo " ! automation runtime skipped (needs node + pnpm)"; return; } - if ( cd "$REPO_ROOT" && pnpm --filter @tronbrowser/browser-core --filter @tronbrowser/sdk build >/dev/null 2>&1 ); then - rm -rf "$s/automate" "$s/sdk" + if ( cd "$REPO_ROOT" && pnpm --filter @tronbrowser/browser-core --filter @tronbrowser/agent-runtime --filter @tronbrowser/sdk build >/dev/null 2>&1 ); then + rm -rf "$s/automate" "$s/analyze" "$s/sdk" cp -R "$REPO_ROOT/packages/browser-core/dist" "$s/automate" printf '{\n "type": "module"\n}\n' > "$s/automate/package.json" + cp -R "$REPO_ROOT/packages/agent-runtime/dist" "$s/analyze" + printf '{\n "type": "module"\n}\n' > "$s/analyze/package.json" cp -R "$REPO_ROOT/packages/sdk/dist" "$s/sdk" printf '{\n "type": "module"\n}\n' > "$s/sdk/package.json" - echo " + bundled automation runtime + SDK (tron snapshot/extract/run)" + echo " + bundled automation + analyze + SDK (tron snapshot/extract/analyze/run)" else - echo " ! automation runtime skipped (browser-core/sdk build failed)" + echo " ! automation runtime skipped (browser-core/agent-runtime/sdk build failed)" fi } @@ -84,9 +86,11 @@ stage() { # dest dir # Managed-session engine for `tron browser …` / `tron open` (PRD M3.1). Sits # next to the shim; the `tron` dispatcher resolves it relative to $CURRENT. install -m 0755 "$DESKTOP/launcher/tron-session" "$s/tron-session" - # `tron run` launcher + ESM resolver hook (PRD M3.4). + # `tron run` launcher + ESM resolver hook (PRD M3.4) and the generic bin + # launcher used by `tron analyze` (PRD M3.5). install -m 0644 "$DESKTOP/launcher/tron-run.mjs" "$s/tron-run.mjs" install -m 0644 "$DESKTOP/launcher/tron-run-hooks.mjs" "$s/tron-run-hooks.mjs" + install -m 0644 "$DESKTOP/launcher/tron-node.mjs" "$s/tron-node.mjs" stage_automation "$s" # -L dereferences the branding symlinks (icons/logo.svg -> repo-root logo.svg) # so the package contains real files, not dangling links. diff --git a/apps/web/public/install.sh b/apps/web/public/install.sh index 94945fa..ecf2d94 100755 --- a/apps/web/public/install.sh +++ b/apps/web/public/install.sh @@ -91,6 +91,7 @@ Usage: tron screenshot

Save a PNG of the current page (--full-page) tron headless One-shot: --snapshot | --screenshot

| --extract tron run