@adhdev/daemon-standalone 0.9.82-rc.174 → 0.9.82-rc.175
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 +86 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -62374,6 +62374,18 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
62374
62374
|
init_loader();
|
|
62375
62375
|
var STARTUP_GRACE_MS = 2500;
|
|
62376
62376
|
var BUSY_HOLD_MS = 6e3;
|
|
62377
|
+
var SUBMIT_DELAY_FLOOR_MS = 200;
|
|
62378
|
+
function countNewlines(s) {
|
|
62379
|
+
let n = 0;
|
|
62380
|
+
for (let i = 0; i < s.length; i += 1) if (s.charCodeAt(i) === 10) n += 1;
|
|
62381
|
+
return n;
|
|
62382
|
+
}
|
|
62383
|
+
function resolveSubmitDelayMs(specBeforeSubmit, text) {
|
|
62384
|
+
const lines = countNewlines(text);
|
|
62385
|
+
const linesBonus = Math.min(800, lines * 80);
|
|
62386
|
+
const spec = typeof specBeforeSubmit === "number" && specBeforeSubmit > 0 ? specBeforeSubmit : 0;
|
|
62387
|
+
return Math.max(spec, SUBMIT_DELAY_FLOOR_MS + linesBonus);
|
|
62388
|
+
}
|
|
62377
62389
|
var SpecDriver = class {
|
|
62378
62390
|
constructor(opts) {
|
|
62379
62391
|
this.opts = opts;
|
|
@@ -62601,7 +62613,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
62601
62613
|
actuallySendMessage(text) {
|
|
62602
62614
|
const sm = this.spec.send_message;
|
|
62603
62615
|
const perChar = sm.delay_ms_per_char ?? 0;
|
|
62604
|
-
const beforeSubmit = sm.delay_ms_before_submit
|
|
62616
|
+
const beforeSubmit = resolveSubmitDelayMs(sm.delay_ms_before_submit, text);
|
|
62605
62617
|
if (perChar === 0) {
|
|
62606
62618
|
this.adapter.send_keys(text);
|
|
62607
62619
|
if (beforeSubmit > 0) setTimeout(() => this.adapter.send_keys(sm.submit_key), beforeSubmit);
|
|
@@ -63741,6 +63753,50 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
63741
63753
|
if (looksLikeActiveApprovalPromptText(content)) return false;
|
|
63742
63754
|
return true;
|
|
63743
63755
|
}
|
|
63756
|
+
readExternalCompletionMessages() {
|
|
63757
|
+
const adapterOwnsMessagesElsewhere = this.adapter?.chatMessagesOwnedExternally === true;
|
|
63758
|
+
if (!adapterOwnsMessagesElsewhere) return null;
|
|
63759
|
+
if (!this.providerSessionId) return null;
|
|
63760
|
+
if (!isNativeSourceCanonicalHistory(this.provider.nativeHistory)) return null;
|
|
63761
|
+
const restoredHistory = readProviderChatHistory(this.type, {
|
|
63762
|
+
canonicalHistory: this.provider.nativeHistory,
|
|
63763
|
+
historySessionId: this.providerSessionId,
|
|
63764
|
+
workspace: this.workingDir,
|
|
63765
|
+
offset: 0,
|
|
63766
|
+
limit: Number.MAX_SAFE_INTEGER,
|
|
63767
|
+
historyBehavior: this.provider.historyBehavior,
|
|
63768
|
+
scripts: this.provider.scripts,
|
|
63769
|
+
sessionStartedAtMs: this.startedAt
|
|
63770
|
+
});
|
|
63771
|
+
if (restoredHistory.source !== "provider-native") return null;
|
|
63772
|
+
return restoredHistory.messages;
|
|
63773
|
+
}
|
|
63774
|
+
completionFinalAssistantEvidence(parsedMessages) {
|
|
63775
|
+
if (this.completionHasFinalAssistantMessage(parsedMessages)) {
|
|
63776
|
+
return {
|
|
63777
|
+
present: true,
|
|
63778
|
+
messages: Array.isArray(parsedMessages) ? parsedMessages : [],
|
|
63779
|
+
source: "parsed"
|
|
63780
|
+
};
|
|
63781
|
+
}
|
|
63782
|
+
const externalMessages = this.readExternalCompletionMessages();
|
|
63783
|
+
if (externalMessages) {
|
|
63784
|
+
return {
|
|
63785
|
+
present: this.completionHasFinalAssistantMessage(externalMessages),
|
|
63786
|
+
messages: externalMessages,
|
|
63787
|
+
source: "external-native"
|
|
63788
|
+
};
|
|
63789
|
+
}
|
|
63790
|
+
return {
|
|
63791
|
+
present: false,
|
|
63792
|
+
messages: Array.isArray(parsedMessages) ? parsedMessages : [],
|
|
63793
|
+
source: "unavailable"
|
|
63794
|
+
};
|
|
63795
|
+
}
|
|
63796
|
+
completionFinalSummary(parsedMessages) {
|
|
63797
|
+
const evidence = this.completionFinalAssistantEvidence(parsedMessages);
|
|
63798
|
+
return extractFinalSummaryFromMessages(evidence.messages);
|
|
63799
|
+
}
|
|
63744
63800
|
buildCompletedFinalizationDiagnostic(args) {
|
|
63745
63801
|
let parsed = null;
|
|
63746
63802
|
let parseError;
|
|
@@ -63749,7 +63805,8 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
63749
63805
|
} catch (error48) {
|
|
63750
63806
|
parseError = error48?.message || String(error48);
|
|
63751
63807
|
}
|
|
63752
|
-
const
|
|
63808
|
+
const evidence = this.completionFinalAssistantEvidence(parsed?.messages);
|
|
63809
|
+
const visibleMessages = (Array.isArray(evidence.messages) ? evidence.messages : []).filter((message) => isUserFacingChatMessage(message));
|
|
63753
63810
|
const lastVisible = visibleMessages[visibleMessages.length - 1];
|
|
63754
63811
|
const lastVisibleRole = typeof lastVisible?.role === "string" ? lastVisible.role.trim().toLowerCase() : null;
|
|
63755
63812
|
const lastVisibleKind = typeof lastVisible?.kind === "string" ? lastVisible.kind : null;
|
|
@@ -63767,7 +63824,8 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
63767
63824
|
latestVisibleStatus: args.latestVisibleStatus,
|
|
63768
63825
|
parsedStatus: typeof parsed?.status === "string" ? parsed.status : parseError ? "parse_error" : "unknown",
|
|
63769
63826
|
parseError: parseError || void 0,
|
|
63770
|
-
finalAssistantPresent:
|
|
63827
|
+
finalAssistantPresent: evidence.present,
|
|
63828
|
+
finalAssistantEvidenceSource: evidence.source,
|
|
63771
63829
|
visibleMessageCount: visibleMessages.length,
|
|
63772
63830
|
lastVisibleRole,
|
|
63773
63831
|
lastVisibleKind,
|
|
@@ -63830,8 +63888,21 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
63830
63888
|
}
|
|
63831
63889
|
if (parsed?.activeModal || parsed?.modal) return { reason: "parsed_modal_active", terminal: true };
|
|
63832
63890
|
const adapterOwnsMessagesElsewhere = this.adapter?.chatMessagesOwnedExternally === true;
|
|
63833
|
-
|
|
63834
|
-
|
|
63891
|
+
const finalAssistantEvidence = this.completionFinalAssistantEvidence(parsed?.messages);
|
|
63892
|
+
if (!finalAssistantEvidence.present) {
|
|
63893
|
+
if (adapterOwnsMessagesElsewhere) {
|
|
63894
|
+
if (finalAssistantEvidence.source === "external-native") {
|
|
63895
|
+
return { reason: "missing_final_assistant", terminal: true };
|
|
63896
|
+
}
|
|
63897
|
+
if (this.provider.requiresFinalAssistantBeforeIdle === true) {
|
|
63898
|
+
return { reason: "missing_final_assistant", terminal: true };
|
|
63899
|
+
}
|
|
63900
|
+
} else {
|
|
63901
|
+
return {
|
|
63902
|
+
reason: "missing_final_assistant",
|
|
63903
|
+
terminal: this.provider.requiresFinalAssistantBeforeIdle === true
|
|
63904
|
+
};
|
|
63905
|
+
}
|
|
63835
63906
|
}
|
|
63836
63907
|
try {
|
|
63837
63908
|
const screenText = typeof this.adapter.getScreenText === "function" ? String(this.adapter.getScreenText() || "") : "";
|
|
@@ -63890,7 +63961,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
63890
63961
|
chatTitle: pending.chatTitle,
|
|
63891
63962
|
duration: pending.duration,
|
|
63892
63963
|
timestamp: pending.timestamp,
|
|
63893
|
-
finalSummary: blockReason.startsWith("parsed_status:") ? "" :
|
|
63964
|
+
finalSummary: blockReason.startsWith("parsed_status:") ? "" : this.completionFinalSummary(this.adapter?.getScriptParsedStatus()?.messages),
|
|
63894
63965
|
completionDiagnostic
|
|
63895
63966
|
});
|
|
63896
63967
|
this.completedDebouncePending = null;
|
|
@@ -63905,7 +63976,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
63905
63976
|
chatTitle: pending.chatTitle,
|
|
63906
63977
|
duration: pending.duration,
|
|
63907
63978
|
timestamp: pending.timestamp,
|
|
63908
|
-
finalSummary:
|
|
63979
|
+
finalSummary: this.completionFinalSummary(this.adapter?.getScriptParsedStatus()?.messages)
|
|
63909
63980
|
});
|
|
63910
63981
|
this.completedDebouncePending = null;
|
|
63911
63982
|
this.completedDebounceTimer = null;
|
|
@@ -64038,11 +64109,15 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
64038
64109
|
this.generatingDebouncePending = null;
|
|
64039
64110
|
this.generatingStartedAt = 0;
|
|
64040
64111
|
let shortFinalSummary;
|
|
64112
|
+
let shortEvidenceSource = "unavailable";
|
|
64041
64113
|
try {
|
|
64042
|
-
|
|
64114
|
+
const parsedMessages = this.adapter?.getScriptParsedStatus()?.messages;
|
|
64115
|
+
const evidence = this.completionFinalAssistantEvidence(parsedMessages);
|
|
64116
|
+
shortEvidenceSource = evidence.source;
|
|
64117
|
+
shortFinalSummary = extractFinalSummaryFromMessages(evidence.messages);
|
|
64043
64118
|
} catch {
|
|
64044
64119
|
}
|
|
64045
|
-
if (this.provider.requiresFinalAssistantBeforeIdle === true && !shortFinalSummary) {
|
|
64120
|
+
if ((this.provider.requiresFinalAssistantBeforeIdle === true || shortEvidenceSource === "external-native") && !shortFinalSummary) {
|
|
64046
64121
|
LOG2.info("CLI", `[${this.type}] suppressed short completion without final assistant evidence`);
|
|
64047
64122
|
} else {
|
|
64048
64123
|
this.pushEvent({
|
|
@@ -64053,7 +64128,8 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
64053
64128
|
finalSummary: shortFinalSummary,
|
|
64054
64129
|
completionDiagnostic: {
|
|
64055
64130
|
reason: "short_generating_suppressed",
|
|
64056
|
-
shortDurationMs
|
|
64131
|
+
shortDurationMs,
|
|
64132
|
+
finalAssistantEvidenceSource: shortEvidenceSource
|
|
64057
64133
|
}
|
|
64058
64134
|
});
|
|
64059
64135
|
}
|