import { describe, expect, it } from "@effect/vitest"; import { createCatalogSnapshotV1, createEmptyCatalogV1, decodeCatalogSnapshotV1, mergeCatalogFragments, projectCatalogForAgentSdk, projectSymbolExpandedView, projectSymbolShallowView, validateCatalogInvariants,} from "./catalog";import { CapabilityIdSchema, DiagnosticIdSchema, DocumentIdSchema, ExecutableIdSchema, ExampleSymbolIdSchema, ParameterSymbolIdSchema, RequestBodySymbolIdSchema, ResourceIdSchema, ResponseSetIdSchema, ResponseSymbolIdSchema, ScopeIdSchema, SecuritySchemeSymbolIdSchema, ShapeSymbolIdSchema,} from "./ids";import type { CatalogV1, CatalogFragmentV1, ProvenanceRef } from "./model"; const put = <K extends string, V>(record: Record<K, V>, key: K, value: V) => { record[key] = value;}; const expectNullableShapeContains = ( catalog: CatalogV1, nullableShapeId: ReturnType<typeof ShapeSymbolIdSchema.make>, expectedInnerShapeId: ReturnType<typeof ShapeSymbolIdSchema.make>,) => { const shape = catalog.symbols[nullableShapeId]; if (shape?.kind !== "shape" || shape.node.type !== "anyOf") { throw new Error("Expected nullable anyOf shape"); } expect(shape.node.items).toContain(expectedInnerShapeId);}; const docId = DocumentIdSchema.make("doc_primary");const baseProvenance = (pointer: string): ProvenanceRef[] => [{ relation: "declared", documentId: docId, pointer,}]; const createHttpCatalog = (input: { collideIds?: boolean; method?: string;} = {}): CatalogV1 => { const catalog = createEmptyCatalogV1(); const resourceId = ResourceIdSchema.make("res_primary"); const scopeId = ScopeIdSchema.make("scope_service"); const authSchemeId = SecuritySchemeSymbolIdSchema.make("sym_security_oauth"); const bodyShapeId = ShapeSymbolIdSchema.make("shape_event_body"); const callShapeId = ShapeSymbolIdSchema.make("shape_event_call"); const pathGroupShapeId = ShapeSymbolIdSchema.make("shape_event_call_path"); const queryGroupShapeId = ShapeSymbolIdSchema.make("shape_event_call_query"); const resultShapeId = ShapeSymbolIdSchema.make("shape_event_result"); const stringShapeId = ShapeSymbolIdSchema.make("shape_string"); const idPathParamId = ParameterSymbolIdSchema.make("sym_param_path_event_id"); const calendarParamId = ParameterSymbolIdSchema.make("sym_param_path_calendar_id"); const queryParamId = ParameterSymbolIdSchema.make( input.collideIds ? "sym_param_query_id" : "sym_param_query_send_updates", ); const requestBodyId = RequestBodySymbolIdSchema.make("sym_request_body_event"); const responseId = ResponseSymbolIdSchema.make("sym_response_200"); const responseSetId = ResponseSetIdSchema.make("response_set_events_update"); const executableId = ExecutableIdSchema.make("exec_http_events_update"); const capabilityId = CapabilityIdSchema.make("cap_events_update"); const exampleId = ExampleSymbolIdSchema.make("sym_example_event_body"); const collisionDiagnosticId = DiagnosticIdSchema.make("diag_projection_collision_grouped_fields"); put(catalog.documents as Record<typeof docId, CatalogV1["documents"][typeof docId]>, docId, { id: docId, kind: "openapi", title: "Calendar API", fetchedAt: "2026-03-14T00:00:00.000Z", rawRef: "memory://calendar/openapi.json", }); put(catalog.resources as Record<typeof resourceId, CatalogV1["resources"][typeof resourceId]>, resourceId, { id: resourceId, documentId: docId, canonicalUri: "https://example.test/openapi.json", baseUri: "https://example.test/openapi.json", anchors: {}, dynamicAnchors: {}, synthetic: false, provenance: baseProvenance("#"), }); put(catalog.scopes as Record<typeof scopeId, CatalogV1["scopes"][typeof scopeId]>, scopeId, { id: scopeId, kind: "service", name: "Calendar", namespace: "google.calendar", docs: { summary: "Calendar service", description: "Manage calendar events.", }, synthetic: false, provenance: baseProvenance("#/servers/0"), }); put(catalog.symbols as Record<typeof authSchemeId, CatalogV1["symbols"][typeof authSchemeId]>, authSchemeId, { id: authSchemeId, kind: "securityScheme", schemeType: "oauth2", docs: { summary: "OAuth 2.0", }, oauth: { scopes: { "calendar.events": "Manage calendar events", }, }, synthetic: false, provenance: baseProvenance("#/components/securitySchemes/oauth2"), }); put(catalog.symbols as Record<typeof stringShapeId, CatalogV1["symbols"][typeof stringShapeId]>, stringShapeId, { id: stringShapeId, kind: "shape", resourceId, title: "String", node: { type: "scalar", scalar: "string", }, synthetic: false, provenance: baseProvenance("#/components/schemas/String"), }); put(catalog.symbols as Record<typeof bodyShapeId, CatalogV1["symbols"][typeof bodyShapeId]>, bodyShapeId, { id: bodyShapeId, kind: "shape", resourceId, title: "EventUpdateBody", node: { type: "object", fields: { summary: { shapeId: stringShapeId, }, }, additionalProperties: false, }, synthetic: false, provenance: baseProvenance("#/components/schemas/EventUpdateBody"), }); put(catalog.symbols as Record<typeof resultShapeId, CatalogV1["symbols"][typeof resultShapeId]>, resultShapeId, { id: resultShapeId, kind: "shape", resourceId, title: "Event", node: { type: "object", fields: { id: { shapeId: stringShapeId, }, summary: { shapeId: stringShapeId, }, }, required: ["id"], additionalProperties: false, }, synthetic: false, provenance: baseProvenance("#/components/schemas/Event"), }); if (input.collideIds) { put(catalog.symbols as Record<typeof pathGroupShapeId, CatalogV1["symbols"][typeof pathGroupShapeId]>, pathGroupShapeId, { id: pathGroupShapeId, kind: "shape", resourceId, title: "UpdateEventPathParams", node: { type: "object", fields: { id: { shapeId: stringShapeId }, eventId: { shapeId: stringShapeId }, }, required: ["id", "eventId"], additionalProperties: false, }, synthetic: false, provenance: baseProvenance("#/components/schemas/UpdateEventPathParams"), }); put(catalog.symbols as Record<typeof queryGroupShapeId, CatalogV1["symbols"][typeof queryGroupShapeId]>, queryGroupShapeId, { id: queryGroupShapeId, kind: "shape", resourceId, title: "UpdateEventQueryParams", node: { type: "object", fields: { id: { shapeId: stringShapeId }, }, required: ["id"], additionalProperties: false, }, synthetic: false, provenance: baseProvenance("#/components/schemas/UpdateEventQueryParams"), }); } put(catalog.symbols as Record<typeof callShapeId, CatalogV1["symbols"][typeof callShapeId]>, callShapeId, { id: callShapeId, kind: "shape", resourceId, title: "UpdateEventCall", node: input.collideIds ? { type: "object", fields: { path: { shapeId: pathGroupShapeId }, query: { shapeId: queryGroupShapeId }, body: { shapeId: bodyShapeId }, }, required: ["path", "query", "body"], additionalProperties: false, } : { type: "object", fields: { calendarId: { shapeId: stringShapeId }, eventId: { shapeId: stringShapeId }, sendUpdates: { shapeId: stringShapeId }, body: { shapeId: bodyShapeId }, }, required: ["calendarId", "eventId", "body"], additionalProperties: false, }, synthetic: false, provenance: baseProvenance("#/components/schemas/UpdateEventCall"), ...(input.collideIds ? { diagnosticIds: [collisionDiagnosticId] } : {}), }); put(catalog.symbols as Record<typeof exampleId, CatalogV1["symbols"][typeof exampleId]>, exampleId, { id: exampleId, kind: "example", exampleKind: "value", name: "Event body example", value: { summary: "Team sync", }, synthetic: false, provenance: baseProvenance("#/components/examples/EventBody"), }); put(catalog.symbols as Record<typeof calendarParamId, CatalogV1["symbols"][typeof calendarParamId]>, calendarParamId, { id: calendarParamId, kind: "parameter", name: input.collideIds ? "id" : "calendarId", location: "path", required: true, docs: { summary: "Calendar identifier", description: "The target calendar.", }, schemaShapeId: stringShapeId, synthetic: false, provenance: baseProvenance("#/paths/~1events~1{calendarId}/parameters/0"), }); put(catalog.symbols as Record<typeof idPathParamId, CatalogV1["symbols"][typeof idPathParamId]>, idPathParamId, { id: idPathParamId, kind: "parameter", name: "eventId", location: "path", required: true, docs: { summary: "Event identifier", }, schemaShapeId: stringShapeId, synthetic: false, provenance: baseProvenance("#/paths/~1events~1{eventId}/parameters/0"), }); put(catalog.symbols as Record<typeof queryParamId, CatalogV1["symbols"][typeof queryParamId]>, queryParamId, { id: queryParamId, kind: "parameter", name: input.collideIds ? "id" : "sendUpdates", location: "query", docs: { summary: "Notification mode", }, schemaShapeId: stringShapeId, synthetic: false, provenance: baseProvenance("#/paths/~1events/parameters/0"), }); put(catalog.symbols as Record<typeof requestBodyId, CatalogV1["symbols"][typeof requestBodyId]>, requestBodyId, { id: requestBodyId, kind: "requestBody", required: true, docs: { summary: "Event payload", }, contents: [ { mediaType: "application/json", shapeId: bodyShapeId, exampleIds: [exampleId], }, ], synthetic: false, provenance: baseProvenance("#/paths/~1events/requestBody"), }); put(catalog.symbols as Record<typeof responseId, CatalogV1["symbols"][typeof responseId]>, responseId, { id: responseId, kind: "response", docs: { summary: "Updated event", }, contents: [ { mediaType: "application/json", shapeId: resultShapeId, }, ], synthetic: false, provenance: baseProvenance("#/paths/~1events/responses/200"), }); put(catalog.responseSets as Record<typeof responseSetId, CatalogV1["responseSets"][typeof responseSetId]>, responseSetId, { id: responseSetId, variants: [ { match: { kind: "exact", status: 200, }, responseId, traits: ["success"], }, ], synthetic: false, provenance: baseProvenance("#/paths/~1events/responses"), }); if (input.collideIds) { put(catalog.diagnostics as Record<typeof collisionDiagnosticId, CatalogV1["diagnostics"][typeof collisionDiagnosticId]>, collisionDiagnosticId, { id: collisionDiagnosticId, level: "info", code: "projection_collision_grouped_fields", message: "Grouped parameter fields to avoid collisions", provenance: baseProvenance("#/paths/~1events/patch"), }); } put(catalog.executables as Record<typeof executableId, CatalogV1["executables"][typeof executableId]>, executableId, { id: executableId, capabilityId, scopeId, adapterKey: "openapi", bindingVersion: 1, binding: {}, projection: { responseSetId, callShapeId, }, display: { protocol: "http", method: input.method ?? "PATCH", pathTemplate: "/calendars/{calendarId}/events/{eventId}", operationId: "update", group: "events", leaf: "update", rawToolId: "events.update", title: "Update event", summary: "Update a calendar event.", }, synthetic: false, provenance: baseProvenance("#/paths/~1events/patch"), }); put(catalog.capabilities as Record<typeof capabilityId, CatalogV1["capabilities"][typeof capabilityId]>, capabilityId, { id: capabilityId, serviceScopeId: scopeId, surface: { toolPath: ["google", "calendar", "events", "update"], title: "Update event", summary: "Update a calendar event.", description: "Updates an existing event by ID.", tags: ["calendar", "events"], }, semantics: { effect: "write", safe: false, idempotent: false, destructive: false, }, auth: { kind: "scheme", schemeId: authSchemeId, scopes: ["calendar.events"], }, interaction: { approval: { mayRequire: true, reasons: ["write"], }, elicitation: { mayRequest: false, }, resume: { supported: true, }, }, executableIds: [executableId], preferredExecutableId: executableId, synthetic: false, provenance: baseProvenance("#/paths/~1events/patch"), }); return catalog;}; const createGraphqlCatalog = (): CatalogV1 => { const catalog = createEmptyCatalogV1(); const resourceId = ResourceIdSchema.make("res_graphql"); const scopeId = ScopeIdSchema.make("scope_graphql_service"); const argShapeId = ShapeSymbolIdSchema.make("shape_graphql_args"); const inputShapeId = ShapeSymbolIdSchema.make("shape_graphql_input"); const selectShapeId = ShapeSymbolIdSchema.make("shape_graphql_select"); const resultShapeId = ShapeSymbolIdSchema.make("shape_graphql_result"); const stringShapeId = ShapeSymbolIdSchema.make("shape_graphql_string"); const responseId = ResponseSymbolIdSchema.make("sym_graphql_response"); const responseSetId = ResponseSetIdSchema.make("response_set_graphql"); const executableId = ExecutableIdSchema.make("exec_graphql_update"); const capabilityId = CapabilityIdSchema.make("cap_graphql_update"); put(catalog.documents as Record<typeof docId, CatalogV1["documents"][typeof docId]>, docId, { id: docId, kind: "graphql-schema", title: "GraphQL schema", fetchedAt: "2026-03-14T00:00:00.000Z", rawRef: "memory://graphql/schema.json", }); put(catalog.resources as Record<typeof resourceId, CatalogV1["resources"][typeof resourceId]>, resourceId, { id: resourceId, documentId: docId, canonicalUri: "https://example.test/graphql", baseUri: "https://example.test/graphql", anchors: {}, dynamicAnchors: {}, synthetic: false, provenance: baseProvenance("#"), }); put(catalog.scopes as Record<typeof scopeId, CatalogV1["scopes"][typeof scopeId]>, scopeId, { id: scopeId, kind: "service", name: "GraphQL", synthetic: false, provenance: baseProvenance("#/schema"), }); put(catalog.symbols as Record<typeof stringShapeId, CatalogV1["symbols"][typeof stringShapeId]>, stringShapeId, { id: stringShapeId, kind: "shape", resourceId, title: "String", node: { type: "scalar", scalar: "string", }, synthetic: false, provenance: baseProvenance("#/$defs/String"), }); put(catalog.symbols as Record<typeof inputShapeId, CatalogV1["symbols"][typeof inputShapeId]>, inputShapeId, { id: inputShapeId, kind: "shape", resourceId, title: "UserInput", node: { type: "object", fields: { name: { shapeId: stringShapeId,Lines 1–500 of 859. Load more
import { describe, expect, it } from "@effect/vitest"; import { createCatalogSnapshotV1, createEmptyCatalogV1, decodeCatalogSnapshotV1, mergeCatalogFragments, projectCatalogForAgentSdk, projectSymbolExpandedView, projectSymbolShallowView, validateCatalogInvariants, } from "./catalog"; import { CapabilityIdSchema, DiagnosticIdSchema, DocumentIdSchema, ExecutableIdSchema, ExampleSymbolIdSchema, ParameterSymbolIdSchema, RequestBodySymbolIdSchema, ResourceIdSchema, ResponseSetIdSchema, ResponseSymbolIdSchema, ScopeIdSchema, SecuritySchemeSymbolIdSchema, ShapeSymbolIdSchema, } from "./ids"; import type { CatalogV1, CatalogFragmentV1, ProvenanceRef } from "./model"; const put = <K extends string, V>(record: Record<K, V>, key: K, value: V) => { record[key] = value; }; const expectNullableShapeContains = ( catalog: CatalogV1, nullableShapeId: ReturnType<typeof ShapeSymbolIdSchema.make>, expectedInnerShapeId: ReturnType<typeof ShapeSymbolIdSchema.make>, ) => { const shape = catalog.symbols[nullableShapeId]; if (shape?.kind !== "shape" || shape.node.type !== "anyOf") { throw new Error("Expected nullable anyOf shape"); } expect(shape.node.items).toContain(expectedInnerShapeId); }; const docId = DocumentIdSchema.make("doc_primary"); const baseProvenance = (pointer: string): ProvenanceRef[] => [{ relation: "declared", documentId: docId, pointer, }]; const createHttpCatalog = (input: { collideIds?: boolean; method?: string; } = {}): CatalogV1 => { const catalog = createEmptyCatalogV1(); const resourceId = ResourceIdSchema.make("res_primary"); const scopeId = ScopeIdSchema.make("scope_service"); const authSchemeId = SecuritySchemeSymbolIdSchema.make("sym_security_oauth"); const bodyShapeId = ShapeSymbolIdSchema.make("shape_event_body"); const callShapeId = ShapeSymbolIdSchema.make("shape_event_call"); const pathGroupShapeId = ShapeSymbolIdSchema.make("shape_event_call_path"); const queryGroupShapeId = ShapeSymbolIdSchema.make("shape_event_call_query"); const resultShapeId = ShapeSymbolIdSchema.make("shape_event_result"); const stringShapeId = ShapeSymbolIdSchema.make("shape_string"); const idPathParamId = ParameterSymbolIdSchema.make("sym_param_path_event_id"); const calendarParamId = ParameterSymbolIdSchema.make("sym_param_path_calendar_id"); const queryParamId = ParameterSymbolIdSchema.make( input.collideIds ? "sym_param_query_id" : "sym_param_query_send_updates", ); const requestBodyId = RequestBodySymbolIdSchema.make("sym_request_body_event"); const responseId = ResponseSymbolIdSchema.make("sym_response_200"); const responseSetId = ResponseSetIdSchema.make("response_set_events_update"); const executableId = ExecutableIdSchema.make("exec_http_events_update"); const capabilityId = CapabilityIdSchema.make("cap_events_update"); const exampleId = ExampleSymbolIdSchema.make("sym_example_event_body"); const collisionDiagnosticId = DiagnosticIdSchema.make("diag_projection_collision_grouped_fields"); put(catalog.documents as Record<typeof docId, CatalogV1["documents"][typeof docId]>, docId, { id: docId, kind: "openapi", title: "Calendar API", fetchedAt: "2026-03-14T00:00:00.000Z", rawRef: "memory://calendar/openapi.json", }); put(catalog.resources as Record<typeof resourceId, CatalogV1["resources"][typeof resourceId]>, resourceId, { id: resourceId, documentId: docId, canonicalUri: "https://example.test/openapi.json", baseUri: "https://example.test/openapi.json", anchors: {}, dynamicAnchors: {}, synthetic: false, provenance: baseProvenance("#"), }); put(catalog.scopes as Record<typeof scopeId, CatalogV1["scopes"][typeof scopeId]>, scopeId, { id: scopeId, kind: "service", name: "Calendar", namespace: "google.calendar", docs: { summary: "Calendar service", description: "Manage calendar events.", }, synthetic: false, provenance: baseProvenance("#/servers/0"), }); put(catalog.symbols as Record<typeof authSchemeId, CatalogV1["symbols"][typeof authSchemeId]>, authSchemeId, { id: authSchemeId, kind: "securityScheme", schemeType: "oauth2", docs: { summary: "OAuth 2.0", }, oauth: { scopes: { "calendar.events": "Manage calendar events", }, }, synthetic: false, provenance: baseProvenance("#/components/securitySchemes/oauth2"), }); put(catalog.symbols as Record<typeof stringShapeId, CatalogV1["symbols"][typeof stringShapeId]>, stringShapeId, { id: stringShapeId, kind: "shape", resourceId, title: "String", node: { type: "scalar", scalar: "string", }, synthetic: false, provenance: baseProvenance("#/components/schemas/String"), }); put(catalog.symbols as Record<typeof bodyShapeId, CatalogV1["symbols"][typeof bodyShapeId]>, bodyShapeId, { id: bodyShapeId, kind: "shape", resourceId, title: "EventUpdateBody", node: { type: "object", fields: { summary: { shapeId: stringShapeId, }, }, additionalProperties: false, }, synthetic: false, provenance: baseProvenance("#/components/schemas/EventUpdateBody"), }); put(catalog.symbols as Record<typeof resultShapeId, CatalogV1["symbols"][typeof resultShapeId]>, resultShapeId, { id: resultShapeId, kind: "shape", resourceId, title: "Event", node: { type: "object", fields: { id: { shapeId: stringShapeId, }, summary: { shapeId: stringShapeId, }, }, required: ["id"], additionalProperties: false, }, synthetic: false, provenance: baseProvenance("#/components/schemas/Event"), }); if (input.collideIds) { put(catalog.symbols as Record<typeof pathGroupShapeId, CatalogV1["symbols"][typeof pathGroupShapeId]>, pathGroupShapeId, { id: pathGroupShapeId, kind: "shape", resourceId, title: "UpdateEventPathParams", node: { type: "object", fields: { id: { shapeId: stringShapeId }, eventId: { shapeId: stringShapeId }, }, required: ["id", "eventId"], additionalProperties: false, }, synthetic: false, provenance: baseProvenance("#/components/schemas/UpdateEventPathParams"), }); put(catalog.symbols as Record<typeof queryGroupShapeId, CatalogV1["symbols"][typeof queryGroupShapeId]>, queryGroupShapeId, { id: queryGroupShapeId, kind: "shape", resourceId, title: "UpdateEventQueryParams", node: { type: "object", fields: { id: { shapeId: stringShapeId }, }, required: ["id"], additionalProperties: false, }, synthetic: false, provenance: baseProvenance("#/components/schemas/UpdateEventQueryParams"), }); } put(catalog.symbols as Record<typeof callShapeId, CatalogV1["symbols"][typeof callShapeId]>, callShapeId, { id: callShapeId, kind: "shape", resourceId, title: "UpdateEventCall", node: input.collideIds ? { type: "object", fields: { path: { shapeId: pathGroupShapeId }, query: { shapeId: queryGroupShapeId }, body: { shapeId: bodyShapeId }, }, required: ["path", "query", "body"], additionalProperties: false, } : { type: "object", fields: { calendarId: { shapeId: stringShapeId }, eventId: { shapeId: stringShapeId }, sendUpdates: { shapeId: stringShapeId }, body: { shapeId: bodyShapeId }, }, required: ["calendarId", "eventId", "body"], additionalProperties: false, }, synthetic: false, provenance: baseProvenance("#/components/schemas/UpdateEventCall"), ...(input.collideIds ? { diagnosticIds: [collisionDiagnosticId] } : {}), }); put(catalog.symbols as Record<typeof exampleId, CatalogV1["symbols"][typeof exampleId]>, exampleId, { id: exampleId, kind: "example", exampleKind: "value", name: "Event body example", value: { summary: "Team sync", }, synthetic: false, provenance: baseProvenance("#/components/examples/EventBody"), }); put(catalog.symbols as Record<typeof calendarParamId, CatalogV1["symbols"][typeof calendarParamId]>, calendarParamId, { id: calendarParamId, kind: "parameter", name: input.collideIds ? "id" : "calendarId", location: "path", required: true, docs: { summary: "Calendar identifier", description: "The target calendar.", }, schemaShapeId: stringShapeId, synthetic: false, provenance: baseProvenance("#/paths/~1events~1{calendarId}/parameters/0"), }); put(catalog.symbols as Record<typeof idPathParamId, CatalogV1["symbols"][typeof idPathParamId]>, idPathParamId, { id: idPathParamId, kind: "parameter", name: "eventId", location: "path", required: true, docs: { summary: "Event identifier", }, schemaShapeId: stringShapeId, synthetic: false, provenance: baseProvenance("#/paths/~1events~1{eventId}/parameters/0"), }); put(catalog.symbols as Record<typeof queryParamId, CatalogV1["symbols"][typeof queryParamId]>, queryParamId, { id: queryParamId, kind: "parameter", name: input.collideIds ? "id" : "sendUpdates", location: "query", docs: { summary: "Notification mode", }, schemaShapeId: stringShapeId, synthetic: false, provenance: baseProvenance("#/paths/~1events/parameters/0"), }); put(catalog.symbols as Record<typeof requestBodyId, CatalogV1["symbols"][typeof requestBodyId]>, requestBodyId, { id: requestBodyId, kind: "requestBody", required: true, docs: { summary: "Event payload", }, contents: [ { mediaType: "application/json", shapeId: bodyShapeId, exampleIds: [exampleId], }, ], synthetic: false, provenance: baseProvenance("#/paths/~1events/requestBody"), }); put(catalog.symbols as Record<typeof responseId, CatalogV1["symbols"][typeof responseId]>, responseId, { id: responseId, kind: "response", docs: { summary: "Updated event", }, contents: [ { mediaType: "application/json", shapeId: resultShapeId, }, ], synthetic: false, provenance: baseProvenance("#/paths/~1events/responses/200"), }); put(catalog.responseSets as Record<typeof responseSetId, CatalogV1["responseSets"][typeof responseSetId]>, responseSetId, { id: responseSetId, variants: [ { match: { kind: "exact", status: 200, }, responseId, traits: ["success"], }, ], synthetic: false, provenance: baseProvenance("#/paths/~1events/responses"), }); if (input.collideIds) { put(catalog.diagnostics as Record<typeof collisionDiagnosticId, CatalogV1["diagnostics"][typeof collisionDiagnosticId]>, collisionDiagnosticId, { id: collisionDiagnosticId, level: "info", code: "projection_collision_grouped_fields", message: "Grouped parameter fields to avoid collisions", provenance: baseProvenance("#/paths/~1events/patch"), }); } put(catalog.executables as Record<typeof executableId, CatalogV1["executables"][typeof executableId]>, executableId, { id: executableId, capabilityId, scopeId, adapterKey: "openapi", bindingVersion: 1, binding: {}, projection: { responseSetId, callShapeId, }, display: { protocol: "http", method: input.method ?? "PATCH", pathTemplate: "/calendars/{calendarId}/events/{eventId}", operationId: "update", group: "events", leaf: "update", rawToolId: "events.update", title: "Update event", summary: "Update a calendar event.", }, synthetic: false, provenance: baseProvenance("#/paths/~1events/patch"), }); put(catalog.capabilities as Record<typeof capabilityId, CatalogV1["capabilities"][typeof capabilityId]>, capabilityId, { id: capabilityId, serviceScopeId: scopeId, surface: { toolPath: ["google", "calendar", "events", "update"], title: "Update event", summary: "Update a calendar event.", description: "Updates an existing event by ID.", tags: ["calendar", "events"], }, semantics: { effect: "write", safe: false, idempotent: false, destructive: false, }, auth: { kind: "scheme", schemeId: authSchemeId, scopes: ["calendar.events"], }, interaction: { approval: { mayRequire: true, reasons: ["write"], }, elicitation: { mayRequest: false, }, resume: { supported: true, }, }, executableIds: [executableId], preferredExecutableId: executableId, synthetic: false, provenance: baseProvenance("#/paths/~1events/patch"), }); return catalog; }; const createGraphqlCatalog = (): CatalogV1 => { const catalog = createEmptyCatalogV1(); const resourceId = ResourceIdSchema.make("res_graphql"); const scopeId = ScopeIdSchema.make("scope_graphql_service"); const argShapeId = ShapeSymbolIdSchema.make("shape_graphql_args"); const inputShapeId = ShapeSymbolIdSchema.make("shape_graphql_input"); const selectShapeId = ShapeSymbolIdSchema.make("shape_graphql_select"); const resultShapeId = ShapeSymbolIdSchema.make("shape_graphql_result"); const stringShapeId = ShapeSymbolIdSchema.make("shape_graphql_string"); const responseId = ResponseSymbolIdSchema.make("sym_graphql_response"); const responseSetId = ResponseSetIdSchema.make("response_set_graphql"); const executableId = ExecutableIdSchema.make("exec_graphql_update"); const capabilityId = CapabilityIdSchema.make("cap_graphql_update"); put(catalog.documents as Record<typeof docId, CatalogV1["documents"][typeof docId]>, docId, { id: docId, kind: "graphql-schema", title: "GraphQL schema", fetchedAt: "2026-03-14T00:00:00.000Z", rawRef: "memory://graphql/schema.json", }); put(catalog.resources as Record<typeof resourceId, CatalogV1["resources"][typeof resourceId]>, resourceId, { id: resourceId, documentId: docId, canonicalUri: "https://example.test/graphql", baseUri: "https://example.test/graphql", anchors: {}, dynamicAnchors: {}, synthetic: false, provenance: baseProvenance("#"), }); put(catalog.scopes as Record<typeof scopeId, CatalogV1["scopes"][typeof scopeId]>, scopeId, { id: scopeId, kind: "service", name: "GraphQL", synthetic: false, provenance: baseProvenance("#/schema"), }); put(catalog.symbols as Record<typeof stringShapeId, CatalogV1["symbols"][typeof stringShapeId]>, stringShapeId, { id: stringShapeId, kind: "shape", resourceId, title: "String", node: { type: "scalar", scalar: "string", }, synthetic: false, provenance: baseProvenance("#/$defs/String"), }); put(catalog.symbols as Record<typeof inputShapeId, CatalogV1["symbols"][typeof inputShapeId]>, inputShapeId, { id: inputShapeId, kind: "shape", resourceId, title: "UserInput", node: { type: "object", fields: { name: { shapeId: stringShapeId,