@adhdev/daemon-core 0.9.82-rc.211 → 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 +32 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -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 +35 -4
- 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.js
CHANGED
|
@@ -5560,12 +5560,14 @@ function formatCompletionMetadata(event) {
|
|
|
5560
5560
|
const completionDiagnostic = event.completionDiagnostic && typeof event.completionDiagnostic === "object" ? event.completionDiagnostic : null;
|
|
5561
5561
|
const diagnosticReason = completionDiagnostic ? readNonEmptyString2(completionDiagnostic.blockReason) || "present" : "";
|
|
5562
5562
|
const finalAssistantPresent = typeof completionDiagnostic?.finalAssistantPresent === "boolean" ? String(completionDiagnostic.finalAssistantPresent) : "";
|
|
5563
|
+
const evidenceLevel = readNonEmptyString2(event.evidenceLevel);
|
|
5563
5564
|
const parts = [
|
|
5564
5565
|
readNonEmptyString2(event.targetSessionId) ? `session_id=${readNonEmptyString2(event.targetSessionId)}` : "",
|
|
5565
5566
|
readNonEmptyString2(event.providerType) ? `provider=${readNonEmptyString2(event.providerType)}` : "",
|
|
5566
5567
|
readNonEmptyString2(event.providerSessionId) ? `provider_session_id=${readNonEmptyString2(event.providerSessionId)}` : "",
|
|
5567
5568
|
diagnosticReason ? `completion_diagnostic=${diagnosticReason}` : "",
|
|
5568
|
-
finalAssistantPresent ? `final_assistant=${finalAssistantPresent}` : ""
|
|
5569
|
+
finalAssistantPresent ? `final_assistant=${finalAssistantPresent}` : "",
|
|
5570
|
+
evidenceLevel && evidenceLevel !== "sufficient" ? `evidence_level=${evidenceLevel}` : ""
|
|
5569
5571
|
].filter(Boolean);
|
|
5570
5572
|
return parts.length > 0 ? ` (${parts.join("; ")})` : "";
|
|
5571
5573
|
}
|
|
@@ -5575,7 +5577,8 @@ function buildMeshSystemMessage(args) {
|
|
|
5575
5577
|
if (args.metadataEvent.source === "long_generating_reconciliation") {
|
|
5576
5578
|
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.`;
|
|
5577
5579
|
}
|
|
5578
|
-
|
|
5580
|
+
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.";
|
|
5581
|
+
return `[System] ${args.nodeLabel} has completed its task and is now idle${metadata}. This completion came from the agent status event path;${reviewNote}`;
|
|
5579
5582
|
}
|
|
5580
5583
|
if (args.event === "agent:waiting_approval") {
|
|
5581
5584
|
return `[System] ${args.nodeLabel} is waiting for approval to proceed${metadata}. You may use mesh_read_chat and mesh_approve to handle it.`;
|
|
@@ -28518,6 +28521,7 @@ var SCHEMA_V3 = {
|
|
|
28518
28521
|
"busy_hold_ms": { "type": "integer", "minimum": 0 },
|
|
28519
28522
|
"idle_hold_ms": { "type": "integer", "minimum": 0 },
|
|
28520
28523
|
"startup_grace_ms": { "type": "integer", "minimum": 0 },
|
|
28524
|
+
"screen_active_hold_ms": { "type": "integer", "minimum": 0 },
|
|
28521
28525
|
"completion_marker": {
|
|
28522
28526
|
"type": "object",
|
|
28523
28527
|
"additionalProperties": false,
|
|
@@ -28860,6 +28864,7 @@ function attachDebounceAlias(spec) {
|
|
|
28860
28864
|
...t.busy_hold_ms !== void 0 ? { busy_hold_ms: t.busy_hold_ms } : {},
|
|
28861
28865
|
...t.idle_hold_ms !== void 0 ? { idle_hold_ms: t.idle_hold_ms } : {},
|
|
28862
28866
|
...t.startup_grace_ms !== void 0 ? { startup_grace_ms: t.startup_grace_ms } : {},
|
|
28867
|
+
...t.screen_active_hold_ms !== void 0 ? { screen_active_hold_ms: t.screen_active_hold_ms } : {},
|
|
28863
28868
|
...cm ? {
|
|
28864
28869
|
completion_idle_after: {
|
|
28865
28870
|
...cm.section ? { section: cm.section } : {},
|
|
@@ -29163,6 +29168,10 @@ var SpecDriver = class {
|
|
|
29163
29168
|
completionIdleKey = "";
|
|
29164
29169
|
/** Previous screen lines — passed to evaluate() for `changed` condition detection. */
|
|
29165
29170
|
prevScreenLines = [];
|
|
29171
|
+
/** Timestamp of the last PTY frame that changed the screen content.
|
|
29172
|
+
* Used by screen_active_hold_ms to suppress idle downshifts while
|
|
29173
|
+
* the terminal is still actively updating. */
|
|
29174
|
+
lastScreenChangedAt = 0;
|
|
29166
29175
|
/** Timer that re-runs evaluate() once the hold window expires. Needed
|
|
29167
29176
|
* because the PTY stops emitting once the agent finishes; without an
|
|
29168
29177
|
* explicit wake-up there's nothing to trigger the busy → idle
|
|
@@ -29364,8 +29373,12 @@ var SpecDriver = class {
|
|
|
29364
29373
|
reevaluate(forceEmit = false) {
|
|
29365
29374
|
const screen = this.adapter.snapshot();
|
|
29366
29375
|
const cursor = this.adapter.getCursorPosition();
|
|
29376
|
+
const currentLines = screen.split("\n").map((l) => l.endsWith("\r") ? l.slice(0, -1) : l);
|
|
29367
29377
|
const ev = evaluate(this.spec, screen, cursor, this.prevScreenLines.length > 0 ? this.prevScreenLines : void 0);
|
|
29368
|
-
this.prevScreenLines
|
|
29378
|
+
if (this.prevScreenLines.length > 0 && currentLines.join("\n") !== this.prevScreenLines.join("\n")) {
|
|
29379
|
+
this.lastScreenChangedAt = Date.now();
|
|
29380
|
+
}
|
|
29381
|
+
this.prevScreenLines = currentLines;
|
|
29369
29382
|
let evState = ev.state;
|
|
29370
29383
|
const busyHoldMs = this.spec.debounce?.busy_hold_ms ?? BUSY_HOLD_MS;
|
|
29371
29384
|
if (this.currentStateId === "busy" && evState.id === "idle") {
|
|
@@ -29383,12 +29396,19 @@ var SpecDriver = class {
|
|
|
29383
29396
|
}
|
|
29384
29397
|
}
|
|
29385
29398
|
const completionIdleRule = this.spec.debounce?.completion_idle_after;
|
|
29399
|
+
const screenActiveHoldMs = this.spec.debounce?.screen_active_hold_ms;
|
|
29386
29400
|
let busyWakeMs = busyHoldMs;
|
|
29387
29401
|
const postModalGraceMs = busyHoldMs;
|
|
29388
29402
|
const now = Date.now();
|
|
29389
29403
|
const recentlyInModal = isModalState(this.currentStateId) || this.lastModalAt > 0 && now - this.lastModalAt < postModalGraceMs;
|
|
29390
29404
|
const recentlyLeftModal = !recentlyInModal && this.lastModalExitAt > 0 && now - this.lastModalExitAt < postModalGraceMs;
|
|
29391
|
-
|
|
29405
|
+
const screenActiveMs = screenActiveHoldMs ?? 0;
|
|
29406
|
+
const screenStableMs = this.lastScreenChangedAt > 0 ? now - this.lastScreenChangedAt : Infinity;
|
|
29407
|
+
const screenIsActive = screenActiveMs > 0 && screenStableMs < screenActiveMs;
|
|
29408
|
+
if (screenIsActive) {
|
|
29409
|
+
busyWakeMs = Math.min(busyWakeMs, screenActiveMs - screenStableMs + 50);
|
|
29410
|
+
}
|
|
29411
|
+
if (evState.id === "busy" && completionIdleRule && !recentlyInModal && !recentlyLeftModal && !screenIsActive) {
|
|
29392
29412
|
const completionKey = matchesCompletionIdleRule(this.spec, ev, screen);
|
|
29393
29413
|
if (completionKey) {
|
|
29394
29414
|
const now2 = Date.now();
|
|
@@ -29418,8 +29438,13 @@ var SpecDriver = class {
|
|
|
29418
29438
|
this.completionIdleFirstSeenAt = 0;
|
|
29419
29439
|
}
|
|
29420
29440
|
} else if (evState.id !== "busy") {
|
|
29421
|
-
|
|
29422
|
-
|
|
29441
|
+
if (!screenIsActive) {
|
|
29442
|
+
this.completionIdleKey = "";
|
|
29443
|
+
this.completionIdleFirstSeenAt = 0;
|
|
29444
|
+
}
|
|
29445
|
+
}
|
|
29446
|
+
if (screenIsActive && this.currentStateId === "busy" && evState.id === (this.spec.default_state ?? "idle")) {
|
|
29447
|
+
evState = this.lastBusyState ?? evState;
|
|
29423
29448
|
}
|
|
29424
29449
|
if (evState.id === "busy") {
|
|
29425
29450
|
this.lastBusyAt = Date.now();
|
|
@@ -32126,7 +32151,7 @@ var CliProviderInstance = class {
|
|
|
32126
32151
|
message: typeof modal?.message === "string" ? modal.message.trim() : "",
|
|
32127
32152
|
buttons: Array.isArray(modal?.buttons) ? modal.buttons.map((button) => String(button).trim()) : []
|
|
32128
32153
|
});
|
|
32129
|
-
if (
|
|
32154
|
+
if (approvalFingerprint !== this.lastApprovalEventFingerprint) {
|
|
32130
32155
|
this.lastApprovalEventFingerprint = approvalFingerprint;
|
|
32131
32156
|
this.appendRuntimeSystemMessage(
|
|
32132
32157
|
this.formatApprovalRequestMessage(modal?.message, modal?.buttons),
|