@adhdev/daemon-core 0.9.82-rc.408 → 0.9.82-rc.409
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 +49 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +49 -15
- package/dist/index.mjs.map +1 -1
- package/dist/providers/chat-message-normalization.d.ts +18 -0
- package/package.json +2 -2
- package/src/commands/chat-commands-write.ts +11 -0
- package/src/providers/chat-message-normalization.ts +53 -5
- package/src/providers/cli-provider-instance.ts +49 -8
package/dist/index.js
CHANGED
|
@@ -399,10 +399,10 @@ function readInjected(value) {
|
|
|
399
399
|
}
|
|
400
400
|
function getDaemonBuildInfo() {
|
|
401
401
|
if (cached) return cached;
|
|
402
|
-
const commit = readInjected(true ? "
|
|
403
|
-
const commitShort = readInjected(true ? "
|
|
404
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
405
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
402
|
+
const commit = readInjected(true ? "69cd9c459ec9efafe19a05f66899bb791d6e0561" : void 0) ?? "unknown";
|
|
403
|
+
const commitShort = readInjected(true ? "69cd9c45" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
404
|
+
const version = readInjected(true ? "0.9.82-rc.409" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
405
|
+
const builtAt = readInjected(true ? "2026-06-28T09:03:15.861Z" : void 0);
|
|
406
406
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
407
407
|
return cached;
|
|
408
408
|
}
|
|
@@ -13830,21 +13830,42 @@ function extractFinalSummaryFromMessages(messages, maxChars = DEFAULT_FINAL_SUMM
|
|
|
13830
13830
|
}
|
|
13831
13831
|
return "";
|
|
13832
13832
|
}
|
|
13833
|
-
function
|
|
13833
|
+
function readChatMessageTimestampMs(message) {
|
|
13834
13834
|
if (!message) return void 0;
|
|
13835
13835
|
const record = message;
|
|
13836
|
-
for (const value of [record.timestamp, record.createdAt, record.created_at, record.updatedAt, record.time]) {
|
|
13836
|
+
for (const value of [record.timestamp, record.createdAt, record.created_at, record.updatedAt, record.time, record.receivedAt]) {
|
|
13837
13837
|
if (typeof value === "number" && Number.isFinite(value)) {
|
|
13838
|
-
|
|
13839
|
-
return new Date(ms).toISOString();
|
|
13838
|
+
return value > 1e10 ? value : value * 1e3;
|
|
13840
13839
|
}
|
|
13841
13840
|
if (typeof value === "string" && value.trim()) {
|
|
13842
13841
|
const ms = new Date(value.trim()).getTime();
|
|
13843
|
-
if (Number.isFinite(ms)) return
|
|
13842
|
+
if (Number.isFinite(ms)) return ms;
|
|
13844
13843
|
}
|
|
13845
13844
|
}
|
|
13846
13845
|
return void 0;
|
|
13847
13846
|
}
|
|
13847
|
+
function readChatMessageTimestampIso(message) {
|
|
13848
|
+
const ms = readChatMessageTimestampMs(message);
|
|
13849
|
+
return typeof ms === "number" ? new Date(ms).toISOString() : void 0;
|
|
13850
|
+
}
|
|
13851
|
+
function extractFinalSummaryFromMessagesAfter(messages, minTimestampMs, maxChars = DEFAULT_FINAL_SUMMARY_MAX_CHARS) {
|
|
13852
|
+
if (!Array.isArray(messages) || messages.length === 0) return "";
|
|
13853
|
+
const hasBoundary = typeof minTimestampMs === "number" && Number.isFinite(minTimestampMs);
|
|
13854
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
13855
|
+
const msg = messages[i];
|
|
13856
|
+
if (!msg) continue;
|
|
13857
|
+
if (hasBoundary) {
|
|
13858
|
+
const ts2 = readChatMessageTimestampMs(msg);
|
|
13859
|
+
if (typeof ts2 === "number" && ts2 < minTimestampMs) continue;
|
|
13860
|
+
}
|
|
13861
|
+
const classification = classifyChatMessageVisibility(msg);
|
|
13862
|
+
if (classification.isUserFacing && (msg.role === "assistant" || msg.role === "model")) {
|
|
13863
|
+
const text = flattenContent(msg.content).trim();
|
|
13864
|
+
if (text) return text.slice(0, maxChars);
|
|
13865
|
+
}
|
|
13866
|
+
}
|
|
13867
|
+
return "";
|
|
13868
|
+
}
|
|
13848
13869
|
function extractFinalAssistantSummaryEvidence(messages, maxChars = DEFAULT_FINAL_SUMMARY_MAX_CHARS) {
|
|
13849
13870
|
if (!Array.isArray(messages) || messages.length === 0) return { finalSummary: "" };
|
|
13850
13871
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
@@ -32796,6 +32817,10 @@ async function handleResolveAction(h, args) {
|
|
|
32796
32817
|
const effectiveStatus = status?.status === "waiting_approval" || targetState?.activeChat?.status === "waiting_approval" || parsedStatus?.status === "waiting_approval" ? "waiting_approval" : status?.status;
|
|
32797
32818
|
LOG.info("Command", `[resolveAction] CLI PTY gate target=${String(args?.targetSessionId || "")} rawStatus=${String(status?.status || "")} effectiveStatus=${String(effectiveStatus || "")} statusModal=${statusModal ? "yes" : "no"} surfacedModal=${surfacedModal ? "yes" : "no"} parsedModal=${parsedModal ? "yes" : "no"} instance=${targetInstance ? "yes" : "no"}`);
|
|
32798
32819
|
if (!effectiveModal) {
|
|
32820
|
+
if (typeof adapter.isApprovalRecentlyResolved === "function" && adapter.isApprovalRecentlyResolved()) {
|
|
32821
|
+
LOG.info("Command", `[resolveAction] CLI PTY \u2192 already_resolved (modal gone, resolved within cooldown)`);
|
|
32822
|
+
return { success: true, alreadyResolved: true, status: "already_resolved" };
|
|
32823
|
+
}
|
|
32799
32824
|
return { success: false, error: "Not in approval state" };
|
|
32800
32825
|
}
|
|
32801
32826
|
const buttons = Array.isArray(effectiveModal.buttons) ? effectiveModal.buttons : [];
|
|
@@ -40817,14 +40842,14 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
40817
40842
|
source: "unavailable"
|
|
40818
40843
|
};
|
|
40819
40844
|
}
|
|
40820
|
-
completionFinalSummary(parsedMessages) {
|
|
40845
|
+
completionFinalSummary(parsedMessages, turnStartedAt) {
|
|
40821
40846
|
const adapterOwnsMessagesElsewhere = this.adapter?.chatMessagesOwnedExternally === true;
|
|
40822
40847
|
const parsedSummary = extractFinalSummaryFromMessages(
|
|
40823
40848
|
this.completionHasFinalAssistantMessage(parsedMessages) ? Array.isArray(parsedMessages) ? parsedMessages : [] : []
|
|
40824
40849
|
);
|
|
40825
40850
|
if (adapterOwnsMessagesElsewhere) {
|
|
40826
40851
|
const externalMessages = this.readExternalCompletionMessages();
|
|
40827
|
-
const externalSummary = externalMessages ?
|
|
40852
|
+
const externalSummary = externalMessages ? extractFinalSummaryFromMessagesAfter(externalMessages, turnStartedAt) : "";
|
|
40828
40853
|
if (externalSummary) return externalSummary;
|
|
40829
40854
|
return parsedSummary || void 0;
|
|
40830
40855
|
}
|
|
@@ -41111,7 +41136,7 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
41111
41136
|
// delegated session's inbox preview blank — or, for a LOCAL worktree session,
|
|
41112
41137
|
// stuck on the dispatched user task. If the parser DID surface assistant text,
|
|
41113
41138
|
// prefer it; only fall back to '' when no assistant summary can be derived.
|
|
41114
|
-
finalSummary: blockReason.startsWith("parsed_status:") ? this.completionFinalSummary(this.adapter?.getScriptParsedStatus()?.messages) ?? "" : this.completionFinalSummary(this.adapter?.getScriptParsedStatus()?.messages),
|
|
41139
|
+
finalSummary: blockReason.startsWith("parsed_status:") ? this.completionFinalSummary(this.adapter?.getScriptParsedStatus()?.messages, pending.turnStartedAt) ?? "" : this.completionFinalSummary(this.adapter?.getScriptParsedStatus()?.messages, pending.turnStartedAt),
|
|
41115
41140
|
completionDiagnostic
|
|
41116
41141
|
});
|
|
41117
41142
|
this.completedDebouncePending = null;
|
|
@@ -41131,7 +41156,7 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
41131
41156
|
timestamp: pending.timestamp,
|
|
41132
41157
|
// ARCH-REFACTOR R1: attribute to the turn captured at idle-transition.
|
|
41133
41158
|
...pending.taskId ? { taskId: pending.taskId } : {},
|
|
41134
|
-
finalSummary: this.completionFinalSummary(this.adapter?.getScriptParsedStatus()?.messages)
|
|
41159
|
+
finalSummary: this.completionFinalSummary(this.adapter?.getScriptParsedStatus()?.messages, pending.turnStartedAt)
|
|
41135
41160
|
});
|
|
41136
41161
|
this.completedDebouncePending = null;
|
|
41137
41162
|
this.completedDebounceTimer = null;
|
|
@@ -41247,7 +41272,7 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
41247
41272
|
*/
|
|
41248
41273
|
recheckAutoApproveSettled() {
|
|
41249
41274
|
try {
|
|
41250
|
-
const adapterStatus = this.adapter.getStatus({ allowParse:
|
|
41275
|
+
const adapterStatus = this.adapter.getStatus({ allowParse: true });
|
|
41251
41276
|
this.maybeAutoApproveStatus(adapterStatus, Date.now());
|
|
41252
41277
|
} catch {
|
|
41253
41278
|
}
|
|
@@ -41478,7 +41503,16 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
41478
41503
|
// ARCH-REFACTOR R1: snapshot the completing turn's taskId NOW (sync),
|
|
41479
41504
|
// before any follow-up task's flush can start a new turn and move
|
|
41480
41505
|
// engine.currentTurnTaskId.
|
|
41481
|
-
...this.completingTurnTaskId() ? { taskId: this.completingTurnTaskId() } : {}
|
|
41506
|
+
...this.completingTurnTaskId() ? { taskId: this.completingTurnTaskId() } : {},
|
|
41507
|
+
// NOTIF Defect-B: snapshot the producing turn's START instant NOW, for the
|
|
41508
|
+
// same reason as taskId — a follow-up turn moves engine.currentTurnStartedAt.
|
|
41509
|
+
// Prefer the engine's per-turn start (set at onTurnStarted, earliest reliable
|
|
41510
|
+
// anchor) and fall back to generatingStartedAt (when generating was observed).
|
|
41511
|
+
...(() => {
|
|
41512
|
+
const engineTurnStart = typeof this.adapter?.currentTurnStartedAt === "number" && Number.isFinite(this.adapter.currentTurnStartedAt) ? this.adapter.currentTurnStartedAt : 0;
|
|
41513
|
+
const turnStartedAt = engineTurnStart || this.generatingStartedAt || 0;
|
|
41514
|
+
return turnStartedAt ? { turnStartedAt } : {};
|
|
41515
|
+
})()
|
|
41482
41516
|
};
|
|
41483
41517
|
const ownsExternalHistory = !!this.adapter?.chatMessagesOwnedExternally;
|
|
41484
41518
|
const meshWorkerSession = this.isMeshWorkerSession();
|