Restore swarm CultMesh publication
This commit is contained in:
parent
953e6da5ed
commit
9e163f1e19
3 changed files with 46 additions and 12 deletions
|
|
@ -2792,8 +2792,8 @@ function loadCultMeshRuntime(): { CultMesh: any; defineDocumentType: any } | nul
|
|||
for (const packageJson of candidates) {
|
||||
try {
|
||||
const requireCult = createRequire(packageJson);
|
||||
const { CultMesh } = requireCult("cultmesh-ts/dist/index.js");
|
||||
const { defineDocumentType } = requireCult("cultcache-ts/dist/index.js");
|
||||
const { CultMesh } = requireCult("cultmesh-ts");
|
||||
const { defineDocumentType } = requireCult("cultcache-ts");
|
||||
if (CultMesh && defineDocumentType) {
|
||||
return { CultMesh, defineDocumentType };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -240,6 +240,8 @@ function buildUpcomingTurns(participants) {
|
|||
activeJobId: participant.activeJobId,
|
||||
restState: participant.restState,
|
||||
pendingMentionCount: participant.pendingMentionCount,
|
||||
anchoredMentionCount: participant.anchoredMentionCount,
|
||||
unanchoredMentionCount: participant.unanchoredMentionCount,
|
||||
shuffleReason: participant.pendingMentionCount > 0
|
||||
? "mention"
|
||||
: participant.activeJobId
|
||||
|
|
@ -288,7 +290,12 @@ function projectParticipant(participant, pendingMentions, initiativeClock, ident
|
|||
const channelCount = Array.isArray(participant.groups)
|
||||
? participant.groups.filter((entry) => typeof entry === "string" && entry.startsWith("channel:")).length
|
||||
: 0;
|
||||
const mentionCount = pendingMentions.filter((mention) => mention?.identityId === identityId).length;
|
||||
const participantMentions = pendingMentions.filter((mention) => mention?.identityId === identityId);
|
||||
const mentionCount = participantMentions.length;
|
||||
const anchoredMentionCount = participantMentions.filter((mention) =>
|
||||
!isBlankString(mention?.sourceMessageId ?? mention?.messageId) &&
|
||||
!isBlankString(mention?.sourceChannelId ?? mention?.channelId)
|
||||
).length;
|
||||
const nextTurnInMinutes =
|
||||
typeof nextTurnAt === "number" && typeof initiativeClock === "number"
|
||||
? round(nextTurnAt - initiativeClock, 3)
|
||||
|
|
@ -327,6 +334,8 @@ function projectParticipant(participant, pendingMentions, initiativeClock, ident
|
|||
lastQueuedAt: stringOrNull(participant.lastQueuedAt),
|
||||
queuedCount: numberOrNull(participant.queuedCount),
|
||||
pendingMentionCount: mentionCount,
|
||||
anchoredMentionCount,
|
||||
unanchoredMentionCount: Math.max(0, mentionCount - anchoredMentionCount),
|
||||
channelCount,
|
||||
constraintCount: Array.isArray(participant.constraints) ? participant.constraints.length : 0,
|
||||
constraints: Array.isArray(participant.constraints) ? participant.constraints.slice(0, 4).map(String) : [],
|
||||
|
|
@ -665,9 +674,9 @@ function renderValueDetail(value) {
|
|||
function projectPendingMention(mention) {
|
||||
return {
|
||||
identityId: stringOrNull(mention?.identityId),
|
||||
sourceChannelId: stringOrNull(mention?.sourceChannelId),
|
||||
sourceMessageId: stringOrNull(mention?.sourceMessageId),
|
||||
createdAt: stringOrNull(mention?.createdAt),
|
||||
sourceChannelId: stringOrNull(mention?.sourceChannelId ?? mention?.channelId),
|
||||
sourceMessageId: stringOrNull(mention?.sourceMessageId ?? mention?.messageId),
|
||||
createdAt: stringOrNull(mention?.createdAt ?? mention?.queuedAt),
|
||||
prompt: truncate(String(mention?.prompt ?? mention?.content ?? ""), 220),
|
||||
};
|
||||
}
|
||||
|
|
@ -814,8 +823,8 @@ function loadCultPackages() {
|
|||
}
|
||||
try {
|
||||
const requireCult = createRequire(packageJson);
|
||||
const { CultMesh } = requireCult("cultmesh-ts/dist/index.js");
|
||||
const { defineDocumentType } = requireCult("cultcache-ts/dist/index.js");
|
||||
const { CultMesh } = requireCult("cultmesh-ts");
|
||||
const { defineDocumentType } = requireCult("cultcache-ts");
|
||||
if (CultMesh && defineDocumentType) {
|
||||
return { CultMesh, defineDocumentType };
|
||||
}
|
||||
|
|
@ -1164,9 +1173,9 @@ function buildEveProviderState(snapshot) {
|
|||
}, upcoming.slice(0, 14).map((turn, index) =>
|
||||
eveNode(`turn-${stableId(turn.identityId)}-${index}`, "text", {
|
||||
role: "mono",
|
||||
text: `${String(index + 1).padStart(2, " ")}. ${String(turn.displayName ?? turn.identityId ?? "face").padEnd(10, " ")} ${turnState(turn).padEnd(7, " ")} s${formatNumber(turn.effectiveSpeed, 3)} h${formatNumber(turn.heat, 2)}`,
|
||||
text: `${String(index + 1).padStart(2, " ")}. ${String(turn.displayName ?? turn.identityId ?? "face").padEnd(10, " ")} ${turnState(turn).padEnd(9, " ")} ${minutesText(turn.nextTurnInMinutes).padStart(6, " ")} ${mentionText(turn).padEnd(5, " ")} s${formatNumber(turn.effectiveSpeed, 3)} h${formatNumber(turn.heat, 2)}`,
|
||||
status: turnState(turn),
|
||||
detail: `${turn.repoName ?? "repo"} / ${minutesText(turn.nextTurnInMinutes)}`,
|
||||
detail: `${turn.repoName ?? "repo"} / due ${minutesText(turn.nextTurnInMinutes)} / ${mentionDetail(turn)}`,
|
||||
}),
|
||||
)),
|
||||
]),
|
||||
|
|
@ -1188,17 +1197,37 @@ function stableId(value) {
|
|||
|
||||
function turnState(turn) {
|
||||
if (turn?.activeJobId) return "active";
|
||||
if ((turn?.pendingMentionCount ?? 0) > 0) return "mention";
|
||||
if (turn?.restState?.isNapping) return "nap";
|
||||
if ((turn?.pendingMentionCount ?? 0) > 0) return "mention";
|
||||
return minutesText(turn?.nextTurnInMinutes);
|
||||
}
|
||||
|
||||
function minutesText(value) {
|
||||
return typeof value === "number"
|
||||
? value <= 0 ? "ready" : `${value.toFixed(value < 10 ? 1 : 0)}m`
|
||||
? value <= 0 ? `${value.toFixed(1)}m` : `${value.toFixed(value < 10 ? 1 : 0)}m`
|
||||
: "unknown";
|
||||
}
|
||||
|
||||
function mentionText(turn) {
|
||||
const count = turn?.pendingMentionCount ?? 0;
|
||||
if (count <= 0) return "-";
|
||||
const unanchored = turn?.unanchoredMentionCount ?? 0;
|
||||
const anchored = turn?.anchoredMentionCount ?? Math.max(0, count - unanchored);
|
||||
if (unanchored > 0 && anchored <= 0) return `m?${count}`;
|
||||
if (unanchored > 0) return `m${anchored}?${unanchored}`;
|
||||
return `m${count}`;
|
||||
}
|
||||
|
||||
function mentionDetail(turn) {
|
||||
const count = turn?.pendingMentionCount ?? 0;
|
||||
if (count <= 0) return "no pending mention";
|
||||
const unanchored = turn?.unanchoredMentionCount ?? 0;
|
||||
if (unanchored > 0) {
|
||||
return `${count} pending mention(s), ${unanchored} missing source channel/message provenance`;
|
||||
}
|
||||
return `${count} pending anchored mention(s)`;
|
||||
}
|
||||
|
||||
function formatNumber(value, decimals) {
|
||||
return typeof value === "number" && Number.isFinite(value) ? value.toFixed(decimals).replace(/\.?0+$/, "") : "?";
|
||||
}
|
||||
|
|
@ -2373,6 +2402,10 @@ function stringOrNull(value) {
|
|||
return typeof value === "string" && value.length > 0 ? value : null;
|
||||
}
|
||||
|
||||
function isBlankString(value) {
|
||||
return typeof value !== "string" || value.trim().length === 0;
|
||||
}
|
||||
|
||||
function round(value, places) {
|
||||
const factor = 10 ** places;
|
||||
return Math.round(value * factor) / factor;
|
||||
|
|
|
|||
|
|
@ -348,3 +348,4 @@
|
|||
{"ts":"2026-06-04T22:27:52Z","type":"implementation","status":"ok","note":"Void moderation candidate delivery now resolves persona avatar URLs at the parent delivery boundary when the model target names a persona but omits personaAvatarUrl. Speech fixture verifies Void delivery receives DISCORD_PERSONA_AVATAR_URL_VOID before direct/Bifrost transport."}
|
||||
{"ts":"2026-06-04T22:29:15Z","type":"decision","status":"ok","note":"Transport doctrine updated by operator: VoidBot should expect GameCult infra and Bifrost/CultMesh transport; standalone native Discord fallback is no longer a product goal. Future cuts should remove direct VoidBot-native transport authority instead of preserving convenience for non-GameCult deployments."}
|
||||
{"ts":"2026-06-04T22:36:57Z","type":"implementation","status":"ok","note":"Void moderation delivery now requires Bifrost instead of falling back to VoidBot-native Discord transport: run-void-moderator-rumination rejects VOID_DISCORD_TRANSPORT=direct, candidate speech and moderation-status DMs call bifrost-bridge only, and speech/status fixtures use fake Bifrost bridges."}
|
||||
{"ts":"2026-06-05T13:52:45Z","type":"implementation","status":"ok","note":"Restored Odin visibility for voidbot.swarm: Odin/VoidBot CultMesh consumers now import cultmesh-ts and cultcache-ts package roots instead of private dist subpaths, normal swarm dashboard publication writes the CultMesh witness again, and CTB Eve text now shows due time plus anchored/unanchored mention markers (m1 vs m?1)."}
|
||||
|
|
|
|||
Loading…
Reference in a new issue