Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

docs([extract-shared-requiretoolkit-helper]): remove from PLAN.md and log to changelog

[._.]/ Adam Eivy748a49352d6b
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 2bd9c8352a..8e5b5b46a9 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -5,6 +5,7 @@
## Changed
- **[cover-prose-input-idea-input-in-canonusage-corpus] Universe canon cross-reference test suite now pins every stage the per-issue search reads** — a regression that silently drops a stage from the search now fails the test suite immediately.
+- **[extract-shared-requiretoolkit-helper] Internal: consolidated three duplicated AI toolkit accessors into one shared module.** No behavior change; cuts ~30 lines and makes future toolkit-state changes one-touch.
## Fixed
diff --git a/PLAN.md b/PLAN.md
index 86c794ba6c..7bb904caaa 100644
--- a/PLAN.md
+++ b/PLAN.md
@@ -14,7 +14,6 @@ _Nothing currently parked — pick the next item from the Backlog._
### Better-audit residue
-- [ ] [extract-shared-requiretoolkit-helper] **[LOW][CODE]** Three services now carry an identical private `requireToolkit()` helper that throws `ServerError('AI Toolkit not initialized', { status: 503, code: 'AI_TOOLKIT_NOT_INITIALIZED' })` — `server/services/providers.js`, `server/services/runner.js`, `server/services/promptService.js`. Three module-level `let aiToolkitInstance = null` declarations all receive the same toolkit object from `server/index.js` via per-service `setAIToolkit(toolkit)` setters. Candidate consolidation: extract to `server/lib/aiToolkitState.js` exporting `setAIToolkitInstance(toolkit)` + `requireToolkit()` so all three services import the same module-level state. Includes barrel + README row per `server/lib/` maintenance rule. Deferred from `[extract-requiretoolkit-pattern-to-runner-js]` — three callers crosses the threshold but the 8-line helper × 3 sites is low-maintenance enough that this can wait for a fourth caller or somebody actually wanting to consolidate.
- [ ] [feeds-ssrf-ipv6-bracket-hostname-gap] **[MED][SECURITY]** `server/services/feeds.js#isHostSafe` doesn't reliably reject IPv6 literal hostnames like `http://[::1]/feed`. `new URL(...).hostname` returns `'[::1]'` (with brackets), so `net.isIP('[::1]')` returns 0 (brackets aren't valid IP syntax) and execution falls through to `dns.resolve4('[::1]')`. Production DNS typically errors → empty addresses → `return false`, so the loopback is protected _incidentally_, but the protection is fragile (any caching resolver or unusual hosts file could subvert it). Fix: strip surrounding `[…]` brackets before `net.isIP`, add an explicit `if (net.isIP(stripped) === 6) return !isPrivateIP(stripped)` branch, and extend `isPrivateIP` to cover ULA (`fc00::/7`) and link-local (`fe80::/10`) ranges. `isPrivateIP` already handles `::1`/`::`. Surfaced 2026-05-19 while adding feeds.js test coverage; deferred to keep that PR scoped to tests.
### Pipeline — deferred