@adhdev/daemon-core 0.9.76-rc.50 → 0.9.76-rc.51
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/index.js +18 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/commands/chat-commands.ts +15 -0
- package/src/providers/cli-provider-instance.ts +5 -2
package/dist/index.mjs
CHANGED
|
@@ -11718,6 +11718,7 @@ function buildSessionModalDeliverySignature(payload) {
|
|
|
11718
11718
|
// src/commands/chat-commands.ts
|
|
11719
11719
|
var RECENT_SEND_WINDOW_MS = 1200;
|
|
11720
11720
|
var READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS = 25e3;
|
|
11721
|
+
var HERMES_CLI_STARTING_SEND_SETTLE_MS = 2e3;
|
|
11721
11722
|
var recentSendByTarget = /* @__PURE__ */ new Map();
|
|
11722
11723
|
function getCurrentProviderType(h, fallback = "") {
|
|
11723
11724
|
return h.currentSession?.providerType || h.currentProviderType || fallback;
|
|
@@ -11770,6 +11771,16 @@ function buildSendInputSignature(input) {
|
|
|
11770
11771
|
function getSendChatInputEnvelope(args) {
|
|
11771
11772
|
return normalizeInputEnvelope(args?.input ? { input: args.input } : args);
|
|
11772
11773
|
}
|
|
11774
|
+
function sleep(ms) {
|
|
11775
|
+
return new Promise((resolve16) => setTimeout(resolve16, ms));
|
|
11776
|
+
}
|
|
11777
|
+
async function waitOnceForFreshHermesCliStart(adapter, log) {
|
|
11778
|
+
if (adapter.cliType !== "hermes-cli") return;
|
|
11779
|
+
const status = typeof adapter.getStatus === "function" ? adapter.getStatus()?.status : void 0;
|
|
11780
|
+
if (status !== "starting") return;
|
|
11781
|
+
log(`Hermes CLI is still starting; waiting ${HERMES_CLI_STARTING_SEND_SETTLE_MS}ms before first send`);
|
|
11782
|
+
await sleep(HERMES_CLI_STARTING_SEND_SETTLE_MS);
|
|
11783
|
+
}
|
|
11773
11784
|
function getHistorySessionId(h, args) {
|
|
11774
11785
|
const explicit = typeof args?.historySessionId === "string" ? args.historySessionId.trim() : "";
|
|
11775
11786
|
if (explicit) return explicit;
|
|
@@ -12629,6 +12640,7 @@ async function handleSendChat(h, args) {
|
|
|
12629
12640
|
try {
|
|
12630
12641
|
assertTextOnlyInput(provider, input);
|
|
12631
12642
|
if (!text) return { success: false, error: "text required for PTY send" };
|
|
12643
|
+
await waitOnceForFreshHermesCliStart(adapter, _log);
|
|
12632
12644
|
await adapter.sendMessage(text);
|
|
12633
12645
|
return _logSendSuccess(`${transport}-adapter`, adapter.cliType);
|
|
12634
12646
|
} catch (e) {
|
|
@@ -15556,8 +15568,6 @@ ${effect.notification.body || ""}`.trim();
|
|
|
15556
15568
|
const aTime = getTime(a.message);
|
|
15557
15569
|
const bTime = getTime(b.message);
|
|
15558
15570
|
if (aTime && bTime && aTime !== bTime) return aTime - bTime;
|
|
15559
|
-
if (aTime && !bTime && a.source === "runtime" && b.source === "parsed") return -1;
|
|
15560
|
-
if (!aTime && bTime && a.source === "parsed" && b.source === "runtime") return 1;
|
|
15561
15571
|
return a.index - b.index;
|
|
15562
15572
|
}).map((entry) => entry.message));
|
|
15563
15573
|
}
|
|
@@ -25915,7 +25925,7 @@ function getCliTargetBundle(ctx, type, instanceId) {
|
|
|
25915
25925
|
if (!adapter) return null;
|
|
25916
25926
|
return { target, instance, adapter };
|
|
25917
25927
|
}
|
|
25918
|
-
function
|
|
25928
|
+
function sleep2(ms) {
|
|
25919
25929
|
return new Promise((resolve16) => setTimeout(resolve16, ms));
|
|
25920
25930
|
}
|
|
25921
25931
|
async function waitForCliReady(ctx, type, instanceId, timeoutMs) {
|
|
@@ -25932,7 +25942,7 @@ async function waitForCliReady(ctx, type, instanceId, timeoutMs) {
|
|
|
25932
25942
|
return bundle;
|
|
25933
25943
|
}
|
|
25934
25944
|
}
|
|
25935
|
-
await
|
|
25945
|
+
await sleep2(100);
|
|
25936
25946
|
}
|
|
25937
25947
|
return getCliTargetBundle(ctx, type, instanceId);
|
|
25938
25948
|
}
|
|
@@ -25988,7 +25998,7 @@ async function runCliExerciseInternal(ctx, body) {
|
|
|
25988
25998
|
const message = String(lastLaunchError.message || "");
|
|
25989
25999
|
const retryable = /ECONNREFUSED|session-host|Session host/i.test(message);
|
|
25990
26000
|
if (!retryable || attempt === 2) break;
|
|
25991
|
-
await
|
|
26001
|
+
await sleep2(1e3);
|
|
25992
26002
|
}
|
|
25993
26003
|
}
|
|
25994
26004
|
if (!launched) {
|
|
@@ -26051,16 +26061,16 @@ async function runCliExerciseInternal(ctx, body) {
|
|
|
26051
26061
|
const modal = debug?.activeModal || trace?.activeModal || null;
|
|
26052
26062
|
noteStatus(status);
|
|
26053
26063
|
if (resolveActiveModalIfNeeded(status, modal)) {
|
|
26054
|
-
await
|
|
26064
|
+
await sleep2(150);
|
|
26055
26065
|
continue;
|
|
26056
26066
|
}
|
|
26057
26067
|
const startupParseGate = !!debug?.startupParseGate;
|
|
26058
26068
|
if (status === "idle" && !startupParseGate) break;
|
|
26059
|
-
await
|
|
26069
|
+
await sleep2(150);
|
|
26060
26070
|
}
|
|
26061
26071
|
ctx.instanceManager.sendEvent(bundle.target.instanceId, "send_message", { text });
|
|
26062
26072
|
while (Date.now() - startAt < Math.max(1e3, timeoutMs)) {
|
|
26063
|
-
await
|
|
26073
|
+
await sleep2(150);
|
|
26064
26074
|
bundle = getCliTargetBundle(ctx, type, bundle.target.instanceId);
|
|
26065
26075
|
if (!bundle) {
|
|
26066
26076
|
throw new Error("CLI instance disappeared during exercise");
|