@maria_rcks/t1code 0.0.4 → 0.0.6

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.
Files changed (40) hide show
  1. package/README.md +24 -0
  2. package/bin/t1code.js +38 -4
  3. package/dist/index.mjs +879 -29527
  4. package/dist/server/{BunPTY-BulfMn1P.cjs → BunPTY-3FAOkA1C.cjs} +4 -5
  5. package/dist/server/BunPTY-3FAOkA1C.cjs.map +1 -0
  6. package/dist/server/{BunPTY-Cueq2gzZ.mjs → BunPTY-B9Pc7ndx.mjs} +5 -6
  7. package/dist/server/BunPTY-B9Pc7ndx.mjs.map +1 -0
  8. package/dist/server/{NodePTY-AdcStdsu.mjs → NodePTY-CZNVLBpq.mjs} +15 -16
  9. package/dist/server/NodePTY-CZNVLBpq.mjs.map +1 -0
  10. package/dist/server/{NodePTY-DmqnQV86.cjs → NodePTY-CbnaoLlj.cjs} +14 -15
  11. package/dist/server/NodePTY-CbnaoLlj.cjs.map +1 -0
  12. package/dist/server/NodeSqliteClient-C5fYhtpO.cjs +147 -0
  13. package/dist/server/NodeSqliteClient-C5fYhtpO.cjs.map +1 -0
  14. package/dist/server/NodeSqliteClient-COEUidVC.mjs +143 -0
  15. package/dist/server/NodeSqliteClient-COEUidVC.mjs.map +1 -0
  16. package/dist/server/SqlError-7DUB2NkG.mjs +43 -0
  17. package/dist/server/SqlError-7DUB2NkG.mjs.map +1 -0
  18. package/dist/server/SqlError-CAzXmpza.cjs +48 -0
  19. package/dist/server/SqlError-CAzXmpza.cjs.map +1 -0
  20. package/dist/server/SqliteClient-BMlcF9O1.cjs +133 -0
  21. package/dist/server/SqliteClient-BMlcF9O1.cjs.map +1 -0
  22. package/dist/server/SqliteClient-MZci3yRi.mjs +129 -0
  23. package/dist/server/SqliteClient-MZci3yRi.mjs.map +1 -0
  24. package/dist/server/index.cjs +96505 -14779
  25. package/dist/server/index.cjs.map +1 -1
  26. package/dist/server/index.mjs +96491 -14777
  27. package/dist/server/index.mjs.map +1 -1
  28. package/dist/server/open-BGXDmMPQ.cjs +501 -0
  29. package/dist/server/open-BGXDmMPQ.cjs.map +1 -0
  30. package/dist/server/open-BvXvp1QV.mjs +492 -0
  31. package/dist/server/open-BvXvp1QV.mjs.map +1 -0
  32. package/package.json +9 -2
  33. package/dist/server/BunPTY-BulfMn1P.cjs.map +0 -1
  34. package/dist/server/BunPTY-Cueq2gzZ.mjs.map +0 -1
  35. package/dist/server/NodePTY-AdcStdsu.mjs.map +0 -1
  36. package/dist/server/NodePTY-DmqnQV86.cjs.map +0 -1
  37. package/dist/server/NodeSqliteClient-BTK-dUey.mjs +0 -156
  38. package/dist/server/NodeSqliteClient-BTK-dUey.mjs.map +0 -1
  39. package/dist/server/NodeSqliteClient-ViK8pcdH.cjs +0 -174
  40. package/dist/server/NodeSqliteClient-ViK8pcdH.cjs.map +0 -1
@@ -0,0 +1,492 @@
1
+ #!/usr/bin/env node
2
+
3
+ import childProcess, { execFile, execFileSync } from "node:child_process";
4
+ import fs from "node:fs";
5
+ import os from "node:os";
6
+ import path from "node:path";
7
+ import { fileURLToPath } from "node:url";
8
+ import fs$1, { constants as constants$1 } from "node:fs/promises";
9
+ import { promisify } from "node:util";
10
+ import process from "node:process";
11
+ import { Buffer } from "node:buffer";
12
+
13
+ //#region ../../node_modules/.bun/is-docker@3.0.0/node_modules/is-docker/index.js
14
+ let isDockerCached;
15
+ function hasDockerEnv() {
16
+ try {
17
+ fs.statSync("/.dockerenv");
18
+ return true;
19
+ } catch {
20
+ return false;
21
+ }
22
+ }
23
+ function hasDockerCGroup() {
24
+ try {
25
+ return fs.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
26
+ } catch {
27
+ return false;
28
+ }
29
+ }
30
+ function isDocker() {
31
+ if (isDockerCached === void 0) isDockerCached = hasDockerEnv() || hasDockerCGroup();
32
+ return isDockerCached;
33
+ }
34
+
35
+ //#endregion
36
+ //#region ../../node_modules/.bun/is-inside-container@1.0.0/node_modules/is-inside-container/index.js
37
+ let cachedResult;
38
+ const hasContainerEnv = () => {
39
+ try {
40
+ fs.statSync("/run/.containerenv");
41
+ return true;
42
+ } catch {
43
+ return false;
44
+ }
45
+ };
46
+ function isInsideContainer() {
47
+ if (cachedResult === void 0) cachedResult = hasContainerEnv() || isDocker();
48
+ return cachedResult;
49
+ }
50
+
51
+ //#endregion
52
+ //#region ../../node_modules/.bun/is-wsl@3.1.1/node_modules/is-wsl/index.js
53
+ const isWsl = () => {
54
+ if (process.platform !== "linux") return false;
55
+ if (os.release().toLowerCase().includes("microsoft")) {
56
+ if (isInsideContainer()) return false;
57
+ return true;
58
+ }
59
+ try {
60
+ if (fs.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft")) return !isInsideContainer();
61
+ } catch {}
62
+ if (fs.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop") || fs.existsSync("/run/WSL")) return !isInsideContainer();
63
+ return false;
64
+ };
65
+ var is_wsl_default = process.env.__IS_WSL_TEST__ ? isWsl : isWsl();
66
+
67
+ //#endregion
68
+ //#region ../../node_modules/.bun/wsl-utils@0.1.0/node_modules/wsl-utils/index.js
69
+ const wslDrivesMountPoint = (() => {
70
+ const defaultMountPoint = "/mnt/";
71
+ let mountPoint;
72
+ return async function() {
73
+ if (mountPoint) return mountPoint;
74
+ const configFilePath = "/etc/wsl.conf";
75
+ let isConfigFileExists = false;
76
+ try {
77
+ await fs$1.access(configFilePath, constants$1.F_OK);
78
+ isConfigFileExists = true;
79
+ } catch {}
80
+ if (!isConfigFileExists) return defaultMountPoint;
81
+ const configContent = await fs$1.readFile(configFilePath, { encoding: "utf8" });
82
+ const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
83
+ if (!configMountPoint) return defaultMountPoint;
84
+ mountPoint = configMountPoint.groups.mountPoint.trim();
85
+ mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
86
+ return mountPoint;
87
+ };
88
+ })();
89
+ const powerShellPathFromWsl = async () => {
90
+ return `${await wslDrivesMountPoint()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
91
+ };
92
+ const powerShellPath = async () => {
93
+ if (is_wsl_default) return powerShellPathFromWsl();
94
+ return `${process.env.SYSTEMROOT || process.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
95
+ };
96
+
97
+ //#endregion
98
+ //#region ../../node_modules/.bun/define-lazy-prop@3.0.0/node_modules/define-lazy-prop/index.js
99
+ function defineLazyProperty(object, propertyName, valueGetter) {
100
+ const define = (value) => Object.defineProperty(object, propertyName, {
101
+ value,
102
+ enumerable: true,
103
+ writable: true
104
+ });
105
+ Object.defineProperty(object, propertyName, {
106
+ configurable: true,
107
+ enumerable: true,
108
+ get() {
109
+ const result = valueGetter();
110
+ define(result);
111
+ return result;
112
+ },
113
+ set(value) {
114
+ define(value);
115
+ }
116
+ });
117
+ return object;
118
+ }
119
+
120
+ //#endregion
121
+ //#region ../../node_modules/.bun/default-browser-id@5.0.1/node_modules/default-browser-id/index.js
122
+ const execFileAsync$3 = promisify(execFile);
123
+ async function defaultBrowserId() {
124
+ if (process.platform !== "darwin") throw new Error("macOS only");
125
+ const { stdout } = await execFileAsync$3("defaults", [
126
+ "read",
127
+ "com.apple.LaunchServices/com.apple.launchservices.secure",
128
+ "LSHandlers"
129
+ ]);
130
+ const browserId = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout)?.groups.id ?? "com.apple.Safari";
131
+ if (browserId === "com.apple.safari") return "com.apple.Safari";
132
+ return browserId;
133
+ }
134
+
135
+ //#endregion
136
+ //#region ../../node_modules/.bun/run-applescript@7.1.0/node_modules/run-applescript/index.js
137
+ const execFileAsync$2 = promisify(execFile);
138
+ async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
139
+ if (process.platform !== "darwin") throw new Error("macOS only");
140
+ const outputArguments = humanReadableOutput ? [] : ["-ss"];
141
+ const execOptions = {};
142
+ if (signal) execOptions.signal = signal;
143
+ const { stdout } = await execFileAsync$2("osascript", [
144
+ "-e",
145
+ script,
146
+ outputArguments
147
+ ], execOptions);
148
+ return stdout.trim();
149
+ }
150
+
151
+ //#endregion
152
+ //#region ../../node_modules/.bun/bundle-name@4.1.0/node_modules/bundle-name/index.js
153
+ async function bundleName(bundleId) {
154
+ return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string\ntell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
155
+ }
156
+
157
+ //#endregion
158
+ //#region ../../node_modules/.bun/default-browser@5.5.0/node_modules/default-browser/windows.js
159
+ const execFileAsync$1 = promisify(execFile);
160
+ const windowsBrowserProgIds = {
161
+ MSEdgeHTM: {
162
+ name: "Edge",
163
+ id: "com.microsoft.edge"
164
+ },
165
+ MSEdgeBHTML: {
166
+ name: "Edge Beta",
167
+ id: "com.microsoft.edge.beta"
168
+ },
169
+ MSEdgeDHTML: {
170
+ name: "Edge Dev",
171
+ id: "com.microsoft.edge.dev"
172
+ },
173
+ AppXq0fevzme2pys62n3e0fbqa7peapykr8v: {
174
+ name: "Edge",
175
+ id: "com.microsoft.edge.old"
176
+ },
177
+ ChromeHTML: {
178
+ name: "Chrome",
179
+ id: "com.google.chrome"
180
+ },
181
+ ChromeBHTML: {
182
+ name: "Chrome Beta",
183
+ id: "com.google.chrome.beta"
184
+ },
185
+ ChromeDHTML: {
186
+ name: "Chrome Dev",
187
+ id: "com.google.chrome.dev"
188
+ },
189
+ ChromiumHTM: {
190
+ name: "Chromium",
191
+ id: "org.chromium.Chromium"
192
+ },
193
+ BraveHTML: {
194
+ name: "Brave",
195
+ id: "com.brave.Browser"
196
+ },
197
+ BraveBHTML: {
198
+ name: "Brave Beta",
199
+ id: "com.brave.Browser.beta"
200
+ },
201
+ BraveDHTML: {
202
+ name: "Brave Dev",
203
+ id: "com.brave.Browser.dev"
204
+ },
205
+ BraveSSHTM: {
206
+ name: "Brave Nightly",
207
+ id: "com.brave.Browser.nightly"
208
+ },
209
+ FirefoxURL: {
210
+ name: "Firefox",
211
+ id: "org.mozilla.firefox"
212
+ },
213
+ OperaStable: {
214
+ name: "Opera",
215
+ id: "com.operasoftware.Opera"
216
+ },
217
+ VivaldiHTM: {
218
+ name: "Vivaldi",
219
+ id: "com.vivaldi.Vivaldi"
220
+ },
221
+ "IE.HTTP": {
222
+ name: "Internet Explorer",
223
+ id: "com.microsoft.ie"
224
+ }
225
+ };
226
+ const _windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));
227
+ var UnknownBrowserError = class extends Error {};
228
+ async function defaultBrowser$1(_execFileAsync = execFileAsync$1) {
229
+ const { stdout } = await _execFileAsync("reg", [
230
+ "QUERY",
231
+ " HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice",
232
+ "/v",
233
+ "ProgId"
234
+ ]);
235
+ const match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout);
236
+ if (!match) throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
237
+ const { id } = match.groups;
238
+ const dotIndex = id.lastIndexOf(".");
239
+ const hyphenIndex = id.lastIndexOf("-");
240
+ const baseIdByDot = dotIndex === -1 ? void 0 : id.slice(0, dotIndex);
241
+ const baseIdByHyphen = hyphenIndex === -1 ? void 0 : id.slice(0, hyphenIndex);
242
+ return windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? {
243
+ name: id,
244
+ id
245
+ };
246
+ }
247
+
248
+ //#endregion
249
+ //#region ../../node_modules/.bun/default-browser@5.5.0/node_modules/default-browser/index.js
250
+ const execFileAsync = promisify(execFile);
251
+ const titleize = (string) => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
252
+ async function defaultBrowser() {
253
+ if (process.platform === "darwin") {
254
+ const id = await defaultBrowserId();
255
+ return {
256
+ name: await bundleName(id),
257
+ id
258
+ };
259
+ }
260
+ if (process.platform === "linux") {
261
+ const { stdout } = await execFileAsync("xdg-mime", [
262
+ "query",
263
+ "default",
264
+ "x-scheme-handler/http"
265
+ ]);
266
+ const id = stdout.trim();
267
+ return {
268
+ name: titleize(id.replace(/.desktop$/, "").replace("-", " ")),
269
+ id
270
+ };
271
+ }
272
+ if (process.platform === "win32") return defaultBrowser$1();
273
+ throw new Error("Only macOS, Linux, and Windows are supported");
274
+ }
275
+
276
+ //#endregion
277
+ //#region ../../node_modules/.bun/open@10.2.0/node_modules/open/index.js
278
+ const execFile$1 = promisify(childProcess.execFile);
279
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
280
+ const localXdgOpenPath = path.join(__dirname, "xdg-open");
281
+ const { platform, arch } = process;
282
+ /**
283
+ Get the default browser name in Windows from WSL.
284
+
285
+ @returns {Promise<string>} Browser name.
286
+ */
287
+ async function getWindowsDefaultBrowserFromWsl() {
288
+ const powershellPath = await powerShellPath();
289
+ const rawCommand = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
290
+ const { stdout } = await execFile$1(powershellPath, [
291
+ "-NoProfile",
292
+ "-NonInteractive",
293
+ "-ExecutionPolicy",
294
+ "Bypass",
295
+ "-EncodedCommand",
296
+ Buffer.from(rawCommand, "utf16le").toString("base64")
297
+ ], { encoding: "utf8" });
298
+ const progId = stdout.trim();
299
+ const browserMap = {
300
+ ChromeHTML: "com.google.chrome",
301
+ BraveHTML: "com.brave.Browser",
302
+ MSEdgeHTM: "com.microsoft.edge",
303
+ FirefoxURL: "org.mozilla.firefox"
304
+ };
305
+ return browserMap[progId] ? { id: browserMap[progId] } : {};
306
+ }
307
+ const pTryEach = async (array, mapper) => {
308
+ let latestError;
309
+ for (const item of array) try {
310
+ return await mapper(item);
311
+ } catch (error) {
312
+ latestError = error;
313
+ }
314
+ throw latestError;
315
+ };
316
+ const baseOpen = async (options) => {
317
+ options = {
318
+ wait: false,
319
+ background: false,
320
+ newInstance: false,
321
+ allowNonzeroExitCode: false,
322
+ ...options
323
+ };
324
+ if (Array.isArray(options.app)) return pTryEach(options.app, (singleApp) => baseOpen({
325
+ ...options,
326
+ app: singleApp
327
+ }));
328
+ let { name: app, arguments: appArguments = [] } = options.app ?? {};
329
+ appArguments = [...appArguments];
330
+ if (Array.isArray(app)) return pTryEach(app, (appName) => baseOpen({
331
+ ...options,
332
+ app: {
333
+ name: appName,
334
+ arguments: appArguments
335
+ }
336
+ }));
337
+ if (app === "browser" || app === "browserPrivate") {
338
+ const ids = {
339
+ "com.google.chrome": "chrome",
340
+ "google-chrome.desktop": "chrome",
341
+ "com.brave.Browser": "brave",
342
+ "org.mozilla.firefox": "firefox",
343
+ "firefox.desktop": "firefox",
344
+ "com.microsoft.msedge": "edge",
345
+ "com.microsoft.edge": "edge",
346
+ "com.microsoft.edgemac": "edge",
347
+ "microsoft-edge.desktop": "edge"
348
+ };
349
+ const flags = {
350
+ chrome: "--incognito",
351
+ brave: "--incognito",
352
+ firefox: "--private-window",
353
+ edge: "--inPrivate"
354
+ };
355
+ const browser = is_wsl_default ? await getWindowsDefaultBrowserFromWsl() : await defaultBrowser();
356
+ if (browser.id in ids) {
357
+ const browserName = ids[browser.id];
358
+ if (app === "browserPrivate") appArguments.push(flags[browserName]);
359
+ return baseOpen({
360
+ ...options,
361
+ app: {
362
+ name: apps[browserName],
363
+ arguments: appArguments
364
+ }
365
+ });
366
+ }
367
+ throw new Error(`${browser.name} is not supported as a default browser`);
368
+ }
369
+ let command;
370
+ const cliArguments = [];
371
+ const childProcessOptions = {};
372
+ if (platform === "darwin") {
373
+ command = "open";
374
+ if (options.wait) cliArguments.push("--wait-apps");
375
+ if (options.background) cliArguments.push("--background");
376
+ if (options.newInstance) cliArguments.push("--new");
377
+ if (app) cliArguments.push("-a", app);
378
+ } else if (platform === "win32" || is_wsl_default && !isInsideContainer() && !app) {
379
+ command = await powerShellPath();
380
+ cliArguments.push("-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-EncodedCommand");
381
+ if (!is_wsl_default) childProcessOptions.windowsVerbatimArguments = true;
382
+ const encodedArguments = ["Start"];
383
+ if (options.wait) encodedArguments.push("-Wait");
384
+ if (app) {
385
+ encodedArguments.push(`"\`"${app}\`""`);
386
+ if (options.target) appArguments.push(options.target);
387
+ } else if (options.target) encodedArguments.push(`"${options.target}"`);
388
+ if (appArguments.length > 0) {
389
+ appArguments = appArguments.map((argument) => `"\`"${argument}\`""`);
390
+ encodedArguments.push("-ArgumentList", appArguments.join(","));
391
+ }
392
+ options.target = Buffer.from(encodedArguments.join(" "), "utf16le").toString("base64");
393
+ } else {
394
+ if (app) command = app;
395
+ else {
396
+ const isBundled = !__dirname || __dirname === "/";
397
+ let exeLocalXdgOpen = false;
398
+ try {
399
+ await fs$1.access(localXdgOpenPath, constants$1.X_OK);
400
+ exeLocalXdgOpen = true;
401
+ } catch {}
402
+ command = process.versions.electron ?? (platform === "android" || isBundled || !exeLocalXdgOpen) ? "xdg-open" : localXdgOpenPath;
403
+ }
404
+ if (appArguments.length > 0) cliArguments.push(...appArguments);
405
+ if (!options.wait) {
406
+ childProcessOptions.stdio = "ignore";
407
+ childProcessOptions.detached = true;
408
+ }
409
+ }
410
+ if (platform === "darwin" && appArguments.length > 0) cliArguments.push("--args", ...appArguments);
411
+ if (options.target) cliArguments.push(options.target);
412
+ const subprocess = childProcess.spawn(command, cliArguments, childProcessOptions);
413
+ if (options.wait) return new Promise((resolve, reject) => {
414
+ subprocess.once("error", reject);
415
+ subprocess.once("close", (exitCode) => {
416
+ if (!options.allowNonzeroExitCode && exitCode > 0) {
417
+ reject(/* @__PURE__ */ new Error(`Exited with code ${exitCode}`));
418
+ return;
419
+ }
420
+ resolve(subprocess);
421
+ });
422
+ });
423
+ subprocess.unref();
424
+ return subprocess;
425
+ };
426
+ const open = (target, options) => {
427
+ if (typeof target !== "string") throw new TypeError("Expected a `target`");
428
+ return baseOpen({
429
+ ...options,
430
+ target
431
+ });
432
+ };
433
+ const openApp = (name, options) => {
434
+ if (typeof name !== "string" && !Array.isArray(name)) throw new TypeError("Expected a valid `name`");
435
+ const { arguments: appArguments = [] } = options ?? {};
436
+ if (appArguments !== void 0 && appArguments !== null && !Array.isArray(appArguments)) throw new TypeError("Expected `appArguments` as Array type");
437
+ return baseOpen({
438
+ ...options,
439
+ app: {
440
+ name,
441
+ arguments: appArguments
442
+ }
443
+ });
444
+ };
445
+ function detectArchBinary(binary) {
446
+ if (typeof binary === "string" || Array.isArray(binary)) return binary;
447
+ const { [arch]: archBinary } = binary;
448
+ if (!archBinary) throw new Error(`${arch} is not supported`);
449
+ return archBinary;
450
+ }
451
+ function detectPlatformBinary({ [platform]: platformBinary }, { wsl }) {
452
+ if (wsl && is_wsl_default) return detectArchBinary(wsl);
453
+ if (!platformBinary) throw new Error(`${platform} is not supported`);
454
+ return detectArchBinary(platformBinary);
455
+ }
456
+ const apps = {};
457
+ defineLazyProperty(apps, "chrome", () => detectPlatformBinary({
458
+ darwin: "google chrome",
459
+ win32: "chrome",
460
+ linux: [
461
+ "google-chrome",
462
+ "google-chrome-stable",
463
+ "chromium"
464
+ ]
465
+ }, { wsl: {
466
+ ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
467
+ x64: ["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe", "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]
468
+ } }));
469
+ defineLazyProperty(apps, "brave", () => detectPlatformBinary({
470
+ darwin: "brave browser",
471
+ win32: "brave",
472
+ linux: ["brave-browser", "brave"]
473
+ }, { wsl: {
474
+ ia32: "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",
475
+ x64: ["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe", "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]
476
+ } }));
477
+ defineLazyProperty(apps, "firefox", () => detectPlatformBinary({
478
+ darwin: "firefox",
479
+ win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
480
+ linux: "firefox"
481
+ }, { wsl: "/mnt/c/Program Files/Mozilla Firefox/firefox.exe" }));
482
+ defineLazyProperty(apps, "edge", () => detectPlatformBinary({
483
+ darwin: "microsoft edge",
484
+ win32: "msedge",
485
+ linux: ["microsoft-edge", "microsoft-edge-dev"]
486
+ }, { wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe" }));
487
+ defineLazyProperty(apps, "browser", () => "browser");
488
+ defineLazyProperty(apps, "browserPrivate", () => "browserPrivate");
489
+
490
+ //#endregion
491
+ export { apps, open as default, openApp };
492
+ //# sourceMappingURL=open-BvXvp1QV.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open-BvXvp1QV.mjs","names":["fs","fsConstants","isWsl","execFileAsync","execFileAsync","execFileAsync","defaultBrowser","windows","execFile","isWsl","fs","fsConstants"],"sources":["../../../node_modules/.bun/is-docker@3.0.0/node_modules/is-docker/index.js","../../../node_modules/.bun/is-inside-container@1.0.0/node_modules/is-inside-container/index.js","../../../node_modules/.bun/is-wsl@3.1.1/node_modules/is-wsl/index.js","../../../node_modules/.bun/wsl-utils@0.1.0/node_modules/wsl-utils/index.js","../../../node_modules/.bun/define-lazy-prop@3.0.0/node_modules/define-lazy-prop/index.js","../../../node_modules/.bun/default-browser-id@5.0.1/node_modules/default-browser-id/index.js","../../../node_modules/.bun/run-applescript@7.1.0/node_modules/run-applescript/index.js","../../../node_modules/.bun/bundle-name@4.1.0/node_modules/bundle-name/index.js","../../../node_modules/.bun/default-browser@5.5.0/node_modules/default-browser/windows.js","../../../node_modules/.bun/default-browser@5.5.0/node_modules/default-browser/index.js","../../../node_modules/.bun/open@10.2.0/node_modules/open/index.js"],"sourcesContent":["import fs from 'node:fs';\n\nlet isDockerCached;\n\nfunction hasDockerEnv() {\n\ttry {\n\t\tfs.statSync('/.dockerenv');\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nfunction hasDockerCGroup() {\n\ttry {\n\t\treturn fs.readFileSync('/proc/self/cgroup', 'utf8').includes('docker');\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport default function isDocker() {\n\t// TODO: Use `??=` when targeting Node.js 16.\n\tif (isDockerCached === undefined) {\n\t\tisDockerCached = hasDockerEnv() || hasDockerCGroup();\n\t}\n\n\treturn isDockerCached;\n}\n","import fs from 'node:fs';\nimport isDocker from 'is-docker';\n\nlet cachedResult;\n\n// Podman detection\nconst hasContainerEnv = () => {\n\ttry {\n\t\tfs.statSync('/run/.containerenv');\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n};\n\nexport default function isInsideContainer() {\n\t// TODO: Use `??=` when targeting Node.js 16.\n\tif (cachedResult === undefined) {\n\t\tcachedResult = hasContainerEnv() || isDocker();\n\t}\n\n\treturn cachedResult;\n}\n","import process from 'node:process';\nimport os from 'node:os';\nimport fs from 'node:fs';\nimport isInsideContainer from 'is-inside-container';\n\nconst isWsl = () => {\n\tif (process.platform !== 'linux') {\n\t\treturn false;\n\t}\n\n\tif (os.release().toLowerCase().includes('microsoft')) {\n\t\tif (isInsideContainer()) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\ttry {\n\t\tif (fs.readFileSync('/proc/version', 'utf8').toLowerCase().includes('microsoft')) {\n\t\t\treturn !isInsideContainer();\n\t\t}\n\t} catch {}\n\n\t// Fallback for custom kernels: check WSL-specific paths.\n\tif (\n\t\tfs.existsSync('/proc/sys/fs/binfmt_misc/WSLInterop')\n\t\t|| fs.existsSync('/run/WSL')\n\t) {\n\t\treturn !isInsideContainer();\n\t}\n\n\treturn false;\n};\n\nexport default process.env.__IS_WSL_TEST__ ? isWsl : isWsl();\n","import process from 'node:process';\nimport fs, {constants as fsConstants} from 'node:fs/promises';\nimport isWsl from 'is-wsl';\n\nexport const wslDrivesMountPoint = (() => {\n\t// Default value for \"root\" param\n\t// according to https://docs.microsoft.com/en-us/windows/wsl/wsl-config\n\tconst defaultMountPoint = '/mnt/';\n\n\tlet mountPoint;\n\n\treturn async function () {\n\t\tif (mountPoint) {\n\t\t\t// Return memoized mount point value\n\t\t\treturn mountPoint;\n\t\t}\n\n\t\tconst configFilePath = '/etc/wsl.conf';\n\n\t\tlet isConfigFileExists = false;\n\t\ttry {\n\t\t\tawait fs.access(configFilePath, fsConstants.F_OK);\n\t\t\tisConfigFileExists = true;\n\t\t} catch {}\n\n\t\tif (!isConfigFileExists) {\n\t\t\treturn defaultMountPoint;\n\t\t}\n\n\t\tconst configContent = await fs.readFile(configFilePath, {encoding: 'utf8'});\n\t\tconst configMountPoint = /(?<!#.*)root\\s*=\\s*(?<mountPoint>.*)/g.exec(configContent);\n\n\t\tif (!configMountPoint) {\n\t\t\treturn defaultMountPoint;\n\t\t}\n\n\t\tmountPoint = configMountPoint.groups.mountPoint.trim();\n\t\tmountPoint = mountPoint.endsWith('/') ? mountPoint : `${mountPoint}/`;\n\n\t\treturn mountPoint;\n\t};\n})();\n\nexport const powerShellPathFromWsl = async () => {\n\tconst mountPoint = await wslDrivesMountPoint();\n\treturn `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;\n};\n\nexport const powerShellPath = async () => {\n\tif (isWsl) {\n\t\treturn powerShellPathFromWsl();\n\t}\n\n\treturn `${process.env.SYSTEMROOT || process.env.windir || String.raw`C:\\Windows`}\\\\System32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe`;\n};\n\nexport {default as isWsl} from 'is-wsl';\n","export default function defineLazyProperty(object, propertyName, valueGetter) {\n\tconst define = value => Object.defineProperty(object, propertyName, {value, enumerable: true, writable: true});\n\n\tObject.defineProperty(object, propertyName, {\n\t\tconfigurable: true,\n\t\tenumerable: true,\n\t\tget() {\n\t\t\tconst result = valueGetter();\n\t\t\tdefine(result);\n\t\t\treturn result;\n\t\t},\n\t\tset(value) {\n\t\t\tdefine(value);\n\t\t}\n\t});\n\n\treturn object;\n}\n","import {promisify} from 'node:util';\nimport process from 'node:process';\nimport {execFile} from 'node:child_process';\n\nconst execFileAsync = promisify(execFile);\n\nexport default async function defaultBrowserId() {\n\tif (process.platform !== 'darwin') {\n\t\tthrow new Error('macOS only');\n\t}\n\n\tconst {stdout} = await execFileAsync('defaults', ['read', 'com.apple.LaunchServices/com.apple.launchservices.secure', 'LSHandlers']);\n\n\t// `(?!-)` is to prevent matching `LSHandlerRoleAll = \"-\";`.\n\tconst match = /LSHandlerRoleAll = \"(?!-)(?<id>[^\"]+?)\";\\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);\n\n\tconst browserId = match?.groups.id ?? 'com.apple.Safari';\n\n\t// Correct the case for Safari's bundle identifier\n\tif (browserId === 'com.apple.safari') {\n\t\treturn 'com.apple.Safari';\n\t}\n\n\treturn browserId;\n}\n","import process from 'node:process';\nimport {promisify} from 'node:util';\nimport {execFile, execFileSync} from 'node:child_process';\n\nconst execFileAsync = promisify(execFile);\n\nexport async function runAppleScript(script, {humanReadableOutput = true, signal} = {}) {\n\tif (process.platform !== 'darwin') {\n\t\tthrow new Error('macOS only');\n\t}\n\n\tconst outputArguments = humanReadableOutput ? [] : ['-ss'];\n\n\tconst execOptions = {};\n\tif (signal) {\n\t\texecOptions.signal = signal;\n\t}\n\n\tconst {stdout} = await execFileAsync('osascript', ['-e', script, outputArguments], execOptions);\n\treturn stdout.trim();\n}\n\nexport function runAppleScriptSync(script, {humanReadableOutput = true} = {}) {\n\tif (process.platform !== 'darwin') {\n\t\tthrow new Error('macOS only');\n\t}\n\n\tconst outputArguments = humanReadableOutput ? [] : ['-ss'];\n\n\tconst stdout = execFileSync('osascript', ['-e', script, ...outputArguments], {\n\t\tencoding: 'utf8',\n\t\tstdio: ['ignore', 'pipe', 'ignore'],\n\t\ttimeout: 500,\n\t});\n\n\treturn stdout.trim();\n}\n","import {runAppleScript} from 'run-applescript';\n\nexport default async function bundleName(bundleId) {\n\treturn runAppleScript(`tell application \"Finder\" to set app_path to application file id \"${bundleId}\" as string\\ntell application \"System Events\" to get value of property list item \"CFBundleName\" of property list file (app_path & \":Contents:Info.plist\")`);\n}\n","import {promisify} from 'node:util';\nimport {execFile} from 'node:child_process';\n\nconst execFileAsync = promisify(execFile);\n\n// TODO: Fix the casing of bundle identifiers in the next major version.\n\n// Windows doesn't have browser IDs in the same way macOS/Linux does so we give fake\n// ones that look real and match the macOS/Linux versions for cross-platform apps.\nconst windowsBrowserProgIds = {\n\tMSEdgeHTM: {name: 'Edge', id: 'com.microsoft.edge'}, // The missing `L` is correct.\n\tMSEdgeBHTML: {name: 'Edge Beta', id: 'com.microsoft.edge.beta'},\n\tMSEdgeDHTML: {name: 'Edge Dev', id: 'com.microsoft.edge.dev'},\n\tAppXq0fevzme2pys62n3e0fbqa7peapykr8v: {name: 'Edge', id: 'com.microsoft.edge.old'},\n\tChromeHTML: {name: 'Chrome', id: 'com.google.chrome'},\n\tChromeBHTML: {name: 'Chrome Beta', id: 'com.google.chrome.beta'},\n\tChromeDHTML: {name: 'Chrome Dev', id: 'com.google.chrome.dev'},\n\tChromiumHTM: {name: 'Chromium', id: 'org.chromium.Chromium'},\n\tBraveHTML: {name: 'Brave', id: 'com.brave.Browser'},\n\tBraveBHTML: {name: 'Brave Beta', id: 'com.brave.Browser.beta'},\n\tBraveDHTML: {name: 'Brave Dev', id: 'com.brave.Browser.dev'},\n\tBraveSSHTM: {name: 'Brave Nightly', id: 'com.brave.Browser.nightly'},\n\tFirefoxURL: {name: 'Firefox', id: 'org.mozilla.firefox'},\n\tOperaStable: {name: 'Opera', id: 'com.operasoftware.Opera'},\n\tVivaldiHTM: {name: 'Vivaldi', id: 'com.vivaldi.Vivaldi'},\n\t'IE.HTTP': {name: 'Internet Explorer', id: 'com.microsoft.ie'},\n};\n\nexport const _windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));\n\nexport class UnknownBrowserError extends Error {}\n\nexport default async function defaultBrowser(_execFileAsync = execFileAsync) {\n\tconst {stdout} = await _execFileAsync('reg', [\n\t\t'QUERY',\n\t\t' HKEY_CURRENT_USER\\\\Software\\\\Microsoft\\\\Windows\\\\Shell\\\\Associations\\\\UrlAssociations\\\\http\\\\UserChoice',\n\t\t'/v',\n\t\t'ProgId',\n\t]);\n\n\tconst match = /ProgId\\s*REG_SZ\\s*(?<id>\\S+)/.exec(stdout);\n\tif (!match) {\n\t\tthrow new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);\n\t}\n\n\tconst {id} = match.groups;\n\n\t// Windows can append a hash suffix to ProgIds using a dot or hyphen\n\t// (e.g., `ChromeHTML.ABC123`, `FirefoxURL-6F193CCC56814779`).\n\t// Try exact match first, then try without the suffix.\n\tconst dotIndex = id.lastIndexOf('.');\n\tconst hyphenIndex = id.lastIndexOf('-');\n\tconst baseIdByDot = dotIndex === -1 ? undefined : id.slice(0, dotIndex);\n\tconst baseIdByHyphen = hyphenIndex === -1 ? undefined : id.slice(0, hyphenIndex);\n\n\treturn windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? {name: id, id};\n}\n","import {promisify} from 'node:util';\nimport process from 'node:process';\nimport {execFile} from 'node:child_process';\nimport defaultBrowserId from 'default-browser-id';\nimport bundleName from 'bundle-name';\nimport windows from './windows.js';\n\nexport {_windowsBrowserProgIdMap} from './windows.js';\n\nconst execFileAsync = promisify(execFile);\n\n// Inlined: https://github.com/sindresorhus/titleize/blob/main/index.js\nconst titleize = string => string.toLowerCase().replaceAll(/(?:^|\\s|-)\\S/g, x => x.toUpperCase());\n\nexport default async function defaultBrowser() {\n\tif (process.platform === 'darwin') {\n\t\tconst id = await defaultBrowserId();\n\t\tconst name = await bundleName(id);\n\t\treturn {name, id};\n\t}\n\n\tif (process.platform === 'linux') {\n\t\tconst {stdout} = await execFileAsync('xdg-mime', ['query', 'default', 'x-scheme-handler/http']);\n\t\tconst id = stdout.trim();\n\t\tconst name = titleize(id.replace(/.desktop$/, '').replace('-', ' '));\n\t\treturn {name, id};\n\t}\n\n\tif (process.platform === 'win32') {\n\t\treturn windows();\n\t}\n\n\tthrow new Error('Only macOS, Linux, and Windows are supported');\n}\n","import process from 'node:process';\nimport {Buffer} from 'node:buffer';\nimport path from 'node:path';\nimport {fileURLToPath} from 'node:url';\nimport {promisify} from 'node:util';\nimport childProcess from 'node:child_process';\nimport fs, {constants as fsConstants} from 'node:fs/promises';\nimport {isWsl, powerShellPath} from 'wsl-utils';\nimport defineLazyProperty from 'define-lazy-prop';\nimport defaultBrowser from 'default-browser';\nimport isInsideContainer from 'is-inside-container';\n\nconst execFile = promisify(childProcess.execFile);\n\n// Path to included `xdg-open`.\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\nconst localXdgOpenPath = path.join(__dirname, 'xdg-open');\n\nconst {platform, arch} = process;\n\n/**\nGet the default browser name in Windows from WSL.\n\n@returns {Promise<string>} Browser name.\n*/\nasync function getWindowsDefaultBrowserFromWsl() {\n\tconst powershellPath = await powerShellPath();\n\tconst rawCommand = String.raw`(Get-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice\").ProgId`;\n\tconst encodedCommand = Buffer.from(rawCommand, 'utf16le').toString('base64');\n\n\tconst {stdout} = await execFile(\n\t\tpowershellPath,\n\t\t[\n\t\t\t'-NoProfile',\n\t\t\t'-NonInteractive',\n\t\t\t'-ExecutionPolicy',\n\t\t\t'Bypass',\n\t\t\t'-EncodedCommand',\n\t\t\tencodedCommand,\n\t\t],\n\t\t{encoding: 'utf8'},\n\t);\n\n\tconst progId = stdout.trim();\n\n\t// Map ProgId to browser IDs\n\tconst browserMap = {\n\t\tChromeHTML: 'com.google.chrome',\n\t\tBraveHTML: 'com.brave.Browser',\n\t\tMSEdgeHTM: 'com.microsoft.edge',\n\t\tFirefoxURL: 'org.mozilla.firefox',\n\t};\n\n\treturn browserMap[progId] ? {id: browserMap[progId]} : {};\n}\n\nconst pTryEach = async (array, mapper) => {\n\tlet latestError;\n\n\tfor (const item of array) {\n\t\ttry {\n\t\t\treturn await mapper(item); // eslint-disable-line no-await-in-loop\n\t\t} catch (error) {\n\t\t\tlatestError = error;\n\t\t}\n\t}\n\n\tthrow latestError;\n};\n\n// eslint-disable-next-line complexity\nconst baseOpen = async options => {\n\toptions = {\n\t\twait: false,\n\t\tbackground: false,\n\t\tnewInstance: false,\n\t\tallowNonzeroExitCode: false,\n\t\t...options,\n\t};\n\n\tif (Array.isArray(options.app)) {\n\t\treturn pTryEach(options.app, singleApp => baseOpen({\n\t\t\t...options,\n\t\t\tapp: singleApp,\n\t\t}));\n\t}\n\n\tlet {name: app, arguments: appArguments = []} = options.app ?? {};\n\tappArguments = [...appArguments];\n\n\tif (Array.isArray(app)) {\n\t\treturn pTryEach(app, appName => baseOpen({\n\t\t\t...options,\n\t\t\tapp: {\n\t\t\t\tname: appName,\n\t\t\t\targuments: appArguments,\n\t\t\t},\n\t\t}));\n\t}\n\n\tif (app === 'browser' || app === 'browserPrivate') {\n\t\t// IDs from default-browser for macOS and windows are the same\n\t\tconst ids = {\n\t\t\t'com.google.chrome': 'chrome',\n\t\t\t'google-chrome.desktop': 'chrome',\n\t\t\t'com.brave.Browser': 'brave',\n\t\t\t'org.mozilla.firefox': 'firefox',\n\t\t\t'firefox.desktop': 'firefox',\n\t\t\t'com.microsoft.msedge': 'edge',\n\t\t\t'com.microsoft.edge': 'edge',\n\t\t\t'com.microsoft.edgemac': 'edge',\n\t\t\t'microsoft-edge.desktop': 'edge',\n\t\t};\n\n\t\t// Incognito flags for each browser in `apps`.\n\t\tconst flags = {\n\t\t\tchrome: '--incognito',\n\t\t\tbrave: '--incognito',\n\t\t\tfirefox: '--private-window',\n\t\t\tedge: '--inPrivate',\n\t\t};\n\n\t\tconst browser = isWsl ? await getWindowsDefaultBrowserFromWsl() : await defaultBrowser();\n\t\tif (browser.id in ids) {\n\t\t\tconst browserName = ids[browser.id];\n\n\t\t\tif (app === 'browserPrivate') {\n\t\t\t\tappArguments.push(flags[browserName]);\n\t\t\t}\n\n\t\t\treturn baseOpen({\n\t\t\t\t...options,\n\t\t\t\tapp: {\n\t\t\t\t\tname: apps[browserName],\n\t\t\t\t\targuments: appArguments,\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\tthrow new Error(`${browser.name} is not supported as a default browser`);\n\t}\n\n\tlet command;\n\tconst cliArguments = [];\n\tconst childProcessOptions = {};\n\n\tif (platform === 'darwin') {\n\t\tcommand = 'open';\n\n\t\tif (options.wait) {\n\t\t\tcliArguments.push('--wait-apps');\n\t\t}\n\n\t\tif (options.background) {\n\t\t\tcliArguments.push('--background');\n\t\t}\n\n\t\tif (options.newInstance) {\n\t\t\tcliArguments.push('--new');\n\t\t}\n\n\t\tif (app) {\n\t\t\tcliArguments.push('-a', app);\n\t\t}\n\t} else if (platform === 'win32' || (isWsl && !isInsideContainer() && !app)) {\n\t\tcommand = await powerShellPath();\n\n\t\tcliArguments.push(\n\t\t\t'-NoProfile',\n\t\t\t'-NonInteractive',\n\t\t\t'-ExecutionPolicy',\n\t\t\t'Bypass',\n\t\t\t'-EncodedCommand',\n\t\t);\n\n\t\tif (!isWsl) {\n\t\t\tchildProcessOptions.windowsVerbatimArguments = true;\n\t\t}\n\n\t\tconst encodedArguments = ['Start'];\n\n\t\tif (options.wait) {\n\t\t\tencodedArguments.push('-Wait');\n\t\t}\n\n\t\tif (app) {\n\t\t\t// Double quote with double quotes to ensure the inner quotes are passed through.\n\t\t\t// Inner quotes are delimited for PowerShell interpretation with backticks.\n\t\t\tencodedArguments.push(`\"\\`\"${app}\\`\"\"`);\n\t\t\tif (options.target) {\n\t\t\t\tappArguments.push(options.target);\n\t\t\t}\n\t\t} else if (options.target) {\n\t\t\tencodedArguments.push(`\"${options.target}\"`);\n\t\t}\n\n\t\tif (appArguments.length > 0) {\n\t\t\tappArguments = appArguments.map(argument => `\"\\`\"${argument}\\`\"\"`);\n\t\t\tencodedArguments.push('-ArgumentList', appArguments.join(','));\n\t\t}\n\n\t\t// Using Base64-encoded command, accepted by PowerShell, to allow special characters.\n\t\toptions.target = Buffer.from(encodedArguments.join(' '), 'utf16le').toString('base64');\n\t} else {\n\t\tif (app) {\n\t\t\tcommand = app;\n\t\t} else {\n\t\t\t// When bundled by Webpack, there's no actual package file path and no local `xdg-open`.\n\t\t\tconst isBundled = !__dirname || __dirname === '/';\n\n\t\t\t// Check if local `xdg-open` exists and is executable.\n\t\t\tlet exeLocalXdgOpen = false;\n\t\t\ttry {\n\t\t\t\tawait fs.access(localXdgOpenPath, fsConstants.X_OK);\n\t\t\t\texeLocalXdgOpen = true;\n\t\t\t} catch {}\n\n\t\t\tconst useSystemXdgOpen = process.versions.electron\n\t\t\t\t?? (platform === 'android' || isBundled || !exeLocalXdgOpen);\n\t\t\tcommand = useSystemXdgOpen ? 'xdg-open' : localXdgOpenPath;\n\t\t}\n\n\t\tif (appArguments.length > 0) {\n\t\t\tcliArguments.push(...appArguments);\n\t\t}\n\n\t\tif (!options.wait) {\n\t\t\t// `xdg-open` will block the process unless stdio is ignored\n\t\t\t// and it's detached from the parent even if it's unref'd.\n\t\t\tchildProcessOptions.stdio = 'ignore';\n\t\t\tchildProcessOptions.detached = true;\n\t\t}\n\t}\n\n\tif (platform === 'darwin' && appArguments.length > 0) {\n\t\tcliArguments.push('--args', ...appArguments);\n\t}\n\n\t// This has to come after `--args`.\n\tif (options.target) {\n\t\tcliArguments.push(options.target);\n\t}\n\n\tconst subprocess = childProcess.spawn(command, cliArguments, childProcessOptions);\n\n\tif (options.wait) {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tsubprocess.once('error', reject);\n\n\t\t\tsubprocess.once('close', exitCode => {\n\t\t\t\tif (!options.allowNonzeroExitCode && exitCode > 0) {\n\t\t\t\t\treject(new Error(`Exited with code ${exitCode}`));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tresolve(subprocess);\n\t\t\t});\n\t\t});\n\t}\n\n\tsubprocess.unref();\n\n\treturn subprocess;\n};\n\nconst open = (target, options) => {\n\tif (typeof target !== 'string') {\n\t\tthrow new TypeError('Expected a `target`');\n\t}\n\n\treturn baseOpen({\n\t\t...options,\n\t\ttarget,\n\t});\n};\n\nexport const openApp = (name, options) => {\n\tif (typeof name !== 'string' && !Array.isArray(name)) {\n\t\tthrow new TypeError('Expected a valid `name`');\n\t}\n\n\tconst {arguments: appArguments = []} = options ?? {};\n\tif (appArguments !== undefined && appArguments !== null && !Array.isArray(appArguments)) {\n\t\tthrow new TypeError('Expected `appArguments` as Array type');\n\t}\n\n\treturn baseOpen({\n\t\t...options,\n\t\tapp: {\n\t\t\tname,\n\t\t\targuments: appArguments,\n\t\t},\n\t});\n};\n\nfunction detectArchBinary(binary) {\n\tif (typeof binary === 'string' || Array.isArray(binary)) {\n\t\treturn binary;\n\t}\n\n\tconst {[arch]: archBinary} = binary;\n\n\tif (!archBinary) {\n\t\tthrow new Error(`${arch} is not supported`);\n\t}\n\n\treturn archBinary;\n}\n\nfunction detectPlatformBinary({[platform]: platformBinary}, {wsl}) {\n\tif (wsl && isWsl) {\n\t\treturn detectArchBinary(wsl);\n\t}\n\n\tif (!platformBinary) {\n\t\tthrow new Error(`${platform} is not supported`);\n\t}\n\n\treturn detectArchBinary(platformBinary);\n}\n\nexport const apps = {};\n\ndefineLazyProperty(apps, 'chrome', () => detectPlatformBinary({\n\tdarwin: 'google chrome',\n\twin32: 'chrome',\n\tlinux: ['google-chrome', 'google-chrome-stable', 'chromium'],\n}, {\n\twsl: {\n\t\tia32: '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe',\n\t\tx64: ['/mnt/c/Program Files/Google/Chrome/Application/chrome.exe', '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe'],\n\t},\n}));\n\ndefineLazyProperty(apps, 'brave', () => detectPlatformBinary({\n\tdarwin: 'brave browser',\n\twin32: 'brave',\n\tlinux: ['brave-browser', 'brave'],\n}, {\n\twsl: {\n\t\tia32: '/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe',\n\t\tx64: ['/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe', '/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe'],\n\t},\n}));\n\ndefineLazyProperty(apps, 'firefox', () => detectPlatformBinary({\n\tdarwin: 'firefox',\n\twin32: String.raw`C:\\Program Files\\Mozilla Firefox\\firefox.exe`,\n\tlinux: 'firefox',\n}, {\n\twsl: '/mnt/c/Program Files/Mozilla Firefox/firefox.exe',\n}));\n\ndefineLazyProperty(apps, 'edge', () => detectPlatformBinary({\n\tdarwin: 'microsoft edge',\n\twin32: 'msedge',\n\tlinux: ['microsoft-edge', 'microsoft-edge-dev'],\n}, {\n\twsl: '/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe',\n}));\n\ndefineLazyProperty(apps, 'browser', () => 'browser');\n\ndefineLazyProperty(apps, 'browserPrivate', () => 'browserPrivate');\n\nexport default open;\n"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10],"mappings":";;;;;;;;;;;;;AAEA,IAAI;AAEJ,SAAS,eAAe;AACvB,KAAI;AACH,KAAG,SAAS,cAAc;AAC1B,SAAO;SACA;AACP,SAAO;;;AAIT,SAAS,kBAAkB;AAC1B,KAAI;AACH,SAAO,GAAG,aAAa,qBAAqB,OAAO,CAAC,SAAS,SAAS;SAC/D;AACP,SAAO;;;AAIT,SAAwB,WAAW;AAElC,KAAI,mBAAmB,OACtB,kBAAiB,cAAc,IAAI,iBAAiB;AAGrD,QAAO;;;;;ACxBR,IAAI;AAGJ,MAAM,wBAAwB;AAC7B,KAAI;AACH,KAAG,SAAS,qBAAqB;AACjC,SAAO;SACA;AACP,SAAO;;;AAIT,SAAwB,oBAAoB;AAE3C,KAAI,iBAAiB,OACpB,gBAAe,iBAAiB,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;AAGhD,QAAO,iBAAiB,eAAe;;AAGxC,MAAa,OAAO,EAAE;AAEtB,mBAAmB,MAAM,gBAAgB,qBAAqB;CAC7D,QAAQ;CACR,OAAO;CACP,OAAO;EAAC;EAAiB;EAAwB;EAAW;CAC5D,EAAE,EACF,KAAK;CACJ,MAAM;CACN,KAAK,CAAC,6DAA6D,kEAAkE;CACrI,EACD,CAAC,CAAC;AAEH,mBAAmB,MAAM,eAAe,qBAAqB;CAC5D,QAAQ;CACR,OAAO;CACP,OAAO,CAAC,iBAAiB,QAAQ;CACjC,EAAE,EACF,KAAK;CACJ,MAAM;CACN,KAAK,CAAC,0EAA0E,+EAA+E;CAC/J,EACD,CAAC,CAAC;AAEH,mBAAmB,MAAM,iBAAiB,qBAAqB;CAC9D,QAAQ;CACR,OAAO,OAAO,GAAG;CACjB,OAAO;CACP,EAAE,EACF,KAAK,oDACL,CAAC,CAAC;AAEH,mBAAmB,MAAM,cAAc,qBAAqB;CAC3D,QAAQ;CACR,OAAO;CACP,OAAO,CAAC,kBAAkB,qBAAqB;CAC/C,EAAE,EACF,KAAK,oEACL,CAAC,CAAC;AAEH,mBAAmB,MAAM,iBAAiB,UAAU;AAEpD,mBAAmB,MAAM,wBAAwB,iBAAiB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maria_rcks/t1code",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "Terminal-first T3 Code fork with an OpenTUI client",
5
5
  "homepage": "https://github.com/maria-rcks/t1code#readme",
6
6
  "bugs": {
@@ -34,8 +34,14 @@
34
34
  "test": "vitest run --passWithNoTests"
35
35
  },
36
36
  "dependencies": {
37
+ "@anthropic-ai/claude-agent-sdk": "^0.2.77",
38
+ "@effect/platform-node": "https://pkg.pr.new/Effect-TS/effect-smol/@effect/platform-node@8881a9b",
37
39
  "@opentui/core": "^0.1.90",
38
40
  "@opentui/react": "^0.1.90",
41
+ "@pierre/diffs": "^1.1.0-beta.16",
42
+ "effect": "https://pkg.pr.new/Effect-TS/effect-smol/effect@8881a9b",
43
+ "node-pty": "^1.1.0",
44
+ "open": "^10.1.0",
39
45
  "react": "^19.0.0",
40
46
  "react-devtools-core": "^7.0.1",
41
47
  "ws": "^8.18.0"
@@ -51,6 +57,7 @@
51
57
  "vitest": "catalog:"
52
58
  },
53
59
  "engines": {
54
- "bun": ">=1.3.9"
60
+ "bun": ">=1.3.9",
61
+ "node": "^22.16 || ^23.11 || >=24.10"
55
62
  }
56
63
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"BunPTY-BulfMn1P.cjs","names":["Layer","PtyAdapter","Effect"],"sources":["../src/terminal/Layers/BunPTY.ts"],"sourcesContent":["import { Effect, Layer } from \"effect\";\nimport { PtyAdapter, PtyAdapterShape, PtyExitEvent, PtyProcess } from \"../Services/PTY\";\n\nclass BunPtyProcess implements PtyProcess {\n private readonly dataListeners = new Set<(data: string) => void>();\n private readonly exitListeners = new Set<(event: PtyExitEvent) => void>();\n private readonly decoder = new TextDecoder();\n private didExit = false;\n\n constructor(private readonly process: Bun.Subprocess) {\n void this.process.exited\n .then((exitCode) => {\n this.emitExit({\n exitCode: Number.isInteger(exitCode) ? exitCode : 0,\n signal: typeof this.process.signalCode === \"number\" ? this.process.signalCode : null,\n });\n })\n .catch(() => {\n this.emitExit({ exitCode: 1, signal: null });\n });\n }\n\n get pid(): number {\n return this.process.pid;\n }\n\n write(data: string): void {\n if (!this.process.terminal) {\n throw new Error(\"Bun PTY terminal handle is unavailable\");\n }\n this.process.terminal.write(data);\n }\n\n resize(cols: number, rows: number): void {\n if (!this.process.terminal?.resize) {\n throw new Error(\"Bun PTY resize is unavailable\");\n }\n this.process.terminal.resize(cols, rows);\n }\n\n kill(signal?: string): void {\n if (!signal) {\n this.process.kill();\n return;\n }\n this.process.kill(signal as NodeJS.Signals);\n }\n\n onData(callback: (data: string) => void): () => void {\n this.dataListeners.add(callback);\n return () => {\n this.dataListeners.delete(callback);\n };\n }\n\n onExit(callback: (event: PtyExitEvent) => void): () => void {\n this.exitListeners.add(callback);\n return () => {\n this.exitListeners.delete(callback);\n };\n }\n\n emitData(data: Uint8Array): void {\n if (this.didExit) return;\n const text = this.decoder.decode(data, { stream: true });\n if (text.length === 0) return;\n for (const listener of this.dataListeners) {\n listener(text);\n }\n }\n\n private emitExit(event: PtyExitEvent): void {\n if (this.didExit) return;\n this.didExit = true;\n\n const remainder = this.decoder.decode();\n if (remainder.length > 0) {\n for (const listener of this.dataListeners) {\n listener(remainder);\n }\n }\n\n for (const listener of this.exitListeners) {\n listener(event);\n }\n }\n}\n\nexport const layer = Layer.effect(\n PtyAdapter,\n Effect.gen(function* () {\n if (process.platform === \"win32\") {\n return yield* Effect.die(\n \"Bun PTY terminal support is unavailable on Windows. Please use Node.js (e.g. by running `npx t3`) instead.\",\n );\n }\n return {\n spawn: (input) =>\n Effect.sync(() => {\n let processHandle: BunPtyProcess | null = null;\n const command = [input.shell, ...(input.args ?? [])];\n const subprocess = Bun.spawn(command, {\n cwd: input.cwd,\n env: input.env,\n terminal: {\n cols: input.cols,\n rows: input.rows,\n data: (_terminal, data) => {\n processHandle?.emitData(data);\n },\n },\n });\n processHandle = new BunPtyProcess(subprocess);\n return processHandle;\n }),\n } satisfies PtyAdapterShape;\n }),\n);\n"],"mappings":";;;;;;AAGA,IAAM,gBAAN,MAA0C;CACxC,AAAiB,gCAAgB,IAAI,KAA6B;CAClE,AAAiB,gCAAgB,IAAI,KAAoC;CACzE,AAAiB,UAAU,IAAI,aAAa;CAC5C,AAAQ,UAAU;CAElB,YAAY,AAAiB,SAAyB;EAAzB;AAC3B,EAAK,KAAK,QAAQ,OACf,MAAM,aAAa;AAClB,QAAK,SAAS;IACZ,UAAU,OAAO,UAAU,SAAS,GAAG,WAAW;IAClD,QAAQ,OAAO,KAAK,QAAQ,eAAe,WAAW,KAAK,QAAQ,aAAa;IACjF,CAAC;IACF,CACD,YAAY;AACX,QAAK,SAAS;IAAE,UAAU;IAAG,QAAQ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,IAAI,gBAAsC;EAC1C,MAAM,UAAU,CAAC,MAAM,OAAO,GAAI,MAAM,QAAQ,EAAE,CAAE;AAYpD,kBAAgB,IAAI,cAXD,IAAI,MAAM,SAAS;GACpC,KAAK,MAAM;GACX,KAAK,MAAM;GACX,UAAU;IACR,MAAM,MAAM;IACZ,MAAM,MAAM;IACZ,OAAO,WAAW,SAAS;AACzB,oBAAe,SAAS,KAAK;;IAEhC;GACF,CAAC,CAC2C;AAC7C,SAAO;GACP,EACL;EACD,CACH"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"BunPTY-Cueq2gzZ.mjs","names":[],"sources":["../src/terminal/Layers/BunPTY.ts"],"sourcesContent":["import { Effect, Layer } from \"effect\";\nimport { PtyAdapter, PtyAdapterShape, PtyExitEvent, PtyProcess } from \"../Services/PTY\";\n\nclass BunPtyProcess implements PtyProcess {\n private readonly dataListeners = new Set<(data: string) => void>();\n private readonly exitListeners = new Set<(event: PtyExitEvent) => void>();\n private readonly decoder = new TextDecoder();\n private didExit = false;\n\n constructor(private readonly process: Bun.Subprocess) {\n void this.process.exited\n .then((exitCode) => {\n this.emitExit({\n exitCode: Number.isInteger(exitCode) ? exitCode : 0,\n signal: typeof this.process.signalCode === \"number\" ? this.process.signalCode : null,\n });\n })\n .catch(() => {\n this.emitExit({ exitCode: 1, signal: null });\n });\n }\n\n get pid(): number {\n return this.process.pid;\n }\n\n write(data: string): void {\n if (!this.process.terminal) {\n throw new Error(\"Bun PTY terminal handle is unavailable\");\n }\n this.process.terminal.write(data);\n }\n\n resize(cols: number, rows: number): void {\n if (!this.process.terminal?.resize) {\n throw new Error(\"Bun PTY resize is unavailable\");\n }\n this.process.terminal.resize(cols, rows);\n }\n\n kill(signal?: string): void {\n if (!signal) {\n this.process.kill();\n return;\n }\n this.process.kill(signal as NodeJS.Signals);\n }\n\n onData(callback: (data: string) => void): () => void {\n this.dataListeners.add(callback);\n return () => {\n this.dataListeners.delete(callback);\n };\n }\n\n onExit(callback: (event: PtyExitEvent) => void): () => void {\n this.exitListeners.add(callback);\n return () => {\n this.exitListeners.delete(callback);\n };\n }\n\n emitData(data: Uint8Array): void {\n if (this.didExit) return;\n const text = this.decoder.decode(data, { stream: true });\n if (text.length === 0) return;\n for (const listener of this.dataListeners) {\n listener(text);\n }\n }\n\n private emitExit(event: PtyExitEvent): void {\n if (this.didExit) return;\n this.didExit = true;\n\n const remainder = this.decoder.decode();\n if (remainder.length > 0) {\n for (const listener of this.dataListeners) {\n listener(remainder);\n }\n }\n\n for (const listener of this.exitListeners) {\n listener(event);\n }\n }\n}\n\nexport const layer = Layer.effect(\n PtyAdapter,\n Effect.gen(function* () {\n if (process.platform === \"win32\") {\n return yield* Effect.die(\n \"Bun PTY terminal support is unavailable on Windows. Please use Node.js (e.g. by running `npx t3`) instead.\",\n );\n }\n return {\n spawn: (input) =>\n Effect.sync(() => {\n let processHandle: BunPtyProcess | null = null;\n const command = [input.shell, ...(input.args ?? [])];\n const subprocess = Bun.spawn(command, {\n cwd: input.cwd,\n env: input.env,\n terminal: {\n cols: input.cols,\n rows: input.rows,\n data: (_terminal, data) => {\n processHandle?.emitData(data);\n },\n },\n });\n processHandle = new BunPtyProcess(subprocess);\n return processHandle;\n }),\n } satisfies PtyAdapterShape;\n }),\n);\n"],"mappings":";;;;;;AAGA,IAAM,gBAAN,MAA0C;CACxC,AAAiB,gCAAgB,IAAI,KAA6B;CAClE,AAAiB,gCAAgB,IAAI,KAAoC;CACzE,AAAiB,UAAU,IAAI,aAAa;CAC5C,AAAQ,UAAU;CAElB,YAAY,AAAiB,SAAyB;EAAzB;AAC3B,EAAK,KAAK,QAAQ,OACf,MAAM,aAAa;AAClB,QAAK,SAAS;IACZ,UAAU,OAAO,UAAU,SAAS,GAAG,WAAW;IAClD,QAAQ,OAAO,KAAK,QAAQ,eAAe,WAAW,KAAK,QAAQ,aAAa;IACjF,CAAC;IACF,CACD,YAAY;AACX,QAAK,SAAS;IAAE,UAAU;IAAG,QAAQ;IAAM,CAAC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C1C,MAAM,UAAU,CAAC,MAAM,OAAO,GAAI,MAAM,QAAQ,EAAE,CAAE;AAYpD,kBAAgB,IAAI,cAXD,IAAI,MAAM,SAAS;GACpC,KAAK,MAAM;GACX,KAAK,MAAM;GACX,UAAU;IACR,MAAM,MAAM;IACZ,MAAM,MAAM;IACZ,OAAO,WAAW,SAAS;AACzB,oBAAe,SAAS,KAAK;;IAEhC;GACF,CAAC,CAC2C;AAC7C,SAAO;GACP,EACL;EACD,CACH"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"NodePTY-AdcStdsu.mjs","names":[],"sources":["../src/terminal/Layers/NodePTY.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\n\nimport { Effect, FileSystem, Layer, Path } from \"effect\";\nimport { PtyAdapter, PtyAdapterShape, PtyExitEvent, PtyProcess } from \"../Services/PTY\";\n\nlet didEnsureSpawnHelperExecutable = false;\n\nconst resolveNodePtySpawnHelperPath = Effect.gen(function* () {\n const requireForNodePty = createRequire(import.meta.url);\n const path = yield* Path.Path;\n const fs = yield* FileSystem.FileSystem;\n\n const packageJsonPath = requireForNodePty.resolve(\"node-pty/package.json\");\n const packageDir = path.dirname(packageJsonPath);\n const candidates = [\n path.join(packageDir, \"build\", \"Release\", \"spawn-helper\"),\n path.join(packageDir, \"build\", \"Debug\", \"spawn-helper\"),\n path.join(packageDir, \"prebuilds\", `${process.platform}-${process.arch}`, \"spawn-helper\"),\n ];\n\n for (const candidate of candidates) {\n if (yield* fs.exists(candidate)) {\n return candidate;\n }\n }\n return null;\n}).pipe(Effect.orElseSucceed(() => null));\n\nexport const ensureNodePtySpawnHelperExecutable = Effect.fn(function* (explicitPath?: string) {\n const fs = yield* FileSystem.FileSystem;\n if (process.platform === \"win32\") return;\n if (!explicitPath && didEnsureSpawnHelperExecutable) return;\n\n const helperPath = explicitPath ?? (yield* resolveNodePtySpawnHelperPath);\n if (!helperPath) return;\n if (!explicitPath) {\n didEnsureSpawnHelperExecutable = true;\n }\n\n if (!(yield* fs.exists(helperPath))) {\n return;\n }\n\n // Best-effort: avoid FileSystem.stat in packaged mode where some fs metadata can be missing.\n yield* fs.chmod(helperPath, 0o755).pipe(Effect.orElseSucceed(() => undefined));\n});\n\nclass NodePtyProcess implements PtyProcess {\n constructor(private readonly process: import(\"node-pty\").IPty) {}\n\n get pid(): number {\n return this.process.pid;\n }\n\n write(data: string): void {\n this.process.write(data);\n }\n\n resize(cols: number, rows: number): void {\n this.process.resize(cols, rows);\n }\n\n kill(signal?: string): void {\n this.process.kill(signal);\n }\n\n onData(callback: (data: string) => void): () => void {\n const disposable = this.process.onData(callback);\n return () => {\n disposable.dispose();\n };\n }\n\n onExit(callback: (event: PtyExitEvent) => void): () => void {\n const disposable = this.process.onExit((event) => {\n callback({\n exitCode: event.exitCode,\n signal: event.signal ?? null,\n });\n });\n return () => {\n disposable.dispose();\n };\n }\n}\n\nexport const layer = Layer.effect(\n PtyAdapter,\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n\n const nodePty = yield* Effect.promise(() => import(\"node-pty\"));\n\n const ensureNodePtySpawnHelperExecutableCached = yield* Effect.cached(\n ensureNodePtySpawnHelperExecutable().pipe(\n Effect.provideService(FileSystem.FileSystem, fs),\n Effect.provideService(Path.Path, path),\n Effect.orElseSucceed(() => undefined),\n ),\n );\n\n return {\n spawn: Effect.fn(function* (input) {\n yield* ensureNodePtySpawnHelperExecutableCached;\n const ptyProcess = nodePty.spawn(input.shell, input.args ?? [], {\n cwd: input.cwd,\n cols: input.cols,\n rows: input.rows,\n env: input.env,\n name: globalThis.process.platform === \"win32\" ? \"xterm-color\" : \"xterm-256color\",\n });\n return new NodePtyProcess(ptyProcess);\n }),\n } satisfies PtyAdapterShape;\n }),\n);\n"],"mappings":";;;;;;;AAKA,IAAI,iCAAiC;AAErC,MAAM,gCAAgC,OAAO,IAAI,aAAa;CAC5D,MAAM,oBAAoB,cAAc,OAAO,KAAK,IAAI;CACxD,MAAM,OAAO,OA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QAAQ,UAAU;AAChD,YAAS;IACP,UAAU,MAAM;IAChB,QAAQ,MAAM,UAAU;IACzB,CAAC;IACF;AACF,eAAa;AACX,cAAW,SAAS;;;;AAK1B,MAAa,QAAQ,MAAM,OACzB,YACA,OAAO,IAAI,aAAa;CACtB,MAAM,KAAK,OAAO,WAAW;CAC7B,MAAM,OAAO,OAAO,KAAK;CAEzB,MAAM,UAAU,OAAO,OAAO,cAAc,OAAO,YAAY;CAE/D,MAAM,2CAA2C,OAAO,OAAO,OAC7D,oCAAoC,CAAC,KACnC,OAAO,eAAe,WAAW,YAAY,GAAG,EAChD,OAAO,eAAe,KAAK,MAAM,KAAK,EACtC,OAAO,oBAAoB,OAAU,CACtC,CACF;AAED,QAAO,EACL,OAAO,OAAO,GAAG,WAAW,OAAO;AACjC,SAAO;AAQP,SAAO,IAAI,eAPQ,QAAQ,MAAM,MAAM,OAAO,MAAM,QAAQ,EAAE,EAAE;GAC9D,KAAK,MAAM;GACX,MAAM,MAAM;GACZ,MAAM,MAAM;GACZ,KAAK,MAAM;GACX,MAAM,WAAW,QAAQ,aAAa,UAAU,gBAAgB;GACjE,CAAC,CACmC;GACrC,EACH;EACD,CACH"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"NodePTY-DmqnQV86.cjs","names":["Effect","Path","FileSystem","Layer","PtyAdapter"],"sources":["../src/terminal/Layers/NodePTY.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\n\nimport { Effect, FileSystem, Layer, Path } from \"effect\";\nimport { PtyAdapter, PtyAdapterShape, PtyExitEvent, PtyProcess } from \"../Services/PTY\";\n\nlet didEnsureSpawnHelperExecutable = false;\n\nconst resolveNodePtySpawnHelperPath = Effect.gen(function* () {\n const requireForNodePty = createRequire(import.meta.url);\n const path = yield* Path.Path;\n const fs = yield* FileSystem.FileSystem;\n\n const packageJsonPath = requireForNodePty.resolve(\"node-pty/package.json\");\n const packageDir = path.dirname(packageJsonPath);\n const candidates = [\n path.join(packageDir, \"build\", \"Release\", \"spawn-helper\"),\n path.join(packageDir, \"build\", \"Debug\", \"spawn-helper\"),\n path.join(packageDir, \"prebuilds\", `${process.platform}-${process.arch}`, \"spawn-helper\"),\n ];\n\n for (const candidate of candidates) {\n if (yield* fs.exists(candidate)) {\n return candidate;\n }\n }\n return null;\n}).pipe(Effect.orElseSucceed(() => null));\n\nexport const ensureNodePtySpawnHelperExecutable = Effect.fn(function* (explicitPath?: string) {\n const fs = yield* FileSystem.FileSystem;\n if (process.platform === \"win32\") return;\n if (!explicitPath && didEnsureSpawnHelperExecutable) return;\n\n const helperPath = explicitPath ?? (yield* resolveNodePtySpawnHelperPath);\n if (!helperPath) return;\n if (!explicitPath) {\n didEnsureSpawnHelperExecutable = true;\n }\n\n if (!(yield* fs.exists(helperPath))) {\n return;\n }\n\n // Best-effort: avoid FileSystem.stat in packaged mode where some fs metadata can be missing.\n yield* fs.chmod(helperPath, 0o755).pipe(Effect.orElseSucceed(() => undefined));\n});\n\nclass NodePtyProcess implements PtyProcess {\n constructor(private readonly process: import(\"node-pty\").IPty) {}\n\n get pid(): number {\n return this.process.pid;\n }\n\n write(data: string): void {\n this.process.write(data);\n }\n\n resize(cols: number, rows: number): void {\n this.process.resize(cols, rows);\n }\n\n kill(signal?: string): void {\n this.process.kill(signal);\n }\n\n onData(callback: (data: string) => void): () => void {\n const disposable = this.process.onData(callback);\n return () => {\n disposable.dispose();\n };\n }\n\n onExit(callback: (event: PtyExitEvent) => void): () => void {\n const disposable = this.process.onExit((event) => {\n callback({\n exitCode: event.exitCode,\n signal: event.signal ?? null,\n });\n });\n return () => {\n disposable.dispose();\n };\n }\n}\n\nexport const layer = Layer.effect(\n PtyAdapter,\n Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n\n const nodePty = yield* Effect.promise(() => import(\"node-pty\"));\n\n const ensureNodePtySpawnHelperExecutableCached = yield* Effect.cached(\n ensureNodePtySpawnHelperExecutable().pipe(\n Effect.provideService(FileSystem.FileSystem, fs),\n Effect.provideService(Path.Path, path),\n Effect.orElseSucceed(() => undefined),\n ),\n );\n\n return {\n spawn: Effect.fn(function* (input) {\n yield* ensureNodePtySpawnHelperExecutableCached;\n const ptyProcess = nodePty.spawn(input.shell, input.args ?? [], {\n cwd: input.cwd,\n cols: input.cols,\n rows: input.rows,\n env: input.env,\n name: globalThis.process.platform === \"win32\" ? \"xterm-color\" : \"xterm-256color\",\n });\n return new NodePtyProcess(ptyProcess);\n }),\n } satisfies PtyAdapterShape;\n }),\n);\n"],"mappings":";;;;;;;AAKA,IAAI,iCAAiC;AAErC,MAAM,gCAAgCA,cAAO,IAAI,aAAa;CAC5D,MAAM,iGAAkD;CACxD,MAAM,OAAO,OAAOC,YAAK;CACzB,MAAM,KAAK,OAAOC,kBAAW;CAE7B,MAAM,kBAAkB,kBAAkB,QAAQ,wBAAwB;CAC1E,MAAM,aAAa,KAAK,QAAQ,gBAAgB;CAChD,MAAM,aAAa;EACjB,KAAK,KAAK,YAAY,SAAS,WAAW,eAAe;EACzD,KAAK,KAAK,YAAY,SAAS,SAAS,eAAe;EACvD,KAAK,KAAK,YAAY,aAAa,GAAG,QAAQ,SAAS,GAAG,QAAQ,QAAQ,eAAe;EAC1F;AAED,MAAK,MAAM,aAAa,WACtB,KAAI,OAAO,GAAG,OAAO,UAAU,CAC7B,QAAO;AAGX,QAAO;EACP,CAAC,KAAKF,cAAO,oBAAoB,KAAK,CAAC;AAEzC,MAAa,qCAAqCA,cAAO,GAAG,WAAW,cAAuB;CAC5F,MAAM,KAAK,OAAOE,kBAAW;AAC7B,KAAI,QAAQ,aAAa,QAAS;AAClC,KAAI,CAAC,gBAAgB,+BAAgC;CAErD,MAAM,aAAa,iBAAiB,OAAO;AAC3C,KAAI,CAAC,WAAY;AACjB,KAAI,CAAC,aACH,kCAAiC;AAGnC,KAAI,EAAE,OAAO,GAAG,OAAO,WAAW,EAChC;AAIF,QAAO,GAAG,MAAM,YAAY,IAAM,CAAC,KAAKF,cAAO,oBA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