adhdev 0.9.76-rc.1 → 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 +330 -273
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +286 -231
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/vendor/mcp-server/index.js +52030 -41
- package/vendor/mcp-server/index.js.map +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -8917,6 +8917,14 @@ function getActiveChatOptions(profile) {
|
|
|
8917
8917
|
if (profile === "full") return {};
|
|
8918
8918
|
return LIVE_STATUS_ACTIVE_CHAT_OPTIONS;
|
|
8919
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
|
+
}
|
|
8920
8928
|
function shouldIncludeSessionControls(profile) {
|
|
8921
8929
|
return profile !== "live";
|
|
8922
8930
|
}
|
|
@@ -8972,9 +8980,7 @@ function buildIdeWorkspaceSession(state, cdpManagers, options) {
|
|
|
8972
8980
|
providerName: state.name,
|
|
8973
8981
|
kind: "workspace",
|
|
8974
8982
|
transport: "cdp-page",
|
|
8975
|
-
status:
|
|
8976
|
-
activeModal: activeChat?.activeModal || null
|
|
8977
|
-
}),
|
|
8983
|
+
status: resolveSessionStatus(activeChat, state.status),
|
|
8978
8984
|
title,
|
|
8979
8985
|
workspace,
|
|
8980
8986
|
...git && { git },
|
|
@@ -9009,9 +9015,7 @@ function buildExtensionAgentSession(parent, ext, options) {
|
|
|
9009
9015
|
providerSessionId: ext.providerSessionId,
|
|
9010
9016
|
kind: "agent",
|
|
9011
9017
|
transport: "cdp-webview",
|
|
9012
|
-
status:
|
|
9013
|
-
activeModal: activeChat?.activeModal || null
|
|
9014
|
-
}),
|
|
9018
|
+
status: resolveSessionStatus(activeChat, ext.status),
|
|
9015
9019
|
title: activeChat?.title || ext.name,
|
|
9016
9020
|
workspace,
|
|
9017
9021
|
...git && { git },
|
|
@@ -9061,9 +9065,7 @@ function buildCliSession(state, options) {
|
|
|
9061
9065
|
providerSessionId: state.providerSessionId,
|
|
9062
9066
|
kind: "agent",
|
|
9063
9067
|
transport: "pty",
|
|
9064
|
-
status:
|
|
9065
|
-
activeModal: activeChat?.activeModal || null
|
|
9066
|
-
}),
|
|
9068
|
+
status: resolveSessionStatus(activeChat, state.status),
|
|
9067
9069
|
title: activeChat?.title || state.name,
|
|
9068
9070
|
workspace,
|
|
9069
9071
|
...git && { git },
|
|
@@ -9111,9 +9113,7 @@ function buildAcpSession(state, options) {
|
|
|
9111
9113
|
providerName: state.name,
|
|
9112
9114
|
kind: "agent",
|
|
9113
9115
|
transport: "acp",
|
|
9114
|
-
status:
|
|
9115
|
-
activeModal: activeChat?.activeModal || null
|
|
9116
|
-
}),
|
|
9116
|
+
status: resolveSessionStatus(activeChat, state.status),
|
|
9117
9117
|
title: activeChat?.title || state.name,
|
|
9118
9118
|
workspace,
|
|
9119
9119
|
...git && { git },
|
|
@@ -14635,8 +14635,9 @@ var init_provider_cli_adapter = __esm({
|
|
|
14635
14635
|
const currentSnapshot = normalizeScreenSnapshot(screenText);
|
|
14636
14636
|
const lastSnapshot = this.lastScreenSnapshot;
|
|
14637
14637
|
if (!lastSnapshot || lastSnapshot === currentSnapshot) return screenText;
|
|
14638
|
-
const
|
|
14639
|
-
const
|
|
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);
|
|
14640
14641
|
if (staleSnapshotLooksActive && currentScreenLooksIdle) return screenText;
|
|
14641
14642
|
if (currentSnapshot.length >= lastSnapshot.length) return screenText;
|
|
14642
14643
|
return `${screenText}
|
|
@@ -35784,7 +35785,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
35784
35785
|
}
|
|
35785
35786
|
});
|
|
35786
35787
|
|
|
35787
|
-
// ../../oss/
|
|
35788
|
+
// ../../oss/node_modules/readdirp/esm/index.js
|
|
35788
35789
|
function readdirp(root, options = {}) {
|
|
35789
35790
|
let type = options.entryType || options.type;
|
|
35790
35791
|
if (type === "both")
|
|
@@ -35801,13 +35802,13 @@ function readdirp(root, options = {}) {
|
|
|
35801
35802
|
options.root = root;
|
|
35802
35803
|
return new ReaddirpStream(options);
|
|
35803
35804
|
}
|
|
35804
|
-
var import_promises3,
|
|
35805
|
-
var
|
|
35806
|
-
"../../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"() {
|
|
35807
35808
|
"use strict";
|
|
35808
35809
|
import_promises3 = require("fs/promises");
|
|
35809
|
-
import_node_path = require("path");
|
|
35810
35810
|
import_node_stream = require("stream");
|
|
35811
|
+
import_node_path = require("path");
|
|
35811
35812
|
EntryTypes = {
|
|
35812
35813
|
FILE_TYPE: "files",
|
|
35813
35814
|
DIR_TYPE: "directories",
|
|
@@ -35862,20 +35863,6 @@ var init_readdirp = __esm({
|
|
|
35862
35863
|
return emptyFn;
|
|
35863
35864
|
};
|
|
35864
35865
|
ReaddirpStream = class extends import_node_stream.Readable {
|
|
35865
|
-
parents;
|
|
35866
|
-
reading;
|
|
35867
|
-
parent;
|
|
35868
|
-
_stat;
|
|
35869
|
-
_maxDepth;
|
|
35870
|
-
_wantsDir;
|
|
35871
|
-
_wantsFile;
|
|
35872
|
-
_wantsEverything;
|
|
35873
|
-
_root;
|
|
35874
|
-
_isDirent;
|
|
35875
|
-
_statsProp;
|
|
35876
|
-
_rdOptions;
|
|
35877
|
-
_fileFilter;
|
|
35878
|
-
_directoryFilter;
|
|
35879
35866
|
constructor(options = {}) {
|
|
35880
35867
|
super({
|
|
35881
35868
|
objectMode: true,
|
|
@@ -35892,7 +35879,7 @@ var init_readdirp = __esm({
|
|
|
35892
35879
|
} else {
|
|
35893
35880
|
this._stat = statMethod;
|
|
35894
35881
|
}
|
|
35895
|
-
this._maxDepth = opts.depth
|
|
35882
|
+
this._maxDepth = opts.depth ?? defaultOptions.depth;
|
|
35896
35883
|
this._wantsDir = type ? DIR_TYPES.has(type) : false;
|
|
35897
35884
|
this._wantsFile = type ? FILE_TYPES.has(type) : false;
|
|
35898
35885
|
this._wantsEverything = type === EntryTypes.EVERYTHING_TYPE;
|
|
@@ -36023,17 +36010,17 @@ var init_readdirp = __esm({
|
|
|
36023
36010
|
}
|
|
36024
36011
|
});
|
|
36025
36012
|
|
|
36026
|
-
// ../../oss/
|
|
36013
|
+
// ../../oss/node_modules/chokidar/esm/handler.js
|
|
36027
36014
|
function createFsWatchInstance(path40, options, listener, errHandler, emitRaw) {
|
|
36028
36015
|
const handleEvent = (rawEvent, evPath) => {
|
|
36029
36016
|
listener(path40);
|
|
36030
36017
|
emitRaw(rawEvent, evPath, { watchedPath: path40 });
|
|
36031
36018
|
if (evPath && path40 !== evPath) {
|
|
36032
|
-
fsWatchBroadcast(
|
|
36019
|
+
fsWatchBroadcast(sysPath.resolve(path40, evPath), KEY_LISTENERS, sysPath.join(path40, evPath));
|
|
36033
36020
|
}
|
|
36034
36021
|
};
|
|
36035
36022
|
try {
|
|
36036
|
-
return (0,
|
|
36023
|
+
return (0, import_fs7.watch)(path40, {
|
|
36037
36024
|
persistent: options.persistent
|
|
36038
36025
|
}, handleEvent);
|
|
36039
36026
|
} catch (error48) {
|
|
@@ -36041,14 +36028,14 @@ function createFsWatchInstance(path40, options, listener, errHandler, emitRaw) {
|
|
|
36041
36028
|
return void 0;
|
|
36042
36029
|
}
|
|
36043
36030
|
}
|
|
36044
|
-
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;
|
|
36045
36032
|
var init_handler2 = __esm({
|
|
36046
|
-
"../../oss/
|
|
36033
|
+
"../../oss/node_modules/chokidar/esm/handler.js"() {
|
|
36047
36034
|
"use strict";
|
|
36048
|
-
|
|
36035
|
+
import_fs7 = require("fs");
|
|
36049
36036
|
import_promises4 = require("fs/promises");
|
|
36050
|
-
|
|
36051
|
-
|
|
36037
|
+
sysPath = __toESM(require("path"), 1);
|
|
36038
|
+
import_os3 = require("os");
|
|
36052
36039
|
STR_DATA = "data";
|
|
36053
36040
|
STR_END = "end";
|
|
36054
36041
|
STR_CLOSE = "close";
|
|
@@ -36059,7 +36046,7 @@ var init_handler2 = __esm({
|
|
|
36059
36046
|
isMacos = pl === "darwin";
|
|
36060
36047
|
isLinux = pl === "linux";
|
|
36061
36048
|
isFreeBSD = pl === "freebsd";
|
|
36062
|
-
isIBMi = (0,
|
|
36049
|
+
isIBMi = (0, import_os3.type)() === "OS400";
|
|
36063
36050
|
EVENTS = {
|
|
36064
36051
|
ALL: "all",
|
|
36065
36052
|
READY: "ready",
|
|
@@ -36341,7 +36328,7 @@ var init_handler2 = __esm({
|
|
|
36341
36328
|
"zip",
|
|
36342
36329
|
"zipx"
|
|
36343
36330
|
]);
|
|
36344
|
-
isBinaryPath = (filePath) => binaryExtensions.has(
|
|
36331
|
+
isBinaryPath = (filePath) => binaryExtensions.has(sysPath.extname(filePath).slice(1).toLowerCase());
|
|
36345
36332
|
foreach = (val, fn) => {
|
|
36346
36333
|
if (val instanceof Set) {
|
|
36347
36334
|
val.forEach(fn);
|
|
@@ -36449,7 +36436,7 @@ var init_handler2 = __esm({
|
|
|
36449
36436
|
let cont = FsWatchFileInstances.get(fullPath);
|
|
36450
36437
|
const copts = cont && cont.options;
|
|
36451
36438
|
if (copts && (copts.persistent < options.persistent || copts.interval > options.interval)) {
|
|
36452
|
-
(0,
|
|
36439
|
+
(0, import_fs7.unwatchFile)(fullPath);
|
|
36453
36440
|
cont = void 0;
|
|
36454
36441
|
}
|
|
36455
36442
|
if (cont) {
|
|
@@ -36460,7 +36447,7 @@ var init_handler2 = __esm({
|
|
|
36460
36447
|
listeners: listener,
|
|
36461
36448
|
rawEmitters: rawEmitter,
|
|
36462
36449
|
options,
|
|
36463
|
-
watcher: (0,
|
|
36450
|
+
watcher: (0, import_fs7.watchFile)(fullPath, options, (curr, prev) => {
|
|
36464
36451
|
foreach(cont.rawEmitters, (rawEmitter2) => {
|
|
36465
36452
|
rawEmitter2(EV.CHANGE, fullPath, { curr, prev });
|
|
36466
36453
|
});
|
|
@@ -36477,15 +36464,13 @@ var init_handler2 = __esm({
|
|
|
36477
36464
|
delFromSet(cont, KEY_RAW, rawEmitter);
|
|
36478
36465
|
if (isEmptySet(cont.listeners)) {
|
|
36479
36466
|
FsWatchFileInstances.delete(fullPath);
|
|
36480
|
-
(0,
|
|
36467
|
+
(0, import_fs7.unwatchFile)(fullPath);
|
|
36481
36468
|
cont.options = cont.watcher = void 0;
|
|
36482
36469
|
Object.freeze(cont);
|
|
36483
36470
|
}
|
|
36484
36471
|
};
|
|
36485
36472
|
};
|
|
36486
36473
|
NodeFsHandler = class {
|
|
36487
|
-
fsw;
|
|
36488
|
-
_boundHandleError;
|
|
36489
36474
|
constructor(fsW) {
|
|
36490
36475
|
this.fsw = fsW;
|
|
36491
36476
|
this._boundHandleError = (error48) => fsW._handleError(error48);
|
|
@@ -36498,11 +36483,11 @@ var init_handler2 = __esm({
|
|
|
36498
36483
|
*/
|
|
36499
36484
|
_watchWithNodeFs(path40, listener) {
|
|
36500
36485
|
const opts = this.fsw.options;
|
|
36501
|
-
const directory =
|
|
36502
|
-
const basename10 =
|
|
36486
|
+
const directory = sysPath.dirname(path40);
|
|
36487
|
+
const basename10 = sysPath.basename(path40);
|
|
36503
36488
|
const parent = this.fsw._getWatchedDir(directory);
|
|
36504
36489
|
parent.add(basename10);
|
|
36505
|
-
const absolutePath =
|
|
36490
|
+
const absolutePath = sysPath.resolve(path40);
|
|
36506
36491
|
const options = {
|
|
36507
36492
|
persistent: opts.persistent
|
|
36508
36493
|
};
|
|
@@ -36533,8 +36518,8 @@ var init_handler2 = __esm({
|
|
|
36533
36518
|
if (this.fsw.closed) {
|
|
36534
36519
|
return;
|
|
36535
36520
|
}
|
|
36536
|
-
const dirname12 =
|
|
36537
|
-
const basename10 =
|
|
36521
|
+
const dirname12 = sysPath.dirname(file2);
|
|
36522
|
+
const basename10 = sysPath.basename(file2);
|
|
36538
36523
|
const parent = this.fsw._getWatchedDir(dirname12);
|
|
36539
36524
|
let prevStats = stats;
|
|
36540
36525
|
if (parent.has(basename10))
|
|
@@ -36625,9 +36610,8 @@ var init_handler2 = __esm({
|
|
|
36625
36610
|
this.fsw._symlinkPaths.set(full, true);
|
|
36626
36611
|
}
|
|
36627
36612
|
_handleRead(directory, initialAdd, wh, target, dir, depth, throttler) {
|
|
36628
|
-
directory =
|
|
36629
|
-
|
|
36630
|
-
throttler = this.fsw._throttle("readdir", throttleKey, 1e3);
|
|
36613
|
+
directory = sysPath.join(directory, "");
|
|
36614
|
+
throttler = this.fsw._throttle("readdir", directory, 1e3);
|
|
36631
36615
|
if (!throttler)
|
|
36632
36616
|
return;
|
|
36633
36617
|
const previous = this.fsw._getWatchedDir(wh.path);
|
|
@@ -36644,7 +36628,7 @@ var init_handler2 = __esm({
|
|
|
36644
36628
|
return;
|
|
36645
36629
|
}
|
|
36646
36630
|
const item = entry.path;
|
|
36647
|
-
let path40 =
|
|
36631
|
+
let path40 = sysPath.join(directory, item);
|
|
36648
36632
|
current.add(item);
|
|
36649
36633
|
if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path40, item)) {
|
|
36650
36634
|
return;
|
|
@@ -36655,7 +36639,7 @@ var init_handler2 = __esm({
|
|
|
36655
36639
|
}
|
|
36656
36640
|
if (item === target || !target && !previous.has(item)) {
|
|
36657
36641
|
this.fsw._incrReadyCount();
|
|
36658
|
-
path40 =
|
|
36642
|
+
path40 = sysPath.join(dir, sysPath.relative(dir, path40));
|
|
36659
36643
|
this._addToNodeFs(path40, initialAdd, wh, depth + 1);
|
|
36660
36644
|
}
|
|
36661
36645
|
}).on(EV.ERROR, this._boundHandleError);
|
|
@@ -36692,12 +36676,12 @@ var init_handler2 = __esm({
|
|
|
36692
36676
|
* @returns closer for the watcher instance.
|
|
36693
36677
|
*/
|
|
36694
36678
|
async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath4) {
|
|
36695
|
-
const parentDir = this.fsw._getWatchedDir(
|
|
36696
|
-
const tracked = parentDir.has(
|
|
36679
|
+
const parentDir = this.fsw._getWatchedDir(sysPath.dirname(dir));
|
|
36680
|
+
const tracked = parentDir.has(sysPath.basename(dir));
|
|
36697
36681
|
if (!(initialAdd && this.fsw.options.ignoreInitial) && !target && !tracked) {
|
|
36698
36682
|
this.fsw._emit(EV.ADD_DIR, dir, stats);
|
|
36699
36683
|
}
|
|
36700
|
-
parentDir.add(
|
|
36684
|
+
parentDir.add(sysPath.basename(dir));
|
|
36701
36685
|
this.fsw._getWatchedDir(dir);
|
|
36702
36686
|
let throttler;
|
|
36703
36687
|
let closer;
|
|
@@ -36747,7 +36731,7 @@ var init_handler2 = __esm({
|
|
|
36747
36731
|
const follow = this.fsw.options.followSymlinks;
|
|
36748
36732
|
let closer;
|
|
36749
36733
|
if (stats.isDirectory()) {
|
|
36750
|
-
const absPath =
|
|
36734
|
+
const absPath = sysPath.resolve(path40);
|
|
36751
36735
|
const targetPath = follow ? await (0, import_promises4.realpath)(path40) : path40;
|
|
36752
36736
|
if (this.fsw.closed)
|
|
36753
36737
|
return;
|
|
@@ -36761,14 +36745,14 @@ var init_handler2 = __esm({
|
|
|
36761
36745
|
const targetPath = follow ? await (0, import_promises4.realpath)(path40) : path40;
|
|
36762
36746
|
if (this.fsw.closed)
|
|
36763
36747
|
return;
|
|
36764
|
-
const parent =
|
|
36748
|
+
const parent = sysPath.dirname(wh.watchPath);
|
|
36765
36749
|
this.fsw._getWatchedDir(parent).add(wh.watchPath);
|
|
36766
36750
|
this.fsw._emit(EV.ADD, wh.watchPath, stats);
|
|
36767
36751
|
closer = await this._handleDir(parent, stats, initialAdd, depth, path40, wh, targetPath);
|
|
36768
36752
|
if (this.fsw.closed)
|
|
36769
36753
|
return;
|
|
36770
36754
|
if (targetPath !== void 0) {
|
|
36771
|
-
this.fsw._symlinkPaths.set(
|
|
36755
|
+
this.fsw._symlinkPaths.set(sysPath.resolve(path40), targetPath);
|
|
36772
36756
|
}
|
|
36773
36757
|
} else {
|
|
36774
36758
|
closer = this._handleFile(wh.watchPath, stats, initialAdd);
|
|
@@ -36788,7 +36772,7 @@ var init_handler2 = __esm({
|
|
|
36788
36772
|
}
|
|
36789
36773
|
});
|
|
36790
36774
|
|
|
36791
|
-
// ../../oss/
|
|
36775
|
+
// ../../oss/node_modules/chokidar/esm/index.js
|
|
36792
36776
|
function arrify(item) {
|
|
36793
36777
|
return Array.isArray(item) ? item : [item];
|
|
36794
36778
|
}
|
|
@@ -36804,11 +36788,11 @@ function createPattern(matcher) {
|
|
|
36804
36788
|
if (matcher.path === string4)
|
|
36805
36789
|
return true;
|
|
36806
36790
|
if (matcher.recursive) {
|
|
36807
|
-
const relative5 =
|
|
36791
|
+
const relative5 = sysPath2.relative(matcher.path, string4);
|
|
36808
36792
|
if (!relative5) {
|
|
36809
36793
|
return false;
|
|
36810
36794
|
}
|
|
36811
|
-
return !relative5.startsWith("..") && !
|
|
36795
|
+
return !relative5.startsWith("..") && !sysPath2.isAbsolute(relative5);
|
|
36812
36796
|
}
|
|
36813
36797
|
return false;
|
|
36814
36798
|
};
|
|
@@ -36818,12 +36802,14 @@ function createPattern(matcher) {
|
|
|
36818
36802
|
function normalizePath(path40) {
|
|
36819
36803
|
if (typeof path40 !== "string")
|
|
36820
36804
|
throw new Error("string expected");
|
|
36821
|
-
path40 =
|
|
36805
|
+
path40 = sysPath2.normalize(path40);
|
|
36822
36806
|
path40 = path40.replace(/\\/g, "/");
|
|
36823
36807
|
let prepend = false;
|
|
36824
36808
|
if (path40.startsWith("//"))
|
|
36825
36809
|
prepend = true;
|
|
36826
|
-
|
|
36810
|
+
const DOUBLE_SLASH_RE2 = /\/\//;
|
|
36811
|
+
while (path40.match(DOUBLE_SLASH_RE2))
|
|
36812
|
+
path40 = path40.replace(DOUBLE_SLASH_RE2, "/");
|
|
36827
36813
|
if (prepend)
|
|
36828
36814
|
path40 = "/" + path40;
|
|
36829
36815
|
return path40;
|
|
@@ -36856,15 +36842,15 @@ function watch(paths, options = {}) {
|
|
|
36856
36842
|
watcher.add(paths);
|
|
36857
36843
|
return watcher;
|
|
36858
36844
|
}
|
|
36859
|
-
var
|
|
36860
|
-
var
|
|
36861
|
-
"../../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"() {
|
|
36862
36848
|
"use strict";
|
|
36863
|
-
|
|
36864
|
-
import_node_fs3 = require("fs");
|
|
36849
|
+
import_fs8 = require("fs");
|
|
36865
36850
|
import_promises5 = require("fs/promises");
|
|
36866
|
-
|
|
36867
|
-
|
|
36851
|
+
import_events = require("events");
|
|
36852
|
+
sysPath2 = __toESM(require("path"), 1);
|
|
36853
|
+
init_esm();
|
|
36868
36854
|
init_handler2();
|
|
36869
36855
|
SLASH = "/";
|
|
36870
36856
|
SLASH_SLASH = "//";
|
|
@@ -36872,7 +36858,7 @@ var init_chokidar = __esm({
|
|
|
36872
36858
|
TWO_DOTS = "..";
|
|
36873
36859
|
STRING_TYPE = "string";
|
|
36874
36860
|
BACK_SLASH_RE = /\\/g;
|
|
36875
|
-
DOUBLE_SLASH_RE =
|
|
36861
|
+
DOUBLE_SLASH_RE = /\/\//;
|
|
36876
36862
|
DOT_RE = /\..*\.(sw[px])$|~$|\.subl.*\.tmp/;
|
|
36877
36863
|
REPLACER_RE = /^\.[/\\]/;
|
|
36878
36864
|
isMatcherObject = (matcher) => typeof matcher === "object" && matcher !== null && !(matcher instanceof RegExp);
|
|
@@ -36889,31 +36875,30 @@ var init_chokidar = __esm({
|
|
|
36889
36875
|
if (str.startsWith(SLASH_SLASH)) {
|
|
36890
36876
|
prepend = true;
|
|
36891
36877
|
}
|
|
36892
|
-
|
|
36878
|
+
while (str.match(DOUBLE_SLASH_RE)) {
|
|
36879
|
+
str = str.replace(DOUBLE_SLASH_RE, SLASH);
|
|
36880
|
+
}
|
|
36893
36881
|
if (prepend) {
|
|
36894
36882
|
str = SLASH + str;
|
|
36895
36883
|
}
|
|
36896
36884
|
return str;
|
|
36897
36885
|
};
|
|
36898
|
-
normalizePathToUnix = (path40) => toUnix(
|
|
36886
|
+
normalizePathToUnix = (path40) => toUnix(sysPath2.normalize(toUnix(path40)));
|
|
36899
36887
|
normalizeIgnored = (cwd = "") => (path40) => {
|
|
36900
36888
|
if (typeof path40 === "string") {
|
|
36901
|
-
return normalizePathToUnix(
|
|
36889
|
+
return normalizePathToUnix(sysPath2.isAbsolute(path40) ? path40 : sysPath2.join(cwd, path40));
|
|
36902
36890
|
} else {
|
|
36903
36891
|
return path40;
|
|
36904
36892
|
}
|
|
36905
36893
|
};
|
|
36906
36894
|
getAbsolutePath = (path40, cwd) => {
|
|
36907
|
-
if (
|
|
36895
|
+
if (sysPath2.isAbsolute(path40)) {
|
|
36908
36896
|
return path40;
|
|
36909
36897
|
}
|
|
36910
|
-
return
|
|
36898
|
+
return sysPath2.join(cwd, path40);
|
|
36911
36899
|
};
|
|
36912
36900
|
EMPTY_SET = Object.freeze(/* @__PURE__ */ new Set());
|
|
36913
36901
|
DirEntry = class {
|
|
36914
|
-
path;
|
|
36915
|
-
_removeWatcher;
|
|
36916
|
-
items;
|
|
36917
36902
|
constructor(dir, removeWatcher) {
|
|
36918
36903
|
this.path = dir;
|
|
36919
36904
|
this._removeWatcher = removeWatcher;
|
|
@@ -36938,7 +36923,7 @@ var init_chokidar = __esm({
|
|
|
36938
36923
|
await (0, import_promises5.readdir)(dir);
|
|
36939
36924
|
} catch (err) {
|
|
36940
36925
|
if (this._removeWatcher) {
|
|
36941
|
-
this._removeWatcher(
|
|
36926
|
+
this._removeWatcher(sysPath2.dirname(dir), sysPath2.basename(dir));
|
|
36942
36927
|
}
|
|
36943
36928
|
}
|
|
36944
36929
|
}
|
|
@@ -36965,19 +36950,12 @@ var init_chokidar = __esm({
|
|
|
36965
36950
|
STAT_METHOD_F = "stat";
|
|
36966
36951
|
STAT_METHOD_L = "lstat";
|
|
36967
36952
|
WatchHelper = class {
|
|
36968
|
-
fsw;
|
|
36969
|
-
path;
|
|
36970
|
-
watchPath;
|
|
36971
|
-
fullWatchPath;
|
|
36972
|
-
dirParts;
|
|
36973
|
-
followSymlinks;
|
|
36974
|
-
statMethod;
|
|
36975
36953
|
constructor(path40, follow, fsw) {
|
|
36976
36954
|
this.fsw = fsw;
|
|
36977
36955
|
const watchPath = path40;
|
|
36978
36956
|
this.path = path40 = path40.replace(REPLACER_RE, "");
|
|
36979
36957
|
this.watchPath = watchPath;
|
|
36980
|
-
this.fullWatchPath =
|
|
36958
|
+
this.fullWatchPath = sysPath2.resolve(watchPath);
|
|
36981
36959
|
this.dirParts = [];
|
|
36982
36960
|
this.dirParts.forEach((parts) => {
|
|
36983
36961
|
if (parts.length > 1)
|
|
@@ -36987,7 +36965,7 @@ var init_chokidar = __esm({
|
|
|
36987
36965
|
this.statMethod = follow ? STAT_METHOD_F : STAT_METHOD_L;
|
|
36988
36966
|
}
|
|
36989
36967
|
entryPath(entry) {
|
|
36990
|
-
return
|
|
36968
|
+
return sysPath2.join(this.watchPath, sysPath2.relative(this.watchPath, entry.fullPath));
|
|
36991
36969
|
}
|
|
36992
36970
|
filterPath(entry) {
|
|
36993
36971
|
const { stats } = entry;
|
|
@@ -37000,25 +36978,7 @@ var init_chokidar = __esm({
|
|
|
37000
36978
|
return this.fsw._isntIgnored(this.entryPath(entry), entry.stats);
|
|
37001
36979
|
}
|
|
37002
36980
|
};
|
|
37003
|
-
FSWatcher = class extends
|
|
37004
|
-
closed;
|
|
37005
|
-
options;
|
|
37006
|
-
_closers;
|
|
37007
|
-
_ignoredPaths;
|
|
37008
|
-
_throttled;
|
|
37009
|
-
_streams;
|
|
37010
|
-
_symlinkPaths;
|
|
37011
|
-
_watched;
|
|
37012
|
-
_pendingWrites;
|
|
37013
|
-
_pendingUnlinks;
|
|
37014
|
-
_readyCount;
|
|
37015
|
-
_emitReady;
|
|
37016
|
-
_closePromise;
|
|
37017
|
-
_userIgnored;
|
|
37018
|
-
_readyEmitted;
|
|
37019
|
-
_emitRaw;
|
|
37020
|
-
_boundRemove;
|
|
37021
|
-
_nodeFsHandler;
|
|
36981
|
+
FSWatcher = class extends import_events.EventEmitter {
|
|
37022
36982
|
// Not indenting methods for history sake; for now.
|
|
37023
36983
|
constructor(_opts = {}) {
|
|
37024
36984
|
super();
|
|
@@ -37137,7 +37097,7 @@ var init_chokidar = __esm({
|
|
|
37137
37097
|
return;
|
|
37138
37098
|
results.forEach((item) => {
|
|
37139
37099
|
if (item)
|
|
37140
|
-
this.add(
|
|
37100
|
+
this.add(sysPath2.dirname(item), sysPath2.basename(_origAdd || item));
|
|
37141
37101
|
});
|
|
37142
37102
|
});
|
|
37143
37103
|
return this;
|
|
@@ -37151,10 +37111,10 @@ var init_chokidar = __esm({
|
|
|
37151
37111
|
const paths = unifyPaths(paths_);
|
|
37152
37112
|
const { cwd } = this.options;
|
|
37153
37113
|
paths.forEach((path40) => {
|
|
37154
|
-
if (!
|
|
37114
|
+
if (!sysPath2.isAbsolute(path40) && !this._closers.has(path40)) {
|
|
37155
37115
|
if (cwd)
|
|
37156
|
-
path40 =
|
|
37157
|
-
path40 =
|
|
37116
|
+
path40 = sysPath2.join(cwd, path40);
|
|
37117
|
+
path40 = sysPath2.resolve(path40);
|
|
37158
37118
|
}
|
|
37159
37119
|
this._closePath(path40);
|
|
37160
37120
|
this._addIgnoredPath(path40);
|
|
@@ -37203,7 +37163,7 @@ var init_chokidar = __esm({
|
|
|
37203
37163
|
getWatched() {
|
|
37204
37164
|
const watchList = {};
|
|
37205
37165
|
this._watched.forEach((entry, dir) => {
|
|
37206
|
-
const key = this.options.cwd ?
|
|
37166
|
+
const key = this.options.cwd ? sysPath2.relative(this.options.cwd, dir) : dir;
|
|
37207
37167
|
const index = key || ONE_DOT;
|
|
37208
37168
|
watchList[index] = entry.getChildren().sort();
|
|
37209
37169
|
});
|
|
@@ -37229,9 +37189,9 @@ var init_chokidar = __esm({
|
|
|
37229
37189
|
return;
|
|
37230
37190
|
const opts = this.options;
|
|
37231
37191
|
if (isWindows)
|
|
37232
|
-
path40 =
|
|
37192
|
+
path40 = sysPath2.normalize(path40);
|
|
37233
37193
|
if (opts.cwd)
|
|
37234
|
-
path40 =
|
|
37194
|
+
path40 = sysPath2.relative(opts.cwd, path40);
|
|
37235
37195
|
const args = [path40];
|
|
37236
37196
|
if (stats != null)
|
|
37237
37197
|
args.push(stats);
|
|
@@ -37282,7 +37242,7 @@ var init_chokidar = __esm({
|
|
|
37282
37242
|
return this;
|
|
37283
37243
|
}
|
|
37284
37244
|
if (opts.alwaysStat && stats === void 0 && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
|
|
37285
|
-
const fullPath = opts.cwd ?
|
|
37245
|
+
const fullPath = opts.cwd ? sysPath2.join(opts.cwd, path40) : path40;
|
|
37286
37246
|
let stats2;
|
|
37287
37247
|
try {
|
|
37288
37248
|
stats2 = await (0, import_promises5.stat)(fullPath);
|
|
@@ -37358,13 +37318,13 @@ var init_chokidar = __esm({
|
|
|
37358
37318
|
const pollInterval = awf.pollInterval;
|
|
37359
37319
|
let timeoutHandler;
|
|
37360
37320
|
let fullPath = path40;
|
|
37361
|
-
if (this.options.cwd && !
|
|
37362
|
-
fullPath =
|
|
37321
|
+
if (this.options.cwd && !sysPath2.isAbsolute(path40)) {
|
|
37322
|
+
fullPath = sysPath2.join(this.options.cwd, path40);
|
|
37363
37323
|
}
|
|
37364
37324
|
const now = /* @__PURE__ */ new Date();
|
|
37365
37325
|
const writes = this._pendingWrites;
|
|
37366
37326
|
function awaitWriteFinishFn(prevStat) {
|
|
37367
|
-
(0,
|
|
37327
|
+
(0, import_fs8.stat)(fullPath, (err, curStat) => {
|
|
37368
37328
|
if (err || !writes.has(path40)) {
|
|
37369
37329
|
if (err && err.code !== "ENOENT")
|
|
37370
37330
|
awfEmit(err);
|
|
@@ -37429,7 +37389,7 @@ var init_chokidar = __esm({
|
|
|
37429
37389
|
* @param directory path of the directory
|
|
37430
37390
|
*/
|
|
37431
37391
|
_getWatchedDir(directory) {
|
|
37432
|
-
const dir =
|
|
37392
|
+
const dir = sysPath2.resolve(directory);
|
|
37433
37393
|
if (!this._watched.has(dir))
|
|
37434
37394
|
this._watched.set(dir, new DirEntry(dir, this._boundRemove));
|
|
37435
37395
|
return this._watched.get(dir);
|
|
@@ -37452,8 +37412,8 @@ var init_chokidar = __esm({
|
|
|
37452
37412
|
* @param item base path of item/directory
|
|
37453
37413
|
*/
|
|
37454
37414
|
_remove(directory, item, isDirectory) {
|
|
37455
|
-
const path40 =
|
|
37456
|
-
const fullPath =
|
|
37415
|
+
const path40 = sysPath2.join(directory, item);
|
|
37416
|
+
const fullPath = sysPath2.resolve(path40);
|
|
37457
37417
|
isDirectory = isDirectory != null ? isDirectory : this._watched.has(path40) || this._watched.has(fullPath);
|
|
37458
37418
|
if (!this._throttle("remove", path40, 100))
|
|
37459
37419
|
return;
|
|
@@ -37471,7 +37431,7 @@ var init_chokidar = __esm({
|
|
|
37471
37431
|
}
|
|
37472
37432
|
let relPath = path40;
|
|
37473
37433
|
if (this.options.cwd)
|
|
37474
|
-
relPath =
|
|
37434
|
+
relPath = sysPath2.relative(this.options.cwd, path40);
|
|
37475
37435
|
if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
|
|
37476
37436
|
const event = this._pendingWrites.get(relPath).cancelWait();
|
|
37477
37437
|
if (event === EVENTS.ADD)
|
|
@@ -37489,8 +37449,8 @@ var init_chokidar = __esm({
|
|
|
37489
37449
|
*/
|
|
37490
37450
|
_closePath(path40) {
|
|
37491
37451
|
this._closeFile(path40);
|
|
37492
|
-
const dir =
|
|
37493
|
-
this._getWatchedDir(dir).remove(
|
|
37452
|
+
const dir = sysPath2.dirname(path40);
|
|
37453
|
+
this._getWatchedDir(dir).remove(sysPath2.basename(path40));
|
|
37494
37454
|
}
|
|
37495
37455
|
/**
|
|
37496
37456
|
* Closes only file-specific watchers
|
|
@@ -37835,7 +37795,7 @@ var init_provider_loader = __esm({
|
|
|
37835
37795
|
fs7 = __toESM(require("fs"));
|
|
37836
37796
|
path18 = __toESM(require("path"));
|
|
37837
37797
|
os17 = __toESM(require("os"));
|
|
37838
|
-
|
|
37798
|
+
init_esm2();
|
|
37839
37799
|
init_ide_detector();
|
|
37840
37800
|
init_logger();
|
|
37841
37801
|
init_provider_schema();
|
|
@@ -40056,7 +40016,7 @@ function resolveAdhdevMcpServerLaunch(options) {
|
|
|
40056
40016
|
if (!entryPath) return null;
|
|
40057
40017
|
return {
|
|
40058
40018
|
command: options.nodeExecutable?.trim() || process.execPath,
|
|
40059
|
-
args: [entryPath, "--repo-mesh", options.meshId]
|
|
40019
|
+
args: [entryPath, "--mode", "ipc", "--repo-mesh", options.meshId]
|
|
40060
40020
|
};
|
|
40061
40021
|
}
|
|
40062
40022
|
function resolveAdhdevMcpEntryPath(explicitPath) {
|
|
@@ -40094,17 +40054,17 @@ function resolveAdhdevMcpEntryPath(explicitPath) {
|
|
|
40094
40054
|
}
|
|
40095
40055
|
function normalizeExistingPath(filePath) {
|
|
40096
40056
|
try {
|
|
40097
|
-
if (!(0,
|
|
40098
|
-
return
|
|
40057
|
+
if (!(0, import_node_fs2.existsSync)(filePath)) return null;
|
|
40058
|
+
return import_node_fs2.realpathSync.native(filePath);
|
|
40099
40059
|
} catch {
|
|
40100
40060
|
return null;
|
|
40101
40061
|
}
|
|
40102
40062
|
}
|
|
40103
|
-
var
|
|
40063
|
+
var import_node_fs2, import_node_module2, import_node_path2, DEFAULT_SERVER_NAME, DEFAULT_ADHDEV_MCP_COMMAND;
|
|
40104
40064
|
var init_mesh_coordinator = __esm({
|
|
40105
40065
|
"../../oss/packages/daemon-core/src/commands/mesh-coordinator.ts"() {
|
|
40106
40066
|
"use strict";
|
|
40107
|
-
|
|
40067
|
+
import_node_fs2 = require("fs");
|
|
40108
40068
|
import_node_module2 = require("module");
|
|
40109
40069
|
import_node_path2 = require("path");
|
|
40110
40070
|
DEFAULT_SERVER_NAME = "adhdev-mesh";
|
|
@@ -40874,7 +40834,7 @@ function summarizeSessionHostPruneResult(result) {
|
|
|
40874
40834
|
keptCount: Array.isArray(value.keptSessionIds) ? value.keptSessionIds.length : void 0
|
|
40875
40835
|
};
|
|
40876
40836
|
}
|
|
40877
|
-
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;
|
|
40878
40838
|
var init_router = __esm({
|
|
40879
40839
|
"../../oss/packages/daemon-core/src/commands/router.ts"() {
|
|
40880
40840
|
"use strict";
|
|
@@ -40902,6 +40862,10 @@ var init_router = __esm({
|
|
|
40902
40862
|
init_upgrade_helper();
|
|
40903
40863
|
fs10 = __toESM(require("fs"));
|
|
40904
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
|
+
};
|
|
40905
40869
|
CHAT_COMMANDS = [
|
|
40906
40870
|
"send_chat",
|
|
40907
40871
|
"new_chat",
|
|
@@ -41507,6 +41471,7 @@ var init_router = __esm({
|
|
|
41507
41471
|
const npmTag = CHANNEL_NPM_TAG[channel];
|
|
41508
41472
|
const latest = String(execNpmCommandSync(["view", `${pkgName}@${npmTag}`, "version"], { encoding: "utf-8", timeout: 1e4 }, npmSurface)).trim();
|
|
41509
41473
|
LOG.info("Upgrade", `Latest ${pkgName}@${npmTag}: v${latest}`);
|
|
41474
|
+
updateConfig({ updateChannel: channel, serverUrl: CHANNEL_SERVER_URL[channel] });
|
|
41510
41475
|
let currentInstalled = null;
|
|
41511
41476
|
try {
|
|
41512
41477
|
const currentJson = String(execNpmCommandSync(["ls", "-g", pkgName, "--depth=0", "--json"], {
|
|
@@ -41709,7 +41674,8 @@ var init_router = __esm({
|
|
|
41709
41674
|
};
|
|
41710
41675
|
if (args?.inlineMesh) {
|
|
41711
41676
|
mcpServerEntry.env = {
|
|
41712
|
-
ADHDEV_INLINE_MESH: JSON.stringify(mesh)
|
|
41677
|
+
ADHDEV_INLINE_MESH: JSON.stringify(mesh),
|
|
41678
|
+
ADHDEV_MCP_TRANSPORT: "ipc"
|
|
41713
41679
|
};
|
|
41714
41680
|
}
|
|
41715
41681
|
const mcpConfig = {
|
|
@@ -43489,7 +43455,7 @@ function runCommand(cmd, timeout = 1e4) {
|
|
|
43489
43455
|
}
|
|
43490
43456
|
}
|
|
43491
43457
|
function findBinary2(name) {
|
|
43492
|
-
const cmd = (0,
|
|
43458
|
+
const cmd = (0, import_os4.platform)() === "win32" ? `where ${name}` : `which ${name}`;
|
|
43493
43459
|
const result = runCommand(cmd, 5e3);
|
|
43494
43460
|
return result ? result.split("\n")[0] : null;
|
|
43495
43461
|
}
|
|
@@ -43537,7 +43503,7 @@ function checkPathExists2(paths) {
|
|
|
43537
43503
|
return null;
|
|
43538
43504
|
}
|
|
43539
43505
|
function getMacAppVersion(appPath) {
|
|
43540
|
-
if ((0,
|
|
43506
|
+
if ((0, import_os4.platform)() !== "darwin" || !appPath.endsWith(".app")) return null;
|
|
43541
43507
|
const plistPath = path23.join(appPath, "Contents", "Info.plist");
|
|
43542
43508
|
if (!fs11.existsSync(plistPath)) return null;
|
|
43543
43509
|
const raw = runCommand(`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${plistPath}"`);
|
|
@@ -43545,7 +43511,7 @@ function getMacAppVersion(appPath) {
|
|
|
43545
43511
|
}
|
|
43546
43512
|
async function detectAllVersions(loader, archive) {
|
|
43547
43513
|
const results = [];
|
|
43548
|
-
const currentOs = (0,
|
|
43514
|
+
const currentOs = (0, import_os4.platform)();
|
|
43549
43515
|
for (const provider of loader.getAll()) {
|
|
43550
43516
|
const info = {
|
|
43551
43517
|
type: provider.type,
|
|
@@ -43601,7 +43567,7 @@ async function detectAllVersions(loader, archive) {
|
|
|
43601
43567
|
}
|
|
43602
43568
|
return results;
|
|
43603
43569
|
}
|
|
43604
|
-
var fs11, path23, os23, import_child_process10,
|
|
43570
|
+
var fs11, path23, os23, import_child_process10, import_os4, ARCHIVE_PATH, MAX_ENTRIES_PER_PROVIDER, VersionArchive;
|
|
43605
43571
|
var init_version_archive = __esm({
|
|
43606
43572
|
"../../oss/packages/daemon-core/src/providers/version-archive.ts"() {
|
|
43607
43573
|
"use strict";
|
|
@@ -43609,7 +43575,7 @@ var init_version_archive = __esm({
|
|
|
43609
43575
|
path23 = __toESM(require("path"));
|
|
43610
43576
|
os23 = __toESM(require("os"));
|
|
43611
43577
|
import_child_process10 = require("child_process");
|
|
43612
|
-
|
|
43578
|
+
import_os4 = require("os");
|
|
43613
43579
|
ARCHIVE_PATH = path23.join(os23.homedir(), ".adhdev", "version-history.json");
|
|
43614
43580
|
MAX_ENTRIES_PER_PROVIDER = 20;
|
|
43615
43581
|
VersionArchive = class {
|
|
@@ -43635,7 +43601,7 @@ var init_version_archive = __esm({
|
|
|
43635
43601
|
entries.push({
|
|
43636
43602
|
version: version2,
|
|
43637
43603
|
detectedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
43638
|
-
os: (0,
|
|
43604
|
+
os: (0, import_os4.platform)()
|
|
43639
43605
|
});
|
|
43640
43606
|
if (entries.length > MAX_ENTRIES_PER_PROVIDER) {
|
|
43641
43607
|
this.history[type] = entries.slice(-MAX_ENTRIES_PER_PROVIDER);
|
|
@@ -50540,7 +50506,7 @@ function isUnicodeSupported() {
|
|
|
50540
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";
|
|
50541
50507
|
}
|
|
50542
50508
|
var import_node_process3, common, specialMainSymbols, specialFallbackSymbols, mainSymbols, fallbackSymbols, shouldUseMain, figures, esm_default, replacements;
|
|
50543
|
-
var
|
|
50509
|
+
var init_esm3 = __esm({
|
|
50544
50510
|
"../../node_modules/@inquirer/figures/dist/esm/index.js"() {
|
|
50545
50511
|
"use strict";
|
|
50546
50512
|
import_node_process3 = __toESM(require("process"), 1);
|
|
@@ -60461,7 +60427,7 @@ var init_separator = __esm({
|
|
|
60461
60427
|
"../../node_modules/inquirer/lib/objects/separator.js"() {
|
|
60462
60428
|
"use strict";
|
|
60463
60429
|
import_yoctocolors_cjs2 = __toESM(require_yoctocolors_cjs(), 1);
|
|
60464
|
-
|
|
60430
|
+
init_esm3();
|
|
60465
60431
|
Separator = class {
|
|
60466
60432
|
constructor(line) {
|
|
60467
60433
|
this.type = "separator";
|
|
@@ -68585,7 +68551,7 @@ var init_list = __esm({
|
|
|
68585
68551
|
"use strict";
|
|
68586
68552
|
import_ansi_escapes3 = __toESM(require_ansi_escapes(), 1);
|
|
68587
68553
|
import_yoctocolors_cjs4 = __toESM(require_yoctocolors_cjs(), 1);
|
|
68588
|
-
|
|
68554
|
+
init_esm3();
|
|
68589
68555
|
import_run_async2 = __toESM(require_run_async(), 1);
|
|
68590
68556
|
import_rxjs3 = __toESM(require_cjs(), 1);
|
|
68591
68557
|
init_events();
|
|
@@ -69280,7 +69246,7 @@ var init_checkbox = __esm({
|
|
|
69280
69246
|
"use strict";
|
|
69281
69247
|
import_ansi_escapes4 = __toESM(require_ansi_escapes(), 1);
|
|
69282
69248
|
import_yoctocolors_cjs9 = __toESM(require_yoctocolors_cjs(), 1);
|
|
69283
|
-
|
|
69249
|
+
init_esm3();
|
|
69284
69250
|
import_rxjs8 = __toESM(require_cjs(), 1);
|
|
69285
69251
|
init_events();
|
|
69286
69252
|
init_paginator();
|
|
@@ -79034,15 +79000,15 @@ function splitStringBySpace(str) {
|
|
|
79034
79000
|
}
|
|
79035
79001
|
return pieces;
|
|
79036
79002
|
}
|
|
79037
|
-
var import_chardet, import_child_process12,
|
|
79038
|
-
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({
|
|
79039
79005
|
"../../node_modules/@inquirer/external-editor/dist/esm/index.js"() {
|
|
79040
79006
|
"use strict";
|
|
79041
79007
|
import_chardet = __toESM(require_lib(), 1);
|
|
79042
79008
|
import_child_process12 = require("child_process");
|
|
79043
|
-
|
|
79009
|
+
import_fs9 = require("fs");
|
|
79044
79010
|
import_node_path3 = __toESM(require("path"), 1);
|
|
79045
|
-
|
|
79011
|
+
import_node_os3 = __toESM(require("os"), 1);
|
|
79046
79012
|
import_node_crypto2 = require("crypto");
|
|
79047
79013
|
import_iconv_lite = __toESM(require_lib2(), 1);
|
|
79048
79014
|
init_CreateFileError();
|
|
@@ -79101,7 +79067,7 @@ var init_esm2 = __esm({
|
|
|
79101
79067
|
}
|
|
79102
79068
|
createTemporaryFile() {
|
|
79103
79069
|
try {
|
|
79104
|
-
const baseDir = this.fileOptions.dir ??
|
|
79070
|
+
const baseDir = this.fileOptions.dir ?? import_node_os3.default.tmpdir();
|
|
79105
79071
|
const id = (0, import_node_crypto2.randomUUID)();
|
|
79106
79072
|
const prefix = sanitizeAffix(this.fileOptions.prefix);
|
|
79107
79073
|
const postfix = sanitizeAffix(this.fileOptions.postfix);
|
|
@@ -79116,14 +79082,14 @@ var init_esm2 = __esm({
|
|
|
79116
79082
|
if (Object.prototype.hasOwnProperty.call(this.fileOptions, "mode")) {
|
|
79117
79083
|
opt.mode = this.fileOptions.mode;
|
|
79118
79084
|
}
|
|
79119
|
-
(0,
|
|
79085
|
+
(0, import_fs9.writeFileSync)(this.tempFile, this.text, opt);
|
|
79120
79086
|
} catch (createFileError) {
|
|
79121
79087
|
throw new CreateFileError(createFileError);
|
|
79122
79088
|
}
|
|
79123
79089
|
}
|
|
79124
79090
|
readTemporaryFile() {
|
|
79125
79091
|
try {
|
|
79126
|
-
const tempFileBuffer = (0,
|
|
79092
|
+
const tempFileBuffer = (0, import_fs9.readFileSync)(this.tempFile);
|
|
79127
79093
|
if (tempFileBuffer.length === 0) {
|
|
79128
79094
|
this.text = "";
|
|
79129
79095
|
} else {
|
|
@@ -79139,7 +79105,7 @@ var init_esm2 = __esm({
|
|
|
79139
79105
|
}
|
|
79140
79106
|
removeTemporaryFile() {
|
|
79141
79107
|
try {
|
|
79142
|
-
(0,
|
|
79108
|
+
(0, import_fs9.unlinkSync)(this.tempFile);
|
|
79143
79109
|
} catch (removeFileError) {
|
|
79144
79110
|
throw new RemoveFileError(removeFileError);
|
|
79145
79111
|
}
|
|
@@ -79173,7 +79139,7 @@ var init_editor = __esm({
|
|
|
79173
79139
|
"../../node_modules/inquirer/lib/prompts/editor.js"() {
|
|
79174
79140
|
"use strict";
|
|
79175
79141
|
import_yoctocolors_cjs11 = __toESM(require_yoctocolors_cjs(), 1);
|
|
79176
|
-
|
|
79142
|
+
init_esm4();
|
|
79177
79143
|
import_rxjs10 = __toESM(require_cjs(), 1);
|
|
79178
79144
|
init_events();
|
|
79179
79145
|
init_base();
|
|
@@ -80847,18 +80813,18 @@ function resolvePackageVersion(options) {
|
|
|
80847
80813
|
];
|
|
80848
80814
|
for (const p of possiblePaths) {
|
|
80849
80815
|
try {
|
|
80850
|
-
const data = JSON.parse((0,
|
|
80816
|
+
const data = JSON.parse((0, import_fs10.readFileSync)(p, "utf-8"));
|
|
80851
80817
|
if (data.version) return data.version;
|
|
80852
80818
|
} catch {
|
|
80853
80819
|
}
|
|
80854
80820
|
}
|
|
80855
80821
|
return injectedVersion;
|
|
80856
80822
|
}
|
|
80857
|
-
var
|
|
80823
|
+
var import_fs10, import_path4;
|
|
80858
80824
|
var init_version = __esm({
|
|
80859
80825
|
"src/version.ts"() {
|
|
80860
80826
|
"use strict";
|
|
80861
|
-
|
|
80827
|
+
import_fs10 = require("fs");
|
|
80862
80828
|
import_path4 = require("path");
|
|
80863
80829
|
}
|
|
80864
80830
|
});
|
|
@@ -80983,13 +80949,14 @@ var init_server_connection = __esm({
|
|
|
80983
80949
|
reject(new Error(`Mesh command timed out after ${timeoutMs}ms`));
|
|
80984
80950
|
}, timeoutMs);
|
|
80985
80951
|
const handler = (msg) => {
|
|
80986
|
-
|
|
80952
|
+
const body = msg.payload && typeof msg.payload === "object" ? { ...msg, ...msg.payload } : msg;
|
|
80953
|
+
if (body.requestId !== requestId) return;
|
|
80987
80954
|
this.off("daemon_mesh_result", handler);
|
|
80988
80955
|
clearTimeout(timer);
|
|
80989
|
-
if (
|
|
80990
|
-
reject(new Error(
|
|
80956
|
+
if (body.success === false) {
|
|
80957
|
+
reject(new Error(body.error ?? "Mesh command failed"));
|
|
80991
80958
|
} else {
|
|
80992
|
-
resolve23(
|
|
80959
|
+
resolve23(body.result);
|
|
80993
80960
|
}
|
|
80994
80961
|
};
|
|
80995
80962
|
this.on("daemon_mesh_result", handler);
|
|
@@ -81091,17 +81058,19 @@ var init_server_connection = __esm({
|
|
|
81091
81058
|
return;
|
|
81092
81059
|
} else if (message.type === "version_mismatch") {
|
|
81093
81060
|
const p = message.payload;
|
|
81061
|
+
const updateCommand = typeof p.updateCommand === "string" && p.updateCommand.trim() ? p.updateCommand.trim() : "adhdev daemon:upgrade";
|
|
81094
81062
|
LOG.info("Server", `
|
|
81095
81063
|
\u{1F504} Update available: v${p.current} \u2192 v${p.latest}`);
|
|
81096
|
-
LOG.info("Server", ` Run:
|
|
81064
|
+
LOG.info("Server", ` Run: ${updateCommand}
|
|
81097
81065
|
`);
|
|
81098
81066
|
} else if (message.type === "force_update_required") {
|
|
81099
81067
|
this.compatBlocked = true;
|
|
81100
81068
|
const p = message.payload;
|
|
81069
|
+
const updateCommand = typeof p.updateCommand === "string" && p.updateCommand.trim() ? p.updateCommand.trim() : "adhdev daemon:upgrade";
|
|
81101
81070
|
LOG.error("Server", `
|
|
81102
81071
|
\u26D4 Daemon v${this.options.daemonVersion} is no longer compatible.`);
|
|
81103
81072
|
LOG.error("Server", ` Minimum required: v${p.minVersion}`);
|
|
81104
|
-
LOG.error("Server", ` Run:
|
|
81073
|
+
LOG.error("Server", ` Run: ${updateCommand}
|
|
81105
81074
|
`);
|
|
81106
81075
|
}
|
|
81107
81076
|
const handlers = this.messageHandlers.get(message.type);
|
|
@@ -86977,10 +86946,10 @@ var require_color = __commonJS({
|
|
|
86977
86946
|
const b = srgbNonlinearTransformInv(rgb[2] / 255);
|
|
86978
86947
|
const lp = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b);
|
|
86979
86948
|
const mp = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b);
|
|
86980
|
-
const
|
|
86981
|
-
const l = 0.2104542553 * lp + 0.793617785 * mp - 0.0040720468 *
|
|
86982
|
-
const aa = 1.9779984951 * lp - 2.428592205 * mp + 0.4505937099 *
|
|
86983
|
-
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;
|
|
86984
86953
|
return [l * 100, aa * 100, bb * 100];
|
|
86985
86954
|
};
|
|
86986
86955
|
convert.rgb.cmyk = function(rgb) {
|
|
@@ -87242,10 +87211,10 @@ var require_color = __commonJS({
|
|
|
87242
87211
|
const z2 = xyz[2] / 100;
|
|
87243
87212
|
const lp = Math.cbrt(0.8189330101 * x + 0.3618667424 * y - 0.1288597137 * z2);
|
|
87244
87213
|
const mp = Math.cbrt(0.0329845436 * x + 0.9293118715 * y + 0.0361456387 * z2);
|
|
87245
|
-
const
|
|
87246
|
-
const l = 0.2104542553 * lp + 0.793617785 * mp - 0.0040720468 *
|
|
87247
|
-
const a = 1.9779984951 * lp - 2.428592205 * mp + 0.4505937099 *
|
|
87248
|
-
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;
|
|
87249
87218
|
return [l * 100, a * 100, b * 100];
|
|
87250
87219
|
};
|
|
87251
87220
|
convert.oklab.oklch = function(oklab) {
|
|
@@ -90005,7 +89974,9 @@ var init_daemon_mesh_manager = __esm({
|
|
|
90005
89974
|
"read_chat",
|
|
90006
89975
|
"git_status",
|
|
90007
89976
|
"git_diff_summary",
|
|
90008
|
-
"launch_cli"
|
|
89977
|
+
"launch_cli",
|
|
89978
|
+
"git_checkpoint",
|
|
89979
|
+
"resolve_action"
|
|
90009
89980
|
]);
|
|
90010
89981
|
setRules(rules) {
|
|
90011
89982
|
const valid = [];
|
|
@@ -90296,7 +90267,7 @@ var init_adhdev_daemon = __esm({
|
|
|
90296
90267
|
init_version();
|
|
90297
90268
|
init_src();
|
|
90298
90269
|
init_runtime_defaults();
|
|
90299
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.76-rc.
|
|
90270
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.76-rc.10" });
|
|
90300
90271
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
90301
90272
|
localHttpServer = null;
|
|
90302
90273
|
localWss = null;
|
|
@@ -91132,6 +91103,19 @@ ${err?.stack || ""}`);
|
|
|
91132
91103
|
void this.statusReporter?.sendUnifiedStatusReport({ forceServer: true, reason });
|
|
91133
91104
|
void this.flushP2PDaemonMetadataSubscriptions();
|
|
91134
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
|
+
}
|
|
91135
91119
|
async handleCommand(msg, cmd, args) {
|
|
91136
91120
|
const normalizedArgs = this.ensureInteractionContext(args);
|
|
91137
91121
|
const interactionId = String(normalizedArgs._interactionId);
|
|
@@ -91166,6 +91150,10 @@ ${err?.stack || ""}`);
|
|
|
91166
91150
|
if (cmd === "resolve_action" || cmd === "send_chat" || cmd === "read_chat") {
|
|
91167
91151
|
void this.flushP2PSessionModalSubscriptions();
|
|
91168
91152
|
}
|
|
91153
|
+
if (cmd.startsWith("git_")) {
|
|
91154
|
+
void this.flushP2PWorkspaceGitSubscriptions();
|
|
91155
|
+
}
|
|
91156
|
+
this.emitMeshCheckpointCompleteIfNeeded(cmd, result, normalizedArgs);
|
|
91169
91157
|
this.sendResult(msg, result.success, { ...result, interactionId });
|
|
91170
91158
|
recordDebugTrace({
|
|
91171
91159
|
interactionId,
|
|
@@ -91247,18 +91235,7 @@ ${err?.stack || ""}`);
|
|
|
91247
91235
|
if (cmdType.startsWith("git_")) {
|
|
91248
91236
|
void this.flushP2PWorkspaceGitSubscriptions();
|
|
91249
91237
|
}
|
|
91250
|
-
|
|
91251
|
-
const workspace = String(normalizedData.workspace ?? "");
|
|
91252
|
-
const baseContext = {
|
|
91253
|
-
workspace,
|
|
91254
|
-
checkpoint_message: routed.checkpoint?.message ?? String(normalizedData.message ?? ""),
|
|
91255
|
-
commit: routed.checkpoint?.commit ?? "",
|
|
91256
|
-
source_session_id: String(normalizedData.targetSessionId ?? "")
|
|
91257
|
-
};
|
|
91258
|
-
void this.buildMeshCheckpointContext(workspace, baseContext).then((ctx) => {
|
|
91259
|
-
this.meshManager.emit({ trigger: "git_checkpoint_complete", context: ctx });
|
|
91260
|
-
});
|
|
91261
|
-
}
|
|
91238
|
+
this.emitMeshCheckpointCompleteIfNeeded(cmdType, routed, normalizedData);
|
|
91262
91239
|
return { ...routed, interactionId };
|
|
91263
91240
|
} catch (e) {
|
|
91264
91241
|
logCommand({ ts: (/* @__PURE__ */ new Date()).toISOString(), cmd: cmdType, source: "p2p", interactionId, success: false, error: e.message, durationMs: Date.now() - cmdStart });
|
|
@@ -91398,7 +91375,21 @@ ${err?.stack || ""}`);
|
|
|
91398
91375
|
return;
|
|
91399
91376
|
}
|
|
91400
91377
|
try {
|
|
91401
|
-
|
|
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
|
+
}
|
|
91402
91393
|
ws.send(JSON.stringify({
|
|
91403
91394
|
type: "ext:command_result",
|
|
91404
91395
|
payload: {
|
|
@@ -91517,8 +91508,54 @@ ${err?.stack || ""}`);
|
|
|
91517
91508
|
// src/wizard.ts
|
|
91518
91509
|
var wizard_exports = {};
|
|
91519
91510
|
__export(wizard_exports, {
|
|
91511
|
+
buildSetupReleaseContext: () => buildSetupReleaseContext,
|
|
91512
|
+
readLatestPublishedCliVersion: () => readLatestPublishedCliVersion,
|
|
91520
91513
|
runWizard: () => runWizard
|
|
91521
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
|
+
}
|
|
91522
91559
|
async function openBrowser(url2) {
|
|
91523
91560
|
const mod = await import("open");
|
|
91524
91561
|
return mod.default(url2);
|
|
@@ -91527,10 +91564,10 @@ function hasCloudMachineAuth() {
|
|
|
91527
91564
|
const config2 = loadConfig();
|
|
91528
91565
|
return Boolean(config2.machineSecret && config2.machineSecret.trim());
|
|
91529
91566
|
}
|
|
91530
|
-
function readLatestPublishedCliVersion(execFileSyncLocal) {
|
|
91567
|
+
function readLatestPublishedCliVersion(execFileSyncLocal, npmTag = "latest") {
|
|
91531
91568
|
const surface = resolveCurrentGlobalInstallSurface({ packageName: "adhdev" });
|
|
91532
91569
|
try {
|
|
91533
|
-
return execFileSyncLocal(surface.npmExecutable, [...surface.npmArgsPrefix || [], "view",
|
|
91570
|
+
return execFileSyncLocal(surface.npmExecutable, [...surface.npmArgsPrefix || [], "view", `adhdev@${npmTag}`, "version"], {
|
|
91534
91571
|
encoding: "utf-8",
|
|
91535
91572
|
timeout: 5e3,
|
|
91536
91573
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -91561,38 +91598,41 @@ function readInstalledGlobalCliVersion(execFileSyncLocal) {
|
|
|
91561
91598
|
}
|
|
91562
91599
|
async function runWizard(options = {}) {
|
|
91563
91600
|
console.log(LOGO);
|
|
91601
|
+
const config2 = loadConfig();
|
|
91602
|
+
const releaseContext = buildSetupReleaseContext({ config: config2 });
|
|
91564
91603
|
if (isSetupComplete() && hasCloudMachineAuth() && !options.force) {
|
|
91565
|
-
const config2 = loadConfig();
|
|
91566
91604
|
console.log(source_default.green("\u2713") + " ADHDev is already configured.");
|
|
91567
91605
|
console.log(source_default.gray(` Account: ${config2.userEmail || "not logged in"}`));
|
|
91606
|
+
console.log(source_default.gray(` Server: ${releaseContext.serverUrl}`));
|
|
91568
91607
|
console.log();
|
|
91569
|
-
await checkForUpdate();
|
|
91570
|
-
await startDaemonFlow();
|
|
91608
|
+
await checkForUpdate(releaseContext);
|
|
91609
|
+
await startDaemonFlow(releaseContext);
|
|
91571
91610
|
return;
|
|
91572
91611
|
}
|
|
91573
|
-
await quickSetup();
|
|
91612
|
+
await quickSetup(releaseContext);
|
|
91574
91613
|
}
|
|
91575
|
-
async function checkForUpdate() {
|
|
91614
|
+
async function checkForUpdate(releaseContext) {
|
|
91576
91615
|
try {
|
|
91577
91616
|
const { execFileSync: execFileSync6 } = await import("child_process");
|
|
91578
91617
|
const currentVersion = resolvePackageVersion();
|
|
91579
|
-
const latestVersion = readLatestPublishedCliVersion(execFileSync6);
|
|
91618
|
+
const latestVersion = readLatestPublishedCliVersion(execFileSync6, releaseContext.npmTag);
|
|
91580
91619
|
if (!latestVersion) return;
|
|
91581
91620
|
if (!currentVersion || !latestVersion || currentVersion === latestVersion) return;
|
|
91582
|
-
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}`));
|
|
91583
91622
|
const { doUpdate } = await (await Promise.resolve().then(() => (init_lib(), lib_exports))).default.prompt([{
|
|
91584
91623
|
type: "confirm",
|
|
91585
91624
|
name: "doUpdate",
|
|
91586
|
-
message: `Update adhdev CLI to v${latestVersion}?`,
|
|
91625
|
+
message: `Update adhdev CLI to v${latestVersion} from ${releaseContext.npmTag}?`,
|
|
91587
91626
|
default: true
|
|
91588
91627
|
}]);
|
|
91589
91628
|
if (!doUpdate) {
|
|
91590
|
-
console.log(source_default.gray(
|
|
91629
|
+
console.log(source_default.gray(` Skipping update. Run: npm install -g adhdev@${releaseContext.npmTag}
|
|
91630
|
+
`));
|
|
91591
91631
|
return;
|
|
91592
91632
|
}
|
|
91593
91633
|
const spinner = (await Promise.resolve().then(() => (init_ora(), ora_exports))).default("Updating adhdev CLI...").start();
|
|
91594
91634
|
try {
|
|
91595
|
-
const installCommand = buildPinnedGlobalInstallCommand({ packageName: "adhdev", targetVersion:
|
|
91635
|
+
const installCommand = buildPinnedGlobalInstallCommand({ packageName: "adhdev", targetVersion: releaseContext.npmTag });
|
|
91596
91636
|
execFileSync6(installCommand.command, installCommand.args, {
|
|
91597
91637
|
encoding: "utf-8",
|
|
91598
91638
|
timeout: 6e4,
|
|
@@ -91603,14 +91643,17 @@ async function checkForUpdate() {
|
|
|
91603
91643
|
console.log();
|
|
91604
91644
|
} catch (e) {
|
|
91605
91645
|
spinner.fail("Update failed");
|
|
91606
|
-
console.log(source_default.gray(
|
|
91646
|
+
console.log(source_default.gray(` Manual: npm install -g adhdev@${releaseContext.npmTag}
|
|
91647
|
+
`));
|
|
91607
91648
|
}
|
|
91608
91649
|
} catch {
|
|
91609
91650
|
}
|
|
91610
91651
|
}
|
|
91611
|
-
async function quickSetup() {
|
|
91652
|
+
async function quickSetup(releaseContext) {
|
|
91612
91653
|
console.log(source_default.bold("\n\u{1F680} Quick Setup\n"));
|
|
91613
|
-
|
|
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);
|
|
91614
91657
|
const setupDate = (/* @__PURE__ */ new Date()).toISOString();
|
|
91615
91658
|
if (!loginResult) {
|
|
91616
91659
|
updateConfig({
|
|
@@ -91621,7 +91664,9 @@ async function quickSetup() {
|
|
|
91621
91664
|
setupDate,
|
|
91622
91665
|
userEmail: null,
|
|
91623
91666
|
userName: null,
|
|
91624
|
-
machineSecret: null
|
|
91667
|
+
machineSecret: null,
|
|
91668
|
+
updateChannel: releaseContext.channel,
|
|
91669
|
+
serverUrl: releaseContext.serverUrl
|
|
91625
91670
|
});
|
|
91626
91671
|
console.log(source_default.yellow("\u26A0 Setup is not complete without login. Run `adhdev setup` after signing in."));
|
|
91627
91672
|
}
|
|
@@ -91632,14 +91677,16 @@ async function quickSetup() {
|
|
|
91632
91677
|
userEmail: loginResult.email,
|
|
91633
91678
|
userName: loginResult.name,
|
|
91634
91679
|
setupDate,
|
|
91680
|
+
updateChannel: releaseContext.channel,
|
|
91681
|
+
serverUrl: releaseContext.serverUrl,
|
|
91635
91682
|
...loginResult.registeredMachineId ? { registeredMachineId: loginResult.registeredMachineId } : {}
|
|
91636
91683
|
};
|
|
91637
91684
|
updateConfig(configUpdate);
|
|
91638
91685
|
console.log(source_default.green(` \u2713 Machine registered`));
|
|
91639
91686
|
}
|
|
91640
|
-
await installCliOnly();
|
|
91687
|
+
await installCliOnly(releaseContext);
|
|
91641
91688
|
if (loginResult) {
|
|
91642
|
-
await startDaemonFlow();
|
|
91689
|
+
await startDaemonFlow(releaseContext);
|
|
91643
91690
|
} else {
|
|
91644
91691
|
console.log(source_default.gray(" Start daemon after login: adhdev setup"));
|
|
91645
91692
|
console.log();
|
|
@@ -91648,6 +91695,7 @@ async function quickSetup() {
|
|
|
91648
91695
|
console.log(source_default.bold("\n\u{1F389} Setup Complete!\n"));
|
|
91649
91696
|
console.log(` ${source_default.bold("User:")} ${loginResult?.email || "not logged in"}`);
|
|
91650
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}`);
|
|
91651
91699
|
console.log();
|
|
91652
91700
|
console.log(source_default.gray(" Next steps:"));
|
|
91653
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"}`));
|
|
@@ -91658,11 +91706,12 @@ async function quickSetup() {
|
|
|
91658
91706
|
console.log(source_default.gray(" adhdev launch claude \u2014 Start Claude Code agent"));
|
|
91659
91707
|
console.log(source_default.gray(" adhdev status \u2014 Check setup status"));
|
|
91660
91708
|
console.log();
|
|
91661
|
-
console.log(source_default.cyan(
|
|
91709
|
+
console.log(source_default.cyan(` Dashboard: ${releaseContext.dashboardUrl}`));
|
|
91662
91710
|
console.log();
|
|
91663
91711
|
}
|
|
91664
|
-
async function loginFlow() {
|
|
91712
|
+
async function loginFlow(releaseContext) {
|
|
91665
91713
|
console.log(source_default.bold("\n\u{1F510} Login to ADHDev\n"));
|
|
91714
|
+
console.log(source_default.gray(` Auth server: ${releaseContext.serverUrl}`));
|
|
91666
91715
|
const { wantLogin } = await lib_default.prompt([
|
|
91667
91716
|
{
|
|
91668
91717
|
type: "confirm",
|
|
@@ -91679,7 +91728,7 @@ async function loginFlow() {
|
|
|
91679
91728
|
try {
|
|
91680
91729
|
const config2 = loadConfig();
|
|
91681
91730
|
const os31 = await import("os");
|
|
91682
|
-
const res = await fetch(`${
|
|
91731
|
+
const res = await fetch(`${releaseContext.serverUrl}/auth/cli/init`, {
|
|
91683
91732
|
method: "POST",
|
|
91684
91733
|
headers: { "Content-Type": "application/json" },
|
|
91685
91734
|
body: JSON.stringify({
|
|
@@ -91721,7 +91770,7 @@ async function loginFlow() {
|
|
|
91721
91770
|
while (Date.now() - startTime < timeout) {
|
|
91722
91771
|
await new Promise((r) => setTimeout(r, 3e3));
|
|
91723
91772
|
try {
|
|
91724
|
-
const res = await fetch(`${
|
|
91773
|
+
const res = await fetch(`${releaseContext.serverUrl}/auth/cli/poll`, {
|
|
91725
91774
|
method: "POST",
|
|
91726
91775
|
headers: { "Content-Type": "application/json" },
|
|
91727
91776
|
body: JSON.stringify({ deviceCode })
|
|
@@ -91751,9 +91800,9 @@ async function loginFlow() {
|
|
|
91751
91800
|
console.log();
|
|
91752
91801
|
console.log(source_default.yellow(" To fix this, do one of the following:"));
|
|
91753
91802
|
console.log(source_default.gray(" 1. Remove an unused machine from the dashboard:"));
|
|
91754
|
-
console.log(source_default.gray(
|
|
91803
|
+
console.log(source_default.gray(` ${releaseContext.dashboardUrl.replace(/\/dashboard$/, "/account")} \u2192 Registered Machines \u2192 \u2715 Remove`));
|
|
91755
91804
|
console.log(source_default.gray(" 2. Upgrade your plan:"));
|
|
91756
|
-
console.log(source_default.gray(
|
|
91805
|
+
console.log(source_default.gray(` ${releaseContext.dashboardUrl.replace(/\/dashboard$/, "/account?tab=billing")}`));
|
|
91757
91806
|
console.log();
|
|
91758
91807
|
console.log(source_default.gray(" Then run `adhdev setup` again."));
|
|
91759
91808
|
console.log();
|
|
@@ -91765,11 +91814,12 @@ async function loginFlow() {
|
|
|
91765
91814
|
pollSpinner.fail("Authentication timed out");
|
|
91766
91815
|
return null;
|
|
91767
91816
|
}
|
|
91768
|
-
async function startDaemonFlow() {
|
|
91817
|
+
async function startDaemonFlow(releaseContext) {
|
|
91769
91818
|
const { isDaemonRunning: isDaemonRunning2 } = await Promise.resolve().then(() => (init_adhdev_daemon(), adhdev_daemon_exports));
|
|
91770
91819
|
if (isDaemonRunning2()) {
|
|
91771
91820
|
console.log(source_default.green(" \u2713 Daemon is already running"));
|
|
91772
|
-
console.log(source_default.gray(
|
|
91821
|
+
console.log(source_default.gray(` Dashboard: ${releaseContext.dashboardUrl}
|
|
91822
|
+
`));
|
|
91773
91823
|
return;
|
|
91774
91824
|
}
|
|
91775
91825
|
const { startDaemon } = await lib_default.prompt([
|
|
@@ -91823,7 +91873,7 @@ async function startDaemonFlow() {
|
|
|
91823
91873
|
} else {
|
|
91824
91874
|
daemonSpinner.warn("Daemon starting in background (may take a few seconds)");
|
|
91825
91875
|
}
|
|
91826
|
-
console.log(source_default.gray(
|
|
91876
|
+
console.log(source_default.gray(` Dashboard: ${releaseContext.dashboardUrl}`));
|
|
91827
91877
|
console.log(source_default.gray(` Logs: ${logPath}`));
|
|
91828
91878
|
console.log();
|
|
91829
91879
|
} catch (e) {
|
|
@@ -91831,7 +91881,7 @@ async function startDaemonFlow() {
|
|
|
91831
91881
|
console.log(source_default.gray(" Manual: adhdev daemon\n"));
|
|
91832
91882
|
}
|
|
91833
91883
|
}
|
|
91834
|
-
async function installCliOnly() {
|
|
91884
|
+
async function installCliOnly(releaseContext) {
|
|
91835
91885
|
const { execFileSync: execFileSyncLocal } = await import("child_process");
|
|
91836
91886
|
const currentVersion = readInstalledGlobalCliVersion(execFileSyncLocal);
|
|
91837
91887
|
const isNpx = process.env.npm_execpath?.includes("npx") || process.argv[1]?.includes("npx") || process.argv[1]?.includes("_npx");
|
|
@@ -91844,7 +91894,7 @@ async function installCliOnly() {
|
|
|
91844
91894
|
console.log();
|
|
91845
91895
|
if (currentVersion) {
|
|
91846
91896
|
console.log(source_default.green(` \u2713 Currently installed: v${currentVersion}`));
|
|
91847
|
-
const latestVersion = readLatestPublishedCliVersion(execFileSyncLocal);
|
|
91897
|
+
const latestVersion = readLatestPublishedCliVersion(execFileSyncLocal, releaseContext.npmTag);
|
|
91848
91898
|
if (latestVersion && currentVersion === latestVersion) {
|
|
91849
91899
|
console.log(source_default.gray(" (Already up to date)"));
|
|
91850
91900
|
return;
|
|
@@ -91853,12 +91903,12 @@ async function installCliOnly() {
|
|
|
91853
91903
|
const { doUpdate } = await lib_default.prompt([{
|
|
91854
91904
|
type: "confirm",
|
|
91855
91905
|
name: "doUpdate",
|
|
91856
|
-
message: `Update to
|
|
91906
|
+
message: `Update to ${releaseContext.npmTag} version${latestVersion ? ` (v${latestVersion})` : ""}?`,
|
|
91857
91907
|
default: true
|
|
91858
91908
|
}]);
|
|
91859
91909
|
if (!doUpdate) return;
|
|
91860
91910
|
} else {
|
|
91861
|
-
console.log(source_default.gray(
|
|
91911
|
+
console.log(source_default.gray(` Updating to ${releaseContext.npmTag}...`));
|
|
91862
91912
|
}
|
|
91863
91913
|
} else {
|
|
91864
91914
|
console.log(source_default.yellow(" \u2717 Not installed globally"));
|
|
@@ -91866,7 +91916,7 @@ async function installCliOnly() {
|
|
|
91866
91916
|
const { doInstall } = await lib_default.prompt([{
|
|
91867
91917
|
type: "confirm",
|
|
91868
91918
|
name: "doInstall",
|
|
91869
|
-
message:
|
|
91919
|
+
message: `Install adhdev CLI globally? (npm install -g adhdev@${releaseContext.npmTag})`,
|
|
91870
91920
|
default: true
|
|
91871
91921
|
}]);
|
|
91872
91922
|
if (!doInstall) {
|
|
@@ -91879,14 +91929,14 @@ async function installCliOnly() {
|
|
|
91879
91929
|
}
|
|
91880
91930
|
const installSpinner = ora2("Installing adhdev CLI...").start();
|
|
91881
91931
|
try {
|
|
91882
|
-
const installCommand = buildPinnedGlobalInstallCommand({ packageName: "adhdev", targetVersion:
|
|
91932
|
+
const installCommand = buildPinnedGlobalInstallCommand({ packageName: "adhdev", targetVersion: releaseContext.npmTag });
|
|
91883
91933
|
execFileSyncLocal(installCommand.command, installCommand.args, {
|
|
91884
91934
|
encoding: "utf-8",
|
|
91885
91935
|
timeout: 6e4,
|
|
91886
91936
|
stdio: ["pipe", "pipe", "pipe"],
|
|
91887
91937
|
...installCommand.execOptions
|
|
91888
91938
|
});
|
|
91889
|
-
const newVersion = readInstalledGlobalCliVersion(execFileSyncLocal) ||
|
|
91939
|
+
const newVersion = readInstalledGlobalCliVersion(execFileSyncLocal) || releaseContext.npmTag;
|
|
91890
91940
|
installSpinner.succeed(`adhdev CLI ${currentVersion ? "updated" : "installed"} \u2713 (v${newVersion})`);
|
|
91891
91941
|
console.log(source_default.gray(" Try: adhdev daemon"));
|
|
91892
91942
|
console.log();
|
|
@@ -91897,11 +91947,11 @@ async function installCliOnly() {
|
|
|
91897
91947
|
if (osModule.platform() === "win32") {
|
|
91898
91948
|
console.log(source_default.gray(" On Windows, run PowerShell as Administrator"));
|
|
91899
91949
|
}
|
|
91900
|
-
console.log(source_default.gray(
|
|
91950
|
+
console.log(source_default.gray(` Manual: npm install -g adhdev@${releaseContext.npmTag}`));
|
|
91901
91951
|
console.log();
|
|
91902
91952
|
}
|
|
91903
91953
|
}
|
|
91904
|
-
var
|
|
91954
|
+
var CHANNEL_NPM_TAG2, CHANNEL_SERVER_URL2, LOGO, DIVIDER;
|
|
91905
91955
|
var init_wizard = __esm({
|
|
91906
91956
|
"src/wizard.ts"() {
|
|
91907
91957
|
"use strict";
|
|
@@ -91910,7 +91960,14 @@ var init_wizard = __esm({
|
|
|
91910
91960
|
init_ora();
|
|
91911
91961
|
init_src();
|
|
91912
91962
|
init_version();
|
|
91913
|
-
|
|
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
|
+
};
|
|
91914
91971
|
LOGO = `
|
|
91915
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")}
|
|
91916
91973
|
${source_default.cyan("\u2551")} ${source_default.bold.white("\u{1F9A6} ADHDev Setup Wizard")} ${source_default.cyan("\u2551")}
|
|
@@ -93934,8 +93991,8 @@ var DEFAULT_TRACE_FOLLOW_INTERVAL_MS = 1500;
|
|
|
93934
93991
|
var DEFAULT_DAEMON_PORT_TEXT = String(DEFAULT_DAEMON_PORT);
|
|
93935
93992
|
var DEV_SERVER_PORT2 = 19280;
|
|
93936
93993
|
var DEV_SERVER_BASE_URL = `http://127.0.0.1:${DEV_SERVER_PORT2}`;
|
|
93937
|
-
var
|
|
93938
|
-
var
|
|
93994
|
+
var CHANNEL_NPM_TAG3 = { stable: "latest", preview: "next" };
|
|
93995
|
+
var CHANNEL_SERVER_URL3 = {
|
|
93939
93996
|
stable: "https://api.adhf.dev",
|
|
93940
93997
|
preview: "https://api-preview.adhf.dev"
|
|
93941
93998
|
};
|
|
@@ -93955,11 +94012,11 @@ async function resolveConfiguredUpdateChannel() {
|
|
|
93955
94012
|
}
|
|
93956
94013
|
}
|
|
93957
94014
|
function releaseChannelLabel(channel) {
|
|
93958
|
-
return `${channel} (${
|
|
94015
|
+
return `${channel} (${CHANNEL_NPM_TAG3[channel]})`;
|
|
93959
94016
|
}
|
|
93960
94017
|
async function persistReleaseChannel(channel) {
|
|
93961
94018
|
const { updateConfig: updateConfig2 } = await Promise.resolve().then(() => (init_src(), src_exports));
|
|
93962
|
-
updateConfig2({ updateChannel: channel, serverUrl:
|
|
94019
|
+
updateConfig2({ updateChannel: channel, serverUrl: CHANNEL_SERVER_URL3[channel] });
|
|
93963
94020
|
}
|
|
93964
94021
|
function hideCommand(command) {
|
|
93965
94022
|
command._hidden = true;
|
|
@@ -94284,7 +94341,7 @@ async function runDaemonUpgrade(options, pkgVersion3) {
|
|
|
94284
94341
|
return;
|
|
94285
94342
|
}
|
|
94286
94343
|
const configuredChannel = requestedChannel || await resolveConfiguredUpdateChannel();
|
|
94287
|
-
const npmTag =
|
|
94344
|
+
const npmTag = CHANNEL_NPM_TAG3[configuredChannel];
|
|
94288
94345
|
if (requestedChannel) {
|
|
94289
94346
|
await persistReleaseChannel(configuredChannel);
|
|
94290
94347
|
}
|
|
@@ -94955,7 +95012,7 @@ function registerDaemonCommands(program2, pkgVersion3) {
|
|
|
94955
95012
|
const current = normalizeReleaseChannel2(config2.updateChannel) || "stable";
|
|
94956
95013
|
console.log(source_default.bold("\n ADHDev Channel\n"));
|
|
94957
95014
|
console.log(` ${source_default.bold("Channel:")} ${releaseChannelLabel(current)}`);
|
|
94958
|
-
console.log(` ${source_default.bold("Server:")} ${config2.serverUrl ||
|
|
95015
|
+
console.log(` ${source_default.bold("Server:")} ${config2.serverUrl || CHANNEL_SERVER_URL3[current]}`);
|
|
94959
95016
|
console.log();
|
|
94960
95017
|
});
|
|
94961
95018
|
channel.command("set <channel>").description("Set the ADHDev channel: stable/latest or preview/next").action(async (channelName) => {
|
|
@@ -94970,7 +95027,7 @@ function registerDaemonCommands(program2, pkgVersion3) {
|
|
|
94970
95027
|
await persistReleaseChannel(selected);
|
|
94971
95028
|
console.log(source_default.green(`
|
|
94972
95029
|
\u2713 Channel set to ${releaseChannelLabel(selected)}`));
|
|
94973
|
-
console.log(source_default.gray(` Server: ${
|
|
95030
|
+
console.log(source_default.gray(` Server: ${CHANNEL_SERVER_URL3[selected]}`));
|
|
94974
95031
|
console.log(source_default.gray(` Update: adhdev update --channel ${selected}
|
|
94975
95032
|
`));
|
|
94976
95033
|
});
|
|
@@ -95100,33 +95157,33 @@ function buildDoctorAdvice(input) {
|
|
|
95100
95157
|
}
|
|
95101
95158
|
|
|
95102
95159
|
// src/cli/service-commands.ts
|
|
95103
|
-
var
|
|
95160
|
+
var import_node_fs3 = __toESM(require("fs"));
|
|
95104
95161
|
var import_node_path5 = __toESM(require("path"));
|
|
95105
|
-
var
|
|
95162
|
+
var import_node_os4 = __toESM(require("os"));
|
|
95106
95163
|
var import_node_child_process2 = require("child_process");
|
|
95107
95164
|
init_source();
|
|
95108
95165
|
init_src();
|
|
95109
95166
|
var DEFAULT_LOCAL_DAEMON_HEALTH_TIMEOUT_MS3 = 1500;
|
|
95110
95167
|
var LAUNCHD_LABEL = "dev.adhf.daemon";
|
|
95111
|
-
var ADHDEV_DIR = import_node_path5.default.join(
|
|
95168
|
+
var ADHDEV_DIR = import_node_path5.default.join(import_node_os4.default.homedir(), ".adhdev");
|
|
95112
95169
|
var LOG_OUT = import_node_path5.default.join(ADHDEV_DIR, "daemon-launchd.out");
|
|
95113
95170
|
var LOG_ERR = import_node_path5.default.join(ADHDEV_DIR, "daemon-launchd.err");
|
|
95114
95171
|
var MAX_LOG_SIZE2 = 10 * 1024 * 1024;
|
|
95115
95172
|
function getDarwinPlistPath() {
|
|
95116
|
-
return import_node_path5.default.join(
|
|
95173
|
+
return import_node_path5.default.join(import_node_os4.default.homedir(), "Library", "LaunchAgents", `${LAUNCHD_LABEL}.plist`);
|
|
95117
95174
|
}
|
|
95118
95175
|
function getWindowsStartupDir() {
|
|
95119
|
-
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");
|
|
95120
95177
|
return import_node_path5.default.join(appData, "Microsoft", "Windows", "Start Menu", "Programs", "Startup");
|
|
95121
95178
|
}
|
|
95122
95179
|
function getWindowsVbsPath() {
|
|
95123
95180
|
return import_node_path5.default.join(getWindowsStartupDir(), "adhdev-daemon.vbs");
|
|
95124
95181
|
}
|
|
95125
95182
|
function resolveCliPath() {
|
|
95126
|
-
return
|
|
95183
|
+
return import_node_fs3.default.realpathSync(process.argv[1]);
|
|
95127
95184
|
}
|
|
95128
95185
|
function ensureDir(dir) {
|
|
95129
|
-
if (!
|
|
95186
|
+
if (!import_node_fs3.default.existsSync(dir)) import_node_fs3.default.mkdirSync(dir, { recursive: true });
|
|
95130
95187
|
}
|
|
95131
95188
|
async function fetchHealth() {
|
|
95132
95189
|
const controller = new AbortController();
|
|
@@ -95168,13 +95225,13 @@ function formatElapsed(etime) {
|
|
|
95168
95225
|
}
|
|
95169
95226
|
function rotateLogIfNeeded(logPath) {
|
|
95170
95227
|
try {
|
|
95171
|
-
if (!
|
|
95172
|
-
const stat5 =
|
|
95228
|
+
if (!import_node_fs3.default.existsSync(logPath)) return;
|
|
95229
|
+
const stat5 = import_node_fs3.default.statSync(logPath);
|
|
95173
95230
|
if (stat5.size > MAX_LOG_SIZE2) {
|
|
95174
95231
|
const rotated = logPath + ".old";
|
|
95175
|
-
if (
|
|
95176
|
-
|
|
95177
|
-
|
|
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()}]
|
|
95178
95235
|
`, "utf-8");
|
|
95179
95236
|
}
|
|
95180
95237
|
} catch {
|
|
@@ -95185,7 +95242,7 @@ function rotateLogs() {
|
|
|
95185
95242
|
rotateLogIfNeeded(LOG_ERR);
|
|
95186
95243
|
}
|
|
95187
95244
|
function buildPlist(nodeExe, cliExe) {
|
|
95188
|
-
const brewPrefix =
|
|
95245
|
+
const brewPrefix = import_node_fs3.default.existsSync("/opt/homebrew/bin") ? "/opt/homebrew/bin" : "/usr/local/bin";
|
|
95189
95246
|
const nodeDir = import_node_path5.default.dirname(nodeExe);
|
|
95190
95247
|
const pathEntries = /* @__PURE__ */ new Set([nodeDir, brewPrefix, "/usr/local/bin", "/usr/bin", "/bin", "/usr/sbin", "/sbin"]);
|
|
95191
95248
|
const pathValue = Array.from(pathEntries).join(":");
|
|
@@ -95226,7 +95283,7 @@ function installDarwin(nodeExe, cliExe) {
|
|
|
95226
95283
|
const plistPath = getDarwinPlistPath();
|
|
95227
95284
|
ensureDir(ADHDEV_DIR);
|
|
95228
95285
|
ensureDir(import_node_path5.default.dirname(plistPath));
|
|
95229
|
-
|
|
95286
|
+
import_node_fs3.default.writeFileSync(plistPath, buildPlist(nodeExe, cliExe), "utf-8");
|
|
95230
95287
|
console.log(source_default.gray(` Plist: ${plistPath}`));
|
|
95231
95288
|
try {
|
|
95232
95289
|
(0, import_node_child_process2.execSync)(`launchctl unload "${plistPath}" 2>/dev/null`, { stdio: "ignore" });
|
|
@@ -95243,7 +95300,7 @@ function installDarwin(nodeExe, cliExe) {
|
|
|
95243
95300
|
}
|
|
95244
95301
|
function uninstallDarwin() {
|
|
95245
95302
|
const plistPath = getDarwinPlistPath();
|
|
95246
|
-
if (!
|
|
95303
|
+
if (!import_node_fs3.default.existsSync(plistPath)) {
|
|
95247
95304
|
console.log(source_default.yellow("\n \u26A0 Service is not installed."));
|
|
95248
95305
|
return;
|
|
95249
95306
|
}
|
|
@@ -95251,11 +95308,11 @@ function uninstallDarwin() {
|
|
|
95251
95308
|
(0, import_node_child_process2.execSync)(`launchctl unload "${plistPath}" 2>/dev/null`, { stdio: "ignore" });
|
|
95252
95309
|
} catch {
|
|
95253
95310
|
}
|
|
95254
|
-
|
|
95311
|
+
import_node_fs3.default.unlinkSync(plistPath);
|
|
95255
95312
|
console.log(source_default.green("\n \u2713 Removed LaunchAgent. Daemon will no longer auto-start."));
|
|
95256
95313
|
}
|
|
95257
95314
|
function isInstalledDarwin() {
|
|
95258
|
-
return
|
|
95315
|
+
return import_node_fs3.default.existsSync(getDarwinPlistPath());
|
|
95259
95316
|
}
|
|
95260
95317
|
function buildVbs(nodeExe, cliExe) {
|
|
95261
95318
|
const logFile = import_node_path5.default.join(ADHDEV_DIR, "daemon-service.log").replace(/\\/g, "\\\\");
|
|
@@ -95270,7 +95327,7 @@ function installWindows(nodeExe, cliExe) {
|
|
|
95270
95327
|
const vbsPath = getWindowsVbsPath();
|
|
95271
95328
|
ensureDir(ADHDEV_DIR);
|
|
95272
95329
|
ensureDir(import_node_path5.default.dirname(vbsPath));
|
|
95273
|
-
|
|
95330
|
+
import_node_fs3.default.writeFileSync(vbsPath, buildVbs(nodeExe, cliExe), "utf-8");
|
|
95274
95331
|
console.log(source_default.gray(` Startup script: ${vbsPath}`));
|
|
95275
95332
|
console.log(source_default.green("\n \u2713 Registered in Startup folder \u2014 daemon will start on login (hidden)."));
|
|
95276
95333
|
console.log(source_default.gray(` Logs: ${import_node_path5.default.join(ADHDEV_DIR, "daemon-service.log")}`));
|
|
@@ -95278,22 +95335,22 @@ function installWindows(nodeExe, cliExe) {
|
|
|
95278
95335
|
}
|
|
95279
95336
|
function uninstallWindows() {
|
|
95280
95337
|
const vbsPath = getWindowsVbsPath();
|
|
95281
|
-
if (!
|
|
95338
|
+
if (!import_node_fs3.default.existsSync(vbsPath)) {
|
|
95282
95339
|
console.log(source_default.yellow("\n \u26A0 Service is not installed."));
|
|
95283
95340
|
return;
|
|
95284
95341
|
}
|
|
95285
|
-
|
|
95342
|
+
import_node_fs3.default.unlinkSync(vbsPath);
|
|
95286
95343
|
console.log(source_default.green("\n \u2713 Removed Startup script. Daemon will no longer auto-start."));
|
|
95287
95344
|
console.log(source_default.gray(" Note: a currently running daemon is not affected. Stop with: adhdev daemon:stop"));
|
|
95288
95345
|
}
|
|
95289
95346
|
function isInstalledWindows() {
|
|
95290
|
-
return
|
|
95347
|
+
return import_node_fs3.default.existsSync(getWindowsVbsPath());
|
|
95291
95348
|
}
|
|
95292
95349
|
function registerServiceCommands(program2) {
|
|
95293
95350
|
const svc = program2.command("service").description("\u{1F50C} Manage ADHDev as an OS background auto-start service");
|
|
95294
95351
|
svc.command("install").description("Register ADHDev daemon to start automatically on login").action(async () => {
|
|
95295
95352
|
console.log(source_default.bold("\n \u{1F680} Installing ADHDev Background Service"));
|
|
95296
|
-
const platform12 =
|
|
95353
|
+
const platform12 = import_node_os4.default.platform();
|
|
95297
95354
|
const nodeExe = process.execPath;
|
|
95298
95355
|
const cliExe = resolveCliPath();
|
|
95299
95356
|
console.log(source_default.gray(` Node: ${nodeExe}`));
|
|
@@ -95312,7 +95369,7 @@ function registerServiceCommands(program2) {
|
|
|
95312
95369
|
});
|
|
95313
95370
|
svc.command("uninstall").description("Remove the OS background service").action(async () => {
|
|
95314
95371
|
console.log(source_default.bold("\n \u{1F5D1}\uFE0F Removing ADHDev Background Service"));
|
|
95315
|
-
const platform12 =
|
|
95372
|
+
const platform12 = import_node_os4.default.platform();
|
|
95316
95373
|
if (platform12 === "darwin") {
|
|
95317
95374
|
uninstallDarwin();
|
|
95318
95375
|
} else if (platform12 === "win32") {
|
|
@@ -95323,7 +95380,7 @@ function registerServiceCommands(program2) {
|
|
|
95323
95380
|
console.log();
|
|
95324
95381
|
});
|
|
95325
95382
|
svc.command("status").description("Show service installation state and live daemon health").action(async () => {
|
|
95326
|
-
const platform12 =
|
|
95383
|
+
const platform12 = import_node_os4.default.platform();
|
|
95327
95384
|
const installed = platform12 === "darwin" ? isInstalledDarwin() : platform12 === "win32" ? isInstalledWindows() : false;
|
|
95328
95385
|
if (installed) {
|
|
95329
95386
|
console.log(source_default.green("\n \u2713 Service is installed."));
|
|
@@ -95343,8 +95400,8 @@ function registerServiceCommands(program2) {
|
|
|
95343
95400
|
} else {
|
|
95344
95401
|
console.log(source_default.yellow(" \u2717 Daemon is not running."));
|
|
95345
95402
|
}
|
|
95346
|
-
const outSize =
|
|
95347
|
-
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;
|
|
95348
95405
|
if (outSize > 0 || errSize > 0) {
|
|
95349
95406
|
console.log(source_default.gray(` Logs: stdout ${formatBytes(outSize)}, stderr ${formatBytes(errSize)}`));
|
|
95350
95407
|
}
|
|
@@ -95353,13 +95410,13 @@ function registerServiceCommands(program2) {
|
|
|
95353
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) => {
|
|
95354
95411
|
if (options.clear) {
|
|
95355
95412
|
for (const f of [LOG_OUT, LOG_ERR]) {
|
|
95356
|
-
if (
|
|
95413
|
+
if (import_node_fs3.default.existsSync(f)) import_node_fs3.default.writeFileSync(f, "", "utf-8");
|
|
95357
95414
|
}
|
|
95358
95415
|
console.log(source_default.green("\n \u2713 Logs cleared.\n"));
|
|
95359
95416
|
return;
|
|
95360
95417
|
}
|
|
95361
95418
|
const logFile = options.err ? LOG_ERR : LOG_OUT;
|
|
95362
|
-
if (!
|
|
95419
|
+
if (!import_node_fs3.default.existsSync(logFile)) {
|
|
95363
95420
|
console.log(source_default.gray(`
|
|
95364
95421
|
No log file found: ${logFile}
|
|
95365
95422
|
`));
|
|
@@ -95369,20 +95426,20 @@ function registerServiceCommands(program2) {
|
|
|
95369
95426
|
console.log(source_default.gray(`
|
|
95370
95427
|
\u2500\u2500 ${options.err ? "stderr" : "stdout"}: ${logFile} (last ${lines} lines) \u2500\u2500
|
|
95371
95428
|
`));
|
|
95372
|
-
const content =
|
|
95429
|
+
const content = import_node_fs3.default.readFileSync(logFile, "utf-8");
|
|
95373
95430
|
const allLines = content.split("\n");
|
|
95374
95431
|
const lastLines = allLines.slice(-lines).join("\n");
|
|
95375
95432
|
if (lastLines.trim()) console.log(lastLines);
|
|
95376
95433
|
console.log(source_default.gray("\n (watching for new output, Ctrl+C to stop)\n"));
|
|
95377
95434
|
let offset = Buffer.byteLength(content, "utf-8");
|
|
95378
|
-
const watcher =
|
|
95435
|
+
const watcher = import_node_fs3.default.watchFile(logFile, { interval: 500 }, () => {
|
|
95379
95436
|
try {
|
|
95380
|
-
const stat5 =
|
|
95437
|
+
const stat5 = import_node_fs3.default.statSync(logFile);
|
|
95381
95438
|
if (stat5.size > offset) {
|
|
95382
|
-
const fd =
|
|
95439
|
+
const fd = import_node_fs3.default.openSync(logFile, "r");
|
|
95383
95440
|
const buf = Buffer.alloc(stat5.size - offset);
|
|
95384
|
-
|
|
95385
|
-
|
|
95441
|
+
import_node_fs3.default.readSync(fd, buf, 0, buf.length, offset);
|
|
95442
|
+
import_node_fs3.default.closeSync(fd);
|
|
95386
95443
|
process.stdout.write(buf.toString("utf-8"));
|
|
95387
95444
|
offset = stat5.size;
|
|
95388
95445
|
} else if (stat5.size < offset) {
|
|
@@ -95392,14 +95449,14 @@ function registerServiceCommands(program2) {
|
|
|
95392
95449
|
}
|
|
95393
95450
|
});
|
|
95394
95451
|
const cleanup = () => {
|
|
95395
|
-
|
|
95452
|
+
import_node_fs3.default.unwatchFile(logFile);
|
|
95396
95453
|
process.exit(0);
|
|
95397
95454
|
};
|
|
95398
95455
|
process.on("SIGINT", cleanup);
|
|
95399
95456
|
process.on("SIGTERM", cleanup);
|
|
95400
95457
|
});
|
|
95401
95458
|
svc.command("restart").description("Restart the daemon process (service will auto-relaunch)").action(async () => {
|
|
95402
|
-
const platform12 =
|
|
95459
|
+
const platform12 = import_node_os4.default.platform();
|
|
95403
95460
|
const installed = platform12 === "darwin" ? isInstalledDarwin() : platform12 === "win32" ? isInstalledWindows() : false;
|
|
95404
95461
|
if (!installed) {
|
|
95405
95462
|
console.log(source_default.yellow("\n \u26A0 Service is not installed. Use `adhdev daemon:restart` for manual restart."));
|
|
@@ -95433,7 +95490,7 @@ function registerServiceCommands(program2) {
|
|
|
95433
95490
|
await new Promise((r) => setTimeout(r, 2e3));
|
|
95434
95491
|
if (platform12 === "win32") {
|
|
95435
95492
|
const vbsPath = getWindowsVbsPath();
|
|
95436
|
-
if (
|
|
95493
|
+
if (import_node_fs3.default.existsSync(vbsPath)) {
|
|
95437
95494
|
try {
|
|
95438
95495
|
(0, import_node_child_process2.execSync)(`wscript.exe "${vbsPath}"`, { stdio: "ignore", windowsHide: true });
|
|
95439
95496
|
} catch {
|
|
@@ -97367,7 +97424,7 @@ void (async () => {
|
|
|
97367
97424
|
});
|
|
97368
97425
|
/*! Bundled license information:
|
|
97369
97426
|
|
|
97370
|
-
chokidar/index.js:
|
|
97427
|
+
chokidar/esm/index.js:
|
|
97371
97428
|
(*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) *)
|
|
97372
97429
|
|
|
97373
97430
|
safe-buffer/index.js:
|