@adhdev/daemon-core 0.9.82-rc.468 → 0.9.82-rc.469
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.d.ts +7 -5
- package/dist/index.js +683 -495
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +674 -493
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/mesh-completion-synthesis.d.ts +4 -0
- package/dist/mesh/mesh-delivery-policy.d.ts +0 -27
- package/dist/mesh/mesh-events-pending.d.ts +40 -0
- package/dist/mesh/mesh-events.d.ts +2 -2
- package/dist/mesh/mesh-ledger.d.ts +1 -1
- package/dist/mesh/mesh-reconcile-config.d.ts +6 -0
- package/dist/mesh/mesh-remote-event-pull.d.ts +15 -0
- package/dist/mesh/mesh-runtime-store.d.ts +0 -22
- package/dist/mesh/mesh-work-queue.d.ts +45 -0
- package/package.json +3 -3
- package/src/index.ts +11 -5
- package/src/mesh/coordinator-prompt.ts +15 -0
- package/src/mesh/mesh-completion-synthesis.ts +398 -0
- package/src/mesh/mesh-delivery-policy.ts +7 -38
- package/src/mesh/mesh-event-forwarding.ts +9 -10
- package/src/mesh/mesh-events-pending.ts +176 -0
- package/src/mesh/mesh-events.ts +6 -1
- package/src/mesh/mesh-ledger.ts +5 -0
- package/src/mesh/mesh-queue-assignment.ts +16 -2
- package/src/mesh/mesh-reconcile-config.ts +66 -0
- package/src/mesh/mesh-reconcile-loop.ts +21 -674
- package/src/mesh/mesh-remote-event-pull.ts +279 -0
- package/src/mesh/mesh-runtime-store.ts +46 -82
- package/src/mesh/mesh-work-queue.ts +90 -0
package/dist/index.js
CHANGED
|
@@ -409,10 +409,10 @@ function readInjected(value) {
|
|
|
409
409
|
}
|
|
410
410
|
function getDaemonBuildInfo() {
|
|
411
411
|
if (cached) return cached;
|
|
412
|
-
const commit = readInjected(true ? "
|
|
413
|
-
const commitShort = readInjected(true ? "
|
|
414
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
415
|
-
const builtAt = readInjected(true ? "2026-07-
|
|
412
|
+
const commit = readInjected(true ? "7e34ff6bc7c6528fca49478a57e0a83620f3a063" : void 0) ?? "unknown";
|
|
413
|
+
const commitShort = readInjected(true ? "7e34ff6b" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
414
|
+
const version = readInjected(true ? "0.9.82-rc.469" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
415
|
+
const builtAt = readInjected(true ? "2026-07-05T12:18:38.077Z" : void 0);
|
|
416
416
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
417
417
|
return cached;
|
|
418
418
|
}
|
|
@@ -2771,12 +2771,57 @@ function summarizeGitShape(status) {
|
|
|
2771
2771
|
submodules
|
|
2772
2772
|
};
|
|
2773
2773
|
}
|
|
2774
|
-
var DAEMON_ID_PREFIXES, MAGI_RAW_ANSWER_CAP;
|
|
2774
|
+
var DAEMON_ID_PREFIXES, MAGI_RAW_ANSWER_CAP, CANONICAL_MESH_TOOL_NAMES, CANONICAL_MESH_TOOL_COUNT;
|
|
2775
2775
|
var init_dist = __esm({
|
|
2776
2776
|
"../mesh-shared/dist/index.mjs"() {
|
|
2777
2777
|
"use strict";
|
|
2778
2778
|
DAEMON_ID_PREFIXES = ["daemon_", "standalone_"];
|
|
2779
2779
|
MAGI_RAW_ANSWER_CAP = 4e3;
|
|
2780
|
+
CANONICAL_MESH_TOOL_NAMES = [
|
|
2781
|
+
"mesh_status",
|
|
2782
|
+
"mesh_list_nodes",
|
|
2783
|
+
"mesh_enqueue_task",
|
|
2784
|
+
"mesh_view_queue",
|
|
2785
|
+
"mesh_queue_cancel",
|
|
2786
|
+
"mesh_queue_requeue",
|
|
2787
|
+
"mesh_send_task",
|
|
2788
|
+
"mesh_read_chat",
|
|
2789
|
+
"mesh_read_debug",
|
|
2790
|
+
"mesh_launch_session",
|
|
2791
|
+
"mesh_git_status",
|
|
2792
|
+
"mesh_read_node_logs",
|
|
2793
|
+
"mesh_fast_forward_node",
|
|
2794
|
+
"mesh_restart_daemon",
|
|
2795
|
+
"mesh_checkpoint",
|
|
2796
|
+
"mesh_approve",
|
|
2797
|
+
"mesh_clone_node",
|
|
2798
|
+
"mesh_remove_node",
|
|
2799
|
+
"mesh_refine_node",
|
|
2800
|
+
"mesh_refine_batch",
|
|
2801
|
+
"mesh_refine_config",
|
|
2802
|
+
"mesh_change_impact_config",
|
|
2803
|
+
"mesh_init",
|
|
2804
|
+
"mesh_reinit",
|
|
2805
|
+
"mesh_write_mesh_json_config",
|
|
2806
|
+
"mesh_refine_plan",
|
|
2807
|
+
"mesh_cleanup_sessions",
|
|
2808
|
+
"mesh_prune_stale_direct",
|
|
2809
|
+
"mesh_task_history",
|
|
2810
|
+
"mesh_record_note",
|
|
2811
|
+
"mesh_forget_note",
|
|
2812
|
+
"mesh_reconcile_ledger",
|
|
2813
|
+
"mesh_requeue_held_events",
|
|
2814
|
+
"mesh_mission_upsert",
|
|
2815
|
+
"mesh_mission_list",
|
|
2816
|
+
"mesh_review_inbox",
|
|
2817
|
+
"mesh_magi_review",
|
|
2818
|
+
"mesh_magi_collect",
|
|
2819
|
+
"mesh_magi_panel_set",
|
|
2820
|
+
"mesh_magi_panel_list",
|
|
2821
|
+
"mesh_magi_kind_panel_set",
|
|
2822
|
+
"mesh_magi_kind_panel_list"
|
|
2823
|
+
];
|
|
2824
|
+
CANONICAL_MESH_TOOL_COUNT = CANONICAL_MESH_TOOL_NAMES.length;
|
|
2780
2825
|
}
|
|
2781
2826
|
});
|
|
2782
2827
|
|
|
@@ -3798,24 +3843,39 @@ var init_coordinator_prompt = __esm({
|
|
|
3798
3843
|
| \`mesh_queue_cancel\` | Cancel a queue task without deleting audit history |
|
|
3799
3844
|
| \`mesh_queue_requeue\` | Return a task to pending for retry; clears stale session targets |
|
|
3800
3845
|
| \`mesh_send_task\` | Legacy push: enqueue a task targeted at a specific node |
|
|
3846
|
+
| \`mesh_mission_upsert\` | Create/update a persistent mission so a multi-task plan survives coordinator restarts; set status completed/abandoned when the outcome is decided |
|
|
3847
|
+
| \`mesh_mission_list\` | List every mission with goal, status, and live task progress \u2014 the authority for "what work remains" (never hidden by status) |
|
|
3801
3848
|
| \`mesh_launch_session\` | Start a new agent session on a node |
|
|
3802
3849
|
| \`mesh_read_chat\` | Read recent chat messages from a delegated agent session |
|
|
3803
3850
|
| \`mesh_read_debug\` | Collect a daemon-side chat/parser debug bundle for a session |
|
|
3804
3851
|
| \`mesh_task_history\` | Read the task ledger \u2014 dispatches, completions, failures. Use to understand what has been done before deciding next steps |
|
|
3852
|
+
| \`mesh_reconcile_ledger\` | Reconcile daemon-local ledgers over P2P \u2014 import missing entries from remote nodes into the coordinator local ledger |
|
|
3853
|
+
| \`mesh_requeue_held_events\` | Restore recoverable held coordinator events (T6 quarantine / pending-trim) back to the pending queue; lossless, no double-requeue |
|
|
3854
|
+
| \`mesh_review_inbox\` | List local worktree nodes needing human review \u2014 merge candidates and Refinery-blocked results with evidence/diff summaries |
|
|
3805
3855
|
| \`mesh_record_note\` | Record a durable, provider-neutral operating note (provider quirk / pattern to avoid / recovery lesson). Future coordinators see it under "## Operating Notes" at launch |
|
|
3806
3856
|
| \`mesh_forget_note\` | Retract a stale/wrong operating note by note_id or exact text so it stops riding into future coordinators' prompts (append-only tombstone; history preserved) |
|
|
3807
3857
|
| \`mesh_git_status\` | Check git status on a specific node |
|
|
3808
3858
|
| \`mesh_read_node_logs\` | Fetch a remote node's daemon log tail directly over P2P (grep/since/byte-bounded, secrets redacted) \u2014 no session/PowerShell needed to debug a node's daemon |
|
|
3809
3859
|
| \`mesh_fast_forward_node\` | Safely dry-run or explicitly execute an obvious clean fast-forward without launching an agent session |
|
|
3860
|
+
| \`mesh_restart_daemon\` | Update a node's daemon to the latest published version on its channel and restart it (the dashboard "preview update" path, as a mesh command) |
|
|
3810
3861
|
| \`mesh_checkpoint\` | Create a git checkpoint on a node |
|
|
3811
3862
|
| \`mesh_approve\` | Approve/reject a pending agent action |
|
|
3812
3863
|
| \`mesh_clone_node\` | Create a worktree node for isolated parallel branch work |
|
|
3813
3864
|
| \`mesh_refine_node\` | Validate and merge a completed worktree node back into its base branch |
|
|
3865
|
+
| \`mesh_refine_batch\` | Batch Refinery: converge multiple sibling worktree nodes onto the base branch in one conflict-aware sequential pipeline |
|
|
3866
|
+
| \`mesh_refine_plan\` | Dry-run Refinery plan for a worktree node \u2014 config source, validation commands, merge/cleanup intent \u2014 without executing validation or git merge |
|
|
3867
|
+
| \`mesh_refine_config\` | Refinery config helper (read-only) \u2014 unified entry for schema/validate/suggest via a required \`mode\` |
|
|
3868
|
+
| \`mesh_change_impact_config\` | Change Impact config helper \u2014 unified entry for schema/validate/suggest via a required \`mode\` |
|
|
3814
3869
|
| \`mesh_remove_node\` | Remove a node (cleans up worktree if applicable) |
|
|
3815
3870
|
| \`mesh_cleanup_sessions\` | Manually clean up delegated session records for a node |
|
|
3871
|
+
| \`mesh_prune_stale_direct\` | Prune orphaned staleDirect dispatch records (dry-run by default); live/pending work and audit history preserved |
|
|
3816
3872
|
| \`mesh_init\` | Guided onboarding for a fresh repo: dry-run scan \u2192 suggest \`.adhdev/*\` configs (refine/bootstrap/change-impact) + providerPriority + current-config echo; gated write on approval |
|
|
3817
3873
|
| \`mesh_reinit\` | Re-onboard an already-configured repo: re-suggest with overwrite semantics + current-vs-suggested diff; dry-run preview first, per-section approval before write |
|
|
3818
3874
|
| \`mesh_write_mesh_json_config\` | Gated write of \`.adhdev/mesh.json\` (repo coordinator-prompt config) from the mesh entry \u2014 dry-run/overwrite like mesh_init |
|
|
3875
|
+
| \`mesh_magi_review\` | Cross-verify a read-only investigation across a standing panel of independent mesh agents (different machines/providers) instead of a single worker |
|
|
3876
|
+
| \`mesh_magi_collect\` | Collect + synthesize a previously dispatched MAGI fan-out by its consensus group id (async companion to mesh_magi_review wait:false) |
|
|
3877
|
+
| \`mesh_magi_panel_set\` | Upsert a named MAGI panel (standing set of independent node\xD7provider members) into machine-local config |
|
|
3878
|
+
| \`mesh_magi_panel_list\` | List configured MAGI panels and resolve each member's availability against the current mesh (read-only) |
|
|
3819
3879
|
| \`mesh_magi_kind_panel_set\` | Bind a task_kind \u2192 MAGI kind-panel slots (machine-local, wholesale replacement \u2014 approve current-vs-new first) |
|
|
3820
3880
|
| \`mesh_magi_kind_panel_list\` | List configured task_kind \u2192 MAGI kind-panel slot bindings (machine-local, read-only) |`;
|
|
3821
3881
|
TOOL_EXPOSURE_PREFLIGHT_SECTION = `## Tool Exposure Preflight
|
|
@@ -5273,29 +5333,6 @@ function getActiveSessionDeliveries(meshId, sessionId) {
|
|
|
5273
5333
|
return [];
|
|
5274
5334
|
}
|
|
5275
5335
|
}
|
|
5276
|
-
function recordCompletionConflict(opts) {
|
|
5277
|
-
try {
|
|
5278
|
-
MeshRuntimeStore.getInstance().recordCompletionConflict({
|
|
5279
|
-
id: (0, import_crypto5.randomUUID)(),
|
|
5280
|
-
meshId: opts.meshId,
|
|
5281
|
-
fingerprint: opts.fingerprint,
|
|
5282
|
-
conflictingTaskId: opts.conflictingTaskId,
|
|
5283
|
-
conflictingSessionId: opts.conflictingSessionId,
|
|
5284
|
-
originalTaskId: opts.originalTaskId,
|
|
5285
|
-
originalSessionId: opts.originalSessionId,
|
|
5286
|
-
event: opts.event,
|
|
5287
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
5288
|
-
});
|
|
5289
|
-
} catch {
|
|
5290
|
-
}
|
|
5291
|
-
}
|
|
5292
|
-
function getRecentCompletionConflicts(meshId, limitMs) {
|
|
5293
|
-
try {
|
|
5294
|
-
return MeshRuntimeStore.getInstance().getRecentCompletionConflicts(meshId, limitMs);
|
|
5295
|
-
} catch {
|
|
5296
|
-
return [];
|
|
5297
|
-
}
|
|
5298
|
-
}
|
|
5299
5336
|
function markSessionDeliveriesTerminal(meshId, sessionId, terminalStatus) {
|
|
5300
5337
|
try {
|
|
5301
5338
|
const active = MeshRuntimeStore.getInstance().getActiveSessionDeliveries(meshId, sessionId);
|
|
@@ -5370,6 +5407,8 @@ __export(mesh_work_queue_exports, {
|
|
|
5370
5407
|
ACTIVE_MESH_QUEUE_STATUSES: () => ACTIVE_MESH_QUEUE_STATUSES,
|
|
5371
5408
|
HISTORICAL_MESH_QUEUE_STATUSES: () => HISTORICAL_MESH_QUEUE_STATUSES,
|
|
5372
5409
|
MESH_TASK_MODES: () => MESH_TASK_MODES,
|
|
5410
|
+
MESH_TASK_PRIORITIES: () => MESH_TASK_PRIORITIES,
|
|
5411
|
+
NOT_BEFORE_RELATIVE_THRESHOLD_MS: () => NOT_BEFORE_RELATIVE_THRESHOLD_MS,
|
|
5373
5412
|
__clearDirectDispatchesForTests: () => __clearDirectDispatchesForTests,
|
|
5374
5413
|
__clearMeshQueueForTests: () => __clearMeshQueueForTests,
|
|
5375
5414
|
__replaceMeshQueueForTests: () => __replaceMeshQueueForTests,
|
|
@@ -5390,21 +5429,60 @@ __export(mesh_work_queue_exports, {
|
|
|
5390
5429
|
insertDirectDispatch: () => insertDirectDispatch,
|
|
5391
5430
|
isTaskReadonly: () => isTaskReadonly,
|
|
5392
5431
|
markStaleDirectDispatches: () => markStaleDirectDispatches,
|
|
5432
|
+
meshTaskNotBeforeReady: () => meshTaskNotBeforeReady,
|
|
5433
|
+
meshTaskPriorityRank: () => meshTaskPriorityRank,
|
|
5393
5434
|
nodeSatisfiesRequiredTags: () => nodeSatisfiesRequiredTags,
|
|
5394
5435
|
normalizeMeshCapabilityTags: () => normalizeMeshCapabilityTags,
|
|
5395
5436
|
normalizeMeshTaskMode: () => normalizeMeshTaskMode,
|
|
5437
|
+
normalizeMeshTaskPriority: () => normalizeMeshTaskPriority,
|
|
5396
5438
|
reclaimStrandedAssignedTask: () => reclaimStrandedAssignedTask,
|
|
5397
5439
|
recordDirectDispatchTask: () => recordDirectDispatchTask,
|
|
5398
5440
|
recordMeshToolCall: () => recordMeshToolCall,
|
|
5399
5441
|
recordTaskAutoLaunch: () => recordTaskAutoLaunch,
|
|
5400
5442
|
requeueTask: () => requeueTask,
|
|
5401
5443
|
resolveConvergeRequiredTags: () => resolveConvergeRequiredTags,
|
|
5444
|
+
resolveNotBefore: () => resolveNotBefore,
|
|
5402
5445
|
taskDependenciesSatisfied: () => taskDependenciesSatisfied,
|
|
5403
5446
|
updateDirectDispatchStatus: () => updateDirectDispatchStatus,
|
|
5404
5447
|
updateSessionTaskStatus: () => updateSessionTaskStatus,
|
|
5405
5448
|
updateTaskStatus: () => updateTaskStatus,
|
|
5406
5449
|
validateMeshTaskModeRequest: () => validateMeshTaskModeRequest
|
|
5407
5450
|
});
|
|
5451
|
+
function meshTaskPriorityRank(priority) {
|
|
5452
|
+
switch (priority) {
|
|
5453
|
+
case "high":
|
|
5454
|
+
return 2;
|
|
5455
|
+
case "low":
|
|
5456
|
+
return 0;
|
|
5457
|
+
default:
|
|
5458
|
+
return 1;
|
|
5459
|
+
}
|
|
5460
|
+
}
|
|
5461
|
+
function normalizeMeshTaskPriority(value) {
|
|
5462
|
+
return value === "low" || value === "normal" || value === "high" ? value : void 0;
|
|
5463
|
+
}
|
|
5464
|
+
function resolveNotBefore(value, nowMs = Date.now()) {
|
|
5465
|
+
if (value === void 0 || value === null) return void 0;
|
|
5466
|
+
let absMs;
|
|
5467
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
5468
|
+
absMs = value < NOT_BEFORE_RELATIVE_THRESHOLD_MS ? nowMs + value : value;
|
|
5469
|
+
} else if (typeof value === "string" && value.trim()) {
|
|
5470
|
+
const parsed = Date.parse(value.trim());
|
|
5471
|
+
if (Number.isNaN(parsed)) return void 0;
|
|
5472
|
+
absMs = parsed;
|
|
5473
|
+
} else {
|
|
5474
|
+
return void 0;
|
|
5475
|
+
}
|
|
5476
|
+
if (absMs <= nowMs) return new Date(nowMs).toISOString();
|
|
5477
|
+
return new Date(absMs).toISOString();
|
|
5478
|
+
}
|
|
5479
|
+
function meshTaskNotBeforeReady(task, nowMs = Date.now()) {
|
|
5480
|
+
const nb = task?.notBefore;
|
|
5481
|
+
if (!nb) return true;
|
|
5482
|
+
const parsed = Date.parse(nb);
|
|
5483
|
+
if (Number.isNaN(parsed)) return true;
|
|
5484
|
+
return parsed <= nowMs;
|
|
5485
|
+
}
|
|
5408
5486
|
function isTaskReadonly(task) {
|
|
5409
5487
|
if (!task) return false;
|
|
5410
5488
|
return task.readonly === true || task.taskMode === "live_debug_readonly";
|
|
@@ -5732,6 +5810,9 @@ function enqueueTask(meshId, message, opts) {
|
|
|
5732
5810
|
}
|
|
5733
5811
|
const id = typeof opts?.id === "string" && opts.id.trim() ? opts.id.trim() : (0, import_crypto6.randomUUID)();
|
|
5734
5812
|
const dependsOn = normalizeDependsOn(opts?.dependsOn);
|
|
5813
|
+
const priority = normalizeMeshTaskPriority(opts?.priority);
|
|
5814
|
+
const notBefore = resolveNotBefore(opts?.notBefore);
|
|
5815
|
+
const maxRetries = typeof opts?.maxRetries === "number" && Number.isFinite(opts.maxRetries) && opts.maxRetries >= 0 ? Math.floor(opts.maxRetries) : void 0;
|
|
5735
5816
|
return withQueueLock(meshId, () => {
|
|
5736
5817
|
if (MeshRuntimeStore.getInstance().findQueueEntryById(meshId, id)) {
|
|
5737
5818
|
throw new Error(`duplicate_task_id: task '${id}' already exists in mesh '${meshId}'`);
|
|
@@ -5755,6 +5836,12 @@ function enqueueTask(meshId, message, opts) {
|
|
|
5755
5836
|
targetSessionId: opts?.targetSessionId,
|
|
5756
5837
|
requiredTags: resolvedRequiredTags,
|
|
5757
5838
|
...dependsOn.length > 0 ? { dependsOn } : {},
|
|
5839
|
+
// G6: only persist a non-default priority so legacy/normal rows stay minimal.
|
|
5840
|
+
...priority && priority !== "normal" ? { priority } : {},
|
|
5841
|
+
// G7: hold-until gate (stored ISO). Omitted when absent/immediate.
|
|
5842
|
+
...notBefore ? { notBefore } : {},
|
|
5843
|
+
// P3: explicit retry cap. Omitted → requeue path falls back to policy default.
|
|
5844
|
+
...maxRetries !== void 0 ? { maxRetries } : {},
|
|
5758
5845
|
...typeof opts?.missionId === "string" && opts.missionId.trim() ? { missionId: opts.missionId.trim() } : {},
|
|
5759
5846
|
...typeof opts?.consensusGroupId === "string" && opts.consensusGroupId.trim() ? { consensusGroupId: opts.consensusGroupId.trim() } : {},
|
|
5760
5847
|
...typeof opts?.model === "string" && opts.model.trim() ? { model: opts.model.trim() } : {},
|
|
@@ -6095,7 +6182,7 @@ function recordMeshToolCall(opts) {
|
|
|
6095
6182
|
return { rateLimitExceeded: false, callsInWindow: 0, advisory: null };
|
|
6096
6183
|
}
|
|
6097
6184
|
}
|
|
6098
|
-
var import_crypto6, ACTIVE_MESH_QUEUE_STATUSES, HISTORICAL_MESH_QUEUE_STATUSES, MESH_TASK_MODES, LIVE_DEBUG_READONLY_FORBIDDEN, NEGATION_CUES, NEGATION_WINDOW_TOKENS, GIT_MUTATION_SUBCOMMANDS, GIT_STASH_READONLY_SUBCOMMANDS, DEPENDENCY_FAILURE_TERMINALS, MAX_STRANDED_RECLAIMS;
|
|
6185
|
+
var import_crypto6, ACTIVE_MESH_QUEUE_STATUSES, HISTORICAL_MESH_QUEUE_STATUSES, MESH_TASK_MODES, MESH_TASK_PRIORITIES, NOT_BEFORE_RELATIVE_THRESHOLD_MS, LIVE_DEBUG_READONLY_FORBIDDEN, NEGATION_CUES, NEGATION_WINDOW_TOKENS, GIT_MUTATION_SUBCOMMANDS, GIT_STASH_READONLY_SUBCOMMANDS, DEPENDENCY_FAILURE_TERMINALS, MAX_STRANDED_RECLAIMS;
|
|
6099
6186
|
var init_mesh_work_queue = __esm({
|
|
6100
6187
|
"src/mesh/mesh-work-queue.ts"() {
|
|
6101
6188
|
"use strict";
|
|
@@ -6112,6 +6199,8 @@ var init_mesh_work_queue = __esm({
|
|
|
6112
6199
|
ACTIVE_MESH_QUEUE_STATUSES = ["pending", "assigned"];
|
|
6113
6200
|
HISTORICAL_MESH_QUEUE_STATUSES = ["completed", "failed", "cancelled"];
|
|
6114
6201
|
MESH_TASK_MODES = ["code_change", "validation", "live_debug_readonly", "launch_app", "convergence"];
|
|
6202
|
+
MESH_TASK_PRIORITIES = ["low", "normal", "high"];
|
|
6203
|
+
NOT_BEFORE_RELATIVE_THRESHOLD_MS = 365 * 24 * 60 * 60 * 1e3;
|
|
6115
6204
|
LIVE_DEBUG_READONLY_FORBIDDEN = [
|
|
6116
6205
|
{ label: "source_edit", pattern: /\b(edit|modify|patch|apply\s+patch|write\s+(?:to\s+)?(?:file|source)|overwrite|delete\s+file|remove\s+file|create\s+file|touch\s+file)\b/i },
|
|
6117
6206
|
{ label: "checkpoint", pattern: /\b(checkpoint|mesh_checkpoint)\b/i },
|
|
@@ -6384,20 +6473,9 @@ var init_mesh_runtime_store = __esm({
|
|
|
6384
6473
|
CREATE INDEX IF NOT EXISTS idx_mesh_session_delivery_task
|
|
6385
6474
|
ON mesh_session_delivery(mesh_id, task_id);
|
|
6386
6475
|
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
fingerprint TEXT NOT NULL,
|
|
6391
|
-
conflicting_task_id TEXT,
|
|
6392
|
-
conflicting_session_id TEXT,
|
|
6393
|
-
original_task_id TEXT,
|
|
6394
|
-
original_session_id TEXT,
|
|
6395
|
-
event TEXT NOT NULL,
|
|
6396
|
-
created_at TEXT NOT NULL
|
|
6397
|
-
);
|
|
6398
|
-
|
|
6399
|
-
CREATE INDEX IF NOT EXISTS idx_mesh_completion_conflicts_mesh
|
|
6400
|
-
ON mesh_completion_conflicts(mesh_id, created_at);
|
|
6476
|
+
-- MESH-COMPLEXITY-AUDIT Part 8-2: mesh_completion_conflicts removed
|
|
6477
|
+
-- (write-only fingerprint-collision diagnostic, no production reader,
|
|
6478
|
+
-- no no-loss role). Dropped in migrateMeshIsolationColumns step 6.
|
|
6401
6479
|
|
|
6402
6480
|
CREATE TABLE IF NOT EXISTS mesh_tool_call_log (
|
|
6403
6481
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
@@ -6579,6 +6657,7 @@ var init_mesh_runtime_store = __esm({
|
|
|
6579
6657
|
WHERE event_id IS NOT NULL
|
|
6580
6658
|
`);
|
|
6581
6659
|
this.db.exec(`DROP TABLE IF EXISTS mesh_direct_delivered_events`);
|
|
6660
|
+
this.db.exec(`DROP TABLE IF EXISTS mesh_completion_conflicts`);
|
|
6582
6661
|
} catch (err) {
|
|
6583
6662
|
if (!loggedMigrationFailure) {
|
|
6584
6663
|
loggedMigrationFailure = true;
|
|
@@ -6888,24 +6967,27 @@ var init_mesh_runtime_store = __esm({
|
|
|
6888
6967
|
}
|
|
6889
6968
|
const nodeIdForms = expandDaemonIdForms(nodeId);
|
|
6890
6969
|
const nodePinnedPlaceholders = nodeIdForms.map(() => "?").join(", ");
|
|
6891
|
-
const
|
|
6892
|
-
|
|
6970
|
+
const parseTier = (query, ...params) => {
|
|
6971
|
+
const tierRows = this.db.prepare(query).all(...params);
|
|
6972
|
+
return tierRows.map((row) => JSON.parse(row.payload)).sort((a, b) => meshTaskPriorityRank(b.priority) - meshTaskPriorityRank(a.priority));
|
|
6973
|
+
};
|
|
6974
|
+
const candidates = [
|
|
6975
|
+
...parseTier(`
|
|
6893
6976
|
SELECT payload FROM mesh_queue
|
|
6894
6977
|
WHERE mesh_id = ? AND status = 'pending' AND target_session_id = ?
|
|
6895
6978
|
ORDER BY created_at ASC
|
|
6896
|
-
|
|
6897
|
-
...
|
|
6979
|
+
`, meshId, sessionId),
|
|
6980
|
+
...parseTier(`
|
|
6898
6981
|
SELECT payload FROM mesh_queue
|
|
6899
6982
|
WHERE mesh_id = ? AND status = 'pending' AND target_node_id IN (${nodePinnedPlaceholders}) AND target_session_id IS NULL
|
|
6900
6983
|
ORDER BY created_at ASC
|
|
6901
|
-
|
|
6902
|
-
...
|
|
6984
|
+
`, meshId, ...nodeIdForms),
|
|
6985
|
+
...parseTier(`
|
|
6903
6986
|
SELECT payload FROM mesh_queue
|
|
6904
6987
|
WHERE mesh_id = ? AND status = 'pending' AND target_node_id IS NULL AND target_session_id IS NULL
|
|
6905
6988
|
ORDER BY created_at ASC
|
|
6906
|
-
|
|
6989
|
+
`, meshId)
|
|
6907
6990
|
];
|
|
6908
|
-
const candidates = rows.map((row) => JSON.parse(row.payload));
|
|
6909
6991
|
const depIds = [...new Set(candidates.flatMap((c) => Array.isArray(c.dependsOn) ? c.dependsOn : []))];
|
|
6910
6992
|
const depStatus = /* @__PURE__ */ new Map();
|
|
6911
6993
|
if (depIds.length > 0) {
|
|
@@ -6920,6 +7002,8 @@ var init_mesh_runtime_store = __esm({
|
|
|
6920
7002
|
if (isTaskReadonly(candidate)) return true;
|
|
6921
7003
|
return !nodeBusy;
|
|
6922
7004
|
};
|
|
7005
|
+
const claimNowMs = Date.now();
|
|
7006
|
+
const notBeforeReady = (candidate) => meshTaskNotBeforeReady(candidate, claimNowMs);
|
|
6923
7007
|
const nodeIsWorktree = opts?.nodeIsWorktree === true;
|
|
6924
7008
|
const convergenceAllows = (candidate) => candidate.taskMode !== "convergence" || !nodeIsWorktree;
|
|
6925
7009
|
const targetMatches = (candidate) => {
|
|
@@ -6929,7 +7013,7 @@ var init_mesh_runtime_store = __esm({
|
|
|
6929
7013
|
}
|
|
6930
7014
|
return true;
|
|
6931
7015
|
};
|
|
6932
|
-
const entry = candidates.find((candidate) => nodeSatisfiesRequiredTags(candidate.requiredTags, capabilityTags) && dependenciesSatisfied(candidate) && convergenceAllows(candidate) && targetMatches(candidate) && nodeConflictAllows(candidate));
|
|
7016
|
+
const entry = candidates.find((candidate) => nodeSatisfiesRequiredTags(candidate.requiredTags, capabilityTags) && dependenciesSatisfied(candidate) && notBeforeReady(candidate) && convergenceAllows(candidate) && targetMatches(candidate) && nodeConflictAllows(candidate));
|
|
6933
7017
|
if (!entry) return null;
|
|
6934
7018
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
6935
7019
|
entry.status = "assigned";
|
|
@@ -7289,43 +7373,11 @@ var init_mesh_runtime_store = __esm({
|
|
|
7289
7373
|
this.db.prepare("DELETE FROM mesh_session_delivery WHERE mesh_id = ?").run(meshId);
|
|
7290
7374
|
}
|
|
7291
7375
|
// ── Completion Conflict Diagnostics ──────────────────────────────────────
|
|
7292
|
-
recordCompletionConflict
|
|
7293
|
-
|
|
7294
|
-
|
|
7295
|
-
|
|
7296
|
-
|
|
7297
|
-
VALUES (@id, @meshId, @fingerprint, @conflictingTaskId, @conflictingSessionId,
|
|
7298
|
-
@originalTaskId, @originalSessionId, @event, @createdAt)
|
|
7299
|
-
`).run({
|
|
7300
|
-
id: entry.id,
|
|
7301
|
-
meshId: entry.meshId,
|
|
7302
|
-
fingerprint: entry.fingerprint,
|
|
7303
|
-
conflictingTaskId: entry.conflictingTaskId ?? null,
|
|
7304
|
-
conflictingSessionId: entry.conflictingSessionId ?? null,
|
|
7305
|
-
originalTaskId: entry.originalTaskId ?? null,
|
|
7306
|
-
originalSessionId: entry.originalSessionId ?? null,
|
|
7307
|
-
event: entry.event,
|
|
7308
|
-
createdAt: entry.createdAt
|
|
7309
|
-
});
|
|
7310
|
-
this.maybeCheckpointWal();
|
|
7311
|
-
}
|
|
7312
|
-
getRecentCompletionConflicts(meshId, limitMs = 60 * 60 * 1e3) {
|
|
7313
|
-
const cutoff = new Date(Date.now() - limitMs).toISOString();
|
|
7314
|
-
const rows = this.db.prepare(
|
|
7315
|
-
"SELECT * FROM mesh_completion_conflicts WHERE mesh_id = ? AND created_at >= ? ORDER BY created_at DESC LIMIT 50"
|
|
7316
|
-
).all(meshId, cutoff);
|
|
7317
|
-
return rows.map((r) => ({
|
|
7318
|
-
id: r.id,
|
|
7319
|
-
meshId: r.mesh_id,
|
|
7320
|
-
fingerprint: r.fingerprint,
|
|
7321
|
-
conflictingTaskId: r.conflicting_task_id,
|
|
7322
|
-
conflictingSessionId: r.conflicting_session_id,
|
|
7323
|
-
originalTaskId: r.original_task_id,
|
|
7324
|
-
originalSessionId: r.original_session_id,
|
|
7325
|
-
event: r.event,
|
|
7326
|
-
createdAt: r.created_at
|
|
7327
|
-
}));
|
|
7328
|
-
}
|
|
7376
|
+
// MESH-COMPLEXITY-AUDIT Part 8-2: recordCompletionConflict /
|
|
7377
|
+
// getRecentCompletionConflicts (and their mesh_completion_conflicts table)
|
|
7378
|
+
// were removed. They were a write-only diagnostic of fingerprint-dedup
|
|
7379
|
+
// collisions with no production reader and no part in the no-loss delivery
|
|
7380
|
+
// contract; the table is dropped in migrateMeshIsolationColumns (step 6).
|
|
7329
7381
|
/**
|
|
7330
7382
|
* Record a mesh tool call and check whether this mesh+tool combination is
|
|
7331
7383
|
* being called too rapidly (sliding window rate guard).
|
|
@@ -11563,7 +11615,11 @@ function ledgerRecordQuarantinedEvent(event, reason) {
|
|
|
11563
11615
|
targetCoordinatorDaemonId: event.targetCoordinatorDaemonId ?? null,
|
|
11564
11616
|
...readNonEmptyString2(event.eventId) ? { eventId: event.eventId } : {},
|
|
11565
11617
|
queuedAt: event.queuedAt,
|
|
11566
|
-
...finalSummary ? { finalSummary } : {}
|
|
11618
|
+
...finalSummary ? { finalSummary } : {},
|
|
11619
|
+
// Full original event so mesh_requeue_held_events can restore it
|
|
11620
|
+
// losslessly (event_held→pending). The summary/label fields above stay
|
|
11621
|
+
// for human-readable audit; `heldEvent` is the machine recovery copy.
|
|
11622
|
+
heldEvent: event
|
|
11567
11623
|
}
|
|
11568
11624
|
});
|
|
11569
11625
|
} catch (e) {
|
|
@@ -11874,8 +11930,11 @@ function trimPendingEventsIfNeeded(path45) {
|
|
|
11874
11930
|
nodeLabel: event.nodeLabel,
|
|
11875
11931
|
...event.workspace ? { workspace: event.workspace } : {},
|
|
11876
11932
|
targetCoordinatorDaemonId: event.targetCoordinatorDaemonId ?? null,
|
|
11933
|
+
...readNonEmptyString2(event.eventId) ? { eventId: event.eventId } : {},
|
|
11877
11934
|
queuedAt: event.queuedAt,
|
|
11878
|
-
...finalSummary ? { finalSummary } : {}
|
|
11935
|
+
...finalSummary ? { finalSummary } : {},
|
|
11936
|
+
// Full original event for lossless mesh_requeue_held_events restore.
|
|
11937
|
+
heldEvent: event
|
|
11879
11938
|
}
|
|
11880
11939
|
});
|
|
11881
11940
|
LOG.warn("MeshEvents", `Pending-events trim dropping undelivered ${event.event} for mesh ${event.meshId} \u2014 recorded to ledger (recoverable)`);
|
|
@@ -12202,6 +12261,83 @@ function getPendingMeshCoordinatorEvents(meshId, coordinatorDaemonId, opts) {
|
|
|
12202
12261
|
});
|
|
12203
12262
|
return reconcilePendingMeshCoordinatorEvents(meshId, routed);
|
|
12204
12263
|
}
|
|
12264
|
+
function readHeldTaskId(restored, payload) {
|
|
12265
|
+
const fromMeta = restored?.metadataEvent && typeof restored.metadataEvent === "object" ? readNonEmptyString2(restored.metadataEvent.taskId) : "";
|
|
12266
|
+
return fromMeta || readNonEmptyString2(payload.taskId) || "";
|
|
12267
|
+
}
|
|
12268
|
+
function requeueHeldMeshCoordinatorEvents(meshId, filter) {
|
|
12269
|
+
const result = {
|
|
12270
|
+
meshId,
|
|
12271
|
+
matched: 0,
|
|
12272
|
+
alreadyRequeued: 0,
|
|
12273
|
+
unrecoverable: 0,
|
|
12274
|
+
requeued: 0,
|
|
12275
|
+
dedupSuppressed: 0,
|
|
12276
|
+
entries: []
|
|
12277
|
+
};
|
|
12278
|
+
const all = readLedgerEntries(meshId);
|
|
12279
|
+
const requeuedIds = /* @__PURE__ */ new Set();
|
|
12280
|
+
for (const entry of all) {
|
|
12281
|
+
if (entry.kind !== "event_held_requeued") continue;
|
|
12282
|
+
const id = readNonEmptyString2(entry.payload?.heldEntryId);
|
|
12283
|
+
if (id) requeuedIds.add(id);
|
|
12284
|
+
}
|
|
12285
|
+
const sinceMs = filter?.since ? new Date(filter.since).getTime() : NaN;
|
|
12286
|
+
const wantEvent = readNonEmptyString2(filter?.event);
|
|
12287
|
+
const wantNode = readNonEmptyString2(filter?.nodeId);
|
|
12288
|
+
const wantTask = readNonEmptyString2(filter?.taskId);
|
|
12289
|
+
const wantReason = readNonEmptyString2(filter?.reason);
|
|
12290
|
+
for (const entry of all) {
|
|
12291
|
+
if (entry.kind !== "event_held") continue;
|
|
12292
|
+
const payload = entry.payload && typeof entry.payload === "object" ? entry.payload : {};
|
|
12293
|
+
if (payload.recoverable !== true) continue;
|
|
12294
|
+
const restored = payload.heldEvent && typeof payload.heldEvent === "object" ? { ...payload.heldEvent } : void 0;
|
|
12295
|
+
const eventName = restored?.event || readNonEmptyString2(payload.event);
|
|
12296
|
+
const nodeId = restored?.nodeId || entry.nodeId || readNonEmptyString2(payload.nodeId) || void 0;
|
|
12297
|
+
const taskId = readHeldTaskId(restored, payload);
|
|
12298
|
+
const reason = readNonEmptyString2(payload.reason) || void 0;
|
|
12299
|
+
if (wantEvent && eventName !== wantEvent) continue;
|
|
12300
|
+
if (wantNode && nodeId !== wantNode) continue;
|
|
12301
|
+
if (wantTask && taskId !== wantTask) continue;
|
|
12302
|
+
if (wantReason && reason !== wantReason) continue;
|
|
12303
|
+
if (filter?.since && !Number.isNaN(sinceMs) && new Date(entry.timestamp).getTime() < sinceMs) continue;
|
|
12304
|
+
result.matched++;
|
|
12305
|
+
if (requeuedIds.has(entry.id)) {
|
|
12306
|
+
result.alreadyRequeued++;
|
|
12307
|
+
result.entries.push({ heldEntryId: entry.id, event: eventName, ...nodeId ? { nodeId } : {}, ...taskId ? { taskId } : {}, ...reason ? { reason } : {}, outcome: "already_requeued" });
|
|
12308
|
+
continue;
|
|
12309
|
+
}
|
|
12310
|
+
if (!restored || !readNonEmptyString2(restored.event) || !readNonEmptyString2(restored.meshId)) {
|
|
12311
|
+
result.unrecoverable++;
|
|
12312
|
+
result.entries.push({ heldEntryId: entry.id, event: eventName, ...nodeId ? { nodeId } : {}, ...taskId ? { taskId } : {}, ...reason ? { reason } : {}, outcome: "unrecoverable" });
|
|
12313
|
+
continue;
|
|
12314
|
+
}
|
|
12315
|
+
const beforeDup = hasPendingCoordinatorEventDuplicate(restored);
|
|
12316
|
+
let ok = false;
|
|
12317
|
+
try {
|
|
12318
|
+
ok = queuePendingMeshCoordinatorEvent(restored);
|
|
12319
|
+
} catch (e) {
|
|
12320
|
+
LOG.warn("MeshEvents", `Requeue of held ${eventName} for mesh ${meshId} failed: ${e?.message || e}`);
|
|
12321
|
+
}
|
|
12322
|
+
appendLedgerEntry(meshId, {
|
|
12323
|
+
kind: "event_held_requeued",
|
|
12324
|
+
...nodeId ? { nodeId } : {},
|
|
12325
|
+
payload: {
|
|
12326
|
+
heldEntryId: entry.id,
|
|
12327
|
+
event: eventName,
|
|
12328
|
+
requeued: ok,
|
|
12329
|
+
...taskId ? { taskId } : {},
|
|
12330
|
+
...reason ? { reason } : {},
|
|
12331
|
+
...beforeDup ? { dedupSuppressed: true } : {}
|
|
12332
|
+
}
|
|
12333
|
+
});
|
|
12334
|
+
requeuedIds.add(entry.id);
|
|
12335
|
+
result.requeued++;
|
|
12336
|
+
if (beforeDup) result.dedupSuppressed++;
|
|
12337
|
+
result.entries.push({ heldEntryId: entry.id, event: eventName, ...nodeId ? { nodeId } : {}, ...taskId ? { taskId } : {}, ...reason ? { reason } : {}, outcome: "requeued" });
|
|
12338
|
+
}
|
|
12339
|
+
return result;
|
|
12340
|
+
}
|
|
12205
12341
|
function clearPendingMeshCoordinatorEvents(meshId, coordinatorDaemonId) {
|
|
12206
12342
|
if (!meshId) return;
|
|
12207
12343
|
try {
|
|
@@ -14236,7 +14372,7 @@ function driveExpiredAwaitClaim(components, meshId, task, ctx) {
|
|
|
14236
14372
|
async function maybeAutoLaunchOneQueueSession(components, meshId, mesh) {
|
|
14237
14373
|
const queue = getQueue(meshId);
|
|
14238
14374
|
const statusById = new Map(queue.map((task) => [task.id, task.status]));
|
|
14239
|
-
const pending = queue.filter((task) => task.status === "pending");
|
|
14375
|
+
const pending = queue.filter((task) => task.status === "pending").sort((a, b) => meshTaskPriorityRank(b.priority) - meshTaskPriorityRank(a.priority));
|
|
14240
14376
|
{
|
|
14241
14377
|
const pendingIds = new Set(pending.map((t) => t.id));
|
|
14242
14378
|
const prefix = `${meshId}::`;
|
|
@@ -14252,6 +14388,10 @@ async function maybeAutoLaunchOneQueueSession(components, meshId, mesh) {
|
|
|
14252
14388
|
markAutoLaunch(meshId, task.id, { status: "skipped", reason: "dependencies_unsatisfied" });
|
|
14253
14389
|
continue;
|
|
14254
14390
|
}
|
|
14391
|
+
if (!meshTaskNotBeforeReady(task)) {
|
|
14392
|
+
markAutoLaunch(meshId, task.id, { status: "skipped", reason: "not_before_delayed" });
|
|
14393
|
+
continue;
|
|
14394
|
+
}
|
|
14255
14395
|
const isReadonly = isTaskReadonly(task);
|
|
14256
14396
|
if (isReadonly) {
|
|
14257
14397
|
if (activeReadonlyAssignedCount(meshId) >= maxReadonlyParallelTasks) {
|
|
@@ -17388,15 +17528,6 @@ function isDuplicateMeshCompletionEvent(args) {
|
|
|
17388
17528
|
const fingerprint = buildMeshCompletionFingerprint(args);
|
|
17389
17529
|
if (!fingerprint) return false;
|
|
17390
17530
|
if (hasFingerprintSeen(args.meshId, fingerprint)) {
|
|
17391
|
-
if (args.taskId) {
|
|
17392
|
-
recordCompletionConflict({
|
|
17393
|
-
meshId: args.meshId,
|
|
17394
|
-
fingerprint,
|
|
17395
|
-
conflictingTaskId: args.taskId,
|
|
17396
|
-
conflictingSessionId: args.sessionId,
|
|
17397
|
-
event: args.event
|
|
17398
|
-
});
|
|
17399
|
-
}
|
|
17400
17531
|
return true;
|
|
17401
17532
|
}
|
|
17402
17533
|
recordFingerprintSeen(args.meshId, fingerprint);
|
|
@@ -18474,38 +18605,6 @@ var init_mesh_reconcile_identity = __esm({
|
|
|
18474
18605
|
}
|
|
18475
18606
|
});
|
|
18476
18607
|
|
|
18477
|
-
// src/mesh/mesh-reconcile-v2-backstop.ts
|
|
18478
|
-
function getMeshV2BackstopCounters() {
|
|
18479
|
-
return { ...meshV2BackstopCounters };
|
|
18480
|
-
}
|
|
18481
|
-
function meshProtocolV2EnforceOn() {
|
|
18482
|
-
const raw = process.env.MESH_PROTOCOL_V2_ENFORCE;
|
|
18483
|
-
if (typeof raw !== "string" || !raw.trim()) return true;
|
|
18484
|
-
const v = raw.trim().toLowerCase();
|
|
18485
|
-
return !(v === "0" || v === "false" || v === "off" || v === "no");
|
|
18486
|
-
}
|
|
18487
|
-
function recordBackstopFire(kind, detail) {
|
|
18488
|
-
meshV2BackstopCounters[kind]++;
|
|
18489
|
-
if (meshProtocolV2EnforceOn()) {
|
|
18490
|
-
LOG.warn("MeshReconcileV2", `v2 ENFORCE last-resort backstop fired (${kind}): ${detail}. Under a healthy v2 completion contract this should be 0 \u2014 a worker's real terminal emit was lost/late.`);
|
|
18491
|
-
}
|
|
18492
|
-
}
|
|
18493
|
-
var meshV2BackstopCounters;
|
|
18494
|
-
var init_mesh_reconcile_v2_backstop = __esm({
|
|
18495
|
-
"src/mesh/mesh-reconcile-v2-backstop.ts"() {
|
|
18496
|
-
"use strict";
|
|
18497
|
-
init_logger();
|
|
18498
|
-
meshV2BackstopCounters = {
|
|
18499
|
-
/** PHASE-4 transcript synthesis actually reconciled a missing completion. */
|
|
18500
|
-
phase4SynthesisFired: 0,
|
|
18501
|
-
/** Acked-hold transcript fast-track promoted a synth ahead of the death deadline. */
|
|
18502
|
-
ackedHoldFastTrackFired: 0,
|
|
18503
|
-
/** Acked-hold death-deadline backstop released a held synth (the 8-min net). */
|
|
18504
|
-
ackedHoldDeathDeadlineFired: 0
|
|
18505
|
-
};
|
|
18506
|
-
}
|
|
18507
|
-
});
|
|
18508
|
-
|
|
18509
18608
|
// src/mesh/mesh-reconcile-acked-hold.ts
|
|
18510
18609
|
function resolveTunedReconcileMs(envName, def, min, max) {
|
|
18511
18610
|
const raw = readNonEmptyString2(process.env[envName]);
|
|
@@ -18632,7 +18731,7 @@ var init_mesh_reconcile_acked_hold = __esm({
|
|
|
18632
18731
|
}
|
|
18633
18732
|
});
|
|
18634
18733
|
|
|
18635
|
-
// src/mesh/mesh-reconcile-
|
|
18734
|
+
// src/mesh/mesh-reconcile-config.ts
|
|
18636
18735
|
function resolveAutoPruneMinAgeMs() {
|
|
18637
18736
|
const raw = readNonEmptyString2(process.env.MESH_AUTO_PRUNE_MIN_AGE_MS);
|
|
18638
18737
|
if (raw) {
|
|
@@ -18652,6 +18751,432 @@ function resolveReconcileIntervalMs() {
|
|
|
18652
18751
|
}
|
|
18653
18752
|
return DEFAULT_RECONCILE_INTERVAL_MS;
|
|
18654
18753
|
}
|
|
18754
|
+
var DEFAULT_RECONCILE_INTERVAL_MS, DEFAULT_AUTO_PRUNE_MIN_AGE_MS, DEFAULT_PENDING_HELD_DRAIN_ESCALATE_MS;
|
|
18755
|
+
var init_mesh_reconcile_config = __esm({
|
|
18756
|
+
"src/mesh/mesh-reconcile-config.ts"() {
|
|
18757
|
+
"use strict";
|
|
18758
|
+
init_mesh_events_utils();
|
|
18759
|
+
init_mesh_reconcile_acked_hold();
|
|
18760
|
+
DEFAULT_RECONCILE_INTERVAL_MS = 4e3;
|
|
18761
|
+
DEFAULT_AUTO_PRUNE_MIN_AGE_MS = 24 * 60 * 6e4;
|
|
18762
|
+
DEFAULT_PENDING_HELD_DRAIN_ESCALATE_MS = 12e3;
|
|
18763
|
+
}
|
|
18764
|
+
});
|
|
18765
|
+
|
|
18766
|
+
// src/mesh/mesh-remote-event-pull.ts
|
|
18767
|
+
async function pullRemoteNodeQueues(components, mesh, localDaemonId, candidateDaemonIds) {
|
|
18768
|
+
const dispatchMeshCommand = components.dispatchMeshCommand;
|
|
18769
|
+
if (!dispatchMeshCommand) return;
|
|
18770
|
+
const meshId = mesh.id;
|
|
18771
|
+
const pulls = candidateDaemonIds.length > 0 ? candidateDaemonIds.map((id) => ({ meshId, coordinatorDaemonId: id })) : [{ meshId }];
|
|
18772
|
+
await Promise.allSettled(mesh.nodes.map(async (node) => {
|
|
18773
|
+
const nodeDaemonId = readNonEmptyString2(node.daemonId);
|
|
18774
|
+
if (!nodeDaemonId) return;
|
|
18775
|
+
if (daemonIdsEquivalent(nodeDaemonId, localDaemonId)) return;
|
|
18776
|
+
if (daemonIdListIncludes(candidateDaemonIds, nodeDaemonId)) return;
|
|
18777
|
+
const peerSnapshot = components.getMeshPeerConnectionStatus?.(nodeDaemonId);
|
|
18778
|
+
if (peerSnapshot && String(peerSnapshot.state) !== "connected") return;
|
|
18779
|
+
for (const pendingEventArgs of pulls) {
|
|
18780
|
+
let events;
|
|
18781
|
+
try {
|
|
18782
|
+
events = await dispatchMeshCommand(nodeDaemonId, "get_pending_mesh_events", pendingEventArgs);
|
|
18783
|
+
} catch {
|
|
18784
|
+
break;
|
|
18785
|
+
}
|
|
18786
|
+
const list = extractPendingEvents(events).filter((e) => readNonEmptyString2(e?.meshId) === meshId);
|
|
18787
|
+
for (const event of list) {
|
|
18788
|
+
const payload = buildForwardPayloadFromPending(event);
|
|
18789
|
+
if (!payload.event || !payload.meshId) continue;
|
|
18790
|
+
try {
|
|
18791
|
+
handleMeshForwardEvent(components, payload);
|
|
18792
|
+
} catch {
|
|
18793
|
+
}
|
|
18794
|
+
}
|
|
18795
|
+
}
|
|
18796
|
+
}));
|
|
18797
|
+
}
|
|
18798
|
+
function unwrapReadChatPayload(raw) {
|
|
18799
|
+
let cursor = raw;
|
|
18800
|
+
for (let depth = 0; depth < 4 && cursor && typeof cursor === "object"; depth++) {
|
|
18801
|
+
const record = cursor;
|
|
18802
|
+
if (Array.isArray(record.messages)) return record;
|
|
18803
|
+
if (record.payload && typeof record.payload === "object") {
|
|
18804
|
+
cursor = record.payload;
|
|
18805
|
+
continue;
|
|
18806
|
+
}
|
|
18807
|
+
if (record.result && typeof record.result === "object") {
|
|
18808
|
+
cursor = record.result;
|
|
18809
|
+
continue;
|
|
18810
|
+
}
|
|
18811
|
+
if (record.data && typeof record.data === "object") {
|
|
18812
|
+
cursor = record.data;
|
|
18813
|
+
continue;
|
|
18814
|
+
}
|
|
18815
|
+
break;
|
|
18816
|
+
}
|
|
18817
|
+
return cursor && typeof cursor === "object" ? cursor : null;
|
|
18818
|
+
}
|
|
18819
|
+
function readChatPayloadStatus(payload) {
|
|
18820
|
+
return readNonEmptyString2(payload?.status).toLowerCase();
|
|
18821
|
+
}
|
|
18822
|
+
function realTerminalEmitPendingForTask(meshId, taskId) {
|
|
18823
|
+
let pending;
|
|
18824
|
+
try {
|
|
18825
|
+
pending = getPendingMeshCoordinatorEvents(meshId);
|
|
18826
|
+
} catch {
|
|
18827
|
+
return false;
|
|
18828
|
+
}
|
|
18829
|
+
return pending.some((e) => readNonEmptyString2(e.metadataEvent?.taskId) === taskId && (e.event === "agent:generating_completed" || e.event === "agent:stopped"));
|
|
18830
|
+
}
|
|
18831
|
+
async function reprobeWorkerStatus(components, args) {
|
|
18832
|
+
try {
|
|
18833
|
+
if (args.isLocalNode) {
|
|
18834
|
+
const r = await components.commandHandler.handle("read_chat", args.readArgs);
|
|
18835
|
+
if (r && r.success === false) return null;
|
|
18836
|
+
return readChatPayloadStatus(unwrapReadChatPayload(r));
|
|
18837
|
+
}
|
|
18838
|
+
if (components.dispatchMeshCommand) {
|
|
18839
|
+
const r = await components.dispatchMeshCommand(args.nodeDaemonId, "read_chat", args.readArgs);
|
|
18840
|
+
const p = unwrapReadChatPayload(r);
|
|
18841
|
+
if (p && p.success === false) return null;
|
|
18842
|
+
return readChatPayloadStatus(p);
|
|
18843
|
+
}
|
|
18844
|
+
} catch {
|
|
18845
|
+
return null;
|
|
18846
|
+
}
|
|
18847
|
+
return null;
|
|
18848
|
+
}
|
|
18849
|
+
async function collectLiveNodesWithSessions(components, mesh, selfIds, localDaemonId) {
|
|
18850
|
+
const dispatchMeshCommand = components.dispatchMeshCommand;
|
|
18851
|
+
return Promise.all(mesh.nodes.map(async (node) => {
|
|
18852
|
+
const nodeDaemonId = readNonEmptyString2(node.daemonId);
|
|
18853
|
+
const isLocalNode = !nodeDaemonId || daemonIdListIncludes(selfIds, nodeDaemonId) || daemonIdsEquivalent(nodeDaemonId, localDaemonId);
|
|
18854
|
+
if (!isLocalNode) {
|
|
18855
|
+
const peerSnapshot = components.getMeshPeerConnectionStatus?.(nodeDaemonId);
|
|
18856
|
+
if (peerSnapshot && String(peerSnapshot.state) !== "connected") return node;
|
|
18857
|
+
}
|
|
18858
|
+
let statusResult;
|
|
18859
|
+
try {
|
|
18860
|
+
if (isLocalNode) {
|
|
18861
|
+
statusResult = await components.commandHandler.handle("get_status_metadata", {});
|
|
18862
|
+
} else if (dispatchMeshCommand) {
|
|
18863
|
+
statusResult = await dispatchMeshCommand(nodeDaemonId, "get_status_metadata", {});
|
|
18864
|
+
} else {
|
|
18865
|
+
return node;
|
|
18866
|
+
}
|
|
18867
|
+
} catch {
|
|
18868
|
+
return node;
|
|
18869
|
+
}
|
|
18870
|
+
const sessions = extractStatusMetadataSessions(statusResult);
|
|
18871
|
+
return sessions.length > 0 ? { ...node, sessions } : node;
|
|
18872
|
+
}));
|
|
18873
|
+
}
|
|
18874
|
+
function extractStatusMetadataSessions(raw) {
|
|
18875
|
+
let cursor = raw;
|
|
18876
|
+
for (let depth = 0; depth < 4 && cursor && typeof cursor === "object"; depth++) {
|
|
18877
|
+
const record = cursor;
|
|
18878
|
+
const status = record.status && typeof record.status === "object" ? record.status : void 0;
|
|
18879
|
+
if (status && Array.isArray(status.sessions)) return status.sessions;
|
|
18880
|
+
if (Array.isArray(record.sessions)) return record.sessions;
|
|
18881
|
+
if (record.payload && typeof record.payload === "object") {
|
|
18882
|
+
cursor = record.payload;
|
|
18883
|
+
continue;
|
|
18884
|
+
}
|
|
18885
|
+
if (record.result && typeof record.result === "object") {
|
|
18886
|
+
cursor = record.result;
|
|
18887
|
+
continue;
|
|
18888
|
+
}
|
|
18889
|
+
if (record.data && typeof record.data === "object") {
|
|
18890
|
+
cursor = record.data;
|
|
18891
|
+
continue;
|
|
18892
|
+
}
|
|
18893
|
+
break;
|
|
18894
|
+
}
|
|
18895
|
+
return [];
|
|
18896
|
+
}
|
|
18897
|
+
function extractPendingEvents(raw) {
|
|
18898
|
+
if (Array.isArray(raw)) return raw;
|
|
18899
|
+
if (raw && typeof raw === "object") {
|
|
18900
|
+
const events = raw.events;
|
|
18901
|
+
if (Array.isArray(events)) return events;
|
|
18902
|
+
}
|
|
18903
|
+
return [];
|
|
18904
|
+
}
|
|
18905
|
+
function buildForwardPayloadFromPending(event) {
|
|
18906
|
+
const metadata = event?.metadataEvent && typeof event.metadataEvent === "object" ? event.metadataEvent : {};
|
|
18907
|
+
return {
|
|
18908
|
+
event: readNonEmptyString2(event?.event),
|
|
18909
|
+
meshId: readNonEmptyString2(event?.meshId),
|
|
18910
|
+
nodeId: readNonEmptyString2(event?.nodeId) || readNonEmptyString2(metadata.meshNodeId),
|
|
18911
|
+
workspace: readNonEmptyString2(event?.workspace) || readNonEmptyString2(metadata.workspace),
|
|
18912
|
+
// Preserve the originating coordinator session id across the relay. It is normally
|
|
18913
|
+
// carried inside metadataEvent.meshCoordinatorSessionId (spread below), but pass the
|
|
18914
|
+
// top-level field through explicitly too so the handleMeshForwardEvent whitelist
|
|
18915
|
+
// recovers it regardless of which carrier the producing daemon used.
|
|
18916
|
+
...readNonEmptyString2(event?.targetCoordinatorSessionId) ? { targetCoordinatorSessionId: readNonEmptyString2(event.targetCoordinatorSessionId) } : {},
|
|
18917
|
+
...metadata,
|
|
18918
|
+
// NOTIF-MISS (FIX 3): surface the dispatch task id at the TOP LEVEL so the relay's
|
|
18919
|
+
// received-stage trace (and buildRelayMetadataEvent) recovers it regardless of which
|
|
18920
|
+
// carrier the producing daemon used. The metadata spread above may carry the id only as
|
|
18921
|
+
// `meshActiveTaskId` (a worker provider event), leaving top-level `taskId` unset and the
|
|
18922
|
+
// received stage rendering `task=-`. Resolve both carriers into an explicit `taskId` so
|
|
18923
|
+
// dedup stays task-scoped end-to-end. Only set when a non-empty id exists (no clobber to
|
|
18924
|
+
// undefined when neither is present).
|
|
18925
|
+
...(() => {
|
|
18926
|
+
const tid = readNonEmptyString2(metadata.taskId) || readNonEmptyString2(metadata.meshActiveTaskId);
|
|
18927
|
+
return tid ? { taskId: tid } : {};
|
|
18928
|
+
})(),
|
|
18929
|
+
// T4 (B3b): carry the v2 envelope (protocolVersion/eventId/scope/dispatchedBy/
|
|
18930
|
+
// intendedFor) across the P2P relay boundary at the TOP LEVEL. These live on the
|
|
18931
|
+
// pending event itself, not inside metadataEvent, so without this the remote pull
|
|
18932
|
+
// re-queue would re-stamp a fresh eventId — breaking cross-machine idempotency and
|
|
18933
|
+
// downgrading the relayed completion to v1 broadcast routing. Spread LAST so the
|
|
18934
|
+
// authoritative envelope always wins over any stale key the metadata spread carried.
|
|
18935
|
+
...serializeV2EnvelopeToWire(event)
|
|
18936
|
+
};
|
|
18937
|
+
}
|
|
18938
|
+
var init_mesh_remote_event_pull = __esm({
|
|
18939
|
+
"src/mesh/mesh-remote-event-pull.ts"() {
|
|
18940
|
+
"use strict";
|
|
18941
|
+
init_mesh_events_pending();
|
|
18942
|
+
init_mesh_events_coordinator();
|
|
18943
|
+
init_mesh_events_utils();
|
|
18944
|
+
init_dist();
|
|
18945
|
+
init_mesh_reconcile_identity();
|
|
18946
|
+
}
|
|
18947
|
+
});
|
|
18948
|
+
|
|
18949
|
+
// src/mesh/mesh-reconcile-v2-backstop.ts
|
|
18950
|
+
function getMeshV2BackstopCounters() {
|
|
18951
|
+
return { ...meshV2BackstopCounters };
|
|
18952
|
+
}
|
|
18953
|
+
function meshProtocolV2EnforceOn() {
|
|
18954
|
+
const raw = process.env.MESH_PROTOCOL_V2_ENFORCE;
|
|
18955
|
+
if (typeof raw !== "string" || !raw.trim()) return true;
|
|
18956
|
+
const v = raw.trim().toLowerCase();
|
|
18957
|
+
return !(v === "0" || v === "false" || v === "off" || v === "no");
|
|
18958
|
+
}
|
|
18959
|
+
function recordBackstopFire(kind, detail) {
|
|
18960
|
+
meshV2BackstopCounters[kind]++;
|
|
18961
|
+
if (meshProtocolV2EnforceOn()) {
|
|
18962
|
+
LOG.warn("MeshReconcileV2", `v2 ENFORCE last-resort backstop fired (${kind}): ${detail}. Under a healthy v2 completion contract this should be 0 \u2014 a worker's real terminal emit was lost/late.`);
|
|
18963
|
+
}
|
|
18964
|
+
}
|
|
18965
|
+
var meshV2BackstopCounters;
|
|
18966
|
+
var init_mesh_reconcile_v2_backstop = __esm({
|
|
18967
|
+
"src/mesh/mesh-reconcile-v2-backstop.ts"() {
|
|
18968
|
+
"use strict";
|
|
18969
|
+
init_logger();
|
|
18970
|
+
meshV2BackstopCounters = {
|
|
18971
|
+
/** PHASE-4 transcript synthesis actually reconciled a missing completion. */
|
|
18972
|
+
phase4SynthesisFired: 0,
|
|
18973
|
+
/** Acked-hold transcript fast-track promoted a synth ahead of the death deadline. */
|
|
18974
|
+
ackedHoldFastTrackFired: 0,
|
|
18975
|
+
/** Acked-hold death-deadline backstop released a held synth (the 8-min net). */
|
|
18976
|
+
ackedHoldDeathDeadlineFired: 0
|
|
18977
|
+
};
|
|
18978
|
+
}
|
|
18979
|
+
});
|
|
18980
|
+
|
|
18981
|
+
// src/mesh/mesh-completion-synthesis.ts
|
|
18982
|
+
async function reconcileUnterminatedDirectDispatches(components, mesh, selfIds, localDaemonId) {
|
|
18983
|
+
const dispatches = getActiveDirectDispatches(mesh.id);
|
|
18984
|
+
rehydrateAckedHoldsForMesh(mesh.id);
|
|
18985
|
+
const activeTaskKeys = new Set(
|
|
18986
|
+
dispatches.map((d) => readNonEmptyString2(d.taskId)).filter(Boolean).map((taskId) => inFlightSynthKey(mesh.id, taskId))
|
|
18987
|
+
);
|
|
18988
|
+
const heldKeys = collectHeldSynthKeysForMesh(mesh.id);
|
|
18989
|
+
for (const key2 of heldKeys) {
|
|
18990
|
+
if (!activeTaskKeys.has(key2)) deleteHoldState(key2, mesh.id);
|
|
18991
|
+
}
|
|
18992
|
+
if (dispatches.length === 0) return;
|
|
18993
|
+
const dispatchMeshCommand = components.dispatchMeshCommand;
|
|
18994
|
+
const nodeById = new Map(mesh.nodes.map((n) => [n.id, n]));
|
|
18995
|
+
for (const dispatch of dispatches) {
|
|
18996
|
+
const sessionId = readNonEmptyString2(dispatch.sessionId);
|
|
18997
|
+
const nodeId = readNonEmptyString2(dispatch.nodeId);
|
|
18998
|
+
const taskId = readNonEmptyString2(dispatch.taskId);
|
|
18999
|
+
if (!sessionId || !nodeId || !taskId) continue;
|
|
19000
|
+
const node = nodeById.get(nodeId);
|
|
19001
|
+
const nodeDaemonId = readNonEmptyString2(node?.daemonId);
|
|
19002
|
+
const isLocalNode = !nodeDaemonId || daemonIdListIncludes(selfIds, nodeDaemonId) || daemonIdsEquivalent(nodeDaemonId, localDaemonId) || !!components.instanceManager.getInstance(sessionId);
|
|
19003
|
+
const providerType = readNonEmptyString2(dispatch.providerType);
|
|
19004
|
+
const readArgs = {
|
|
19005
|
+
sessionId,
|
|
19006
|
+
targetSessionId: sessionId,
|
|
19007
|
+
tailLimit: 10,
|
|
19008
|
+
...node?.workspace ? { workspace: node.workspace } : {},
|
|
19009
|
+
...providerType ? { agentType: providerType, providerType } : {}
|
|
19010
|
+
};
|
|
19011
|
+
const synthKey = inFlightSynthKey(mesh.id, taskId);
|
|
19012
|
+
const isAcked = dispatch.status === "acked";
|
|
19013
|
+
let backstopKind;
|
|
19014
|
+
let payload = null;
|
|
19015
|
+
let readFailed = false;
|
|
19016
|
+
try {
|
|
19017
|
+
if (isLocalNode) {
|
|
19018
|
+
const result = await components.commandHandler.handle("read_chat", readArgs);
|
|
19019
|
+
if (result && result.success === false) {
|
|
19020
|
+
readFailed = true;
|
|
19021
|
+
} else {
|
|
19022
|
+
payload = unwrapReadChatPayload(result);
|
|
19023
|
+
}
|
|
19024
|
+
} else if (dispatchMeshCommand) {
|
|
19025
|
+
const result = await dispatchMeshCommand(nodeDaemonId, "read_chat", readArgs);
|
|
19026
|
+
payload = unwrapReadChatPayload(result);
|
|
19027
|
+
if (payload && payload.success === false) {
|
|
19028
|
+
payload = null;
|
|
19029
|
+
readFailed = true;
|
|
19030
|
+
}
|
|
19031
|
+
} else {
|
|
19032
|
+
continue;
|
|
19033
|
+
}
|
|
19034
|
+
} catch {
|
|
19035
|
+
readFailed = true;
|
|
19036
|
+
}
|
|
19037
|
+
if (!payload && !readFailed) continue;
|
|
19038
|
+
if (readFailed || !payload) {
|
|
19039
|
+
if (isAcked) {
|
|
19040
|
+
const prior = getHoldState(synthKey, mesh.id);
|
|
19041
|
+
const failures = (prior?.consecutiveReadFailures ?? 0) + 1;
|
|
19042
|
+
const liveConfirmedSinceAck = prior?.liveConfirmedSinceAck ?? false;
|
|
19043
|
+
setHoldState(synthKey, mesh.id, { liveConfirmedSinceAck, consecutiveReadFailures: failures });
|
|
19044
|
+
if (liveConfirmedSinceAck && failures >= ACKED_DEATH_CONSECUTIVE_READ_FAILURES) {
|
|
19045
|
+
LOG.warn("MeshReconcile", `Acked-hold death signal: task ${taskId} on node ${nodeId} (mesh ${mesh.id}) read_chat failed ${failures}x consecutively after a live-confirmed ack \u2014 worker session presumed gone mid-turn; releasing the indefinite synth hold to the stranded-reclaim / orphan-prune nets`);
|
|
19046
|
+
}
|
|
19047
|
+
}
|
|
19048
|
+
continue;
|
|
19049
|
+
}
|
|
19050
|
+
const priorHoldState = getHoldState(synthKey, mesh.id);
|
|
19051
|
+
setHoldState(synthKey, mesh.id, {
|
|
19052
|
+
liveConfirmedSinceAck: true,
|
|
19053
|
+
consecutiveReadFailures: 0,
|
|
19054
|
+
...priorHoldState?.transcriptIdleSinceMs !== void 0 ? { transcriptIdleSinceMs: priorHoldState.transcriptIdleSinceMs } : {}
|
|
19055
|
+
});
|
|
19056
|
+
const nowMs = Date.now();
|
|
19057
|
+
if (readChatPayloadStatus(payload) !== "idle") {
|
|
19058
|
+
setHoldState(synthKey, mesh.id, { liveConfirmedSinceAck: true, consecutiveReadFailures: 0 });
|
|
19059
|
+
continue;
|
|
19060
|
+
}
|
|
19061
|
+
const messages = Array.isArray(payload.messages) ? payload.messages : [];
|
|
19062
|
+
const evidence = extractFinalAssistantSummaryEvidence(messages);
|
|
19063
|
+
if (isAcked) {
|
|
19064
|
+
const ackedAtMs = Date.parse(readNonEmptyString2(dispatch.updatedAt));
|
|
19065
|
+
const sinceAckMs = Number.isFinite(ackedAtMs) ? nowMs - ackedAtMs : Number.POSITIVE_INFINITY;
|
|
19066
|
+
const deathDeadlineMs = resolveAckedDeathDeadlineMs();
|
|
19067
|
+
const holdState = getHoldState(synthKey, mesh.id);
|
|
19068
|
+
let fastTrackReady = false;
|
|
19069
|
+
if (evidence.finalSummary) {
|
|
19070
|
+
const idleSinceMs = holdState?.transcriptIdleSinceMs ?? nowMs;
|
|
19071
|
+
if (holdState && holdState.transcriptIdleSinceMs === void 0) {
|
|
19072
|
+
setHoldState(synthKey, mesh.id, { ...holdState, transcriptIdleSinceMs: idleSinceMs });
|
|
19073
|
+
}
|
|
19074
|
+
const fastTrackGraceMs = resolveAckedTranscriptFastTrackGraceMs();
|
|
19075
|
+
const idleHeldMs = nowMs - idleSinceMs;
|
|
19076
|
+
if (idleHeldMs >= fastTrackGraceMs) {
|
|
19077
|
+
fastTrackReady = true;
|
|
19078
|
+
backstopKind = "ackedHoldFastTrackFired";
|
|
19079
|
+
LOG.info("MeshReconcile", `Acked-hold transcript fast-track: task ${taskId} on node ${nodeId} (mesh ${mesh.id}) read idle WITH a final assistant message for ${Math.round(idleHeldMs / 1e3)}s continuous (grace ${Math.round(fastTrackGraceMs / 1e3)}s) \u2014 promoting the synth ahead of the ${Math.round(deathDeadlineMs / 1e3)}s death backstop; the worker's real emit was lost/late and a later one no-ops idempotently.`);
|
|
19080
|
+
}
|
|
19081
|
+
} else if (holdState?.transcriptIdleSinceMs !== void 0) {
|
|
19082
|
+
setHoldState(synthKey, mesh.id, { ...holdState, transcriptIdleSinceMs: void 0 });
|
|
19083
|
+
}
|
|
19084
|
+
if (!fastTrackReady && sinceAckMs < deathDeadlineMs) {
|
|
19085
|
+
LOG.info("MeshReconcile", `Acked-hold: task ${taskId} on node ${nodeId} (mesh ${mesh.id}) read idle ${Number.isFinite(sinceAckMs) ? Math.round(sinceAckMs / 1e3) + "s" : "\u221E"} since the generating_started ack \u2014 HOLDING synth (worker presumed alive; a later real emit is idempotent). Transcript fast-track promotes at ${Math.round(resolveAckedTranscriptFastTrackGraceMs() / 1e3)}s continuous idle-with-final-assistant; death backstop at ${Math.round(deathDeadlineMs / 1e3)}s or on consecutive read failures.`);
|
|
19086
|
+
continue;
|
|
19087
|
+
}
|
|
19088
|
+
if (!fastTrackReady) {
|
|
19089
|
+
backstopKind = "ackedHoldDeathDeadlineFired";
|
|
19090
|
+
LOG.warn("MeshReconcile", `Acked-hold death deadline reached: task ${taskId} on node ${nodeId} (mesh ${mesh.id}) still idle ${Math.round(sinceAckMs / 1e3)}s after the ack (deadline ${Math.round(deathDeadlineMs / 1e3)}s) \u2014 synthesizing the missing completion as a notification-loss net (a real emit, if it ever lands, no-ops idempotently).`);
|
|
19091
|
+
}
|
|
19092
|
+
}
|
|
19093
|
+
if (realTerminalEmitPendingForTask(mesh.id, taskId)) {
|
|
19094
|
+
deleteHoldState(synthKey, mesh.id);
|
|
19095
|
+
LOG.info("MeshReconcile", `Worker-emit priority: task ${taskId} on node ${nodeId} (mesh ${mesh.id}) has a real terminal completion already queued \u2014 yielding synth to the worker's own emit`);
|
|
19096
|
+
continue;
|
|
19097
|
+
}
|
|
19098
|
+
if (!evidence.finalSummary) continue;
|
|
19099
|
+
const dispatchedAtMs = Date.parse(readNonEmptyString2(dispatch.dispatchedAt));
|
|
19100
|
+
const transcriptAtMs = Date.parse(evidence.transcriptMessageAt ?? "");
|
|
19101
|
+
if (Number.isFinite(dispatchedAtMs) && Number.isFinite(transcriptAtMs) && transcriptAtMs < dispatchedAtMs) {
|
|
19102
|
+
LOG.info("MeshReconcile", `Stale-summary guard: skipping transcript reconcile for task ${taskId} on node ${nodeId} (mesh ${mesh.id}) \u2014 final assistant message (${evidence.transcriptMessageAt}) predates this task's dispatch (${dispatch.dispatchedAt}); it is a prior task's summary`);
|
|
19103
|
+
traceMeshEventDrop("reconcile_stale_summary_before_dispatch", {
|
|
19104
|
+
taskId,
|
|
19105
|
+
sessionId,
|
|
19106
|
+
nodeId,
|
|
19107
|
+
meshId: mesh.id,
|
|
19108
|
+
event: "agent:generating_completed"
|
|
19109
|
+
}, `transcriptAt=${evidence.transcriptMessageAt} < dispatchedAt=${dispatch.dispatchedAt}`);
|
|
19110
|
+
continue;
|
|
19111
|
+
}
|
|
19112
|
+
const reprobeStatus = await reprobeWorkerStatus(components, { isLocalNode, nodeDaemonId, readArgs });
|
|
19113
|
+
if (reprobeStatus && reprobeStatus !== "idle") {
|
|
19114
|
+
deleteHoldState(synthKey, mesh.id);
|
|
19115
|
+
LOG.info("MeshReconcile", `Live re-probe defer: task ${taskId} on node ${nodeId} (mesh ${mesh.id}) read '${reprobeStatus}' at synth-commit time \u2014 worker resumed generating; deferring synth to a later tick`);
|
|
19116
|
+
continue;
|
|
19117
|
+
}
|
|
19118
|
+
const providerSessionId = readNonEmptyString2(payload.providerSessionId);
|
|
19119
|
+
const coordinatorDaemonId = selfIds.find((id) => !!id);
|
|
19120
|
+
try {
|
|
19121
|
+
const result = reconcileDirectDispatchCompletionFromTranscript({
|
|
19122
|
+
meshId: mesh.id,
|
|
19123
|
+
nodeId,
|
|
19124
|
+
sessionId,
|
|
19125
|
+
providerType: providerType || void 0,
|
|
19126
|
+
providerSessionId: providerSessionId || void 0,
|
|
19127
|
+
taskId,
|
|
19128
|
+
finalSummary: evidence.finalSummary,
|
|
19129
|
+
...evidence.transcriptMessageAt ? { transcriptMessageAt: evidence.transcriptMessageAt } : {},
|
|
19130
|
+
...coordinatorDaemonId ? { targetCoordinatorDaemonId: coordinatorDaemonId } : {},
|
|
19131
|
+
source: "daemon_reconcile_transcript_completion"
|
|
19132
|
+
});
|
|
19133
|
+
if (result.reconciled) {
|
|
19134
|
+
recordBackstopFire(backstopKind ?? "phase4SynthesisFired", `task ${taskId} on node ${nodeId} (mesh ${mesh.id}), kind=${result.kind}`);
|
|
19135
|
+
LOG.info("MeshReconcile", `Synthesized missing completion (${result.kind}) for task ${taskId} on node ${nodeId} (mesh ${mesh.id})`);
|
|
19136
|
+
}
|
|
19137
|
+
} catch (e) {
|
|
19138
|
+
LOG.warn("MeshReconcile", `Transcript completion reconcile threw for task ${taskId}: ${e?.message || e}`);
|
|
19139
|
+
}
|
|
19140
|
+
}
|
|
19141
|
+
}
|
|
19142
|
+
async function autoPruneStaleDirectDispatches(components, mesh, selfIds, localDaemonId, minAgeMs) {
|
|
19143
|
+
const directDispatches = getActiveDirectDispatches(mesh.id);
|
|
19144
|
+
if (directDispatches.length === 0) return;
|
|
19145
|
+
const liveNodes = await collectLiveNodesWithSessions(components, mesh, selfIds, localDaemonId);
|
|
19146
|
+
const result = pruneStaleDirectDispatches({
|
|
19147
|
+
meshId: mesh.id,
|
|
19148
|
+
queue: getQueue(mesh.id),
|
|
19149
|
+
ledgerEntries: readLedgerEntries(mesh.id, { tail: 500 }),
|
|
19150
|
+
directDispatches,
|
|
19151
|
+
nodes: liveNodes,
|
|
19152
|
+
execute: true,
|
|
19153
|
+
minAgeMs,
|
|
19154
|
+
source: "daemon_reconcile_auto_prune"
|
|
19155
|
+
});
|
|
19156
|
+
if (result.prunedCount > 0) {
|
|
19157
|
+
LOG.info("MeshReconcile", `Auto-pruned ${result.prunedCount} orphaned direct dispatch record(s) for mesh ${mesh.id}`);
|
|
19158
|
+
}
|
|
19159
|
+
}
|
|
19160
|
+
var init_mesh_completion_synthesis = __esm({
|
|
19161
|
+
"src/mesh/mesh-completion-synthesis.ts"() {
|
|
19162
|
+
"use strict";
|
|
19163
|
+
init_logger();
|
|
19164
|
+
init_mesh_events_utils();
|
|
19165
|
+
init_mesh_event_trace();
|
|
19166
|
+
init_dist();
|
|
19167
|
+
init_mesh_reconcile_identity();
|
|
19168
|
+
init_mesh_work_queue();
|
|
19169
|
+
init_mesh_ledger();
|
|
19170
|
+
init_mesh_active_work();
|
|
19171
|
+
init_mesh_events_stale();
|
|
19172
|
+
init_chat_message_normalization();
|
|
19173
|
+
init_mesh_reconcile_v2_backstop();
|
|
19174
|
+
init_mesh_reconcile_acked_hold();
|
|
19175
|
+
init_mesh_remote_event_pull();
|
|
19176
|
+
}
|
|
19177
|
+
});
|
|
19178
|
+
|
|
19179
|
+
// src/mesh/mesh-reconcile-loop.ts
|
|
18655
19180
|
function findLiveCoordinators(components) {
|
|
18656
19181
|
const out = [];
|
|
18657
19182
|
for (const inst of components.instanceManager.getByCategory("cli")) {
|
|
@@ -19330,355 +19855,6 @@ async function retryUnresolvedDelegateForwards(components) {
|
|
|
19330
19855
|
LOG.info("MeshReconcile", `Retried+delivered unresolved-delegate ${readNonEmptyString2(entry.payload.event)} to coordinator ${entry.coordinatorDaemonId}`);
|
|
19331
19856
|
}
|
|
19332
19857
|
}
|
|
19333
|
-
async function pullRemoteNodeQueues(components, mesh, localDaemonId, candidateDaemonIds) {
|
|
19334
|
-
const dispatchMeshCommand = components.dispatchMeshCommand;
|
|
19335
|
-
if (!dispatchMeshCommand) return;
|
|
19336
|
-
const meshId = mesh.id;
|
|
19337
|
-
const pulls = candidateDaemonIds.length > 0 ? candidateDaemonIds.map((id) => ({ meshId, coordinatorDaemonId: id })) : [{ meshId }];
|
|
19338
|
-
await Promise.allSettled(mesh.nodes.map(async (node) => {
|
|
19339
|
-
const nodeDaemonId = readNonEmptyString2(node.daemonId);
|
|
19340
|
-
if (!nodeDaemonId) return;
|
|
19341
|
-
if (daemonIdsEquivalent(nodeDaemonId, localDaemonId)) return;
|
|
19342
|
-
if (daemonIdListIncludes(candidateDaemonIds, nodeDaemonId)) return;
|
|
19343
|
-
const peerSnapshot = components.getMeshPeerConnectionStatus?.(nodeDaemonId);
|
|
19344
|
-
if (peerSnapshot && String(peerSnapshot.state) !== "connected") return;
|
|
19345
|
-
for (const pendingEventArgs of pulls) {
|
|
19346
|
-
let events;
|
|
19347
|
-
try {
|
|
19348
|
-
events = await dispatchMeshCommand(nodeDaemonId, "get_pending_mesh_events", pendingEventArgs);
|
|
19349
|
-
} catch {
|
|
19350
|
-
break;
|
|
19351
|
-
}
|
|
19352
|
-
const list = extractPendingEvents(events).filter((e) => readNonEmptyString2(e?.meshId) === meshId);
|
|
19353
|
-
for (const event of list) {
|
|
19354
|
-
const payload = buildForwardPayloadFromPending(event);
|
|
19355
|
-
if (!payload.event || !payload.meshId) continue;
|
|
19356
|
-
try {
|
|
19357
|
-
handleMeshForwardEvent(components, payload);
|
|
19358
|
-
} catch {
|
|
19359
|
-
}
|
|
19360
|
-
}
|
|
19361
|
-
}
|
|
19362
|
-
}));
|
|
19363
|
-
}
|
|
19364
|
-
function unwrapReadChatPayload(raw) {
|
|
19365
|
-
let cursor = raw;
|
|
19366
|
-
for (let depth = 0; depth < 4 && cursor && typeof cursor === "object"; depth++) {
|
|
19367
|
-
const record = cursor;
|
|
19368
|
-
if (Array.isArray(record.messages)) return record;
|
|
19369
|
-
if (record.payload && typeof record.payload === "object") {
|
|
19370
|
-
cursor = record.payload;
|
|
19371
|
-
continue;
|
|
19372
|
-
}
|
|
19373
|
-
if (record.result && typeof record.result === "object") {
|
|
19374
|
-
cursor = record.result;
|
|
19375
|
-
continue;
|
|
19376
|
-
}
|
|
19377
|
-
if (record.data && typeof record.data === "object") {
|
|
19378
|
-
cursor = record.data;
|
|
19379
|
-
continue;
|
|
19380
|
-
}
|
|
19381
|
-
break;
|
|
19382
|
-
}
|
|
19383
|
-
return cursor && typeof cursor === "object" ? cursor : null;
|
|
19384
|
-
}
|
|
19385
|
-
function readChatPayloadStatus(payload) {
|
|
19386
|
-
return readNonEmptyString2(payload?.status).toLowerCase();
|
|
19387
|
-
}
|
|
19388
|
-
function realTerminalEmitPendingForTask(meshId, taskId) {
|
|
19389
|
-
let pending;
|
|
19390
|
-
try {
|
|
19391
|
-
pending = getPendingMeshCoordinatorEvents(meshId);
|
|
19392
|
-
} catch {
|
|
19393
|
-
return false;
|
|
19394
|
-
}
|
|
19395
|
-
return pending.some((e) => readNonEmptyString2(e.metadataEvent?.taskId) === taskId && (e.event === "agent:generating_completed" || e.event === "agent:stopped"));
|
|
19396
|
-
}
|
|
19397
|
-
async function reprobeWorkerStatus(components, args) {
|
|
19398
|
-
try {
|
|
19399
|
-
if (args.isLocalNode) {
|
|
19400
|
-
const r = await components.commandHandler.handle("read_chat", args.readArgs);
|
|
19401
|
-
if (r && r.success === false) return null;
|
|
19402
|
-
return readChatPayloadStatus(unwrapReadChatPayload(r));
|
|
19403
|
-
}
|
|
19404
|
-
if (components.dispatchMeshCommand) {
|
|
19405
|
-
const r = await components.dispatchMeshCommand(args.nodeDaemonId, "read_chat", args.readArgs);
|
|
19406
|
-
const p = unwrapReadChatPayload(r);
|
|
19407
|
-
if (p && p.success === false) return null;
|
|
19408
|
-
return readChatPayloadStatus(p);
|
|
19409
|
-
}
|
|
19410
|
-
} catch {
|
|
19411
|
-
return null;
|
|
19412
|
-
}
|
|
19413
|
-
return null;
|
|
19414
|
-
}
|
|
19415
|
-
async function reconcileUnterminatedDirectDispatches(components, mesh, selfIds, localDaemonId) {
|
|
19416
|
-
const dispatches = getActiveDirectDispatches(mesh.id);
|
|
19417
|
-
rehydrateAckedHoldsForMesh(mesh.id);
|
|
19418
|
-
const activeTaskKeys = new Set(
|
|
19419
|
-
dispatches.map((d) => readNonEmptyString2(d.taskId)).filter(Boolean).map((taskId) => inFlightSynthKey(mesh.id, taskId))
|
|
19420
|
-
);
|
|
19421
|
-
const heldKeys = collectHeldSynthKeysForMesh(mesh.id);
|
|
19422
|
-
for (const key2 of heldKeys) {
|
|
19423
|
-
if (!activeTaskKeys.has(key2)) deleteHoldState(key2, mesh.id);
|
|
19424
|
-
}
|
|
19425
|
-
if (dispatches.length === 0) return;
|
|
19426
|
-
const dispatchMeshCommand = components.dispatchMeshCommand;
|
|
19427
|
-
const nodeById = new Map(mesh.nodes.map((n) => [n.id, n]));
|
|
19428
|
-
for (const dispatch of dispatches) {
|
|
19429
|
-
const sessionId = readNonEmptyString2(dispatch.sessionId);
|
|
19430
|
-
const nodeId = readNonEmptyString2(dispatch.nodeId);
|
|
19431
|
-
const taskId = readNonEmptyString2(dispatch.taskId);
|
|
19432
|
-
if (!sessionId || !nodeId || !taskId) continue;
|
|
19433
|
-
const node = nodeById.get(nodeId);
|
|
19434
|
-
const nodeDaemonId = readNonEmptyString2(node?.daemonId);
|
|
19435
|
-
const isLocalNode = !nodeDaemonId || daemonIdListIncludes(selfIds, nodeDaemonId) || daemonIdsEquivalent(nodeDaemonId, localDaemonId) || !!components.instanceManager.getInstance(sessionId);
|
|
19436
|
-
const providerType = readNonEmptyString2(dispatch.providerType);
|
|
19437
|
-
const readArgs = {
|
|
19438
|
-
sessionId,
|
|
19439
|
-
targetSessionId: sessionId,
|
|
19440
|
-
tailLimit: 10,
|
|
19441
|
-
...node?.workspace ? { workspace: node.workspace } : {},
|
|
19442
|
-
...providerType ? { agentType: providerType, providerType } : {}
|
|
19443
|
-
};
|
|
19444
|
-
const synthKey = inFlightSynthKey(mesh.id, taskId);
|
|
19445
|
-
const isAcked = dispatch.status === "acked";
|
|
19446
|
-
let backstopKind;
|
|
19447
|
-
let payload = null;
|
|
19448
|
-
let readFailed = false;
|
|
19449
|
-
try {
|
|
19450
|
-
if (isLocalNode) {
|
|
19451
|
-
const result = await components.commandHandler.handle("read_chat", readArgs);
|
|
19452
|
-
if (result && result.success === false) {
|
|
19453
|
-
readFailed = true;
|
|
19454
|
-
} else {
|
|
19455
|
-
payload = unwrapReadChatPayload(result);
|
|
19456
|
-
}
|
|
19457
|
-
} else if (dispatchMeshCommand) {
|
|
19458
|
-
const result = await dispatchMeshCommand(nodeDaemonId, "read_chat", readArgs);
|
|
19459
|
-
payload = unwrapReadChatPayload(result);
|
|
19460
|
-
if (payload && payload.success === false) {
|
|
19461
|
-
payload = null;
|
|
19462
|
-
readFailed = true;
|
|
19463
|
-
}
|
|
19464
|
-
} else {
|
|
19465
|
-
continue;
|
|
19466
|
-
}
|
|
19467
|
-
} catch {
|
|
19468
|
-
readFailed = true;
|
|
19469
|
-
}
|
|
19470
|
-
if (!payload && !readFailed) continue;
|
|
19471
|
-
if (readFailed || !payload) {
|
|
19472
|
-
if (isAcked) {
|
|
19473
|
-
const prior = getHoldState(synthKey, mesh.id);
|
|
19474
|
-
const failures = (prior?.consecutiveReadFailures ?? 0) + 1;
|
|
19475
|
-
const liveConfirmedSinceAck = prior?.liveConfirmedSinceAck ?? false;
|
|
19476
|
-
setHoldState(synthKey, mesh.id, { liveConfirmedSinceAck, consecutiveReadFailures: failures });
|
|
19477
|
-
if (liveConfirmedSinceAck && failures >= ACKED_DEATH_CONSECUTIVE_READ_FAILURES) {
|
|
19478
|
-
LOG.warn("MeshReconcile", `Acked-hold death signal: task ${taskId} on node ${nodeId} (mesh ${mesh.id}) read_chat failed ${failures}x consecutively after a live-confirmed ack \u2014 worker session presumed gone mid-turn; releasing the indefinite synth hold to the stranded-reclaim / orphan-prune nets`);
|
|
19479
|
-
}
|
|
19480
|
-
}
|
|
19481
|
-
continue;
|
|
19482
|
-
}
|
|
19483
|
-
const priorHoldState = getHoldState(synthKey, mesh.id);
|
|
19484
|
-
setHoldState(synthKey, mesh.id, {
|
|
19485
|
-
liveConfirmedSinceAck: true,
|
|
19486
|
-
consecutiveReadFailures: 0,
|
|
19487
|
-
...priorHoldState?.transcriptIdleSinceMs !== void 0 ? { transcriptIdleSinceMs: priorHoldState.transcriptIdleSinceMs } : {}
|
|
19488
|
-
});
|
|
19489
|
-
const nowMs = Date.now();
|
|
19490
|
-
if (readChatPayloadStatus(payload) !== "idle") {
|
|
19491
|
-
setHoldState(synthKey, mesh.id, { liveConfirmedSinceAck: true, consecutiveReadFailures: 0 });
|
|
19492
|
-
continue;
|
|
19493
|
-
}
|
|
19494
|
-
const messages = Array.isArray(payload.messages) ? payload.messages : [];
|
|
19495
|
-
const evidence = extractFinalAssistantSummaryEvidence(messages);
|
|
19496
|
-
if (isAcked) {
|
|
19497
|
-
const ackedAtMs = Date.parse(readNonEmptyString2(dispatch.updatedAt));
|
|
19498
|
-
const sinceAckMs = Number.isFinite(ackedAtMs) ? nowMs - ackedAtMs : Number.POSITIVE_INFINITY;
|
|
19499
|
-
const deathDeadlineMs = resolveAckedDeathDeadlineMs();
|
|
19500
|
-
const holdState = getHoldState(synthKey, mesh.id);
|
|
19501
|
-
let fastTrackReady = false;
|
|
19502
|
-
if (evidence.finalSummary) {
|
|
19503
|
-
const idleSinceMs = holdState?.transcriptIdleSinceMs ?? nowMs;
|
|
19504
|
-
if (holdState && holdState.transcriptIdleSinceMs === void 0) {
|
|
19505
|
-
setHoldState(synthKey, mesh.id, { ...holdState, transcriptIdleSinceMs: idleSinceMs });
|
|
19506
|
-
}
|
|
19507
|
-
const fastTrackGraceMs = resolveAckedTranscriptFastTrackGraceMs();
|
|
19508
|
-
const idleHeldMs = nowMs - idleSinceMs;
|
|
19509
|
-
if (idleHeldMs >= fastTrackGraceMs) {
|
|
19510
|
-
fastTrackReady = true;
|
|
19511
|
-
backstopKind = "ackedHoldFastTrackFired";
|
|
19512
|
-
LOG.info("MeshReconcile", `Acked-hold transcript fast-track: task ${taskId} on node ${nodeId} (mesh ${mesh.id}) read idle WITH a final assistant message for ${Math.round(idleHeldMs / 1e3)}s continuous (grace ${Math.round(fastTrackGraceMs / 1e3)}s) \u2014 promoting the synth ahead of the ${Math.round(deathDeadlineMs / 1e3)}s death backstop; the worker's real emit was lost/late and a later one no-ops idempotently.`);
|
|
19513
|
-
}
|
|
19514
|
-
} else if (holdState?.transcriptIdleSinceMs !== void 0) {
|
|
19515
|
-
setHoldState(synthKey, mesh.id, { ...holdState, transcriptIdleSinceMs: void 0 });
|
|
19516
|
-
}
|
|
19517
|
-
if (!fastTrackReady && sinceAckMs < deathDeadlineMs) {
|
|
19518
|
-
LOG.info("MeshReconcile", `Acked-hold: task ${taskId} on node ${nodeId} (mesh ${mesh.id}) read idle ${Number.isFinite(sinceAckMs) ? Math.round(sinceAckMs / 1e3) + "s" : "\u221E"} since the generating_started ack \u2014 HOLDING synth (worker presumed alive; a later real emit is idempotent). Transcript fast-track promotes at ${Math.round(resolveAckedTranscriptFastTrackGraceMs() / 1e3)}s continuous idle-with-final-assistant; death backstop at ${Math.round(deathDeadlineMs / 1e3)}s or on consecutive read failures.`);
|
|
19519
|
-
continue;
|
|
19520
|
-
}
|
|
19521
|
-
if (!fastTrackReady) {
|
|
19522
|
-
backstopKind = "ackedHoldDeathDeadlineFired";
|
|
19523
|
-
LOG.warn("MeshReconcile", `Acked-hold death deadline reached: task ${taskId} on node ${nodeId} (mesh ${mesh.id}) still idle ${Math.round(sinceAckMs / 1e3)}s after the ack (deadline ${Math.round(deathDeadlineMs / 1e3)}s) \u2014 synthesizing the missing completion as a notification-loss net (a real emit, if it ever lands, no-ops idempotently).`);
|
|
19524
|
-
}
|
|
19525
|
-
}
|
|
19526
|
-
if (realTerminalEmitPendingForTask(mesh.id, taskId)) {
|
|
19527
|
-
deleteHoldState(synthKey, mesh.id);
|
|
19528
|
-
LOG.info("MeshReconcile", `Worker-emit priority: task ${taskId} on node ${nodeId} (mesh ${mesh.id}) has a real terminal completion already queued \u2014 yielding synth to the worker's own emit`);
|
|
19529
|
-
continue;
|
|
19530
|
-
}
|
|
19531
|
-
if (!evidence.finalSummary) continue;
|
|
19532
|
-
const dispatchedAtMs = Date.parse(readNonEmptyString2(dispatch.dispatchedAt));
|
|
19533
|
-
const transcriptAtMs = Date.parse(evidence.transcriptMessageAt ?? "");
|
|
19534
|
-
if (Number.isFinite(dispatchedAtMs) && Number.isFinite(transcriptAtMs) && transcriptAtMs < dispatchedAtMs) {
|
|
19535
|
-
LOG.info("MeshReconcile", `Stale-summary guard: skipping transcript reconcile for task ${taskId} on node ${nodeId} (mesh ${mesh.id}) \u2014 final assistant message (${evidence.transcriptMessageAt}) predates this task's dispatch (${dispatch.dispatchedAt}); it is a prior task's summary`);
|
|
19536
|
-
traceMeshEventDrop("reconcile_stale_summary_before_dispatch", {
|
|
19537
|
-
taskId,
|
|
19538
|
-
sessionId,
|
|
19539
|
-
nodeId,
|
|
19540
|
-
meshId: mesh.id,
|
|
19541
|
-
event: "agent:generating_completed"
|
|
19542
|
-
}, `transcriptAt=${evidence.transcriptMessageAt} < dispatchedAt=${dispatch.dispatchedAt}`);
|
|
19543
|
-
continue;
|
|
19544
|
-
}
|
|
19545
|
-
const reprobeStatus = await reprobeWorkerStatus(components, { isLocalNode, nodeDaemonId, readArgs });
|
|
19546
|
-
if (reprobeStatus && reprobeStatus !== "idle") {
|
|
19547
|
-
deleteHoldState(synthKey, mesh.id);
|
|
19548
|
-
LOG.info("MeshReconcile", `Live re-probe defer: task ${taskId} on node ${nodeId} (mesh ${mesh.id}) read '${reprobeStatus}' at synth-commit time \u2014 worker resumed generating; deferring synth to a later tick`);
|
|
19549
|
-
continue;
|
|
19550
|
-
}
|
|
19551
|
-
const providerSessionId = readNonEmptyString2(payload.providerSessionId);
|
|
19552
|
-
const coordinatorDaemonId = selfIds.find((id) => !!id);
|
|
19553
|
-
try {
|
|
19554
|
-
const result = reconcileDirectDispatchCompletionFromTranscript({
|
|
19555
|
-
meshId: mesh.id,
|
|
19556
|
-
nodeId,
|
|
19557
|
-
sessionId,
|
|
19558
|
-
providerType: providerType || void 0,
|
|
19559
|
-
providerSessionId: providerSessionId || void 0,
|
|
19560
|
-
taskId,
|
|
19561
|
-
finalSummary: evidence.finalSummary,
|
|
19562
|
-
...evidence.transcriptMessageAt ? { transcriptMessageAt: evidence.transcriptMessageAt } : {},
|
|
19563
|
-
...coordinatorDaemonId ? { targetCoordinatorDaemonId: coordinatorDaemonId } : {},
|
|
19564
|
-
source: "daemon_reconcile_transcript_completion"
|
|
19565
|
-
});
|
|
19566
|
-
if (result.reconciled) {
|
|
19567
|
-
recordBackstopFire(backstopKind ?? "phase4SynthesisFired", `task ${taskId} on node ${nodeId} (mesh ${mesh.id}), kind=${result.kind}`);
|
|
19568
|
-
LOG.info("MeshReconcile", `Synthesized missing completion (${result.kind}) for task ${taskId} on node ${nodeId} (mesh ${mesh.id})`);
|
|
19569
|
-
}
|
|
19570
|
-
} catch (e) {
|
|
19571
|
-
LOG.warn("MeshReconcile", `Transcript completion reconcile threw for task ${taskId}: ${e?.message || e}`);
|
|
19572
|
-
}
|
|
19573
|
-
}
|
|
19574
|
-
}
|
|
19575
|
-
async function autoPruneStaleDirectDispatches(components, mesh, selfIds, localDaemonId, minAgeMs) {
|
|
19576
|
-
const directDispatches = getActiveDirectDispatches(mesh.id);
|
|
19577
|
-
if (directDispatches.length === 0) return;
|
|
19578
|
-
const liveNodes = await collectLiveNodesWithSessions(components, mesh, selfIds, localDaemonId);
|
|
19579
|
-
const result = pruneStaleDirectDispatches({
|
|
19580
|
-
meshId: mesh.id,
|
|
19581
|
-
queue: getQueue(mesh.id),
|
|
19582
|
-
ledgerEntries: readLedgerEntries(mesh.id, { tail: 500 }),
|
|
19583
|
-
directDispatches,
|
|
19584
|
-
nodes: liveNodes,
|
|
19585
|
-
execute: true,
|
|
19586
|
-
minAgeMs,
|
|
19587
|
-
source: "daemon_reconcile_auto_prune"
|
|
19588
|
-
});
|
|
19589
|
-
if (result.prunedCount > 0) {
|
|
19590
|
-
LOG.info("MeshReconcile", `Auto-pruned ${result.prunedCount} orphaned direct dispatch record(s) for mesh ${mesh.id}`);
|
|
19591
|
-
}
|
|
19592
|
-
}
|
|
19593
|
-
async function collectLiveNodesWithSessions(components, mesh, selfIds, localDaemonId) {
|
|
19594
|
-
const dispatchMeshCommand = components.dispatchMeshCommand;
|
|
19595
|
-
return Promise.all(mesh.nodes.map(async (node) => {
|
|
19596
|
-
const nodeDaemonId = readNonEmptyString2(node.daemonId);
|
|
19597
|
-
const isLocalNode = !nodeDaemonId || daemonIdListIncludes(selfIds, nodeDaemonId) || daemonIdsEquivalent(nodeDaemonId, localDaemonId);
|
|
19598
|
-
if (!isLocalNode) {
|
|
19599
|
-
const peerSnapshot = components.getMeshPeerConnectionStatus?.(nodeDaemonId);
|
|
19600
|
-
if (peerSnapshot && String(peerSnapshot.state) !== "connected") return node;
|
|
19601
|
-
}
|
|
19602
|
-
let statusResult;
|
|
19603
|
-
try {
|
|
19604
|
-
if (isLocalNode) {
|
|
19605
|
-
statusResult = await components.commandHandler.handle("get_status_metadata", {});
|
|
19606
|
-
} else if (dispatchMeshCommand) {
|
|
19607
|
-
statusResult = await dispatchMeshCommand(nodeDaemonId, "get_status_metadata", {});
|
|
19608
|
-
} else {
|
|
19609
|
-
return node;
|
|
19610
|
-
}
|
|
19611
|
-
} catch {
|
|
19612
|
-
return node;
|
|
19613
|
-
}
|
|
19614
|
-
const sessions = extractStatusMetadataSessions(statusResult);
|
|
19615
|
-
return sessions.length > 0 ? { ...node, sessions } : node;
|
|
19616
|
-
}));
|
|
19617
|
-
}
|
|
19618
|
-
function extractStatusMetadataSessions(raw) {
|
|
19619
|
-
let cursor = raw;
|
|
19620
|
-
for (let depth = 0; depth < 4 && cursor && typeof cursor === "object"; depth++) {
|
|
19621
|
-
const record = cursor;
|
|
19622
|
-
const status = record.status && typeof record.status === "object" ? record.status : void 0;
|
|
19623
|
-
if (status && Array.isArray(status.sessions)) return status.sessions;
|
|
19624
|
-
if (Array.isArray(record.sessions)) return record.sessions;
|
|
19625
|
-
if (record.payload && typeof record.payload === "object") {
|
|
19626
|
-
cursor = record.payload;
|
|
19627
|
-
continue;
|
|
19628
|
-
}
|
|
19629
|
-
if (record.result && typeof record.result === "object") {
|
|
19630
|
-
cursor = record.result;
|
|
19631
|
-
continue;
|
|
19632
|
-
}
|
|
19633
|
-
if (record.data && typeof record.data === "object") {
|
|
19634
|
-
cursor = record.data;
|
|
19635
|
-
continue;
|
|
19636
|
-
}
|
|
19637
|
-
break;
|
|
19638
|
-
}
|
|
19639
|
-
return [];
|
|
19640
|
-
}
|
|
19641
|
-
function extractPendingEvents(raw) {
|
|
19642
|
-
if (Array.isArray(raw)) return raw;
|
|
19643
|
-
if (raw && typeof raw === "object") {
|
|
19644
|
-
const events = raw.events;
|
|
19645
|
-
if (Array.isArray(events)) return events;
|
|
19646
|
-
}
|
|
19647
|
-
return [];
|
|
19648
|
-
}
|
|
19649
|
-
function buildForwardPayloadFromPending(event) {
|
|
19650
|
-
const metadata = event?.metadataEvent && typeof event.metadataEvent === "object" ? event.metadataEvent : {};
|
|
19651
|
-
return {
|
|
19652
|
-
event: readNonEmptyString2(event?.event),
|
|
19653
|
-
meshId: readNonEmptyString2(event?.meshId),
|
|
19654
|
-
nodeId: readNonEmptyString2(event?.nodeId) || readNonEmptyString2(metadata.meshNodeId),
|
|
19655
|
-
workspace: readNonEmptyString2(event?.workspace) || readNonEmptyString2(metadata.workspace),
|
|
19656
|
-
// Preserve the originating coordinator session id across the relay. It is normally
|
|
19657
|
-
// carried inside metadataEvent.meshCoordinatorSessionId (spread below), but pass the
|
|
19658
|
-
// top-level field through explicitly too so the handleMeshForwardEvent whitelist
|
|
19659
|
-
// recovers it regardless of which carrier the producing daemon used.
|
|
19660
|
-
...readNonEmptyString2(event?.targetCoordinatorSessionId) ? { targetCoordinatorSessionId: readNonEmptyString2(event.targetCoordinatorSessionId) } : {},
|
|
19661
|
-
...metadata,
|
|
19662
|
-
// NOTIF-MISS (FIX 3): surface the dispatch task id at the TOP LEVEL so the relay's
|
|
19663
|
-
// received-stage trace (and buildRelayMetadataEvent) recovers it regardless of which
|
|
19664
|
-
// carrier the producing daemon used. The metadata spread above may carry the id only as
|
|
19665
|
-
// `meshActiveTaskId` (a worker provider event), leaving top-level `taskId` unset and the
|
|
19666
|
-
// received stage rendering `task=-`. Resolve both carriers into an explicit `taskId` so
|
|
19667
|
-
// dedup stays task-scoped end-to-end. Only set when a non-empty id exists (no clobber to
|
|
19668
|
-
// undefined when neither is present).
|
|
19669
|
-
...(() => {
|
|
19670
|
-
const tid = readNonEmptyString2(metadata.taskId) || readNonEmptyString2(metadata.meshActiveTaskId);
|
|
19671
|
-
return tid ? { taskId: tid } : {};
|
|
19672
|
-
})(),
|
|
19673
|
-
// T4 (B3b): carry the v2 envelope (protocolVersion/eventId/scope/dispatchedBy/
|
|
19674
|
-
// intendedFor) across the P2P relay boundary at the TOP LEVEL. These live on the
|
|
19675
|
-
// pending event itself, not inside metadataEvent, so without this the remote pull
|
|
19676
|
-
// re-queue would re-stamp a fresh eventId — breaking cross-machine idempotency and
|
|
19677
|
-
// downgrading the relayed completion to v1 broadcast routing. Spread LAST so the
|
|
19678
|
-
// authoritative envelope always wins over any stale key the metadata spread carried.
|
|
19679
|
-
...serializeV2EnvelopeToWire(event)
|
|
19680
|
-
};
|
|
19681
|
-
}
|
|
19682
19858
|
function setupMeshReconcileLoop(components) {
|
|
19683
19859
|
const intervalMs = resolveReconcileIntervalMs();
|
|
19684
19860
|
let running = false;
|
|
@@ -19698,7 +19874,7 @@ function setupMeshReconcileLoop(components) {
|
|
|
19698
19874
|
}
|
|
19699
19875
|
};
|
|
19700
19876
|
}
|
|
19701
|
-
var
|
|
19877
|
+
var coordinatorModalParkState, heldEventLedgerRecorded, ASSIGNED_STRANDED_DEADLINE_MS, DELIVERED_NO_TURN_DEADLINE_MS, RECLAIM_UNKNOWN_GRACE_TICKS, deliveredNoTurnUnknownStreak, STRICT_SESSION_MATCH_TTL_MS, unresolvedForwardRejectionCounts, MAX_FORWARD_REJECTIONS;
|
|
19702
19878
|
var init_mesh_reconcile_loop = __esm({
|
|
19703
19879
|
"src/mesh/mesh-reconcile-loop.ts"() {
|
|
19704
19880
|
"use strict";
|
|
@@ -19717,17 +19893,13 @@ var init_mesh_reconcile_loop = __esm({
|
|
|
19717
19893
|
init_mesh_work_queue();
|
|
19718
19894
|
init_mesh_queue_assignment();
|
|
19719
19895
|
init_mesh_ledger();
|
|
19720
|
-
init_mesh_active_work();
|
|
19721
19896
|
init_mesh_events_stale();
|
|
19722
|
-
init_chat_message_normalization();
|
|
19723
19897
|
init_mesh_reconcile_identity();
|
|
19898
|
+
init_mesh_reconcile_config();
|
|
19899
|
+
init_mesh_remote_event_pull();
|
|
19900
|
+
init_mesh_completion_synthesis();
|
|
19724
19901
|
init_mesh_reconcile_v2_backstop();
|
|
19725
19902
|
init_mesh_reconcile_acked_hold();
|
|
19726
|
-
init_mesh_reconcile_v2_backstop();
|
|
19727
|
-
init_mesh_reconcile_acked_hold();
|
|
19728
|
-
DEFAULT_RECONCILE_INTERVAL_MS = 4e3;
|
|
19729
|
-
DEFAULT_AUTO_PRUNE_MIN_AGE_MS = 24 * 60 * 6e4;
|
|
19730
|
-
DEFAULT_PENDING_HELD_DRAIN_ESCALATE_MS = 12e3;
|
|
19731
19903
|
coordinatorModalParkState = /* @__PURE__ */ new Map();
|
|
19732
19904
|
heldEventLedgerRecorded = /* @__PURE__ */ new Set();
|
|
19733
19905
|
ASSIGNED_STRANDED_DEADLINE_MS = 5 * 6e4;
|
|
@@ -19757,6 +19929,7 @@ __export(mesh_events_exports, {
|
|
|
19757
19929
|
queuePendingMeshCoordinatorEvent: () => queuePendingMeshCoordinatorEvent,
|
|
19758
19930
|
readV2EnvelopeFromWire: () => readV2EnvelopeFromWire,
|
|
19759
19931
|
reconcileDirectDispatchCompletionFromTranscript: () => reconcileDirectDispatchCompletionFromTranscript,
|
|
19932
|
+
requeueHeldMeshCoordinatorEvents: () => requeueHeldMeshCoordinatorEvents,
|
|
19760
19933
|
resolveCoordinatorDrainDeliverability: () => resolveCoordinatorDrainDeliverability,
|
|
19761
19934
|
runMeshReconcileTick: () => runMeshReconcileTick,
|
|
19762
19935
|
serializeV2EnvelopeToWire: () => serializeV2EnvelopeToWire,
|
|
@@ -25381,6 +25554,8 @@ __export(index_exports, {
|
|
|
25381
25554
|
AcpProviderInstance: () => AcpProviderInstance,
|
|
25382
25555
|
AgentStreamPoller: () => AgentStreamPoller,
|
|
25383
25556
|
BUILTIN_CHAT_MESSAGE_KINDS: () => BUILTIN_CHAT_MESSAGE_KINDS,
|
|
25557
|
+
CANONICAL_MESH_TOOL_COUNT: () => CANONICAL_MESH_TOOL_COUNT,
|
|
25558
|
+
CANONICAL_MESH_TOOL_NAMES: () => CANONICAL_MESH_TOOL_NAMES,
|
|
25384
25559
|
CHANGE_IMPACT_CONFIG_LOCATIONS: () => CHANGE_IMPACT_CONFIG_LOCATIONS,
|
|
25385
25560
|
CHANGE_IMPACT_CONFIG_SCHEMA: () => CHANGE_IMPACT_CONFIG_SCHEMA,
|
|
25386
25561
|
CHAT_MESSAGE_ACTIVITY_SOURCES: () => CHAT_MESSAGE_ACTIVITY_SOURCES,
|
|
@@ -25438,11 +25613,13 @@ __export(index_exports, {
|
|
|
25438
25613
|
MESH_REFINE_CONFIG_LOCATIONS: () => MESH_REFINE_CONFIG_LOCATIONS,
|
|
25439
25614
|
MESH_REFINE_CONFIG_SCHEMA: () => MESH_REFINE_CONFIG_SCHEMA,
|
|
25440
25615
|
MESH_SCHEDULING_STRATEGIES: () => MESH_SCHEDULING_STRATEGIES,
|
|
25616
|
+
MESH_TASK_PRIORITIES: () => MESH_TASK_PRIORITIES,
|
|
25441
25617
|
MESH_WORKTREE_BOOTSTRAP_CONFIG_LOCATIONS: () => MESH_WORKTREE_BOOTSTRAP_CONFIG_LOCATIONS,
|
|
25442
25618
|
MESH_WORKTREE_BOOTSTRAP_CONFIG_SCHEMA: () => MESH_WORKTREE_BOOTSTRAP_CONFIG_SCHEMA,
|
|
25443
25619
|
MIN_GIT_WORKSPACE_POLL_INTERVAL_MS: () => MIN_GIT_WORKSPACE_POLL_INTERVAL_MS,
|
|
25444
25620
|
MIN_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS: () => MIN_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS,
|
|
25445
25621
|
MIN_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS: () => MIN_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS,
|
|
25622
|
+
NOT_BEFORE_RELATIVE_THRESHOLD_MS: () => NOT_BEFORE_RELATIVE_THRESHOLD_MS,
|
|
25446
25623
|
NodePtyTransportFactory: () => NodePtyTransportFactory,
|
|
25447
25624
|
OPERATING_NOTE_DEDUPE_WINDOW: () => OPERATING_NOTE_DEDUPE_WINDOW,
|
|
25448
25625
|
OPERATING_NOTE_KEEP_LATEST: () => OPERATING_NOTE_KEEP_LATEST,
|
|
@@ -25590,7 +25767,6 @@ __export(index_exports, {
|
|
|
25590
25767
|
getQueue: () => getQueue,
|
|
25591
25768
|
getRecentActivity: () => getRecentActivity,
|
|
25592
25769
|
getRecentCommands: () => getRecentCommands,
|
|
25593
|
-
getRecentCompletionConflicts: () => getRecentCompletionConflicts,
|
|
25594
25770
|
getRecentDebugTrace: () => getRecentDebugTrace,
|
|
25595
25771
|
getRecentLogs: () => getRecentLogs,
|
|
25596
25772
|
getSavedProviderSessions: () => getSavedProviderSessions,
|
|
@@ -25654,6 +25830,8 @@ __export(index_exports, {
|
|
|
25654
25830
|
maybeRunDaemonUpgradeHelperFromEnv: () => maybeRunDaemonUpgradeHelperFromEnv,
|
|
25655
25831
|
mergeAndNormalizePolicy: () => mergeAndNormalizePolicy,
|
|
25656
25832
|
meshNodeIdMatches: () => meshNodeIdMatches,
|
|
25833
|
+
meshTaskNotBeforeReady: () => meshTaskNotBeforeReady,
|
|
25834
|
+
meshTaskPriorityRank: () => meshTaskPriorityRank,
|
|
25657
25835
|
namedKeyToAnsi: () => namedKeyToAnsi,
|
|
25658
25836
|
namedKeysToAnsi: () => namedKeysToAnsi,
|
|
25659
25837
|
nodeSatisfiesRequiredTags: () => nodeSatisfiesRequiredTags,
|
|
@@ -25676,6 +25854,7 @@ __export(index_exports, {
|
|
|
25676
25854
|
normalizeMeshNodeId: () => normalizeMeshNodeId,
|
|
25677
25855
|
normalizeMeshSchedulingStrategy: () => normalizeMeshSchedulingStrategy,
|
|
25678
25856
|
normalizeMeshTaskMode: () => normalizeMeshTaskMode,
|
|
25857
|
+
normalizeMeshTaskPriority: () => normalizeMeshTaskPriority,
|
|
25679
25858
|
normalizeMeshWorkerResult: () => normalizeMeshWorkerResult,
|
|
25680
25859
|
normalizeMessageParts: () => normalizeMessageParts,
|
|
25681
25860
|
normalizeRepoIdentity: () => normalizeRepoIdentity,
|
|
@@ -25704,7 +25883,6 @@ __export(index_exports, {
|
|
|
25704
25883
|
readOperatingNotes: () => readOperatingNotes,
|
|
25705
25884
|
readV2EnvelopeFromWire: () => readV2EnvelopeFromWire,
|
|
25706
25885
|
reconcileDirectDispatchCompletionFromTranscript: () => reconcileDirectDispatchCompletionFromTranscript,
|
|
25707
|
-
recordCompletionConflict: () => recordCompletionConflict,
|
|
25708
25886
|
recordDebugTrace: () => recordDebugTrace,
|
|
25709
25887
|
recordDirectDispatchTask: () => recordDirectDispatchTask,
|
|
25710
25888
|
recordMeshToolCall: () => recordMeshToolCall,
|
|
@@ -25714,6 +25892,7 @@ __export(index_exports, {
|
|
|
25714
25892
|
removeMagiPanel: () => removeMagiPanel,
|
|
25715
25893
|
removeNode: () => removeNode,
|
|
25716
25894
|
removeWorktree: () => removeWorktree,
|
|
25895
|
+
requeueHeldMeshCoordinatorEvents: () => requeueHeldMeshCoordinatorEvents,
|
|
25717
25896
|
requeueTask: () => requeueTask,
|
|
25718
25897
|
requireMeshHostQueueOwner: () => requireMeshHostQueueOwner,
|
|
25719
25898
|
resetConfig: () => resetConfig,
|
|
@@ -25734,6 +25913,7 @@ __export(index_exports, {
|
|
|
25734
25913
|
resolveMeshRefineValidationPlan: () => resolveMeshRefineValidationPlan,
|
|
25735
25914
|
resolveMeshSurfacedSessionPreview: () => resolveMeshSurfacedSessionPreview,
|
|
25736
25915
|
resolveNodeSchedulingPriority: () => resolveNodeSchedulingPriority,
|
|
25916
|
+
resolveNotBefore: () => resolveNotBefore,
|
|
25737
25917
|
resolveProviderMaxParallel: () => resolveProviderMaxParallel,
|
|
25738
25918
|
resolveSessionHostAppName: () => resolveSessionHostAppName,
|
|
25739
25919
|
resolveSessionHostAppNameResolution: () => resolveSessionHostAppNameResolution,
|
|
@@ -27056,6 +27236,7 @@ init_mesh_config();
|
|
|
27056
27236
|
init_dist();
|
|
27057
27237
|
init_dist();
|
|
27058
27238
|
init_dist();
|
|
27239
|
+
init_dist();
|
|
27059
27240
|
init_coordinator_prompt();
|
|
27060
27241
|
init_mesh_missions();
|
|
27061
27242
|
init_mesh_task_stats();
|
|
@@ -68759,6 +68940,8 @@ var V1_CONTRACT_VERSION = "1.0.0";
|
|
|
68759
68940
|
AcpProviderInstance,
|
|
68760
68941
|
AgentStreamPoller,
|
|
68761
68942
|
BUILTIN_CHAT_MESSAGE_KINDS,
|
|
68943
|
+
CANONICAL_MESH_TOOL_COUNT,
|
|
68944
|
+
CANONICAL_MESH_TOOL_NAMES,
|
|
68762
68945
|
CHANGE_IMPACT_CONFIG_LOCATIONS,
|
|
68763
68946
|
CHANGE_IMPACT_CONFIG_SCHEMA,
|
|
68764
68947
|
CHAT_MESSAGE_ACTIVITY_SOURCES,
|
|
@@ -68816,11 +68999,13 @@ var V1_CONTRACT_VERSION = "1.0.0";
|
|
|
68816
68999
|
MESH_REFINE_CONFIG_LOCATIONS,
|
|
68817
69000
|
MESH_REFINE_CONFIG_SCHEMA,
|
|
68818
69001
|
MESH_SCHEDULING_STRATEGIES,
|
|
69002
|
+
MESH_TASK_PRIORITIES,
|
|
68819
69003
|
MESH_WORKTREE_BOOTSTRAP_CONFIG_LOCATIONS,
|
|
68820
69004
|
MESH_WORKTREE_BOOTSTRAP_CONFIG_SCHEMA,
|
|
68821
69005
|
MIN_GIT_WORKSPACE_POLL_INTERVAL_MS,
|
|
68822
69006
|
MIN_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS,
|
|
68823
69007
|
MIN_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS,
|
|
69008
|
+
NOT_BEFORE_RELATIVE_THRESHOLD_MS,
|
|
68824
69009
|
NodePtyTransportFactory,
|
|
68825
69010
|
OPERATING_NOTE_DEDUPE_WINDOW,
|
|
68826
69011
|
OPERATING_NOTE_KEEP_LATEST,
|
|
@@ -68968,7 +69153,6 @@ var V1_CONTRACT_VERSION = "1.0.0";
|
|
|
68968
69153
|
getQueue,
|
|
68969
69154
|
getRecentActivity,
|
|
68970
69155
|
getRecentCommands,
|
|
68971
|
-
getRecentCompletionConflicts,
|
|
68972
69156
|
getRecentDebugTrace,
|
|
68973
69157
|
getRecentLogs,
|
|
68974
69158
|
getSavedProviderSessions,
|
|
@@ -69032,6 +69216,8 @@ var V1_CONTRACT_VERSION = "1.0.0";
|
|
|
69032
69216
|
maybeRunDaemonUpgradeHelperFromEnv,
|
|
69033
69217
|
mergeAndNormalizePolicy,
|
|
69034
69218
|
meshNodeIdMatches,
|
|
69219
|
+
meshTaskNotBeforeReady,
|
|
69220
|
+
meshTaskPriorityRank,
|
|
69035
69221
|
namedKeyToAnsi,
|
|
69036
69222
|
namedKeysToAnsi,
|
|
69037
69223
|
nodeSatisfiesRequiredTags,
|
|
@@ -69054,6 +69240,7 @@ var V1_CONTRACT_VERSION = "1.0.0";
|
|
|
69054
69240
|
normalizeMeshNodeId,
|
|
69055
69241
|
normalizeMeshSchedulingStrategy,
|
|
69056
69242
|
normalizeMeshTaskMode,
|
|
69243
|
+
normalizeMeshTaskPriority,
|
|
69057
69244
|
normalizeMeshWorkerResult,
|
|
69058
69245
|
normalizeMessageParts,
|
|
69059
69246
|
normalizeRepoIdentity,
|
|
@@ -69082,7 +69269,6 @@ var V1_CONTRACT_VERSION = "1.0.0";
|
|
|
69082
69269
|
readOperatingNotes,
|
|
69083
69270
|
readV2EnvelopeFromWire,
|
|
69084
69271
|
reconcileDirectDispatchCompletionFromTranscript,
|
|
69085
|
-
recordCompletionConflict,
|
|
69086
69272
|
recordDebugTrace,
|
|
69087
69273
|
recordDirectDispatchTask,
|
|
69088
69274
|
recordMeshToolCall,
|
|
@@ -69092,6 +69278,7 @@ var V1_CONTRACT_VERSION = "1.0.0";
|
|
|
69092
69278
|
removeMagiPanel,
|
|
69093
69279
|
removeNode,
|
|
69094
69280
|
removeWorktree,
|
|
69281
|
+
requeueHeldMeshCoordinatorEvents,
|
|
69095
69282
|
requeueTask,
|
|
69096
69283
|
requireMeshHostQueueOwner,
|
|
69097
69284
|
resetConfig,
|
|
@@ -69112,6 +69299,7 @@ var V1_CONTRACT_VERSION = "1.0.0";
|
|
|
69112
69299
|
resolveMeshRefineValidationPlan,
|
|
69113
69300
|
resolveMeshSurfacedSessionPreview,
|
|
69114
69301
|
resolveNodeSchedulingPriority,
|
|
69302
|
+
resolveNotBefore,
|
|
69115
69303
|
resolveProviderMaxParallel,
|
|
69116
69304
|
resolveSessionHostAppName,
|
|
69117
69305
|
resolveSessionHostAppNameResolution,
|