ponzu 1.62.0 → 1.64.0
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/dist/index.js
CHANGED
|
@@ -46860,7 +46860,7 @@ function remoteUpdater(endpoint, token) {
|
|
|
46860
46860
|
// apps/cli/package.json
|
|
46861
46861
|
var package_default = {
|
|
46862
46862
|
name: "ponzu",
|
|
46863
|
-
version: "1.
|
|
46863
|
+
version: "1.64.0",
|
|
46864
46864
|
description: "The open source canvas your agent draws on in HTML and CSS.",
|
|
46865
46865
|
type: "module",
|
|
46866
46866
|
license: "MIT",
|
|
@@ -46883,10 +46883,10 @@ var package_default = {
|
|
|
46883
46883
|
|
|
46884
46884
|
// apps/cli/src/host.ts
|
|
46885
46885
|
import { spawn as spawn5 } from "child_process";
|
|
46886
|
-
import { existsSync as existsSync9, readFileSync as readFileSync2 } from "fs";
|
|
46887
|
-
import { chmod, mkdir as mkdir10, rm as rm4, writeFile as writeFile8 } from "fs/promises";
|
|
46886
|
+
import { existsSync as existsSync9, readFileSync as readFileSync2, statSync as statSync3 } from "fs";
|
|
46887
|
+
import { chmod, copyFile, mkdir as mkdir10, rename as rename8, rm as rm4, utimes as utimes3, writeFile as writeFile8 } from "fs/promises";
|
|
46888
46888
|
import { homedir as homedir4 } from "os";
|
|
46889
|
-
import { dirname as dirname5, join as join13 } from "path";
|
|
46889
|
+
import { dirname as dirname5, join as join13, posix, win32 } from "path";
|
|
46890
46890
|
var ponzuHome = () => process.env.PONZU_HOME ?? join13(homedir4(), ".ponzu");
|
|
46891
46891
|
var hostFile = () => join13(ponzuHome(), "host.json");
|
|
46892
46892
|
async function announceHost(url, opts = {}) {
|
|
@@ -46922,26 +46922,103 @@ async function runningHost() {
|
|
|
46922
46922
|
}
|
|
46923
46923
|
}
|
|
46924
46924
|
var SERVER = "Contents/Resources/server/ponzu";
|
|
46925
|
-
|
|
46926
|
-
|
|
46927
|
-
|
|
46925
|
+
var pathFor = (os) => os === "win32" ? win32 : posix;
|
|
46926
|
+
var appImageServer = () => join13(ponzuHome(), "app/ponzu");
|
|
46927
|
+
var appImageRecord = () => join13(ponzuHome(), "app/appimage");
|
|
46928
|
+
function recordedAppImage() {
|
|
46929
|
+
try {
|
|
46930
|
+
const path = readFileSync2(appImageRecord(), "utf8").trim();
|
|
46931
|
+
return path && existsSync9(path) ? path : null;
|
|
46932
|
+
} catch {
|
|
46928
46933
|
return null;
|
|
46929
|
-
|
|
46934
|
+
}
|
|
46935
|
+
}
|
|
46936
|
+
function isFolder(app) {
|
|
46937
|
+
try {
|
|
46938
|
+
return statSync3(app).isDirectory() && !app.endsWith(".app");
|
|
46939
|
+
} catch {
|
|
46940
|
+
return false;
|
|
46941
|
+
}
|
|
46942
|
+
}
|
|
46943
|
+
function appServer(app, os = process.platform) {
|
|
46944
|
+
if (os === "darwin")
|
|
46945
|
+
return join13(app, SERVER);
|
|
46946
|
+
const path = pathFor(os);
|
|
46947
|
+
if (os === "linux" && !isFolder(app))
|
|
46948
|
+
return appImageServer();
|
|
46949
|
+
return path.join(app, "resources", "server", os === "win32" ? "ponzu.exe" : "ponzu");
|
|
46950
|
+
}
|
|
46951
|
+
function appLauncher(app, os = process.platform) {
|
|
46952
|
+
if (app.endsWith(".app"))
|
|
46953
|
+
return ["open", ["-n", "-g", "-a", app, "--args", "--background"]];
|
|
46954
|
+
if (isFolder(app))
|
|
46955
|
+
return [pathFor(os).join(app, os === "win32" ? "Ponzu.exe" : "ponzu"), ["--background"]];
|
|
46956
|
+
return [app, ["--background"]];
|
|
46957
|
+
}
|
|
46958
|
+
function ownBundle(execPath = process.execPath, os = process.platform, env = process.env) {
|
|
46959
|
+
if (os === "darwin") {
|
|
46960
|
+
const app = /^(.*?\.app)\/Contents\/Resources\/server\/ponzu$/.exec(execPath)?.[1];
|
|
46961
|
+
if (!app || app.startsWith("/Volumes/") || app.includes("/AppTranslocation/"))
|
|
46962
|
+
return null;
|
|
46963
|
+
return app;
|
|
46964
|
+
}
|
|
46965
|
+
if (os === "win32")
|
|
46966
|
+
return /^(.*)\\resources\\server\\ponzu\.exe$/i.exec(execPath)?.[1] ?? null;
|
|
46967
|
+
if (execPath === appImageServer())
|
|
46968
|
+
return recordedAppImage();
|
|
46969
|
+
const folder = /^(.*)\/resources\/server\/ponzu$/.exec(execPath)?.[1];
|
|
46970
|
+
if (!folder)
|
|
46971
|
+
return null;
|
|
46972
|
+
if (env.APPIMAGE && (folder === env.APPDIR || folder.startsWith("/tmp/.mount_")))
|
|
46973
|
+
return env.APPIMAGE;
|
|
46974
|
+
return folder.startsWith("/tmp/.mount_") ? null : folder;
|
|
46975
|
+
}
|
|
46976
|
+
function installedApps(os = process.platform, env = process.env) {
|
|
46977
|
+
if (os === "darwin")
|
|
46978
|
+
return ["/Applications/Ponzu.app", join13(homedir4(), "Applications/Ponzu.app")];
|
|
46979
|
+
if (os === "win32") {
|
|
46980
|
+
return [
|
|
46981
|
+
env.LOCALAPPDATA && win32.join(env.LOCALAPPDATA, "Programs", "ponzu"),
|
|
46982
|
+
env.ProgramFiles && win32.join(env.ProgramFiles, "Ponzu")
|
|
46983
|
+
].filter((p) => Boolean(p));
|
|
46984
|
+
}
|
|
46985
|
+
return [recordedAppImage(), "/opt/Ponzu"].filter((p) => Boolean(p));
|
|
46930
46986
|
}
|
|
46931
|
-
function
|
|
46932
|
-
|
|
46987
|
+
function isInstalled(app, os = process.platform) {
|
|
46988
|
+
if (os === "linux" && !isFolder(app))
|
|
46989
|
+
return existsSync9(app);
|
|
46990
|
+
return existsSync9(appServer(app, os));
|
|
46991
|
+
}
|
|
46992
|
+
function findApp(os = process.platform, env = process.env, execPath = process.execPath) {
|
|
46993
|
+
const override = env.PONZU_APP;
|
|
46933
46994
|
if (override === "none")
|
|
46934
46995
|
return null;
|
|
46935
46996
|
if (override)
|
|
46936
46997
|
return override;
|
|
46937
|
-
|
|
46998
|
+
const candidates = [ownBundle(execPath, os, env), ...installedApps(os, env)];
|
|
46999
|
+
return candidates.find((c) => Boolean(c && isInstalled(c, os))) ?? null;
|
|
47000
|
+
}
|
|
47001
|
+
async function adoptAppImage(execPath = process.execPath, os = process.platform, env = process.env) {
|
|
47002
|
+
if (os !== "linux")
|
|
46938
47003
|
return null;
|
|
46939
|
-
const
|
|
46940
|
-
|
|
46941
|
-
|
|
46942
|
-
|
|
46943
|
-
|
|
46944
|
-
|
|
47004
|
+
const appimage = ownBundle(execPath, os, env);
|
|
47005
|
+
if (!appimage || isFolder(appimage) || execPath === appImageServer())
|
|
47006
|
+
return null;
|
|
47007
|
+
const copy = appImageServer();
|
|
47008
|
+
const from = statSync3(execPath);
|
|
47009
|
+
const to = statSync3(copy, { throwIfNoEntry: false });
|
|
47010
|
+
if (!to || to.size !== from.size || Math.trunc(to.mtimeMs) !== Math.trunc(from.mtimeMs)) {
|
|
47011
|
+
await mkdir10(dirname5(copy), { recursive: true });
|
|
47012
|
+
const temp = `${copy}.${process.pid}`;
|
|
47013
|
+
await copyFile(execPath, temp);
|
|
47014
|
+
await chmod(temp, 493);
|
|
47015
|
+
await utimes3(temp, from.atime, from.mtime);
|
|
47016
|
+
await rename8(temp, copy);
|
|
47017
|
+
}
|
|
47018
|
+
if (recordedAppImage() !== appimage)
|
|
47019
|
+
await writeFile8(appImageRecord(), `${appimage}
|
|
47020
|
+
`);
|
|
47021
|
+
return appimage;
|
|
46945
47022
|
}
|
|
46946
47023
|
async function launchApp(app, timeoutMs = 30000) {
|
|
46947
47024
|
const deadline = Date.now() + timeoutMs;
|
|
@@ -46958,7 +47035,7 @@ async function launchApp(app, timeoutMs = 30000) {
|
|
|
46958
47035
|
function startApp(app) {
|
|
46959
47036
|
const env = { ...process.env };
|
|
46960
47037
|
delete env.ELECTRON_RUN_AS_NODE;
|
|
46961
|
-
const [cmd, args] =
|
|
47038
|
+
const [cmd, args] = appLauncher(app);
|
|
46962
47039
|
return new Promise((resolve) => {
|
|
46963
47040
|
try {
|
|
46964
47041
|
const child = spawn5(cmd, args, { detached: true, stdio: "ignore", env });
|
|
@@ -46989,11 +47066,31 @@ async function findHost(launch) {
|
|
|
46989
47066
|
lastFailed = Date.now();
|
|
46990
47067
|
return url;
|
|
46991
47068
|
}
|
|
46992
|
-
var shimPath = () => join13(ponzuHome(), "bin/ponzu");
|
|
46993
|
-
|
|
46994
|
-
|
|
47069
|
+
var shimPath = (os = process.platform) => join13(ponzuHome(), os === "win32" ? "bin/ponzu.cmd" : "bin/ponzu");
|
|
47070
|
+
function shimScript(app, os = process.platform) {
|
|
47071
|
+
if (os === "win32") {
|
|
47072
|
+
const candidates = [
|
|
47073
|
+
appServer(app, os),
|
|
47074
|
+
"%LOCALAPPDATA%\\Programs\\ponzu\\resources\\server\\ponzu.exe",
|
|
47075
|
+
"%ProgramFiles%\\Ponzu\\resources\\server\\ponzu.exe"
|
|
47076
|
+
];
|
|
47077
|
+
return `@echo off\r
|
|
47078
|
+
rem Written by Ponzu. Runs the server inside the installed Ponzu, so it updates with the app.\r
|
|
47079
|
+
setlocal\r
|
|
47080
|
+
${candidates.map((c) => `if exist "${c}" (\r
|
|
47081
|
+
set "bin=${c}"\r
|
|
47082
|
+
goto run\r
|
|
47083
|
+
)\r
|
|
47084
|
+
`).join("")}echo Ponzu isn't installed. Download it from https://ponzu.design 1>&2\r
|
|
47085
|
+
exit /b 1\r
|
|
47086
|
+
:run\r
|
|
47087
|
+
"%bin%" %*\r
|
|
47088
|
+
exit /b %ERRORLEVEL%\r
|
|
47089
|
+
`;
|
|
47090
|
+
}
|
|
46995
47091
|
const quote = (s) => `'${s.replace(/'/g, `'\\''`)}'`;
|
|
46996
|
-
|
|
47092
|
+
if (os === "darwin")
|
|
47093
|
+
return `#!/bin/sh
|
|
46997
47094
|
# Written by Ponzu. Runs the server inside the installed Ponzu.app, so it updates with the app.
|
|
46998
47095
|
for app in ${quote(app)} /Applications/Ponzu.app "$HOME/Applications/Ponzu.app"; do
|
|
46999
47096
|
bin="$app/${SERVER}"
|
|
@@ -47002,20 +47099,33 @@ done
|
|
|
47002
47099
|
echo "Ponzu isn't installed. Download it from https://ponzu.design" >&2
|
|
47003
47100
|
exit 1
|
|
47004
47101
|
`;
|
|
47102
|
+
const bins = new Set([appServer(app, os), "/opt/Ponzu/resources/server/ponzu", appImageServer()]);
|
|
47103
|
+
return `#!/bin/sh
|
|
47104
|
+
# Written by Ponzu. Runs the server inside the installed Ponzu, so it updates with the app.
|
|
47105
|
+
for bin in ${[...bins].map(quote).join(" ")}; do
|
|
47106
|
+
[ -x "$bin" ] && exec "$bin" "$@"
|
|
47107
|
+
done
|
|
47108
|
+
echo "Ponzu isn't installed. Download it from https://ponzu.design" >&2
|
|
47109
|
+
exit 1
|
|
47110
|
+
`;
|
|
47111
|
+
}
|
|
47112
|
+
async function writeShim(app) {
|
|
47113
|
+
const path = shimPath();
|
|
47005
47114
|
await mkdir10(dirname5(path), { recursive: true });
|
|
47006
|
-
await writeFile8(path,
|
|
47115
|
+
await writeFile8(path, shimScript(app));
|
|
47007
47116
|
await chmod(path, 493);
|
|
47008
47117
|
return path;
|
|
47009
47118
|
}
|
|
47010
47119
|
|
|
47011
47120
|
// apps/cli/src/install.ts
|
|
47012
|
-
import { spawnSync } from "child_process";
|
|
47121
|
+
import { spawnSync as spawnSync2 } from "child_process";
|
|
47013
47122
|
import { existsSync as existsSync11, readFileSync as readFileSync4 } from "fs";
|
|
47014
47123
|
import { mkdir as mkdir12, writeFile as writeFile10 } from "fs/promises";
|
|
47015
47124
|
import { homedir as homedir6 } from "os";
|
|
47016
47125
|
import { delimiter as delimiter2, dirname as dirname7, join as join15 } from "path";
|
|
47017
47126
|
|
|
47018
47127
|
// apps/cli/src/command.ts
|
|
47128
|
+
import { spawnSync } from "child_process";
|
|
47019
47129
|
import { accessSync, constants, existsSync as existsSync10, lstatSync, readFileSync as readFileSync3, realpathSync as realpathSync3 } from "fs";
|
|
47020
47130
|
import { mkdir as mkdir11, symlink, writeFile as writeFile9 } from "fs/promises";
|
|
47021
47131
|
import { homedir as homedir5 } from "os";
|
|
@@ -47029,8 +47139,11 @@ async function linkCommand(shim, opts) {
|
|
|
47029
47139
|
if (!opts.auto)
|
|
47030
47140
|
console.log(s);
|
|
47031
47141
|
};
|
|
47142
|
+
if (process.platform === "win32")
|
|
47143
|
+
return addToUserPath(dirname6(shim), opts.auto, say);
|
|
47032
47144
|
const found = Bun.which("ponzu", { PATH: opts.path.join(delimiter) });
|
|
47033
|
-
|
|
47145
|
+
const app = found && opensApp(found) ? found : null;
|
|
47146
|
+
if (found && !app) {
|
|
47034
47147
|
if (sameFile(found, shim))
|
|
47035
47148
|
say(`The ponzu command is on your PATH: ${found}`);
|
|
47036
47149
|
return;
|
|
@@ -47038,9 +47151,13 @@ async function linkCommand(shim, opts) {
|
|
|
47038
47151
|
const state = readState();
|
|
47039
47152
|
if (opts.auto && state.linked)
|
|
47040
47153
|
return;
|
|
47041
|
-
const
|
|
47154
|
+
const before = app ? opts.path.indexOf(dirname6(app)) : -1;
|
|
47155
|
+
const dir = commandDirs(opts.home).find((d) => {
|
|
47156
|
+
const at = opts.path.indexOf(d);
|
|
47157
|
+
return at >= 0 && (before < 0 || at < before) && canLink(d, opts.home);
|
|
47158
|
+
});
|
|
47042
47159
|
if (!dir) {
|
|
47043
|
-
say(`To run ponzu from a terminal, add ${dirname6(shim)} to your PATH, or choose Install Terminal Command in Ponzu's app menu.`);
|
|
47160
|
+
say(process.platform === "darwin" ? `To run ponzu from a terminal, add ${dirname6(shim)} to your PATH, or choose Install Terminal Command in Ponzu's app menu.` : `To run ponzu from a terminal, add ${dirname6(shim)} to your PATH.`);
|
|
47044
47161
|
return;
|
|
47045
47162
|
}
|
|
47046
47163
|
const link = join14(dir, "ponzu");
|
|
@@ -47056,6 +47173,45 @@ async function linkCommand(shim, opts) {
|
|
|
47056
47173
|
`);
|
|
47057
47174
|
say(`Linked ${link}, so ponzu runs from a terminal.`);
|
|
47058
47175
|
}
|
|
47176
|
+
var USER_PATH = String.raw`
|
|
47177
|
+
$at = if ($env:PONZU_ENVIRONMENT_KEY) { $env:PONZU_ENVIRONMENT_KEY } else { 'HKCU:\Environment' }
|
|
47178
|
+
$key = Get-Item -LiteralPath $at
|
|
47179
|
+
$norm = { param($p) $p.Trim().TrimEnd('\', '/') }
|
|
47180
|
+
$entries = @(([string]$key.GetValue('Path', '', 'DoNotExpandEnvironmentNames')) -split ';' | Where-Object { $_.Trim() })
|
|
47181
|
+
if ($entries | Where-Object { (& $norm $_) -ieq (& $norm $env:PONZU_BIN) }) { exit 0 }
|
|
47182
|
+
if (-not $env:PONZU_ADD) { exit 3 }
|
|
47183
|
+
$kind = if ($key.GetValueNames() -contains 'Path') { $key.GetValueKind('Path') } else { 'ExpandString' }
|
|
47184
|
+
Set-ItemProperty -LiteralPath $at -Name Path -Value (($entries + $env:PONZU_BIN) -join ';') -Type $kind
|
|
47185
|
+
if (-not $env:PONZU_ENVIRONMENT_KEY) {
|
|
47186
|
+
[Environment]::SetEnvironmentVariable('PONZU_PATH_CHANGED', '1', 'User')
|
|
47187
|
+
[Environment]::SetEnvironmentVariable('PONZU_PATH_CHANGED', $null, 'User')
|
|
47188
|
+
}
|
|
47189
|
+
exit 2
|
|
47190
|
+
`;
|
|
47191
|
+
function userPath(dir, add, env = {}) {
|
|
47192
|
+
const out = spawnSync("powershell.exe", ["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-Command", USER_PATH], {
|
|
47193
|
+
stdio: "ignore",
|
|
47194
|
+
timeout: 15000,
|
|
47195
|
+
env: { ...process.env, ...env, PONZU_BIN: dir, ...add ? { PONZU_ADD: "1" } : {} },
|
|
47196
|
+
windowsHide: true
|
|
47197
|
+
});
|
|
47198
|
+
return { 0: "on", 3: "off", 2: "added" }[out.status ?? -1] ?? "failed";
|
|
47199
|
+
}
|
|
47200
|
+
async function addToUserPath(dir, auto, say) {
|
|
47201
|
+
const now = userPath(dir, false);
|
|
47202
|
+
if (now === "on")
|
|
47203
|
+
return say(`The ponzu command is on your PATH: ${dir}`);
|
|
47204
|
+
if (now === "failed")
|
|
47205
|
+
return say(`To run ponzu from a terminal, add ${dir} to your PATH.`);
|
|
47206
|
+
if (auto && readState().linked)
|
|
47207
|
+
return;
|
|
47208
|
+
if (userPath(dir, true) !== "added")
|
|
47209
|
+
return say(`Couldn't add ${dir} to your PATH. Add it yourself to run ponzu from a terminal.`);
|
|
47210
|
+
await mkdir11(dirname6(stateFile()), { recursive: true });
|
|
47211
|
+
await writeFile9(stateFile(), `${JSON.stringify({ linked: dir }, null, 2)}
|
|
47212
|
+
`);
|
|
47213
|
+
say(`Added ${dir} to your PATH. Open a new terminal and run ponzu.`);
|
|
47214
|
+
}
|
|
47059
47215
|
function readState() {
|
|
47060
47216
|
try {
|
|
47061
47217
|
return JSON.parse(readFileSync3(stateFile(), "utf8"));
|
|
@@ -47077,6 +47233,13 @@ function canLink(dir, home = homedir5()) {
|
|
|
47077
47233
|
return false;
|
|
47078
47234
|
}
|
|
47079
47235
|
}
|
|
47236
|
+
function opensApp(file) {
|
|
47237
|
+
try {
|
|
47238
|
+
return existsSync10(join14(dirname6(realpathSync3(file)), "resources/server/ponzu"));
|
|
47239
|
+
} catch {
|
|
47240
|
+
return false;
|
|
47241
|
+
}
|
|
47242
|
+
}
|
|
47080
47243
|
function sameFile(a, b) {
|
|
47081
47244
|
try {
|
|
47082
47245
|
return realpathSync3(a) === realpathSync3(b);
|
|
@@ -47181,14 +47344,15 @@ async function installAgent(agent, opts) {
|
|
|
47181
47344
|
Or launch \`ponzu mcp\` over stdio from any MCP client.`);
|
|
47182
47345
|
process.exit(1);
|
|
47183
47346
|
}
|
|
47184
|
-
const
|
|
47347
|
+
const launch = opts.url ? { entry: { url: opts.url } } : await launchEntry();
|
|
47348
|
+
const entry = launch?.entry;
|
|
47185
47349
|
if (!entry) {
|
|
47186
47350
|
if (!opts.auto)
|
|
47187
47351
|
console.error("Move Ponzu to your Applications folder, then try again.");
|
|
47188
47352
|
return;
|
|
47189
47353
|
}
|
|
47190
|
-
if (
|
|
47191
|
-
await linkCommand(
|
|
47354
|
+
if (launch.shim)
|
|
47355
|
+
await linkCommand(launch.shim, { auto: opts.auto, path: loginPath() });
|
|
47192
47356
|
const done = readDone();
|
|
47193
47357
|
const targets = AGENTS.filter((a) => id ? a.id === id : a.detect());
|
|
47194
47358
|
if (!targets.length && !opts.auto)
|
|
@@ -47234,16 +47398,21 @@ function codexConfigured() {
|
|
|
47234
47398
|
}
|
|
47235
47399
|
}
|
|
47236
47400
|
async function launchEntry() {
|
|
47401
|
+
await adoptAppImage().catch(() => null);
|
|
47237
47402
|
const app = findApp();
|
|
47238
|
-
|
|
47239
|
-
|
|
47403
|
+
const installed = process.platform === "darwin" ? app?.endsWith(".app") : app && app !== process.env.PONZU_APP;
|
|
47404
|
+
if (app && installed) {
|
|
47405
|
+
const shim = await writeShim(app);
|
|
47406
|
+
const command = process.platform === "win32" ? appServer(app) : shim;
|
|
47407
|
+
return { entry: { command, args: ["mcp"] }, shim };
|
|
47408
|
+
}
|
|
47240
47409
|
if (/\.app\/Contents\//.test(process.execPath))
|
|
47241
47410
|
return null;
|
|
47242
|
-
if (Bun.main.startsWith("/$bunfs/"))
|
|
47243
|
-
return { command: process.execPath, args: ["mcp"] };
|
|
47244
|
-
if (
|
|
47245
|
-
return { command: process.execPath, args: ["x", "ponzu", "mcp"] };
|
|
47246
|
-
return { command: process.execPath, args: [Bun.main, "mcp"] };
|
|
47411
|
+
if (Bun.main.startsWith("/$bunfs/") || Bun.main.startsWith("B:\\~BUN\\"))
|
|
47412
|
+
return { entry: { command: process.execPath, args: ["mcp"] } };
|
|
47413
|
+
if (/[\\/]bunx-[^\\/]+[\\/]/.test(Bun.main))
|
|
47414
|
+
return { entry: { command: process.execPath, args: ["x", "ponzu", "mcp"] } };
|
|
47415
|
+
return { entry: { command: process.execPath, args: [Bun.main, "mcp"] } };
|
|
47247
47416
|
}
|
|
47248
47417
|
function toEntry(raw) {
|
|
47249
47418
|
if (raw?.command)
|
|
@@ -47312,7 +47481,7 @@ function loginPath() {
|
|
|
47312
47481
|
shellPath = [];
|
|
47313
47482
|
const shell = process.env.SHELL;
|
|
47314
47483
|
if (shell) {
|
|
47315
|
-
const login =
|
|
47484
|
+
const login = spawnSync2(shell, ["-ilc", 'printf %s "$PATH"'], {
|
|
47316
47485
|
encoding: "utf8",
|
|
47317
47486
|
timeout: 3000
|
|
47318
47487
|
});
|
|
@@ -47329,7 +47498,7 @@ function capture2(cmd) {
|
|
|
47329
47498
|
const bin = which(cmd[0]);
|
|
47330
47499
|
if (!bin)
|
|
47331
47500
|
return null;
|
|
47332
|
-
const out =
|
|
47501
|
+
const out = spawnSync2(bin, cmd.slice(1), {
|
|
47333
47502
|
encoding: "utf8",
|
|
47334
47503
|
timeout: 15000,
|
|
47335
47504
|
env: { ...process.env, PATH: agentPath() }
|
|
@@ -47340,7 +47509,7 @@ function run(cmd, quiet = false) {
|
|
|
47340
47509
|
const bin = which(cmd[0]);
|
|
47341
47510
|
if (!bin)
|
|
47342
47511
|
return false;
|
|
47343
|
-
const out =
|
|
47512
|
+
const out = spawnSync2(bin, cmd.slice(1), {
|
|
47344
47513
|
stdio: quiet ? "ignore" : "inherit",
|
|
47345
47514
|
timeout: 30000,
|
|
47346
47515
|
env: { ...process.env, PATH: agentPath() }
|
|
@@ -47396,12 +47565,12 @@ function firstFree(ports, hostname) {
|
|
|
47396
47565
|
// apps/cli/src/telemetry.ts
|
|
47397
47566
|
import { createHash as createHash6, randomUUID } from "crypto";
|
|
47398
47567
|
import { readFileSync as readFileSync5 } from "fs";
|
|
47399
|
-
import { mkdir as mkdir13, rename as
|
|
47568
|
+
import { mkdir as mkdir13, rename as rename9, writeFile as writeFile11 } from "fs/promises";
|
|
47400
47569
|
import { arch, platform as platform2 } from "os";
|
|
47401
47570
|
import { dirname as dirname10, join as join17 } from "path";
|
|
47402
47571
|
|
|
47403
47572
|
// node_modules/.bun/posthog-node@5.56.2/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
47404
|
-
import { dirname as dirname9, posix, sep as sep5 } from "path";
|
|
47573
|
+
import { dirname as dirname9, posix as posix2, sep as sep5 } from "path";
|
|
47405
47574
|
function createModulerModifier() {
|
|
47406
47575
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
47407
47576
|
return async (frames) => {
|
|
@@ -47416,7 +47585,7 @@ function createGetModuleFromFilename(basePath = process.argv[1] ? dirname9(proce
|
|
|
47416
47585
|
if (!filename)
|
|
47417
47586
|
return;
|
|
47418
47587
|
const normalizedFilename = isWindows ? normalizeWindowsPath(filename) : filename;
|
|
47419
|
-
let { dir, base: file, ext } =
|
|
47588
|
+
let { dir, base: file, ext } = posix2.parse(normalizedFilename);
|
|
47420
47589
|
if (ext === ".js" || ext === ".mjs" || ext === ".cjs")
|
|
47421
47590
|
file = file.slice(0, -1 * ext.length);
|
|
47422
47591
|
const decodedFile = decodeURIComponent(file);
|
|
@@ -56704,7 +56873,7 @@ async function writeSettings(settings) {
|
|
|
56704
56873
|
const tmp = `${path}.${process.pid}.tmp`;
|
|
56705
56874
|
await writeFile11(tmp, `${JSON.stringify(settings, null, 2)}
|
|
56706
56875
|
`);
|
|
56707
|
-
await
|
|
56876
|
+
await rename9(tmp, path);
|
|
56708
56877
|
}
|
|
56709
56878
|
async function settings() {
|
|
56710
56879
|
const current = readSettings();
|
|
@@ -56875,7 +57044,7 @@ async function telemetryCommand(arg = "status") {
|
|
|
56875
57044
|
|
|
56876
57045
|
// apps/cli/src/wake.ts
|
|
56877
57046
|
import { dlopen, FFIType, ptr } from "bun:ffi";
|
|
56878
|
-
import { spawnSync as
|
|
57047
|
+
import { spawnSync as spawnSync3 } from "child_process";
|
|
56879
57048
|
import { fstatSync, readFileSync as readFileSync6 } from "fs";
|
|
56880
57049
|
import { mkdir as mkdir14, rm as rm5, writeFile as writeFile12 } from "fs/promises";
|
|
56881
57050
|
import { homedir as homedir7 } from "os";
|
|
@@ -56918,7 +57087,7 @@ function wakePlist(program, port = WAKE_PORT) {
|
|
|
56918
57087
|
</plist>
|
|
56919
57088
|
`;
|
|
56920
57089
|
}
|
|
56921
|
-
var launchctl = (args) =>
|
|
57090
|
+
var launchctl = (args) => spawnSync3("/bin/launchctl", args, { stdio: "ignore" }).status === 0;
|
|
56922
57091
|
var domain = () => `gui/${process.getuid?.() ?? 501}`;
|
|
56923
57092
|
async function installWake(program, run = launchctl) {
|
|
56924
57093
|
const path = wakePlistPath();
|
|
@@ -57079,7 +57248,7 @@ function sockaddrIp(addr) {
|
|
|
57079
57248
|
return null;
|
|
57080
57249
|
}
|
|
57081
57250
|
function lsofPeer() {
|
|
57082
|
-
const out =
|
|
57251
|
+
const out = spawnSync3("/usr/sbin/lsof", ["-nP", "-a", "-p", String(process.pid), "-d", "0", "-Fn"], {
|
|
57083
57252
|
encoding: "utf8"
|
|
57084
57253
|
}).stdout;
|
|
57085
57254
|
const remote = /->(.+):\d+$/m.exec(out ?? "")?.[1];
|