@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.js
CHANGED
|
@@ -11914,6 +11914,7 @@ function buildSessionModalDeliverySignature(payload) {
|
|
|
11914
11914
|
// src/commands/chat-commands.ts
|
|
11915
11915
|
var RECENT_SEND_WINDOW_MS = 1200;
|
|
11916
11916
|
var READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS = 25e3;
|
|
11917
|
+
var HERMES_CLI_STARTING_SEND_SETTLE_MS = 2e3;
|
|
11917
11918
|
var recentSendByTarget = /* @__PURE__ */ new Map();
|
|
11918
11919
|
function getCurrentProviderType(h, fallback = "") {
|
|
11919
11920
|
return h.currentSession?.providerType || h.currentProviderType || fallback;
|
|
@@ -11966,6 +11967,16 @@ function buildSendInputSignature(input) {
|
|
|
11966
11967
|
function getSendChatInputEnvelope(args) {
|
|
11967
11968
|
return normalizeInputEnvelope(args?.input ? { input: args.input } : args);
|
|
11968
11969
|
}
|
|
11970
|
+
function sleep(ms) {
|
|
11971
|
+
return new Promise((resolve16) => setTimeout(resolve16, ms));
|
|
11972
|
+
}
|
|
11973
|
+
async function waitOnceForFreshHermesCliStart(adapter, log) {
|
|
11974
|
+
if (adapter.cliType !== "hermes-cli") return;
|
|
11975
|
+
const status = typeof adapter.getStatus === "function" ? adapter.getStatus()?.status : void 0;
|
|
11976
|
+
if (status !== "starting") return;
|
|
11977
|
+
log(`Hermes CLI is still starting; waiting ${HERMES_CLI_STARTING_SEND_SETTLE_MS}ms before first send`);
|
|
11978
|
+
await sleep(HERMES_CLI_STARTING_SEND_SETTLE_MS);
|
|
11979
|
+
}
|
|
11969
11980
|
function getHistorySessionId(h, args) {
|
|
11970
11981
|
const explicit = typeof args?.historySessionId === "string" ? args.historySessionId.trim() : "";
|
|
11971
11982
|
if (explicit) return explicit;
|
|
@@ -12825,6 +12836,7 @@ async function handleSendChat(h, args) {
|
|
|
12825
12836
|
try {
|
|
12826
12837
|
assertTextOnlyInput(provider, input);
|
|
12827
12838
|
if (!text) return { success: false, error: "text required for PTY send" };
|
|
12839
|
+
await waitOnceForFreshHermesCliStart(adapter, _log);
|
|
12828
12840
|
await adapter.sendMessage(text);
|
|
12829
12841
|
return _logSendSuccess(`${transport}-adapter`, adapter.cliType);
|
|
12830
12842
|
} catch (e) {
|
|
@@ -15752,8 +15764,6 @@ ${effect.notification.body || ""}`.trim();
|
|
|
15752
15764
|
const aTime = getTime(a.message);
|
|
15753
15765
|
const bTime = getTime(b.message);
|
|
15754
15766
|
if (aTime && bTime && aTime !== bTime) return aTime - bTime;
|
|
15755
|
-
if (aTime && !bTime && a.source === "runtime" && b.source === "parsed") return -1;
|
|
15756
|
-
if (!aTime && bTime && a.source === "parsed" && b.source === "runtime") return 1;
|
|
15757
15767
|
return a.index - b.index;
|
|
15758
15768
|
}).map((entry) => entry.message));
|
|
15759
15769
|
}
|
|
@@ -26106,7 +26116,7 @@ function getCliTargetBundle(ctx, type, instanceId) {
|
|
|
26106
26116
|
if (!adapter) return null;
|
|
26107
26117
|
return { target, instance, adapter };
|
|
26108
26118
|
}
|
|
26109
|
-
function
|
|
26119
|
+
function sleep2(ms) {
|
|
26110
26120
|
return new Promise((resolve16) => setTimeout(resolve16, ms));
|
|
26111
26121
|
}
|
|
26112
26122
|
async function waitForCliReady(ctx, type, instanceId, timeoutMs) {
|
|
@@ -26123,7 +26133,7 @@ async function waitForCliReady(ctx, type, instanceId, timeoutMs) {
|
|
|
26123
26133
|
return bundle;
|
|
26124
26134
|
}
|
|
26125
26135
|
}
|
|
26126
|
-
await
|
|
26136
|
+
await sleep2(100);
|
|
26127
26137
|
}
|
|
26128
26138
|
return getCliTargetBundle(ctx, type, instanceId);
|
|
26129
26139
|
}
|
|
@@ -26179,7 +26189,7 @@ async function runCliExerciseInternal(ctx, body) {
|
|
|
26179
26189
|
const message = String(lastLaunchError.message || "");
|
|
26180
26190
|
const retryable = /ECONNREFUSED|session-host|Session host/i.test(message);
|
|
26181
26191
|
if (!retryable || attempt === 2) break;
|
|
26182
|
-
await
|
|
26192
|
+
await sleep2(1e3);
|
|
26183
26193
|
}
|
|
26184
26194
|
}
|
|
26185
26195
|
if (!launched) {
|
|
@@ -26242,16 +26252,16 @@ async function runCliExerciseInternal(ctx, body) {
|
|
|
26242
26252
|
const modal = debug?.activeModal || trace?.activeModal || null;
|
|
26243
26253
|
noteStatus(status);
|
|
26244
26254
|
if (resolveActiveModalIfNeeded(status, modal)) {
|
|
26245
|
-
await
|
|
26255
|
+
await sleep2(150);
|
|
26246
26256
|
continue;
|
|
26247
26257
|
}
|
|
26248
26258
|
const startupParseGate = !!debug?.startupParseGate;
|
|
26249
26259
|
if (status === "idle" && !startupParseGate) break;
|
|
26250
|
-
await
|
|
26260
|
+
await sleep2(150);
|
|
26251
26261
|
}
|
|
26252
26262
|
ctx.instanceManager.sendEvent(bundle.target.instanceId, "send_message", { text });
|
|
26253
26263
|
while (Date.now() - startAt < Math.max(1e3, timeoutMs)) {
|
|
26254
|
-
await
|
|
26264
|
+
await sleep2(150);
|
|
26255
26265
|
bundle = getCliTargetBundle(ctx, type, bundle.target.instanceId);
|
|
26256
26266
|
if (!bundle) {
|
|
26257
26267
|
throw new Error("CLI instance disappeared during exercise");
|