@adhdev/daemon-core 0.9.82-rc.77 → 0.9.82-rc.79
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 +231 -83
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +233 -85
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/mesh-active-work.d.ts +3 -0
- package/dist/mesh/mesh-events.d.ts +1 -0
- package/dist/providers/cli-provider-instance.d.ts +1 -1
- package/package.json +1 -1
- package/src/commands/cli-manager.ts +45 -1
- package/src/commands/router.ts +75 -34
- package/src/mesh/coordinator-prompt.ts +24 -7
- package/src/mesh/mesh-active-work.ts +32 -15
- package/src/mesh/mesh-events.ts +54 -12
- package/src/providers/cli-provider-instance.ts +23 -12
|
@@ -43,6 +43,11 @@ type CompletedDebouncePending = {
|
|
|
43
43
|
loggedBlockReason?: string;
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
+
type CompletedFinalizationBlock = {
|
|
47
|
+
reason: string;
|
|
48
|
+
terminal?: boolean;
|
|
49
|
+
};
|
|
50
|
+
|
|
46
51
|
const COMPLETED_FINALIZATION_RETRY_MS = 1000;
|
|
47
52
|
const COMPLETED_FINALIZATION_MAX_WAIT_MS = 30_000;
|
|
48
53
|
|
|
@@ -817,29 +822,34 @@ export class CliProviderInstance implements ProviderInstance {
|
|
|
817
822
|
return !this.hasAdapterPendingResponse();
|
|
818
823
|
}
|
|
819
824
|
|
|
820
|
-
private
|
|
821
|
-
if (latestVisibleStatus !== 'idle') return `status:${latestVisibleStatus}
|
|
825
|
+
private getCompletedFinalizationBlock(latestVisibleStatus: string): CompletedFinalizationBlock | null {
|
|
826
|
+
if (latestVisibleStatus !== 'idle') return { reason: `status:${latestVisibleStatus}`, terminal: true };
|
|
822
827
|
|
|
823
828
|
const adapterAny = this.adapter as any;
|
|
824
|
-
if (adapterAny?.isWaitingForResponse === true) return 'adapter_waiting_for_response';
|
|
825
|
-
if (adapterAny?.currentTurnScope) return 'adapter_turn_scope_active';
|
|
829
|
+
if (adapterAny?.isWaitingForResponse === true) return { reason: 'adapter_waiting_for_response', terminal: true };
|
|
830
|
+
if (adapterAny?.currentTurnScope) return { reason: 'adapter_turn_scope_active', terminal: true };
|
|
831
|
+
if (this.hasAdapterPendingResponse()) return { reason: 'adapter_pending_response', terminal: true };
|
|
826
832
|
|
|
827
833
|
const partial = typeof this.adapter.getPartialResponse === 'function'
|
|
828
834
|
? this.adapter.getPartialResponse()
|
|
829
835
|
: '';
|
|
830
|
-
if (typeof partial === 'string' && partial.trim()) return 'partial_response_pending';
|
|
836
|
+
if (typeof partial === 'string' && partial.trim()) return { reason: 'partial_response_pending', terminal: true };
|
|
831
837
|
|
|
832
838
|
let parsed: any;
|
|
833
839
|
try {
|
|
834
840
|
parsed = this.adapter.getScriptParsedStatus();
|
|
835
841
|
} catch (error: any) {
|
|
836
|
-
return `parse_error:${error?.message || String(error)}
|
|
842
|
+
return { reason: `parse_error:${error?.message || String(error)}` };
|
|
837
843
|
}
|
|
838
844
|
|
|
839
845
|
const parsedStatus = typeof parsed?.status === 'string' ? parsed.status : 'unknown';
|
|
840
|
-
if (parsedStatus !== 'idle')
|
|
841
|
-
|
|
842
|
-
|
|
846
|
+
if (parsedStatus !== 'idle') {
|
|
847
|
+
const adapterStatus = this.adapter.getStatus({ allowParse: false });
|
|
848
|
+
if (this.shouldSuppressStaleParsedBusyStatus(parsed, adapterStatus)) return null;
|
|
849
|
+
return { reason: `parsed_status:${parsedStatus}`, terminal: isCliGeneratingLikeStatus(parsedStatus) };
|
|
850
|
+
}
|
|
851
|
+
if (parsed?.activeModal || parsed?.modal) return { reason: 'parsed_modal_active', terminal: true };
|
|
852
|
+
if (!this.completionHasFinalAssistantMessage(parsed?.messages)) return { reason: 'missing_final_assistant' };
|
|
843
853
|
|
|
844
854
|
return null;
|
|
845
855
|
}
|
|
@@ -866,10 +876,11 @@ export class CliProviderInstance implements ProviderInstance {
|
|
|
866
876
|
return;
|
|
867
877
|
}
|
|
868
878
|
|
|
869
|
-
const
|
|
870
|
-
if (
|
|
879
|
+
const block = this.getCompletedFinalizationBlock(latestVisibleStatus);
|
|
880
|
+
if (block) {
|
|
881
|
+
const blockReason = block.reason;
|
|
871
882
|
const waitedMs = Date.now() - pending.firstObservedAt;
|
|
872
|
-
if (waitedMs < COMPLETED_FINALIZATION_MAX_WAIT_MS) {
|
|
883
|
+
if (block.terminal || waitedMs < COMPLETED_FINALIZATION_MAX_WAIT_MS) {
|
|
873
884
|
if (pending.loggedBlockReason !== blockReason) {
|
|
874
885
|
LOG.info('CLI', `[${this.type}] waiting to emit completed until transcript finalizes (${blockReason})`);
|
|
875
886
|
pending.loggedBlockReason = blockReason;
|