@selesai/code 0.5.19 → 0.5.20

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.
@@ -0,0 +1,31 @@
1
+ import { createRequire } from "module";
2
+ import { describe, expect, it } from "vitest";
3
+ import { getBrokerLaunchSpec, getWindowsBrokerCommandLine } from "./spawn.ts";
4
+
5
+ const require = createRequire(import.meta.url);
6
+ const brokerPath = "C:\\broker dir\\broker.ts";
7
+ const extensionDir = "C:\\published-package\\dist\\extensions\\pi-intercom";
8
+ const nodePath = "C:\\Program Files\\nodejs\\node.exe";
9
+
10
+ describe("intercom broker launch", () => {
11
+ it("resolves default Windows tsx launcher from installed dependencies", () => {
12
+ const tsxCliPath = require.resolve("tsx/cli");
13
+
14
+ expect(getWindowsBrokerCommandLine(brokerPath, extensionDir, nodePath)).toBe(
15
+ `"${nodePath}" "${tsxCliPath}" "${brokerPath}"`,
16
+ );
17
+ expect(getWindowsBrokerCommandLine(brokerPath, extensionDir, nodePath)).not.toContain(extensionDir);
18
+ });
19
+
20
+ it("preserves custom broker commands on Windows and other platforms", () => {
21
+ expect(getWindowsBrokerCommandLine(brokerPath, extensionDir, nodePath, "broker-command", ["--port", "1234"])).toBe(
22
+ `"broker-command" "--port" "1234" "${brokerPath}"`,
23
+ );
24
+
25
+ expect(getBrokerLaunchSpec(brokerPath, "broker-command", ["--port", "1234"], extensionDir, "linux")).toEqual({
26
+ kind: "direct",
27
+ command: "broker-command",
28
+ args: ["--port", "1234", brokerPath],
29
+ });
30
+ });
31
+ });
@@ -1,10 +1,12 @@
1
1
  import { spawn } from "child_process";
2
2
  import { existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from "fs";
3
+ import { createRequire } from "module";
3
4
  import { join, dirname } from "path";
4
5
  import { fileURLToPath } from "url";
5
6
  import net from "net";
6
7
  import { getBrokerSocketPath, getIntercomDir } from "./paths.js";
7
8
 
9
+ const require = createRequire(import.meta.url);
8
10
  const INTERCOM_DIR = getIntercomDir();
9
11
  const EXTENSION_DIR = join(dirname(fileURLToPath(import.meta.url)), "..");
10
12
  const BROKER_SOCKET = getBrokerSocketPath();
@@ -29,8 +31,8 @@ function sleep(ms: number): Promise<void> {
29
31
  return new Promise(resolve => setTimeout(resolve, ms));
30
32
  }
31
33
 
32
- export function getTsxCliPath(extensionDir: string = EXTENSION_DIR): string {
33
- return join(extensionDir, "node_modules", "tsx", "dist", "cli.mjs");
34
+ export function getTsxCliPath(): string {
35
+ return require.resolve("tsx/cli");
34
36
  }
35
37
 
36
38
  function quoteWindowsArg(value: string): string {
@@ -56,7 +58,7 @@ export function getWindowsBrokerCommandLine(
56
58
  brokerArgs: string[] = ["--no-install", "tsx"],
57
59
  ): string {
58
60
  if (usesDefaultBrokerCommand(brokerCommand, brokerArgs)) {
59
- return [quoteWindowsArg(nodePath), quoteWindowsArg(getTsxCliPath(extensionDir)), quoteWindowsArg(brokerPath)].join(" ");
61
+ return [quoteWindowsArg(nodePath), quoteWindowsArg(getTsxCliPath()), quoteWindowsArg(brokerPath)].join(" ");
60
62
  }
61
63
 
62
64
  return [quoteWindowsArg(brokerCommand), ...brokerArgs.map(quoteWindowsArg), quoteWindowsArg(brokerPath)].join(" ");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@selesai/code",
3
- "version": "0.5.19",
3
+ "version": "0.5.20",
4
4
  "description": "Maintained, extension-first Pi coding agent with built-in workflows, subagents, web research, questions, skills, and an enhanced terminal UI.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -74,6 +74,7 @@
74
74
  "playwright": "^1.60.0",
75
75
  "proper-lockfile": "4.1.2",
76
76
  "semver": "7.8.0",
77
+ "tsx": "^4.20.0",
77
78
  "typebox": "1.1.38",
78
79
  "undici": "8.5.0",
79
80
  "yaml": "2.9.0"