@adhdev/daemon-standalone 0.8.13 → 0.8.15
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
|
@@ -28501,19 +28501,32 @@ var require_dist2 = __commonJS({
|
|
|
28501
28501
|
};
|
|
28502
28502
|
}
|
|
28503
28503
|
});
|
|
28504
|
+
var import_session_host_core2;
|
|
28505
|
+
var init_spawn_env = __esm2({
|
|
28506
|
+
"src/cli-adapters/spawn-env.ts"() {
|
|
28507
|
+
"use strict";
|
|
28508
|
+
import_session_host_core2 = require_dist();
|
|
28509
|
+
}
|
|
28510
|
+
});
|
|
28511
|
+
function loadNodePty() {
|
|
28512
|
+
if (cachedPty !== void 0) return cachedPty;
|
|
28513
|
+
try {
|
|
28514
|
+
cachedPty = require("node-pty");
|
|
28515
|
+
(0, import_session_host_core2.ensureNodePtySpawnHelperPermissions)();
|
|
28516
|
+
} catch {
|
|
28517
|
+
cachedPty = null;
|
|
28518
|
+
}
|
|
28519
|
+
return cachedPty;
|
|
28520
|
+
}
|
|
28504
28521
|
var os7;
|
|
28505
|
-
var
|
|
28522
|
+
var cachedPty;
|
|
28506
28523
|
var NodePtyRuntimeTransport;
|
|
28507
28524
|
var NodePtyTransportFactory;
|
|
28508
28525
|
var init_pty_transport = __esm2({
|
|
28509
28526
|
"src/cli-adapters/pty-transport.ts"() {
|
|
28510
28527
|
"use strict";
|
|
28511
28528
|
os7 = __toESM2(require("os"));
|
|
28512
|
-
|
|
28513
|
-
pty = require("node-pty");
|
|
28514
|
-
} catch {
|
|
28515
|
-
pty = null;
|
|
28516
|
-
}
|
|
28529
|
+
init_spawn_env();
|
|
28517
28530
|
NodePtyRuntimeTransport = class {
|
|
28518
28531
|
constructor(handle) {
|
|
28519
28532
|
this.handle = handle;
|
|
@@ -28544,6 +28557,7 @@ var require_dist2 = __commonJS({
|
|
|
28544
28557
|
};
|
|
28545
28558
|
NodePtyTransportFactory = class {
|
|
28546
28559
|
spawn(command, args, options) {
|
|
28560
|
+
const pty = loadNodePty();
|
|
28547
28561
|
if (!pty) throw new Error("node-pty is not installed");
|
|
28548
28562
|
let cwd = options.cwd;
|
|
28549
28563
|
if (cwd) {
|
|
@@ -28567,13 +28581,6 @@ var require_dist2 = __commonJS({
|
|
|
28567
28581
|
};
|
|
28568
28582
|
}
|
|
28569
28583
|
});
|
|
28570
|
-
var import_session_host_core2;
|
|
28571
|
-
var init_spawn_env = __esm2({
|
|
28572
|
-
"src/cli-adapters/spawn-env.ts"() {
|
|
28573
|
-
"use strict";
|
|
28574
|
-
import_session_host_core2 = require_dist();
|
|
28575
|
-
}
|
|
28576
|
-
});
|
|
28577
28584
|
var provider_cli_adapter_exports = {};
|
|
28578
28585
|
__export2(provider_cli_adapter_exports, {
|
|
28579
28586
|
ProviderCliAdapter: () => ProviderCliAdapter,
|
|
@@ -28719,7 +28726,6 @@ var require_dist2 = __commonJS({
|
|
|
28719
28726
|
var os8;
|
|
28720
28727
|
var path7;
|
|
28721
28728
|
var import_child_process4;
|
|
28722
|
-
var pty2;
|
|
28723
28729
|
var buildCliSpawnEnv;
|
|
28724
28730
|
var ProviderCliAdapter;
|
|
28725
28731
|
var init_provider_cli_adapter = __esm2({
|
|
@@ -28732,12 +28738,6 @@ var require_dist2 = __commonJS({
|
|
|
28732
28738
|
init_terminal_screen();
|
|
28733
28739
|
init_pty_transport();
|
|
28734
28740
|
init_spawn_env();
|
|
28735
|
-
try {
|
|
28736
|
-
pty2 = require("node-pty");
|
|
28737
|
-
(0, import_session_host_core2.ensureNodePtySpawnHelperPermissions)((msg) => LOG2.info("CLI", msg));
|
|
28738
|
-
} catch {
|
|
28739
|
-
LOG2.error("CLI", "[ProviderCliAdapter] node-pty not found. Terminal features disabled.");
|
|
28740
|
-
}
|
|
28741
28741
|
buildCliSpawnEnv = import_session_host_core2.sanitizeSpawnEnv;
|
|
28742
28742
|
ProviderCliAdapter = class _ProviderCliAdapter {
|
|
28743
28743
|
constructor(provider, workingDir, extraArgs = [], transportFactory = new NodePtyTransportFactory()) {
|
|
@@ -29061,13 +29061,16 @@ var require_dist2 = __commonJS({
|
|
|
29061
29061
|
let shellArgs;
|
|
29062
29062
|
const useShellUnix = !isWin && (!!spawnConfig.shell || !path7.isAbsolute(binaryPath) || isScriptBinary(binaryPath) || !looksLikeMachOOrElf(binaryPath));
|
|
29063
29063
|
const isCmdShim = isWin && /\.(cmd|bat)$/i.test(binaryPath);
|
|
29064
|
-
const
|
|
29064
|
+
const useShellWin = isCmdShim || !path7.isAbsolute(binaryPath) || isScriptBinary(binaryPath);
|
|
29065
|
+
const useShell = isWin ? useShellWin : useShellUnix;
|
|
29065
29066
|
if (useShell) {
|
|
29066
29067
|
if (!spawnConfig.shell && !isWin) {
|
|
29067
29068
|
LOG2.info("CLI", `[${this.cliType}] Using login shell (script shim or non-native binary)`);
|
|
29068
29069
|
}
|
|
29069
29070
|
if (isCmdShim) {
|
|
29070
29071
|
LOG2.info("CLI", `[${this.cliType}] Using cmd.exe shell for .cmd/.bat shim: ${binaryPath}`);
|
|
29072
|
+
} else if (isWin) {
|
|
29073
|
+
LOG2.info("CLI", `[${this.cliType}] Using cmd.exe shell on Windows: ${binaryPath}`);
|
|
29071
29074
|
}
|
|
29072
29075
|
shellCmd = isWin ? "cmd.exe" : process.env.SHELL || "/bin/zsh";
|
|
29073
29076
|
if (isWin) {
|
|
@@ -29077,6 +29080,9 @@ var require_dist2 = __commonJS({
|
|
|
29077
29080
|
shellArgs = ["-l", "-c", fullCmd];
|
|
29078
29081
|
}
|
|
29079
29082
|
} else {
|
|
29083
|
+
if (isWin && spawnConfig.shell) {
|
|
29084
|
+
LOG2.info("CLI", `[${this.cliType}] Spawning Windows binary directly without cmd.exe: ${binaryPath}`);
|
|
29085
|
+
}
|
|
29080
29086
|
shellCmd = binaryPath;
|
|
29081
29087
|
shellArgs = allArgs;
|
|
29082
29088
|
}
|
|
@@ -35079,8 +35085,24 @@ ${data.message || ""}`.trim();
|
|
|
35079
35085
|
return { success: false, error: "Failed to save setting" };
|
|
35080
35086
|
}
|
|
35081
35087
|
init_config();
|
|
35088
|
+
function loadWorkspaceConfig() {
|
|
35089
|
+
try {
|
|
35090
|
+
return loadConfig2();
|
|
35091
|
+
} catch (e) {
|
|
35092
|
+
return { error: `Could not load config: ${e?.message || "unknown error"}` };
|
|
35093
|
+
}
|
|
35094
|
+
}
|
|
35095
|
+
function persistWorkspaceConfig(config2) {
|
|
35096
|
+
try {
|
|
35097
|
+
saveConfig(config2);
|
|
35098
|
+
return { ok: true };
|
|
35099
|
+
} catch (e) {
|
|
35100
|
+
return { error: `Could not save config: ${e?.message || "unknown error"}` };
|
|
35101
|
+
}
|
|
35102
|
+
}
|
|
35082
35103
|
function handleWorkspaceList() {
|
|
35083
|
-
const config2 =
|
|
35104
|
+
const config2 = loadWorkspaceConfig();
|
|
35105
|
+
if ("error" in config2) return { success: false, error: config2.error };
|
|
35084
35106
|
const state = getWorkspaceState2(config2);
|
|
35085
35107
|
return {
|
|
35086
35108
|
success: true,
|
|
@@ -35094,31 +35116,37 @@ ${data.message || ""}`.trim();
|
|
|
35094
35116
|
const label = (args?.label || "").trim() || void 0;
|
|
35095
35117
|
const createIfMissing = args?.createIfMissing === true;
|
|
35096
35118
|
if (!rawPath) return { success: false, error: "path required" };
|
|
35097
|
-
const config2 =
|
|
35119
|
+
const config2 = loadWorkspaceConfig();
|
|
35120
|
+
if ("error" in config2) return { success: false, error: config2.error };
|
|
35098
35121
|
const result = addWorkspaceEntry(config2, rawPath, label, { createIfMissing });
|
|
35099
35122
|
if ("error" in result) return { success: false, error: result.error };
|
|
35100
|
-
|
|
35123
|
+
const saveResult = persistWorkspaceConfig(result.config);
|
|
35124
|
+
if ("error" in saveResult) return { success: false, error: saveResult.error };
|
|
35101
35125
|
const state = getWorkspaceState2(result.config);
|
|
35102
35126
|
return { success: true, entry: result.entry, ...state };
|
|
35103
35127
|
}
|
|
35104
35128
|
function handleWorkspaceRemove(args) {
|
|
35105
35129
|
const id = (args?.id || "").trim();
|
|
35106
35130
|
if (!id) return { success: false, error: "id required" };
|
|
35107
|
-
const config2 =
|
|
35131
|
+
const config2 = loadWorkspaceConfig();
|
|
35132
|
+
if ("error" in config2) return { success: false, error: config2.error };
|
|
35108
35133
|
const removed = (config2.workspaces || []).find((w) => w.id === id);
|
|
35109
35134
|
const result = removeWorkspaceEntry(config2, id);
|
|
35110
35135
|
if ("error" in result) return { success: false, error: result.error };
|
|
35111
|
-
|
|
35136
|
+
const saveResult = persistWorkspaceConfig(result.config);
|
|
35137
|
+
if ("error" in saveResult) return { success: false, error: saveResult.error };
|
|
35112
35138
|
const state = getWorkspaceState2(result.config);
|
|
35113
35139
|
return { success: true, removedId: id, ...state };
|
|
35114
35140
|
}
|
|
35115
35141
|
function handleWorkspaceSetDefault(args) {
|
|
35116
35142
|
const clear = args?.clear === true || args?.id === null || args?.id === "";
|
|
35117
35143
|
if (clear) {
|
|
35118
|
-
const config22 =
|
|
35144
|
+
const config22 = loadWorkspaceConfig();
|
|
35145
|
+
if ("error" in config22) return { success: false, error: config22.error };
|
|
35119
35146
|
const result2 = setDefaultWorkspaceId(config22, null);
|
|
35120
35147
|
if ("error" in result2) return { success: false, error: result2.error };
|
|
35121
|
-
|
|
35148
|
+
const saveResult2 = persistWorkspaceConfig(result2.config);
|
|
35149
|
+
if ("error" in saveResult2) return { success: false, error: saveResult2.error };
|
|
35122
35150
|
const state2 = getWorkspaceState2(result2.config);
|
|
35123
35151
|
return {
|
|
35124
35152
|
success: true,
|
|
@@ -35130,7 +35158,9 @@ ${data.message || ""}`.trim();
|
|
|
35130
35158
|
if (!pathArg && !idArg) {
|
|
35131
35159
|
return { success: false, error: "id or path required (or clear: true)" };
|
|
35132
35160
|
}
|
|
35133
|
-
|
|
35161
|
+
const configResult = loadWorkspaceConfig();
|
|
35162
|
+
if ("error" in configResult) return { success: false, error: configResult.error };
|
|
35163
|
+
let config2 = configResult;
|
|
35134
35164
|
let nextId;
|
|
35135
35165
|
if (pathArg) {
|
|
35136
35166
|
let w = findWorkspaceByPath(config2, pathArg);
|
|
@@ -35146,7 +35176,8 @@ ${data.message || ""}`.trim();
|
|
|
35146
35176
|
}
|
|
35147
35177
|
const result = setDefaultWorkspaceId(config2, nextId);
|
|
35148
35178
|
if ("error" in result) return { success: false, error: result.error };
|
|
35149
|
-
|
|
35179
|
+
const saveResult = persistWorkspaceConfig(result.config);
|
|
35180
|
+
if ("error" in saveResult) return { success: false, error: saveResult.error };
|
|
35150
35181
|
const state = getWorkspaceState2(result.config);
|
|
35151
35182
|
return { success: true, ...state };
|
|
35152
35183
|
}
|
|
@@ -43713,10 +43744,10 @@ async (params) => {
|
|
|
43713
43744
|
let isPty = false;
|
|
43714
43745
|
const { spawn: spawnFn } = await import("child_process");
|
|
43715
43746
|
try {
|
|
43716
|
-
const
|
|
43747
|
+
const pty = require("node-pty");
|
|
43717
43748
|
ctx.log(`Auto-implement spawn (PTY): ${shellCmd}`);
|
|
43718
43749
|
const isWin2 = os17.platform() === "win32";
|
|
43719
|
-
child =
|
|
43750
|
+
child = pty.spawn(isWin2 ? "cmd.exe" : process.env.SHELL || "/bin/zsh", [isWin2 ? "/c" : "-c", shellCmd], {
|
|
43720
43751
|
name: "xterm-256color",
|
|
43721
43752
|
cols: 120,
|
|
43722
43753
|
rows: 40,
|
|
@@ -47448,6 +47479,14 @@ if (pkgVersion === "unknown") {
|
|
|
47448
47479
|
} catch {
|
|
47449
47480
|
}
|
|
47450
47481
|
}
|
|
47482
|
+
if (process.platform === "win32") {
|
|
47483
|
+
const nodeMajor = Number.parseInt(process.versions.node.split(".")[0] || "0", 10);
|
|
47484
|
+
if (nodeMajor >= 24) {
|
|
47485
|
+
console.error("\n\u2717 Windows is currently unsupported on Node.js 24+ for ADHDev standalone.");
|
|
47486
|
+
console.error(" Install Node.js 22.x on Windows, then retry.\n");
|
|
47487
|
+
process.exit(1);
|
|
47488
|
+
}
|
|
47489
|
+
}
|
|
47451
47490
|
var SESSION_TARGET_COMMANDS = /* @__PURE__ */ new Set([
|
|
47452
47491
|
"send_chat",
|
|
47453
47492
|
"read_chat",
|