adhdev 0.9.75 → 0.9.76-rc.10
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/cli/index.js +339 -276
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +295 -234
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/vendor/mcp-server/index.js +52052 -47
- package/vendor/mcp-server/index.js.map +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -2907,7 +2907,7 @@ function buildNodeConfigSection(mesh) {
|
|
|
2907
2907
|
for (const n of mesh.nodes) {
|
|
2908
2908
|
const labels = [];
|
|
2909
2909
|
if (n.isLocalWorktree) labels.push("worktree");
|
|
2910
|
-
if (n.policy
|
|
2910
|
+
if (n.policy?.readOnly) labels.push("read-only");
|
|
2911
2911
|
const suffix = labels.length ? ` [${labels.join(", ")}]` : "";
|
|
2912
2912
|
lines.push(`- **${n.workspace}** (${n.id})${suffix}`);
|
|
2913
2913
|
}
|
|
@@ -2953,18 +2953,20 @@ var init_coordinator_prompt = __esm({
|
|
|
2953
2953
|
3. **Delegate** \u2014 For each task:
|
|
2954
2954
|
a. Pick the best node (consider: health, dirty state, current workload).
|
|
2955
2955
|
b. If no session exists, call \`mesh_launch_session\` to start one.
|
|
2956
|
-
c. Call \`mesh_send_task\` with a
|
|
2956
|
+
c. Call \`mesh_send_task\` with a **complete, self-contained** instruction that includes all context the agent needs (file paths, line numbers, what to change, why). Do not send partial instructions expecting future follow-up.
|
|
2957
2957
|
4. **Monitor** \u2014 Periodically call \`mesh_read_chat\` to check progress. Handle approvals via \`mesh_approve\`.
|
|
2958
2958
|
5. **Verify** \u2014 When a task reports completion, call \`mesh_git_status\` to verify changes were made.
|
|
2959
2959
|
6. **Checkpoint** \u2014 Call \`mesh_checkpoint\` to save the work.
|
|
2960
2960
|
7. **Report** \u2014 Summarize what was done, what changed, and any issues.`;
|
|
2961
2961
|
RULES_SECTION = `## Rules
|
|
2962
2962
|
|
|
2963
|
-
- **
|
|
2964
|
-
- **
|
|
2963
|
+
- **Minimize coordinator context.** The coordinator's job is routing, not implementing. Do not read source files, run commands, or analyze code directly \u2014 delegate all of that to node agents. Your context should stay lean.
|
|
2964
|
+
- **Delegate analysis too.** If you need to understand a bug or explore the codebase, send that investigation as a task to a node. Do not do it yourself.
|
|
2965
|
+
- **Front-load the task message.** When calling \`mesh_send_task\`, include everything the agent needs: what files to touch, what the problem is, what the fix should look like. The agent won't ask follow-up questions.
|
|
2966
|
+
- **Don't inspect code.** Trust the agent's output. Verify via \`mesh_git_status\`, not by reading source files.
|
|
2965
2967
|
- **Don't over-parallelize.** Start with 1-2 concurrent tasks. Scale up if they succeed.
|
|
2966
2968
|
- **Handle failures gracefully.** If a task fails, read the chat to understand why, then retry or reassign.
|
|
2967
|
-
- **Keep the user informed.** Report progress after each delegation round.
|
|
2969
|
+
- **Keep the user informed.** Report progress after each delegation round \u2014 one or two sentences, not a narration.
|
|
2968
2970
|
- **Respect node capabilities.** Don't send build tasks to read-only nodes. Don't push from nodes that aren't allowed to.
|
|
2969
2971
|
- **Never fabricate tool results.** Always call the actual tool; never pretend you did.`;
|
|
2970
2972
|
}
|
|
@@ -8915,6 +8917,14 @@ function getActiveChatOptions(profile) {
|
|
|
8915
8917
|
if (profile === "full") return {};
|
|
8916
8918
|
return LIVE_STATUS_ACTIVE_CHAT_OPTIONS;
|
|
8917
8919
|
}
|
|
8920
|
+
function resolveSessionStatus(activeChat, providerStatus) {
|
|
8921
|
+
const chatStatus = normalizeManagedStatus(activeChat?.status, { activeModal: activeChat?.activeModal || null });
|
|
8922
|
+
const topLevelStatus = normalizeManagedStatus(providerStatus, { activeModal: activeChat?.activeModal || null });
|
|
8923
|
+
if (chatStatus === "waiting_approval" || topLevelStatus === "waiting_approval") return "waiting_approval";
|
|
8924
|
+
if (chatStatus === "generating" || topLevelStatus === "generating") return "generating";
|
|
8925
|
+
if (topLevelStatus !== "idle") return topLevelStatus;
|
|
8926
|
+
return chatStatus;
|
|
8927
|
+
}
|
|
8918
8928
|
function shouldIncludeSessionControls(profile) {
|
|
8919
8929
|
return profile !== "live";
|
|
8920
8930
|
}
|
|
@@ -8970,9 +8980,7 @@ function buildIdeWorkspaceSession(state, cdpManagers, options) {
|
|
|
8970
8980
|
providerName: state.name,
|
|
8971
8981
|
kind: "workspace",
|
|
8972
8982
|
transport: "cdp-page",
|
|
8973
|
-
status:
|
|
8974
|
-
activeModal: activeChat?.activeModal || null
|
|
8975
|
-
}),
|
|
8983
|
+
status: resolveSessionStatus(activeChat, state.status),
|
|
8976
8984
|
title,
|
|
8977
8985
|
workspace,
|
|
8978
8986
|
...git && { git },
|
|
@@ -9007,9 +9015,7 @@ function buildExtensionAgentSession(parent, ext, options) {
|
|
|
9007
9015
|
providerSessionId: ext.providerSessionId,
|
|
9008
9016
|
kind: "agent",
|
|
9009
9017
|
transport: "cdp-webview",
|
|
9010
|
-
status:
|
|
9011
|
-
activeModal: activeChat?.activeModal || null
|
|
9012
|
-
}),
|
|
9018
|
+
status: resolveSessionStatus(activeChat, ext.status),
|
|
9013
9019
|
title: activeChat?.title || ext.name,
|
|
9014
9020
|
workspace,
|
|
9015
9021
|
...git && { git },
|
|
@@ -9059,9 +9065,7 @@ function buildCliSession(state, options) {
|
|
|
9059
9065
|
providerSessionId: state.providerSessionId,
|
|
9060
9066
|
kind: "agent",
|
|
9061
9067
|
transport: "pty",
|
|
9062
|
-
status:
|
|
9063
|
-
activeModal: activeChat?.activeModal || null
|
|
9064
|
-
}),
|
|
9068
|
+
status: resolveSessionStatus(activeChat, state.status),
|
|
9065
9069
|
title: activeChat?.title || state.name,
|
|
9066
9070
|
workspace,
|
|
9067
9071
|
...git && { git },
|
|
@@ -9109,9 +9113,7 @@ function buildAcpSession(state, options) {
|
|
|
9109
9113
|
providerName: state.name,
|
|
9110
9114
|
kind: "agent",
|
|
9111
9115
|
transport: "acp",
|
|
9112
|
-
status:
|
|
9113
|
-
activeModal: activeChat?.activeModal || null
|
|
9114
|
-
}),
|
|
9116
|
+
status: resolveSessionStatus(activeChat, state.status),
|
|
9115
9117
|
title: activeChat?.title || state.name,
|
|
9116
9118
|
workspace,
|
|
9117
9119
|
...git && { git },
|
|
@@ -14633,6 +14635,11 @@ var init_provider_cli_adapter = __esm({
|
|
|
14633
14635
|
const currentSnapshot = normalizeScreenSnapshot(screenText);
|
|
14634
14636
|
const lastSnapshot = this.lastScreenSnapshot;
|
|
14635
14637
|
if (!lastSnapshot || lastSnapshot === currentSnapshot) return screenText;
|
|
14638
|
+
const activeScreenPattern = /\besc to (?:interrupt|stop)\b|Enter to interrupt, Ctrl\+C to cancel|Enter to confirm\s*[·•-]\s*Esc to cancel|\b(?:MCP servers?|tool calls?)\b[^\n\r]{0,160}\brequire approval\b/i;
|
|
14639
|
+
const staleSnapshotLooksActive = activeScreenPattern.test(lastSnapshot);
|
|
14640
|
+
const currentScreenLooksIdle = /(?:^|\n|\r)\s*[❯›>]\s*(?:Try\s+["“][^\n\r"”]+["”])?\s*(?:\n|\r|$)/.test(screenText) && !activeScreenPattern.test(screenText);
|
|
14641
|
+
if (staleSnapshotLooksActive && currentScreenLooksIdle) return screenText;
|
|
14642
|
+
if (currentSnapshot.length >= lastSnapshot.length) return screenText;
|
|
14636
14643
|
return `${screenText}
|
|
14637
14644
|
${lastSnapshot}`;
|
|
14638
14645
|
}
|
|
@@ -35778,7 +35785,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
35778
35785
|
}
|
|
35779
35786
|
});
|
|
35780
35787
|
|
|
35781
|
-
// ../../oss/
|
|
35788
|
+
// ../../oss/node_modules/readdirp/esm/index.js
|
|
35782
35789
|
function readdirp(root, options = {}) {
|
|
35783
35790
|
let type = options.entryType || options.type;
|
|
35784
35791
|
if (type === "both")
|
|
@@ -35795,13 +35802,13 @@ function readdirp(root, options = {}) {
|
|
|
35795
35802
|
options.root = root;
|
|
35796
35803
|
return new ReaddirpStream(options);
|
|
35797
35804
|
}
|
|
35798
|
-
var import_promises3,
|
|
35799
|
-
var
|
|
35800
|
-
"../../oss/
|
|
35805
|
+
var import_promises3, import_node_stream, import_node_path, EntryTypes, defaultOptions, RECURSIVE_ERROR_CODE, NORMAL_FLOW_ERRORS, ALL_TYPES, DIR_TYPES, FILE_TYPES, isNormalFlowError, wantBigintFsStats, emptyFn, normalizeFilter, ReaddirpStream;
|
|
35806
|
+
var init_esm = __esm({
|
|
35807
|
+
"../../oss/node_modules/readdirp/esm/index.js"() {
|
|
35801
35808
|
"use strict";
|
|
35802
35809
|
import_promises3 = require("fs/promises");
|
|
35803
|
-
import_node_path = require("path");
|
|
35804
35810
|
import_node_stream = require("stream");
|
|
35811
|
+
import_node_path = require("path");
|
|
35805
35812
|
EntryTypes = {
|
|
35806
35813
|
FILE_TYPE: "files",
|
|
35807
35814
|
DIR_TYPE: "directories",
|
|
@@ -35856,20 +35863,6 @@ var init_readdirp = __esm({
|
|
|
35856
35863
|
return emptyFn;
|
|
35857
35864
|
};
|
|
35858
35865
|
ReaddirpStream = class extends import_node_stream.Readable {
|
|
35859
|
-
parents;
|
|
35860
|
-
reading;
|
|
35861
|
-
parent;
|
|
35862
|
-
_stat;
|
|
35863
|
-
_maxDepth;
|
|
35864
|
-
_wantsDir;
|
|
35865
|
-
_wantsFile;
|
|
35866
|
-
_wantsEverything;
|
|
35867
|
-
_root;
|
|
35868
|
-
_isDirent;
|
|
35869
|
-
_statsProp;
|
|
35870
|
-
_rdOptions;
|
|
35871
|
-
_fileFilter;
|
|
35872
|
-
_directoryFilter;
|
|
35873
35866
|
constructor(options = {}) {
|
|
35874
35867
|
super({
|
|
35875
35868
|
objectMode: true,
|
|
@@ -35886,7 +35879,7 @@ var init_readdirp = __esm({
|
|
|
35886
35879
|
} else {
|
|
35887
35880
|
this._stat = statMethod;
|
|
35888
35881
|
}
|
|
35889
|
-
this._maxDepth = opts.depth
|
|
35882
|
+
this._maxDepth = opts.depth ?? defaultOptions.depth;
|
|
35890
35883
|
this._wantsDir = type ? DIR_TYPES.has(type) : false;
|
|
35891
35884
|
this._wantsFile = type ? FILE_TYPES.has(type) : false;
|
|
35892
35885
|
this._wantsEverything = type === EntryTypes.EVERYTHING_TYPE;
|
|
@@ -36017,17 +36010,17 @@ var init_readdirp = __esm({
|
|
|
36017
36010
|
}
|
|
36018
36011
|
});
|
|
36019
36012
|
|
|
36020
|
-
// ../../oss/
|
|
36013
|
+
// ../../oss/node_modules/chokidar/esm/handler.js
|
|
36021
36014
|
function createFsWatchInstance(path40, options, listener, errHandler, emitRaw) {
|
|
36022
36015
|
const handleEvent = (rawEvent, evPath) => {
|
|
36023
36016
|
listener(path40);
|
|
36024
36017
|
emitRaw(rawEvent, evPath, { watchedPath: path40 });
|
|
36025
36018
|
if (evPath && path40 !== evPath) {
|
|
36026
|
-
fsWatchBroadcast(
|
|
36019
|
+
fsWatchBroadcast(sysPath.resolve(path40, evPath), KEY_LISTENERS, sysPath.join(path40, evPath));
|
|
36027
36020
|
}
|
|
36028
36021
|
};
|
|
36029
36022
|
try {
|
|
36030
|
-
return (0,
|
|
36023
|
+
return (0, import_fs7.watch)(path40, {
|
|
36031
36024
|
persistent: options.persistent
|
|
36032
36025
|
}, handleEvent);
|
|
36033
36026
|
} catch (error48) {
|
|
@@ -36035,14 +36028,14 @@ function createFsWatchInstance(path40, options, listener, errHandler, emitRaw) {
|
|
|
36035
36028
|
return void 0;
|
|
36036
36029
|
}
|
|
36037
36030
|
}
|
|
36038
|
-
var
|
|
36031
|
+
var import_fs7, import_promises4, sysPath, import_os3, STR_DATA, STR_END, STR_CLOSE, EMPTY_FN, pl, isWindows, isMacos, isLinux, isFreeBSD, isIBMi, EVENTS, EV, THROTTLE_MODE_WATCH, statMethods, KEY_LISTENERS, KEY_ERR, KEY_RAW, HANDLER_KEYS, binaryExtensions, isBinaryPath, foreach, addAndConvert, clearItem, delFromSet, isEmptySet, FsWatchInstances, fsWatchBroadcast, setFsWatchListener, FsWatchFileInstances, setFsWatchFileListener, NodeFsHandler;
|
|
36039
36032
|
var init_handler2 = __esm({
|
|
36040
|
-
"../../oss/
|
|
36033
|
+
"../../oss/node_modules/chokidar/esm/handler.js"() {
|
|
36041
36034
|
"use strict";
|
|
36042
|
-
|
|
36035
|
+
import_fs7 = require("fs");
|
|
36043
36036
|
import_promises4 = require("fs/promises");
|
|
36044
|
-
|
|
36045
|
-
|
|
36037
|
+
sysPath = __toESM(require("path"), 1);
|
|
36038
|
+
import_os3 = require("os");
|
|
36046
36039
|
STR_DATA = "data";
|
|
36047
36040
|
STR_END = "end";
|
|
36048
36041
|
STR_CLOSE = "close";
|
|
@@ -36053,7 +36046,7 @@ var init_handler2 = __esm({
|
|
|
36053
36046
|
isMacos = pl === "darwin";
|
|
36054
36047
|
isLinux = pl === "linux";
|
|
36055
36048
|
isFreeBSD = pl === "freebsd";
|
|
36056
|
-
isIBMi = (0,
|
|
36049
|
+
isIBMi = (0, import_os3.type)() === "OS400";
|
|
36057
36050
|
EVENTS = {
|
|
36058
36051
|
ALL: "all",
|
|
36059
36052
|
READY: "ready",
|
|
@@ -36335,7 +36328,7 @@ var init_handler2 = __esm({
|
|
|
36335
36328
|
"zip",
|
|
36336
36329
|
"zipx"
|
|
36337
36330
|
]);
|
|
36338
|
-
isBinaryPath = (filePath) => binaryExtensions.has(
|
|
36331
|
+
isBinaryPath = (filePath) => binaryExtensions.has(sysPath.extname(filePath).slice(1).toLowerCase());
|
|
36339
36332
|
foreach = (val, fn) => {
|
|
36340
36333
|
if (val instanceof Set) {
|
|
36341
36334
|
val.forEach(fn);
|
|
@@ -36443,7 +36436,7 @@ var init_handler2 = __esm({
|
|
|
36443
36436
|
let cont = FsWatchFileInstances.get(fullPath);
|
|
36444
36437
|
const copts = cont && cont.options;
|
|
36445
36438
|
if (copts && (copts.persistent < options.persistent || copts.interval > options.interval)) {
|
|
36446
|
-
(0,
|
|
36439
|
+
(0, import_fs7.unwatchFile)(fullPath);
|
|
36447
36440
|
cont = void 0;
|
|
36448
36441
|
}
|
|
36449
36442
|
if (cont) {
|
|
@@ -36454,7 +36447,7 @@ var init_handler2 = __esm({
|
|
|
36454
36447
|
listeners: listener,
|
|
36455
36448
|
rawEmitters: rawEmitter,
|
|
36456
36449
|
options,
|
|
36457
|
-
watcher: (0,
|
|
36450
|
+
watcher: (0, import_fs7.watchFile)(fullPath, options, (curr, prev) => {
|
|
36458
36451
|
foreach(cont.rawEmitters, (rawEmitter2) => {
|
|
36459
36452
|
rawEmitter2(EV.CHANGE, fullPath, { curr, prev });
|
|
36460
36453
|
});
|
|
@@ -36471,15 +36464,13 @@ var init_handler2 = __esm({
|
|
|
36471
36464
|
delFromSet(cont, KEY_RAW, rawEmitter);
|
|
36472
36465
|
if (isEmptySet(cont.listeners)) {
|
|
36473
36466
|
FsWatchFileInstances.delete(fullPath);
|
|
36474
|
-
(0,
|
|
36467
|
+
(0, import_fs7.unwatchFile)(fullPath);
|
|
36475
36468
|
cont.options = cont.watcher = void 0;
|
|
36476
36469
|
Object.freeze(cont);
|
|
36477
36470
|
}
|
|
36478
36471
|
};
|
|
36479
36472
|
};
|
|
36480
36473
|
NodeFsHandler = class {
|
|
36481
|
-
fsw;
|
|
36482
|
-
_boundHandleError;
|
|
36483
36474
|
constructor(fsW) {
|
|
36484
36475
|
this.fsw = fsW;
|
|
36485
36476
|
this._boundHandleError = (error48) => fsW._handleError(error48);
|
|
@@ -36492,11 +36483,11 @@ var init_handler2 = __esm({
|
|
|
36492
36483
|
*/
|
|
36493
36484
|
_watchWithNodeFs(path40, listener) {
|
|
36494
36485
|
const opts = this.fsw.options;
|
|
36495
|
-
const directory =
|
|
36496
|
-
const basename10 =
|
|
36486
|
+
const directory = sysPath.dirname(path40);
|
|
36487
|
+
const basename10 = sysPath.basename(path40);
|
|
36497
36488
|
const parent = this.fsw._getWatchedDir(directory);
|
|
36498
36489
|
parent.add(basename10);
|
|
36499
|
-
const absolutePath =
|
|
36490
|
+
const absolutePath = sysPath.resolve(path40);
|
|
36500
36491
|
const options = {
|
|
36501
36492
|
persistent: opts.persistent
|
|
36502
36493
|
};
|
|
@@ -36527,8 +36518,8 @@ var init_handler2 = __esm({
|
|
|
36527
36518
|
if (this.fsw.closed) {
|
|
36528
36519
|
return;
|
|
36529
36520
|
}
|
|
36530
|
-
const dirname12 =
|
|
36531
|
-
const basename10 =
|
|
36521
|
+
const dirname12 = sysPath.dirname(file2);
|
|
36522
|
+
const basename10 = sysPath.basename(file2);
|
|
36532
36523
|
const parent = this.fsw._getWatchedDir(dirname12);
|
|
36533
36524
|
let prevStats = stats;
|
|
36534
36525
|
if (parent.has(basename10))
|
|
@@ -36619,9 +36610,8 @@ var init_handler2 = __esm({
|
|
|
36619
36610
|
this.fsw._symlinkPaths.set(full, true);
|
|
36620
36611
|
}
|
|
36621
36612
|
_handleRead(directory, initialAdd, wh, target, dir, depth, throttler) {
|
|
36622
|
-
directory =
|
|
36623
|
-
|
|
36624
|
-
throttler = this.fsw._throttle("readdir", throttleKey, 1e3);
|
|
36613
|
+
directory = sysPath.join(directory, "");
|
|
36614
|
+
throttler = this.fsw._throttle("readdir", directory, 1e3);
|
|
36625
36615
|
if (!throttler)
|
|
36626
36616
|
return;
|
|
36627
36617
|
const previous = this.fsw._getWatchedDir(wh.path);
|
|
@@ -36638,7 +36628,7 @@ var init_handler2 = __esm({
|
|
|
36638
36628
|
return;
|
|
36639
36629
|
}
|
|
36640
36630
|
const item = entry.path;
|
|
36641
|
-
let path40 =
|
|
36631
|
+
let path40 = sysPath.join(directory, item);
|
|
36642
36632
|
current.add(item);
|
|
36643
36633
|
if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path40, item)) {
|
|
36644
36634
|
return;
|
|
@@ -36649,7 +36639,7 @@ var init_handler2 = __esm({
|
|
|
36649
36639
|
}
|
|
36650
36640
|
if (item === target || !target && !previous.has(item)) {
|
|
36651
36641
|
this.fsw._incrReadyCount();
|
|
36652
|
-
path40 =
|
|
36642
|
+
path40 = sysPath.join(dir, sysPath.relative(dir, path40));
|
|
36653
36643
|
this._addToNodeFs(path40, initialAdd, wh, depth + 1);
|
|
36654
36644
|
}
|
|
36655
36645
|
}).on(EV.ERROR, this._boundHandleError);
|
|
@@ -36686,12 +36676,12 @@ var init_handler2 = __esm({
|
|
|
36686
36676
|
* @returns closer for the watcher instance.
|
|
36687
36677
|
*/
|
|
36688
36678
|
async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath4) {
|
|
36689
|
-
const parentDir = this.fsw._getWatchedDir(
|
|
36690
|
-
const tracked = parentDir.has(
|
|
36679
|
+
const parentDir = this.fsw._getWatchedDir(sysPath.dirname(dir));
|
|
36680
|
+
const tracked = parentDir.has(sysPath.basename(dir));
|
|
36691
36681
|
if (!(initialAdd && this.fsw.options.ignoreInitial) && !target && !tracked) {
|
|
36692
36682
|
this.fsw._emit(EV.ADD_DIR, dir, stats);
|
|
36693
36683
|
}
|
|
36694
|
-
parentDir.add(
|
|
36684
|
+
parentDir.add(sysPath.basename(dir));
|
|
36695
36685
|
this.fsw._getWatchedDir(dir);
|
|
36696
36686
|
let throttler;
|
|
36697
36687
|
let closer;
|
|
@@ -36741,7 +36731,7 @@ var init_handler2 = __esm({
|
|
|
36741
36731
|
const follow = this.fsw.options.followSymlinks;
|
|
36742
36732
|
let closer;
|
|
36743
36733
|
if (stats.isDirectory()) {
|
|
36744
|
-
const absPath =
|
|
36734
|
+
const absPath = sysPath.resolve(path40);
|
|
36745
36735
|
const targetPath = follow ? await (0, import_promises4.realpath)(path40) : path40;
|
|
36746
36736
|
if (this.fsw.closed)
|
|
36747
36737
|
return;
|
|
@@ -36755,14 +36745,14 @@ var init_handler2 = __esm({
|
|
|
36755
36745
|
const targetPath = follow ? await (0, import_promises4.realpath)(path40) : path40;
|
|
36756
36746
|
if (this.fsw.closed)
|
|
36757
36747
|
return;
|
|
36758
|
-
const parent =
|
|
36748
|
+
const parent = sysPath.dirname(wh.watchPath);
|
|
36759
36749
|
this.fsw._getWatchedDir(parent).add(wh.watchPath);
|
|
36760
36750
|
this.fsw._emit(EV.ADD, wh.watchPath, stats);
|
|
36761
36751
|
closer = await this._handleDir(parent, stats, initialAdd, depth, path40, wh, targetPath);
|
|
36762
36752
|
if (this.fsw.closed)
|
|
36763
36753
|
return;
|
|
36764
36754
|
if (targetPath !== void 0) {
|
|
36765
|
-
this.fsw._symlinkPaths.set(
|
|
36755
|
+
this.fsw._symlinkPaths.set(sysPath.resolve(path40), targetPath);
|
|
36766
36756
|
}
|
|
36767
36757
|
} else {
|
|
36768
36758
|
closer = this._handleFile(wh.watchPath, stats, initialAdd);
|
|
@@ -36782,7 +36772,7 @@ var init_handler2 = __esm({
|
|
|
36782
36772
|
}
|
|
36783
36773
|
});
|
|
36784
36774
|
|
|
36785
|
-
// ../../oss/
|
|
36775
|
+
// ../../oss/node_modules/chokidar/esm/index.js
|
|
36786
36776
|
function arrify(item) {
|
|
36787
36777
|
return Array.isArray(item) ? item : [item];
|
|
36788
36778
|
}
|
|
@@ -36798,11 +36788,11 @@ function createPattern(matcher) {
|
|
|
36798
36788
|
if (matcher.path === string4)
|
|
36799
36789
|
return true;
|
|
36800
36790
|
if (matcher.recursive) {
|
|
36801
|
-
const relative5 =
|
|
36791
|
+
const relative5 = sysPath2.relative(matcher.path, string4);
|
|
36802
36792
|
if (!relative5) {
|
|
36803
36793
|
return false;
|
|
36804
36794
|
}
|
|
36805
|
-
return !relative5.startsWith("..") && !
|
|
36795
|
+
return !relative5.startsWith("..") && !sysPath2.isAbsolute(relative5);
|
|
36806
36796
|
}
|
|
36807
36797
|
return false;
|
|
36808
36798
|
};
|
|
@@ -36812,12 +36802,14 @@ function createPattern(matcher) {
|
|
|
36812
36802
|
function normalizePath(path40) {
|
|
36813
36803
|
if (typeof path40 !== "string")
|
|
36814
36804
|
throw new Error("string expected");
|
|
36815
|
-
path40 =
|
|
36805
|
+
path40 = sysPath2.normalize(path40);
|
|
36816
36806
|
path40 = path40.replace(/\\/g, "/");
|
|
36817
36807
|
let prepend = false;
|
|
36818
36808
|
if (path40.startsWith("//"))
|
|
36819
36809
|
prepend = true;
|
|
36820
|
-
|
|
36810
|
+
const DOUBLE_SLASH_RE2 = /\/\//;
|
|
36811
|
+
while (path40.match(DOUBLE_SLASH_RE2))
|
|
36812
|
+
path40 = path40.replace(DOUBLE_SLASH_RE2, "/");
|
|
36821
36813
|
if (prepend)
|
|
36822
36814
|
path40 = "/" + path40;
|
|
36823
36815
|
return path40;
|
|
@@ -36850,15 +36842,15 @@ function watch(paths, options = {}) {
|
|
|
36850
36842
|
watcher.add(paths);
|
|
36851
36843
|
return watcher;
|
|
36852
36844
|
}
|
|
36853
|
-
var
|
|
36854
|
-
var
|
|
36855
|
-
"../../oss/
|
|
36845
|
+
var import_fs8, import_promises5, import_events, sysPath2, SLASH, SLASH_SLASH, ONE_DOT, TWO_DOTS, STRING_TYPE, BACK_SLASH_RE, DOUBLE_SLASH_RE, DOT_RE, REPLACER_RE, isMatcherObject, unifyPaths, toUnix, normalizePathToUnix, normalizeIgnored, getAbsolutePath, EMPTY_SET, DirEntry, STAT_METHOD_F, STAT_METHOD_L, WatchHelper, FSWatcher;
|
|
36846
|
+
var init_esm2 = __esm({
|
|
36847
|
+
"../../oss/node_modules/chokidar/esm/index.js"() {
|
|
36856
36848
|
"use strict";
|
|
36857
|
-
|
|
36858
|
-
import_node_fs3 = require("fs");
|
|
36849
|
+
import_fs8 = require("fs");
|
|
36859
36850
|
import_promises5 = require("fs/promises");
|
|
36860
|
-
|
|
36861
|
-
|
|
36851
|
+
import_events = require("events");
|
|
36852
|
+
sysPath2 = __toESM(require("path"), 1);
|
|
36853
|
+
init_esm();
|
|
36862
36854
|
init_handler2();
|
|
36863
36855
|
SLASH = "/";
|
|
36864
36856
|
SLASH_SLASH = "//";
|
|
@@ -36866,7 +36858,7 @@ var init_chokidar = __esm({
|
|
|
36866
36858
|
TWO_DOTS = "..";
|
|
36867
36859
|
STRING_TYPE = "string";
|
|
36868
36860
|
BACK_SLASH_RE = /\\/g;
|
|
36869
|
-
DOUBLE_SLASH_RE =
|
|
36861
|
+
DOUBLE_SLASH_RE = /\/\//;
|
|
36870
36862
|
DOT_RE = /\..*\.(sw[px])$|~$|\.subl.*\.tmp/;
|
|
36871
36863
|
REPLACER_RE = /^\.[/\\]/;
|
|
36872
36864
|
isMatcherObject = (matcher) => typeof matcher === "object" && matcher !== null && !(matcher instanceof RegExp);
|
|
@@ -36883,31 +36875,30 @@ var init_chokidar = __esm({
|
|
|
36883
36875
|
if (str.startsWith(SLASH_SLASH)) {
|
|
36884
36876
|
prepend = true;
|
|
36885
36877
|
}
|
|
36886
|
-
|
|
36878
|
+
while (str.match(DOUBLE_SLASH_RE)) {
|
|
36879
|
+
str = str.replace(DOUBLE_SLASH_RE, SLASH);
|
|
36880
|
+
}
|
|
36887
36881
|
if (prepend) {
|
|
36888
36882
|
str = SLASH + str;
|
|
36889
36883
|
}
|
|
36890
36884
|
return str;
|
|
36891
36885
|
};
|
|
36892
|
-
normalizePathToUnix = (path40) => toUnix(
|
|
36886
|
+
normalizePathToUnix = (path40) => toUnix(sysPath2.normalize(toUnix(path40)));
|
|
36893
36887
|
normalizeIgnored = (cwd = "") => (path40) => {
|
|
36894
36888
|
if (typeof path40 === "string") {
|
|
36895
|
-
return normalizePathToUnix(
|
|
36889
|
+
return normalizePathToUnix(sysPath2.isAbsolute(path40) ? path40 : sysPath2.join(cwd, path40));
|
|
36896
36890
|
} else {
|
|
36897
36891
|
return path40;
|
|
36898
36892
|
}
|
|
36899
36893
|
};
|
|
36900
36894
|
getAbsolutePath = (path40, cwd) => {
|
|
36901
|
-
if (
|
|
36895
|
+
if (sysPath2.isAbsolute(path40)) {
|
|
36902
36896
|
return path40;
|
|
36903
36897
|
}
|
|
36904
|
-
return
|
|
36898
|
+
return sysPath2.join(cwd, path40);
|
|
36905
36899
|
};
|
|
36906
36900
|
EMPTY_SET = Object.freeze(/* @__PURE__ */ new Set());
|
|
36907
36901
|
DirEntry = class {
|
|
36908
|
-
path;
|
|
36909
|
-
_removeWatcher;
|
|
36910
|
-
items;
|
|
36911
36902
|
constructor(dir, removeWatcher) {
|
|
36912
36903
|
this.path = dir;
|
|
36913
36904
|
this._removeWatcher = removeWatcher;
|
|
@@ -36932,7 +36923,7 @@ var init_chokidar = __esm({
|
|
|
36932
36923
|
await (0, import_promises5.readdir)(dir);
|
|
36933
36924
|
} catch (err) {
|
|
36934
36925
|
if (this._removeWatcher) {
|
|
36935
|
-
this._removeWatcher(
|
|
36926
|
+
this._removeWatcher(sysPath2.dirname(dir), sysPath2.basename(dir));
|
|
36936
36927
|
}
|
|
36937
36928
|
}
|
|
36938
36929
|
}
|
|
@@ -36959,19 +36950,12 @@ var init_chokidar = __esm({
|
|
|
36959
36950
|
STAT_METHOD_F = "stat";
|
|
36960
36951
|
STAT_METHOD_L = "lstat";
|
|
36961
36952
|
WatchHelper = class {
|
|
36962
|
-
fsw;
|
|
36963
|
-
path;
|
|
36964
|
-
watchPath;
|
|
36965
|
-
fullWatchPath;
|
|
36966
|
-
dirParts;
|
|
36967
|
-
followSymlinks;
|
|
36968
|
-
statMethod;
|
|
36969
36953
|
constructor(path40, follow, fsw) {
|
|
36970
36954
|
this.fsw = fsw;
|
|
36971
36955
|
const watchPath = path40;
|
|
36972
36956
|
this.path = path40 = path40.replace(REPLACER_RE, "");
|
|
36973
36957
|
this.watchPath = watchPath;
|
|
36974
|
-
this.fullWatchPath =
|
|
36958
|
+
this.fullWatchPath = sysPath2.resolve(watchPath);
|
|
36975
36959
|
this.dirParts = [];
|
|
36976
36960
|
this.dirParts.forEach((parts) => {
|
|
36977
36961
|
if (parts.length > 1)
|
|
@@ -36981,7 +36965,7 @@ var init_chokidar = __esm({
|
|
|
36981
36965
|
this.statMethod = follow ? STAT_METHOD_F : STAT_METHOD_L;
|
|
36982
36966
|
}
|
|
36983
36967
|
entryPath(entry) {
|
|
36984
|
-
return
|
|
36968
|
+
return sysPath2.join(this.watchPath, sysPath2.relative(this.watchPath, entry.fullPath));
|
|
36985
36969
|
}
|
|
36986
36970
|
filterPath(entry) {
|
|
36987
36971
|
const { stats } = entry;
|
|
@@ -36994,25 +36978,7 @@ var init_chokidar = __esm({
|
|
|
36994
36978
|
return this.fsw._isntIgnored(this.entryPath(entry), entry.stats);
|
|
36995
36979
|
}
|
|
36996
36980
|
};
|
|
36997
|
-
FSWatcher = class extends
|
|
36998
|
-
closed;
|
|
36999
|
-
options;
|
|
37000
|
-
_closers;
|
|
37001
|
-
_ignoredPaths;
|
|
37002
|
-
_throttled;
|
|
37003
|
-
_streams;
|
|
37004
|
-
_symlinkPaths;
|
|
37005
|
-
_watched;
|
|
37006
|
-
_pendingWrites;
|
|
37007
|
-
_pendingUnlinks;
|
|
37008
|
-
_readyCount;
|
|
37009
|
-
_emitReady;
|
|
37010
|
-
_closePromise;
|
|
37011
|
-
_userIgnored;
|
|
37012
|
-
_readyEmitted;
|
|
37013
|
-
_emitRaw;
|
|
37014
|
-
_boundRemove;
|
|
37015
|
-
_nodeFsHandler;
|
|
36981
|
+
FSWatcher = class extends import_events.EventEmitter {
|
|
37016
36982
|
// Not indenting methods for history sake; for now.
|
|
37017
36983
|
constructor(_opts = {}) {
|
|
37018
36984
|
super();
|
|
@@ -37131,7 +37097,7 @@ var init_chokidar = __esm({
|
|
|
37131
37097
|
return;
|
|
37132
37098
|
results.forEach((item) => {
|
|
37133
37099
|
if (item)
|
|
37134
|
-
this.add(
|
|
37100
|
+
this.add(sysPath2.dirname(item), sysPath2.basename(_origAdd || item));
|
|
37135
37101
|
});
|
|
37136
37102
|
});
|
|
37137
37103
|
return this;
|
|
@@ -37145,10 +37111,10 @@ var init_chokidar = __esm({
|
|
|
37145
37111
|
const paths = unifyPaths(paths_);
|
|
37146
37112
|
const { cwd } = this.options;
|
|
37147
37113
|
paths.forEach((path40) => {
|
|
37148
|
-
if (!
|
|
37114
|
+
if (!sysPath2.isAbsolute(path40) && !this._closers.has(path40)) {
|
|
37149
37115
|
if (cwd)
|
|
37150
|
-
path40 =
|
|
37151
|
-
path40 =
|
|
37116
|
+
path40 = sysPath2.join(cwd, path40);
|
|
37117
|
+
path40 = sysPath2.resolve(path40);
|
|
37152
37118
|
}
|
|
37153
37119
|
this._closePath(path40);
|
|
37154
37120
|
this._addIgnoredPath(path40);
|
|
@@ -37197,7 +37163,7 @@ var init_chokidar = __esm({
|
|
|
37197
37163
|
getWatched() {
|
|
37198
37164
|
const watchList = {};
|
|
37199
37165
|
this._watched.forEach((entry, dir) => {
|
|
37200
|
-
const key = this.options.cwd ?
|
|
37166
|
+
const key = this.options.cwd ? sysPath2.relative(this.options.cwd, dir) : dir;
|
|
37201
37167
|
const index = key || ONE_DOT;
|
|
37202
37168
|
watchList[index] = entry.getChildren().sort();
|
|
37203
37169
|
});
|
|
@@ -37223,9 +37189,9 @@ var init_chokidar = __esm({
|
|
|
37223
37189
|
return;
|
|
37224
37190
|
const opts = this.options;
|
|
37225
37191
|
if (isWindows)
|
|
37226
|
-
path40 =
|
|
37192
|
+
path40 = sysPath2.normalize(path40);
|
|
37227
37193
|
if (opts.cwd)
|
|
37228
|
-
path40 =
|
|
37194
|
+
path40 = sysPath2.relative(opts.cwd, path40);
|
|
37229
37195
|
const args = [path40];
|
|
37230
37196
|
if (stats != null)
|
|
37231
37197
|
args.push(stats);
|
|
@@ -37276,7 +37242,7 @@ var init_chokidar = __esm({
|
|
|
37276
37242
|
return this;
|
|
37277
37243
|
}
|
|
37278
37244
|
if (opts.alwaysStat && stats === void 0 && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
|
|
37279
|
-
const fullPath = opts.cwd ?
|
|
37245
|
+
const fullPath = opts.cwd ? sysPath2.join(opts.cwd, path40) : path40;
|
|
37280
37246
|
let stats2;
|
|
37281
37247
|
try {
|
|
37282
37248
|
stats2 = await (0, import_promises5.stat)(fullPath);
|
|
@@ -37352,13 +37318,13 @@ var init_chokidar = __esm({
|
|
|
37352
37318
|
const pollInterval = awf.pollInterval;
|
|
37353
37319
|
let timeoutHandler;
|
|
37354
37320
|
let fullPath = path40;
|
|
37355
|
-
if (this.options.cwd && !
|
|
37356
|
-
fullPath =
|
|
37321
|
+
if (this.options.cwd && !sysPath2.isAbsolute(path40)) {
|
|
37322
|
+
fullPath = sysPath2.join(this.options.cwd, path40);
|
|
37357
37323
|
}
|
|
37358
37324
|
const now = /* @__PURE__ */ new Date();
|
|
37359
37325
|
const writes = this._pendingWrites;
|
|
37360
37326
|
function awaitWriteFinishFn(prevStat) {
|
|
37361
|
-
(0,
|
|
37327
|
+
(0, import_fs8.stat)(fullPath, (err, curStat) => {
|
|
37362
37328
|
if (err || !writes.has(path40)) {
|
|
37363
37329
|
if (err && err.code !== "ENOENT")
|
|
37364
37330
|
awfEmit(err);
|
|
@@ -37423,7 +37389,7 @@ var init_chokidar = __esm({
|
|
|
37423
37389
|
* @param directory path of the directory
|
|
37424
37390
|
*/
|
|
37425
37391
|
_getWatchedDir(directory) {
|
|
37426
|
-
const dir =
|
|
37392
|
+
const dir = sysPath2.resolve(directory);
|
|
37427
37393
|
if (!this._watched.has(dir))
|
|
37428
37394
|
this._watched.set(dir, new DirEntry(dir, this._boundRemove));
|
|
37429
37395
|
return this._watched.get(dir);
|
|
@@ -37446,8 +37412,8 @@ var init_chokidar = __esm({
|
|
|
37446
37412
|
* @param item base path of item/directory
|
|
37447
37413
|
*/
|
|
37448
37414
|
_remove(directory, item, isDirectory) {
|
|
37449
|
-
const path40 =
|
|
37450
|
-
const fullPath =
|
|
37415
|
+
const path40 = sysPath2.join(directory, item);
|
|
37416
|
+
const fullPath = sysPath2.resolve(path40);
|
|
37451
37417
|
isDirectory = isDirectory != null ? isDirectory : this._watched.has(path40) || this._watched.has(fullPath);
|
|
37452
37418
|
if (!this._throttle("remove", path40, 100))
|
|
37453
37419
|
return;
|
|
@@ -37465,7 +37431,7 @@ var init_chokidar = __esm({
|
|
|
37465
37431
|
}
|
|
37466
37432
|
let relPath = path40;
|
|
37467
37433
|
if (this.options.cwd)
|
|
37468
|
-
relPath =
|
|
37434
|
+
relPath = sysPath2.relative(this.options.cwd, path40);
|
|
37469
37435
|
if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
|
|
37470
37436
|
const event = this._pendingWrites.get(relPath).cancelWait();
|
|
37471
37437
|
if (event === EVENTS.ADD)
|
|
@@ -37483,8 +37449,8 @@ var init_chokidar = __esm({
|
|
|
37483
37449
|
*/
|
|
37484
37450
|
_closePath(path40) {
|
|
37485
37451
|
this._closeFile(path40);
|
|
37486
|
-
const dir =
|
|
37487
|
-
this._getWatchedDir(dir).remove(
|
|
37452
|
+
const dir = sysPath2.dirname(path40);
|
|
37453
|
+
this._getWatchedDir(dir).remove(sysPath2.basename(path40));
|
|
37488
37454
|
}
|
|
37489
37455
|
/**
|
|
37490
37456
|
* Closes only file-specific watchers
|
|
@@ -37829,7 +37795,7 @@ var init_provider_loader = __esm({
|
|
|
37829
37795
|
fs7 = __toESM(require("fs"));
|
|
37830
37796
|
path18 = __toESM(require("path"));
|
|
37831
37797
|
os17 = __toESM(require("os"));
|
|
37832
|
-
|
|
37798
|
+
init_esm2();
|
|
37833
37799
|
init_ide_detector();
|
|
37834
37800
|
init_logger();
|
|
37835
37801
|
init_provider_schema();
|
|
@@ -40050,7 +40016,7 @@ function resolveAdhdevMcpServerLaunch(options) {
|
|
|
40050
40016
|
if (!entryPath) return null;
|
|
40051
40017
|
return {
|
|
40052
40018
|
command: options.nodeExecutable?.trim() || process.execPath,
|
|
40053
|
-
args: [entryPath, "--repo-mesh", options.meshId]
|
|
40019
|
+
args: [entryPath, "--mode", "ipc", "--repo-mesh", options.meshId]
|
|
40054
40020
|
};
|
|
40055
40021
|
}
|
|
40056
40022
|
function resolveAdhdevMcpEntryPath(explicitPath) {
|
|
@@ -40088,17 +40054,17 @@ function resolveAdhdevMcpEntryPath(explicitPath) {
|
|
|
40088
40054
|
}
|
|
40089
40055
|
function normalizeExistingPath(filePath) {
|
|
40090
40056
|
try {
|
|
40091
|
-
if (!(0,
|
|
40092
|
-
return
|
|
40057
|
+
if (!(0, import_node_fs2.existsSync)(filePath)) return null;
|
|
40058
|
+
return import_node_fs2.realpathSync.native(filePath);
|
|
40093
40059
|
} catch {
|
|
40094
40060
|
return null;
|
|
40095
40061
|
}
|
|
40096
40062
|
}
|
|
40097
|
-
var
|
|
40063
|
+
var import_node_fs2, import_node_module2, import_node_path2, DEFAULT_SERVER_NAME, DEFAULT_ADHDEV_MCP_COMMAND;
|
|
40098
40064
|
var init_mesh_coordinator = __esm({
|
|
40099
40065
|
"../../oss/packages/daemon-core/src/commands/mesh-coordinator.ts"() {
|
|
40100
40066
|
"use strict";
|
|
40101
|
-
|
|
40067
|
+
import_node_fs2 = require("fs");
|
|
40102
40068
|
import_node_module2 = require("module");
|
|
40103
40069
|
import_node_path2 = require("path");
|
|
40104
40070
|
DEFAULT_SERVER_NAME = "adhdev-mesh";
|
|
@@ -40868,7 +40834,7 @@ function summarizeSessionHostPruneResult(result) {
|
|
|
40868
40834
|
keptCount: Array.isArray(value.keptSessionIds) ? value.keptSessionIds.length : void 0
|
|
40869
40835
|
};
|
|
40870
40836
|
}
|
|
40871
|
-
var fs10, CHANNEL_NPM_TAG, CHAT_COMMANDS, READ_DEBUG_ENABLED2, DaemonCommandRouter;
|
|
40837
|
+
var fs10, CHANNEL_NPM_TAG, CHANNEL_SERVER_URL, CHAT_COMMANDS, READ_DEBUG_ENABLED2, DaemonCommandRouter;
|
|
40872
40838
|
var init_router = __esm({
|
|
40873
40839
|
"../../oss/packages/daemon-core/src/commands/router.ts"() {
|
|
40874
40840
|
"use strict";
|
|
@@ -40896,6 +40862,10 @@ var init_router = __esm({
|
|
|
40896
40862
|
init_upgrade_helper();
|
|
40897
40863
|
fs10 = __toESM(require("fs"));
|
|
40898
40864
|
CHANNEL_NPM_TAG = { stable: "latest", preview: "next" };
|
|
40865
|
+
CHANNEL_SERVER_URL = {
|
|
40866
|
+
stable: "https://api.adhf.dev",
|
|
40867
|
+
preview: "https://api-preview.adhf.dev"
|
|
40868
|
+
};
|
|
40899
40869
|
CHAT_COMMANDS = [
|
|
40900
40870
|
"send_chat",
|
|
40901
40871
|
"new_chat",
|
|
@@ -41501,6 +41471,7 @@ var init_router = __esm({
|
|
|
41501
41471
|
const npmTag = CHANNEL_NPM_TAG[channel];
|
|
41502
41472
|
const latest = String(execNpmCommandSync(["view", `${pkgName}@${npmTag}`, "version"], { encoding: "utf-8", timeout: 1e4 }, npmSurface)).trim();
|
|
41503
41473
|
LOG.info("Upgrade", `Latest ${pkgName}@${npmTag}: v${latest}`);
|
|
41474
|
+
updateConfig({ updateChannel: channel, serverUrl: CHANNEL_SERVER_URL[channel] });
|
|
41504
41475
|
let currentInstalled = null;
|
|
41505
41476
|
try {
|
|
41506
41477
|
const currentJson = String(execNpmCommandSync(["ls", "-g", pkgName, "--depth=0", "--json"], {
|
|
@@ -41703,7 +41674,8 @@ var init_router = __esm({
|
|
|
41703
41674
|
};
|
|
41704
41675
|
if (args?.inlineMesh) {
|
|
41705
41676
|
mcpServerEntry.env = {
|
|
41706
|
-
ADHDEV_INLINE_MESH: JSON.stringify(mesh)
|
|
41677
|
+
ADHDEV_INLINE_MESH: JSON.stringify(mesh),
|
|
41678
|
+
ADHDEV_MCP_TRANSPORT: "ipc"
|
|
41707
41679
|
};
|
|
41708
41680
|
}
|
|
41709
41681
|
const mcpConfig = {
|
|
@@ -43483,7 +43455,7 @@ function runCommand(cmd, timeout = 1e4) {
|
|
|
43483
43455
|
}
|
|
43484
43456
|
}
|
|
43485
43457
|
function findBinary2(name) {
|
|
43486
|
-
const cmd = (0,
|
|
43458
|
+
const cmd = (0, import_os4.platform)() === "win32" ? `where ${name}` : `which ${name}`;
|
|
43487
43459
|
const result = runCommand(cmd, 5e3);
|
|
43488
43460
|
return result ? result.split("\n")[0] : null;
|
|
43489
43461
|
}
|
|
@@ -43531,7 +43503,7 @@ function checkPathExists2(paths) {
|
|
|
43531
43503
|
return null;
|
|
43532
43504
|
}
|
|
43533
43505
|
function getMacAppVersion(appPath) {
|
|
43534
|
-
if ((0,
|
|
43506
|
+
if ((0, import_os4.platform)() !== "darwin" || !appPath.endsWith(".app")) return null;
|
|
43535
43507
|
const plistPath = path23.join(appPath, "Contents", "Info.plist");
|
|
43536
43508
|
if (!fs11.existsSync(plistPath)) return null;
|
|
43537
43509
|
const raw = runCommand(`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${plistPath}"`);
|
|
@@ -43539,7 +43511,7 @@ function getMacAppVersion(appPath) {
|
|
|
43539
43511
|
}
|
|
43540
43512
|
async function detectAllVersions(loader, archive) {
|
|
43541
43513
|
const results = [];
|
|
43542
|
-
const currentOs = (0,
|
|
43514
|
+
const currentOs = (0, import_os4.platform)();
|
|
43543
43515
|
for (const provider of loader.getAll()) {
|
|
43544
43516
|
const info = {
|
|
43545
43517
|
type: provider.type,
|
|
@@ -43595,7 +43567,7 @@ async function detectAllVersions(loader, archive) {
|
|
|
43595
43567
|
}
|
|
43596
43568
|
return results;
|
|
43597
43569
|
}
|
|
43598
|
-
var fs11, path23, os23, import_child_process10,
|
|
43570
|
+
var fs11, path23, os23, import_child_process10, import_os4, ARCHIVE_PATH, MAX_ENTRIES_PER_PROVIDER, VersionArchive;
|
|
43599
43571
|
var init_version_archive = __esm({
|
|
43600
43572
|
"../../oss/packages/daemon-core/src/providers/version-archive.ts"() {
|
|
43601
43573
|
"use strict";
|
|
@@ -43603,7 +43575,7 @@ var init_version_archive = __esm({
|
|
|
43603
43575
|
path23 = __toESM(require("path"));
|
|
43604
43576
|
os23 = __toESM(require("os"));
|
|
43605
43577
|
import_child_process10 = require("child_process");
|
|
43606
|
-
|
|
43578
|
+
import_os4 = require("os");
|
|
43607
43579
|
ARCHIVE_PATH = path23.join(os23.homedir(), ".adhdev", "version-history.json");
|
|
43608
43580
|
MAX_ENTRIES_PER_PROVIDER = 20;
|
|
43609
43581
|
VersionArchive = class {
|
|
@@ -43629,7 +43601,7 @@ var init_version_archive = __esm({
|
|
|
43629
43601
|
entries.push({
|
|
43630
43602
|
version: version2,
|
|
43631
43603
|
detectedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
43632
|
-
os: (0,
|
|
43604
|
+
os: (0, import_os4.platform)()
|
|
43633
43605
|
});
|
|
43634
43606
|
if (entries.length > MAX_ENTRIES_PER_PROVIDER) {
|
|
43635
43607
|
this.history[type] = entries.slice(-MAX_ENTRIES_PER_PROVIDER);
|
|
@@ -50534,7 +50506,7 @@ function isUnicodeSupported() {
|
|
|
50534
50506
|
import_node_process3.default.env["TERM_PROGRAM"] === "Terminus-Sublime" || import_node_process3.default.env["TERM_PROGRAM"] === "vscode" || import_node_process3.default.env["TERM"] === "xterm-256color" || import_node_process3.default.env["TERM"] === "alacritty" || import_node_process3.default.env["TERMINAL_EMULATOR"] === "JetBrains-JediTerm";
|
|
50535
50507
|
}
|
|
50536
50508
|
var import_node_process3, common, specialMainSymbols, specialFallbackSymbols, mainSymbols, fallbackSymbols, shouldUseMain, figures, esm_default, replacements;
|
|
50537
|
-
var
|
|
50509
|
+
var init_esm3 = __esm({
|
|
50538
50510
|
"../../node_modules/@inquirer/figures/dist/esm/index.js"() {
|
|
50539
50511
|
"use strict";
|
|
50540
50512
|
import_node_process3 = __toESM(require("process"), 1);
|
|
@@ -60455,7 +60427,7 @@ var init_separator = __esm({
|
|
|
60455
60427
|
"../../node_modules/inquirer/lib/objects/separator.js"() {
|
|
60456
60428
|
"use strict";
|
|
60457
60429
|
import_yoctocolors_cjs2 = __toESM(require_yoctocolors_cjs(), 1);
|
|
60458
|
-
|
|
60430
|
+
init_esm3();
|
|
60459
60431
|
Separator = class {
|
|
60460
60432
|
constructor(line) {
|
|
60461
60433
|
this.type = "separator";
|
|
@@ -68579,7 +68551,7 @@ var init_list = __esm({
|
|
|
68579
68551
|
"use strict";
|
|
68580
68552
|
import_ansi_escapes3 = __toESM(require_ansi_escapes(), 1);
|
|
68581
68553
|
import_yoctocolors_cjs4 = __toESM(require_yoctocolors_cjs(), 1);
|
|
68582
|
-
|
|
68554
|
+
init_esm3();
|
|
68583
68555
|
import_run_async2 = __toESM(require_run_async(), 1);
|
|
68584
68556
|
import_rxjs3 = __toESM(require_cjs(), 1);
|
|
68585
68557
|
init_events();
|
|
@@ -69274,7 +69246,7 @@ var init_checkbox = __esm({
|
|
|
69274
69246
|
"use strict";
|
|
69275
69247
|
import_ansi_escapes4 = __toESM(require_ansi_escapes(), 1);
|
|
69276
69248
|
import_yoctocolors_cjs9 = __toESM(require_yoctocolors_cjs(), 1);
|
|
69277
|
-
|
|
69249
|
+
init_esm3();
|
|
69278
69250
|
import_rxjs8 = __toESM(require_cjs(), 1);
|
|
69279
69251
|
init_events();
|
|
69280
69252
|
init_paginator();
|
|
@@ -79028,15 +79000,15 @@ function splitStringBySpace(str) {
|
|
|
79028
79000
|
}
|
|
79029
79001
|
return pieces;
|
|
79030
79002
|
}
|
|
79031
|
-
var import_chardet, import_child_process12,
|
|
79032
|
-
var
|
|
79003
|
+
var import_chardet, import_child_process12, import_fs9, import_node_path3, import_node_os3, import_node_crypto2, import_iconv_lite, ExternalEditor;
|
|
79004
|
+
var init_esm4 = __esm({
|
|
79033
79005
|
"../../node_modules/@inquirer/external-editor/dist/esm/index.js"() {
|
|
79034
79006
|
"use strict";
|
|
79035
79007
|
import_chardet = __toESM(require_lib(), 1);
|
|
79036
79008
|
import_child_process12 = require("child_process");
|
|
79037
|
-
|
|
79009
|
+
import_fs9 = require("fs");
|
|
79038
79010
|
import_node_path3 = __toESM(require("path"), 1);
|
|
79039
|
-
|
|
79011
|
+
import_node_os3 = __toESM(require("os"), 1);
|
|
79040
79012
|
import_node_crypto2 = require("crypto");
|
|
79041
79013
|
import_iconv_lite = __toESM(require_lib2(), 1);
|
|
79042
79014
|
init_CreateFileError();
|
|
@@ -79095,7 +79067,7 @@ var init_esm2 = __esm({
|
|
|
79095
79067
|
}
|
|
79096
79068
|
createTemporaryFile() {
|
|
79097
79069
|
try {
|
|
79098
|
-
const baseDir = this.fileOptions.dir ??
|
|
79070
|
+
const baseDir = this.fileOptions.dir ?? import_node_os3.default.tmpdir();
|
|
79099
79071
|
const id = (0, import_node_crypto2.randomUUID)();
|
|
79100
79072
|
const prefix = sanitizeAffix(this.fileOptions.prefix);
|
|
79101
79073
|
const postfix = sanitizeAffix(this.fileOptions.postfix);
|
|
@@ -79110,14 +79082,14 @@ var init_esm2 = __esm({
|
|
|
79110
79082
|
if (Object.prototype.hasOwnProperty.call(this.fileOptions, "mode")) {
|
|
79111
79083
|
opt.mode = this.fileOptions.mode;
|
|
79112
79084
|
}
|
|
79113
|
-
(0,
|
|
79085
|
+
(0, import_fs9.writeFileSync)(this.tempFile, this.text, opt);
|
|
79114
79086
|
} catch (createFileError) {
|
|
79115
79087
|
throw new CreateFileError(createFileError);
|
|
79116
79088
|
}
|
|
79117
79089
|
}
|
|
79118
79090
|
readTemporaryFile() {
|
|
79119
79091
|
try {
|
|
79120
|
-
const tempFileBuffer = (0,
|
|
79092
|
+
const tempFileBuffer = (0, import_fs9.readFileSync)(this.tempFile);
|
|
79121
79093
|
if (tempFileBuffer.length === 0) {
|
|
79122
79094
|
this.text = "";
|
|
79123
79095
|
} else {
|
|
@@ -79133,7 +79105,7 @@ var init_esm2 = __esm({
|
|
|
79133
79105
|
}
|
|
79134
79106
|
removeTemporaryFile() {
|
|
79135
79107
|
try {
|
|
79136
|
-
(0,
|
|
79108
|
+
(0, import_fs9.unlinkSync)(this.tempFile);
|
|
79137
79109
|
} catch (removeFileError) {
|
|
79138
79110
|
throw new RemoveFileError(removeFileError);
|
|
79139
79111
|
}
|
|
@@ -79167,7 +79139,7 @@ var init_editor = __esm({
|
|
|
79167
79139
|
"../../node_modules/inquirer/lib/prompts/editor.js"() {
|
|
79168
79140
|
"use strict";
|
|
79169
79141
|
import_yoctocolors_cjs11 = __toESM(require_yoctocolors_cjs(), 1);
|
|
79170
|
-
|
|
79142
|
+
init_esm4();
|
|
79171
79143
|
import_rxjs10 = __toESM(require_cjs(), 1);
|
|
79172
79144
|
init_events();
|
|
79173
79145
|
init_base();
|
|
@@ -80841,18 +80813,18 @@ function resolvePackageVersion(options) {
|
|
|
80841
80813
|
];
|
|
80842
80814
|
for (const p of possiblePaths) {
|
|
80843
80815
|
try {
|
|
80844
|
-
const data = JSON.parse((0,
|
|
80816
|
+
const data = JSON.parse((0, import_fs10.readFileSync)(p, "utf-8"));
|
|
80845
80817
|
if (data.version) return data.version;
|
|
80846
80818
|
} catch {
|
|
80847
80819
|
}
|
|
80848
80820
|
}
|
|
80849
80821
|
return injectedVersion;
|
|
80850
80822
|
}
|
|
80851
|
-
var
|
|
80823
|
+
var import_fs10, import_path4;
|
|
80852
80824
|
var init_version = __esm({
|
|
80853
80825
|
"src/version.ts"() {
|
|
80854
80826
|
"use strict";
|
|
80855
|
-
|
|
80827
|
+
import_fs10 = require("fs");
|
|
80856
80828
|
import_path4 = require("path");
|
|
80857
80829
|
}
|
|
80858
80830
|
});
|
|
@@ -80977,13 +80949,14 @@ var init_server_connection = __esm({
|
|
|
80977
80949
|
reject(new Error(`Mesh command timed out after ${timeoutMs}ms`));
|
|
80978
80950
|
}, timeoutMs);
|
|
80979
80951
|
const handler = (msg) => {
|
|
80980
|
-
|
|
80952
|
+
const body = msg.payload && typeof msg.payload === "object" ? { ...msg, ...msg.payload } : msg;
|
|
80953
|
+
if (body.requestId !== requestId) return;
|
|
80981
80954
|
this.off("daemon_mesh_result", handler);
|
|
80982
80955
|
clearTimeout(timer);
|
|
80983
|
-
if (
|
|
80984
|
-
reject(new Error(
|
|
80956
|
+
if (body.success === false) {
|
|
80957
|
+
reject(new Error(body.error ?? "Mesh command failed"));
|
|
80985
80958
|
} else {
|
|
80986
|
-
resolve23(
|
|
80959
|
+
resolve23(body.result);
|
|
80987
80960
|
}
|
|
80988
80961
|
};
|
|
80989
80962
|
this.on("daemon_mesh_result", handler);
|
|
@@ -81085,17 +81058,19 @@ var init_server_connection = __esm({
|
|
|
81085
81058
|
return;
|
|
81086
81059
|
} else if (message.type === "version_mismatch") {
|
|
81087
81060
|
const p = message.payload;
|
|
81061
|
+
const updateCommand = typeof p.updateCommand === "string" && p.updateCommand.trim() ? p.updateCommand.trim() : "adhdev daemon:upgrade";
|
|
81088
81062
|
LOG.info("Server", `
|
|
81089
81063
|
\u{1F504} Update available: v${p.current} \u2192 v${p.latest}`);
|
|
81090
|
-
LOG.info("Server", ` Run:
|
|
81064
|
+
LOG.info("Server", ` Run: ${updateCommand}
|
|
81091
81065
|
`);
|
|
81092
81066
|
} else if (message.type === "force_update_required") {
|
|
81093
81067
|
this.compatBlocked = true;
|
|
81094
81068
|
const p = message.payload;
|
|
81069
|
+
const updateCommand = typeof p.updateCommand === "string" && p.updateCommand.trim() ? p.updateCommand.trim() : "adhdev daemon:upgrade";
|
|
81095
81070
|
LOG.error("Server", `
|
|
81096
81071
|
\u26D4 Daemon v${this.options.daemonVersion} is no longer compatible.`);
|
|
81097
81072
|
LOG.error("Server", ` Minimum required: v${p.minVersion}`);
|
|
81098
|
-
LOG.error("Server", ` Run:
|
|
81073
|
+
LOG.error("Server", ` Run: ${updateCommand}
|
|
81099
81074
|
`);
|
|
81100
81075
|
}
|
|
81101
81076
|
const handlers = this.messageHandlers.get(message.type);
|
|
@@ -86971,10 +86946,10 @@ var require_color = __commonJS({
|
|
|
86971
86946
|
const b = srgbNonlinearTransformInv(rgb[2] / 255);
|
|
86972
86947
|
const lp = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b);
|
|
86973
86948
|
const mp = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b);
|
|
86974
|
-
const
|
|
86975
|
-
const l = 0.2104542553 * lp + 0.793617785 * mp - 0.0040720468 *
|
|
86976
|
-
const aa = 1.9779984951 * lp - 2.428592205 * mp + 0.4505937099 *
|
|
86977
|
-
const bb = 0.0259040371 * lp + 0.7827717662 * mp - 0.808675766 *
|
|
86949
|
+
const sp = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b);
|
|
86950
|
+
const l = 0.2104542553 * lp + 0.793617785 * mp - 0.0040720468 * sp;
|
|
86951
|
+
const aa = 1.9779984951 * lp - 2.428592205 * mp + 0.4505937099 * sp;
|
|
86952
|
+
const bb = 0.0259040371 * lp + 0.7827717662 * mp - 0.808675766 * sp;
|
|
86978
86953
|
return [l * 100, aa * 100, bb * 100];
|
|
86979
86954
|
};
|
|
86980
86955
|
convert.rgb.cmyk = function(rgb) {
|
|
@@ -87236,10 +87211,10 @@ var require_color = __commonJS({
|
|
|
87236
87211
|
const z2 = xyz[2] / 100;
|
|
87237
87212
|
const lp = Math.cbrt(0.8189330101 * x + 0.3618667424 * y - 0.1288597137 * z2);
|
|
87238
87213
|
const mp = Math.cbrt(0.0329845436 * x + 0.9293118715 * y + 0.0361456387 * z2);
|
|
87239
|
-
const
|
|
87240
|
-
const l = 0.2104542553 * lp + 0.793617785 * mp - 0.0040720468 *
|
|
87241
|
-
const a = 1.9779984951 * lp - 2.428592205 * mp + 0.4505937099 *
|
|
87242
|
-
const b = 0.0259040371 * lp + 0.7827717662 * mp - 0.808675766 *
|
|
87214
|
+
const sp = Math.cbrt(0.0482003018 * x + 0.2643662691 * y + 0.633851707 * z2);
|
|
87215
|
+
const l = 0.2104542553 * lp + 0.793617785 * mp - 0.0040720468 * sp;
|
|
87216
|
+
const a = 1.9779984951 * lp - 2.428592205 * mp + 0.4505937099 * sp;
|
|
87217
|
+
const b = 0.0259040371 * lp + 0.7827717662 * mp - 0.808675766 * sp;
|
|
87243
87218
|
return [l * 100, a * 100, b * 100];
|
|
87244
87219
|
};
|
|
87245
87220
|
convert.oklab.oklch = function(oklab) {
|
|
@@ -89999,7 +89974,9 @@ var init_daemon_mesh_manager = __esm({
|
|
|
89999
89974
|
"read_chat",
|
|
90000
89975
|
"git_status",
|
|
90001
89976
|
"git_diff_summary",
|
|
90002
|
-
"launch_cli"
|
|
89977
|
+
"launch_cli",
|
|
89978
|
+
"git_checkpoint",
|
|
89979
|
+
"resolve_action"
|
|
90003
89980
|
]);
|
|
90004
89981
|
setRules(rules) {
|
|
90005
89982
|
const valid = [];
|
|
@@ -90290,7 +90267,7 @@ var init_adhdev_daemon = __esm({
|
|
|
90290
90267
|
init_version();
|
|
90291
90268
|
init_src();
|
|
90292
90269
|
init_runtime_defaults();
|
|
90293
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.
|
|
90270
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.76-rc.10" });
|
|
90294
90271
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
90295
90272
|
localHttpServer = null;
|
|
90296
90273
|
localWss = null;
|
|
@@ -91126,6 +91103,19 @@ ${err?.stack || ""}`);
|
|
|
91126
91103
|
void this.statusReporter?.sendUnifiedStatusReport({ forceServer: true, reason });
|
|
91127
91104
|
void this.flushP2PDaemonMetadataSubscriptions();
|
|
91128
91105
|
}
|
|
91106
|
+
emitMeshCheckpointCompleteIfNeeded(commandType, result, normalizedData) {
|
|
91107
|
+
if (commandType !== "git_checkpoint" || result?.success !== true || !this.meshManager) return;
|
|
91108
|
+
const workspace = String(normalizedData.workspace ?? "");
|
|
91109
|
+
const baseContext = {
|
|
91110
|
+
workspace,
|
|
91111
|
+
checkpoint_message: result.checkpoint?.message ?? String(normalizedData.message ?? ""),
|
|
91112
|
+
commit: result.checkpoint?.commit ?? "",
|
|
91113
|
+
source_session_id: String(normalizedData.targetSessionId ?? "")
|
|
91114
|
+
};
|
|
91115
|
+
void this.buildMeshCheckpointContext(workspace, baseContext).then((ctx) => {
|
|
91116
|
+
this.meshManager.emit({ trigger: "git_checkpoint_complete", context: ctx });
|
|
91117
|
+
});
|
|
91118
|
+
}
|
|
91129
91119
|
async handleCommand(msg, cmd, args) {
|
|
91130
91120
|
const normalizedArgs = this.ensureInteractionContext(args);
|
|
91131
91121
|
const interactionId = String(normalizedArgs._interactionId);
|
|
@@ -91160,6 +91150,10 @@ ${err?.stack || ""}`);
|
|
|
91160
91150
|
if (cmd === "resolve_action" || cmd === "send_chat" || cmd === "read_chat") {
|
|
91161
91151
|
void this.flushP2PSessionModalSubscriptions();
|
|
91162
91152
|
}
|
|
91153
|
+
if (cmd.startsWith("git_")) {
|
|
91154
|
+
void this.flushP2PWorkspaceGitSubscriptions();
|
|
91155
|
+
}
|
|
91156
|
+
this.emitMeshCheckpointCompleteIfNeeded(cmd, result, normalizedArgs);
|
|
91163
91157
|
this.sendResult(msg, result.success, { ...result, interactionId });
|
|
91164
91158
|
recordDebugTrace({
|
|
91165
91159
|
interactionId,
|
|
@@ -91241,18 +91235,7 @@ ${err?.stack || ""}`);
|
|
|
91241
91235
|
if (cmdType.startsWith("git_")) {
|
|
91242
91236
|
void this.flushP2PWorkspaceGitSubscriptions();
|
|
91243
91237
|
}
|
|
91244
|
-
|
|
91245
|
-
const workspace = String(normalizedData.workspace ?? "");
|
|
91246
|
-
const baseContext = {
|
|
91247
|
-
workspace,
|
|
91248
|
-
checkpoint_message: routed.checkpoint?.message ?? String(normalizedData.message ?? ""),
|
|
91249
|
-
commit: routed.checkpoint?.commit ?? "",
|
|
91250
|
-
source_session_id: String(normalizedData.targetSessionId ?? "")
|
|
91251
|
-
};
|
|
91252
|
-
void this.buildMeshCheckpointContext(workspace, baseContext).then((ctx) => {
|
|
91253
|
-
this.meshManager.emit({ trigger: "git_checkpoint_complete", context: ctx });
|
|
91254
|
-
});
|
|
91255
|
-
}
|
|
91238
|
+
this.emitMeshCheckpointCompleteIfNeeded(cmdType, routed, normalizedData);
|
|
91256
91239
|
return { ...routed, interactionId };
|
|
91257
91240
|
} catch (e) {
|
|
91258
91241
|
logCommand({ ts: (/* @__PURE__ */ new Date()).toISOString(), cmd: cmdType, source: "p2p", interactionId, success: false, error: e.message, durationMs: Date.now() - cmdStart });
|
|
@@ -91392,7 +91375,21 @@ ${err?.stack || ""}`);
|
|
|
91392
91375
|
return;
|
|
91393
91376
|
}
|
|
91394
91377
|
try {
|
|
91395
|
-
|
|
91378
|
+
let result;
|
|
91379
|
+
if (command === "mesh_relay_command") {
|
|
91380
|
+
if (!this.meshManager) throw new Error("Mesh manager is not initialized");
|
|
91381
|
+
const targetDaemonId = typeof normalizedArgs.targetDaemonId === "string" ? normalizedArgs.targetDaemonId : "";
|
|
91382
|
+
const relayedCommand = typeof normalizedArgs.command === "string" ? normalizedArgs.command : "";
|
|
91383
|
+
const relayedArgs = normalizedArgs.args && typeof normalizedArgs.args === "object" ? normalizedArgs.args : {};
|
|
91384
|
+
if (!targetDaemonId || !relayedCommand) {
|
|
91385
|
+
throw new Error("mesh_relay_command requires targetDaemonId and command");
|
|
91386
|
+
}
|
|
91387
|
+
const relayResult = await this.meshManager.sendCommand(targetDaemonId, relayedCommand, relayedArgs);
|
|
91388
|
+
result = { success: true, result: relayResult };
|
|
91389
|
+
} else {
|
|
91390
|
+
result = await this.components.router.execute(command, normalizedArgs, "ipc");
|
|
91391
|
+
this.emitMeshCheckpointCompleteIfNeeded(command, result, normalizedArgs);
|
|
91392
|
+
}
|
|
91396
91393
|
ws.send(JSON.stringify({
|
|
91397
91394
|
type: "ext:command_result",
|
|
91398
91395
|
payload: {
|
|
@@ -91511,8 +91508,54 @@ ${err?.stack || ""}`);
|
|
|
91511
91508
|
// src/wizard.ts
|
|
91512
91509
|
var wizard_exports = {};
|
|
91513
91510
|
__export(wizard_exports, {
|
|
91511
|
+
buildSetupReleaseContext: () => buildSetupReleaseContext,
|
|
91512
|
+
readLatestPublishedCliVersion: () => readLatestPublishedCliVersion,
|
|
91514
91513
|
runWizard: () => runWizard
|
|
91515
91514
|
});
|
|
91515
|
+
function normalizeSetupReleaseChannel(value) {
|
|
91516
|
+
if (typeof value !== "string") return null;
|
|
91517
|
+
const normalized = value.trim().toLowerCase();
|
|
91518
|
+
if (normalized === "stable" || normalized === "latest") return "stable";
|
|
91519
|
+
if (normalized === "preview" || normalized === "next") return "preview";
|
|
91520
|
+
return null;
|
|
91521
|
+
}
|
|
91522
|
+
function inferReleaseChannelFromServerUrl(serverUrl) {
|
|
91523
|
+
if (typeof serverUrl !== "string") return null;
|
|
91524
|
+
const normalized = serverUrl.trim().toLowerCase();
|
|
91525
|
+
if (!normalized) return null;
|
|
91526
|
+
if (normalized.includes("api-preview.adhf.dev") || normalized.includes("dev.adhf.dev")) return "preview";
|
|
91527
|
+
if (normalized.includes("api.adhf.dev") || normalized.includes("adhf.dev")) return "stable";
|
|
91528
|
+
return null;
|
|
91529
|
+
}
|
|
91530
|
+
function buildDashboardUrl(serverUrl, channel) {
|
|
91531
|
+
try {
|
|
91532
|
+
const url2 = new URL(serverUrl);
|
|
91533
|
+
if (url2.hostname === "api-preview.adhf.dev") return "https://dev.adhf.dev/dashboard";
|
|
91534
|
+
if (url2.hostname === "api.adhf.dev") return "https://adhf.dev/dashboard";
|
|
91535
|
+
if (url2.hostname === "127.0.0.1" || url2.hostname === "localhost") {
|
|
91536
|
+
url2.port = url2.port === "3100" ? "3000" : url2.port;
|
|
91537
|
+
url2.pathname = "/dashboard";
|
|
91538
|
+
url2.search = "";
|
|
91539
|
+
url2.hash = "";
|
|
91540
|
+
return url2.toString();
|
|
91541
|
+
}
|
|
91542
|
+
} catch {
|
|
91543
|
+
}
|
|
91544
|
+
return channel === "preview" ? "https://dev.adhf.dev/dashboard" : "https://adhf.dev/dashboard";
|
|
91545
|
+
}
|
|
91546
|
+
function buildSetupReleaseContext(options = {}) {
|
|
91547
|
+
const env3 = options.env || process.env;
|
|
91548
|
+
const envServerUrl = typeof env3.ADHDEV_SERVER_URL === "string" && env3.ADHDEV_SERVER_URL.trim() ? env3.ADHDEV_SERVER_URL.trim() : null;
|
|
91549
|
+
const config2 = options.config || {};
|
|
91550
|
+
const channel = normalizeSetupReleaseChannel(config2.updateChannel) || inferReleaseChannelFromServerUrl(envServerUrl) || inferReleaseChannelFromServerUrl(config2.serverUrl) || "stable";
|
|
91551
|
+
const serverUrl = envServerUrl || CHANNEL_SERVER_URL2[channel];
|
|
91552
|
+
return {
|
|
91553
|
+
channel,
|
|
91554
|
+
npmTag: CHANNEL_NPM_TAG2[channel],
|
|
91555
|
+
serverUrl,
|
|
91556
|
+
dashboardUrl: buildDashboardUrl(serverUrl, channel)
|
|
91557
|
+
};
|
|
91558
|
+
}
|
|
91516
91559
|
async function openBrowser(url2) {
|
|
91517
91560
|
const mod = await import("open");
|
|
91518
91561
|
return mod.default(url2);
|
|
@@ -91521,10 +91564,10 @@ function hasCloudMachineAuth() {
|
|
|
91521
91564
|
const config2 = loadConfig();
|
|
91522
91565
|
return Boolean(config2.machineSecret && config2.machineSecret.trim());
|
|
91523
91566
|
}
|
|
91524
|
-
function readLatestPublishedCliVersion(execFileSyncLocal) {
|
|
91567
|
+
function readLatestPublishedCliVersion(execFileSyncLocal, npmTag = "latest") {
|
|
91525
91568
|
const surface = resolveCurrentGlobalInstallSurface({ packageName: "adhdev" });
|
|
91526
91569
|
try {
|
|
91527
|
-
return execFileSyncLocal(surface.npmExecutable, [...surface.npmArgsPrefix || [], "view",
|
|
91570
|
+
return execFileSyncLocal(surface.npmExecutable, [...surface.npmArgsPrefix || [], "view", `adhdev@${npmTag}`, "version"], {
|
|
91528
91571
|
encoding: "utf-8",
|
|
91529
91572
|
timeout: 5e3,
|
|
91530
91573
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -91555,38 +91598,41 @@ function readInstalledGlobalCliVersion(execFileSyncLocal) {
|
|
|
91555
91598
|
}
|
|
91556
91599
|
async function runWizard(options = {}) {
|
|
91557
91600
|
console.log(LOGO);
|
|
91601
|
+
const config2 = loadConfig();
|
|
91602
|
+
const releaseContext = buildSetupReleaseContext({ config: config2 });
|
|
91558
91603
|
if (isSetupComplete() && hasCloudMachineAuth() && !options.force) {
|
|
91559
|
-
const config2 = loadConfig();
|
|
91560
91604
|
console.log(source_default.green("\u2713") + " ADHDev is already configured.");
|
|
91561
91605
|
console.log(source_default.gray(` Account: ${config2.userEmail || "not logged in"}`));
|
|
91606
|
+
console.log(source_default.gray(` Server: ${releaseContext.serverUrl}`));
|
|
91562
91607
|
console.log();
|
|
91563
|
-
await checkForUpdate();
|
|
91564
|
-
await startDaemonFlow();
|
|
91608
|
+
await checkForUpdate(releaseContext);
|
|
91609
|
+
await startDaemonFlow(releaseContext);
|
|
91565
91610
|
return;
|
|
91566
91611
|
}
|
|
91567
|
-
await quickSetup();
|
|
91612
|
+
await quickSetup(releaseContext);
|
|
91568
91613
|
}
|
|
91569
|
-
async function checkForUpdate() {
|
|
91614
|
+
async function checkForUpdate(releaseContext) {
|
|
91570
91615
|
try {
|
|
91571
91616
|
const { execFileSync: execFileSync6 } = await import("child_process");
|
|
91572
91617
|
const currentVersion = resolvePackageVersion();
|
|
91573
|
-
const latestVersion = readLatestPublishedCliVersion(execFileSync6);
|
|
91618
|
+
const latestVersion = readLatestPublishedCliVersion(execFileSync6, releaseContext.npmTag);
|
|
91574
91619
|
if (!latestVersion) return;
|
|
91575
91620
|
if (!currentVersion || !latestVersion || currentVersion === latestVersion) return;
|
|
91576
|
-
console.log(source_default.yellow(` Update available: ${currentVersion} \u2192 ${latestVersion}`));
|
|
91621
|
+
console.log(source_default.yellow(` Update available (${releaseContext.channel}/${releaseContext.npmTag}): ${currentVersion} \u2192 ${latestVersion}`));
|
|
91577
91622
|
const { doUpdate } = await (await Promise.resolve().then(() => (init_lib(), lib_exports))).default.prompt([{
|
|
91578
91623
|
type: "confirm",
|
|
91579
91624
|
name: "doUpdate",
|
|
91580
|
-
message: `Update adhdev CLI to v${latestVersion}?`,
|
|
91625
|
+
message: `Update adhdev CLI to v${latestVersion} from ${releaseContext.npmTag}?`,
|
|
91581
91626
|
default: true
|
|
91582
91627
|
}]);
|
|
91583
91628
|
if (!doUpdate) {
|
|
91584
|
-
console.log(source_default.gray(
|
|
91629
|
+
console.log(source_default.gray(` Skipping update. Run: npm install -g adhdev@${releaseContext.npmTag}
|
|
91630
|
+
`));
|
|
91585
91631
|
return;
|
|
91586
91632
|
}
|
|
91587
91633
|
const spinner = (await Promise.resolve().then(() => (init_ora(), ora_exports))).default("Updating adhdev CLI...").start();
|
|
91588
91634
|
try {
|
|
91589
|
-
const installCommand = buildPinnedGlobalInstallCommand({ packageName: "adhdev", targetVersion:
|
|
91635
|
+
const installCommand = buildPinnedGlobalInstallCommand({ packageName: "adhdev", targetVersion: releaseContext.npmTag });
|
|
91590
91636
|
execFileSync6(installCommand.command, installCommand.args, {
|
|
91591
91637
|
encoding: "utf-8",
|
|
91592
91638
|
timeout: 6e4,
|
|
@@ -91597,14 +91643,17 @@ async function checkForUpdate() {
|
|
|
91597
91643
|
console.log();
|
|
91598
91644
|
} catch (e) {
|
|
91599
91645
|
spinner.fail("Update failed");
|
|
91600
|
-
console.log(source_default.gray(
|
|
91646
|
+
console.log(source_default.gray(` Manual: npm install -g adhdev@${releaseContext.npmTag}
|
|
91647
|
+
`));
|
|
91601
91648
|
}
|
|
91602
91649
|
} catch {
|
|
91603
91650
|
}
|
|
91604
91651
|
}
|
|
91605
|
-
async function quickSetup() {
|
|
91652
|
+
async function quickSetup(releaseContext) {
|
|
91606
91653
|
console.log(source_default.bold("\n\u{1F680} Quick Setup\n"));
|
|
91607
|
-
|
|
91654
|
+
console.log(source_default.gray(` Channel: ${releaseContext.channel} (${releaseContext.npmTag})`));
|
|
91655
|
+
console.log(source_default.gray(` Server: ${releaseContext.serverUrl}`));
|
|
91656
|
+
const loginResult = await loginFlow(releaseContext);
|
|
91608
91657
|
const setupDate = (/* @__PURE__ */ new Date()).toISOString();
|
|
91609
91658
|
if (!loginResult) {
|
|
91610
91659
|
updateConfig({
|
|
@@ -91615,7 +91664,9 @@ async function quickSetup() {
|
|
|
91615
91664
|
setupDate,
|
|
91616
91665
|
userEmail: null,
|
|
91617
91666
|
userName: null,
|
|
91618
|
-
machineSecret: null
|
|
91667
|
+
machineSecret: null,
|
|
91668
|
+
updateChannel: releaseContext.channel,
|
|
91669
|
+
serverUrl: releaseContext.serverUrl
|
|
91619
91670
|
});
|
|
91620
91671
|
console.log(source_default.yellow("\u26A0 Setup is not complete without login. Run `adhdev setup` after signing in."));
|
|
91621
91672
|
}
|
|
@@ -91626,14 +91677,16 @@ async function quickSetup() {
|
|
|
91626
91677
|
userEmail: loginResult.email,
|
|
91627
91678
|
userName: loginResult.name,
|
|
91628
91679
|
setupDate,
|
|
91680
|
+
updateChannel: releaseContext.channel,
|
|
91681
|
+
serverUrl: releaseContext.serverUrl,
|
|
91629
91682
|
...loginResult.registeredMachineId ? { registeredMachineId: loginResult.registeredMachineId } : {}
|
|
91630
91683
|
};
|
|
91631
91684
|
updateConfig(configUpdate);
|
|
91632
91685
|
console.log(source_default.green(` \u2713 Machine registered`));
|
|
91633
91686
|
}
|
|
91634
|
-
await installCliOnly();
|
|
91687
|
+
await installCliOnly(releaseContext);
|
|
91635
91688
|
if (loginResult) {
|
|
91636
|
-
await startDaemonFlow();
|
|
91689
|
+
await startDaemonFlow(releaseContext);
|
|
91637
91690
|
} else {
|
|
91638
91691
|
console.log(source_default.gray(" Start daemon after login: adhdev setup"));
|
|
91639
91692
|
console.log();
|
|
@@ -91642,6 +91695,7 @@ async function quickSetup() {
|
|
|
91642
91695
|
console.log(source_default.bold("\n\u{1F389} Setup Complete!\n"));
|
|
91643
91696
|
console.log(` ${source_default.bold("User:")} ${loginResult?.email || "not logged in"}`);
|
|
91644
91697
|
console.log(` ${source_default.bold("Status:")} ${loginResult ? source_default.green("Ready to connect") : source_default.yellow("Login required")}`);
|
|
91698
|
+
console.log(` ${source_default.bold("Server:")} ${releaseContext.serverUrl}`);
|
|
91645
91699
|
console.log();
|
|
91646
91700
|
console.log(source_default.gray(" Next steps:"));
|
|
91647
91701
|
console.log(source_default.gray(` ${loginResult ? "adhdev daemon \u2014 Start the main daemon (IDE / remote features)" : "adhdev setup \u2014 Sign in to finish setup and enable the daemon"}`));
|
|
@@ -91652,11 +91706,12 @@ async function quickSetup() {
|
|
|
91652
91706
|
console.log(source_default.gray(" adhdev launch claude \u2014 Start Claude Code agent"));
|
|
91653
91707
|
console.log(source_default.gray(" adhdev status \u2014 Check setup status"));
|
|
91654
91708
|
console.log();
|
|
91655
|
-
console.log(source_default.cyan(
|
|
91709
|
+
console.log(source_default.cyan(` Dashboard: ${releaseContext.dashboardUrl}`));
|
|
91656
91710
|
console.log();
|
|
91657
91711
|
}
|
|
91658
|
-
async function loginFlow() {
|
|
91712
|
+
async function loginFlow(releaseContext) {
|
|
91659
91713
|
console.log(source_default.bold("\n\u{1F510} Login to ADHDev\n"));
|
|
91714
|
+
console.log(source_default.gray(` Auth server: ${releaseContext.serverUrl}`));
|
|
91660
91715
|
const { wantLogin } = await lib_default.prompt([
|
|
91661
91716
|
{
|
|
91662
91717
|
type: "confirm",
|
|
@@ -91673,7 +91728,7 @@ async function loginFlow() {
|
|
|
91673
91728
|
try {
|
|
91674
91729
|
const config2 = loadConfig();
|
|
91675
91730
|
const os31 = await import("os");
|
|
91676
|
-
const res = await fetch(`${
|
|
91731
|
+
const res = await fetch(`${releaseContext.serverUrl}/auth/cli/init`, {
|
|
91677
91732
|
method: "POST",
|
|
91678
91733
|
headers: { "Content-Type": "application/json" },
|
|
91679
91734
|
body: JSON.stringify({
|
|
@@ -91715,7 +91770,7 @@ async function loginFlow() {
|
|
|
91715
91770
|
while (Date.now() - startTime < timeout) {
|
|
91716
91771
|
await new Promise((r) => setTimeout(r, 3e3));
|
|
91717
91772
|
try {
|
|
91718
|
-
const res = await fetch(`${
|
|
91773
|
+
const res = await fetch(`${releaseContext.serverUrl}/auth/cli/poll`, {
|
|
91719
91774
|
method: "POST",
|
|
91720
91775
|
headers: { "Content-Type": "application/json" },
|
|
91721
91776
|
body: JSON.stringify({ deviceCode })
|
|
@@ -91745,9 +91800,9 @@ async function loginFlow() {
|
|
|
91745
91800
|
console.log();
|
|
91746
91801
|
console.log(source_default.yellow(" To fix this, do one of the following:"));
|
|
91747
91802
|
console.log(source_default.gray(" 1. Remove an unused machine from the dashboard:"));
|
|
91748
|
-
console.log(source_default.gray(
|
|
91803
|
+
console.log(source_default.gray(` ${releaseContext.dashboardUrl.replace(/\/dashboard$/, "/account")} \u2192 Registered Machines \u2192 \u2715 Remove`));
|
|
91749
91804
|
console.log(source_default.gray(" 2. Upgrade your plan:"));
|
|
91750
|
-
console.log(source_default.gray(
|
|
91805
|
+
console.log(source_default.gray(` ${releaseContext.dashboardUrl.replace(/\/dashboard$/, "/account?tab=billing")}`));
|
|
91751
91806
|
console.log();
|
|
91752
91807
|
console.log(source_default.gray(" Then run `adhdev setup` again."));
|
|
91753
91808
|
console.log();
|
|
@@ -91759,11 +91814,12 @@ async function loginFlow() {
|
|
|
91759
91814
|
pollSpinner.fail("Authentication timed out");
|
|
91760
91815
|
return null;
|
|
91761
91816
|
}
|
|
91762
|
-
async function startDaemonFlow() {
|
|
91817
|
+
async function startDaemonFlow(releaseContext) {
|
|
91763
91818
|
const { isDaemonRunning: isDaemonRunning2 } = await Promise.resolve().then(() => (init_adhdev_daemon(), adhdev_daemon_exports));
|
|
91764
91819
|
if (isDaemonRunning2()) {
|
|
91765
91820
|
console.log(source_default.green(" \u2713 Daemon is already running"));
|
|
91766
|
-
console.log(source_default.gray(
|
|
91821
|
+
console.log(source_default.gray(` Dashboard: ${releaseContext.dashboardUrl}
|
|
91822
|
+
`));
|
|
91767
91823
|
return;
|
|
91768
91824
|
}
|
|
91769
91825
|
const { startDaemon } = await lib_default.prompt([
|
|
@@ -91817,7 +91873,7 @@ async function startDaemonFlow() {
|
|
|
91817
91873
|
} else {
|
|
91818
91874
|
daemonSpinner.warn("Daemon starting in background (may take a few seconds)");
|
|
91819
91875
|
}
|
|
91820
|
-
console.log(source_default.gray(
|
|
91876
|
+
console.log(source_default.gray(` Dashboard: ${releaseContext.dashboardUrl}`));
|
|
91821
91877
|
console.log(source_default.gray(` Logs: ${logPath}`));
|
|
91822
91878
|
console.log();
|
|
91823
91879
|
} catch (e) {
|
|
@@ -91825,7 +91881,7 @@ async function startDaemonFlow() {
|
|
|
91825
91881
|
console.log(source_default.gray(" Manual: adhdev daemon\n"));
|
|
91826
91882
|
}
|
|
91827
91883
|
}
|
|
91828
|
-
async function installCliOnly() {
|
|
91884
|
+
async function installCliOnly(releaseContext) {
|
|
91829
91885
|
const { execFileSync: execFileSyncLocal } = await import("child_process");
|
|
91830
91886
|
const currentVersion = readInstalledGlobalCliVersion(execFileSyncLocal);
|
|
91831
91887
|
const isNpx = process.env.npm_execpath?.includes("npx") || process.argv[1]?.includes("npx") || process.argv[1]?.includes("_npx");
|
|
@@ -91838,7 +91894,7 @@ async function installCliOnly() {
|
|
|
91838
91894
|
console.log();
|
|
91839
91895
|
if (currentVersion) {
|
|
91840
91896
|
console.log(source_default.green(` \u2713 Currently installed: v${currentVersion}`));
|
|
91841
|
-
const latestVersion = readLatestPublishedCliVersion(execFileSyncLocal);
|
|
91897
|
+
const latestVersion = readLatestPublishedCliVersion(execFileSyncLocal, releaseContext.npmTag);
|
|
91842
91898
|
if (latestVersion && currentVersion === latestVersion) {
|
|
91843
91899
|
console.log(source_default.gray(" (Already up to date)"));
|
|
91844
91900
|
return;
|
|
@@ -91847,12 +91903,12 @@ async function installCliOnly() {
|
|
|
91847
91903
|
const { doUpdate } = await lib_default.prompt([{
|
|
91848
91904
|
type: "confirm",
|
|
91849
91905
|
name: "doUpdate",
|
|
91850
|
-
message: `Update to
|
|
91906
|
+
message: `Update to ${releaseContext.npmTag} version${latestVersion ? ` (v${latestVersion})` : ""}?`,
|
|
91851
91907
|
default: true
|
|
91852
91908
|
}]);
|
|
91853
91909
|
if (!doUpdate) return;
|
|
91854
91910
|
} else {
|
|
91855
|
-
console.log(source_default.gray(
|
|
91911
|
+
console.log(source_default.gray(` Updating to ${releaseContext.npmTag}...`));
|
|
91856
91912
|
}
|
|
91857
91913
|
} else {
|
|
91858
91914
|
console.log(source_default.yellow(" \u2717 Not installed globally"));
|
|
@@ -91860,7 +91916,7 @@ async function installCliOnly() {
|
|
|
91860
91916
|
const { doInstall } = await lib_default.prompt([{
|
|
91861
91917
|
type: "confirm",
|
|
91862
91918
|
name: "doInstall",
|
|
91863
|
-
message:
|
|
91919
|
+
message: `Install adhdev CLI globally? (npm install -g adhdev@${releaseContext.npmTag})`,
|
|
91864
91920
|
default: true
|
|
91865
91921
|
}]);
|
|
91866
91922
|
if (!doInstall) {
|
|
@@ -91873,14 +91929,14 @@ async function installCliOnly() {
|
|
|
91873
91929
|
}
|
|
91874
91930
|
const installSpinner = ora2("Installing adhdev CLI...").start();
|
|
91875
91931
|
try {
|
|
91876
|
-
const installCommand = buildPinnedGlobalInstallCommand({ packageName: "adhdev", targetVersion:
|
|
91932
|
+
const installCommand = buildPinnedGlobalInstallCommand({ packageName: "adhdev", targetVersion: releaseContext.npmTag });
|
|
91877
91933
|
execFileSyncLocal(installCommand.command, installCommand.args, {
|
|
91878
91934
|
encoding: "utf-8",
|
|
91879
91935
|
timeout: 6e4,
|
|
91880
91936
|
stdio: ["pipe", "pipe", "pipe"],
|
|
91881
91937
|
...installCommand.execOptions
|
|
91882
91938
|
});
|
|
91883
|
-
const newVersion = readInstalledGlobalCliVersion(execFileSyncLocal) ||
|
|
91939
|
+
const newVersion = readInstalledGlobalCliVersion(execFileSyncLocal) || releaseContext.npmTag;
|
|
91884
91940
|
installSpinner.succeed(`adhdev CLI ${currentVersion ? "updated" : "installed"} \u2713 (v${newVersion})`);
|
|
91885
91941
|
console.log(source_default.gray(" Try: adhdev daemon"));
|
|
91886
91942
|
console.log();
|
|
@@ -91891,11 +91947,11 @@ async function installCliOnly() {
|
|
|
91891
91947
|
if (osModule.platform() === "win32") {
|
|
91892
91948
|
console.log(source_default.gray(" On Windows, run PowerShell as Administrator"));
|
|
91893
91949
|
}
|
|
91894
|
-
console.log(source_default.gray(
|
|
91950
|
+
console.log(source_default.gray(` Manual: npm install -g adhdev@${releaseContext.npmTag}`));
|
|
91895
91951
|
console.log();
|
|
91896
91952
|
}
|
|
91897
91953
|
}
|
|
91898
|
-
var
|
|
91954
|
+
var CHANNEL_NPM_TAG2, CHANNEL_SERVER_URL2, LOGO, DIVIDER;
|
|
91899
91955
|
var init_wizard = __esm({
|
|
91900
91956
|
"src/wizard.ts"() {
|
|
91901
91957
|
"use strict";
|
|
@@ -91904,7 +91960,14 @@ var init_wizard = __esm({
|
|
|
91904
91960
|
init_ora();
|
|
91905
91961
|
init_src();
|
|
91906
91962
|
init_version();
|
|
91907
|
-
|
|
91963
|
+
CHANNEL_NPM_TAG2 = {
|
|
91964
|
+
stable: "latest",
|
|
91965
|
+
preview: "next"
|
|
91966
|
+
};
|
|
91967
|
+
CHANNEL_SERVER_URL2 = {
|
|
91968
|
+
stable: "https://api.adhf.dev",
|
|
91969
|
+
preview: "https://api-preview.adhf.dev"
|
|
91970
|
+
};
|
|
91908
91971
|
LOGO = `
|
|
91909
91972
|
${source_default.cyan("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")}
|
|
91910
91973
|
${source_default.cyan("\u2551")} ${source_default.bold.white("\u{1F9A6} ADHDev Setup Wizard")} ${source_default.cyan("\u2551")}
|
|
@@ -93928,8 +93991,8 @@ var DEFAULT_TRACE_FOLLOW_INTERVAL_MS = 1500;
|
|
|
93928
93991
|
var DEFAULT_DAEMON_PORT_TEXT = String(DEFAULT_DAEMON_PORT);
|
|
93929
93992
|
var DEV_SERVER_PORT2 = 19280;
|
|
93930
93993
|
var DEV_SERVER_BASE_URL = `http://127.0.0.1:${DEV_SERVER_PORT2}`;
|
|
93931
|
-
var
|
|
93932
|
-
var
|
|
93994
|
+
var CHANNEL_NPM_TAG3 = { stable: "latest", preview: "next" };
|
|
93995
|
+
var CHANNEL_SERVER_URL3 = {
|
|
93933
93996
|
stable: "https://api.adhf.dev",
|
|
93934
93997
|
preview: "https://api-preview.adhf.dev"
|
|
93935
93998
|
};
|
|
@@ -93949,11 +94012,11 @@ async function resolveConfiguredUpdateChannel() {
|
|
|
93949
94012
|
}
|
|
93950
94013
|
}
|
|
93951
94014
|
function releaseChannelLabel(channel) {
|
|
93952
|
-
return `${channel} (${
|
|
94015
|
+
return `${channel} (${CHANNEL_NPM_TAG3[channel]})`;
|
|
93953
94016
|
}
|
|
93954
94017
|
async function persistReleaseChannel(channel) {
|
|
93955
94018
|
const { updateConfig: updateConfig2 } = await Promise.resolve().then(() => (init_src(), src_exports));
|
|
93956
|
-
updateConfig2({ updateChannel: channel, serverUrl:
|
|
94019
|
+
updateConfig2({ updateChannel: channel, serverUrl: CHANNEL_SERVER_URL3[channel] });
|
|
93957
94020
|
}
|
|
93958
94021
|
function hideCommand(command) {
|
|
93959
94022
|
command._hidden = true;
|
|
@@ -94278,7 +94341,7 @@ async function runDaemonUpgrade(options, pkgVersion3) {
|
|
|
94278
94341
|
return;
|
|
94279
94342
|
}
|
|
94280
94343
|
const configuredChannel = requestedChannel || await resolveConfiguredUpdateChannel();
|
|
94281
|
-
const npmTag =
|
|
94344
|
+
const npmTag = CHANNEL_NPM_TAG3[configuredChannel];
|
|
94282
94345
|
if (requestedChannel) {
|
|
94283
94346
|
await persistReleaseChannel(configuredChannel);
|
|
94284
94347
|
}
|
|
@@ -94949,7 +95012,7 @@ function registerDaemonCommands(program2, pkgVersion3) {
|
|
|
94949
95012
|
const current = normalizeReleaseChannel2(config2.updateChannel) || "stable";
|
|
94950
95013
|
console.log(source_default.bold("\n ADHDev Channel\n"));
|
|
94951
95014
|
console.log(` ${source_default.bold("Channel:")} ${releaseChannelLabel(current)}`);
|
|
94952
|
-
console.log(` ${source_default.bold("Server:")} ${config2.serverUrl ||
|
|
95015
|
+
console.log(` ${source_default.bold("Server:")} ${config2.serverUrl || CHANNEL_SERVER_URL3[current]}`);
|
|
94953
95016
|
console.log();
|
|
94954
95017
|
});
|
|
94955
95018
|
channel.command("set <channel>").description("Set the ADHDev channel: stable/latest or preview/next").action(async (channelName) => {
|
|
@@ -94964,7 +95027,7 @@ function registerDaemonCommands(program2, pkgVersion3) {
|
|
|
94964
95027
|
await persistReleaseChannel(selected);
|
|
94965
95028
|
console.log(source_default.green(`
|
|
94966
95029
|
\u2713 Channel set to ${releaseChannelLabel(selected)}`));
|
|
94967
|
-
console.log(source_default.gray(` Server: ${
|
|
95030
|
+
console.log(source_default.gray(` Server: ${CHANNEL_SERVER_URL3[selected]}`));
|
|
94968
95031
|
console.log(source_default.gray(` Update: adhdev update --channel ${selected}
|
|
94969
95032
|
`));
|
|
94970
95033
|
});
|
|
@@ -95094,33 +95157,33 @@ function buildDoctorAdvice(input) {
|
|
|
95094
95157
|
}
|
|
95095
95158
|
|
|
95096
95159
|
// src/cli/service-commands.ts
|
|
95097
|
-
var
|
|
95160
|
+
var import_node_fs3 = __toESM(require("fs"));
|
|
95098
95161
|
var import_node_path5 = __toESM(require("path"));
|
|
95099
|
-
var
|
|
95162
|
+
var import_node_os4 = __toESM(require("os"));
|
|
95100
95163
|
var import_node_child_process2 = require("child_process");
|
|
95101
95164
|
init_source();
|
|
95102
95165
|
init_src();
|
|
95103
95166
|
var DEFAULT_LOCAL_DAEMON_HEALTH_TIMEOUT_MS3 = 1500;
|
|
95104
95167
|
var LAUNCHD_LABEL = "dev.adhf.daemon";
|
|
95105
|
-
var ADHDEV_DIR = import_node_path5.default.join(
|
|
95168
|
+
var ADHDEV_DIR = import_node_path5.default.join(import_node_os4.default.homedir(), ".adhdev");
|
|
95106
95169
|
var LOG_OUT = import_node_path5.default.join(ADHDEV_DIR, "daemon-launchd.out");
|
|
95107
95170
|
var LOG_ERR = import_node_path5.default.join(ADHDEV_DIR, "daemon-launchd.err");
|
|
95108
95171
|
var MAX_LOG_SIZE2 = 10 * 1024 * 1024;
|
|
95109
95172
|
function getDarwinPlistPath() {
|
|
95110
|
-
return import_node_path5.default.join(
|
|
95173
|
+
return import_node_path5.default.join(import_node_os4.default.homedir(), "Library", "LaunchAgents", `${LAUNCHD_LABEL}.plist`);
|
|
95111
95174
|
}
|
|
95112
95175
|
function getWindowsStartupDir() {
|
|
95113
|
-
const appData = process.env.APPDATA || import_node_path5.default.join(
|
|
95176
|
+
const appData = process.env.APPDATA || import_node_path5.default.join(import_node_os4.default.homedir(), "AppData", "Roaming");
|
|
95114
95177
|
return import_node_path5.default.join(appData, "Microsoft", "Windows", "Start Menu", "Programs", "Startup");
|
|
95115
95178
|
}
|
|
95116
95179
|
function getWindowsVbsPath() {
|
|
95117
95180
|
return import_node_path5.default.join(getWindowsStartupDir(), "adhdev-daemon.vbs");
|
|
95118
95181
|
}
|
|
95119
95182
|
function resolveCliPath() {
|
|
95120
|
-
return
|
|
95183
|
+
return import_node_fs3.default.realpathSync(process.argv[1]);
|
|
95121
95184
|
}
|
|
95122
95185
|
function ensureDir(dir) {
|
|
95123
|
-
if (!
|
|
95186
|
+
if (!import_node_fs3.default.existsSync(dir)) import_node_fs3.default.mkdirSync(dir, { recursive: true });
|
|
95124
95187
|
}
|
|
95125
95188
|
async function fetchHealth() {
|
|
95126
95189
|
const controller = new AbortController();
|
|
@@ -95162,13 +95225,13 @@ function formatElapsed(etime) {
|
|
|
95162
95225
|
}
|
|
95163
95226
|
function rotateLogIfNeeded(logPath) {
|
|
95164
95227
|
try {
|
|
95165
|
-
if (!
|
|
95166
|
-
const stat5 =
|
|
95228
|
+
if (!import_node_fs3.default.existsSync(logPath)) return;
|
|
95229
|
+
const stat5 = import_node_fs3.default.statSync(logPath);
|
|
95167
95230
|
if (stat5.size > MAX_LOG_SIZE2) {
|
|
95168
95231
|
const rotated = logPath + ".old";
|
|
95169
|
-
if (
|
|
95170
|
-
|
|
95171
|
-
|
|
95232
|
+
if (import_node_fs3.default.existsSync(rotated)) import_node_fs3.default.unlinkSync(rotated);
|
|
95233
|
+
import_node_fs3.default.renameSync(logPath, rotated);
|
|
95234
|
+
import_node_fs3.default.writeFileSync(logPath, `[log rotated at ${(/* @__PURE__ */ new Date()).toISOString()}]
|
|
95172
95235
|
`, "utf-8");
|
|
95173
95236
|
}
|
|
95174
95237
|
} catch {
|
|
@@ -95179,7 +95242,7 @@ function rotateLogs() {
|
|
|
95179
95242
|
rotateLogIfNeeded(LOG_ERR);
|
|
95180
95243
|
}
|
|
95181
95244
|
function buildPlist(nodeExe, cliExe) {
|
|
95182
|
-
const brewPrefix =
|
|
95245
|
+
const brewPrefix = import_node_fs3.default.existsSync("/opt/homebrew/bin") ? "/opt/homebrew/bin" : "/usr/local/bin";
|
|
95183
95246
|
const nodeDir = import_node_path5.default.dirname(nodeExe);
|
|
95184
95247
|
const pathEntries = /* @__PURE__ */ new Set([nodeDir, brewPrefix, "/usr/local/bin", "/usr/bin", "/bin", "/usr/sbin", "/sbin"]);
|
|
95185
95248
|
const pathValue = Array.from(pathEntries).join(":");
|
|
@@ -95220,7 +95283,7 @@ function installDarwin(nodeExe, cliExe) {
|
|
|
95220
95283
|
const plistPath = getDarwinPlistPath();
|
|
95221
95284
|
ensureDir(ADHDEV_DIR);
|
|
95222
95285
|
ensureDir(import_node_path5.default.dirname(plistPath));
|
|
95223
|
-
|
|
95286
|
+
import_node_fs3.default.writeFileSync(plistPath, buildPlist(nodeExe, cliExe), "utf-8");
|
|
95224
95287
|
console.log(source_default.gray(` Plist: ${plistPath}`));
|
|
95225
95288
|
try {
|
|
95226
95289
|
(0, import_node_child_process2.execSync)(`launchctl unload "${plistPath}" 2>/dev/null`, { stdio: "ignore" });
|
|
@@ -95237,7 +95300,7 @@ function installDarwin(nodeExe, cliExe) {
|
|
|
95237
95300
|
}
|
|
95238
95301
|
function uninstallDarwin() {
|
|
95239
95302
|
const plistPath = getDarwinPlistPath();
|
|
95240
|
-
if (!
|
|
95303
|
+
if (!import_node_fs3.default.existsSync(plistPath)) {
|
|
95241
95304
|
console.log(source_default.yellow("\n \u26A0 Service is not installed."));
|
|
95242
95305
|
return;
|
|
95243
95306
|
}
|
|
@@ -95245,11 +95308,11 @@ function uninstallDarwin() {
|
|
|
95245
95308
|
(0, import_node_child_process2.execSync)(`launchctl unload "${plistPath}" 2>/dev/null`, { stdio: "ignore" });
|
|
95246
95309
|
} catch {
|
|
95247
95310
|
}
|
|
95248
|
-
|
|
95311
|
+
import_node_fs3.default.unlinkSync(plistPath);
|
|
95249
95312
|
console.log(source_default.green("\n \u2713 Removed LaunchAgent. Daemon will no longer auto-start."));
|
|
95250
95313
|
}
|
|
95251
95314
|
function isInstalledDarwin() {
|
|
95252
|
-
return
|
|
95315
|
+
return import_node_fs3.default.existsSync(getDarwinPlistPath());
|
|
95253
95316
|
}
|
|
95254
95317
|
function buildVbs(nodeExe, cliExe) {
|
|
95255
95318
|
const logFile = import_node_path5.default.join(ADHDEV_DIR, "daemon-service.log").replace(/\\/g, "\\\\");
|
|
@@ -95264,7 +95327,7 @@ function installWindows(nodeExe, cliExe) {
|
|
|
95264
95327
|
const vbsPath = getWindowsVbsPath();
|
|
95265
95328
|
ensureDir(ADHDEV_DIR);
|
|
95266
95329
|
ensureDir(import_node_path5.default.dirname(vbsPath));
|
|
95267
|
-
|
|
95330
|
+
import_node_fs3.default.writeFileSync(vbsPath, buildVbs(nodeExe, cliExe), "utf-8");
|
|
95268
95331
|
console.log(source_default.gray(` Startup script: ${vbsPath}`));
|
|
95269
95332
|
console.log(source_default.green("\n \u2713 Registered in Startup folder \u2014 daemon will start on login (hidden)."));
|
|
95270
95333
|
console.log(source_default.gray(` Logs: ${import_node_path5.default.join(ADHDEV_DIR, "daemon-service.log")}`));
|
|
@@ -95272,22 +95335,22 @@ function installWindows(nodeExe, cliExe) {
|
|
|
95272
95335
|
}
|
|
95273
95336
|
function uninstallWindows() {
|
|
95274
95337
|
const vbsPath = getWindowsVbsPath();
|
|
95275
|
-
if (!
|
|
95338
|
+
if (!import_node_fs3.default.existsSync(vbsPath)) {
|
|
95276
95339
|
console.log(source_default.yellow("\n \u26A0 Service is not installed."));
|
|
95277
95340
|
return;
|
|
95278
95341
|
}
|
|
95279
|
-
|
|
95342
|
+
import_node_fs3.default.unlinkSync(vbsPath);
|
|
95280
95343
|
console.log(source_default.green("\n \u2713 Removed Startup script. Daemon will no longer auto-start."));
|
|
95281
95344
|
console.log(source_default.gray(" Note: a currently running daemon is not affected. Stop with: adhdev daemon:stop"));
|
|
95282
95345
|
}
|
|
95283
95346
|
function isInstalledWindows() {
|
|
95284
|
-
return
|
|
95347
|
+
return import_node_fs3.default.existsSync(getWindowsVbsPath());
|
|
95285
95348
|
}
|
|
95286
95349
|
function registerServiceCommands(program2) {
|
|
95287
95350
|
const svc = program2.command("service").description("\u{1F50C} Manage ADHDev as an OS background auto-start service");
|
|
95288
95351
|
svc.command("install").description("Register ADHDev daemon to start automatically on login").action(async () => {
|
|
95289
95352
|
console.log(source_default.bold("\n \u{1F680} Installing ADHDev Background Service"));
|
|
95290
|
-
const platform12 =
|
|
95353
|
+
const platform12 = import_node_os4.default.platform();
|
|
95291
95354
|
const nodeExe = process.execPath;
|
|
95292
95355
|
const cliExe = resolveCliPath();
|
|
95293
95356
|
console.log(source_default.gray(` Node: ${nodeExe}`));
|
|
@@ -95306,7 +95369,7 @@ function registerServiceCommands(program2) {
|
|
|
95306
95369
|
});
|
|
95307
95370
|
svc.command("uninstall").description("Remove the OS background service").action(async () => {
|
|
95308
95371
|
console.log(source_default.bold("\n \u{1F5D1}\uFE0F Removing ADHDev Background Service"));
|
|
95309
|
-
const platform12 =
|
|
95372
|
+
const platform12 = import_node_os4.default.platform();
|
|
95310
95373
|
if (platform12 === "darwin") {
|
|
95311
95374
|
uninstallDarwin();
|
|
95312
95375
|
} else if (platform12 === "win32") {
|
|
@@ -95317,7 +95380,7 @@ function registerServiceCommands(program2) {
|
|
|
95317
95380
|
console.log();
|
|
95318
95381
|
});
|
|
95319
95382
|
svc.command("status").description("Show service installation state and live daemon health").action(async () => {
|
|
95320
|
-
const platform12 =
|
|
95383
|
+
const platform12 = import_node_os4.default.platform();
|
|
95321
95384
|
const installed = platform12 === "darwin" ? isInstalledDarwin() : platform12 === "win32" ? isInstalledWindows() : false;
|
|
95322
95385
|
if (installed) {
|
|
95323
95386
|
console.log(source_default.green("\n \u2713 Service is installed."));
|
|
@@ -95337,8 +95400,8 @@ function registerServiceCommands(program2) {
|
|
|
95337
95400
|
} else {
|
|
95338
95401
|
console.log(source_default.yellow(" \u2717 Daemon is not running."));
|
|
95339
95402
|
}
|
|
95340
|
-
const outSize =
|
|
95341
|
-
const errSize =
|
|
95403
|
+
const outSize = import_node_fs3.default.existsSync(LOG_OUT) ? import_node_fs3.default.statSync(LOG_OUT).size : 0;
|
|
95404
|
+
const errSize = import_node_fs3.default.existsSync(LOG_ERR) ? import_node_fs3.default.statSync(LOG_ERR).size : 0;
|
|
95342
95405
|
if (outSize > 0 || errSize > 0) {
|
|
95343
95406
|
console.log(source_default.gray(` Logs: stdout ${formatBytes(outSize)}, stderr ${formatBytes(errSize)}`));
|
|
95344
95407
|
}
|
|
@@ -95347,13 +95410,13 @@ function registerServiceCommands(program2) {
|
|
|
95347
95410
|
svc.command("logs").description("View daemon service logs").option("--err", "Show stderr log instead of stdout").option("--clear", "Truncate all log files").option("-n, --lines <count>", "Number of lines to show", "30").action(async (options) => {
|
|
95348
95411
|
if (options.clear) {
|
|
95349
95412
|
for (const f of [LOG_OUT, LOG_ERR]) {
|
|
95350
|
-
if (
|
|
95413
|
+
if (import_node_fs3.default.existsSync(f)) import_node_fs3.default.writeFileSync(f, "", "utf-8");
|
|
95351
95414
|
}
|
|
95352
95415
|
console.log(source_default.green("\n \u2713 Logs cleared.\n"));
|
|
95353
95416
|
return;
|
|
95354
95417
|
}
|
|
95355
95418
|
const logFile = options.err ? LOG_ERR : LOG_OUT;
|
|
95356
|
-
if (!
|
|
95419
|
+
if (!import_node_fs3.default.existsSync(logFile)) {
|
|
95357
95420
|
console.log(source_default.gray(`
|
|
95358
95421
|
No log file found: ${logFile}
|
|
95359
95422
|
`));
|
|
@@ -95363,20 +95426,20 @@ function registerServiceCommands(program2) {
|
|
|
95363
95426
|
console.log(source_default.gray(`
|
|
95364
95427
|
\u2500\u2500 ${options.err ? "stderr" : "stdout"}: ${logFile} (last ${lines} lines) \u2500\u2500
|
|
95365
95428
|
`));
|
|
95366
|
-
const content =
|
|
95429
|
+
const content = import_node_fs3.default.readFileSync(logFile, "utf-8");
|
|
95367
95430
|
const allLines = content.split("\n");
|
|
95368
95431
|
const lastLines = allLines.slice(-lines).join("\n");
|
|
95369
95432
|
if (lastLines.trim()) console.log(lastLines);
|
|
95370
95433
|
console.log(source_default.gray("\n (watching for new output, Ctrl+C to stop)\n"));
|
|
95371
95434
|
let offset = Buffer.byteLength(content, "utf-8");
|
|
95372
|
-
const watcher =
|
|
95435
|
+
const watcher = import_node_fs3.default.watchFile(logFile, { interval: 500 }, () => {
|
|
95373
95436
|
try {
|
|
95374
|
-
const stat5 =
|
|
95437
|
+
const stat5 = import_node_fs3.default.statSync(logFile);
|
|
95375
95438
|
if (stat5.size > offset) {
|
|
95376
|
-
const fd =
|
|
95439
|
+
const fd = import_node_fs3.default.openSync(logFile, "r");
|
|
95377
95440
|
const buf = Buffer.alloc(stat5.size - offset);
|
|
95378
|
-
|
|
95379
|
-
|
|
95441
|
+
import_node_fs3.default.readSync(fd, buf, 0, buf.length, offset);
|
|
95442
|
+
import_node_fs3.default.closeSync(fd);
|
|
95380
95443
|
process.stdout.write(buf.toString("utf-8"));
|
|
95381
95444
|
offset = stat5.size;
|
|
95382
95445
|
} else if (stat5.size < offset) {
|
|
@@ -95386,14 +95449,14 @@ function registerServiceCommands(program2) {
|
|
|
95386
95449
|
}
|
|
95387
95450
|
});
|
|
95388
95451
|
const cleanup = () => {
|
|
95389
|
-
|
|
95452
|
+
import_node_fs3.default.unwatchFile(logFile);
|
|
95390
95453
|
process.exit(0);
|
|
95391
95454
|
};
|
|
95392
95455
|
process.on("SIGINT", cleanup);
|
|
95393
95456
|
process.on("SIGTERM", cleanup);
|
|
95394
95457
|
});
|
|
95395
95458
|
svc.command("restart").description("Restart the daemon process (service will auto-relaunch)").action(async () => {
|
|
95396
|
-
const platform12 =
|
|
95459
|
+
const platform12 = import_node_os4.default.platform();
|
|
95397
95460
|
const installed = platform12 === "darwin" ? isInstalledDarwin() : platform12 === "win32" ? isInstalledWindows() : false;
|
|
95398
95461
|
if (!installed) {
|
|
95399
95462
|
console.log(source_default.yellow("\n \u26A0 Service is not installed. Use `adhdev daemon:restart` for manual restart."));
|
|
@@ -95427,7 +95490,7 @@ function registerServiceCommands(program2) {
|
|
|
95427
95490
|
await new Promise((r) => setTimeout(r, 2e3));
|
|
95428
95491
|
if (platform12 === "win32") {
|
|
95429
95492
|
const vbsPath = getWindowsVbsPath();
|
|
95430
|
-
if (
|
|
95493
|
+
if (import_node_fs3.default.existsSync(vbsPath)) {
|
|
95431
95494
|
try {
|
|
95432
95495
|
(0, import_node_child_process2.execSync)(`wscript.exe "${vbsPath}"`, { stdio: "ignore", windowsHide: true });
|
|
95433
95496
|
} catch {
|
|
@@ -97361,7 +97424,7 @@ void (async () => {
|
|
|
97361
97424
|
});
|
|
97362
97425
|
/*! Bundled license information:
|
|
97363
97426
|
|
|
97364
|
-
chokidar/index.js:
|
|
97427
|
+
chokidar/esm/index.js:
|
|
97365
97428
|
(*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) *)
|
|
97366
97429
|
|
|
97367
97430
|
safe-buffer/index.js:
|