adhdev 0.8.24 → 0.8.25
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 +96 -6
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +96 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4510,6 +4510,56 @@ var init_builders = __esm({
|
|
|
4510
4510
|
}
|
|
4511
4511
|
});
|
|
4512
4512
|
|
|
4513
|
+
// ../../oss/packages/daemon-core/src/sessions/reconcile.ts
|
|
4514
|
+
function upsertSessionTarget(sessionRegistry, target) {
|
|
4515
|
+
const existing = sessionRegistry.get(target.sessionId);
|
|
4516
|
+
if (existing && existing.parentSessionId === target.parentSessionId && existing.providerType === target.providerType && existing.transport === target.transport && existing.cdpManagerKey === target.cdpManagerKey && existing.instanceKey === target.instanceKey) {
|
|
4517
|
+
return;
|
|
4518
|
+
}
|
|
4519
|
+
sessionRegistry.register(target);
|
|
4520
|
+
}
|
|
4521
|
+
function reconcileIdeRuntimeSessions(instanceManager, sessionRegistry) {
|
|
4522
|
+
if (!instanceManager || !sessionRegistry) return;
|
|
4523
|
+
for (const instanceKey of instanceManager.listInstanceIds()) {
|
|
4524
|
+
if (!instanceKey.startsWith("ide:")) continue;
|
|
4525
|
+
const ideInstance = instanceManager.getInstance(instanceKey);
|
|
4526
|
+
if (!ideInstance || ideInstance.category !== "ide" || typeof ideInstance.getInstanceId !== "function") {
|
|
4527
|
+
continue;
|
|
4528
|
+
}
|
|
4529
|
+
const managerKey = instanceKey.slice(4);
|
|
4530
|
+
const ideType = typeof ideInstance.type === "string" && ideInstance.type.trim() ? ideInstance.type.trim() : managerKey.split("_")[0];
|
|
4531
|
+
const parentSessionId = ideInstance.getInstanceId();
|
|
4532
|
+
if (!parentSessionId) continue;
|
|
4533
|
+
upsertSessionTarget(sessionRegistry, {
|
|
4534
|
+
sessionId: parentSessionId,
|
|
4535
|
+
parentSessionId: null,
|
|
4536
|
+
providerType: ideType,
|
|
4537
|
+
transport: "cdp-page",
|
|
4538
|
+
cdpManagerKey: managerKey,
|
|
4539
|
+
instanceKey
|
|
4540
|
+
});
|
|
4541
|
+
const extensions = ideInstance.getExtensionInstances?.() || [];
|
|
4542
|
+
for (const ext of extensions) {
|
|
4543
|
+
const extType = typeof ext?.type === "string" ? ext.type.trim() : "";
|
|
4544
|
+
const extSessionId = ext?.getInstanceId?.();
|
|
4545
|
+
if (!extType || !extSessionId) continue;
|
|
4546
|
+
upsertSessionTarget(sessionRegistry, {
|
|
4547
|
+
sessionId: extSessionId,
|
|
4548
|
+
parentSessionId,
|
|
4549
|
+
providerType: extType,
|
|
4550
|
+
transport: "cdp-webview",
|
|
4551
|
+
cdpManagerKey: managerKey,
|
|
4552
|
+
instanceKey
|
|
4553
|
+
});
|
|
4554
|
+
}
|
|
4555
|
+
}
|
|
4556
|
+
}
|
|
4557
|
+
var init_reconcile = __esm({
|
|
4558
|
+
"../../oss/packages/daemon-core/src/sessions/reconcile.ts"() {
|
|
4559
|
+
"use strict";
|
|
4560
|
+
}
|
|
4561
|
+
});
|
|
4562
|
+
|
|
4513
4563
|
// ../../oss/packages/daemon-core/src/commands/chat-commands.ts
|
|
4514
4564
|
function getCurrentProviderType(h, fallback = "") {
|
|
4515
4565
|
return h.currentSession?.providerType || h.currentProviderType || fallback;
|
|
@@ -6166,6 +6216,7 @@ var init_handler = __esm({
|
|
|
6166
6216
|
init_devtools();
|
|
6167
6217
|
init_builders();
|
|
6168
6218
|
init_chat_history();
|
|
6219
|
+
init_reconcile();
|
|
6169
6220
|
init_logger();
|
|
6170
6221
|
init_chat_commands();
|
|
6171
6222
|
init_cdp_commands();
|
|
@@ -6300,17 +6351,27 @@ var init_handler = __esm({
|
|
|
6300
6351
|
return key.split("_")[0];
|
|
6301
6352
|
}
|
|
6302
6353
|
resolveRoute(args) {
|
|
6303
|
-
const
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6354
|
+
const targetSessionId = typeof args?.targetSessionId === "string" ? args.targetSessionId.trim() : "";
|
|
6355
|
+
let session = targetSessionId ? this._ctx.sessionRegistry?.get(targetSessionId) : void 0;
|
|
6356
|
+
if (targetSessionId && !session) {
|
|
6357
|
+
reconcileIdeRuntimeSessions(this._ctx.instanceManager, this._ctx.sessionRegistry);
|
|
6358
|
+
session = this._ctx.sessionRegistry?.get(targetSessionId);
|
|
6359
|
+
}
|
|
6360
|
+
const sessionLookupFailed = !!targetSessionId && !session;
|
|
6361
|
+
const managerKey = this.extractIdeType(args, sessionLookupFailed);
|
|
6362
|
+
let providerType;
|
|
6363
|
+
if (!sessionLookupFailed) {
|
|
6364
|
+
providerType = session?.providerType || args?.agentType || args?.providerType || this.inferProviderType(managerKey);
|
|
6365
|
+
}
|
|
6366
|
+
return { session, managerKey, providerType, sessionLookupFailed };
|
|
6307
6367
|
}
|
|
6308
6368
|
/** Extract CDP scope key from target session or explicit ideType */
|
|
6309
|
-
extractIdeType(args) {
|
|
6369
|
+
extractIdeType(args, sessionLookupFailed = false) {
|
|
6310
6370
|
if (args?.targetSessionId) {
|
|
6311
6371
|
const target = this._ctx.sessionRegistry?.get(args.targetSessionId);
|
|
6312
6372
|
if (target?.cdpManagerKey) return target.cdpManagerKey;
|
|
6313
6373
|
if (this._ctx.cdpManagers.has(args.targetSessionId)) return args.targetSessionId;
|
|
6374
|
+
if (sessionLookupFailed) return void 0;
|
|
6314
6375
|
}
|
|
6315
6376
|
if (args?.ideType) {
|
|
6316
6377
|
const target = this._ctx.sessionRegistry?.get(args.ideType);
|
|
@@ -6357,6 +6418,33 @@ var init_handler = __esm({
|
|
|
6357
6418
|
this._currentRoute = this.resolveRoute(args);
|
|
6358
6419
|
const startedAt = Date.now();
|
|
6359
6420
|
this.logCommandStart(cmd, args);
|
|
6421
|
+
const sessionScopedCommands = /* @__PURE__ */ new Set([
|
|
6422
|
+
"read_chat",
|
|
6423
|
+
"send_chat",
|
|
6424
|
+
"list_chats",
|
|
6425
|
+
"new_chat",
|
|
6426
|
+
"switch_chat",
|
|
6427
|
+
"set_mode",
|
|
6428
|
+
"change_model",
|
|
6429
|
+
"set_thought_level",
|
|
6430
|
+
"resolve_action",
|
|
6431
|
+
"focus_session",
|
|
6432
|
+
"pty_input",
|
|
6433
|
+
"pty_resize",
|
|
6434
|
+
"invoke_provider_script",
|
|
6435
|
+
"list_extension_models",
|
|
6436
|
+
"set_extension_model",
|
|
6437
|
+
"list_extension_modes",
|
|
6438
|
+
"set_extension_mode"
|
|
6439
|
+
]);
|
|
6440
|
+
if (this._currentRoute.sessionLookupFailed && sessionScopedCommands.has(cmd)) {
|
|
6441
|
+
const result2 = {
|
|
6442
|
+
success: false,
|
|
6443
|
+
error: `Live session not found for targetSessionId: ${String(args?.targetSessionId || "").trim() || "unknown"}`
|
|
6444
|
+
};
|
|
6445
|
+
this.logCommandEnd(cmd, result2, startedAt);
|
|
6446
|
+
return result2;
|
|
6447
|
+
}
|
|
6360
6448
|
let result;
|
|
6361
6449
|
if (!this._currentRoute.session && !this._currentRoute.managerKey && !this._currentRoute.providerType) {
|
|
6362
6450
|
const cdpCommands = ["send_chat", "read_chat", "list_chats", "new_chat", "switch_chat", "set_mode", "change_model", "set_thought_level", "resolve_action"];
|
|
@@ -32415,6 +32503,7 @@ var init_poller = __esm({
|
|
|
32415
32503
|
"../../oss/packages/daemon-core/src/agent-stream/poller.ts"() {
|
|
32416
32504
|
"use strict";
|
|
32417
32505
|
init_setup();
|
|
32506
|
+
init_reconcile();
|
|
32418
32507
|
init_logger();
|
|
32419
32508
|
AgentStreamPoller = class {
|
|
32420
32509
|
deps;
|
|
@@ -32454,6 +32543,7 @@ var init_poller = __esm({
|
|
|
32454
32543
|
sessionRegistry
|
|
32455
32544
|
} = this.deps;
|
|
32456
32545
|
if (!agentStreamManager || cdpManagers.size === 0) return;
|
|
32546
|
+
reconcileIdeRuntimeSessions(instanceManager, sessionRegistry);
|
|
32457
32547
|
for (const [ideType, cdp] of cdpManagers) {
|
|
32458
32548
|
registerExtensionProviders(providerLoader, cdp, ideType);
|
|
32459
32549
|
const ideInstance = instanceManager.getInstance(`ide:${ideType}`);
|
|
@@ -47268,7 +47358,7 @@ var init_adhdev_daemon = __esm({
|
|
|
47268
47358
|
import_ws3 = require("ws");
|
|
47269
47359
|
import_chalk2 = __toESM(require("chalk"));
|
|
47270
47360
|
init_version();
|
|
47271
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.
|
|
47361
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.25" });
|
|
47272
47362
|
DANGEROUS_PATTERNS = [
|
|
47273
47363
|
/\brm\s+(-[a-z]*f|-[a-z]*r|--force|--recursive)/i,
|
|
47274
47364
|
/\bsudo\b/i,
|