# Continuity ledger (per-branch)

## Human intent (must not be overwritten)

- Add useSWR with revalidateOnFocus to data stores so that newly added data stores are visible when returning to /workspaces/:id without page refresh
- Reuse the same fetch function for both initial server-side load and client-side SWR refetch
- Avoid creating an API route; use Server Action directly as SWR fetcher

## Goal (incl. success criteria)

- Data stores refresh automatically when the workspace page gains focus
- No page reload required to see newly created data stores
- Single Server Action (`getTeamDataStores`) shared between data-loader.ts and useSWR

## Constraints/Assumptions

- Follow existing pattern from `useDocumentVectorStores`
- Server Actions can be called from both server components and client components
- SWR's default `revalidateOnFocus: true` handles automatic refetch

## Key decisions

- Created `getTeamDataStores` Server Action in `lib/data-stores/actions.ts`
- Used Server Action directly as SWR fetcher instead of API route
- Added `fetchDataStores` optional function to `DataStoreContextValue` interface
- Created `useDataStores` hook that accepts fetcher as parameter

## State

- Implementation complete
- All verification passed: format, build-sdk, check-types, test, tidy

## Done

- Created `lib/data-stores/actions.ts` with `getTeamDataStores` Server Action
- Updated `data-loader.ts` to use the Server Action
- Created `use-data-stores.ts` hook with useSWR
- Updated `DataStoreContextValue` to include `fetchDataStores`
- Updated `page.client.tsx` to pass the Server Action
- Updated `DataStorePropertiesPanel` to use the new hook

## Now

- N/A (complete)

## Next

- N/A (complete)

## Open questions (UNCONFIRMED if needed)

- None

## Working set (files/ids/commands)

- `apps/studio.giselles.ai/lib/data-stores/actions.ts` (new)
- `apps/studio.giselles.ai/app/workspaces/[workspaceId]/data-loader.ts` (modified)
- `apps/studio.giselles.ai/app/workspaces/[workspaceId]/page.client.tsx` (modified)
- `internal-packages/workflow-designer-ui/src/editor/hooks/use-data-stores.ts` (new)
- `internal-packages/workflow-designer-ui/src/editor/properties-panel/data-store-properties-panel/index.tsx` (modified)
- `packages/react/src/data-store/context.tsx` (modified)

## 2026-02-11 `/tasks/[taskId]` authorization fix

### Key decisions

- Kept authorization check inline in `app/(main)/tasks/[taskId]/page.tsx` (no shared helper)
- Used the unified message `authorization error` only for refresh-time unauthorized access
- Preserved resource existence masking on first load with `notFound()` for both missing task and non-member
- Avoided relying on thrown Server Action error messages; `refreshAction` now returns an ActionResult-style object

### Files changed

- `apps/studio.giselles.ai/app/(main)/tasks/[taskId]/page.tsx`
- `apps/studio.giselles.ai/app/(main)/tasks/[taskId]/ui/task-client.tsx`

### Verification

- IDE linter (`ReadLints`) reports no diagnostics in changed files
- `pnpm exec biome check` is currently unavailable in this environment (`biome` command not found)
- Behavior alignment:
  - initial load: missing/non-member task -> `notFound()`
  - refresh: existing task + non-member -> `authorization error`
  - client: handles only `authorization error` with toast and `/tasks` redirect

## 2026-05-28 Remove Cohere embedding support

### Human intent

- Remove Cohere from the product/codebase.
- Keep the implementation small and aligned with existing OpenAI/Google embedding paths.

### Key decisions

- Removed Cohere from protocol embedding providers, model IDs, and built-in profiles.
- Removed Cohere embedding cost pricing/tests instead of keeping dead pricing data.
- Removed the placeholder Cohere RAG embedder path and its unused `not-implemented` helper.
- Simplified provider API key selection to OpenAI vs Google.
- Removed Studio UI filters/comments that existed only to hide Cohere.

### State

- Implementation complete.
- Verification passed: `pnpm format`, `pnpm build-sdk`, `pnpm check-types`, `pnpm tidy`, `pnpm test`.
- Final source/runtime text sweep passed: no remaining `Cohere`, `cohere`, or `COHERE` references outside continuity audit notes.

### Working set

- `packages/protocol/src/embedding/*`
- `packages/language-model/src/costs/*`
- `packages/rag/src/embedder/*`
- `packages/rag/src/ingest/pipeline.ts`
- `packages/rag/src/query-service/postgres/index.ts`
- `packages/rag/README.md`
- `packages/langfuse/src/trace-embedding.ts`
- `apps/studio.giselles.ai/app/(main)/settings/team/vector-stores/*`
- `apps/studio.giselles.ai/lib/vector-stores/document/ingest/generate-embeddings.ts`
