@adhdev/daemon-core 0.9.82-rc.210 → 0.9.82-rc.212
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 +34 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -7
- package/dist/index.mjs.map +1 -1
- package/dist/providers/spec/driver.d.ts +4 -0
- package/dist/providers/spec/schema.gen.d.ts +8 -0
- package/dist/providers/spec/types.d.ts +6 -0
- package/package.json +1 -1
- package/src/mesh/mesh-events-utils.ts +6 -1
- package/src/providers/cli-provider-instance.ts +4 -3
- package/src/providers/spec/driver.ts +46 -5
- package/src/providers/spec/loader.ts +1 -0
- package/src/providers/spec/schema.gen.ts +1 -0
- package/src/providers/spec/schema.json +1 -0
- package/src/providers/spec/types.ts +6 -0
package/dist/index.mjs
CHANGED
|
@@ -5554,12 +5554,14 @@ function formatCompletionMetadata(event) {
|
|
|
5554
5554
|
const completionDiagnostic = event.completionDiagnostic && typeof event.completionDiagnostic === "object" ? event.completionDiagnostic : null;
|
|
5555
5555
|
const diagnosticReason = completionDiagnostic ? readNonEmptyString2(completionDiagnostic.blockReason) || "present" : "";
|
|
5556
5556
|
const finalAssistantPresent = typeof completionDiagnostic?.finalAssistantPresent === "boolean" ? String(completionDiagnostic.finalAssistantPresent) : "";
|
|
5557
|
+
const evidenceLevel = readNonEmptyString2(event.evidenceLevel);
|
|
5557
5558
|
const parts = [
|
|
5558
5559
|
readNonEmptyString2(event.targetSessionId) ? `session_id=${readNonEmptyString2(event.targetSessionId)}` : "",
|
|
5559
5560
|
readNonEmptyString2(event.providerType) ? `provider=${readNonEmptyString2(event.providerType)}` : "",
|
|
5560
5561
|
readNonEmptyString2(event.providerSessionId) ? `provider_session_id=${readNonEmptyString2(event.providerSessionId)}` : "",
|
|
5561
5562
|
diagnosticReason ? `completion_diagnostic=${diagnosticReason}` : "",
|
|
5562
|
-
finalAssistantPresent ? `final_assistant=${finalAssistantPresent}` : ""
|
|
5563
|
+
finalAssistantPresent ? `final_assistant=${finalAssistantPresent}` : "",
|
|
5564
|
+
evidenceLevel && evidenceLevel !== "sufficient" ? `evidence_level=${evidenceLevel}` : ""
|
|
5563
5565
|
].filter(Boolean);
|
|
5564
5566
|
return parts.length > 0 ? ` (${parts.join("; ")})` : "";
|
|
5565
5567
|
}
|
|
@@ -5569,7 +5571,8 @@ function buildMeshSystemMessage(args) {
|
|
|
5569
5571
|
if (args.metadataEvent.source === "long_generating_reconciliation") {
|
|
5570
5572
|
return `[System] ${args.nodeLabel} already has completion evidence${metadata}. The long-generating monitor reconciled the terminal handoff and marked the session complete; wait for the queued completion event/status refresh before doing any manual transcript check.`;
|
|
5571
5573
|
}
|
|
5572
|
-
|
|
5574
|
+
const reviewNote = args.metadataEvent.reviewRecommended === true ? " Completion evidence is insufficient \u2014 verify via git status or provider_session_id before assuming the task is done. Use mesh_read_chat once if needed, but do not poll repeatedly." : " Use mesh_read_chat once to review its final progress, but do not poll repeatedly.";
|
|
5575
|
+
return `[System] ${args.nodeLabel} has completed its task and is now idle${metadata}. This completion came from the agent status event path;${reviewNote}`;
|
|
5573
5576
|
}
|
|
5574
5577
|
if (args.event === "agent:waiting_approval") {
|
|
5575
5578
|
return `[System] ${args.nodeLabel} is waiting for approval to proceed${metadata}. You may use mesh_read_chat and mesh_approve to handle it.`;
|
|
@@ -28185,6 +28188,7 @@ var SCHEMA_V3 = {
|
|
|
28185
28188
|
"busy_hold_ms": { "type": "integer", "minimum": 0 },
|
|
28186
28189
|
"idle_hold_ms": { "type": "integer", "minimum": 0 },
|
|
28187
28190
|
"startup_grace_ms": { "type": "integer", "minimum": 0 },
|
|
28191
|
+
"screen_active_hold_ms": { "type": "integer", "minimum": 0 },
|
|
28188
28192
|
"completion_marker": {
|
|
28189
28193
|
"type": "object",
|
|
28190
28194
|
"additionalProperties": false,
|
|
@@ -28527,6 +28531,7 @@ function attachDebounceAlias(spec) {
|
|
|
28527
28531
|
...t.busy_hold_ms !== void 0 ? { busy_hold_ms: t.busy_hold_ms } : {},
|
|
28528
28532
|
...t.idle_hold_ms !== void 0 ? { idle_hold_ms: t.idle_hold_ms } : {},
|
|
28529
28533
|
...t.startup_grace_ms !== void 0 ? { startup_grace_ms: t.startup_grace_ms } : {},
|
|
28534
|
+
...t.screen_active_hold_ms !== void 0 ? { screen_active_hold_ms: t.screen_active_hold_ms } : {},
|
|
28530
28535
|
...cm ? {
|
|
28531
28536
|
completion_idle_after: {
|
|
28532
28537
|
...cm.section ? { section: cm.section } : {},
|
|
@@ -28830,6 +28835,10 @@ var SpecDriver = class {
|
|
|
28830
28835
|
completionIdleKey = "";
|
|
28831
28836
|
/** Previous screen lines — passed to evaluate() for `changed` condition detection. */
|
|
28832
28837
|
prevScreenLines = [];
|
|
28838
|
+
/** Timestamp of the last PTY frame that changed the screen content.
|
|
28839
|
+
* Used by screen_active_hold_ms to suppress idle downshifts while
|
|
28840
|
+
* the terminal is still actively updating. */
|
|
28841
|
+
lastScreenChangedAt = 0;
|
|
28833
28842
|
/** Timer that re-runs evaluate() once the hold window expires. Needed
|
|
28834
28843
|
* because the PTY stops emitting once the agent finishes; without an
|
|
28835
28844
|
* explicit wake-up there's nothing to trigger the busy → idle
|
|
@@ -28908,6 +28917,8 @@ var SpecDriver = class {
|
|
|
28908
28917
|
if (this.idleHoldTimer) {
|
|
28909
28918
|
clearTimeout(this.idleHoldTimer);
|
|
28910
28919
|
this.idleHoldTimer = null;
|
|
28920
|
+
this.completionIdleKey = "";
|
|
28921
|
+
this.completionIdleFirstSeenAt = 0;
|
|
28911
28922
|
}
|
|
28912
28923
|
this.pendingIdleState = null;
|
|
28913
28924
|
}
|
|
@@ -29029,8 +29040,12 @@ var SpecDriver = class {
|
|
|
29029
29040
|
reevaluate(forceEmit = false) {
|
|
29030
29041
|
const screen = this.adapter.snapshot();
|
|
29031
29042
|
const cursor = this.adapter.getCursorPosition();
|
|
29043
|
+
const currentLines = screen.split("\n").map((l) => l.endsWith("\r") ? l.slice(0, -1) : l);
|
|
29032
29044
|
const ev = evaluate(this.spec, screen, cursor, this.prevScreenLines.length > 0 ? this.prevScreenLines : void 0);
|
|
29033
|
-
this.prevScreenLines
|
|
29045
|
+
if (this.prevScreenLines.length > 0 && currentLines.join("\n") !== this.prevScreenLines.join("\n")) {
|
|
29046
|
+
this.lastScreenChangedAt = Date.now();
|
|
29047
|
+
}
|
|
29048
|
+
this.prevScreenLines = currentLines;
|
|
29034
29049
|
let evState = ev.state;
|
|
29035
29050
|
const busyHoldMs = this.spec.debounce?.busy_hold_ms ?? BUSY_HOLD_MS;
|
|
29036
29051
|
if (this.currentStateId === "busy" && evState.id === "idle") {
|
|
@@ -29048,12 +29063,19 @@ var SpecDriver = class {
|
|
|
29048
29063
|
}
|
|
29049
29064
|
}
|
|
29050
29065
|
const completionIdleRule = this.spec.debounce?.completion_idle_after;
|
|
29066
|
+
const screenActiveHoldMs = this.spec.debounce?.screen_active_hold_ms;
|
|
29051
29067
|
let busyWakeMs = busyHoldMs;
|
|
29052
29068
|
const postModalGraceMs = busyHoldMs;
|
|
29053
29069
|
const now = Date.now();
|
|
29054
29070
|
const recentlyInModal = isModalState(this.currentStateId) || this.lastModalAt > 0 && now - this.lastModalAt < postModalGraceMs;
|
|
29055
29071
|
const recentlyLeftModal = !recentlyInModal && this.lastModalExitAt > 0 && now - this.lastModalExitAt < postModalGraceMs;
|
|
29056
|
-
|
|
29072
|
+
const screenActiveMs = screenActiveHoldMs ?? 0;
|
|
29073
|
+
const screenStableMs = this.lastScreenChangedAt > 0 ? now - this.lastScreenChangedAt : Infinity;
|
|
29074
|
+
const screenIsActive = screenActiveMs > 0 && screenStableMs < screenActiveMs;
|
|
29075
|
+
if (screenIsActive) {
|
|
29076
|
+
busyWakeMs = Math.min(busyWakeMs, screenActiveMs - screenStableMs + 50);
|
|
29077
|
+
}
|
|
29078
|
+
if (evState.id === "busy" && completionIdleRule && !recentlyInModal && !recentlyLeftModal && !screenIsActive) {
|
|
29057
29079
|
const completionKey = matchesCompletionIdleRule(this.spec, ev, screen);
|
|
29058
29080
|
if (completionKey) {
|
|
29059
29081
|
const now2 = Date.now();
|
|
@@ -29083,8 +29105,13 @@ var SpecDriver = class {
|
|
|
29083
29105
|
this.completionIdleFirstSeenAt = 0;
|
|
29084
29106
|
}
|
|
29085
29107
|
} else if (evState.id !== "busy") {
|
|
29086
|
-
|
|
29087
|
-
|
|
29108
|
+
if (!screenIsActive) {
|
|
29109
|
+
this.completionIdleKey = "";
|
|
29110
|
+
this.completionIdleFirstSeenAt = 0;
|
|
29111
|
+
}
|
|
29112
|
+
}
|
|
29113
|
+
if (screenIsActive && this.currentStateId === "busy" && evState.id === (this.spec.default_state ?? "idle")) {
|
|
29114
|
+
evState = this.lastBusyState ?? evState;
|
|
29088
29115
|
}
|
|
29089
29116
|
if (evState.id === "busy") {
|
|
29090
29117
|
this.lastBusyAt = Date.now();
|
|
@@ -31791,7 +31818,7 @@ var CliProviderInstance = class {
|
|
|
31791
31818
|
message: typeof modal?.message === "string" ? modal.message.trim() : "",
|
|
31792
31819
|
buttons: Array.isArray(modal?.buttons) ? modal.buttons.map((button) => String(button).trim()) : []
|
|
31793
31820
|
});
|
|
31794
|
-
if (
|
|
31821
|
+
if (approvalFingerprint !== this.lastApprovalEventFingerprint) {
|
|
31795
31822
|
this.lastApprovalEventFingerprint = approvalFingerprint;
|
|
31796
31823
|
this.appendRuntimeSystemMessage(
|
|
31797
31824
|
this.formatApprovalRequestMessage(modal?.message, modal?.buttons),
|