syncDiscoverToolsTool method

void syncDiscoverToolsTool()

Registers or unregisters the discover_tools meta tool (issue #680) so the registry matches the LIVE load mode: present only in omp (discoveryEnabledByLoadMode — pi is pi-mono's exact benchmark shape, discovery off, issue #679; the default mode has no demotion and stays byte-identical). The tool carries no availability id, so it sits outside the gate's groups and no resolution can hide it. Called from rebuildToolAvailability, so a mid-session mode switch syncs it.

Implementation

void syncDiscoverToolsTool() {
  // The gate's tombstone pointer follows the live mode too (issue #680
  // review): only a registered discovery surface may be named in the
  // discoverable tombstone.
  _toolGate.discoveryEnabled =
      discoveryEnabledByLoadMode[_liveLoadMode] == true;
  if (discoveryEnabledByLoadMode[_liveLoadMode] != true) {
    _toolRegistry.unregister('discover_tools');
    return;
  }
  if (_toolRegistry.contains('discover_tools')) return;
  _toolRegistry.register(
    discoverToolsTool(
      discoverableDocs: _toolGate.discoverableDocs,
      onMount: (names) => _mountDiscoverables(names),
    ),
  );
}