@adhdev/daemon-core 0.9.82-rc.401 → 0.9.82-rc.402
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +196 -183
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +193 -180
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/mesh/mesh-work-queue.ts +23 -0
package/dist/index.mjs
CHANGED
|
@@ -394,10 +394,10 @@ function readInjected(value) {
|
|
|
394
394
|
}
|
|
395
395
|
function getDaemonBuildInfo() {
|
|
396
396
|
if (cached) return cached;
|
|
397
|
-
const commit = readInjected(true ? "
|
|
398
|
-
const commitShort = readInjected(true ? "
|
|
399
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
400
|
-
const builtAt = readInjected(true ? "2026-06-27T16:
|
|
397
|
+
const commit = readInjected(true ? "93b00efeec1fccd6550c1faf5fa838106caef4bb" : void 0) ?? "unknown";
|
|
398
|
+
const commitShort = readInjected(true ? "93b00efe" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
399
|
+
const version = readInjected(true ? "0.9.82-rc.402" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
400
|
+
const builtAt = readInjected(true ? "2026-06-27T16:41:05.513Z" : void 0);
|
|
401
401
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
402
402
|
return cached;
|
|
403
403
|
}
|
|
@@ -4484,6 +4484,176 @@ var init_mesh_ledger = __esm({
|
|
|
4484
4484
|
}
|
|
4485
4485
|
});
|
|
4486
4486
|
|
|
4487
|
+
// src/mesh/mesh-delivery-policy.ts
|
|
4488
|
+
import { randomUUID as randomUUID5 } from "crypto";
|
|
4489
|
+
function resolveDeliveryDecision(sessionStatus, opts) {
|
|
4490
|
+
const status = (sessionStatus || "").trim().toLowerCase();
|
|
4491
|
+
if (!status) {
|
|
4492
|
+
return {
|
|
4493
|
+
decision: "rejected",
|
|
4494
|
+
reason: "unknown_session_status",
|
|
4495
|
+
message: "Session status is unknown. Delivery rejected (fail-closed). Use mesh_launch_session to start a fresh session."
|
|
4496
|
+
};
|
|
4497
|
+
}
|
|
4498
|
+
if (IMMEDIATE_DELIVERY_STATUSES.has(status)) {
|
|
4499
|
+
return {
|
|
4500
|
+
decision: "immediate",
|
|
4501
|
+
reason: `session_${status}`,
|
|
4502
|
+
message: `Session is ${status} \u2014 delivery allowed immediately.`
|
|
4503
|
+
};
|
|
4504
|
+
}
|
|
4505
|
+
if (BUSY_DELIVERY_STATUSES.has(status)) {
|
|
4506
|
+
if (opts?.allowBusyInjection) {
|
|
4507
|
+
return {
|
|
4508
|
+
decision: "immediate",
|
|
4509
|
+
reason: `session_${status}_busy_injection_allowed`,
|
|
4510
|
+
message: `Session is ${status} but provider supports busy injection. Delivered immediately.`
|
|
4511
|
+
};
|
|
4512
|
+
}
|
|
4513
|
+
if (status === "waiting_approval" && opts?.kind === "approval") {
|
|
4514
|
+
return {
|
|
4515
|
+
decision: "immediate",
|
|
4516
|
+
reason: "session_waiting_approval_approval_message",
|
|
4517
|
+
message: "Session is waiting for approval \u2014 approval message delivered immediately."
|
|
4518
|
+
};
|
|
4519
|
+
}
|
|
4520
|
+
return {
|
|
4521
|
+
decision: "queued",
|
|
4522
|
+
reason: `session_${status}_busy`,
|
|
4523
|
+
message: `Session is ${status}. Task queued for delivery when session becomes idle. Do not inject directly into a busy session.`
|
|
4524
|
+
};
|
|
4525
|
+
}
|
|
4526
|
+
if (TERMINAL_DELIVERY_STATUSES.has(status)) {
|
|
4527
|
+
return {
|
|
4528
|
+
decision: "rejected",
|
|
4529
|
+
reason: `session_${status}_terminal`,
|
|
4530
|
+
message: `Session is ${status} (terminal). Delivery rejected. Launch a new session before dispatching tasks.`
|
|
4531
|
+
};
|
|
4532
|
+
}
|
|
4533
|
+
return {
|
|
4534
|
+
decision: "rejected",
|
|
4535
|
+
reason: "unrecognized_session_status",
|
|
4536
|
+
message: `Session status '${sessionStatus}' is not recognized. Delivery rejected (fail-closed). Inspect session state before retrying.`
|
|
4537
|
+
};
|
|
4538
|
+
}
|
|
4539
|
+
function createSessionDelivery(opts) {
|
|
4540
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4541
|
+
const id = randomUUID5();
|
|
4542
|
+
const record = {
|
|
4543
|
+
id,
|
|
4544
|
+
meshId: opts.meshId,
|
|
4545
|
+
nodeId: opts.nodeId,
|
|
4546
|
+
sessionId: opts.sessionId,
|
|
4547
|
+
providerType: opts.providerType,
|
|
4548
|
+
taskId: opts.taskId,
|
|
4549
|
+
kind: opts.kind,
|
|
4550
|
+
priority: opts.priority ?? 0,
|
|
4551
|
+
message: opts.message,
|
|
4552
|
+
status: opts.status,
|
|
4553
|
+
deliverAfter: opts.deliverAfter,
|
|
4554
|
+
expiresAt: opts.expiresAt,
|
|
4555
|
+
attemptCount: 0,
|
|
4556
|
+
sourceCoordinatorSessionId: opts.sourceCoordinatorSessionId,
|
|
4557
|
+
sourceCoordinatorDaemonId: opts.sourceCoordinatorDaemonId,
|
|
4558
|
+
createdAt: now,
|
|
4559
|
+
updatedAt: now
|
|
4560
|
+
};
|
|
4561
|
+
MeshRuntimeStore.getInstance().insertSessionDelivery({
|
|
4562
|
+
id,
|
|
4563
|
+
meshId: opts.meshId,
|
|
4564
|
+
nodeId: opts.nodeId,
|
|
4565
|
+
sessionId: opts.sessionId,
|
|
4566
|
+
providerType: opts.providerType,
|
|
4567
|
+
taskId: opts.taskId,
|
|
4568
|
+
kind: opts.kind,
|
|
4569
|
+
priority: opts.priority ?? 0,
|
|
4570
|
+
message: opts.message,
|
|
4571
|
+
status: opts.status,
|
|
4572
|
+
deliverAfter: opts.deliverAfter,
|
|
4573
|
+
expiresAt: opts.expiresAt,
|
|
4574
|
+
sourceCoordinatorSessionId: opts.sourceCoordinatorSessionId,
|
|
4575
|
+
sourceCoordinatorDaemonId: opts.sourceCoordinatorDaemonId,
|
|
4576
|
+
createdAt: now,
|
|
4577
|
+
updatedAt: now
|
|
4578
|
+
});
|
|
4579
|
+
return record;
|
|
4580
|
+
}
|
|
4581
|
+
function updateSessionDeliveryStatus(id, status, opts) {
|
|
4582
|
+
try {
|
|
4583
|
+
MeshRuntimeStore.getInstance().updateSessionDeliveryStatus(id, status, opts);
|
|
4584
|
+
} catch {
|
|
4585
|
+
}
|
|
4586
|
+
}
|
|
4587
|
+
function getActiveSessionDeliveries(meshId, sessionId) {
|
|
4588
|
+
try {
|
|
4589
|
+
return MeshRuntimeStore.getInstance().getActiveSessionDeliveries(meshId, sessionId);
|
|
4590
|
+
} catch {
|
|
4591
|
+
return [];
|
|
4592
|
+
}
|
|
4593
|
+
}
|
|
4594
|
+
function recordCompletionConflict(opts) {
|
|
4595
|
+
try {
|
|
4596
|
+
MeshRuntimeStore.getInstance().recordCompletionConflict({
|
|
4597
|
+
id: randomUUID5(),
|
|
4598
|
+
meshId: opts.meshId,
|
|
4599
|
+
fingerprint: opts.fingerprint,
|
|
4600
|
+
conflictingTaskId: opts.conflictingTaskId,
|
|
4601
|
+
conflictingSessionId: opts.conflictingSessionId,
|
|
4602
|
+
originalTaskId: opts.originalTaskId,
|
|
4603
|
+
originalSessionId: opts.originalSessionId,
|
|
4604
|
+
event: opts.event,
|
|
4605
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
4606
|
+
});
|
|
4607
|
+
} catch {
|
|
4608
|
+
}
|
|
4609
|
+
}
|
|
4610
|
+
function getRecentCompletionConflicts(meshId, limitMs) {
|
|
4611
|
+
try {
|
|
4612
|
+
return MeshRuntimeStore.getInstance().getRecentCompletionConflicts(meshId, limitMs);
|
|
4613
|
+
} catch {
|
|
4614
|
+
return [];
|
|
4615
|
+
}
|
|
4616
|
+
}
|
|
4617
|
+
function markSessionDeliveriesTerminal(meshId, sessionId, terminalStatus) {
|
|
4618
|
+
try {
|
|
4619
|
+
const active = MeshRuntimeStore.getInstance().getActiveSessionDeliveries(meshId, sessionId);
|
|
4620
|
+
for (const delivery of active) {
|
|
4621
|
+
MeshRuntimeStore.getInstance().updateSessionDeliveryStatus(delivery.id, terminalStatus);
|
|
4622
|
+
}
|
|
4623
|
+
} catch {
|
|
4624
|
+
}
|
|
4625
|
+
}
|
|
4626
|
+
var IMMEDIATE_DELIVERY_STATUSES, BUSY_DELIVERY_STATUSES, TERMINAL_DELIVERY_STATUSES;
|
|
4627
|
+
var init_mesh_delivery_policy = __esm({
|
|
4628
|
+
"src/mesh/mesh-delivery-policy.ts"() {
|
|
4629
|
+
"use strict";
|
|
4630
|
+
init_mesh_runtime_store();
|
|
4631
|
+
IMMEDIATE_DELIVERY_STATUSES = /* @__PURE__ */ new Set([
|
|
4632
|
+
"idle",
|
|
4633
|
+
"waiting_input",
|
|
4634
|
+
"ready"
|
|
4635
|
+
]);
|
|
4636
|
+
BUSY_DELIVERY_STATUSES = /* @__PURE__ */ new Set([
|
|
4637
|
+
"generating",
|
|
4638
|
+
"running",
|
|
4639
|
+
"streaming",
|
|
4640
|
+
"busy",
|
|
4641
|
+
"starting",
|
|
4642
|
+
"initializing",
|
|
4643
|
+
"waiting_approval"
|
|
4644
|
+
]);
|
|
4645
|
+
TERMINAL_DELIVERY_STATUSES = /* @__PURE__ */ new Set([
|
|
4646
|
+
"stopped",
|
|
4647
|
+
"failed",
|
|
4648
|
+
"terminated",
|
|
4649
|
+
"exited",
|
|
4650
|
+
"closed",
|
|
4651
|
+
"deleted",
|
|
4652
|
+
"error"
|
|
4653
|
+
]);
|
|
4654
|
+
}
|
|
4655
|
+
});
|
|
4656
|
+
|
|
4487
4657
|
// src/mesh/mesh-work-queue.ts
|
|
4488
4658
|
var mesh_work_queue_exports = {};
|
|
4489
4659
|
__export(mesh_work_queue_exports, {
|
|
@@ -4523,7 +4693,7 @@ __export(mesh_work_queue_exports, {
|
|
|
4523
4693
|
updateTaskStatus: () => updateTaskStatus,
|
|
4524
4694
|
validateMeshTaskModeRequest: () => validateMeshTaskModeRequest
|
|
4525
4695
|
});
|
|
4526
|
-
import { randomUUID as
|
|
4696
|
+
import { randomUUID as randomUUID6 } from "crypto";
|
|
4527
4697
|
function hasNegationBefore(text, matchIndex) {
|
|
4528
4698
|
const before = text.slice(0, matchIndex);
|
|
4529
4699
|
const clauseStart = Math.max(
|
|
@@ -4846,7 +5016,7 @@ function enqueueTask(meshId, message, opts) {
|
|
|
4846
5016
|
if (!modeValidation.valid) {
|
|
4847
5017
|
throw new Error(`live_debug_readonly_guardrail_violation: forbidden operations (${modeValidation.violations.join(", ")})`);
|
|
4848
5018
|
}
|
|
4849
|
-
const id = typeof opts?.id === "string" && opts.id.trim() ? opts.id.trim() :
|
|
5019
|
+
const id = typeof opts?.id === "string" && opts.id.trim() ? opts.id.trim() : randomUUID6();
|
|
4850
5020
|
const dependsOn = normalizeDependsOn(opts?.dependsOn);
|
|
4851
5021
|
return withQueueLock(meshId, () => {
|
|
4852
5022
|
if (MeshRuntimeStore.getInstance().findQueueEntryById(meshId, id)) {
|
|
@@ -4907,6 +5077,18 @@ function recordDirectDispatchTask(meshId, message, opts) {
|
|
|
4907
5077
|
updatedAt: now
|
|
4908
5078
|
};
|
|
4909
5079
|
MeshRuntimeStore.getInstance().insertQueueEntry(entry);
|
|
5080
|
+
try {
|
|
5081
|
+
createSessionDelivery({
|
|
5082
|
+
meshId,
|
|
5083
|
+
...opts.assignedNodeId ? { nodeId: opts.assignedNodeId } : {},
|
|
5084
|
+
...opts.assignedSessionId ? { sessionId: opts.assignedSessionId } : {},
|
|
5085
|
+
taskId,
|
|
5086
|
+
kind: "task",
|
|
5087
|
+
message,
|
|
5088
|
+
status: "delivered"
|
|
5089
|
+
});
|
|
5090
|
+
} catch {
|
|
5091
|
+
}
|
|
4910
5092
|
return entry;
|
|
4911
5093
|
});
|
|
4912
5094
|
}
|
|
@@ -5190,6 +5372,7 @@ var init_mesh_work_queue = __esm({
|
|
|
5190
5372
|
init_mesh_config();
|
|
5191
5373
|
init_logger();
|
|
5192
5374
|
init_mesh_ledger();
|
|
5375
|
+
init_mesh_delivery_policy();
|
|
5193
5376
|
ACTIVE_MESH_QUEUE_STATUSES = ["pending", "assigned"];
|
|
5194
5377
|
HISTORICAL_MESH_QUEUE_STATUSES = ["completed", "failed", "cancelled"];
|
|
5195
5378
|
MESH_TASK_MODES = ["code_change", "validation", "live_debug_readonly", "launch_app", "convergence"];
|
|
@@ -6834,7 +7017,7 @@ __export(mesh_missions_exports, {
|
|
|
6834
7017
|
summarizeMissionTasks: () => summarizeMissionTasks,
|
|
6835
7018
|
upsertMeshMission: () => upsertMeshMission
|
|
6836
7019
|
});
|
|
6837
|
-
import { randomUUID as
|
|
7020
|
+
import { randomUUID as randomUUID7 } from "crypto";
|
|
6838
7021
|
function normalizeMissionStatus(value) {
|
|
6839
7022
|
return MESH_MISSION_STATUSES.includes(value) ? value : "active";
|
|
6840
7023
|
}
|
|
@@ -6844,7 +7027,7 @@ function upsertMeshMission(meshId, input) {
|
|
|
6844
7027
|
if (input.status !== void 0 && !MESH_MISSION_STATUSES.includes(input.status)) {
|
|
6845
7028
|
throw new Error(`invalid_mission_status: '${input.status}' (valid: ${MESH_MISSION_STATUSES.join(", ")})`);
|
|
6846
7029
|
}
|
|
6847
|
-
const id = typeof input.id === "string" && input.id.trim() ? input.id.trim() :
|
|
7030
|
+
const id = typeof input.id === "string" && input.id.trim() ? input.id.trim() : randomUUID7();
|
|
6848
7031
|
const store = MeshRuntimeStore.getInstance();
|
|
6849
7032
|
const existing = store.getMission(meshId, id);
|
|
6850
7033
|
const record = {
|
|
@@ -9829,7 +10012,7 @@ var init_mesh_events_utils = __esm({
|
|
|
9829
10012
|
// src/mesh/mesh-events-pending.ts
|
|
9830
10013
|
import { appendFileSync as appendFileSync2, existsSync as existsSync14, readFileSync as readFileSync11, renameSync as renameSync4, statSync as statSync6, unlinkSync as unlinkSync2, writeFileSync as writeFileSync6 } from "fs";
|
|
9831
10014
|
import { join as join15 } from "path";
|
|
9832
|
-
import { randomUUID as
|
|
10015
|
+
import { randomUUID as randomUUID8 } from "crypto";
|
|
9833
10016
|
function normalizeCoordinatorDaemonIds(coordinatorDaemonId) {
|
|
9834
10017
|
return expandDaemonIdForms(coordinatorDaemonId);
|
|
9835
10018
|
}
|
|
@@ -10033,7 +10216,7 @@ function queuePendingMeshCoordinatorEvent(event) {
|
|
|
10033
10216
|
let sqliteOk = false;
|
|
10034
10217
|
try {
|
|
10035
10218
|
MeshRuntimeStore.getInstance().insertPendingEvent({
|
|
10036
|
-
id:
|
|
10219
|
+
id: randomUUID8(),
|
|
10037
10220
|
meshId: event.meshId,
|
|
10038
10221
|
coordinatorDaemonId: event.targetCoordinatorDaemonId ?? null,
|
|
10039
10222
|
event: event.event,
|
|
@@ -10237,176 +10420,6 @@ var init_mesh_events_pending = __esm({
|
|
|
10237
10420
|
}
|
|
10238
10421
|
});
|
|
10239
10422
|
|
|
10240
|
-
// src/mesh/mesh-delivery-policy.ts
|
|
10241
|
-
import { randomUUID as randomUUID8 } from "crypto";
|
|
10242
|
-
function resolveDeliveryDecision(sessionStatus, opts) {
|
|
10243
|
-
const status = (sessionStatus || "").trim().toLowerCase();
|
|
10244
|
-
if (!status) {
|
|
10245
|
-
return {
|
|
10246
|
-
decision: "rejected",
|
|
10247
|
-
reason: "unknown_session_status",
|
|
10248
|
-
message: "Session status is unknown. Delivery rejected (fail-closed). Use mesh_launch_session to start a fresh session."
|
|
10249
|
-
};
|
|
10250
|
-
}
|
|
10251
|
-
if (IMMEDIATE_DELIVERY_STATUSES.has(status)) {
|
|
10252
|
-
return {
|
|
10253
|
-
decision: "immediate",
|
|
10254
|
-
reason: `session_${status}`,
|
|
10255
|
-
message: `Session is ${status} \u2014 delivery allowed immediately.`
|
|
10256
|
-
};
|
|
10257
|
-
}
|
|
10258
|
-
if (BUSY_DELIVERY_STATUSES.has(status)) {
|
|
10259
|
-
if (opts?.allowBusyInjection) {
|
|
10260
|
-
return {
|
|
10261
|
-
decision: "immediate",
|
|
10262
|
-
reason: `session_${status}_busy_injection_allowed`,
|
|
10263
|
-
message: `Session is ${status} but provider supports busy injection. Delivered immediately.`
|
|
10264
|
-
};
|
|
10265
|
-
}
|
|
10266
|
-
if (status === "waiting_approval" && opts?.kind === "approval") {
|
|
10267
|
-
return {
|
|
10268
|
-
decision: "immediate",
|
|
10269
|
-
reason: "session_waiting_approval_approval_message",
|
|
10270
|
-
message: "Session is waiting for approval \u2014 approval message delivered immediately."
|
|
10271
|
-
};
|
|
10272
|
-
}
|
|
10273
|
-
return {
|
|
10274
|
-
decision: "queued",
|
|
10275
|
-
reason: `session_${status}_busy`,
|
|
10276
|
-
message: `Session is ${status}. Task queued for delivery when session becomes idle. Do not inject directly into a busy session.`
|
|
10277
|
-
};
|
|
10278
|
-
}
|
|
10279
|
-
if (TERMINAL_DELIVERY_STATUSES.has(status)) {
|
|
10280
|
-
return {
|
|
10281
|
-
decision: "rejected",
|
|
10282
|
-
reason: `session_${status}_terminal`,
|
|
10283
|
-
message: `Session is ${status} (terminal). Delivery rejected. Launch a new session before dispatching tasks.`
|
|
10284
|
-
};
|
|
10285
|
-
}
|
|
10286
|
-
return {
|
|
10287
|
-
decision: "rejected",
|
|
10288
|
-
reason: "unrecognized_session_status",
|
|
10289
|
-
message: `Session status '${sessionStatus}' is not recognized. Delivery rejected (fail-closed). Inspect session state before retrying.`
|
|
10290
|
-
};
|
|
10291
|
-
}
|
|
10292
|
-
function createSessionDelivery(opts) {
|
|
10293
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
10294
|
-
const id = randomUUID8();
|
|
10295
|
-
const record = {
|
|
10296
|
-
id,
|
|
10297
|
-
meshId: opts.meshId,
|
|
10298
|
-
nodeId: opts.nodeId,
|
|
10299
|
-
sessionId: opts.sessionId,
|
|
10300
|
-
providerType: opts.providerType,
|
|
10301
|
-
taskId: opts.taskId,
|
|
10302
|
-
kind: opts.kind,
|
|
10303
|
-
priority: opts.priority ?? 0,
|
|
10304
|
-
message: opts.message,
|
|
10305
|
-
status: opts.status,
|
|
10306
|
-
deliverAfter: opts.deliverAfter,
|
|
10307
|
-
expiresAt: opts.expiresAt,
|
|
10308
|
-
attemptCount: 0,
|
|
10309
|
-
sourceCoordinatorSessionId: opts.sourceCoordinatorSessionId,
|
|
10310
|
-
sourceCoordinatorDaemonId: opts.sourceCoordinatorDaemonId,
|
|
10311
|
-
createdAt: now,
|
|
10312
|
-
updatedAt: now
|
|
10313
|
-
};
|
|
10314
|
-
MeshRuntimeStore.getInstance().insertSessionDelivery({
|
|
10315
|
-
id,
|
|
10316
|
-
meshId: opts.meshId,
|
|
10317
|
-
nodeId: opts.nodeId,
|
|
10318
|
-
sessionId: opts.sessionId,
|
|
10319
|
-
providerType: opts.providerType,
|
|
10320
|
-
taskId: opts.taskId,
|
|
10321
|
-
kind: opts.kind,
|
|
10322
|
-
priority: opts.priority ?? 0,
|
|
10323
|
-
message: opts.message,
|
|
10324
|
-
status: opts.status,
|
|
10325
|
-
deliverAfter: opts.deliverAfter,
|
|
10326
|
-
expiresAt: opts.expiresAt,
|
|
10327
|
-
sourceCoordinatorSessionId: opts.sourceCoordinatorSessionId,
|
|
10328
|
-
sourceCoordinatorDaemonId: opts.sourceCoordinatorDaemonId,
|
|
10329
|
-
createdAt: now,
|
|
10330
|
-
updatedAt: now
|
|
10331
|
-
});
|
|
10332
|
-
return record;
|
|
10333
|
-
}
|
|
10334
|
-
function updateSessionDeliveryStatus(id, status, opts) {
|
|
10335
|
-
try {
|
|
10336
|
-
MeshRuntimeStore.getInstance().updateSessionDeliveryStatus(id, status, opts);
|
|
10337
|
-
} catch {
|
|
10338
|
-
}
|
|
10339
|
-
}
|
|
10340
|
-
function getActiveSessionDeliveries(meshId, sessionId) {
|
|
10341
|
-
try {
|
|
10342
|
-
return MeshRuntimeStore.getInstance().getActiveSessionDeliveries(meshId, sessionId);
|
|
10343
|
-
} catch {
|
|
10344
|
-
return [];
|
|
10345
|
-
}
|
|
10346
|
-
}
|
|
10347
|
-
function recordCompletionConflict(opts) {
|
|
10348
|
-
try {
|
|
10349
|
-
MeshRuntimeStore.getInstance().recordCompletionConflict({
|
|
10350
|
-
id: randomUUID8(),
|
|
10351
|
-
meshId: opts.meshId,
|
|
10352
|
-
fingerprint: opts.fingerprint,
|
|
10353
|
-
conflictingTaskId: opts.conflictingTaskId,
|
|
10354
|
-
conflictingSessionId: opts.conflictingSessionId,
|
|
10355
|
-
originalTaskId: opts.originalTaskId,
|
|
10356
|
-
originalSessionId: opts.originalSessionId,
|
|
10357
|
-
event: opts.event,
|
|
10358
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
10359
|
-
});
|
|
10360
|
-
} catch {
|
|
10361
|
-
}
|
|
10362
|
-
}
|
|
10363
|
-
function getRecentCompletionConflicts(meshId, limitMs) {
|
|
10364
|
-
try {
|
|
10365
|
-
return MeshRuntimeStore.getInstance().getRecentCompletionConflicts(meshId, limitMs);
|
|
10366
|
-
} catch {
|
|
10367
|
-
return [];
|
|
10368
|
-
}
|
|
10369
|
-
}
|
|
10370
|
-
function markSessionDeliveriesTerminal(meshId, sessionId, terminalStatus) {
|
|
10371
|
-
try {
|
|
10372
|
-
const active = MeshRuntimeStore.getInstance().getActiveSessionDeliveries(meshId, sessionId);
|
|
10373
|
-
for (const delivery of active) {
|
|
10374
|
-
MeshRuntimeStore.getInstance().updateSessionDeliveryStatus(delivery.id, terminalStatus);
|
|
10375
|
-
}
|
|
10376
|
-
} catch {
|
|
10377
|
-
}
|
|
10378
|
-
}
|
|
10379
|
-
var IMMEDIATE_DELIVERY_STATUSES, BUSY_DELIVERY_STATUSES, TERMINAL_DELIVERY_STATUSES;
|
|
10380
|
-
var init_mesh_delivery_policy = __esm({
|
|
10381
|
-
"src/mesh/mesh-delivery-policy.ts"() {
|
|
10382
|
-
"use strict";
|
|
10383
|
-
init_mesh_runtime_store();
|
|
10384
|
-
IMMEDIATE_DELIVERY_STATUSES = /* @__PURE__ */ new Set([
|
|
10385
|
-
"idle",
|
|
10386
|
-
"waiting_input",
|
|
10387
|
-
"ready"
|
|
10388
|
-
]);
|
|
10389
|
-
BUSY_DELIVERY_STATUSES = /* @__PURE__ */ new Set([
|
|
10390
|
-
"generating",
|
|
10391
|
-
"running",
|
|
10392
|
-
"streaming",
|
|
10393
|
-
"busy",
|
|
10394
|
-
"starting",
|
|
10395
|
-
"initializing",
|
|
10396
|
-
"waiting_approval"
|
|
10397
|
-
]);
|
|
10398
|
-
TERMINAL_DELIVERY_STATUSES = /* @__PURE__ */ new Set([
|
|
10399
|
-
"stopped",
|
|
10400
|
-
"failed",
|
|
10401
|
-
"terminated",
|
|
10402
|
-
"exited",
|
|
10403
|
-
"closed",
|
|
10404
|
-
"deleted",
|
|
10405
|
-
"error"
|
|
10406
|
-
]);
|
|
10407
|
-
}
|
|
10408
|
-
});
|
|
10409
|
-
|
|
10410
10423
|
// src/mesh/mesh-events-stale.ts
|
|
10411
10424
|
function findRecentTerminalLedgerEvidence(args) {
|
|
10412
10425
|
if (!args.sessionId && !args.nodeId) return null;
|