diff --git a/lib/context/README.md b/lib/context/README.md index 3771d8eca..14e9faf94 100644 --- a/lib/context/README.md +++ b/lib/context/README.md @@ -277,3 +277,54 @@ withdrawal, replay and history behavior applies. This requires the database company-assessment purpose migration before API release. Local fixtures cover compile/save/reopen; they do not prove a hosted Records trial. + +### Withdraw a source + +Use the same HTTP `POST /api/context` or MCP Context operation to withdraw one +recorded source input of a saved request, for example a private note or an +incorrect page that must stop informing briefs: + +```json +{ + "action": "withdraw_source", + "request_id": "", + "source_version_id": "" +} +``` + +Name the source with exactly one of `source_id` or `source_version_id`; brief +and saved-brief input manifests expose version IDs as `sourceVersionIds`, and the +receipt returns the resolved `source_id`. Add `organization_id` for the existing authorized +organization scope; membership is rechecked inside the transaction. The source +must belong to the workspace and be recorded as an input of `request_id` through +saved result lineage; arbitrary IDs and sources only linked to other requests are +rejected. The operation calls the existing `withdraw_context_source` primitive: +every saved result that depends on any version of the source is relabelled +`withdrawn` (replacing its earlier status, such as `stale` or `partial`; rows are +kept), documents whose current result depended on it lose that result (revision +bumped), and `read_context_documents`, `accept_context_result` and +`read_context_brief` withhold the evidence on the next read, so saved briefs that +depend on it return `state: unavailable`. + +The withdrawal is sticky for that workspace, source kind and URL. Writers re-create +sources through the active-source index, so a database trigger makes any later +row with the same owner, kind and URL born withdrawn, after waiting for an +in-flight withdrawal to commit. A slow older job or a new ingestion therefore +cannot republish the source: writers that need that evidence accepted fail closed +with an acceptance conflict, and evidence kept against a born-withdrawn row stays +history that reads never return. Other workspaces and +other source kinds are unaffected. There is no restore operation yet, so delegated +MCP marks `withdraw_music_context_source` destructive. + +The receipt (`context-source-withdrawal-v1`) reports `withdrawn_at`, +`already_withdrawn` and the source's recorded lineage in `affected`: results that +depend on it, documents holding such a result, and the request IDs whose attempts +produced them. Replaying the same withdrawal returns the same receipt without +touching timestamps or revisions. A writer that already holds a document lock can +deadlock with a concurrent withdrawal; PostgreSQL aborts one transaction, the API +returns 409 and the caller retries. + +This does not delete original bytes or storage objects, correct or refresh +evidence, recompute briefs, de-duplicate articles, or spend credits; those remain +separate lifecycle work. It requires the database source-withdrawal migration +before API release. Fixture-tested only; not hosted-verified. diff --git a/lib/context/__tests__/sourceWithdrawalOperation.test.ts b/lib/context/__tests__/sourceWithdrawalOperation.test.ts new file mode 100644 index 000000000..b845560ad --- /dev/null +++ b/lib/context/__tests__/sourceWithdrawalOperation.test.ts @@ -0,0 +1,142 @@ +import { describe, expect, it, vi } from "vitest"; +import { contextOperationSchema, processContextOperation } from "../processContextOperation"; +// Isolate module initialization from hosted Supabase credentials; tests inject authorization. +vi.mock("../authorizeContextOwner", () => ({ authorizeContextOwner: vi.fn() })); +const actor = "11111111-1111-4111-8111-111111111111"; +const owner = "22222222-2222-4222-8222-222222222222"; +const request = "33333333-3333-4333-8333-333333333333"; +const source = "44444444-4444-4444-8444-444444444444"; +const version = "55555555-5555-4555-8555-555555555555"; +const input = { + action: "withdraw_source", + organization_id: owner, + request_id: request, + source_id: source, +}; +const receipt = { + contract_version: "context-source-withdrawal-v1", + request_id: request, + source_id: source, + withdrawn_at: "2026-10-10T12:00:00+00:00", + already_withdrawn: false, + affected: { results: 1, documents: 1, request_ids: [request] }, +}; +describe("source withdrawal operation", () => { + it("withdraws one recorded input through the actor-scoped RPC without collection", async () => { + const rpc = vi.fn(async () => receipt); + const dispatch = vi.fn(); + const authorize = vi.fn(async () => ({ + accountId: actor, + ownerId: owner, + organizationId: owner, + })); + expect(await processContextOperation(actor, input, { rpc, dispatch, authorize })).toEqual( + receipt, + ); + expect(authorize).toHaveBeenCalledWith(actor, owner); + expect(rpc).toHaveBeenCalledExactlyOnceWith("withdraw_context_request_source", { + p_actor: actor, + p_owner: owner, + p_request: request, + p_source: source, + p_source_version: null, + }); + expect(dispatch).not.toHaveBeenCalled(); + }); + it("uses the personal workspace when no organization is selected", async () => { + const rpc = vi.fn(async () => receipt); + const authorize = vi.fn(async () => ({ + accountId: actor, + ownerId: actor, + organizationId: null, + })); + const { organization_id: _omitted, ...personal } = input; + await processContextOperation(actor, personal, { rpc, dispatch: vi.fn(), authorize }); + expect(authorize).toHaveBeenCalledWith(actor, undefined); + expect(rpc).toHaveBeenCalledExactlyOnceWith("withdraw_context_request_source", { + p_actor: actor, + p_owner: actor, + p_request: request, + p_source: source, + p_source_version: null, + }); + }); + it("withdraws by a manifest source version and returns the resolved source", async () => { + const rpc = vi.fn(async () => receipt); + const authorize = vi.fn(async () => ({ + accountId: actor, + ownerId: owner, + organizationId: owner, + })); + const { source_id: _omitted, ...byVersion } = input; + expect( + await processContextOperation( + actor, + { ...byVersion, source_version_id: version }, + { rpc, dispatch: vi.fn(), authorize }, + ), + ).toEqual(receipt); + expect(rpc).toHaveBeenCalledExactlyOnceWith("withdraw_context_request_source", { + p_actor: actor, + p_owner: owner, + p_request: request, + p_source: null, + p_source_version: version, + }); + }); + it("requires exactly one source identifier", () => { + const { source_id: _omitted, ...neither } = input; + for (const value of [neither, { ...input, source_version_id: version }]) { + const parsed = contextOperationSchema.safeParse(value); + expect(parsed.success).toBe(false); + expect(parsed.error?.issues[0]).toMatchObject({ + path: ["source_id"], + message: "Provide exactly one of source_id or source_version_id", + }); + } + }); + it("passes an idempotent replay receipt through unchanged", async () => { + const replay = { ...receipt, already_withdrawn: true }; + const rpc = vi.fn(async () => replay); + const authorize = vi.fn(async () => ({ + accountId: actor, + ownerId: owner, + organizationId: owner, + })); + expect( + await processContextOperation(actor, input, { rpc, dispatch: vi.fn(), authorize }), + ).toEqual(replay); + }); + it("does not withdraw on revoked access", async () => { + const rpc = vi.fn(); + await expect( + processContextOperation(actor, input, { + rpc, + dispatch: vi.fn(), + authorize: vi.fn(async () => { + throw new Error("Access denied"); + }), + }), + ).rejects.toThrow("Access denied"); + expect(rpc).not.toHaveBeenCalled(); + }); + it("rejects fabricated actors, missing requests and non-UUID sources", () => { + expect(contextOperationSchema.safeParse(input).success).toBe(true); + for (const changes of [ + { account_id: actor }, + { delete_original: true }, + { request_id: undefined }, + { source_id: "not-a-uuid" }, + { source_version_id: "not-a-uuid", source_id: undefined }, + { organization_id: "" }, + ]) { + const parsed = contextOperationSchema.safeParse({ ...input, ...changes }); + expect(parsed.success).toBe(false); + const key = Object.keys(changes)[0]; + const issue = parsed.error?.issues[0]; + if (key === "account_id" || key === "delete_original") + expect(issue).toMatchObject({ code: "unrecognized_keys", keys: [key] }); + else expect(issue?.path).toEqual([key]); + } + }); +}); diff --git a/lib/context/__tests__/sourceWithdrawalTransports.test.ts b/lib/context/__tests__/sourceWithdrawalTransports.test.ts new file mode 100644 index 000000000..b0789acb0 --- /dev/null +++ b/lib/context/__tests__/sourceWithdrawalTransports.test.ts @@ -0,0 +1,93 @@ +import { afterEach, expect, it, vi } from "vitest"; +import { NextRequest } from "next/server"; +import { contextOperationHandler } from "../contextOperationHandler"; +import { registerContextTool } from "@/lib/mcp/tools/context/registerContextTool"; +import { callContextRpc } from "@/lib/supabase/context_requests/callContextRpc"; + +const actor = "11111111-1111-4111-8111-111111111111"; +const owner = "22222222-2222-4222-8222-222222222222"; +const request = "33333333-3333-4333-8333-333333333333"; +const source = "44444444-4444-4444-8444-444444444444"; +vi.mock("@/lib/auth/validateAuthContext", () => ({ + validateAuthContext: vi.fn(async () => ({ accountId: actor })), +})); +vi.mock("@/lib/mcp/resolveAccountId", () => ({ + resolveAccountId: vi.fn(async () => ({ accountId: actor, error: null })), +})); +vi.mock("../authorizeContextOwner", () => ({ + authorizeContextOwner: vi.fn(async () => ({ + accountId: actor, + ownerId: owner, + organizationId: owner, + })), +})); +vi.mock("@/lib/supabase/context_requests/callContextRpc", () => ({ callContextRpc: vi.fn() })); +vi.mock("../dispatchContextRequest", () => ({ dispatchContextRequest: vi.fn() })); +vi.mock("../dispatchContextReleaseVerification", () => ({ + dispatchContextReleaseVerification: vi.fn(), +})); +vi.mock("../dispatchContextReleaseTrackIsrcs", () => ({ + dispatchContextReleaseTrackIsrcs: vi.fn(), +})); +const operation = { + action: "withdraw_source", + organization_id: owner, + request_id: request, + source_id: source, +}; +const params = { + p_actor: actor, + p_owner: owner, + p_request: request, + p_source: source, + p_source_version: null, +}; +const receipt = { + contract_version: "context-source-withdrawal-v1", + request_id: request, + source_id: source, + withdrawn_at: "2026-10-10T12:00:00+00:00", + already_withdrawn: false, + affected: { results: 1, documents: 1, request_ids: [request] }, +}; +const http = (body: unknown) => + contextOperationHandler( + new NextRequest("http://localhost/api/context", { method: "POST", body: JSON.stringify(body) }), + ); +const mcp = async (body: unknown) => { + const registerTool = vi.fn(); + registerContextTool({ registerTool } as never); + const result = await registerTool.mock.calls[0][2](body, {}); + return JSON.parse(result.content[0].text); +}; + +afterEach(() => vi.clearAllMocks()); + +it("HTTP and MCP withdraw through the same actor-scoped RPC", async () => { + vi.mocked(callContextRpc).mockResolvedValue(receipt); + const response = await http(operation); + expect(response.status).toBe(200); + expect(await response.json()).toEqual(receipt); + expect(callContextRpc).toHaveBeenCalledExactlyOnceWith("withdraw_context_request_source", params); + vi.mocked(callContextRpc).mockClear(); + expect(await mcp(operation)).toEqual(receipt); + expect(callContextRpc).toHaveBeenCalledExactlyOnceWith("withdraw_context_request_source", params); +}); + +it("rejects a withdrawal without a source before any storage call", async () => { + const { source_id: _omitted, ...incomplete } = operation; + expect((await http(incomplete)).status).toBe(400); + expect(callContextRpc).not.toHaveBeenCalled(); +}); + +it("redacts storage failures on both transports", async () => { + vi.mocked(callContextRpc).mockRejectedValue( + new Error("Context storage operation failed: Source is not an input of this request"), + ); + const response = await http(operation); + expect(response.status).toBe(409); + expect(JSON.stringify(await response.json())).not.toContain("Source is not an input"); + const result = await mcp(operation); + expect(result).toMatchObject({ success: false }); + expect(JSON.stringify(result)).not.toContain("Source is not an input"); +}); diff --git a/lib/context/processContextOperation.ts b/lib/context/processContextOperation.ts index 7b53ac0ad..5c07eafb2 100644 --- a/lib/context/processContextOperation.ts +++ b/lib/context/processContextOperation.ts @@ -1,5 +1,7 @@ import { releaseCaseOperationSchemas } from "./releaseCaseOperationSchemas"; import { processReleaseCaseOperation } from "./processReleaseCaseOperation"; +import { sourceWithdrawalOperationSchemas } from "./sourceWithdrawalSchemas"; +import { processSourceWithdrawalOperation } from "./processSourceWithdrawalOperation"; import { createHash } from "node:crypto"; import { z } from "zod"; import { authorizeContextOwner } from "./authorizeContextOwner"; @@ -20,6 +22,7 @@ const briefFields = { export const contextOperationSchema = z.discriminatedUnion("action", [ ...releaseCaseOperationSchemas, + ...sourceWithdrawalOperationSchemas, z.strictObject({ action: z.literal("save_brief"), ...briefFields, @@ -199,6 +202,8 @@ export async function processContextOperation( args.action === "review_release_case" ) return processReleaseCaseOperation(accountId, ownerId, args, deps.rpc); + if (args.action === "withdraw_source") + return processSourceWithdrawalOperation(accountId, ownerId, args, deps.rpc); if (args.action === "read_brief") return { snapshot: await deps.rpc("read_context_brief", { p_owner: ownerId, p_brief: args.brief_id }), diff --git a/lib/context/processSourceWithdrawalOperation.ts b/lib/context/processSourceWithdrawalOperation.ts new file mode 100644 index 000000000..fe5a32a73 --- /dev/null +++ b/lib/context/processSourceWithdrawalOperation.ts @@ -0,0 +1,18 @@ +import type { SourceWithdrawalOperation } from "./sourceWithdrawalSchemas"; +import type { ContextSourceWithdrawalReceipt } from "./sourceWithdrawalTypes"; + +/** Withdraw one recorded source input after shared actor/workspace authorization; no deletion or recompute. */ +export async function processSourceWithdrawalOperation( + accountId: string, + ownerId: string, + args: SourceWithdrawalOperation, + rpc: (name: string, params: Record) => Promise, +) { + return (await rpc("withdraw_context_request_source", { + p_actor: accountId, + p_owner: ownerId, + p_request: args.request_id, + p_source: args.source_id ?? null, + p_source_version: args.source_version_id ?? null, + })) as ContextSourceWithdrawalReceipt; +} diff --git a/lib/context/sourceWithdrawalSchemas.ts b/lib/context/sourceWithdrawalSchemas.ts new file mode 100644 index 000000000..bc06172ac --- /dev/null +++ b/lib/context/sourceWithdrawalSchemas.ts @@ -0,0 +1,21 @@ +import { z } from "zod"; + +/** + * Withdraw one recorded source input of a saved request, named by its source ID or by one of + * its version IDs (brief input manifests expose sourceVersionIds). Rows are kept; nothing is deleted. + */ +export const sourceWithdrawalOperationSchemas = [ + z + .strictObject({ + action: z.literal("withdraw_source"), + organization_id: z.uuid().optional(), + request_id: z.uuid(), + source_id: z.uuid().optional(), + source_version_id: z.uuid().optional(), + }) + .refine(value => (value.source_id === undefined) !== (value.source_version_id === undefined), { + message: "Provide exactly one of source_id or source_version_id", + path: ["source_id"], + }), +] as const; +export type SourceWithdrawalOperation = z.infer<(typeof sourceWithdrawalOperationSchemas)[number]>; diff --git a/lib/context/sourceWithdrawalTypes.ts b/lib/context/sourceWithdrawalTypes.ts new file mode 100644 index 000000000..facc8b4f7 --- /dev/null +++ b/lib/context/sourceWithdrawalTypes.ts @@ -0,0 +1,19 @@ +/** Receipt from withdraw_context_request_source; counts come from recorded result lineage. */ +export interface ContextSourceWithdrawalReceipt { + contract_version: "context-source-withdrawal-v1"; + request_id: string; + /** The withdrawn source, also when the caller named it by a version ID. */ + source_id: string; + withdrawn_at: string; + /** True when the source was already withdrawn; timestamps and revisions are untouched. */ + already_withdrawn: boolean; + /** Recorded lineage of the source; identical on replay. */ + affected: { + /** Saved results that depend on any version of the source; all are now withdrawn. */ + results: number; + /** Documents holding such a result; any whose current result used the source now has none. */ + documents: number; + /** Every request whose saved attempts produced those results, including this one. */ + request_ids: string[]; + }; +} diff --git a/lib/mcp/oauth/__tests__/fullOAuthCatalog.test.ts b/lib/mcp/oauth/__tests__/fullOAuthCatalog.test.ts index 130005c52..67da85fdd 100644 --- a/lib/mcp/oauth/__tests__/fullOAuthCatalog.test.ts +++ b/lib/mcp/oauth/__tests__/fullOAuthCatalog.test.ts @@ -37,13 +37,21 @@ it("discovers the entire delegated catalog over the real MCP SDK", async () => { ].sort(), ); for (const tool of tools) expect(tool.inputSchema.properties).not.toHaveProperty("account_id"); - expect(tools).toHaveLength(84); + expect(tools).toHaveLength(85); for (const operation of Object.values(contextToolOperations)) { const tool = tools.find(tool => tool.name === operation.name)!; expect(Object.keys(tool.inputSchema.properties ?? {}).length).toBeGreaterThan(0); expect(tool.inputSchema.properties).not.toHaveProperty("action"); expect(tool.annotations?.readOnlyHint).toBe(operation.readOnly); + expect(tool.annotations?.destructiveHint).toBe( + "destructive" in operation ? operation.destructive : false, + ); } + const withdrawal = tools.find( + tool => tool.name === contextToolOperations.withdraw_source.name, + )!; + expect(withdrawal.annotations).toMatchObject({ readOnlyHint: false, destructiveHint: true }); + expect(withdrawal.description).toContain("Cannot be undone"); const artist = tools.find(tool => tool.name === "create_new_artist")!; expect(artist.inputSchema.properties).not.toHaveProperty("active_conversation_id"); expect(JSON.stringify(artist)).not.toMatch(/system prompt|copy.*conversation/i); diff --git a/lib/mcp/oauth/contextToolOperations.ts b/lib/mcp/oauth/contextToolOperations.ts index d729c64ca..d81dc1de7 100644 --- a/lib/mcp/oauth/contextToolOperations.ts +++ b/lib/mcp/oauth/contextToolOperations.ts @@ -148,4 +148,16 @@ export const contextToolOperations = { "Compile a creative direction or playlist pitch brief from saved music context without saving a snapshot.", readOnly: true, }, -} satisfies Record; + withdraw_source: { + name: "withdraw_music_context_source", + description: + "Withdraw one private or incorrect source recorded as an input of a saved context request, named by source_id or by a source_version_id from a brief manifest, so future authorized reads and briefs exclude it. Rows are kept; this does not delete original files or recompute anything.", + readOnly: false, + destructive: true, + notice: + "Cannot be undone: the source stays withdrawn in this workspace, later jobs cannot republish it, and dependent documents and saved briefs stop returning its evidence.", + }, +} satisfies Record< + Action, + { name: string; description: string; readOnly: boolean; destructive?: boolean; notice?: string } +>; diff --git a/lib/mcp/oauth/registerFullOAuthTools.ts b/lib/mcp/oauth/registerFullOAuthTools.ts index bdd05cced..5dbc9307f 100644 --- a/lib/mcp/oauth/registerFullOAuthTools.ts +++ b/lib/mcp/oauth/registerFullOAuthTools.ts @@ -33,7 +33,13 @@ export function registerFullOAuthTools( name: string, config: { description?: string; inputSchema: z.ZodType; annotations?: Record }, handler: (args: Args, extra: Extra) => Promise, - operation?: { name: string; action: string; readOnly: boolean }, + operation?: { + name: string; + action: string; + readOnly: boolean; + destructive?: boolean; + notice?: string; + }, ) => { // Credentials never belong in model-visible output. Professional roster tools // remain excluded until their delegated organization-grant audit is complete. @@ -66,7 +72,11 @@ export function registerFullOAuthTools( return; } const policy = operation - ? { readOnly: operation.readOnly, destructive: false, notice: "" } + ? { + readOnly: operation.readOnly, + destructive: operation.destructive ?? false, + notice: operation.notice ?? "", + } : fullOAuthToolPolicy[name]; if (!policy) throw new Error(`Missing delegated policy for ${name}`); const originalObject = diff --git a/lib/mcp/tools/context/registerContextTool.ts b/lib/mcp/tools/context/registerContextTool.ts index 5b3af1711..5f329ba0d 100644 --- a/lib/mcp/tools/context/registerContextTool.ts +++ b/lib/mcp/tools/context/registerContextTool.ts @@ -17,7 +17,7 @@ export function registerContextTool(server: McpServer) { "context", { description: - "Use list_release_cases and read_release_case to inspect saved release metadata without provider calls. review_release_case records metadata review only (reviewed or needs_changes), requires the exact current fingerprint and an idempotency key; it never approves rights or distribution. read_release_case_review retrieves an authorized historical receipt, withholding withdrawn evidence. Save reusable context from a Spotify track URL, read request progress, or compile a creative-direction/playlist-pitch evidence brief. For brief or save_brief, use request_id and optional additional_request_ids from the same workspace to combine saved song context without recollection. save_brief also requires idempotency_key and freezes the server-compiled output; use read_brief with brief_id for exact historical output. An unavailable snapshot withholds withdrawn evidence. Briefs include bounded text, per-request coverage and an input-version manifest. Inspect gaps; audio, lyrics, artwork analysis and research may be unavailable. Never treat partial context as full song understanding.", + "Use list_release_cases and read_release_case to inspect saved release metadata without provider calls. review_release_case records metadata review only (reviewed or needs_changes), requires the exact current fingerprint and an idempotency key; it never approves rights or distribution. read_release_case_review retrieves an authorized historical receipt, withholding withdrawn evidence. Save reusable context from a Spotify track URL, read request progress, or compile a creative-direction/playlist-pitch evidence brief. For brief or save_brief, use request_id and optional additional_request_ids from the same workspace to combine saved song context without recollection. save_brief also requires idempotency_key and freezes the server-compiled output; use read_brief with brief_id for exact historical output. An unavailable snapshot withholds withdrawn evidence. Briefs include bounded text, per-request coverage and an input-version manifest. Inspect gaps; audio, lyrics, artwork analysis and research may be unavailable. Never treat partial context as full song understanding. withdraw_source marks one recorded source input of a saved request withdrawn (request_id plus exactly one of source_id or a source_version_id from a brief manifest) so future authorized reads and briefs exclude it and later jobs cannot republish it. It cannot be undone; rows are kept, original files are not deleted and nothing is recomputed.", inputSchema: contextOperationSchema, }, async (args, extra) => { diff --git a/lib/supabase/context_requests/__tests__/sourceWithdrawalRpc.test.ts b/lib/supabase/context_requests/__tests__/sourceWithdrawalRpc.test.ts new file mode 100644 index 000000000..035df5eb2 --- /dev/null +++ b/lib/supabase/context_requests/__tests__/sourceWithdrawalRpc.test.ts @@ -0,0 +1,38 @@ +import { beforeEach, expect, it, vi } from "vitest"; +import { callContextRpc } from "../callContextRpc"; +import { processContextOperation } from "@/lib/context/processContextOperation"; + +const { rpc } = vi.hoisted(() => ({ rpc: vi.fn() })); +vi.mock("../../serverClient", () => ({ default: { rpc } })); +vi.mock("@/lib/context/authorizeContextOwner", () => ({ authorizeContextOwner: vi.fn() })); +const account = "00000000-0000-4000-8000-000000000001"; +const request = "00000000-0000-4000-8000-000000000002"; +const version = "00000000-0000-4000-8000-000000000003"; +beforeEach(() => vi.clearAllMocks()); +it("allows scoped source withdrawal through the real database adapter", async () => { + const receipt = { contract_version: "context-source-withdrawal-v1", already_withdrawn: false }; + rpc.mockResolvedValue({ data: receipt, error: null }); + const result = await processContextOperation( + account, + { action: "withdraw_source", request_id: request, source_version_id: version }, + { + authorize: async () => ({ accountId: account, ownerId: account, organizationId: null }), + rpc: callContextRpc, + dispatch: vi.fn(), + }, + ); + expect(result).toEqual(receipt); + expect(rpc).toHaveBeenCalledExactlyOnceWith("withdraw_context_request_source", { + p_actor: account, + p_owner: account, + p_request: request, + p_source: null, + p_source_version: version, + }); +}); +it("keeps the unscoped withdrawal primitive off the adapter allowlist", async () => { + await expect( + callContextRpc("withdraw_context_source", { p_owner: account, p_source: version }), + ).rejects.toThrow("Unknown context operation"); + expect(rpc).not.toHaveBeenCalled(); +}); diff --git a/lib/supabase/context_requests/callContextRpc.ts b/lib/supabase/context_requests/callContextRpc.ts index dab3f941d..18b1cb558 100644 --- a/lib/supabase/context_requests/callContextRpc.ts +++ b/lib/supabase/context_requests/callContextRpc.ts @@ -61,6 +61,7 @@ export async function callContextRpc( "fail_context_request", "read_context_documents", "resolve_context_spotify_release", + "withdraw_context_request_source", ]; if (!allowed.includes(name)) throw new Error("Unknown context operation"); const rpc = supabase.rpc.bind(supabase) as unknown as (