diff --git a/docs/superpowers/plans/2026-08-23-qdrant-configuration-guidance.md b/docs/superpowers/plans/2026-08-23-qdrant-configuration-guidance.md deleted file mode 100644 index d99670f92f..0000000000 --- a/docs/superpowers/plans/2026-08-23-qdrant-configuration-guidance.md +++ /dev/null @@ -1,53 +0,0 @@ -# Qdrant Configuration Guidance Implementation Plan - -> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. - -**Goal:** Explain Qdrant configuration and prevent activation until a real embedding-to-Qdrant search verifies the selected model and collection work together. - -**Architecture:** The health route remains read-only but exposes collection vector metadata. The card provides a localized mini tutorial and requires a successful search test before activation; that test produces an actual embedding, so it detects mismatched dimensions without guessing a model's size. - -**Tech Stack:** Next.js App Router, React, TypeScript, Zod, next-intl, Node test runner, Vitest. - ---- - -### Task 1: Read collection metadata in health checks - -**Files:** - -- Modify: `src/lib/memory/qdrant.ts` -- Modify: `tests/integration/qdrant-routes.test.ts` - -- [ ] Add a failing integration test that mocks `/readyz` and `GET /collections/omniroute_memory`, then expects `collection: { exists: true, vectorSize: 2048, vectorName: "omniao" }` from the health route. -- [ ] Run `node --import tsx/esm --test tests/integration/qdrant-routes.test.ts` and observe the expected failure because health lacks collection metadata. -- [ ] Add `getQdrantCollectionMetadata()` to `src/lib/memory/qdrant.ts`. It may only read `GET /collections/` and returns `{ exists: false }` or `{ exists: true, vectorSize, vectorName }`. It handles unnamed `vectors.size` and named-vector maps; it never returns API keys or changes Qdrant state. -- [ ] Extend `checkQdrantHealth()` to return this metadata after a successful `/readyz` probe. -- [ ] Re-run `node --import tsx/esm --test tests/integration/qdrant-routes.test.ts` and confirm it passes. - -### Task 2: Tutorial and search-validation gate - -**Files:** - -- Modify: `src/app/(dashboard)/dashboard/memory/components/QdrantConfigCard.tsx` -- Modify: `tests/unit/ui/qdrant-config-card.test.tsx` - -- [ ] Add failing component tests for a `data-testid="qdrant-setup-tutorial"` trigger, tutorial credit, disabled enable action before validation, and enabled action after a successful `/api/settings/qdrant/search` result. -- [ ] Run `npx vitest run tests/unit/ui/qdrant-config-card.test.tsx` and observe the expected failure. -- [ ] Add `tutorialOpen` and `searchValidated` state. Reset `searchValidated` when configuration is saved or search fails; set it only after `{ ok: true }` from the search endpoint. -- [ ] Disable only the transition that enables Qdrant while `searchValidated` is false; allow disabling normally. -- [ ] Render a compact modal opened from the tutorial trigger. It explains vector-memory retrieval, indirect token savings, HTTPS/API-key protection, matching dimensions, collection creation, and Save → Test connection → Test search. Add credit text through i18n: `Rafa Martins — rafacpti@gmail.com`. -- [ ] Display the health-route collection state: missing collection, unnamed vector size, or named vector plus size. -- [ ] Re-run `npx vitest run tests/unit/ui/qdrant-config-card.test.tsx` and confirm it passes. - -### Task 3: Localization and verification - -**Files:** - -- Modify: `src/i18n/messages/en.json` -- Modify: `src/i18n/messages/pt-BR.json` - -- [ ] Add matching English and Portuguese `memory.qdrant` strings for tutorial content, collection states, validation requirement, and credit. -- [ ] Format changed code with `npx prettier --write`. -- [ ] Run `node --import tsx/esm --test tests/integration/qdrant-routes.test.ts`. -- [ ] Run `npx vitest run src/lib/memory/__tests__/qdrant-wiring.test.ts tests/unit/ui/qdrant-config-card.test.tsx`. -- [ ] Run `npm run typecheck:core`. -- [ ] Commit with `feat: guide Qdrant memory configuration`, push `rafacpti23/qdrant-configuration-guidance` to `origin`, and open a draft PR to `diegosouzapw/OmniRoute`. diff --git a/docs/superpowers/specs/2026-08-23-qdrant-configuration-guidance-design.md b/docs/superpowers/specs/2026-08-23-qdrant-configuration-guidance-design.md deleted file mode 100644 index d78c52812b..0000000000 --- a/docs/superpowers/specs/2026-08-23-qdrant-configuration-guidance-design.md +++ /dev/null @@ -1,64 +0,0 @@ -# Qdrant Configuration Guidance Design - -## Goal - -Make the Memory > Engine > Qdrant experience explain what Qdrant does, guide users through a safe configuration, and verify that the selected Qdrant collection accepts embeddings produced by the configured OmniRoute model before Qdrant is enabled. - -## Scope - -- Add a concise, localized explanation that Qdrant stores semantic-memory vectors for relevant-context retrieval. It is not a token compressor; token savings are indirect and depend on less irrelevant context being injected. -- Add a configuration checklist covering a protected Qdrant endpoint, host/port, collection, embedding provider/model, matching vector dimensions, connection test, and search test. -- Extend the authenticated Qdrant health route to inspect the configured collection without creating, updating, searching, or deleting points. Return the collection vector dimension and a clear state when the collection is absent or uses named vectors. -- Show a pre-enable compatibility result in the Qdrant card. If the endpoint is reachable but the vector dimension cannot be determined from the selected embedding model, the UI must explain that the search test is the authoritative end-to-end validation. If dimensions differ, the UI must block enabling and explain how to create a compatible collection. -- Keep the existing behavior that initial writes create a missing collection using the embedding dimension detected from the first successful embedding. - -## User Flow - -1. The user opens Dashboard > Memory > Engine and reads the purpose and prerequisites. -2. The user enters Qdrant host, port, collection, optional API key, and an embedding provider/model with a configured provider credential. -3. The user saves settings and clicks Test connection. -4. The health result reports endpoint status and, for an existing collection, its vector dimensions and named-vector configuration. -5. The user runs Test search. This generates an embedding through OmniRoute and proves that the model dimension matches the collection and that retrieval works. -6. The Enable control remains unavailable after a known incompatibility; otherwise it follows the existing setting update path, which sets `memoryVectorStore` to `qdrant`. - -## Collection Creation Guidance - -The UI will provide copyable Qdrant REST guidance, using a placeholder dimension rather than assuming one for every model: - -```json -PUT /collections/ -{ - "vectors": { "size": , "distance": "Cosine" } -} -``` - -For the audited server, the existing `omniroute_memory` collection has a named 2048-dimensional vector. It must be paired with the same 2048-dimensional embedding model that created it. The default `openai/text-embedding-3-small` emits 1536-dimensional vectors and therefore requires a separate 1536-dimensional collection. - -## API Contract - -`GET /api/settings/qdrant/health` will retain `{ ok, latencyMs, error? }` and add optional read-only metadata: - -```ts -{ - collection?: { - exists: boolean; - vectorSize?: number; - vectorName?: string | null; - }; -} -``` - -The route must never expose Qdrant API keys. It must sanitize upstream error text before returning it. - -## Error Handling - -- A disconnected endpoint remains an error result, without changing settings. -- A missing collection is guidance, not an error: OmniRoute creates it on the first successful Qdrant write. -- A known dimension mismatch blocks enabling and tells the user to choose a matching model or a separate collection. -- A model whose dimension cannot be determined does not claim compatibility; the user must run Test search. - -## Testing - -- Route tests cover health metadata for single-vector, named-vector, missing-collection, and sanitized upstream-error responses. -- Component tests cover the purpose explanation, checklist, compatible/mismatch/missing collection states, and disabled enable action on a mismatch. -- Existing Qdrant route and card tests remain green. diff --git a/src/app/(dashboard)/dashboard/endpoint/EndpointPageClient.tsx b/src/app/(dashboard)/dashboard/endpoint/EndpointPageClient.tsx index f521103287..cdf00e95d8 100644 --- a/src/app/(dashboard)/dashboard/endpoint/EndpointPageClient.tsx +++ b/src/app/(dashboard)/dashboard/endpoint/EndpointPageClient.tsx @@ -1250,6 +1250,22 @@ export default function APIPageClient({ machineId }: Readonly + {/* Guided connection header (#11228): /v1 URL + test action lead; advanced protocols demoted */} +
+

{t("title")}

+

{t("subtitle")}

+
+ + {displayBaseUrl}/v1 + + + {t("testEndpoint")} + +
+
+ {t("advancedProtocols")} +
+
({ ...tab, label: t(tab.labelKey) }))} value={activeEndpointTab} @@ -2360,19 +2376,7 @@ function ProviderModelsModal({
{groupModels.map((m) => { const copyKey = `modal-${m.id}`; - return ( -
-
-

{t("endpoint.title")}

-

{t("endpoint.subtitle")}

-
- {useDisplayBaseUrl()}/v1 - {t("endpoint.testEndpoint")} -
-
-
- {t("endpoint.advancedProtocols")} -
+ return (