@adhdev/daemon-core 0.9.82-rc.429 → 0.9.82-rc.430
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 +1 -0
- package/dist/index.js +186 -132
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +185 -132
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/mesh-missions.d.ts +25 -0
- package/dist/mesh/mesh-runtime-store.d.ts +3 -0
- package/dist/repo-mesh-types.d.ts +12 -0
- package/package.json +2 -2
- package/src/commands/high-family/mesh-status.ts +32 -0
- package/src/index.ts +3 -0
- package/src/mesh/mesh-missions.ts +46 -4
- package/src/mesh/mesh-runtime-store.ts +23 -6
- package/src/repo-mesh-types.ts +12 -0
package/dist/index.mjs
CHANGED
|
@@ -404,10 +404,10 @@ function readInjected(value) {
|
|
|
404
404
|
}
|
|
405
405
|
function getDaemonBuildInfo() {
|
|
406
406
|
if (cached) return cached;
|
|
407
|
-
const commit = readInjected(true ? "
|
|
408
|
-
const commitShort = readInjected(true ? "
|
|
409
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
410
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
407
|
+
const commit = readInjected(true ? "c7dba412b544423c5eee2bac9e1004739ecab503" : void 0) ?? "unknown";
|
|
408
|
+
const commitShort = readInjected(true ? "c7dba412" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
409
|
+
const version = readInjected(true ? "0.9.82-rc.430" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
410
|
+
const builtAt = readInjected(true ? "2026-06-30T05:29:05.430Z" : void 0);
|
|
411
411
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
412
412
|
return cached;
|
|
413
413
|
}
|
|
@@ -3333,11 +3333,12 @@ function summarizeGitShape(status) {
|
|
|
3333
3333
|
submodules
|
|
3334
3334
|
};
|
|
3335
3335
|
}
|
|
3336
|
-
var DAEMON_ID_PREFIXES;
|
|
3336
|
+
var DAEMON_ID_PREFIXES, MAGI_RAW_ANSWER_CAP;
|
|
3337
3337
|
var init_dist = __esm({
|
|
3338
3338
|
"../mesh-shared/dist/index.mjs"() {
|
|
3339
3339
|
"use strict";
|
|
3340
3340
|
DAEMON_ID_PREFIXES = ["daemon_", "standalone_"];
|
|
3341
|
+
MAGI_RAW_ANSWER_CAP = 4e3;
|
|
3341
3342
|
}
|
|
3342
3343
|
});
|
|
3343
3344
|
|
|
@@ -5931,6 +5932,7 @@ var init_mesh_runtime_store = __esm({
|
|
|
5931
5932
|
title TEXT NOT NULL,
|
|
5932
5933
|
goal TEXT NOT NULL DEFAULT '',
|
|
5933
5934
|
status TEXT NOT NULL DEFAULT 'active',
|
|
5935
|
+
source TEXT,
|
|
5934
5936
|
created_at TEXT NOT NULL,
|
|
5935
5937
|
updated_at TEXT NOT NULL
|
|
5936
5938
|
);
|
|
@@ -5991,6 +5993,10 @@ var init_mesh_runtime_store = __esm({
|
|
|
5991
5993
|
);
|
|
5992
5994
|
`);
|
|
5993
5995
|
}
|
|
5996
|
+
const missionCols = this.tableColumns("mesh_missions");
|
|
5997
|
+
if (!missionCols.has("source")) {
|
|
5998
|
+
this.db.exec(`ALTER TABLE mesh_missions ADD COLUMN source TEXT`);
|
|
5999
|
+
}
|
|
5994
6000
|
} catch (err) {
|
|
5995
6001
|
if (!loggedMigrationFailure) {
|
|
5996
6002
|
loggedMigrationFailure = true;
|
|
@@ -7040,12 +7046,13 @@ var init_mesh_runtime_store = __esm({
|
|
|
7040
7046
|
upsertMission(mission) {
|
|
7041
7047
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
7042
7048
|
this.db.prepare(
|
|
7043
|
-
`INSERT INTO mesh_missions (id, mesh_id, title, goal, status, created_at, updated_at)
|
|
7044
|
-
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
7049
|
+
`INSERT INTO mesh_missions (id, mesh_id, title, goal, status, source, created_at, updated_at)
|
|
7050
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
7045
7051
|
ON CONFLICT(id) DO UPDATE SET
|
|
7046
7052
|
title = excluded.title,
|
|
7047
7053
|
goal = excluded.goal,
|
|
7048
7054
|
status = excluded.status,
|
|
7055
|
+
source = COALESCE(excluded.source, mesh_missions.source),
|
|
7049
7056
|
updated_at = excluded.updated_at`
|
|
7050
7057
|
).run(
|
|
7051
7058
|
mission.id,
|
|
@@ -7053,6 +7060,7 @@ var init_mesh_runtime_store = __esm({
|
|
|
7053
7060
|
mission.title,
|
|
7054
7061
|
mission.goal ?? "",
|
|
7055
7062
|
mission.status ?? "active",
|
|
7063
|
+
mission.source ?? null,
|
|
7056
7064
|
now,
|
|
7057
7065
|
now
|
|
7058
7066
|
);
|
|
@@ -7063,7 +7071,7 @@ var init_mesh_runtime_store = __esm({
|
|
|
7063
7071
|
"SELECT * FROM mesh_missions WHERE mesh_id = ? AND id = ?"
|
|
7064
7072
|
).get(meshId, missionId);
|
|
7065
7073
|
if (!row) return null;
|
|
7066
|
-
return { id: row.id, meshId: row.mesh_id, title: row.title, goal: row.goal, status: row.status, createdAt: row.created_at, updatedAt: row.updated_at };
|
|
7074
|
+
return { id: row.id, meshId: row.mesh_id, title: row.title, goal: row.goal, status: row.status, source: row.source ?? void 0, createdAt: row.created_at, updatedAt: row.updated_at };
|
|
7067
7075
|
}
|
|
7068
7076
|
getMissions(meshId, statuses) {
|
|
7069
7077
|
let rows;
|
|
@@ -7077,7 +7085,7 @@ var init_mesh_runtime_store = __esm({
|
|
|
7077
7085
|
"SELECT * FROM mesh_missions WHERE mesh_id = ? ORDER BY updated_at DESC"
|
|
7078
7086
|
).all(meshId);
|
|
7079
7087
|
}
|
|
7080
|
-
return rows.map((row) => ({ id: row.id, meshId: row.mesh_id, title: row.title, goal: row.goal, status: row.status, createdAt: row.created_at, updatedAt: row.updated_at }));
|
|
7088
|
+
return rows.map((row) => ({ id: row.id, meshId: row.mesh_id, title: row.title, goal: row.goal, status: row.status, source: row.source ?? void 0, createdAt: row.created_at, updatedAt: row.updated_at }));
|
|
7081
7089
|
}
|
|
7082
7090
|
/** Remove all missions for a mesh — mesh deletion / test cleanup. */
|
|
7083
7091
|
clearMissionsForMesh(meshId) {
|
|
@@ -7253,6 +7261,9 @@ function summarizeGoalForLedger(goal) {
|
|
|
7253
7261
|
function normalizeMissionStatus(value) {
|
|
7254
7262
|
return MESH_MISSION_STATUSES.includes(value) ? value : "active";
|
|
7255
7263
|
}
|
|
7264
|
+
function normalizeMissionSource(value) {
|
|
7265
|
+
return value === "magi" || value === "coordinator" ? value : void 0;
|
|
7266
|
+
}
|
|
7256
7267
|
function upsertMeshMission(meshId, input) {
|
|
7257
7268
|
const title = typeof input.title === "string" ? input.title.trim() : "";
|
|
7258
7269
|
if (!title) throw new Error("mission_title_required: a mission needs a non-empty title");
|
|
@@ -7269,11 +7280,19 @@ function upsertMeshMission(meshId, input) {
|
|
|
7269
7280
|
meshId,
|
|
7270
7281
|
title,
|
|
7271
7282
|
goal: typeof input.goal === "string" ? input.goal : existing?.goal ?? "",
|
|
7272
|
-
status: normalizeMissionStatus(input.status ?? existing?.status)
|
|
7283
|
+
status: normalizeMissionStatus(input.status ?? existing?.status),
|
|
7284
|
+
// source is write-once: only forwarded when the caller supplies one. The
|
|
7285
|
+
// store COALESCEs it against the existing value, so a later status/goal
|
|
7286
|
+
// upsert that omits source never clears a previously-stamped tag.
|
|
7287
|
+
...input.source ? { source: input.source } : {}
|
|
7273
7288
|
};
|
|
7274
7289
|
store.upsertMission(record);
|
|
7275
7290
|
const saved = store.getMission(meshId, id);
|
|
7276
|
-
const result = {
|
|
7291
|
+
const result = {
|
|
7292
|
+
...saved,
|
|
7293
|
+
status: normalizeMissionStatus(saved.status),
|
|
7294
|
+
source: normalizeMissionSource(saved.source)
|
|
7295
|
+
};
|
|
7277
7296
|
appendMissionLedgerEntries(meshId, {
|
|
7278
7297
|
isCreate: !existing,
|
|
7279
7298
|
record: result,
|
|
@@ -7330,11 +7349,11 @@ function appendMissionLedgerEntries(meshId, args) {
|
|
|
7330
7349
|
}
|
|
7331
7350
|
}
|
|
7332
7351
|
function getMeshMissions(meshId, statuses) {
|
|
7333
|
-
return MeshRuntimeStore.getInstance().getMissions(meshId, statuses).map((m) => ({ ...m, status: normalizeMissionStatus(m.status) }));
|
|
7352
|
+
return MeshRuntimeStore.getInstance().getMissions(meshId, statuses).map((m) => ({ ...m, status: normalizeMissionStatus(m.status), source: normalizeMissionSource(m.source) }));
|
|
7334
7353
|
}
|
|
7335
7354
|
function getMeshMission(meshId, missionId) {
|
|
7336
7355
|
const record = MeshRuntimeStore.getInstance().getMission(meshId, missionId);
|
|
7337
|
-
return record ? { ...record, status: normalizeMissionStatus(record.status) } : null;
|
|
7356
|
+
return record ? { ...record, status: normalizeMissionStatus(record.status), source: normalizeMissionSource(record.source) } : null;
|
|
7338
7357
|
}
|
|
7339
7358
|
function summarizeMissionTasks(meshId, missionId) {
|
|
7340
7359
|
const tasks = getQueue(meshId).filter((task) => task.missionId === missionId);
|
|
@@ -7409,7 +7428,8 @@ function getMeshStatusMissionsCompact(meshId, options) {
|
|
|
7409
7428
|
}
|
|
7410
7429
|
function listMeshMissionSummaries(meshId, options) {
|
|
7411
7430
|
const statuses = options?.statuses && options.statuses.length > 0 ? options.statuses : void 0;
|
|
7412
|
-
const
|
|
7431
|
+
const includeMagi = options?.includeMagi === true;
|
|
7432
|
+
const missions = getMeshMissions(meshId, statuses).filter((m) => includeMagi || !(m.source === "magi" && m.status === "completed")).sort((a, b) => (b.updatedAt || "").localeCompare(a.updatedAt || ""));
|
|
7413
7433
|
const full = missions.map((mission) => summarizeMeshMission(meshId, mission));
|
|
7414
7434
|
return options?.verbose ? full : full.map((summary) => slimMissionSummary(summary));
|
|
7415
7435
|
}
|
|
@@ -10232,6 +10252,137 @@ var init_mesh_active_work = __esm({
|
|
|
10232
10252
|
}
|
|
10233
10253
|
});
|
|
10234
10254
|
|
|
10255
|
+
// src/mesh/mesh-magi-status.ts
|
|
10256
|
+
var mesh_magi_status_exports = {};
|
|
10257
|
+
__export(mesh_magi_status_exports, {
|
|
10258
|
+
MAGI_NEEDS_VERIFICATION_PREVIEW_CAP: () => MAGI_NEEDS_VERIFICATION_PREVIEW_CAP,
|
|
10259
|
+
RECENT_MAGI_CAP: () => RECENT_MAGI_CAP,
|
|
10260
|
+
STALE_MAGI_WINDOW_MS: () => STALE_MAGI_WINDOW_MS,
|
|
10261
|
+
buildMeshMagiActivity: () => buildMeshMagiActivity,
|
|
10262
|
+
getMeshMagiActivityByGroup: () => getMeshMagiActivityByGroup,
|
|
10263
|
+
summarizeMeshMagiActivity: () => summarizeMeshMagiActivity
|
|
10264
|
+
});
|
|
10265
|
+
function readString7(value) {
|
|
10266
|
+
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
10267
|
+
}
|
|
10268
|
+
function readRecord4(value) {
|
|
10269
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
10270
|
+
}
|
|
10271
|
+
function readNumber2(value) {
|
|
10272
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
10273
|
+
}
|
|
10274
|
+
function summarizeNeedsVerification(synthesis) {
|
|
10275
|
+
const list = Array.isArray(synthesis?.needsVerification) ? synthesis.needsVerification : void 0;
|
|
10276
|
+
if (!list) return void 0;
|
|
10277
|
+
const items = [];
|
|
10278
|
+
for (const raw of list.slice(0, MAGI_NEEDS_VERIFICATION_PREVIEW_CAP)) {
|
|
10279
|
+
const r = readRecord4(raw);
|
|
10280
|
+
const claim = readString7(r?.claim);
|
|
10281
|
+
if (!claim) continue;
|
|
10282
|
+
items.push({ claim, category: readString7(r?.category) || "needs_verification" });
|
|
10283
|
+
}
|
|
10284
|
+
return items;
|
|
10285
|
+
}
|
|
10286
|
+
function mergeGroup(groups, patch) {
|
|
10287
|
+
const consensusGroupId = readString7(patch.consensusGroupId);
|
|
10288
|
+
if (!consensusGroupId) return;
|
|
10289
|
+
const previous = groups.get(consensusGroupId);
|
|
10290
|
+
const status = patch.status === "synthesized" || previous?.status === "synthesized" ? "synthesized" : "running";
|
|
10291
|
+
const definedPatch = Object.fromEntries(
|
|
10292
|
+
Object.entries(patch).filter(([, v]) => v !== void 0)
|
|
10293
|
+
);
|
|
10294
|
+
groups.set(consensusGroupId, { ...previous, ...definedPatch, consensusGroupId, status });
|
|
10295
|
+
}
|
|
10296
|
+
function buildMeshMagiActivity(args) {
|
|
10297
|
+
const groups = /* @__PURE__ */ new Map();
|
|
10298
|
+
for (const entry of args.ledgerEntries || []) {
|
|
10299
|
+
const payload = readRecord4(entry.payload);
|
|
10300
|
+
if (payload?.source !== "magi") continue;
|
|
10301
|
+
const consensusGroupId = readString7(payload.consensusGroupId);
|
|
10302
|
+
if (!consensusGroupId) continue;
|
|
10303
|
+
if (entry.kind === "magi_synthesis") {
|
|
10304
|
+
const synthesis = readRecord4(payload.synthesis);
|
|
10305
|
+
mergeGroup(groups, {
|
|
10306
|
+
consensusGroupId,
|
|
10307
|
+
status: "synthesized",
|
|
10308
|
+
missionId: readString7(payload.missionId),
|
|
10309
|
+
panel: readString7(payload.panel),
|
|
10310
|
+
question: readString7(payload.question),
|
|
10311
|
+
replicaCount: readNumber2(synthesis?.replicasExpected) ?? readNumber2(payload.replicaCount),
|
|
10312
|
+
answered: readNumber2(synthesis?.replicasAnswered),
|
|
10313
|
+
missing: readNumber2(synthesis?.replicasMissing),
|
|
10314
|
+
staleReplicas: readNumber2(payload.staleReplicas) ?? readNumber2(synthesis?.staleReplicas),
|
|
10315
|
+
needsVerificationCount: Array.isArray(synthesis?.needsVerification) ? synthesis.needsVerification.length : void 0,
|
|
10316
|
+
agreedCount: Array.isArray(synthesis?.agreed) ? synthesis.agreed.length : void 0,
|
|
10317
|
+
independenceBanner: synthesis && "independenceBanner" in synthesis ? synthesis.independenceBanner : void 0,
|
|
10318
|
+
gitSkew: readRecord4(synthesis?.gitSkew),
|
|
10319
|
+
needsVerification: summarizeNeedsVerification(synthesis),
|
|
10320
|
+
openQuestions: Array.isArray(synthesis?.openQuestions) ? synthesis.openQuestions.slice(0, 10) : void 0,
|
|
10321
|
+
lastLedgerKind: entry.kind,
|
|
10322
|
+
lastUpdatedAt: entry.timestamp
|
|
10323
|
+
});
|
|
10324
|
+
} else if (entry.kind === "magi_dispatched") {
|
|
10325
|
+
mergeGroup(groups, {
|
|
10326
|
+
consensusGroupId,
|
|
10327
|
+
status: "running",
|
|
10328
|
+
missionId: readString7(payload.missionId),
|
|
10329
|
+
panel: readString7(payload.panel),
|
|
10330
|
+
question: readString7(payload.question),
|
|
10331
|
+
replicaCount: readNumber2(payload.replicaCount),
|
|
10332
|
+
lastLedgerKind: entry.kind,
|
|
10333
|
+
lastUpdatedAt: entry.timestamp
|
|
10334
|
+
});
|
|
10335
|
+
}
|
|
10336
|
+
}
|
|
10337
|
+
return Array.from(groups.values()).sort((a, b) => {
|
|
10338
|
+
const at = new Date(a.lastUpdatedAt || "").getTime();
|
|
10339
|
+
const bt = new Date(b.lastUpdatedAt || "").getTime();
|
|
10340
|
+
return (Number.isFinite(bt) ? bt : 0) - (Number.isFinite(at) ? at : 0);
|
|
10341
|
+
});
|
|
10342
|
+
}
|
|
10343
|
+
function activityTime(g) {
|
|
10344
|
+
const t = new Date(g.lastUpdatedAt || "").getTime();
|
|
10345
|
+
return Number.isFinite(t) ? t : 0;
|
|
10346
|
+
}
|
|
10347
|
+
function summarizeMeshMagiActivity(activity) {
|
|
10348
|
+
const running = [];
|
|
10349
|
+
const synthesized = [];
|
|
10350
|
+
for (const g of activity) {
|
|
10351
|
+
if (g.status === "synthesized") synthesized.push(g);
|
|
10352
|
+
else running.push(g);
|
|
10353
|
+
}
|
|
10354
|
+
let newest = 0;
|
|
10355
|
+
for (const g of activity) newest = Math.max(newest, activityTime(g));
|
|
10356
|
+
const cutoff = newest - STALE_MAGI_WINDOW_MS;
|
|
10357
|
+
const synthesizedByRecency = [...synthesized].sort((a, b) => activityTime(b) - activityTime(a));
|
|
10358
|
+
const freshSynthesized = synthesizedByRecency.filter((g) => activityTime(g) >= cutoff).slice(0, RECENT_MAGI_CAP);
|
|
10359
|
+
const byStatus = {};
|
|
10360
|
+
for (const g of [...running, ...freshSynthesized]) {
|
|
10361
|
+
byStatus[g.status] = (byStatus[g.status] ?? 0) + 1;
|
|
10362
|
+
}
|
|
10363
|
+
const runningByRecency = [...running].sort((a, b) => activityTime(b) - activityTime(a));
|
|
10364
|
+
return {
|
|
10365
|
+
total: running.length + freshSynthesized.length,
|
|
10366
|
+
byStatus,
|
|
10367
|
+
staleSynthesized: synthesized.length - freshSynthesized.length,
|
|
10368
|
+
groups: [...runningByRecency, ...freshSynthesized]
|
|
10369
|
+
};
|
|
10370
|
+
}
|
|
10371
|
+
function getMeshMagiActivityByGroup(ledgerEntries, consensusGroupId) {
|
|
10372
|
+
const key2 = readString7(consensusGroupId);
|
|
10373
|
+
if (!key2) return void 0;
|
|
10374
|
+
return buildMeshMagiActivity({ ledgerEntries }).find((g) => g.consensusGroupId === key2);
|
|
10375
|
+
}
|
|
10376
|
+
var MAGI_NEEDS_VERIFICATION_PREVIEW_CAP, STALE_MAGI_WINDOW_MS, RECENT_MAGI_CAP;
|
|
10377
|
+
var init_mesh_magi_status = __esm({
|
|
10378
|
+
"src/mesh/mesh-magi-status.ts"() {
|
|
10379
|
+
"use strict";
|
|
10380
|
+
MAGI_NEEDS_VERIFICATION_PREVIEW_CAP = 8;
|
|
10381
|
+
STALE_MAGI_WINDOW_MS = 6 * 60 * 60 * 1e3;
|
|
10382
|
+
RECENT_MAGI_CAP = 6;
|
|
10383
|
+
}
|
|
10384
|
+
});
|
|
10385
|
+
|
|
10235
10386
|
// src/mesh/mesh-scheduling-runtime.ts
|
|
10236
10387
|
var mesh_scheduling_runtime_exports = {};
|
|
10237
10388
|
__export(mesh_scheduling_runtime_exports, {
|
|
@@ -24612,6 +24763,7 @@ function getSavedProviderSessions(state, filters) {
|
|
|
24612
24763
|
init_mesh_config();
|
|
24613
24764
|
init_dist();
|
|
24614
24765
|
init_dist();
|
|
24766
|
+
init_dist();
|
|
24615
24767
|
init_coordinator_prompt();
|
|
24616
24768
|
init_mesh_missions();
|
|
24617
24769
|
init_mesh_task_stats();
|
|
@@ -24706,124 +24858,7 @@ function buildMeshLedgerReconciliationEvidence(meshId, replicas) {
|
|
|
24706
24858
|
init_mesh_work_queue();
|
|
24707
24859
|
init_mesh_active_work();
|
|
24708
24860
|
init_mesh_refine_status();
|
|
24709
|
-
|
|
24710
|
-
// src/mesh/mesh-magi-status.ts
|
|
24711
|
-
function readString7(value) {
|
|
24712
|
-
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
24713
|
-
}
|
|
24714
|
-
function readRecord4(value) {
|
|
24715
|
-
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
24716
|
-
}
|
|
24717
|
-
function readNumber2(value) {
|
|
24718
|
-
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
24719
|
-
}
|
|
24720
|
-
var MAGI_NEEDS_VERIFICATION_PREVIEW_CAP = 8;
|
|
24721
|
-
function summarizeNeedsVerification(synthesis) {
|
|
24722
|
-
const list = Array.isArray(synthesis?.needsVerification) ? synthesis.needsVerification : void 0;
|
|
24723
|
-
if (!list) return void 0;
|
|
24724
|
-
const items = [];
|
|
24725
|
-
for (const raw of list.slice(0, MAGI_NEEDS_VERIFICATION_PREVIEW_CAP)) {
|
|
24726
|
-
const r = readRecord4(raw);
|
|
24727
|
-
const claim = readString7(r?.claim);
|
|
24728
|
-
if (!claim) continue;
|
|
24729
|
-
items.push({ claim, category: readString7(r?.category) || "needs_verification" });
|
|
24730
|
-
}
|
|
24731
|
-
return items;
|
|
24732
|
-
}
|
|
24733
|
-
function mergeGroup(groups, patch) {
|
|
24734
|
-
const consensusGroupId = readString7(patch.consensusGroupId);
|
|
24735
|
-
if (!consensusGroupId) return;
|
|
24736
|
-
const previous = groups.get(consensusGroupId);
|
|
24737
|
-
const status = patch.status === "synthesized" || previous?.status === "synthesized" ? "synthesized" : "running";
|
|
24738
|
-
const definedPatch = Object.fromEntries(
|
|
24739
|
-
Object.entries(patch).filter(([, v]) => v !== void 0)
|
|
24740
|
-
);
|
|
24741
|
-
groups.set(consensusGroupId, { ...previous, ...definedPatch, consensusGroupId, status });
|
|
24742
|
-
}
|
|
24743
|
-
function buildMeshMagiActivity(args) {
|
|
24744
|
-
const groups = /* @__PURE__ */ new Map();
|
|
24745
|
-
for (const entry of args.ledgerEntries || []) {
|
|
24746
|
-
const payload = readRecord4(entry.payload);
|
|
24747
|
-
if (payload?.source !== "magi") continue;
|
|
24748
|
-
const consensusGroupId = readString7(payload.consensusGroupId);
|
|
24749
|
-
if (!consensusGroupId) continue;
|
|
24750
|
-
if (entry.kind === "magi_synthesis") {
|
|
24751
|
-
const synthesis = readRecord4(payload.synthesis);
|
|
24752
|
-
mergeGroup(groups, {
|
|
24753
|
-
consensusGroupId,
|
|
24754
|
-
status: "synthesized",
|
|
24755
|
-
missionId: readString7(payload.missionId),
|
|
24756
|
-
panel: readString7(payload.panel),
|
|
24757
|
-
question: readString7(payload.question),
|
|
24758
|
-
replicaCount: readNumber2(synthesis?.replicasExpected) ?? readNumber2(payload.replicaCount),
|
|
24759
|
-
answered: readNumber2(synthesis?.replicasAnswered),
|
|
24760
|
-
missing: readNumber2(synthesis?.replicasMissing),
|
|
24761
|
-
staleReplicas: readNumber2(payload.staleReplicas) ?? readNumber2(synthesis?.staleReplicas),
|
|
24762
|
-
needsVerificationCount: Array.isArray(synthesis?.needsVerification) ? synthesis.needsVerification.length : void 0,
|
|
24763
|
-
agreedCount: Array.isArray(synthesis?.agreed) ? synthesis.agreed.length : void 0,
|
|
24764
|
-
independenceBanner: synthesis && "independenceBanner" in synthesis ? synthesis.independenceBanner : void 0,
|
|
24765
|
-
gitSkew: readRecord4(synthesis?.gitSkew),
|
|
24766
|
-
needsVerification: summarizeNeedsVerification(synthesis),
|
|
24767
|
-
openQuestions: Array.isArray(synthesis?.openQuestions) ? synthesis.openQuestions.slice(0, 10) : void 0,
|
|
24768
|
-
lastLedgerKind: entry.kind,
|
|
24769
|
-
lastUpdatedAt: entry.timestamp
|
|
24770
|
-
});
|
|
24771
|
-
} else if (entry.kind === "magi_dispatched") {
|
|
24772
|
-
mergeGroup(groups, {
|
|
24773
|
-
consensusGroupId,
|
|
24774
|
-
status: "running",
|
|
24775
|
-
missionId: readString7(payload.missionId),
|
|
24776
|
-
panel: readString7(payload.panel),
|
|
24777
|
-
question: readString7(payload.question),
|
|
24778
|
-
replicaCount: readNumber2(payload.replicaCount),
|
|
24779
|
-
lastLedgerKind: entry.kind,
|
|
24780
|
-
lastUpdatedAt: entry.timestamp
|
|
24781
|
-
});
|
|
24782
|
-
}
|
|
24783
|
-
}
|
|
24784
|
-
return Array.from(groups.values()).sort((a, b) => {
|
|
24785
|
-
const at = new Date(a.lastUpdatedAt || "").getTime();
|
|
24786
|
-
const bt = new Date(b.lastUpdatedAt || "").getTime();
|
|
24787
|
-
return (Number.isFinite(bt) ? bt : 0) - (Number.isFinite(at) ? at : 0);
|
|
24788
|
-
});
|
|
24789
|
-
}
|
|
24790
|
-
var STALE_MAGI_WINDOW_MS = 6 * 60 * 60 * 1e3;
|
|
24791
|
-
var RECENT_MAGI_CAP = 6;
|
|
24792
|
-
function activityTime(g) {
|
|
24793
|
-
const t = new Date(g.lastUpdatedAt || "").getTime();
|
|
24794
|
-
return Number.isFinite(t) ? t : 0;
|
|
24795
|
-
}
|
|
24796
|
-
function summarizeMeshMagiActivity(activity) {
|
|
24797
|
-
const running = [];
|
|
24798
|
-
const synthesized = [];
|
|
24799
|
-
for (const g of activity) {
|
|
24800
|
-
if (g.status === "synthesized") synthesized.push(g);
|
|
24801
|
-
else running.push(g);
|
|
24802
|
-
}
|
|
24803
|
-
let newest = 0;
|
|
24804
|
-
for (const g of activity) newest = Math.max(newest, activityTime(g));
|
|
24805
|
-
const cutoff = newest - STALE_MAGI_WINDOW_MS;
|
|
24806
|
-
const synthesizedByRecency = [...synthesized].sort((a, b) => activityTime(b) - activityTime(a));
|
|
24807
|
-
const freshSynthesized = synthesizedByRecency.filter((g) => activityTime(g) >= cutoff).slice(0, RECENT_MAGI_CAP);
|
|
24808
|
-
const byStatus = {};
|
|
24809
|
-
for (const g of [...running, ...freshSynthesized]) {
|
|
24810
|
-
byStatus[g.status] = (byStatus[g.status] ?? 0) + 1;
|
|
24811
|
-
}
|
|
24812
|
-
const runningByRecency = [...running].sort((a, b) => activityTime(b) - activityTime(a));
|
|
24813
|
-
return {
|
|
24814
|
-
total: running.length + freshSynthesized.length,
|
|
24815
|
-
byStatus,
|
|
24816
|
-
staleSynthesized: synthesized.length - freshSynthesized.length,
|
|
24817
|
-
groups: [...runningByRecency, ...freshSynthesized]
|
|
24818
|
-
};
|
|
24819
|
-
}
|
|
24820
|
-
function getMeshMagiActivityByGroup(ledgerEntries, consensusGroupId) {
|
|
24821
|
-
const key2 = readString7(consensusGroupId);
|
|
24822
|
-
if (!key2) return void 0;
|
|
24823
|
-
return buildMeshMagiActivity({ ledgerEntries }).find((g) => g.consensusGroupId === key2);
|
|
24824
|
-
}
|
|
24825
|
-
|
|
24826
|
-
// src/index.ts
|
|
24861
|
+
init_mesh_magi_status();
|
|
24827
24862
|
init_mesh_scheduling_runtime();
|
|
24828
24863
|
init_mesh_host_ownership();
|
|
24829
24864
|
init_mesh_events();
|
|
@@ -51267,6 +51302,13 @@ var meshStatusHandlers = {
|
|
|
51267
51302
|
});
|
|
51268
51303
|
const { getMeshStatusMissionSummaries: getMeshStatusMissionSummaries2 } = await Promise.resolve().then(() => (init_mesh_missions(), mesh_missions_exports));
|
|
51269
51304
|
const missions = getMeshStatusMissionSummaries2(meshId, { verbose: verboseMissions, withStats: true });
|
|
51305
|
+
const { buildMeshMagiActivity: buildMeshMagiActivity2, summarizeMeshMagiActivity: summarizeMeshMagiActivity2 } = await Promise.resolve().then(() => (init_mesh_magi_status(), mesh_magi_status_exports));
|
|
51306
|
+
const magiLedgerEntries = readLedgerEntries2(meshId, { kind: ["magi_dispatched", "magi_synthesis"], tail: 200 });
|
|
51307
|
+
const magiActivity = buildMeshMagiActivity2({ meshId, ledgerEntries: magiLedgerEntries });
|
|
51308
|
+
let magiActivityFold;
|
|
51309
|
+
if (magiActivity.length > 0 && !verboseMissions) {
|
|
51310
|
+
magiActivityFold = summarizeMeshMagiActivity2(magiActivity);
|
|
51311
|
+
}
|
|
51270
51312
|
const statusResult = {
|
|
51271
51313
|
success: true,
|
|
51272
51314
|
meshId: mesh.id,
|
|
@@ -51319,6 +51361,16 @@ var meshStatusHandlers = {
|
|
|
51319
51361
|
queue: { tasks: queue, summary: queueSummary },
|
|
51320
51362
|
ledger: { entries: ledgerEntries, summary: ledgerSummary },
|
|
51321
51363
|
...missions.length > 0 ? { missions } : {},
|
|
51364
|
+
// Compact (default): bounded folded groups + a status-count summary.
|
|
51365
|
+
// Verbose: the full reconstructed activity list. Mirrors the MCP tool.
|
|
51366
|
+
...magiActivity.length > 0 ? magiActivityFold ? {
|
|
51367
|
+
...magiActivityFold.groups.length > 0 ? { magiActivity: magiActivityFold.groups } : {},
|
|
51368
|
+
magiActivitySummary: {
|
|
51369
|
+
total: magiActivityFold.total,
|
|
51370
|
+
byStatus: magiActivityFold.byStatus,
|
|
51371
|
+
...magiActivityFold.staleSynthesized > 0 ? { staleSynthesized: magiActivityFold.staleSynthesized } : {}
|
|
51372
|
+
}
|
|
51373
|
+
} : { magiActivity } : {},
|
|
51322
51374
|
...asyncRefineJobs.length > 0 ? { asyncRefineJobs } : {},
|
|
51323
51375
|
...historicalSessions ? { historicalSessions } : {},
|
|
51324
51376
|
...pendingCoordinatorEvents.length > 0 ? { pendingCoordinatorEvents } : {},
|
|
@@ -64936,6 +64988,7 @@ export {
|
|
|
64936
64988
|
InMemoryGitSnapshotStore,
|
|
64937
64989
|
LOG,
|
|
64938
64990
|
MAGI_NEEDS_VERIFICATION_PREVIEW_CAP,
|
|
64991
|
+
MAGI_RAW_ANSWER_CAP,
|
|
64939
64992
|
MAX_LEDGER_SLICE_LIMIT,
|
|
64940
64993
|
MESH_CONVERGE_FAST_FORWARD_TAG,
|
|
64941
64994
|
MESH_CONVERGE_REFINE_TAG,
|