@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 CHANGED
@@ -31,6 +31,7 @@ export type { SavedProviderSessionEntry } from './config/saved-sessions.js';
31
31
  export { listMeshes, getMesh, getMeshByRepo, createMesh, updateMesh, deleteMesh, addNode, removeNode, updateNode, normalizeRepoIdentity, listMagiPanels, getMagiPanel, upsertMagiPanel, removeMagiPanel, normalizeMagiPanel, } from './config/mesh-config.js';
32
32
  export type { CreateMeshOptions, UpdateMeshOptions, AddNodeOptions } from './config/mesh-config.js';
33
33
  export type { MagiPanel, MagiPanelMember, MagiPanelMap, MagiMode, MagiTaskKind, MagiPanelDefaultKind, MagiClaim, MagiClaimStance, MagiAgentResponse, MagiResponseSource, MagiReplicaGitRef, MagiGitSkew, MagiSynthesizedResponse, MagiClusterCategory, MagiClusterMember, MagiClaimCluster, MagiSynthesis, } from '@adhdev/mesh-shared';
34
+ export { MAGI_RAW_ANSWER_CAP } from '@adhdev/mesh-shared';
34
35
  export { expandDaemonIdForms, daemonIdsEquivalent, machineCoreFromDaemonId, canonicalDaemonId } from '@adhdev/mesh-shared';
35
36
  export { normalizeMeshNodeId, meshNodeIdMatches } from '@adhdev/mesh-shared';
36
37
  export { buildCoordinatorSystemPrompt } from './mesh/coordinator-prompt.js';
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 ? "5278a1a4b75ca08a30a9f98e7e5888daa84e37e2" : void 0) ?? "unknown";
413
- const commitShort = readInjected(true ? "5278a1a4" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
414
- const version = readInjected(true ? "0.9.82-rc.429" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
415
- const builtAt = readInjected(true ? "2026-06-30T03:05:39.361Z" : void 0);
412
+ const commit = readInjected(true ? "c7dba412b544423c5eee2bac9e1004739ecab503" : void 0) ?? "unknown";
413
+ const commitShort = readInjected(true ? "c7dba412" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
414
+ const version = readInjected(true ? "0.9.82-rc.430" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
415
+ const builtAt = readInjected(true ? "2026-06-30T05:29:05.430Z" : void 0);
416
416
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
417
417
  return cached;
418
418
  }
@@ -3339,11 +3339,12 @@ function summarizeGitShape(status) {
3339
3339
  submodules
3340
3340
  };
3341
3341
  }
3342
- var DAEMON_ID_PREFIXES;
3342
+ var DAEMON_ID_PREFIXES, MAGI_RAW_ANSWER_CAP;
3343
3343
  var init_dist = __esm({
3344
3344
  "../mesh-shared/dist/index.mjs"() {
3345
3345
  "use strict";
3346
3346
  DAEMON_ID_PREFIXES = ["daemon_", "standalone_"];
3347
+ MAGI_RAW_ANSWER_CAP = 4e3;
3347
3348
  }
3348
3349
  });
3349
3350
 
@@ -5938,6 +5939,7 @@ var init_mesh_runtime_store = __esm({
5938
5939
  title TEXT NOT NULL,
5939
5940
  goal TEXT NOT NULL DEFAULT '',
5940
5941
  status TEXT NOT NULL DEFAULT 'active',
5942
+ source TEXT,
5941
5943
  created_at TEXT NOT NULL,
5942
5944
  updated_at TEXT NOT NULL
5943
5945
  );
@@ -5998,6 +6000,10 @@ var init_mesh_runtime_store = __esm({
5998
6000
  );
5999
6001
  `);
6000
6002
  }
6003
+ const missionCols = this.tableColumns("mesh_missions");
6004
+ if (!missionCols.has("source")) {
6005
+ this.db.exec(`ALTER TABLE mesh_missions ADD COLUMN source TEXT`);
6006
+ }
6001
6007
  } catch (err) {
6002
6008
  if (!loggedMigrationFailure) {
6003
6009
  loggedMigrationFailure = true;
@@ -7047,12 +7053,13 @@ var init_mesh_runtime_store = __esm({
7047
7053
  upsertMission(mission) {
7048
7054
  const now = (/* @__PURE__ */ new Date()).toISOString();
7049
7055
  this.db.prepare(
7050
- `INSERT INTO mesh_missions (id, mesh_id, title, goal, status, created_at, updated_at)
7051
- VALUES (?, ?, ?, ?, ?, ?, ?)
7056
+ `INSERT INTO mesh_missions (id, mesh_id, title, goal, status, source, created_at, updated_at)
7057
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)
7052
7058
  ON CONFLICT(id) DO UPDATE SET
7053
7059
  title = excluded.title,
7054
7060
  goal = excluded.goal,
7055
7061
  status = excluded.status,
7062
+ source = COALESCE(excluded.source, mesh_missions.source),
7056
7063
  updated_at = excluded.updated_at`
7057
7064
  ).run(
7058
7065
  mission.id,
@@ -7060,6 +7067,7 @@ var init_mesh_runtime_store = __esm({
7060
7067
  mission.title,
7061
7068
  mission.goal ?? "",
7062
7069
  mission.status ?? "active",
7070
+ mission.source ?? null,
7063
7071
  now,
7064
7072
  now
7065
7073
  );
@@ -7070,7 +7078,7 @@ var init_mesh_runtime_store = __esm({
7070
7078
  "SELECT * FROM mesh_missions WHERE mesh_id = ? AND id = ?"
7071
7079
  ).get(meshId, missionId);
7072
7080
  if (!row) return null;
7073
- 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 };
7081
+ 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 };
7074
7082
  }
7075
7083
  getMissions(meshId, statuses) {
7076
7084
  let rows;
@@ -7084,7 +7092,7 @@ var init_mesh_runtime_store = __esm({
7084
7092
  "SELECT * FROM mesh_missions WHERE mesh_id = ? ORDER BY updated_at DESC"
7085
7093
  ).all(meshId);
7086
7094
  }
7087
- 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 }));
7095
+ 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 }));
7088
7096
  }
7089
7097
  /** Remove all missions for a mesh — mesh deletion / test cleanup. */
7090
7098
  clearMissionsForMesh(meshId) {
@@ -7259,6 +7267,9 @@ function summarizeGoalForLedger(goal) {
7259
7267
  function normalizeMissionStatus(value) {
7260
7268
  return MESH_MISSION_STATUSES.includes(value) ? value : "active";
7261
7269
  }
7270
+ function normalizeMissionSource(value) {
7271
+ return value === "magi" || value === "coordinator" ? value : void 0;
7272
+ }
7262
7273
  function upsertMeshMission(meshId, input) {
7263
7274
  const title = typeof input.title === "string" ? input.title.trim() : "";
7264
7275
  if (!title) throw new Error("mission_title_required: a mission needs a non-empty title");
@@ -7275,11 +7286,19 @@ function upsertMeshMission(meshId, input) {
7275
7286
  meshId,
7276
7287
  title,
7277
7288
  goal: typeof input.goal === "string" ? input.goal : existing?.goal ?? "",
7278
- status: normalizeMissionStatus(input.status ?? existing?.status)
7289
+ status: normalizeMissionStatus(input.status ?? existing?.status),
7290
+ // source is write-once: only forwarded when the caller supplies one. The
7291
+ // store COALESCEs it against the existing value, so a later status/goal
7292
+ // upsert that omits source never clears a previously-stamped tag.
7293
+ ...input.source ? { source: input.source } : {}
7279
7294
  };
7280
7295
  store.upsertMission(record);
7281
7296
  const saved = store.getMission(meshId, id);
7282
- const result = { ...saved, status: normalizeMissionStatus(saved.status) };
7297
+ const result = {
7298
+ ...saved,
7299
+ status: normalizeMissionStatus(saved.status),
7300
+ source: normalizeMissionSource(saved.source)
7301
+ };
7283
7302
  appendMissionLedgerEntries(meshId, {
7284
7303
  isCreate: !existing,
7285
7304
  record: result,
@@ -7336,11 +7355,11 @@ function appendMissionLedgerEntries(meshId, args) {
7336
7355
  }
7337
7356
  }
7338
7357
  function getMeshMissions(meshId, statuses) {
7339
- return MeshRuntimeStore.getInstance().getMissions(meshId, statuses).map((m) => ({ ...m, status: normalizeMissionStatus(m.status) }));
7358
+ return MeshRuntimeStore.getInstance().getMissions(meshId, statuses).map((m) => ({ ...m, status: normalizeMissionStatus(m.status), source: normalizeMissionSource(m.source) }));
7340
7359
  }
7341
7360
  function getMeshMission(meshId, missionId) {
7342
7361
  const record = MeshRuntimeStore.getInstance().getMission(meshId, missionId);
7343
- return record ? { ...record, status: normalizeMissionStatus(record.status) } : null;
7362
+ return record ? { ...record, status: normalizeMissionStatus(record.status), source: normalizeMissionSource(record.source) } : null;
7344
7363
  }
7345
7364
  function summarizeMissionTasks(meshId, missionId) {
7346
7365
  const tasks = getQueue(meshId).filter((task) => task.missionId === missionId);
@@ -7415,7 +7434,8 @@ function getMeshStatusMissionsCompact(meshId, options) {
7415
7434
  }
7416
7435
  function listMeshMissionSummaries(meshId, options) {
7417
7436
  const statuses = options?.statuses && options.statuses.length > 0 ? options.statuses : void 0;
7418
- const missions = getMeshMissions(meshId, statuses).sort((a, b) => (b.updatedAt || "").localeCompare(a.updatedAt || ""));
7437
+ const includeMagi = options?.includeMagi === true;
7438
+ const missions = getMeshMissions(meshId, statuses).filter((m) => includeMagi || !(m.source === "magi" && m.status === "completed")).sort((a, b) => (b.updatedAt || "").localeCompare(a.updatedAt || ""));
7419
7439
  const full = missions.map((mission) => summarizeMeshMission(meshId, mission));
7420
7440
  return options?.verbose ? full : full.map((summary) => slimMissionSummary(summary));
7421
7441
  }
@@ -10239,6 +10259,137 @@ var init_mesh_active_work = __esm({
10239
10259
  }
10240
10260
  });
10241
10261
 
10262
+ // src/mesh/mesh-magi-status.ts
10263
+ var mesh_magi_status_exports = {};
10264
+ __export(mesh_magi_status_exports, {
10265
+ MAGI_NEEDS_VERIFICATION_PREVIEW_CAP: () => MAGI_NEEDS_VERIFICATION_PREVIEW_CAP,
10266
+ RECENT_MAGI_CAP: () => RECENT_MAGI_CAP,
10267
+ STALE_MAGI_WINDOW_MS: () => STALE_MAGI_WINDOW_MS,
10268
+ buildMeshMagiActivity: () => buildMeshMagiActivity,
10269
+ getMeshMagiActivityByGroup: () => getMeshMagiActivityByGroup,
10270
+ summarizeMeshMagiActivity: () => summarizeMeshMagiActivity
10271
+ });
10272
+ function readString7(value) {
10273
+ return typeof value === "string" && value.trim() ? value.trim() : void 0;
10274
+ }
10275
+ function readRecord4(value) {
10276
+ return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
10277
+ }
10278
+ function readNumber2(value) {
10279
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
10280
+ }
10281
+ function summarizeNeedsVerification(synthesis) {
10282
+ const list = Array.isArray(synthesis?.needsVerification) ? synthesis.needsVerification : void 0;
10283
+ if (!list) return void 0;
10284
+ const items = [];
10285
+ for (const raw of list.slice(0, MAGI_NEEDS_VERIFICATION_PREVIEW_CAP)) {
10286
+ const r = readRecord4(raw);
10287
+ const claim = readString7(r?.claim);
10288
+ if (!claim) continue;
10289
+ items.push({ claim, category: readString7(r?.category) || "needs_verification" });
10290
+ }
10291
+ return items;
10292
+ }
10293
+ function mergeGroup(groups, patch) {
10294
+ const consensusGroupId = readString7(patch.consensusGroupId);
10295
+ if (!consensusGroupId) return;
10296
+ const previous = groups.get(consensusGroupId);
10297
+ const status = patch.status === "synthesized" || previous?.status === "synthesized" ? "synthesized" : "running";
10298
+ const definedPatch = Object.fromEntries(
10299
+ Object.entries(patch).filter(([, v]) => v !== void 0)
10300
+ );
10301
+ groups.set(consensusGroupId, { ...previous, ...definedPatch, consensusGroupId, status });
10302
+ }
10303
+ function buildMeshMagiActivity(args) {
10304
+ const groups = /* @__PURE__ */ new Map();
10305
+ for (const entry of args.ledgerEntries || []) {
10306
+ const payload = readRecord4(entry.payload);
10307
+ if (payload?.source !== "magi") continue;
10308
+ const consensusGroupId = readString7(payload.consensusGroupId);
10309
+ if (!consensusGroupId) continue;
10310
+ if (entry.kind === "magi_synthesis") {
10311
+ const synthesis = readRecord4(payload.synthesis);
10312
+ mergeGroup(groups, {
10313
+ consensusGroupId,
10314
+ status: "synthesized",
10315
+ missionId: readString7(payload.missionId),
10316
+ panel: readString7(payload.panel),
10317
+ question: readString7(payload.question),
10318
+ replicaCount: readNumber2(synthesis?.replicasExpected) ?? readNumber2(payload.replicaCount),
10319
+ answered: readNumber2(synthesis?.replicasAnswered),
10320
+ missing: readNumber2(synthesis?.replicasMissing),
10321
+ staleReplicas: readNumber2(payload.staleReplicas) ?? readNumber2(synthesis?.staleReplicas),
10322
+ needsVerificationCount: Array.isArray(synthesis?.needsVerification) ? synthesis.needsVerification.length : void 0,
10323
+ agreedCount: Array.isArray(synthesis?.agreed) ? synthesis.agreed.length : void 0,
10324
+ independenceBanner: synthesis && "independenceBanner" in synthesis ? synthesis.independenceBanner : void 0,
10325
+ gitSkew: readRecord4(synthesis?.gitSkew),
10326
+ needsVerification: summarizeNeedsVerification(synthesis),
10327
+ openQuestions: Array.isArray(synthesis?.openQuestions) ? synthesis.openQuestions.slice(0, 10) : void 0,
10328
+ lastLedgerKind: entry.kind,
10329
+ lastUpdatedAt: entry.timestamp
10330
+ });
10331
+ } else if (entry.kind === "magi_dispatched") {
10332
+ mergeGroup(groups, {
10333
+ consensusGroupId,
10334
+ status: "running",
10335
+ missionId: readString7(payload.missionId),
10336
+ panel: readString7(payload.panel),
10337
+ question: readString7(payload.question),
10338
+ replicaCount: readNumber2(payload.replicaCount),
10339
+ lastLedgerKind: entry.kind,
10340
+ lastUpdatedAt: entry.timestamp
10341
+ });
10342
+ }
10343
+ }
10344
+ return Array.from(groups.values()).sort((a, b) => {
10345
+ const at = new Date(a.lastUpdatedAt || "").getTime();
10346
+ const bt = new Date(b.lastUpdatedAt || "").getTime();
10347
+ return (Number.isFinite(bt) ? bt : 0) - (Number.isFinite(at) ? at : 0);
10348
+ });
10349
+ }
10350
+ function activityTime(g) {
10351
+ const t = new Date(g.lastUpdatedAt || "").getTime();
10352
+ return Number.isFinite(t) ? t : 0;
10353
+ }
10354
+ function summarizeMeshMagiActivity(activity) {
10355
+ const running = [];
10356
+ const synthesized = [];
10357
+ for (const g of activity) {
10358
+ if (g.status === "synthesized") synthesized.push(g);
10359
+ else running.push(g);
10360
+ }
10361
+ let newest = 0;
10362
+ for (const g of activity) newest = Math.max(newest, activityTime(g));
10363
+ const cutoff = newest - STALE_MAGI_WINDOW_MS;
10364
+ const synthesizedByRecency = [...synthesized].sort((a, b) => activityTime(b) - activityTime(a));
10365
+ const freshSynthesized = synthesizedByRecency.filter((g) => activityTime(g) >= cutoff).slice(0, RECENT_MAGI_CAP);
10366
+ const byStatus = {};
10367
+ for (const g of [...running, ...freshSynthesized]) {
10368
+ byStatus[g.status] = (byStatus[g.status] ?? 0) + 1;
10369
+ }
10370
+ const runningByRecency = [...running].sort((a, b) => activityTime(b) - activityTime(a));
10371
+ return {
10372
+ total: running.length + freshSynthesized.length,
10373
+ byStatus,
10374
+ staleSynthesized: synthesized.length - freshSynthesized.length,
10375
+ groups: [...runningByRecency, ...freshSynthesized]
10376
+ };
10377
+ }
10378
+ function getMeshMagiActivityByGroup(ledgerEntries, consensusGroupId) {
10379
+ const key2 = readString7(consensusGroupId);
10380
+ if (!key2) return void 0;
10381
+ return buildMeshMagiActivity({ ledgerEntries }).find((g) => g.consensusGroupId === key2);
10382
+ }
10383
+ var MAGI_NEEDS_VERIFICATION_PREVIEW_CAP, STALE_MAGI_WINDOW_MS, RECENT_MAGI_CAP;
10384
+ var init_mesh_magi_status = __esm({
10385
+ "src/mesh/mesh-magi-status.ts"() {
10386
+ "use strict";
10387
+ MAGI_NEEDS_VERIFICATION_PREVIEW_CAP = 8;
10388
+ STALE_MAGI_WINDOW_MS = 6 * 60 * 60 * 1e3;
10389
+ RECENT_MAGI_CAP = 6;
10390
+ }
10391
+ });
10392
+
10242
10393
  // src/mesh/mesh-scheduling-runtime.ts
10243
10394
  var mesh_scheduling_runtime_exports = {};
10244
10395
  __export(mesh_scheduling_runtime_exports, {
@@ -23428,6 +23579,7 @@ __export(index_exports, {
23428
23579
  InMemoryGitSnapshotStore: () => InMemoryGitSnapshotStore,
23429
23580
  LOG: () => LOG,
23430
23581
  MAGI_NEEDS_VERIFICATION_PREVIEW_CAP: () => MAGI_NEEDS_VERIFICATION_PREVIEW_CAP,
23582
+ MAGI_RAW_ANSWER_CAP: () => MAGI_RAW_ANSWER_CAP,
23431
23583
  MAX_LEDGER_SLICE_LIMIT: () => MAX_LEDGER_SLICE_LIMIT,
23432
23584
  MESH_CONVERGE_FAST_FORWARD_TAG: () => MESH_CONVERGE_FAST_FORWARD_TAG,
23433
23585
  MESH_CONVERGE_REFINE_TAG: () => MESH_CONVERGE_REFINE_TAG,
@@ -25010,6 +25162,7 @@ function getSavedProviderSessions(state, filters) {
25010
25162
  init_mesh_config();
25011
25163
  init_dist();
25012
25164
  init_dist();
25165
+ init_dist();
25013
25166
  init_coordinator_prompt();
25014
25167
  init_mesh_missions();
25015
25168
  init_mesh_task_stats();
@@ -25104,124 +25257,7 @@ function buildMeshLedgerReconciliationEvidence(meshId, replicas) {
25104
25257
  init_mesh_work_queue();
25105
25258
  init_mesh_active_work();
25106
25259
  init_mesh_refine_status();
25107
-
25108
- // src/mesh/mesh-magi-status.ts
25109
- function readString7(value) {
25110
- return typeof value === "string" && value.trim() ? value.trim() : void 0;
25111
- }
25112
- function readRecord4(value) {
25113
- return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
25114
- }
25115
- function readNumber2(value) {
25116
- return typeof value === "number" && Number.isFinite(value) ? value : void 0;
25117
- }
25118
- var MAGI_NEEDS_VERIFICATION_PREVIEW_CAP = 8;
25119
- function summarizeNeedsVerification(synthesis) {
25120
- const list = Array.isArray(synthesis?.needsVerification) ? synthesis.needsVerification : void 0;
25121
- if (!list) return void 0;
25122
- const items = [];
25123
- for (const raw of list.slice(0, MAGI_NEEDS_VERIFICATION_PREVIEW_CAP)) {
25124
- const r = readRecord4(raw);
25125
- const claim = readString7(r?.claim);
25126
- if (!claim) continue;
25127
- items.push({ claim, category: readString7(r?.category) || "needs_verification" });
25128
- }
25129
- return items;
25130
- }
25131
- function mergeGroup(groups, patch) {
25132
- const consensusGroupId = readString7(patch.consensusGroupId);
25133
- if (!consensusGroupId) return;
25134
- const previous = groups.get(consensusGroupId);
25135
- const status = patch.status === "synthesized" || previous?.status === "synthesized" ? "synthesized" : "running";
25136
- const definedPatch = Object.fromEntries(
25137
- Object.entries(patch).filter(([, v]) => v !== void 0)
25138
- );
25139
- groups.set(consensusGroupId, { ...previous, ...definedPatch, consensusGroupId, status });
25140
- }
25141
- function buildMeshMagiActivity(args) {
25142
- const groups = /* @__PURE__ */ new Map();
25143
- for (const entry of args.ledgerEntries || []) {
25144
- const payload = readRecord4(entry.payload);
25145
- if (payload?.source !== "magi") continue;
25146
- const consensusGroupId = readString7(payload.consensusGroupId);
25147
- if (!consensusGroupId) continue;
25148
- if (entry.kind === "magi_synthesis") {
25149
- const synthesis = readRecord4(payload.synthesis);
25150
- mergeGroup(groups, {
25151
- consensusGroupId,
25152
- status: "synthesized",
25153
- missionId: readString7(payload.missionId),
25154
- panel: readString7(payload.panel),
25155
- question: readString7(payload.question),
25156
- replicaCount: readNumber2(synthesis?.replicasExpected) ?? readNumber2(payload.replicaCount),
25157
- answered: readNumber2(synthesis?.replicasAnswered),
25158
- missing: readNumber2(synthesis?.replicasMissing),
25159
- staleReplicas: readNumber2(payload.staleReplicas) ?? readNumber2(synthesis?.staleReplicas),
25160
- needsVerificationCount: Array.isArray(synthesis?.needsVerification) ? synthesis.needsVerification.length : void 0,
25161
- agreedCount: Array.isArray(synthesis?.agreed) ? synthesis.agreed.length : void 0,
25162
- independenceBanner: synthesis && "independenceBanner" in synthesis ? synthesis.independenceBanner : void 0,
25163
- gitSkew: readRecord4(synthesis?.gitSkew),
25164
- needsVerification: summarizeNeedsVerification(synthesis),
25165
- openQuestions: Array.isArray(synthesis?.openQuestions) ? synthesis.openQuestions.slice(0, 10) : void 0,
25166
- lastLedgerKind: entry.kind,
25167
- lastUpdatedAt: entry.timestamp
25168
- });
25169
- } else if (entry.kind === "magi_dispatched") {
25170
- mergeGroup(groups, {
25171
- consensusGroupId,
25172
- status: "running",
25173
- missionId: readString7(payload.missionId),
25174
- panel: readString7(payload.panel),
25175
- question: readString7(payload.question),
25176
- replicaCount: readNumber2(payload.replicaCount),
25177
- lastLedgerKind: entry.kind,
25178
- lastUpdatedAt: entry.timestamp
25179
- });
25180
- }
25181
- }
25182
- return Array.from(groups.values()).sort((a, b) => {
25183
- const at = new Date(a.lastUpdatedAt || "").getTime();
25184
- const bt = new Date(b.lastUpdatedAt || "").getTime();
25185
- return (Number.isFinite(bt) ? bt : 0) - (Number.isFinite(at) ? at : 0);
25186
- });
25187
- }
25188
- var STALE_MAGI_WINDOW_MS = 6 * 60 * 60 * 1e3;
25189
- var RECENT_MAGI_CAP = 6;
25190
- function activityTime(g) {
25191
- const t = new Date(g.lastUpdatedAt || "").getTime();
25192
- return Number.isFinite(t) ? t : 0;
25193
- }
25194
- function summarizeMeshMagiActivity(activity) {
25195
- const running = [];
25196
- const synthesized = [];
25197
- for (const g of activity) {
25198
- if (g.status === "synthesized") synthesized.push(g);
25199
- else running.push(g);
25200
- }
25201
- let newest = 0;
25202
- for (const g of activity) newest = Math.max(newest, activityTime(g));
25203
- const cutoff = newest - STALE_MAGI_WINDOW_MS;
25204
- const synthesizedByRecency = [...synthesized].sort((a, b) => activityTime(b) - activityTime(a));
25205
- const freshSynthesized = synthesizedByRecency.filter((g) => activityTime(g) >= cutoff).slice(0, RECENT_MAGI_CAP);
25206
- const byStatus = {};
25207
- for (const g of [...running, ...freshSynthesized]) {
25208
- byStatus[g.status] = (byStatus[g.status] ?? 0) + 1;
25209
- }
25210
- const runningByRecency = [...running].sort((a, b) => activityTime(b) - activityTime(a));
25211
- return {
25212
- total: running.length + freshSynthesized.length,
25213
- byStatus,
25214
- staleSynthesized: synthesized.length - freshSynthesized.length,
25215
- groups: [...runningByRecency, ...freshSynthesized]
25216
- };
25217
- }
25218
- function getMeshMagiActivityByGroup(ledgerEntries, consensusGroupId) {
25219
- const key2 = readString7(consensusGroupId);
25220
- if (!key2) return void 0;
25221
- return buildMeshMagiActivity({ ledgerEntries }).find((g) => g.consensusGroupId === key2);
25222
- }
25223
-
25224
- // src/index.ts
25260
+ init_mesh_magi_status();
25225
25261
  init_mesh_scheduling_runtime();
25226
25262
  init_mesh_host_ownership();
25227
25263
  init_mesh_events();
@@ -51660,6 +51696,13 @@ var meshStatusHandlers = {
51660
51696
  });
51661
51697
  const { getMeshStatusMissionSummaries: getMeshStatusMissionSummaries2 } = await Promise.resolve().then(() => (init_mesh_missions(), mesh_missions_exports));
51662
51698
  const missions = getMeshStatusMissionSummaries2(meshId, { verbose: verboseMissions, withStats: true });
51699
+ const { buildMeshMagiActivity: buildMeshMagiActivity2, summarizeMeshMagiActivity: summarizeMeshMagiActivity2 } = await Promise.resolve().then(() => (init_mesh_magi_status(), mesh_magi_status_exports));
51700
+ const magiLedgerEntries = readLedgerEntries2(meshId, { kind: ["magi_dispatched", "magi_synthesis"], tail: 200 });
51701
+ const magiActivity = buildMeshMagiActivity2({ meshId, ledgerEntries: magiLedgerEntries });
51702
+ let magiActivityFold;
51703
+ if (magiActivity.length > 0 && !verboseMissions) {
51704
+ magiActivityFold = summarizeMeshMagiActivity2(magiActivity);
51705
+ }
51663
51706
  const statusResult = {
51664
51707
  success: true,
51665
51708
  meshId: mesh.id,
@@ -51712,6 +51755,16 @@ var meshStatusHandlers = {
51712
51755
  queue: { tasks: queue, summary: queueSummary },
51713
51756
  ledger: { entries: ledgerEntries, summary: ledgerSummary },
51714
51757
  ...missions.length > 0 ? { missions } : {},
51758
+ // Compact (default): bounded folded groups + a status-count summary.
51759
+ // Verbose: the full reconstructed activity list. Mirrors the MCP tool.
51760
+ ...magiActivity.length > 0 ? magiActivityFold ? {
51761
+ ...magiActivityFold.groups.length > 0 ? { magiActivity: magiActivityFold.groups } : {},
51762
+ magiActivitySummary: {
51763
+ total: magiActivityFold.total,
51764
+ byStatus: magiActivityFold.byStatus,
51765
+ ...magiActivityFold.staleSynthesized > 0 ? { staleSynthesized: magiActivityFold.staleSynthesized } : {}
51766
+ }
51767
+ } : { magiActivity } : {},
51715
51768
  ...asyncRefineJobs.length > 0 ? { asyncRefineJobs } : {},
51716
51769
  ...historicalSessions ? { historicalSessions } : {},
51717
51770
  ...pendingCoordinatorEvents.length > 0 ? { pendingCoordinatorEvents } : {},
@@ -65323,6 +65376,7 @@ var V1_CONTRACT_VERSION = "1.0.0";
65323
65376
  InMemoryGitSnapshotStore,
65324
65377
  LOG,
65325
65378
  MAGI_NEEDS_VERIFICATION_PREVIEW_CAP,
65379
+ MAGI_RAW_ANSWER_CAP,
65326
65380
  MAX_LEDGER_SLICE_LIMIT,
65327
65381
  MESH_CONVERGE_FAST_FORWARD_TAG,
65328
65382
  MESH_CONVERGE_REFINE_TAG,