@adhdev/daemon-standalone 0.9.34 → 0.9.35
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 +64 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/{index-4TARDjk2.js → index-B8qTNoOd.js} +4 -4
- package/public/index.html +1 -1
- package/vendor/session-host-daemon/index.js +8 -1
- package/vendor/session-host-daemon/index.js.map +1 -1
- package/vendor/session-host-daemon/index.mjs +8 -1
- package/vendor/session-host-daemon/index.mjs.map +1 -1
package/dist/index.js
CHANGED
|
@@ -29954,6 +29954,8 @@ var require_dist2 = __commonJS({
|
|
|
29954
29954
|
messages = [];
|
|
29955
29955
|
committedMessages = [];
|
|
29956
29956
|
structuredMessages = [];
|
|
29957
|
+
committedMessagesActivitySignature = "";
|
|
29958
|
+
committedMessagesChangedAt = 0;
|
|
29957
29959
|
currentStatus = "starting";
|
|
29958
29960
|
onStatusChange = null;
|
|
29959
29961
|
responseBuffer = "";
|
|
@@ -30035,10 +30037,35 @@ var require_dist2 = __commonJS({
|
|
|
30035
30037
|
providerResolutionMeta;
|
|
30036
30038
|
static FINISH_RETRY_DELAY_MS = 300;
|
|
30037
30039
|
static MAX_FINISH_RETRIES = 2;
|
|
30040
|
+
buildCommittedMessagesActivitySignature() {
|
|
30041
|
+
const last = this.committedMessages[this.committedMessages.length - 1];
|
|
30042
|
+
return [
|
|
30043
|
+
String(this.committedMessages.length),
|
|
30044
|
+
String(last?.role || ""),
|
|
30045
|
+
String(last?.kind || ""),
|
|
30046
|
+
String(last?.senderName || ""),
|
|
30047
|
+
String(last?.timestamp || ""),
|
|
30048
|
+
String(last?.receivedAt || ""),
|
|
30049
|
+
normalizeComparableMessageContent(last?.content || "").slice(-240)
|
|
30050
|
+
].join("|");
|
|
30051
|
+
}
|
|
30038
30052
|
syncMessageViews() {
|
|
30053
|
+
const signature = this.buildCommittedMessagesActivitySignature();
|
|
30054
|
+
if (signature !== this.committedMessagesActivitySignature) {
|
|
30055
|
+
this.committedMessagesActivitySignature = signature;
|
|
30056
|
+
this.committedMessagesChangedAt = Date.now();
|
|
30057
|
+
}
|
|
30039
30058
|
this.messages = [...this.committedMessages];
|
|
30040
30059
|
this.structuredMessages = [...this.committedMessages];
|
|
30041
30060
|
}
|
|
30061
|
+
getLastCommittedMessageActivityAt() {
|
|
30062
|
+
const last = this.committedMessages[this.committedMessages.length - 1];
|
|
30063
|
+
const messageTime = Math.max(
|
|
30064
|
+
typeof last?.receivedAt === "number" && Number.isFinite(last.receivedAt) ? last.receivedAt : 0,
|
|
30065
|
+
typeof last?.timestamp === "number" && Number.isFinite(last.timestamp) ? last.timestamp : 0
|
|
30066
|
+
);
|
|
30067
|
+
return Math.max(messageTime, this.committedMessagesChangedAt || 0);
|
|
30068
|
+
}
|
|
30042
30069
|
readTerminalScreenText(now = Date.now()) {
|
|
30043
30070
|
const screenText = this.terminalScreen.getText() || "";
|
|
30044
30071
|
this.lastScreenText = screenText;
|
|
@@ -30178,9 +30205,16 @@ var require_dist2 = __commonJS({
|
|
|
30178
30205
|
/** Inject CLI scripts after construction (e.g. when resolved by ProviderLoader) */
|
|
30179
30206
|
setCliScripts(scripts) {
|
|
30180
30207
|
this.cliScripts = scripts;
|
|
30208
|
+
this.parsedStatusCache = null;
|
|
30209
|
+
this.parseErrorMessage = null;
|
|
30181
30210
|
const scriptNames = listCliScriptNames(scripts);
|
|
30182
30211
|
LOG2.info("CLI", `[${this.cliType}] CLI scripts injected: [${scriptNames.join(", ")}]`);
|
|
30183
30212
|
}
|
|
30213
|
+
/** Refresh provider scripts/config used by this adapter without restarting the PTY runtime. */
|
|
30214
|
+
refreshProviderDefinition(provider) {
|
|
30215
|
+
this.provider = provider;
|
|
30216
|
+
this.setCliScripts(provider.scripts || {});
|
|
30217
|
+
}
|
|
30184
30218
|
updateRuntimeSettings(settings) {
|
|
30185
30219
|
this.runtimeSettings = { ...settings };
|
|
30186
30220
|
}
|
|
@@ -40747,7 +40781,14 @@ ${effect.notification.body || ""}`.trim();
|
|
|
40747
40781
|
await this._ctx.providerLoader.fetchLatest().catch(() => {
|
|
40748
40782
|
});
|
|
40749
40783
|
this._ctx.providerLoader.reload();
|
|
40750
|
-
|
|
40784
|
+
this._ctx.providerLoader.registerToDetector();
|
|
40785
|
+
const refreshedInstances = this._ctx.instanceManager ? this._ctx.instanceManager.refreshProviderDefinitions((providerType) => this._ctx.providerLoader.resolve(providerType)) : 0;
|
|
40786
|
+
const providers = this._ctx.providerLoader.getAll().map((provider) => ({
|
|
40787
|
+
type: provider.type,
|
|
40788
|
+
name: provider.name,
|
|
40789
|
+
category: provider.category
|
|
40790
|
+
}));
|
|
40791
|
+
return { success: true, refreshedInstances, providers };
|
|
40751
40792
|
}
|
|
40752
40793
|
return { success: false, error: "ProviderLoader not initialized" };
|
|
40753
40794
|
}
|
|
@@ -40994,6 +41035,11 @@ ${effect.notification.body || ""}`.trim();
|
|
|
40994
41035
|
launchMode;
|
|
40995
41036
|
startedAt = Date.now();
|
|
40996
41037
|
onProviderSessionResolved;
|
|
41038
|
+
refreshProviderDefinition(provider) {
|
|
41039
|
+
if (provider.type !== this.type || provider.category !== "cli") return;
|
|
41040
|
+
this.provider = provider;
|
|
41041
|
+
this.adapter.refreshProviderDefinition(provider);
|
|
41042
|
+
}
|
|
40997
41043
|
// ─── Lifecycle ─────────────────────────────────
|
|
40998
41044
|
async init(context) {
|
|
40999
41045
|
this.context = context;
|
|
@@ -41204,9 +41250,11 @@ ${effect.notification.body || ""}`.trim();
|
|
|
41204
41250
|
const autoApproveActive = adapterStatus.status === "waiting_approval" && this.shouldAutoApprove();
|
|
41205
41251
|
const visibleStatus = autoApproveActive ? "generating" : adapterStatus.status;
|
|
41206
41252
|
const runtime = this.adapter.getRuntimeMetadata();
|
|
41253
|
+
const lastCommittedMessageActivityAt = typeof this.adapter.getLastCommittedMessageActivityAt === "function" ? this.adapter.getLastCommittedMessageActivityAt() : 0;
|
|
41207
41254
|
return {
|
|
41208
41255
|
id: this.instanceId,
|
|
41209
41256
|
status: visibleStatus,
|
|
41257
|
+
lastMessageAt: lastCommittedMessageActivityAt || void 0,
|
|
41210
41258
|
runtimeLifecycle: runtime?.lifecycle ?? null,
|
|
41211
41259
|
runtimeSurfaceKind: runtime?.surfaceKind,
|
|
41212
41260
|
runtimeRestoredFromStorage: runtime?.restoredFromStorage === true,
|
|
@@ -48643,6 +48691,9 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
48643
48691
|
const project = (item) => ({
|
|
48644
48692
|
id: item.instanceId,
|
|
48645
48693
|
status: item.activeChat?.status || item.status,
|
|
48694
|
+
unread: item.unread,
|
|
48695
|
+
inboxBucket: item.inboxBucket,
|
|
48696
|
+
lastMessageAt: item.lastMessageAt ?? item.activeChat?.lastMessageAt,
|
|
48646
48697
|
runtimeLifecycle: item.runtime?.lifecycle ?? null,
|
|
48647
48698
|
runtimeSurfaceKind: item.runtime?.surfaceKind,
|
|
48648
48699
|
runtimeRestoredFromStorage: item.runtime?.restoredFromStorage === true,
|
|
@@ -48850,6 +48901,17 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
48850
48901
|
}
|
|
48851
48902
|
return updated;
|
|
48852
48903
|
}
|
|
48904
|
+
refreshProviderDefinitions(resolveProvider) {
|
|
48905
|
+
let refreshed = 0;
|
|
48906
|
+
for (const instance of this.instances.values()) {
|
|
48907
|
+
if (typeof instance.refreshProviderDefinition !== "function") continue;
|
|
48908
|
+
const provider = resolveProvider(instance.type);
|
|
48909
|
+
if (!provider || typeof provider !== "object") continue;
|
|
48910
|
+
instance.refreshProviderDefinition(provider);
|
|
48911
|
+
refreshed += 1;
|
|
48912
|
+
}
|
|
48913
|
+
return refreshed;
|
|
48914
|
+
}
|
|
48853
48915
|
// ─── cleanup ──────────────────────────────────────
|
|
48854
48916
|
/**
|
|
48855
48917
|
* All terminate
|
|
@@ -53076,20 +53138,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
53076
53138
|
async handleReload(_req, res) {
|
|
53077
53139
|
try {
|
|
53078
53140
|
this.providerLoader.reload();
|
|
53079
|
-
|
|
53080
|
-
if (this.instanceManager) {
|
|
53081
|
-
for (const id of this.instanceManager.listInstanceIds()) {
|
|
53082
|
-
const instance = this.instanceManager.getInstance(id);
|
|
53083
|
-
const providerType = typeof instance?.type === "string" ? instance.type : "";
|
|
53084
|
-
if (!providerType) continue;
|
|
53085
|
-
const resolved = this.providerLoader.resolve(providerType);
|
|
53086
|
-
if (!resolved) continue;
|
|
53087
|
-
if (instance && typeof instance === "object" && "provider" in instance) {
|
|
53088
|
-
instance.provider = resolved;
|
|
53089
|
-
refreshedInstances += 1;
|
|
53090
|
-
}
|
|
53091
|
-
}
|
|
53092
|
-
}
|
|
53141
|
+
const refreshedInstances = this.instanceManager ? this.instanceManager.refreshProviderDefinitions((providerType) => this.providerLoader.resolve(providerType)) : 0;
|
|
53093
53142
|
const providers = this.providerLoader.getAll().map((p) => ({
|
|
53094
53143
|
type: p.type,
|
|
53095
53144
|
name: p.name,
|