From 45ca908bc3aa05468c35b2230025a43c2ffb7efa Mon Sep 17 00:00:00 2001 From: "[._.]/ Adam Eivy" Date: Wed, 2 Sep 2026 08:19:36 -0700 Subject: [PATCH] test: pin the endpoint guard's barrel re-export, and fix two stale references to its old internal/ path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-ups from the #5625 review, none of which belonged in an external contributor's PR: - `index.js`'s `export * from './endpointGuard.js'` was asserted by nothing. `bootstrap.js` is the only barrel importer, so dropping that line would have failed a live server start rather than a test. The new case loads the barrel lazily and checks both functions resolve to the same identities as the direct import — verified by deleting the re-export and watching it fail. - `scripts/migrations/195-cerebras-provider.js` still pointed at `aiToolkit/internal/endpointGuard.js`, a path that no longer exists. - Trimmed the `server/lib/README.md` row back to the one sentence a reader needs; the graph-cost rationale already lives in the module's own header. --- scripts/migrations/195-cerebras-provider.js | 2 +- server/lib/README.md | 2 +- server/lib/aiToolkit/endpointGuard.test.js | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/scripts/migrations/195-cerebras-provider.js b/scripts/migrations/195-cerebras-provider.js index 9d15f8c59f..00389d52bb 100644 --- a/scripts/migrations/195-cerebras-provider.js +++ b/scripts/migrations/195-cerebras-provider.js @@ -5,7 +5,7 @@ * (https://api.cerebras.ai/v1) authenticated with a plain API key, so the * toolkit's generic `executeApiRun` drives it with no runner changes — the * provider is pure configuration. `api.cerebras.ai` is allowlisted in - * aiToolkit/internal/endpointGuard.js so the key may be attached outbound. + * aiToolkit/endpointGuard.js so the key may be attached outbound. * * `setup-data.js` merges *missing* provider entries from data.reference, but * only when an install re-runs setup. This migration delivers the provider on a diff --git a/server/lib/README.md b/server/lib/README.md index 9f745c1796..f9381d1a0b 100644 --- a/server/lib/README.md +++ b/server/lib/README.md @@ -136,7 +136,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub | Module | Purpose | |---|---| -| `aiToolkit/` | Vendored toolkit (providers + runner + prompts + status). See `aiToolkit/index.js`. `aiToolkit/endpointGuard.js` — a peer of `aiToolkit/errorDetection.js`, not under `internal/` — publicly exports `evaluateSecretEndpoint`/`assertSecretEndpoint`, the SSRF/key-exfiltration guard for provider `endpoint` URLs; PortOS's own `server/services/*` should import both directly from there (also re-exported through `aiToolkit/index.js` for barrel completeness, but that pulls the toolkit's much larger route/provider/runner graph — not worth it for just this guard). | +| `aiToolkit/` | Vendored toolkit (providers + runner + prompts + status). See `aiToolkit/index.js`. `aiToolkit/endpointGuard.js` is the public SSRF / key-exfiltration guard for provider `endpoint` URLs (`evaluateSecretEndpoint` / `assertSecretEndpoint`) — import it from there, not from `internal/`. | | `aiToolkitState.js` | Module-level singleton for the toolkit instance shared by the `providers`/`runner`/`promptService` shims — `setAIToolkitInstance` / `requireToolkit` (throws `AI_TOOLKIT_NOT_INITIALIZED`) / `getAIToolkitInstance` (no-throw for cleanup paths). | | `antigravity.js` | Antigravity (`agy`) CLI provider helpers — id/sentinel constants (`ANTIGRAVITY_CLI_ID`, `ANTIGRAVITY_CONFIGURED_DEFAULT`, `LEGACY_GEMINI_*`), `isAntigravityCommand`/`isAntigravityCliProvider` predicates, and `ensureAntigravityPrintArgs(args, {model, effort})`/`ensureAntigravityTuiArgs(args, {model, effort})`/`stripAntigravityUnsupportedArgs` argv normalizers. `parseAntigravityModelList(stdout)` parses `agy models` rows — accepts both the modern `\t