@adhdev/daemon-core 0.6.46 → 0.6.48
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 +50 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/cli-adapters/provider-cli-adapter.ts +4 -7
- package/src/providers/acp-provider-instance.ts +4 -1
- package/src/providers/cli-provider-instance.ts +5 -1
- package/src/providers/extension-provider-instance.ts +8 -2
- package/src/providers/ide-provider-instance.ts +7 -1
- package/src/providers/status-monitor.ts +30 -5
package/dist/index.js
CHANGED
|
@@ -703,16 +703,15 @@ var init_provider_cli_adapter = __esm({
|
|
|
703
703
|
}
|
|
704
704
|
FALLBACK_PROMPT = [
|
|
705
705
|
/Type your message/i,
|
|
706
|
-
/^>\s*$/m,
|
|
707
|
-
// '>' alone on its own line
|
|
708
|
-
/[›❯]\s*[\r\n]/,
|
|
709
|
-
// prompt char followed by line ending (ANSI-stripped may not have $ at end)
|
|
710
|
-
/[›❯]\s*$/m,
|
|
711
|
-
// prompt char at end of line (multiline)
|
|
712
706
|
/for\s*shortcuts/i,
|
|
713
|
-
// Claude Code prompt
|
|
707
|
+
// Claude Code prompt
|
|
714
708
|
/\?\s*for\s*help/i,
|
|
715
|
-
|
|
709
|
+
// Claude Code help prompt
|
|
710
|
+
/Press enter/i,
|
|
711
|
+
/^[>›❯]\s*$/i,
|
|
712
|
+
// Prompt char as the complete evaluated string
|
|
713
|
+
/[>›❯]\s*$/
|
|
714
|
+
// Prompt char at the very end of evaluated string
|
|
716
715
|
];
|
|
717
716
|
FALLBACK_GENERATING = [
|
|
718
717
|
/[\u2800-\u28ff]/,
|
|
@@ -729,12 +728,8 @@ var init_provider_cli_adapter = __esm({
|
|
|
729
728
|
/Always\s*allow/i,
|
|
730
729
|
/\(y\/n\)/i,
|
|
731
730
|
/\[Y\/n\]/i,
|
|
732
|
-
/
|
|
733
|
-
// "Run bash command" etc — requires surrounding words to avoid false matches
|
|
734
|
-
/Yes,?\s*don'?t\s*ask/i,
|
|
731
|
+
/Yes,?\s*don'?t\s*ask/i
|
|
735
732
|
// "Yes, don't ask again" (Claude Code)
|
|
736
|
-
/\bDeny\b/i
|
|
737
|
-
// Word-boundary match — avoids "allow & deny" in /permissions menu text
|
|
738
733
|
];
|
|
739
734
|
ProviderCliAdapter = class {
|
|
740
735
|
constructor(provider, workingDir, extraArgs = []) {
|
|
@@ -2761,6 +2756,9 @@ var StatusMonitor = class {
|
|
|
2761
2756
|
config;
|
|
2762
2757
|
lastAlertTime = /* @__PURE__ */ new Map();
|
|
2763
2758
|
generatingStartTimes = /* @__PURE__ */ new Map();
|
|
2759
|
+
longGeneratingAlerted = /* @__PURE__ */ new Map();
|
|
2760
|
+
lastProgressFingerprint = /* @__PURE__ */ new Map();
|
|
2761
|
+
lastProgressChangeAt = /* @__PURE__ */ new Map();
|
|
2764
2762
|
constructor(config) {
|
|
2765
2763
|
this.config = { ...DEFAULT_MONITOR_CONFIG, ...config };
|
|
2766
2764
|
}
|
|
@@ -2776,7 +2774,7 @@ var StatusMonitor = class {
|
|
|
2776
2774
|
* Check status transition → return notification event array.
|
|
2777
2775
|
* Called from each onTick() or detectStatusTransition().
|
|
2778
2776
|
*/
|
|
2779
|
-
check(agentKey, status, now) {
|
|
2777
|
+
check(agentKey, status, now, progressFingerprint) {
|
|
2780
2778
|
const events = [];
|
|
2781
2779
|
if (this.config.approvalAlert && status === "waiting_approval") {
|
|
2782
2780
|
if (this.shouldAlert(agentKey + ":approval", now)) {
|
|
@@ -2791,24 +2789,40 @@ var StatusMonitor = class {
|
|
|
2791
2789
|
if (status === "generating" || status === "streaming") {
|
|
2792
2790
|
if (!this.generatingStartTimes.has(agentKey)) {
|
|
2793
2791
|
this.generatingStartTimes.set(agentKey, now);
|
|
2792
|
+
this.longGeneratingAlerted.set(agentKey, false);
|
|
2793
|
+
const initialFingerprint = progressFingerprint ?? "";
|
|
2794
|
+
this.lastProgressFingerprint.set(agentKey, initialFingerprint);
|
|
2795
|
+
this.lastProgressChangeAt.set(agentKey, now);
|
|
2796
|
+
}
|
|
2797
|
+
const currentFingerprint = progressFingerprint ?? "";
|
|
2798
|
+
const previousFingerprint = this.lastProgressFingerprint.get(agentKey);
|
|
2799
|
+
if (previousFingerprint !== currentFingerprint) {
|
|
2800
|
+
this.lastProgressFingerprint.set(agentKey, currentFingerprint);
|
|
2801
|
+
this.lastProgressChangeAt.set(agentKey, now);
|
|
2802
|
+
this.longGeneratingAlerted.set(agentKey, false);
|
|
2794
2803
|
}
|
|
2795
2804
|
if (this.config.longGeneratingAlert) {
|
|
2796
|
-
const
|
|
2797
|
-
const elapsedSec = Math.round((now -
|
|
2798
|
-
|
|
2805
|
+
const progressChangedAt = this.lastProgressChangeAt.get(agentKey) || this.generatingStartTimes.get(agentKey);
|
|
2806
|
+
const elapsedSec = Math.round((now - progressChangedAt) / 1e3);
|
|
2807
|
+
const alreadyAlerted = this.longGeneratingAlerted.get(agentKey) === true;
|
|
2808
|
+
if (elapsedSec > this.config.longGeneratingThresholdSec && !alreadyAlerted) {
|
|
2799
2809
|
if (this.shouldAlert(agentKey + ":long_gen", now)) {
|
|
2810
|
+
this.longGeneratingAlerted.set(agentKey, true);
|
|
2800
2811
|
events.push({
|
|
2801
2812
|
type: "monitor:long_generating",
|
|
2802
2813
|
agentKey,
|
|
2803
2814
|
elapsedSec,
|
|
2804
2815
|
timestamp: now,
|
|
2805
|
-
message: `${agentKey}
|
|
2816
|
+
message: `${agentKey} output appears stuck for ${Math.round(elapsedSec / 60)}min`
|
|
2806
2817
|
});
|
|
2807
2818
|
}
|
|
2808
2819
|
}
|
|
2809
2820
|
}
|
|
2810
2821
|
} else {
|
|
2811
2822
|
this.generatingStartTimes.delete(agentKey);
|
|
2823
|
+
this.longGeneratingAlerted.delete(agentKey);
|
|
2824
|
+
this.lastProgressFingerprint.delete(agentKey);
|
|
2825
|
+
this.lastProgressChangeAt.delete(agentKey);
|
|
2812
2826
|
}
|
|
2813
2827
|
return events;
|
|
2814
2828
|
}
|
|
@@ -2825,11 +2839,17 @@ var StatusMonitor = class {
|
|
|
2825
2839
|
reset(agentKey) {
|
|
2826
2840
|
if (agentKey) {
|
|
2827
2841
|
this.generatingStartTimes.delete(agentKey);
|
|
2842
|
+
this.longGeneratingAlerted.delete(agentKey);
|
|
2843
|
+
this.lastProgressFingerprint.delete(agentKey);
|
|
2844
|
+
this.lastProgressChangeAt.delete(agentKey);
|
|
2828
2845
|
for (const k of this.lastAlertTime.keys()) {
|
|
2829
2846
|
if (k.startsWith(agentKey)) this.lastAlertTime.delete(k);
|
|
2830
2847
|
}
|
|
2831
2848
|
} else {
|
|
2832
2849
|
this.generatingStartTimes.clear();
|
|
2850
|
+
this.longGeneratingAlerted.clear();
|
|
2851
|
+
this.lastProgressFingerprint.clear();
|
|
2852
|
+
this.lastProgressChangeAt.clear();
|
|
2833
2853
|
this.lastAlertTime.clear();
|
|
2834
2854
|
}
|
|
2835
2855
|
}
|
|
@@ -2929,9 +2949,11 @@ var ExtensionProviderInstance = class {
|
|
|
2929
2949
|
// (generating_started, generating_completed, waiting_approval)
|
|
2930
2950
|
// via its own detectAgentTransitions(). Emitting here would cause
|
|
2931
2951
|
// duplicate toasts with slightly different content.
|
|
2932
|
-
detectTransition(newStatus,
|
|
2952
|
+
detectTransition(newStatus, data) {
|
|
2933
2953
|
const now = Date.now();
|
|
2934
2954
|
const agentStatus = newStatus === "streaming" || newStatus === "generating" ? "generating" : newStatus === "waiting_approval" ? "waiting_approval" : "idle";
|
|
2955
|
+
const lastMsg = Array.isArray(data?.messages) && data.messages.length > 0 ? data.messages[data.messages.length - 1] : null;
|
|
2956
|
+
const progressFingerprint = agentStatus === "generating" ? `${lastMsg?.role || ""}:${typeof lastMsg?.content === "string" ? lastMsg.content : JSON.stringify(lastMsg?.content || "")}`.slice(-2e3) : void 0;
|
|
2935
2957
|
if (agentStatus !== this.lastAgentStatus) {
|
|
2936
2958
|
if (this.lastAgentStatus === "idle" && agentStatus === "generating") {
|
|
2937
2959
|
this.generatingStartedAt = now;
|
|
@@ -2941,7 +2963,7 @@ var ExtensionProviderInstance = class {
|
|
|
2941
2963
|
this.lastAgentStatus = agentStatus;
|
|
2942
2964
|
}
|
|
2943
2965
|
const agentKey = `${this.type}:ext`;
|
|
2944
|
-
const monitorEvents = this.monitor.check(agentKey, agentStatus, now);
|
|
2966
|
+
const monitorEvents = this.monitor.check(agentKey, agentStatus, now, progressFingerprint);
|
|
2945
2967
|
for (const me of monitorEvents) {
|
|
2946
2968
|
this.pushEvent({ event: me.type, agentKey: me.agentKey, message: me.message, elapsedSec: me.elapsedSec, timestamp: me.timestamp });
|
|
2947
2969
|
}
|
|
@@ -3359,6 +3381,8 @@ var IdeProviderInstance = class {
|
|
|
3359
3381
|
if (!chatStatus) return;
|
|
3360
3382
|
const agentKey = `${this.type}:native`;
|
|
3361
3383
|
const agentStatus = chatStatus === "streaming" || chatStatus === "generating" ? "generating" : chatStatus === "waiting_approval" ? "waiting_approval" : "idle";
|
|
3384
|
+
const lastMsg = Array.isArray(chatData?.messages) && chatData.messages.length > 0 ? chatData.messages[chatData.messages.length - 1] : null;
|
|
3385
|
+
const progressFingerprint = agentStatus === "generating" ? `${lastMsg?.role || ""}:${typeof lastMsg?.content === "string" ? lastMsg.content : JSON.stringify(lastMsg?.content || "")}`.slice(-2e3) : void 0;
|
|
3362
3386
|
this.currentStatus = agentStatus;
|
|
3363
3387
|
const lastStatus = this.lastAgentStatuses.get(agentKey) || "idle";
|
|
3364
3388
|
if (agentStatus !== lastStatus) {
|
|
@@ -3388,7 +3412,7 @@ var IdeProviderInstance = class {
|
|
|
3388
3412
|
if (agentStatus === "waiting_approval" && this.settings.autoApprove && !this.autoApproveBusy) {
|
|
3389
3413
|
this.autoApproveViaScript(chatData);
|
|
3390
3414
|
}
|
|
3391
|
-
const monitorEvents = this.monitor.check(agentKey, agentStatus, now);
|
|
3415
|
+
const monitorEvents = this.monitor.check(agentKey, agentStatus, now, progressFingerprint);
|
|
3392
3416
|
for (const me of monitorEvents) {
|
|
3393
3417
|
this.pushEvent({ event: me.type, agentKey: me.agentKey, message: me.message, elapsedSec: me.elapsedSec, timestamp: me.timestamp });
|
|
3394
3418
|
}
|
|
@@ -7787,6 +7811,8 @@ var CliProviderInstance = class {
|
|
|
7787
7811
|
const newStatus = adapterStatus.status;
|
|
7788
7812
|
const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
|
|
7789
7813
|
const chatTitle = `${this.provider.name} \xB7 ${dirName}`;
|
|
7814
|
+
const partial = this.adapter.getPartialResponse();
|
|
7815
|
+
const progressFingerprint = newStatus === "generating" ? `${partial || ""}::${adapterStatus.messages.at(-1)?.content || ""}`.slice(-2e3) : void 0;
|
|
7790
7816
|
if (newStatus !== this.lastStatus) {
|
|
7791
7817
|
LOG.info("CLI", `[${this.type}] status: ${this.lastStatus} \u2192 ${newStatus}`);
|
|
7792
7818
|
if (this.lastStatus === "idle" && newStatus === "generating") {
|
|
@@ -7875,7 +7901,7 @@ var CliProviderInstance = class {
|
|
|
7875
7901
|
this.lastStatus = newStatus;
|
|
7876
7902
|
}
|
|
7877
7903
|
const agentKey = `${this.type}:cli`;
|
|
7878
|
-
const monitorEvents = this.monitor.check(agentKey, newStatus, now);
|
|
7904
|
+
const monitorEvents = this.monitor.check(agentKey, newStatus, now, progressFingerprint);
|
|
7879
7905
|
for (const me of monitorEvents) {
|
|
7880
7906
|
this.pushEvent({ event: me.type, agentKey: me.agentKey, message: me.message, elapsedSec: me.elapsedSec, timestamp: me.timestamp });
|
|
7881
7907
|
}
|
|
@@ -8740,6 +8766,7 @@ var AcpProviderInstance = class {
|
|
|
8740
8766
|
const newStatus = this.currentStatus;
|
|
8741
8767
|
const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
|
|
8742
8768
|
const chatTitle = `${this.provider.name} \xB7 ${dirName}`;
|
|
8769
|
+
const progressFingerprint = newStatus === "generating" ? `${this.partialContent}::${JSON.stringify(this.partialBlocks)}::${JSON.stringify(this.activeToolCalls.map((t) => ({ name: t.name, status: t.status })))}`.slice(-2e3) : void 0;
|
|
8743
8770
|
if (newStatus !== this.lastStatus) {
|
|
8744
8771
|
if (this.lastStatus === "idle" && newStatus === "generating") {
|
|
8745
8772
|
this.generatingStartedAt = now;
|
|
@@ -8762,7 +8789,7 @@ var AcpProviderInstance = class {
|
|
|
8762
8789
|
this.lastStatus = newStatus;
|
|
8763
8790
|
}
|
|
8764
8791
|
const agentKey = `${this.type}:acp`;
|
|
8765
|
-
const monitorEvents = this.monitor.check(agentKey, newStatus, now);
|
|
8792
|
+
const monitorEvents = this.monitor.check(agentKey, newStatus, now, progressFingerprint);
|
|
8766
8793
|
for (const me of monitorEvents) {
|
|
8767
8794
|
this.pushEvent({ event: me.type, agentKey: me.agentKey, message: me.message, elapsedSec: me.elapsedSec, timestamp: me.timestamp });
|
|
8768
8795
|
}
|