@akon-labs/nexus-cli 0.1.10 → 0.1.11

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 (127) hide show
  1. package/dist/cli/require-login.d.ts.map +1 -1
  2. package/dist/cli/require-login.js +2 -2
  3. package/dist/cli/require-login.js.map +1 -1
  4. package/dist/cli.js +2492 -1088
  5. package/dist/core/agent-session.d.ts +3 -1
  6. package/dist/core/agent-session.d.ts.map +1 -1
  7. package/dist/core/agent-session.js +4 -0
  8. package/dist/core/agent-session.js.map +1 -1
  9. package/dist/core/extensions/index.d.ts +1 -1
  10. package/dist/core/extensions/index.d.ts.map +1 -1
  11. package/dist/core/extensions/index.js.map +1 -1
  12. package/dist/core/extensions/loader.d.ts.map +1 -1
  13. package/dist/core/extensions/loader.js +6 -0
  14. package/dist/core/extensions/loader.js.map +1 -1
  15. package/dist/core/extensions/runner.d.ts +7 -1
  16. package/dist/core/extensions/runner.d.ts.map +1 -1
  17. package/dist/core/extensions/runner.js +14 -0
  18. package/dist/core/extensions/runner.js.map +1 -1
  19. package/dist/core/extensions/types.d.ts +18 -0
  20. package/dist/core/extensions/types.d.ts.map +1 -1
  21. package/dist/core/extensions/types.js.map +1 -1
  22. package/dist/core/graph-rail-store.d.ts +10 -0
  23. package/dist/core/graph-rail-store.d.ts.map +1 -1
  24. package/dist/core/graph-rail-store.js +9 -0
  25. package/dist/core/graph-rail-store.js.map +1 -1
  26. package/dist/core/keybindings.d.ts +2 -1
  27. package/dist/core/keybindings.d.ts.map +1 -1
  28. package/dist/core/keybindings.js +4 -1
  29. package/dist/core/keybindings.js.map +1 -1
  30. package/dist/core/tools/find.d.ts.map +1 -1
  31. package/dist/core/tools/find.js +1 -1
  32. package/dist/core/tools/find.js.map +1 -1
  33. package/dist/core/tools/grep.d.ts.map +1 -1
  34. package/dist/core/tools/grep.js +1 -1
  35. package/dist/core/tools/grep.js.map +1 -1
  36. package/dist/extensions/gitnexus/client.d.ts.map +1 -1
  37. package/dist/extensions/gitnexus/client.js +45 -14
  38. package/dist/extensions/gitnexus/client.js.map +1 -1
  39. package/dist/extensions/gitnexus/config.d.ts +15 -1
  40. package/dist/extensions/gitnexus/config.d.ts.map +1 -1
  41. package/dist/extensions/gitnexus/config.js +86 -2
  42. package/dist/extensions/gitnexus/config.js.map +1 -1
  43. package/dist/extensions/gitnexus/hub-api.d.ts +56 -0
  44. package/dist/extensions/gitnexus/hub-api.d.ts.map +1 -0
  45. package/dist/extensions/gitnexus/hub-api.js +105 -0
  46. package/dist/extensions/gitnexus/hub-api.js.map +1 -0
  47. package/dist/extensions/gitnexus/index-repo.d.ts +50 -0
  48. package/dist/extensions/gitnexus/index-repo.d.ts.map +1 -0
  49. package/dist/extensions/gitnexus/index-repo.js +162 -0
  50. package/dist/extensions/gitnexus/index-repo.js.map +1 -0
  51. package/dist/extensions/gitnexus/index.d.ts.map +1 -1
  52. package/dist/extensions/gitnexus/index.js +137 -17
  53. package/dist/extensions/gitnexus/index.js.map +1 -1
  54. package/dist/extensions/gitnexus/observatory.d.ts.map +1 -1
  55. package/dist/extensions/gitnexus/observatory.js +2 -2
  56. package/dist/extensions/gitnexus/observatory.js.map +1 -1
  57. package/dist/extensions/gitnexus/resolve.d.ts +9 -0
  58. package/dist/extensions/gitnexus/resolve.d.ts.map +1 -1
  59. package/dist/extensions/gitnexus/resolve.js +52 -2
  60. package/dist/extensions/gitnexus/resolve.js.map +1 -1
  61. package/dist/extensions/index.d.ts.map +1 -1
  62. package/dist/extensions/index.js +3 -0
  63. package/dist/extensions/index.js.map +1 -1
  64. package/dist/extensions/mcp/commands.d.ts +22 -2
  65. package/dist/extensions/mcp/commands.d.ts.map +1 -1
  66. package/dist/extensions/mcp/commands.js +201 -9
  67. package/dist/extensions/mcp/commands.js.map +1 -1
  68. package/dist/extensions/mcp/config.d.ts +2 -0
  69. package/dist/extensions/mcp/config.d.ts.map +1 -1
  70. package/dist/extensions/mcp/config.js +6 -1
  71. package/dist/extensions/mcp/config.js.map +1 -1
  72. package/dist/extensions/mcp/index.d.ts.map +1 -1
  73. package/dist/extensions/mcp/index.js +54 -5
  74. package/dist/extensions/mcp/index.js.map +1 -1
  75. package/dist/extensions/mcp/mcp-setup-panel.d.ts +63 -2
  76. package/dist/extensions/mcp/mcp-setup-panel.d.ts.map +1 -1
  77. package/dist/extensions/mcp/mcp-setup-panel.js +563 -77
  78. package/dist/extensions/mcp/mcp-setup-panel.js.map +1 -1
  79. package/dist/extensions/subagent/index.d.ts +2 -1
  80. package/dist/extensions/subagent/index.d.ts.map +1 -1
  81. package/dist/extensions/subagent/index.js +19 -6
  82. package/dist/extensions/subagent/index.js.map +1 -1
  83. package/dist/extensions/subagent-render.d.ts +3 -0
  84. package/dist/extensions/subagent-render.d.ts.map +1 -0
  85. package/dist/extensions/subagent-render.js +39 -0
  86. package/dist/extensions/subagent-render.js.map +1 -0
  87. package/dist/index.js +2524 -1120
  88. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  89. package/dist/modes/interactive/components/assistant-message.js +2 -0
  90. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  91. package/dist/modes/interactive/components/command-palette.d.ts +2 -1
  92. package/dist/modes/interactive/components/command-palette.d.ts.map +1 -1
  93. package/dist/modes/interactive/components/command-palette.js +11 -4
  94. package/dist/modes/interactive/components/command-palette.js.map +1 -1
  95. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  96. package/dist/modes/interactive/components/footer.js +9 -3
  97. package/dist/modes/interactive/components/footer.js.map +1 -1
  98. package/dist/modes/interactive/components/graph-rail.d.ts.map +1 -1
  99. package/dist/modes/interactive/components/graph-rail.js +18 -3
  100. package/dist/modes/interactive/components/graph-rail.js.map +1 -1
  101. package/dist/modes/interactive/components/keybinding-hints.d.ts +1 -0
  102. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
  103. package/dist/modes/interactive/components/keybinding-hints.js +7 -1
  104. package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
  105. package/dist/modes/interactive/components/landing-panel.d.ts.map +1 -1
  106. package/dist/modes/interactive/components/landing-panel.js +15 -2
  107. package/dist/modes/interactive/components/landing-panel.js.map +1 -1
  108. package/dist/modes/interactive/components/tool-execution.d.ts +3 -2
  109. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  110. package/dist/modes/interactive/components/tool-execution.js +12 -2
  111. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  112. package/dist/modes/interactive/interactive-mode.d.ts +3 -0
  113. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  114. package/dist/modes/interactive/interactive-mode.js +42 -8
  115. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  116. package/dist/rpc-entry.js +2492 -1088
  117. package/dist/utils/hidden-spawn.d.ts +29 -0
  118. package/dist/utils/hidden-spawn.d.ts.map +1 -0
  119. package/dist/utils/hidden-spawn.js +101 -0
  120. package/dist/utils/hidden-spawn.js.map +1 -0
  121. package/dist/vendor/ai.js +233 -233
  122. package/dist/vendor/tui.js +1 -1
  123. package/native/win32/build.mjs +95 -0
  124. package/native/win32/prebuilds/win32-x64/hidden-spawn.exe +0 -0
  125. package/native/win32/src/hidden-spawn.c +157 -0
  126. package/npm-shrinkwrap.json +2 -37
  127. package/package.json +7 -3
@@ -0,0 +1,29 @@
1
+ import { type ChildProcess, type SpawnOptions } from "node:child_process";
2
+ /**
3
+ * Windowless relauncher. See native/win32/src/hidden-spawn.c.
4
+ * The parent spawns this GUI-subsystem exe, which starts the real console
5
+ * binary with CREATE_NO_WINDOW and no SW_HIDE, so Windows never paints a console.
6
+ */
7
+ export declare const HIDDEN_SPAWN_TARGET_ENV = "NEXUS_HIDDEN_SPAWN_TARGET";
8
+ export declare const HIDDEN_SPAWN_SCRIPT_ENV = "NEXUS_HIDDEN_SPAWN_SCRIPT";
9
+ export interface HiddenSpawnOptions {
10
+ platform?: NodeJS.Platform;
11
+ /** Explicit helper path. Pass an empty string to skip the helper. */
12
+ hiddenSpawn?: string;
13
+ execPath?: string;
14
+ }
15
+ /** Locate the built helper next to this package or next to a compiled CLI binary. */
16
+ export declare function findHiddenSpawnBinary(moduleUrl?: string, execPath?: string, arch?: string): string | undefined;
17
+ /**
18
+ * Point pi-subagents' child binary at the windowless helper.
19
+ * Returns true when the helper was installed into env.
20
+ * An explicit PI_SUBAGENT_PI_BINARY is left untouched by the caller.
21
+ */
22
+ export declare function applyHiddenChildLaunch(env: NodeJS.ProcessEnv, resolved: string, binaryEnv: string, options?: HiddenSpawnOptions): boolean;
23
+ /**
24
+ * Spawn a child without a console window on Windows.
25
+ * Uses the helper when it is built; otherwise windowsHide with detached forced off,
26
+ * because DETACHED_PROCESS makes Windows ignore CREATE_NO_WINDOW.
27
+ */
28
+ export declare function spawnWithoutConsole(command: string, args: string[], options?: SpawnOptions): ChildProcess;
29
+ //# sourceMappingURL=hidden-spawn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hidden-spawn.d.ts","sourceRoot":"","sources":["../../src/utils/hidden-spawn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAS,MAAM,oBAAoB,CAAC;AAKjF;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,8BAA8B,CAAC;AACnE,eAAO,MAAM,uBAAuB,8BAA8B,CAAC;AAEnE,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC3B,qEAAqE;IACrE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAQD,qFAAqF;AACrF,wBAAgB,qBAAqB,CACpC,SAAS,GAAE,MAAwB,EACnC,QAAQ,GAAE,MAAyB,EACnC,IAAI,GAAE,MAAqB,GACzB,MAAM,GAAG,SAAS,CAmBpB;AAMD;;;;GAIG;AACH,wBAAgB,sBAAsB,CACrC,GAAG,EAAE,MAAM,CAAC,UAAU,EACtB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,kBAAuB,GAC9B,OAAO,CAkBT;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,YAAiB,GAAG,YAAY,CAwB7G","sourcesContent":["import { type ChildProcess, type SpawnOptions, spawn } from \"node:child_process\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\n/**\n * Windowless relauncher. See native/win32/src/hidden-spawn.c.\n * The parent spawns this GUI-subsystem exe, which starts the real console\n * binary with CREATE_NO_WINDOW and no SW_HIDE, so Windows never paints a console.\n */\nexport const HIDDEN_SPAWN_TARGET_ENV = \"NEXUS_HIDDEN_SPAWN_TARGET\";\nexport const HIDDEN_SPAWN_SCRIPT_ENV = \"NEXUS_HIDDEN_SPAWN_SCRIPT\";\n\nexport interface HiddenSpawnOptions {\n\tplatform?: NodeJS.Platform;\n\t/** Explicit helper path. Pass an empty string to skip the helper. */\n\thiddenSpawn?: string;\n\texecPath?: string;\n}\n\nfunction prebuildArch(arch: string): \"x64\" | \"arm64\" | undefined {\n\tif (arch === \"arm64\") return \"arm64\";\n\tif (arch === \"x64\") return \"x64\";\n\treturn undefined;\n}\n\n/** Locate the built helper next to this package or next to a compiled CLI binary. */\nexport function findHiddenSpawnBinary(\n\tmoduleUrl: string = import.meta.url,\n\texecPath: string = process.execPath,\n\tarch: string = process.arch,\n): string | undefined {\n\tconst folder = prebuildArch(arch);\n\tif (!folder) return undefined;\n\tconst relative = path.join(\"prebuilds\", `win32-${folder}`, \"hidden-spawn.exe\");\n\tconst here = path.dirname(fileURLToPath(moduleUrl));\n\tconst candidates = [\n\t\tpath.join(here, \"hidden-spawn.exe\"),\n\t\tpath.resolve(here, \"../native/win32\", relative),\n\t\tpath.resolve(here, \"../../native/win32\", relative),\n\t\tpath.resolve(here, \"../../../native/win32\", relative),\n\t\tpath.join(path.dirname(execPath), \"hidden-spawn.exe\"),\n\t];\n\treturn candidates.find((candidate) => {\n\t\ttry {\n\t\t\treturn fs.existsSync(candidate);\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t});\n}\n\nfunction isScriptPath(filePath: string): boolean {\n\treturn /\\.(?:mjs|cjs|js)$/i.test(filePath);\n}\n\n/**\n * Point pi-subagents' child binary at the windowless helper.\n * Returns true when the helper was installed into env.\n * An explicit PI_SUBAGENT_PI_BINARY is left untouched by the caller.\n */\nexport function applyHiddenChildLaunch(\n\tenv: NodeJS.ProcessEnv,\n\tresolved: string,\n\tbinaryEnv: string,\n\toptions: HiddenSpawnOptions = {},\n): boolean {\n\tconst platform = options.platform ?? process.platform;\n\tif (platform !== \"win32\") return false;\n\tconst helper =\n\t\toptions.hiddenSpawn !== undefined\n\t\t\t? options.hiddenSpawn.trim() || undefined\n\t\t\t: findHiddenSpawnBinary(import.meta.url, options.execPath ?? process.execPath);\n\tif (!helper) return false;\n\tconst execPath = options.execPath ?? process.execPath;\n\tenv[binaryEnv] = helper;\n\tif (isScriptPath(resolved)) {\n\t\tenv[HIDDEN_SPAWN_TARGET_ENV] = execPath;\n\t\tenv[HIDDEN_SPAWN_SCRIPT_ENV] = resolved;\n\t} else {\n\t\tenv[HIDDEN_SPAWN_TARGET_ENV] = resolved;\n\t\tdelete env[HIDDEN_SPAWN_SCRIPT_ENV];\n\t}\n\treturn true;\n}\n\n/**\n * Spawn a child without a console window on Windows.\n * Uses the helper when it is built; otherwise windowsHide with detached forced off,\n * because DETACHED_PROCESS makes Windows ignore CREATE_NO_WINDOW.\n */\nexport function spawnWithoutConsole(command: string, args: string[], options: SpawnOptions = {}): ChildProcess {\n\tif (process.platform !== \"win32\") {\n\t\treturn spawn(command, args, options);\n\t}\n\tconst helper = findHiddenSpawnBinary();\n\tconst env = { ...(options.env ?? process.env) };\n\tif (helper) {\n\t\tenv[HIDDEN_SPAWN_TARGET_ENV] = command;\n\t\tdelete env[HIDDEN_SPAWN_SCRIPT_ENV];\n\t\treturn spawn(helper, args, {\n\t\t\t...options,\n\t\t\tdetached: false,\n\t\t\tenv,\n\t\t\tshell: false,\n\t\t\twindowsHide: true,\n\t\t});\n\t}\n\treturn spawn(command, args, {\n\t\t...options,\n\t\tdetached: false,\n\t\tenv,\n\t\tshell: false,\n\t\twindowsHide: true,\n\t});\n}\n"]}
@@ -0,0 +1,101 @@
1
+ import { spawn } from "node:child_process";
2
+ import * as fs from "node:fs";
3
+ import * as path from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ /**
6
+ * Windowless relauncher. See native/win32/src/hidden-spawn.c.
7
+ * The parent spawns this GUI-subsystem exe, which starts the real console
8
+ * binary with CREATE_NO_WINDOW and no SW_HIDE, so Windows never paints a console.
9
+ */
10
+ export const HIDDEN_SPAWN_TARGET_ENV = "NEXUS_HIDDEN_SPAWN_TARGET";
11
+ export const HIDDEN_SPAWN_SCRIPT_ENV = "NEXUS_HIDDEN_SPAWN_SCRIPT";
12
+ function prebuildArch(arch) {
13
+ if (arch === "arm64")
14
+ return "arm64";
15
+ if (arch === "x64")
16
+ return "x64";
17
+ return undefined;
18
+ }
19
+ /** Locate the built helper next to this package or next to a compiled CLI binary. */
20
+ export function findHiddenSpawnBinary(moduleUrl = import.meta.url, execPath = process.execPath, arch = process.arch) {
21
+ const folder = prebuildArch(arch);
22
+ if (!folder)
23
+ return undefined;
24
+ const relative = path.join("prebuilds", `win32-${folder}`, "hidden-spawn.exe");
25
+ const here = path.dirname(fileURLToPath(moduleUrl));
26
+ const candidates = [
27
+ path.join(here, "hidden-spawn.exe"),
28
+ path.resolve(here, "../native/win32", relative),
29
+ path.resolve(here, "../../native/win32", relative),
30
+ path.resolve(here, "../../../native/win32", relative),
31
+ path.join(path.dirname(execPath), "hidden-spawn.exe"),
32
+ ];
33
+ return candidates.find((candidate) => {
34
+ try {
35
+ return fs.existsSync(candidate);
36
+ }
37
+ catch {
38
+ return false;
39
+ }
40
+ });
41
+ }
42
+ function isScriptPath(filePath) {
43
+ return /\.(?:mjs|cjs|js)$/i.test(filePath);
44
+ }
45
+ /**
46
+ * Point pi-subagents' child binary at the windowless helper.
47
+ * Returns true when the helper was installed into env.
48
+ * An explicit PI_SUBAGENT_PI_BINARY is left untouched by the caller.
49
+ */
50
+ export function applyHiddenChildLaunch(env, resolved, binaryEnv, options = {}) {
51
+ const platform = options.platform ?? process.platform;
52
+ if (platform !== "win32")
53
+ return false;
54
+ const helper = options.hiddenSpawn !== undefined
55
+ ? options.hiddenSpawn.trim() || undefined
56
+ : findHiddenSpawnBinary(import.meta.url, options.execPath ?? process.execPath);
57
+ if (!helper)
58
+ return false;
59
+ const execPath = options.execPath ?? process.execPath;
60
+ env[binaryEnv] = helper;
61
+ if (isScriptPath(resolved)) {
62
+ env[HIDDEN_SPAWN_TARGET_ENV] = execPath;
63
+ env[HIDDEN_SPAWN_SCRIPT_ENV] = resolved;
64
+ }
65
+ else {
66
+ env[HIDDEN_SPAWN_TARGET_ENV] = resolved;
67
+ delete env[HIDDEN_SPAWN_SCRIPT_ENV];
68
+ }
69
+ return true;
70
+ }
71
+ /**
72
+ * Spawn a child without a console window on Windows.
73
+ * Uses the helper when it is built; otherwise windowsHide with detached forced off,
74
+ * because DETACHED_PROCESS makes Windows ignore CREATE_NO_WINDOW.
75
+ */
76
+ export function spawnWithoutConsole(command, args, options = {}) {
77
+ if (process.platform !== "win32") {
78
+ return spawn(command, args, options);
79
+ }
80
+ const helper = findHiddenSpawnBinary();
81
+ const env = { ...(options.env ?? process.env) };
82
+ if (helper) {
83
+ env[HIDDEN_SPAWN_TARGET_ENV] = command;
84
+ delete env[HIDDEN_SPAWN_SCRIPT_ENV];
85
+ return spawn(helper, args, {
86
+ ...options,
87
+ detached: false,
88
+ env,
89
+ shell: false,
90
+ windowsHide: true,
91
+ });
92
+ }
93
+ return spawn(command, args, {
94
+ ...options,
95
+ detached: false,
96
+ env,
97
+ shell: false,
98
+ windowsHide: true,
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_process\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\n/**\n * Windowless relauncher. See native/win32/src/hidden-spawn.c.\n * The parent spawns this GUI-subsystem exe, which starts the real console\n * binary with CREATE_NO_WINDOW and no SW_HIDE, so Windows never paints a console.\n */\nexport const HIDDEN_SPAWN_TARGET_ENV = \"NEXUS_HIDDEN_SPAWN_TARGET\";\nexport const HIDDEN_SPAWN_SCRIPT_ENV = \"NEXUS_HIDDEN_SPAWN_SCRIPT\";\n\nexport interface HiddenSpawnOptions {\n\tplatform?: NodeJS.Platform;\n\t/** Explicit helper path. Pass an empty string to skip the helper. */\n\thiddenSpawn?: string;\n\texecPath?: string;\n}\n\nfunction prebuildArch(arch: string): \"x64\" | \"arm64\" | undefined {\n\tif (arch === \"arm64\") return \"arm64\";\n\tif (arch === \"x64\") return \"x64\";\n\treturn undefined;\n}\n\n/** Locate the built helper next to this package or next to a compiled CLI binary. */\nexport function findHiddenSpawnBinary(\n\tmoduleUrl: string = import.meta.url,\n\texecPath: string = process.execPath,\n\tarch: string = process.arch,\n): string | undefined {\n\tconst folder = prebuildArch(arch);\n\tif (!folder) return undefined;\n\tconst relative = path.join(\"prebuilds\", `win32-${folder}`, \"hidden-spawn.exe\");\n\tconst here = path.dirname(fileURLToPath(moduleUrl));\n\tconst candidates = [\n\t\tpath.join(here, \"hidden-spawn.exe\"),\n\t\tpath.resolve(here, \"../native/win32\", relative),\n\t\tpath.resolve(here, \"../../native/win32\", relative),\n\t\tpath.resolve(here, \"../../../native/win32\", relative),\n\t\tpath.join(path.dirname(execPath), \"hidden-spawn.exe\"),\n\t];\n\treturn candidates.find((candidate) => {\n\t\ttry {\n\t\t\treturn fs.existsSync(candidate);\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t});\n}\n\nfunction isScriptPath(filePath: string): boolean {\n\treturn /\\.(?:mjs|cjs|js)$/i.test(filePath);\n}\n\n/**\n * Point pi-subagents' child binary at the windowless helper.\n * Returns true when the helper was installed into env.\n * An explicit PI_SUBAGENT_PI_BINARY is left untouched by the caller.\n */\nexport function applyHiddenChildLaunch(\n\tenv: NodeJS.ProcessEnv,\n\tresolved: string,\n\tbinaryEnv: string,\n\toptions: HiddenSpawnOptions = {},\n): boolean {\n\tconst platform = options.platform ?? process.platform;\n\tif (platform !== \"win32\") return false;\n\tconst helper =\n\t\toptions.hiddenSpawn !== undefined\n\t\t\t? options.hiddenSpawn.trim() || undefined\n\t\t\t: findHiddenSpawnBinary(import.meta.url, options.execPath ?? process.execPath);\n\tif (!helper) return false;\n\tconst execPath = options.execPath ?? process.execPath;\n\tenv[binaryEnv] = helper;\n\tif (isScriptPath(resolved)) {\n\t\tenv[HIDDEN_SPAWN_TARGET_ENV] = execPath;\n\t\tenv[HIDDEN_SPAWN_SCRIPT_ENV] = resolved;\n\t} else {\n\t\tenv[HIDDEN_SPAWN_TARGET_ENV] = resolved;\n\t\tdelete env[HIDDEN_SPAWN_SCRIPT_ENV];\n\t}\n\treturn true;\n}\n\n/**\n * Spawn a child without a console window on Windows.\n * Uses the helper when it is built; otherwise windowsHide with detached forced off,\n * because DETACHED_PROCESS makes Windows ignore CREATE_NO_WINDOW.\n */\nexport function spawnWithoutConsole(command: string, args: string[], options: SpawnOptions = {}): ChildProcess {\n\tif (process.platform !== \"win32\") {\n\t\treturn spawn(command, args, options);\n\t}\n\tconst helper = findHiddenSpawnBinary();\n\tconst env = { ...(options.env ?? process.env) };\n\tif (helper) {\n\t\tenv[HIDDEN_SPAWN_TARGET_ENV] = command;\n\t\tdelete env[HIDDEN_SPAWN_SCRIPT_ENV];\n\t\treturn spawn(helper, args, {\n\t\t\t...options,\n\t\t\tdetached: false,\n\t\t\tenv,\n\t\t\tshell: false,\n\t\t\twindowsHide: true,\n\t\t});\n\t}\n\treturn spawn(command, args, {\n\t\t...options,\n\t\tdetached: false,\n\t\tenv,\n\t\tshell: false,\n\t\twindowsHide: true,\n\t});\n}\n"]}