adhdev 0.7.40 → 0.7.41
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 +61 -11
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +61 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3427,6 +3427,8 @@ function buildCliSession(state) {
|
|
|
3427
3427
|
runtimeWorkspaceLabel: state.runtime?.workspaceLabel,
|
|
3428
3428
|
runtimeWriteOwner: state.runtime?.writeOwner || null,
|
|
3429
3429
|
runtimeAttachedClients: state.runtime?.attachedClients || [],
|
|
3430
|
+
launchMode: state.launchMode,
|
|
3431
|
+
mode: state.mode,
|
|
3430
3432
|
resume: state.resume,
|
|
3431
3433
|
activeChat,
|
|
3432
3434
|
capabilities: PTY_SESSION_CAPABILITIES,
|
|
@@ -19895,12 +19897,14 @@ var init_cli_provider_instance = __esm({
|
|
|
19895
19897
|
init_chat_history();
|
|
19896
19898
|
init_logger();
|
|
19897
19899
|
CliProviderInstance = class {
|
|
19898
|
-
constructor(provider, workingDir, cliArgs = [], instanceId, transportFactory) {
|
|
19900
|
+
constructor(provider, workingDir, cliArgs = [], instanceId, transportFactory, launchModeId) {
|
|
19899
19901
|
this.provider = provider;
|
|
19900
19902
|
this.workingDir = workingDir;
|
|
19901
19903
|
this.cliArgs = cliArgs;
|
|
19902
19904
|
this.type = provider.type;
|
|
19903
19905
|
this.instanceId = instanceId || crypto3.randomUUID();
|
|
19906
|
+
this.launchMode = launchModeId && provider.launchModes?.find((m) => m.id === launchModeId) || null;
|
|
19907
|
+
this.resolvedOutputFormat = this.resolveOutputFormat();
|
|
19904
19908
|
this.adapter = new ProviderCliAdapter(provider, workingDir, cliArgs, transportFactory);
|
|
19905
19909
|
this.monitor = new StatusMonitor();
|
|
19906
19910
|
this.historyWriter = new ChatHistoryWriter();
|
|
@@ -19919,6 +19923,26 @@ var init_cli_provider_instance = __esm({
|
|
|
19919
19923
|
lastApprovalEventAt = 0;
|
|
19920
19924
|
historyWriter;
|
|
19921
19925
|
instanceId;
|
|
19926
|
+
launchMode;
|
|
19927
|
+
resolvedOutputFormat;
|
|
19928
|
+
/**
|
|
19929
|
+
* Determine output rendering format from:
|
|
19930
|
+
* 1. launchMode.outputFormat (explicit override)
|
|
19931
|
+
* 2. launchOptions[].outputFormatMap — check actual args for matching values
|
|
19932
|
+
* 3. Default: 'terminal'
|
|
19933
|
+
*/
|
|
19934
|
+
resolveOutputFormat() {
|
|
19935
|
+
if (this.launchMode?.outputFormat) return this.launchMode.outputFormat;
|
|
19936
|
+
if (this.provider.launchOptions?.length) {
|
|
19937
|
+
for (const opt of this.provider.launchOptions) {
|
|
19938
|
+
if (!opt.outputFormatMap) continue;
|
|
19939
|
+
for (const [val, fmt] of Object.entries(opt.outputFormatMap)) {
|
|
19940
|
+
if (this.cliArgs.includes(val)) return fmt;
|
|
19941
|
+
}
|
|
19942
|
+
}
|
|
19943
|
+
}
|
|
19944
|
+
return "terminal";
|
|
19945
|
+
}
|
|
19922
19946
|
// ─── Lifecycle ─────────────────────────────────
|
|
19923
19947
|
async init(context) {
|
|
19924
19948
|
this.context = context;
|
|
@@ -19958,7 +19982,8 @@ var init_cli_provider_instance = __esm({
|
|
|
19958
19982
|
name: this.provider.name,
|
|
19959
19983
|
category: "cli",
|
|
19960
19984
|
status: adapterStatus.status,
|
|
19961
|
-
mode: "terminal",
|
|
19985
|
+
mode: this.resolvedOutputFormat === "stream-json" ? "chat" : "terminal",
|
|
19986
|
+
launchMode: this.launchMode?.id,
|
|
19962
19987
|
activeChat: {
|
|
19963
19988
|
id: `${this.type}_${this.workingDir}`,
|
|
19964
19989
|
title: `${this.provider.name} \xB7 ${dirName}`,
|
|
@@ -37429,12 +37454,12 @@ var init_cli_manager = __esm({
|
|
|
37429
37454
|
}
|
|
37430
37455
|
}, 3e3);
|
|
37431
37456
|
}
|
|
37432
|
-
async registerCliInstance(key, normalizedType, cliType, resolvedDir, cliArgs, provider, settings, attachExisting = false) {
|
|
37457
|
+
async registerCliInstance(key, normalizedType, cliType, resolvedDir, cliArgs, provider, settings, attachExisting = false, launchModeId) {
|
|
37433
37458
|
const instanceManager = this.deps.getInstanceManager();
|
|
37434
37459
|
const sessionRegistry = this.deps.getSessionRegistry?.() || null;
|
|
37435
37460
|
if (!instanceManager) throw new Error("InstanceManager not available");
|
|
37436
37461
|
const transportFactory = this.getTransportFactory(key, normalizedType, resolvedDir, cliArgs, attachExisting);
|
|
37437
|
-
const cliInstance = new CliProviderInstance(provider, resolvedDir, cliArgs, key, transportFactory);
|
|
37462
|
+
const cliInstance = new CliProviderInstance(provider, resolvedDir, cliArgs, key, transportFactory, launchModeId);
|
|
37438
37463
|
try {
|
|
37439
37464
|
await instanceManager.addInstance(key, cliInstance, {
|
|
37440
37465
|
serverConn: this.deps.getServerConn(),
|
|
@@ -37460,7 +37485,7 @@ var init_cli_manager = __esm({
|
|
|
37460
37485
|
this.startCliExitMonitor(key, cliType);
|
|
37461
37486
|
}
|
|
37462
37487
|
// ─── Session start/management ──────────────────────────────
|
|
37463
|
-
async startSession(cliType, workingDir, cliArgs, initialModel) {
|
|
37488
|
+
async startSession(cliType, workingDir, cliArgs, initialModel, launchMode, launchOptionValues) {
|
|
37464
37489
|
const trimmed = (workingDir || "").trim();
|
|
37465
37490
|
if (!trimmed) throw new Error("working directory required");
|
|
37466
37491
|
const resolvedDir = trimmed.startsWith("~") ? trimmed.replace(/^~/, os14.homedir()) : path10.resolve(trimmed);
|
|
@@ -37552,6 +37577,29 @@ ${installInfo}`
|
|
|
37552
37577
|
if (provider) {
|
|
37553
37578
|
console.log(colorize("cyan", ` \u{1F4E6} Using provider: ${provider.name} (${provider.type})`));
|
|
37554
37579
|
}
|
|
37580
|
+
let resolvedCliArgs = cliArgs;
|
|
37581
|
+
let resolvedLaunchMode = launchMode;
|
|
37582
|
+
const activeMode = provider?.launchModes?.length ? launchMode ? provider.launchModes.find((m) => m.id === launchMode) : provider.launchModes.find((m) => m.default) : void 0;
|
|
37583
|
+
if (activeMode) {
|
|
37584
|
+
resolvedLaunchMode = activeMode.id;
|
|
37585
|
+
}
|
|
37586
|
+
if (provider?.launchArgBuilder) {
|
|
37587
|
+
const defaults = {};
|
|
37588
|
+
for (const opt of provider.launchOptions || []) {
|
|
37589
|
+
if (opt.default !== void 0) defaults[opt.id] = opt.default;
|
|
37590
|
+
}
|
|
37591
|
+
const modeOptions = activeMode?.options || {};
|
|
37592
|
+
const userOptions = launchOptionValues || {};
|
|
37593
|
+
const merged = { ...defaults, ...modeOptions, ...userOptions };
|
|
37594
|
+
const extraArgs = provider.launchArgBuilder(merged);
|
|
37595
|
+
if (extraArgs.length) {
|
|
37596
|
+
resolvedCliArgs = [...cliArgs || [], ...extraArgs];
|
|
37597
|
+
console.log(colorize("cyan", ` \u{1F680} Launch options applied: ${extraArgs.join(" ")}`));
|
|
37598
|
+
}
|
|
37599
|
+
} else if (activeMode?.extraArgs?.length) {
|
|
37600
|
+
resolvedCliArgs = [...cliArgs || [], ...activeMode.extraArgs];
|
|
37601
|
+
console.log(colorize("cyan", ` \u{1F680} Launch mode '${activeMode.name}': appending args ${activeMode.extraArgs.join(" ")}`));
|
|
37602
|
+
}
|
|
37555
37603
|
const instanceManager = this.deps.getInstanceManager();
|
|
37556
37604
|
if (provider && instanceManager) {
|
|
37557
37605
|
const resolvedProvider = this.providerLoader.resolve(cliType, { version: cliInfo.version }) || provider;
|
|
@@ -37560,14 +37608,15 @@ ${installInfo}`
|
|
|
37560
37608
|
normalizedType,
|
|
37561
37609
|
cliType,
|
|
37562
37610
|
resolvedDir,
|
|
37563
|
-
|
|
37611
|
+
resolvedCliArgs,
|
|
37564
37612
|
resolvedProvider,
|
|
37565
37613
|
{},
|
|
37566
|
-
false
|
|
37614
|
+
false,
|
|
37615
|
+
resolvedLaunchMode
|
|
37567
37616
|
);
|
|
37568
37617
|
console.log(colorize("green", ` \u2713 CLI started: ${cliInfo.displayName} v${cliInfo.version || "unknown"} in ${resolvedDir}`));
|
|
37569
37618
|
} else {
|
|
37570
|
-
const adapter = this.createAdapter(cliType, resolvedDir,
|
|
37619
|
+
const adapter = this.createAdapter(cliType, resolvedDir, resolvedCliArgs, key, false);
|
|
37571
37620
|
try {
|
|
37572
37621
|
await adapter.spawn();
|
|
37573
37622
|
} catch (spawnErr) {
|
|
@@ -37675,7 +37724,8 @@ ${installInfo}`
|
|
|
37675
37724
|
record2.cliArgs,
|
|
37676
37725
|
resolvedProvider,
|
|
37677
37726
|
{},
|
|
37678
|
-
true
|
|
37727
|
+
true,
|
|
37728
|
+
record2.launchMode
|
|
37679
37729
|
);
|
|
37680
37730
|
restored += 1;
|
|
37681
37731
|
LOG.info("CLI", `\u267B Restored hosted runtime: ${record2.runtimeKey || record2.runtimeId} (${record2.displayName || record2.workspace})`);
|
|
@@ -37745,7 +37795,7 @@ ${installInfo}`
|
|
|
37745
37795
|
const dir = resolved.path;
|
|
37746
37796
|
const launchSource = resolved.source;
|
|
37747
37797
|
if (!cliType) throw new Error("cliType required");
|
|
37748
|
-
await this.startSession(cliType, dir, args?.cliArgs, args?.initialModel);
|
|
37798
|
+
await this.startSession(cliType, dir, args?.cliArgs, args?.initialModel, args?.launchMode, args?.launchOptionValues);
|
|
37749
37799
|
let newKey = null;
|
|
37750
37800
|
for (const [k, adapter] of this.adapters) {
|
|
37751
37801
|
if (adapter.cliType === cliType && adapter.workingDir === dir) {
|
|
@@ -45141,7 +45191,7 @@ var init_adhdev_daemon = __esm({
|
|
|
45141
45191
|
fs15 = __toESM(require("fs"));
|
|
45142
45192
|
path17 = __toESM(require("path"));
|
|
45143
45193
|
import_chalk2 = __toESM(require("chalk"));
|
|
45144
|
-
pkgVersion = "0.7.
|
|
45194
|
+
pkgVersion = "0.7.41";
|
|
45145
45195
|
if (pkgVersion === "unknown") {
|
|
45146
45196
|
try {
|
|
45147
45197
|
const possiblePaths = [
|