@adhdev/daemon-core 0.9.82-rc.481 → 0.9.82-rc.482

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.
@@ -65,6 +65,36 @@ function getStore(): MeshRuntimeStore | undefined {
65
65
  try { return MeshRuntimeStore.getInstance(); } catch { return undefined; }
66
66
  }
67
67
 
68
+ // ---------------------------------------------------------------------------
69
+ // Reconcile-nudge registry (polling-single-model §2.1 (B)).
70
+ //
71
+ // The spontaneous best-effort immediate push that used to run inline in
72
+ // forwardUnresolvedDelegateEvent was removed: the durable outbox row + the
73
+ // reconcile loop's PHASE 0 retry (acked, retry-capped) is now the ONLY delivery
74
+ // path for an unresolved-delegate event. To keep the happy-path latency low
75
+ // without re-introducing a spontaneous data push, the enqueue site emits a
76
+ // data-free NUDGE: "outbox has work — run the PHASE 0 retry soon". The reconcile
77
+ // loop registers the handler at setup; a lost/unregistered nudge is harmless —
78
+ // the next periodic tick (default 4s) covers it, so nudge loss = bounded delay,
79
+ // never event loss.
80
+ //
81
+ // A registry (rather than a direct import of the reconcile loop) keeps the
82
+ // module graph acyclic: mesh-reconcile-loop already imports from
83
+ // mesh-event-forwarding (via the mesh-events-coordinator barrel), so the
84
+ // forwarding side must not import the loop back.
85
+ // ---------------------------------------------------------------------------
86
+ let retryNudgeHandler: (() => void) | undefined;
87
+
88
+ /** Register (or clear, with undefined) the PHASE 0 retry nudge handler. */
89
+ export function registerUnresolvedForwardRetryNudge(handler?: () => void): void {
90
+ retryNudgeHandler = handler;
91
+ }
92
+
93
+ /** Fire-and-forget nudge: ask the reconcile loop to run the outbox retry soon. */
94
+ export function nudgeUnresolvedForwardRetry(): void {
95
+ try { retryNudgeHandler?.(); } catch { /* nudge is best-effort; the periodic tick covers */ }
96
+ }
97
+
68
98
  /**
69
99
  * Durably enqueue an unresolved-delegate forward for a coordinator daemon. The
70
100
  * `forwardPayload` is the flat shape handleMeshForwardEvent reads on the coordinator.
@@ -14,7 +14,7 @@
14
14
  import type { GitRepoStatus, GitCompactSummary } from './git/git-types.js';
15
15
  import type { MeshMissionSummary, MeshMissionSlimSummary } from './mesh/mesh-missions.js';
16
16
  import type { MeshMagiActivitySummary } from './mesh/mesh-magi-status.js';
17
- import type { MagiPanelMap, MagiKindPanelMap } from '@adhdev/mesh-shared';
17
+ import type { MagiKindPanelMap } from '@adhdev/mesh-shared';
18
18
 
19
19
  // ─── Core Mesh Types ────────────────────────────
20
20
 
@@ -814,18 +814,12 @@ export interface RepoMeshCoordinatorConfig {
814
814
  export interface LocalMeshConfig {
815
815
  meshes: LocalMeshEntry[];
816
816
  /**
817
- * MAGI cross-verification panels (machine-local). Keyed by panel name; each
818
- * binds concrete `(node × provider)` members machine-dependent facts — so
819
- * panels live here in meshes.json, never in the repo-shared .adhdev/mesh.json.
820
- * Optional: absent on configs written before MAGI existed.
821
- */
822
- magiPanels?: MagiPanelMap;
823
- /**
824
- * MAGI-KIND-PANEL: per-task_kind panel bindings (machine-local). Keyed by
825
- * task_kind (rca / design / claim_audit / freeform); each maps to ≥1
826
- * `(node × provider × model?)` slot. A `mesh_magi_review` invoked with a bare
827
- * `task_kind` resolves its panel from here — an unconfigured kind is a hard
828
- * error, never a synthesized fallback. Optional; absent on pre-feature configs.
817
+ * MAGI-KIND-PANEL: per-task_kind panel bindings (machine-local), the SOLE MAGI
818
+ * panel-resolution surface (the former named-panel `magiPanels` map was removed).
819
+ * Keyed by task_kind (rca / design / claim_audit / freeform); each maps to ≥1
820
+ * `(node × provider × model?)` slot. A `mesh_magi_review` resolves its panel from
821
+ * here — an unconfigured kind is a hard error, never a synthesized fallback.
822
+ * Optional; absent on pre-feature configs.
829
823
  */
830
824
  magiKindPanels?: MagiKindPanelMap;
831
825
  }
package/src/types.ts CHANGED
@@ -5,7 +5,13 @@
5
5
  * When modifying this file, also update interface contracts in AGENT_PROTOCOL.md.
6
6
  */
7
7
  import type { StatusReportPayload, AvailableProviderInfo } from './shared-types.js';
8
- import type { ChatMessageKind } from './providers/chat-message-normalization.js';
8
+ import type {
9
+ ChatMessageKind,
10
+ ChatMessageVisibility,
11
+ ChatMessageTranscriptVisibility,
12
+ ChatMessageAudience,
13
+ ChatMessageSource,
14
+ } from './providers/chat-message-normalization.js';
9
15
 
10
16
  // ── Daemon Status ──
11
17
 
@@ -54,11 +60,20 @@ export interface ChatMessage {
54
60
  /** Optional: fiber metadata */
55
61
  _type?: string;
56
62
  _sub?: string;
57
- /** Transcript visibility/audience contract for separating chat-visible content from internal/debug runtime rows. */
58
- visibility?: 'visible' | 'user' | 'chat' | 'hidden' | 'debug' | 'internal' | (string & {});
59
- transcriptVisibility?: 'visible' | 'user' | 'chat' | 'hidden' | 'debug' | 'internal' | (string & {});
60
- audience?: 'chat' | 'debug' | 'trace' | 'internal' | (string & {});
61
- source?: 'assistant_text' | 'tool_call' | 'terminal_command' | 'runtime_activity' | 'runtime_status' | 'provider_chrome' | 'control' | (string & {});
63
+ /**
64
+ * Transcript visibility/audience contract for separating chat-visible content
65
+ * from internal/debug runtime rows. These reference the canonical named unions
66
+ * declared alongside the classifier (chat-message-normalization.ts) so the known
67
+ * values have one source of truth instead of a hand-inlined copy that drifts.
68
+ * Each alias keeps the `| (string & {})` escape hatch: the read-chat contract
69
+ * (read-chat-contract.ts) preserves ANY producer-supplied string verbatim, so
70
+ * the type must stay open — it documents the known values without forbidding
71
+ * provider-specific extensions.
72
+ */
73
+ visibility?: ChatMessageVisibility;
74
+ transcriptVisibility?: ChatMessageTranscriptVisibility;
75
+ audience?: ChatMessageAudience;
76
+ source?: ChatMessageSource;
62
77
  userFacing?: boolean;
63
78
  internal?: boolean;
64
79
  isInternal?: boolean;