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/cli/index.js
CHANGED
|
@@ -3601,6 +3601,8 @@ function buildCliSession(state) {
|
|
|
3601
3601
|
runtimeWorkspaceLabel: state.runtime?.workspaceLabel,
|
|
3602
3602
|
runtimeWriteOwner: state.runtime?.writeOwner || null,
|
|
3603
3603
|
runtimeAttachedClients: state.runtime?.attachedClients || [],
|
|
3604
|
+
launchMode: state.launchMode,
|
|
3605
|
+
mode: state.mode,
|
|
3604
3606
|
resume: state.resume,
|
|
3605
3607
|
activeChat,
|
|
3606
3608
|
capabilities: PTY_SESSION_CAPABILITIES,
|
|
@@ -20097,12 +20099,14 @@ var init_cli_provider_instance = __esm({
|
|
|
20097
20099
|
init_chat_history();
|
|
20098
20100
|
init_logger();
|
|
20099
20101
|
CliProviderInstance = class {
|
|
20100
|
-
constructor(provider, workingDir, cliArgs = [], instanceId, transportFactory) {
|
|
20102
|
+
constructor(provider, workingDir, cliArgs = [], instanceId, transportFactory, launchModeId) {
|
|
20101
20103
|
this.provider = provider;
|
|
20102
20104
|
this.workingDir = workingDir;
|
|
20103
20105
|
this.cliArgs = cliArgs;
|
|
20104
20106
|
this.type = provider.type;
|
|
20105
20107
|
this.instanceId = instanceId || crypto3.randomUUID();
|
|
20108
|
+
this.launchMode = launchModeId && provider.launchModes?.find((m) => m.id === launchModeId) || null;
|
|
20109
|
+
this.resolvedOutputFormat = this.resolveOutputFormat();
|
|
20106
20110
|
this.adapter = new ProviderCliAdapter(provider, workingDir, cliArgs, transportFactory);
|
|
20107
20111
|
this.monitor = new StatusMonitor();
|
|
20108
20112
|
this.historyWriter = new ChatHistoryWriter();
|
|
@@ -20121,6 +20125,26 @@ var init_cli_provider_instance = __esm({
|
|
|
20121
20125
|
lastApprovalEventAt = 0;
|
|
20122
20126
|
historyWriter;
|
|
20123
20127
|
instanceId;
|
|
20128
|
+
launchMode;
|
|
20129
|
+
resolvedOutputFormat;
|
|
20130
|
+
/**
|
|
20131
|
+
* Determine output rendering format from:
|
|
20132
|
+
* 1. launchMode.outputFormat (explicit override)
|
|
20133
|
+
* 2. launchOptions[].outputFormatMap — check actual args for matching values
|
|
20134
|
+
* 3. Default: 'terminal'
|
|
20135
|
+
*/
|
|
20136
|
+
resolveOutputFormat() {
|
|
20137
|
+
if (this.launchMode?.outputFormat) return this.launchMode.outputFormat;
|
|
20138
|
+
if (this.provider.launchOptions?.length) {
|
|
20139
|
+
for (const opt of this.provider.launchOptions) {
|
|
20140
|
+
if (!opt.outputFormatMap) continue;
|
|
20141
|
+
for (const [val, fmt] of Object.entries(opt.outputFormatMap)) {
|
|
20142
|
+
if (this.cliArgs.includes(val)) return fmt;
|
|
20143
|
+
}
|
|
20144
|
+
}
|
|
20145
|
+
}
|
|
20146
|
+
return "terminal";
|
|
20147
|
+
}
|
|
20124
20148
|
// ─── Lifecycle ─────────────────────────────────
|
|
20125
20149
|
async init(context) {
|
|
20126
20150
|
this.context = context;
|
|
@@ -20160,7 +20184,8 @@ var init_cli_provider_instance = __esm({
|
|
|
20160
20184
|
name: this.provider.name,
|
|
20161
20185
|
category: "cli",
|
|
20162
20186
|
status: adapterStatus.status,
|
|
20163
|
-
mode: "terminal",
|
|
20187
|
+
mode: this.resolvedOutputFormat === "stream-json" ? "chat" : "terminal",
|
|
20188
|
+
launchMode: this.launchMode?.id,
|
|
20164
20189
|
activeChat: {
|
|
20165
20190
|
id: `${this.type}_${this.workingDir}`,
|
|
20166
20191
|
title: `${this.provider.name} \xB7 ${dirName}`,
|
|
@@ -37631,12 +37656,12 @@ var init_cli_manager = __esm({
|
|
|
37631
37656
|
}
|
|
37632
37657
|
}, 3e3);
|
|
37633
37658
|
}
|
|
37634
|
-
async registerCliInstance(key, normalizedType, cliType, resolvedDir, cliArgs, provider, settings, attachExisting = false) {
|
|
37659
|
+
async registerCliInstance(key, normalizedType, cliType, resolvedDir, cliArgs, provider, settings, attachExisting = false, launchModeId) {
|
|
37635
37660
|
const instanceManager = this.deps.getInstanceManager();
|
|
37636
37661
|
const sessionRegistry = this.deps.getSessionRegistry?.() || null;
|
|
37637
37662
|
if (!instanceManager) throw new Error("InstanceManager not available");
|
|
37638
37663
|
const transportFactory = this.getTransportFactory(key, normalizedType, resolvedDir, cliArgs, attachExisting);
|
|
37639
|
-
const cliInstance = new CliProviderInstance(provider, resolvedDir, cliArgs, key, transportFactory);
|
|
37664
|
+
const cliInstance = new CliProviderInstance(provider, resolvedDir, cliArgs, key, transportFactory, launchModeId);
|
|
37640
37665
|
try {
|
|
37641
37666
|
await instanceManager.addInstance(key, cliInstance, {
|
|
37642
37667
|
serverConn: this.deps.getServerConn(),
|
|
@@ -37662,7 +37687,7 @@ var init_cli_manager = __esm({
|
|
|
37662
37687
|
this.startCliExitMonitor(key, cliType);
|
|
37663
37688
|
}
|
|
37664
37689
|
// ─── Session start/management ──────────────────────────────
|
|
37665
|
-
async startSession(cliType, workingDir, cliArgs, initialModel) {
|
|
37690
|
+
async startSession(cliType, workingDir, cliArgs, initialModel, launchMode, launchOptionValues) {
|
|
37666
37691
|
const trimmed = (workingDir || "").trim();
|
|
37667
37692
|
if (!trimmed) throw new Error("working directory required");
|
|
37668
37693
|
const resolvedDir = trimmed.startsWith("~") ? trimmed.replace(/^~/, os14.homedir()) : path10.resolve(trimmed);
|
|
@@ -37754,6 +37779,29 @@ ${installInfo}`
|
|
|
37754
37779
|
if (provider) {
|
|
37755
37780
|
console.log(colorize("cyan", ` \u{1F4E6} Using provider: ${provider.name} (${provider.type})`));
|
|
37756
37781
|
}
|
|
37782
|
+
let resolvedCliArgs = cliArgs;
|
|
37783
|
+
let resolvedLaunchMode = launchMode;
|
|
37784
|
+
const activeMode = provider?.launchModes?.length ? launchMode ? provider.launchModes.find((m) => m.id === launchMode) : provider.launchModes.find((m) => m.default) : void 0;
|
|
37785
|
+
if (activeMode) {
|
|
37786
|
+
resolvedLaunchMode = activeMode.id;
|
|
37787
|
+
}
|
|
37788
|
+
if (provider?.launchArgBuilder) {
|
|
37789
|
+
const defaults = {};
|
|
37790
|
+
for (const opt of provider.launchOptions || []) {
|
|
37791
|
+
if (opt.default !== void 0) defaults[opt.id] = opt.default;
|
|
37792
|
+
}
|
|
37793
|
+
const modeOptions = activeMode?.options || {};
|
|
37794
|
+
const userOptions = launchOptionValues || {};
|
|
37795
|
+
const merged = { ...defaults, ...modeOptions, ...userOptions };
|
|
37796
|
+
const extraArgs = provider.launchArgBuilder(merged);
|
|
37797
|
+
if (extraArgs.length) {
|
|
37798
|
+
resolvedCliArgs = [...cliArgs || [], ...extraArgs];
|
|
37799
|
+
console.log(colorize("cyan", ` \u{1F680} Launch options applied: ${extraArgs.join(" ")}`));
|
|
37800
|
+
}
|
|
37801
|
+
} else if (activeMode?.extraArgs?.length) {
|
|
37802
|
+
resolvedCliArgs = [...cliArgs || [], ...activeMode.extraArgs];
|
|
37803
|
+
console.log(colorize("cyan", ` \u{1F680} Launch mode '${activeMode.name}': appending args ${activeMode.extraArgs.join(" ")}`));
|
|
37804
|
+
}
|
|
37757
37805
|
const instanceManager = this.deps.getInstanceManager();
|
|
37758
37806
|
if (provider && instanceManager) {
|
|
37759
37807
|
const resolvedProvider = this.providerLoader.resolve(cliType, { version: cliInfo.version }) || provider;
|
|
@@ -37762,14 +37810,15 @@ ${installInfo}`
|
|
|
37762
37810
|
normalizedType,
|
|
37763
37811
|
cliType,
|
|
37764
37812
|
resolvedDir,
|
|
37765
|
-
|
|
37813
|
+
resolvedCliArgs,
|
|
37766
37814
|
resolvedProvider,
|
|
37767
37815
|
{},
|
|
37768
|
-
false
|
|
37816
|
+
false,
|
|
37817
|
+
resolvedLaunchMode
|
|
37769
37818
|
);
|
|
37770
37819
|
console.log(colorize("green", ` \u2713 CLI started: ${cliInfo.displayName} v${cliInfo.version || "unknown"} in ${resolvedDir}`));
|
|
37771
37820
|
} else {
|
|
37772
|
-
const adapter = this.createAdapter(cliType, resolvedDir,
|
|
37821
|
+
const adapter = this.createAdapter(cliType, resolvedDir, resolvedCliArgs, key, false);
|
|
37773
37822
|
try {
|
|
37774
37823
|
await adapter.spawn();
|
|
37775
37824
|
} catch (spawnErr) {
|
|
@@ -37877,7 +37926,8 @@ ${installInfo}`
|
|
|
37877
37926
|
record2.cliArgs,
|
|
37878
37927
|
resolvedProvider,
|
|
37879
37928
|
{},
|
|
37880
|
-
true
|
|
37929
|
+
true,
|
|
37930
|
+
record2.launchMode
|
|
37881
37931
|
);
|
|
37882
37932
|
restored += 1;
|
|
37883
37933
|
LOG.info("CLI", `\u267B Restored hosted runtime: ${record2.runtimeKey || record2.runtimeId} (${record2.displayName || record2.workspace})`);
|
|
@@ -37947,7 +37997,7 @@ ${installInfo}`
|
|
|
37947
37997
|
const dir = resolved.path;
|
|
37948
37998
|
const launchSource = resolved.source;
|
|
37949
37999
|
if (!cliType) throw new Error("cliType required");
|
|
37950
|
-
await this.startSession(cliType, dir, args?.cliArgs, args?.initialModel);
|
|
38000
|
+
await this.startSession(cliType, dir, args?.cliArgs, args?.initialModel, args?.launchMode, args?.launchOptionValues);
|
|
37951
38001
|
let newKey = null;
|
|
37952
38002
|
for (const [k, adapter] of this.adapters) {
|
|
37953
38003
|
if (adapter.cliType === cliType && adapter.workingDir === dir) {
|
|
@@ -45660,7 +45710,7 @@ var init_adhdev_daemon = __esm({
|
|
|
45660
45710
|
fs15 = __toESM(require("fs"));
|
|
45661
45711
|
path17 = __toESM(require("path"));
|
|
45662
45712
|
import_chalk2 = __toESM(require("chalk"));
|
|
45663
|
-
pkgVersion = "0.7.
|
|
45713
|
+
pkgVersion = "0.7.41";
|
|
45664
45714
|
if (pkgVersion === "unknown") {
|
|
45665
45715
|
try {
|
|
45666
45716
|
const possiblePaths = [
|