Source adapters now produce CatalogFragmentV1 instead of full CatalogSnapshotV1 objects. Fragments are assembled into snapshots at the sync boundary via createCatalogSnapshotV1FromFragments, keeping import metadata separate from catalog data. This prepares the IR pipeline for multi-fragment catalog composition.
Unified · Split
| @@ -1650,6 +1650,15 @@ export const createCatalogSnapshotV1 = (input: { · 1649 unmodified lines | ||
| 1650 | 1650 | }; |
| 1651 | 1651 | }; |
| 1652 | 1652 | |
| 1653 | +export const createCatalogSnapshotV1FromFragments = (input: { | |
| 1654 | + import: ImportMetadata; | |
| 1655 | + fragments: readonly CatalogFragmentV1[]; | |
| 1656 | +}) => | |
| 1657 | + createCatalogSnapshotV1({ | |
| 1658 | + import: input.import, | |
| 1659 | + catalog: mergeCatalogFragments(input.fragments), | |
| 1660 | + }); | |
| 1661 | + | |
| 1653 | 1662 | export const mergeCatalogFragments = (fragments: readonly CatalogFragmentV1[]): CatalogV1 => { |
| 1654 | 1663 | const catalog = emptyCatalog(); |
| 1655 | 1664 | const seenByCollection = new Map<string, string>(); |
| @@ -20,8 +20,9 @@ import { · 19 unmodified lines | ||
| 20 | 20 | } from "./local-source-artifacts"; |
| 21 | 21 | import type { ResolvedLocalWorkspaceContext } from "./local-config"; |
| 22 | 22 | import { |
| 23 | − createGraphqlCatalogSnapshot, | |
| 24 | − createOpenApiCatalogSnapshot, | |
| 23 | + createCatalogImportMetadata, | |
| 24 | + createGraphqlCatalogFragment, | |
| 25 | + createOpenApiCatalogFragment, | |
| 25 | 26 | } from "./source-catalog-snapshot"; |
| 26 | 27 | |
| 27 | 28 | const makeContext = (): ResolvedLocalWorkspaceContext => { |
| @@ -33,6 +34,7 @@ const makeContext = (): ResolvedLocalWorkspaceContext => { · 5 unmodified lines | ||
| 33 | 34 | configDirectory: join(workspaceRoot, ".executor"), |
| 34 | 35 | projectConfigPath: join(workspaceRoot, ".executor", "executor.jsonc"), |
| 35 | 36 | homeConfigPath: join(workspaceRoot, ".executor-home.jsonc"), |
| 37 | + homeStateDirectory: join(workspaceRoot, ".executor-home-state"), | |
| 36 | 38 | artifactsDirectory: join(workspaceRoot, ".executor", "artifacts"), |
| 37 | 39 | stateDirectory: join(workspaceRoot, ".executor", "state"), |
| 38 | 40 | }; |
| @@ -63,7 +65,7 @@ const makeSource = (): Source => ({ · 24 unmodified lines | ||
| 63 | 65 | |
| 64 | 66 | const makeArtifact = () => { |
| 65 | 67 | const source = makeSource(); |
| 66 | − const snapshot = createOpenApiCatalogSnapshot({ | |
| 68 | + const fragment = createOpenApiCatalogFragment({ | |
| 67 | 69 | source, |
| 68 | 70 | documents: [{ |
| 69 | 71 | documentKind: "openapi", |
| @@ -77,7 +79,11 @@ const makeArtifact = () => { · 7 unmodified lines | ||
| 77 | 79 | return buildLocalSourceArtifact({ |
| 78 | 80 | source, |
| 79 | 81 | syncResult: { |
| 80 | − snapshot, | |
| 82 | + fragment, | |
| 83 | + importMetadata: createCatalogImportMetadata({ | |
| 84 | + source, | |
| 85 | + adapterKey: "openapi", | |
| 86 | + }), | |
| 81 | 87 | sourceHash: source.sourceHash, |
| 82 | 88 | }, |
| 83 | 89 | }); |
| @@ -92,7 +98,7 @@ const makeGraphqlArtifact = () => { · 8 unmodified lines | ||
| 92 | 98 | defaultHeaders: null, |
| 93 | 99 | }, |
| 94 | 100 | }; |
| 95 | − const snapshot = createGraphqlCatalogSnapshot({ | |
| 101 | + const fragment = createGraphqlCatalogFragment({ | |
| 96 | 102 | source, |
| 97 | 103 | documents: [{ |
| 98 | 104 | documentKind: "graphql_introspection", |
| @@ -128,7 +134,11 @@ const makeGraphqlArtifact = () => { · 29 unmodified lines | ||
| 128 | 134 | return buildLocalSourceArtifact({ |
| 129 | 135 | source, |
| 130 | 136 | syncResult: { |
| 131 | − snapshot, | |
| 137 | + fragment, | |
| 138 | + importMetadata: createCatalogImportMetadata({ | |
| 139 | + source, | |
| 140 | + adapterKey: "graphql", | |
| 141 | + }), | |
| 132 | 142 | sourceHash: source.sourceHash, |
| 133 | 143 | }, |
| 134 | 144 | }); |
| @@ -16,10 +16,15 @@ import * as Schema from "effect/Schema"; · 15 unmodified lines | ||
| 16 | 16 | import { decodeCatalogSnapshotV1 } from "../ir/catalog"; |
| 17 | 17 | import { |
| 18 | 18 | CatalogSnapshotV1Schema, |
| 19 | + type CatalogSnapshotV1, | |
| 19 | 20 | type NativeBlob, |
| 20 | 21 | type SourceDocument, |
| 21 | 22 | } from "../ir/model"; |
| 22 | −import type { SourceCatalogSyncResult } from "./source-catalog-support"; | |
| 23 | +import { | |
| 24 | + contentHash, | |
| 25 | + snapshotFromSourceCatalogSyncResult, | |
| 26 | + type SourceCatalogSyncResult, | |
| 27 | +} from "./source-catalog-support"; | |
| 23 | 28 | import type { ResolvedLocalWorkspaceContext } from "./local-config"; |
| 24 | 29 | import { |
| 25 | 30 | LocalFileSystemError, |
| @@ -30,8 +35,6 @@ import { · 4 unmodified lines | ||
| 30 | 35 | createSourceCatalogRevisionRecord, |
| 31 | 36 | stableSourceCatalogId, |
| 32 | 37 | } from "./source-definitions"; |
| 33 | −import { contentHash } from "./source-catalog-support"; | |
| 34 | − | |
| 35 | 38 | const LOCAL_SOURCE_ARTIFACT_VERSION = 3 as const; |
| 36 | 39 | |
| 37 | 40 | export const LocalSourceArtifactSchema = Schema.Struct({ |
| @@ -155,10 +158,10 @@ const hydrateArtifactSourceDocuments = (input: { · 117 unmodified lines | ||
| 155 | 158 | return nextArtifact; |
| 156 | 159 | }; |
| 157 | 160 | |
| 158 | −const snapshotHash = (snapshot: SourceCatalogSyncResult["snapshot"]): string => | |
| 161 | +const snapshotHash = (snapshot: CatalogSnapshotV1): string => | |
| 159 | 162 | contentHash(JSON.stringify(snapshot)); |
| 160 | 163 | |
| 161 | −const importMetadataHash = (snapshot: SourceCatalogSyncResult["snapshot"]): string => | |
| 164 | +const importMetadataHash = (snapshot: { import: SourceCatalogSyncResult["importMetadata"] }): string => | |
| 162 | 165 | contentHash(JSON.stringify(snapshot.import)); |
| 163 | 166 | |
| 164 | 167 | export const buildLocalSourceArtifact = (input: { |
| @@ -167,13 +170,14 @@ export const buildLocalSourceArtifact = (input: { · 2 unmodified lines | ||
| 167 | 170 | }): LocalSourceArtifact => { |
| 168 | 171 | const catalogId: SourceCatalogId = stableSourceCatalogId(input.source); |
| 169 | 172 | const generatedAt = Date.now(); |
| 170 | − const importHash = importMetadataHash(input.syncResult.snapshot); | |
| 171 | − const hash = snapshotHash(input.syncResult.snapshot); | |
| 173 | + const snapshot = snapshotFromSourceCatalogSyncResult(input.syncResult); | |
| 174 | + const importHash = importMetadataHash(snapshot); | |
| 175 | + const hash = snapshotHash(snapshot); | |
| 172 | 176 | const revision = createSourceCatalogRevisionRecord({ |
| 173 | 177 | source: input.source, |
| 174 | 178 | catalogId, |
| 175 | 179 | revisionNumber: 1, |
| 176 | − importMetadataJson: JSON.stringify(input.syncResult.snapshot.import), | |
| 180 | + importMetadataJson: JSON.stringify(snapshot.import), | |
| 177 | 181 | importMetadataHash: importHash, |
| 178 | 182 | snapshotHash: hash, |
| 179 | 183 | }); |
| @@ -184,7 +188,7 @@ export const buildLocalSourceArtifact = (input: { · 4 unmodified lines | ||
| 184 | 188 | catalogId, |
| 185 | 189 | generatedAt, |
| 186 | 190 | revision, |
| 187 | − snapshot: input.syncResult.snapshot, | |
| 191 | + snapshot, | |
| 188 | 192 | }; |
| 189 | 193 | }; |
| 190 | 194 | |
| @@ -6,6 +6,7 @@ import { SourceIdSchema } from "#schema"; · 5 unmodified lines | ||
| 6 | 6 | import * as Effect from "effect/Effect"; |
| 7 | 7 | |
| 8 | 8 | import { googleDiscoverySourceAdapter } from "./google-discovery"; |
| 9 | +import { snapshotFromSourceCatalogSyncResult } from "../source-catalog-support"; | |
| 9 | 10 | import { createSourceFromPayload } from "../source-definitions"; |
| 10 | 11 | |
| 11 | 12 | const fetchLiveDiscoveryDocument = async (): Promise<string> => { |
| @@ -102,12 +103,14 @@ describe("google discovery source adapter", () => { · 90 unmodified lines | ||
| 102 | 103 | }), |
| 103 | 104 | }), |
| 104 | 105 | ); |
| 106 | + const snapshot = snapshotFromSourceCatalogSyncResult(syncResult); | |
| 105 | 107 | |
| 106 | − expect(Object.values(syncResult.snapshot.catalog.documents)[0]?.kind).toBe("google-discovery"); | |
| 107 | − expect(Object.keys(syncResult.snapshot.catalog.resources)).not.toHaveLength(0); | |
| 108 | − expect(Object.keys(syncResult.snapshot.catalog.capabilities).length).toBeGreaterThan(50); | |
| 108 | + expect(syncResult.fragment.version).toBe("ir.v1.fragment"); | |
| 109 | + expect(Object.values(snapshot.catalog.documents)[0]?.kind).toBe("google-discovery"); | |
| 110 | + expect(Object.keys(snapshot.catalog.resources)).not.toHaveLength(0); | |
| 111 | + expect(Object.keys(snapshot.catalog.capabilities).length).toBeGreaterThan(50); | |
| 109 | 112 | expect( |
| 110 | − Object.values(syncResult.snapshot.catalog.capabilities).some((capability) => | |
| 113 | + Object.values(snapshot.catalog.capabilities).some((capability) => | |
| 111 | 114 | capability.surface.toolPath.join(".") === "google.sheets.spreadsheets.values.get" |
| 112 | 115 | ), |
| 113 | 116 | ).toBe(true); |
| @@ -15,9 +15,11 @@ import * as Effect from "effect/Effect"; · 14 unmodified lines | ||
| 15 | 15 | import * as Schema from "effect/Schema"; |
| 16 | 16 | |
| 17 | 17 | import { |
| 18 | − createGoogleDiscoveryCatalogSnapshot, | |
| 18 | + createCatalogImportMetadata, | |
| 19 | + createGoogleDiscoveryCatalogFragment, | |
| 19 | 20 | type GoogleDiscoveryCatalogOperationInput, |
| 20 | 21 | } from "../source-catalog-snapshot"; |
| 22 | +import { createSourceCatalogSyncResult } from "../source-catalog-support"; | |
| 21 | 23 | import type { SourceAdapter } from "./types"; |
| 22 | 24 | import { |
| 23 | 25 | ConnectHttpAuthSchema, |
| @@ -336,8 +338,8 @@ export const googleDiscoverySourceAdapter: SourceAdapter = { · 312 unmodified lines | ||
| 336 | 338 | const definitions = compileGoogleDiscoveryToolDefinitions(manifest); |
| 337 | 339 | const now = Date.now(); |
| 338 | 340 | |
| 339 | − return { | |
| 340 | − snapshot: createGoogleDiscoveryCatalogSnapshot({ | |
| 341 | + return createSourceCatalogSyncResult({ | |
| 342 | + fragment: createGoogleDiscoveryCatalogFragment({ | |
| 341 | 343 | source, |
| 342 | 344 | documents: [{ |
| 343 | 345 | documentKind: "google_discovery", |
| @@ -352,8 +354,12 @@ export const googleDiscoverySourceAdapter: SourceAdapter = { · 8 unmodified lines | ||
| 352 | 354 | }) |
| 353 | 355 | ), |
| 354 | 356 | }), |
| 357 | + importMetadata: createCatalogImportMetadata({ | |
| 358 | + source, | |
| 359 | + adapterKey: "google_discovery", | |
| 360 | + }), | |
| 355 | 361 | sourceHash: manifest.sourceHash, |
| 356 | − }; | |
| 362 | + }); | |
| 357 | 363 | }), |
| 358 | 364 | getOauth2SetupConfig: ({ source }) => googleDiscoveryOauth2SetupConfig(source), |
| 359 | 365 | normalizeOauthClientInput: (input) => |
| @@ -16,9 +16,11 @@ import * as Effect from "effect/Effect"; · 15 unmodified lines | ||
| 16 | 16 | import * as Schema from "effect/Schema"; |
| 17 | 17 | |
| 18 | 18 | import { |
| 19 | − createGraphqlCatalogSnapshot, | |
| 19 | + createCatalogImportMetadata, | |
| 20 | + createGraphqlCatalogFragment, | |
| 20 | 21 | type GraphqlCatalogOperationInput, |
| 21 | 22 | } from "../source-catalog-snapshot"; |
| 23 | +import { createSourceCatalogSyncResult } from "../source-catalog-support"; | |
| 22 | 24 | import type { SourceAdapter } from "./types"; |
| 23 | 25 | import { |
| 24 | 26 | ConnectHttpAuthSchema, |
| @@ -327,8 +329,8 @@ export const graphqlSourceAdapter: SourceAdapter = { · 302 unmodified lines | ||
| 327 | 329 | }), |
| 328 | 330 | ); |
| 329 | 331 | const now = Date.now(); |
| 330 | − const snapshot = yield* Effect.sync(() => | |
| 331 | − createGraphqlCatalogSnapshot({ | |
| 332 | + const fragment = yield* Effect.sync(() => | |
| 333 | + createGraphqlCatalogFragment({ | |
| 332 | 334 | source, |
| 333 | 335 | documents: [{ |
| 334 | 336 | documentKind: "graphql_introspection", |
| @@ -347,10 +349,14 @@ export const graphqlSourceAdapter: SourceAdapter = { · 12 unmodified lines | ||
| 347 | 349 | }), |
| 348 | 350 | ); |
| 349 | 351 | |
| 350 | − return { | |
| 351 | − snapshot, | |
| 352 | + return createSourceCatalogSyncResult({ | |
| 353 | + fragment, | |
| 354 | + importMetadata: createCatalogImportMetadata({ | |
| 355 | + source, | |
| 356 | + adapterKey: "graphql", | |
| 357 | + }), | |
| 352 | 358 | sourceHash: manifest.sourceHash, |
| 353 | − }; | |
| 359 | + }); | |
| 354 | 360 | }).pipe( |
| 355 | 361 | Effect.withSpan("graphql.syncCatalog", { |
| 356 | 362 | attributes: { |
| @@ -2,6 +2,8 @@ import * as Effect from "effect/Effect"; · 1 unmodified line | ||
| 2 | 2 | import * as Schema from "effect/Schema"; |
| 3 | 3 | import type { Source } from "#schema"; |
| 4 | 4 | |
| 5 | +import { createCatalogImportMetadata } from "../source-catalog-snapshot"; | |
| 6 | +import { createSourceCatalogSyncResult } from "../source-catalog-support"; | |
| 5 | 7 | import type { SourceAdapter } from "./types"; |
| 6 | 8 | import { |
| 7 | 9 | decodeBindingConfig, |
| @@ -99,28 +101,19 @@ export const internalSourceAdapter: SourceAdapter = { · 91 unmodified lines | ||
| 99 | 101 | }; |
| 100 | 102 | }), |
| 101 | 103 | shouldAutoProbe: () => false, |
| 102 | − syncCatalog: () => Effect.succeed({ | |
| 103 | − snapshot: { | |
| 104 | − version: "ir.v1.snapshot", | |
| 105 | − import: { | |
| 106 | − sourceKind: "custom", | |
| 107 | − adapterKey: "internal", | |
| 104 | + syncCatalog: ({ source }) => | |
| 105 | + Effect.succeed(createSourceCatalogSyncResult({ | |
| 106 | + fragment: { | |
| 107 | + version: "ir.v1.fragment", | |
| 108 | + }, | |
| 109 | + importMetadata: { | |
| 110 | + ...createCatalogImportMetadata({ | |
| 111 | + source, | |
| 112 | + adapterKey: "internal", | |
| 113 | + }), | |
| 108 | 114 | importerVersion: "ir.v1.internal", |
| 109 | − importedAt: new Date().toISOString(), | |
| 110 | 115 | sourceConfigHash: "internal", |
| 111 | 116 | }, |
| 112 | − catalog: { | |
| 113 | − version: "ir.v1", | |
| 114 | − documents: {}, | |
| 115 | − resources: {}, | |
| 116 | − scopes: {}, | |
| 117 | − symbols: {}, | |
| 118 | − capabilities: {}, | |
| 119 | − executables: {}, | |
| 120 | − responseSets: {}, | |
| 121 | − diagnostics: {}, | |
| 122 | − }, | |
| 123 | − }, | |
| 124 | − sourceHash: null, | |
| 125 | − }), | |
| 117 | + sourceHash: null, | |
| 118 | + })), | |
| 126 | 119 | }; |
| @@ -26,6 +26,7 @@ import { · 25 unmodified lines | ||
| 26 | 26 | expandCatalogToolByPath, |
| 27 | 27 | type LoadedSourceCatalog, |
| 28 | 28 | } from "../source-catalog-runtime"; |
| 29 | +import { snapshotFromSourceCatalogSyncResult } from "../source-catalog-support"; | |
| 29 | 30 | import { createSourceFromPayload } from "../source-definitions"; |
| 30 | 31 | import { mcpSourceAdapter } from "./mcp"; |
| 31 | 32 | |
| @@ -252,13 +253,14 @@ describe("mcp source adapter", () => { · 220 unmodified lines | ||
| 252 | 253 | cookies: {}, |
| 253 | 254 | bodyValues: {}, |
| 254 | 255 | expiresAt: null, |
| 255 | − refreshAfter: null, | |
| 256 | − }), | |
| 256 | + refreshAfter: null, | |
| 257 | + }), | |
| 257 | 258 | }); |
| 259 | + const snapshot = snapshotFromSourceCatalogSyncResult(syncResult); | |
| 258 | 260 | |
| 259 | − const capability = Object.values(syncResult.snapshot.catalog.capabilities)[0]!; | |
| 260 | − const executable = Object.values(syncResult.snapshot.catalog.executables)[0]!; | |
| 261 | − const document = Object.values(syncResult.snapshot.catalog.documents)[0]!; | |
| 261 | + const capability = Object.values(snapshot.catalog.capabilities)[0]!; | |
| 262 | + const executable = Object.values(snapshot.catalog.executables)[0]!; | |
| 263 | + const document = Object.values(snapshot.catalog.documents)[0]!; | |
| 262 | 264 | const rawManifest = document.native?.[0]?.value; |
| 263 | 265 | |
| 264 | 266 | expect(capability.surface.title).toBe("Read File"); |
| @@ -339,14 +341,15 @@ describe("mcp source adapter", () => { · 74 unmodified lines | ||
| 339 | 341 | cookies: {}, |
| 340 | 342 | bodyValues: {}, |
| 341 | 343 | expiresAt: null, |
| 342 | − refreshAfter: null, | |
| 343 | − }), | |
| 344 | + refreshAfter: null, | |
| 345 | + }), | |
| 344 | 346 | }); |
| 347 | + const snapshot = snapshotFromSourceCatalogSyncResult(syncResult); | |
| 345 | 348 | |
| 346 | 349 | const tool = yield* expandCatalogToolByPath({ |
| 347 | 350 | catalogs: [makeLoadedCatalog({ |
| 348 | 351 | source, |
| 349 | − snapshot: syncResult.snapshot, | |
| 352 | + snapshot, | |
| 350 | 353 | })], |
| 351 | 354 | path: "mcp.demo.read_file", |
| 352 | 355 | }); |
| @@ -19,11 +19,13 @@ import * as Effect from "effect/Effect"; · 18 unmodified lines | ||
| 19 | 19 | import * as Schema from "effect/Schema"; |
| 20 | 20 | |
| 21 | 21 | import { |
| 22 | − createMcpCatalogSnapshot, | |
| 22 | + createCatalogImportMetadata, | |
| 23 | + createMcpCatalogFragment, | |
| 23 | 24 | type McpCatalogOperationInput, |
| 24 | 25 | } from "../source-catalog-snapshot"; |
| 25 | 26 | import { |
| 26 | 27 | contentHash, |
| 28 | + createSourceCatalogSyncResult, | |
| 27 | 29 | type SourceCatalogSyncResult, |
| 28 | 30 | } from "../source-catalog-support"; |
| 29 | 31 | import { namespaceFromSourceName } from "../source-names"; |
| @@ -160,8 +162,8 @@ export const catalogSyncResultFromMcpManifest = (input: { · 130 unmodified lines | ||
| 160 | 162 | const manifestJson = JSON.stringify(input.manifest); |
| 161 | 163 | const manifestHash = contentHash(manifestJson); |
| 162 | 164 | |
| 163 | − return { | |
| 164 | − snapshot: createMcpCatalogSnapshot({ | |
| 165 | + return createSourceCatalogSyncResult({ | |
| 166 | + fragment: createMcpCatalogFragment({ | |
| 165 | 167 | source: input.source, |
| 166 | 168 | documents: [{ |
| 167 | 169 | documentKind: "mcp_manifest", |
| @@ -176,8 +178,12 @@ export const catalogSyncResultFromMcpManifest = (input: { · 8 unmodified lines | ||
| 176 | 178 | }) |
| 177 | 179 | ), |
| 178 | 180 | }), |
| 181 | + importMetadata: createCatalogImportMetadata({ | |
| 182 | + source: input.source, | |
| 183 | + adapterKey: "mcp", | |
| 184 | + }), | |
| 179 | 185 | sourceHash: manifestHash, |
| 180 | − }; | |
| 186 | + }); | |
| 181 | 187 | }; |
| 182 | 188 | |
| 183 | 189 | export const mcpSourceAdapter: SourceAdapter = { |
| @@ -20,9 +20,11 @@ import * as Effect from "effect/Effect"; · 19 unmodified lines | ||
| 20 | 20 | import * as Schema from "effect/Schema"; |
| 21 | 21 | |
| 22 | 22 | import { |
| 23 | − createOpenApiCatalogSnapshot, | |
| 23 | + createCatalogImportMetadata, | |
| 24 | + createOpenApiCatalogFragment, | |
| 24 | 25 | type OpenApiCatalogOperationInput, |
| 25 | 26 | } from "../source-catalog-snapshot"; |
| 27 | +import { createSourceCatalogSyncResult } from "../source-catalog-support"; | |
| 26 | 28 | import type { SourceAdapter } from "./types"; |
| 27 | 29 | import { |
| 28 | 30 | ConnectHttpAuthSchema, |
| @@ -299,8 +301,8 @@ export const openApiSourceAdapter: SourceAdapter = { · 270 unmodified lines | ||
| 299 | 301 | const definitions = compileOpenApiToolDefinitions(manifest); |
| 300 | 302 | const now = Date.now(); |
| 301 | 303 | |
| 302 | − return { | |
| 303 | − snapshot: createOpenApiCatalogSnapshot({ | |
| 304 | + return createSourceCatalogSyncResult({ | |
| 305 | + fragment: createOpenApiCatalogFragment({ | |
| 304 | 306 | source, |
| 305 | 307 | documents: [{ |
| 306 | 308 | documentKind: "openapi", |
| @@ -314,7 +316,11 @@ export const openApiSourceAdapter: SourceAdapter = { · 7 unmodified lines | ||
| 314 | 316 | refHintTable: manifest.refHintTable, |
| 315 | 317 | })), |
| 316 | 318 | }), |
| 319 | + importMetadata: createCatalogImportMetadata({ | |
| 320 | + source, | |
| 321 | + adapterKey: "openapi", | |
| 322 | + }), | |
| 317 | 323 | sourceHash: manifest.sourceHash, |
| 318 | − }; | |
| 324 | + }); | |
| 319 | 325 | }), |
| 320 | 326 | }; |
| @@ -14,8 +14,7 @@ import type { · 13 unmodified lines | ||
| 14 | 14 | import type { Source } from "#schema"; |
| 15 | 15 | |
| 16 | 16 | import { |
| 17 | − createCatalogSnapshotV1, | |
| 18 | − createEmptyCatalogV1, | |
| 17 | + createCatalogSnapshotV1FromFragments, | |
| 19 | 18 | } from "../ir/catalog"; |
| 20 | 19 | import { |
| 21 | 20 | CapabilityIdSchema, |
| @@ -36,8 +35,8 @@ import { · 14 unmodified lines | ||
| 36 | 35 | import type { |
| 37 | 36 | AuthRequirement, |
| 38 | 37 | Capability, |
| 38 | + CatalogFragmentV1, | |
| 39 | 39 | CatalogSnapshotV1, |
| 40 | − CatalogV1, | |
| 41 | 40 | ContentSpec, |
| 42 | 41 | DocumentationBlock, |
| 43 | 42 | EffectKind, |
| @@ -63,6 +62,18 @@ import { namespaceFromSourceName } from "./source-names"; · 19 unmodified lines | ||
| 63 | 62 | |
| 64 | 63 | type JsonSchema = boolean | Record<string, unknown>; |
| 65 | 64 | |
| 65 | +type CatalogFragmentBuilder = { | |
| 66 | + version: "ir.v1.fragment"; | |
| 67 | + documents: NonNullable<CatalogFragmentV1["documents"]>; | |
| 68 | + resources: NonNullable<CatalogFragmentV1["resources"]>; | |
| 69 | + scopes: NonNullable<CatalogFragmentV1["scopes"]>; | |
| 70 | + symbols: NonNullable<CatalogFragmentV1["symbols"]>; | |
| 71 | + capabilities: NonNullable<CatalogFragmentV1["capabilities"]>; | |
| 72 | + executables: NonNullable<CatalogFragmentV1["executables"]>; | |
| 73 | + responseSets: NonNullable<CatalogFragmentV1["responseSets"]>; | |
| 74 | + diagnostics: NonNullable<CatalogFragmentV1["diagnostics"]>; | |
| 75 | +}; | |
| 76 | + | |
| 66 | 77 | export type CatalogSourceDocumentInput = { |
| 67 | 78 | documentKind: string; |
| 68 | 79 | documentKey: string; |
| @@ -262,8 +273,37 @@ const importMetadataFor = (input: { · 193 unmodified lines | ||
| 262 | 273 | }), |
| 263 | 274 | }); |
| 264 | 275 | |
| 276 | +export const createCatalogImportMetadata = (input: { | |
| 277 | + source: Source; | |
| 278 | + adapterKey: string; | |
| 279 | +}) => importMetadataFor(input); | |
| 280 | + | |
| 281 | +const createEmptyCatalogFragment = (): CatalogFragmentBuilder => ({ | |
| 282 | + version: "ir.v1.fragment", | |
| 283 | + documents: {}, | |
| 284 | + resources: {}, | |
| 285 | + scopes: {}, | |
| 286 | + symbols: {}, | |
| 287 | + capabilities: {}, | |
| 288 | + executables: {}, | |
| 289 | + responseSets: {}, | |
| 290 | + diagnostics: {}, | |
| 291 | +}); | |
| 292 | + | |
| 293 | +const finalizeCatalogFragment = (fragment: CatalogFragmentBuilder): CatalogFragmentV1 => ({ | |
| 294 | + version: "ir.v1.fragment", | |
| 295 | + ...(Object.keys(fragment.documents).length > 0 ? { documents: fragment.documents } : {}), | |
| 296 | + ...(Object.keys(fragment.resources).length > 0 ? { resources: fragment.resources } : {}), | |
| 297 | + ...(Object.keys(fragment.scopes).length > 0 ? { scopes: fragment.scopes } : {}), | |
| 298 | + ...(Object.keys(fragment.symbols).length > 0 ? { symbols: fragment.symbols } : {}), | |
| 299 | + ...(Object.keys(fragment.capabilities).length > 0 ? { capabilities: fragment.capabilities } : {}), | |
| 300 | + ...(Object.keys(fragment.executables).length > 0 ? { executables: fragment.executables } : {}), | |
| 301 | + ...(Object.keys(fragment.responseSets).length > 0 ? { responseSets: fragment.responseSets } : {}), | |
| 302 | + ...(Object.keys(fragment.diagnostics).length > 0 ? { diagnostics: fragment.diagnostics } : {}), | |
| 303 | +}); | |
| 304 | + | |
| 265 | 305 | const addDiagnostic = ( |
| 266 | − catalog: CatalogV1, | |
| 306 | + catalog: CatalogFragmentBuilder, | |
| 267 | 307 | input: Omit<ImportDiagnostic, "id">, |
| 268 | 308 | ) => { |
| 269 | 309 | const id = DiagnosticIdSchema.make(`diag_${stableHash(input)}`); |
| @@ -310,7 +350,7 @@ const docsFrom = (input: { · 40 unmodified lines | ||
| 310 | 350 | }; |
| 311 | 351 | |
| 312 | 352 | const createJsonSchemaImporter = (input: { |
| 313 | − catalog: CatalogV1; | |
| 353 | + catalog: CatalogFragmentBuilder; | |
| 314 | 354 | source: Source; |
| 315 | 355 | resourceId: ReturnType<typeof ResourceIdSchema.make>; |
| 316 | 356 | documentId: ReturnType<typeof DocumentIdSchema.make>; |
| @@ -800,7 +840,7 @@ const createJsonSchemaImporter = (input: { · 483 unmodified lines | ||
| 800 | 840 | }; |
| 801 | 841 | |
| 802 | 842 | const exampleSymbolFromValue = (input: { |
| 803 | − catalog: CatalogV1; | |
| 843 | + catalog: CatalogFragmentBuilder; | |
| 804 | 844 | source: Source; |
| 805 | 845 | documentId: ReturnType<typeof DocumentIdSchema.make>; |
| 806 | 846 | pointer: string; |
| @@ -886,7 +926,7 @@ const preferredResponseContentTypes = ( · 79 unmodified lines | ||
| 886 | 926 | }; |
| 887 | 927 | |
| 888 | 928 | const createServiceScope = (input: { |
| 889 | − catalog: CatalogV1; | |
| 929 | + catalog: CatalogFragmentBuilder; | |
| 890 | 930 | source: Source; |
| 891 | 931 | documentId: ReturnType<typeof DocumentIdSchema.make>; |
| 892 | 932 | defaults?: Scope["defaults"]; |
| @@ -936,7 +976,7 @@ const googleDiscoveryServerSpecs = ( · 43 unmodified lines | ||
| 936 | 976 | }; |
| 937 | 977 | |
| 938 | 978 | const createOperationScope = (input: { |
| 939 | − catalog: CatalogV1; | |
| 979 | + catalog: CatalogFragmentBuilder; | |
| 940 | 980 | source: Source; |
| 941 | 981 | documentId: ReturnType<typeof DocumentIdSchema.make>; |
| 942 | 982 | parentScopeId: ReturnType<typeof ScopeIdSchema.make>; |
| @@ -967,7 +1007,7 @@ const createOperationScope = (input: { · 24 unmodified lines | ||
| 967 | 1007 | }; |
| 968 | 1008 | |
| 969 | 1009 | const responseSetFromSingleResponse = (input: { |
| 970 | − catalog: CatalogV1; | |
| 1010 | + catalog: CatalogFragmentBuilder; | |
| 971 | 1011 | responseId: ReturnType<typeof ResponseSymbolIdSchema.make>; |
| 972 | 1012 | provenance: ProvenanceRef[]; |
| 973 | 1013 | traits?: ResponseSet["variants"][number]["traits"]; |
| @@ -993,7 +1033,7 @@ const responseSetFromSingleResponse = (input: { · 19 unmodified lines | ||
| 993 | 1033 | }; |
| 994 | 1034 | |
| 995 | 1035 | const responseSetFromVariants = (input: { |
| 996 | − catalog: CatalogV1; | |
| 1036 | + catalog: CatalogFragmentBuilder; | |
| 997 | 1037 | variants: ResponseSet["variants"]; |
| 998 | 1038 | provenance: ProvenanceRef[]; |
| 999 | 1039 | }) => { |
| @@ -1038,7 +1078,7 @@ const statusMatchFromHttpStatusCode = ( · 38 unmodified lines | ||
| 1038 | 1078 | }; |
| 1039 | 1079 | |
| 1040 | 1080 | const ensureOpenApiSecuritySchemeSymbol = (input: { |
| 1041 | − catalog: CatalogV1; | |
| 1081 | + catalog: CatalogFragmentBuilder; | |
| 1042 | 1082 | source: Source; |
| 1043 | 1083 | documentId: ReturnType<typeof DocumentIdSchema.make>; |
| 1044 | 1084 | schemeName: string; |
| @@ -1147,7 +1187,7 @@ const ensureOpenApiSecuritySchemeSymbol = (input: { · 102 unmodified lines | ||
| 1147 | 1187 | }; |
| 1148 | 1188 | |
| 1149 | 1189 | const openApiAuthRequirementToIr = (input: { |
| 1150 | − catalog: CatalogV1; | |
| 1190 | + catalog: CatalogFragmentBuilder; | |
| 1151 | 1191 | source: Source; |
| 1152 | 1192 | documentId: ReturnType<typeof DocumentIdSchema.make>; |
| 1153 | 1193 | authRequirement: OpenApiToolProviderData["authRequirement"] | undefined; |
| @@ -1199,7 +1239,7 @@ const openApiAuthRequirementToIr = (input: { · 45 unmodified lines | ||
| 1199 | 1239 | }; |
| 1200 | 1240 | |
| 1201 | 1241 | const contentSpecsFromOpenApiContents = (input: { |
| 1202 | − catalog: CatalogV1; | |
| 1242 | + catalog: CatalogFragmentBuilder; | |
| 1203 | 1243 | source: Source; |
| 1204 | 1244 | documentId: ReturnType<typeof DocumentIdSchema.make>; |
| 1205 | 1245 | importer: JsonSchemaImporter; |
| @@ -1239,7 +1279,7 @@ const contentSpecsFromOpenApiContents = (input: { · 33 unmodified lines | ||
| 1239 | 1279 | }); |
| 1240 | 1280 | |
| 1241 | 1281 | const createOpenApiHeaderSymbol = (input: { |
| 1242 | − catalog: CatalogV1; | |
| 1282 | + catalog: CatalogFragmentBuilder; | |
| 1243 | 1283 | source: Source; |
| 1244 | 1284 | documentId: ReturnType<typeof DocumentIdSchema.make>; |
| 1245 | 1285 | importer: JsonSchemaImporter; |
| @@ -1307,7 +1347,7 @@ const createOpenApiHeaderSymbol = (input: { · 61 unmodified lines | ||
| 1307 | 1347 | }; |
| 1308 | 1348 | |
| 1309 | 1349 | const createHttpCapabilityFromOpenApi = (input: { |
| 1310 | − catalog: CatalogV1; | |
| 1350 | + catalog: CatalogFragmentBuilder; | |
| 1311 | 1351 | source: Source; |
| 1312 | 1352 | documentId: ReturnType<typeof DocumentIdSchema.make>; |
| 1313 | 1353 | serviceScopeId: ReturnType<typeof ScopeIdSchema.make>; |
| @@ -1714,7 +1754,7 @@ const createHttpCapabilityFromOpenApi = (input: { · 400 unmodified lines | ||
| 1714 | 1754 | }; |
| 1715 | 1755 | |
| 1716 | 1756 | const createHttpCapabilityFromGoogleDiscovery = (input: { |
| 1717 | − catalog: CatalogV1; | |
| 1757 | + catalog: CatalogFragmentBuilder; | |
| 1718 | 1758 | source: Source; |
| 1719 | 1759 | documentId: ReturnType<typeof DocumentIdSchema.make>; |
| 1720 | 1760 | serviceScopeId: ReturnType<typeof ScopeIdSchema.make>; |
| @@ -1927,7 +1967,7 @@ const createHttpCapabilityFromGoogleDiscovery = (input: { · 206 unmodified lines | ||
| 1927 | 1967 | }; |
| 1928 | 1968 | |
| 1929 | 1969 | const createGraphqlCapability = (input: { |
| 1930 | − catalog: CatalogV1; | |
| 1970 | + catalog: CatalogFragmentBuilder; | |
| 1931 | 1971 | source: Source; |
| 1932 | 1972 | documentId: ReturnType<typeof DocumentIdSchema.make>; |
| 1933 | 1973 | serviceScopeId: ReturnType<typeof ScopeIdSchema.make>; |
| @@ -2047,7 +2087,7 @@ const createGraphqlCapability = (input: { · 113 unmodified lines | ||
| 2047 | 2087 | }; |
| 2048 | 2088 | |
| 2049 | 2089 | const createMcpCapability = (input: { |
| 2050 | − catalog: CatalogV1; | |
| 2090 | + catalog: CatalogFragmentBuilder; | |
| 2051 | 2091 | source: Source; |
| 2052 | 2092 | documentId: ReturnType<typeof DocumentIdSchema.make>; |
| 2053 | 2093 | serviceScopeId: ReturnType<typeof ScopeIdSchema.make>; |
| @@ -2147,19 +2187,18 @@ const createMcpCapability = (input: { · 93 unmodified lines | ||
| 2147 | 2187 | } satisfies Capability; |
| 2148 | 2188 | }; |
| 2149 | 2189 | |
| 2150 | −const buildCatalogSnapshot = (input: { | |
| 2190 | +const buildCatalogFragment = (input: { | |
| 2151 | 2191 | source: Source; |
| 2152 | − adapterKey: string; | |
| 2153 | 2192 | documents: readonly CatalogSourceDocumentInput[]; |
| 2154 | 2193 | serviceScopeDefaults?: Scope["defaults"]; |
| 2155 | 2194 | registerOperations: (context: { |
| 2156 | − catalog: CatalogV1; | |
| 2195 | + catalog: CatalogFragmentBuilder; | |
| 2157 | 2196 | documentId: ReturnType<typeof DocumentIdSchema.make>; |
| 2158 | 2197 | serviceScopeId: ReturnType<typeof ScopeIdSchema.make>; |
| 2159 | 2198 | importer: JsonSchemaImporter; |
| 2160 | 2199 | }) => void; |
| 2161 | −}): CatalogSnapshotV1 => { | |
| 2162 | − const catalog = createEmptyCatalogV1(); | |
| 2200 | +}): CatalogFragmentV1 => { | |
| 2201 | + const catalog = createEmptyCatalogFragment(); | |
| 2163 | 2202 | const documents = input.documents.length > 0 |
| 2164 | 2203 | ? input.documents |
| 2165 | 2204 | : [{ |
| @@ -2237,19 +2276,14 @@ const buildCatalogSnapshot = (input: { · 71 unmodified lines | ||
| 2237 | 2276 | }); |
| 2238 | 2277 | importer.finalize(); |
| 2239 | 2278 | |
| 2240 | − const snapshot = createCatalogSnapshotV1({ | |
| 2241 | − import: importMetadataFor(input), | |
| 2242 | − catalog, | |
| 2243 | − }); | |
| 2244 | − | |
| 2245 | − return snapshot; | |
| 2279 | + return finalizeCatalogFragment(catalog); | |
| 2246 | 2280 | }; |
| 2247 | 2281 | |
| 2248 | −export const createOpenApiCatalogSnapshot = (input: { | |
| 2282 | +export const createOpenApiCatalogFragment = (input: { | |
| 2249 | 2283 | source: Source; |
| 2250 | 2284 | documents: readonly CatalogSourceDocumentInput[]; |
| 2251 | 2285 | operations: readonly OpenApiCatalogOperationInput[]; |
| 2252 | −}): CatalogSnapshotV1 => { | |
| 2286 | +}): CatalogFragmentV1 => { | |
| 2253 | 2287 | const rootSchema = (() => { |
| 2254 | 2288 | const primaryDocumentText = input.documents[0]?.contentText; |
| 2255 | 2289 | if (!primaryDocumentText) { |
| @@ -2263,9 +2297,8 @@ export const createOpenApiCatalogSnapshot = (input: { · 7 unmodified lines | ||
| 2263 | 2297 | } |
| 2264 | 2298 | })(); |
| 2265 | 2299 | |
| 2266 | − return buildCatalogSnapshot({ | |
| 2300 | + return buildCatalogFragment({ | |
| 2267 | 2301 | source: input.source, |
| 2268 | − adapterKey: "openapi", | |
| 2269 | 2302 | documents: input.documents, |
| 2270 | 2303 | serviceScopeDefaults: (() => { |
| 2271 | 2304 | const documentServers = openApiServerSpecs( |
| @@ -2292,14 +2325,26 @@ export const createOpenApiCatalogSnapshot = (input: { · 20 unmodified lines | ||
| 2292 | 2325 | }); |
| 2293 | 2326 | }; |
| 2294 | 2327 | |
| 2295 | −export const createGoogleDiscoveryCatalogSnapshot = (input: { | |
| 2328 | +export const createOpenApiCatalogSnapshot = (input: { | |
| 2296 | 2329 | source: Source; |
| 2297 | 2330 | documents: readonly CatalogSourceDocumentInput[]; |
| 2298 | − operations: readonly GoogleDiscoveryCatalogOperationInput[]; | |
| 2331 | + operations: readonly OpenApiCatalogOperationInput[]; | |
| 2299 | 2332 | }): CatalogSnapshotV1 => |
| 2300 | − buildCatalogSnapshot({ | |
| 2333 | + createCatalogSnapshotV1FromFragments({ | |
| 2334 | + import: createCatalogImportMetadata({ | |
| 2335 | + source: input.source, | |
| 2336 | + adapterKey: "openapi", | |
| 2337 | + }), | |
| 2338 | + fragments: [createOpenApiCatalogFragment(input)], | |
| 2339 | + }); | |
| 2340 | + | |
| 2341 | +export const createGoogleDiscoveryCatalogFragment = (input: { | |
| 2342 | + source: Source; | |
| 2343 | + documents: readonly CatalogSourceDocumentInput[]; | |
| 2344 | + operations: readonly GoogleDiscoveryCatalogOperationInput[]; | |
| 2345 | +}): CatalogFragmentV1 => | |
| 2346 | + buildCatalogFragment({ | |
| 2301 | 2347 | source: input.source, |
| 2302 | − adapterKey: "google_discovery", | |
| 2303 | 2348 | documents: input.documents, |
| 2304 | 2349 | serviceScopeDefaults: (() => { |
| 2305 | 2350 | const servers = googleDiscoveryServerSpecs(input.operations[0]); |
| @@ -2319,14 +2364,26 @@ export const createGoogleDiscoveryCatalogSnapshot = (input: { · 13 unmodified lines | ||
| 2319 | 2364 | }, |
| 2320 | 2365 | }); |
| 2321 | 2366 | |
| 2322 | −export const createGraphqlCatalogSnapshot = (input: { | |
| 2367 | +export const createGoogleDiscoveryCatalogSnapshot = (input: { | |
| 2323 | 2368 | source: Source; |
| 2324 | 2369 | documents: readonly CatalogSourceDocumentInput[]; |
| 2325 | − operations: readonly GraphqlCatalogOperationInput[]; | |
| 2370 | + operations: readonly GoogleDiscoveryCatalogOperationInput[]; | |
| 2326 | 2371 | }): CatalogSnapshotV1 => |
| 2327 | − buildCatalogSnapshot({ | |
| 2372 | + createCatalogSnapshotV1FromFragments({ | |
| 2373 | + import: createCatalogImportMetadata({ | |
| 2374 | + source: input.source, | |
| 2375 | + adapterKey: "google_discovery", | |
| 2376 | + }), | |
| 2377 | + fragments: [createGoogleDiscoveryCatalogFragment(input)], | |
| 2378 | + }); | |
| 2379 | + | |
| 2380 | +export const createGraphqlCatalogFragment = (input: { | |
| 2381 | + source: Source; | |
| 2382 | + documents: readonly CatalogSourceDocumentInput[]; | |
| 2383 | + operations: readonly GraphqlCatalogOperationInput[]; | |
| 2384 | +}): CatalogFragmentV1 => | |
| 2385 | + buildCatalogFragment({ | |
| 2328 | 2386 | source: input.source, |
| 2329 | − adapterKey: "graphql", | |
| 2330 | 2387 | documents: input.documents, |
| 2331 | 2388 | registerOperations: ({ catalog, documentId, serviceScopeId, importer }) => { |
| 2332 | 2389 | for (const operation of input.operations) { |
| @@ -2342,14 +2399,26 @@ export const createGraphqlCatalogSnapshot = (input: { · 9 unmodified lines | ||
| 2342 | 2399 | }, |
| 2343 | 2400 | }); |
| 2344 | 2401 | |
| 2345 | −export const createMcpCatalogSnapshot = (input: { | |
| 2402 | +export const createGraphqlCatalogSnapshot = (input: { | |
| 2346 | 2403 | source: Source; |
| 2347 | 2404 | documents: readonly CatalogSourceDocumentInput[]; |
| 2348 | − operations: readonly McpCatalogOperationInput[]; | |
| 2405 | + operations: readonly GraphqlCatalogOperationInput[]; | |
| 2349 | 2406 | }): CatalogSnapshotV1 => |
| 2350 | − buildCatalogSnapshot({ | |
| 2407 | + createCatalogSnapshotV1FromFragments({ | |
| 2408 | + import: createCatalogImportMetadata({ | |
| 2409 | + source: input.source, | |
| 2410 | + adapterKey: "graphql", | |
| 2411 | + }), | |
| 2412 | + fragments: [createGraphqlCatalogFragment(input)], | |
| 2413 | + }); | |
| 2414 | + | |
| 2415 | +export const createMcpCatalogFragment = (input: { | |
| 2416 | + source: Source; | |
| 2417 | + documents: readonly CatalogSourceDocumentInput[]; | |
| 2418 | + operations: readonly McpCatalogOperationInput[]; | |
| 2419 | +}): CatalogFragmentV1 => | |
| 2420 | + buildCatalogFragment({ | |
| 2351 | 2421 | source: input.source, |
| 2352 | − adapterKey: "mcp", | |
| 2353 | 2422 | documents: input.documents, |
| 2354 | 2423 | registerOperations: ({ catalog, documentId, serviceScopeId, importer }) => { |
| 2355 | 2424 | for (const operation of input.operations) { |
| @@ -2364,3 +2433,16 @@ export const createMcpCatalogSnapshot = (input: { · 8 unmodified lines | ||
| 2364 | 2433 | } |
| 2365 | 2434 | }, |
| 2366 | 2435 | }); |
| 2436 | + | |
| 2437 | +export const createMcpCatalogSnapshot = (input: { | |
| 2438 | + source: Source; | |
| 2439 | + documents: readonly CatalogSourceDocumentInput[]; | |
| 2440 | + operations: readonly McpCatalogOperationInput[]; | |
| 2441 | +}): CatalogSnapshotV1 => | |
| 2442 | + createCatalogSnapshotV1FromFragments({ | |
| 2443 | + import: createCatalogImportMetadata({ | |
| 2444 | + source: input.source, | |
| 2445 | + adapterKey: "mcp", | |
| 2446 | + }), | |
| 2447 | + fragments: [createMcpCatalogFragment(input)], | |
| 2448 | + }); | |
| @@ -1,5 +1,10 @@ | ||
| 1 | 1 | import { sha256Hex } from "@executor/codemode-core"; |
| 2 | −import type { CatalogSnapshotV1 } from "../ir/model"; | |
| 2 | +import { createCatalogSnapshotV1FromFragments } from "../ir/catalog"; | |
| 3 | +import type { | |
| 4 | + CatalogFragmentV1, | |
| 5 | + CatalogSnapshotV1, | |
| 6 | + ImportMetadata, | |
| 7 | +} from "../ir/model"; | |
| 3 | 8 | |
| 4 | 9 | export const normalizeSearchText = ( |
| 5 | 10 | ...parts: ReadonlyArray<string | null | undefined> |
| @@ -13,6 +18,19 @@ export const normalizeSearchText = ( · 7 unmodified lines | ||
| 13 | 18 | export const contentHash = (value: string): string => sha256Hex(value); |
| 14 | 19 | |
| 15 | 20 | export type SourceCatalogSyncResult = { |
| 16 | − snapshot: CatalogSnapshotV1; | |
| 21 | + fragment: CatalogFragmentV1; | |
| 22 | + importMetadata: ImportMetadata; | |
| 17 | 23 | sourceHash: string | null; |
| 18 | 24 | }; |
| 25 | + | |
| 26 | +export const createSourceCatalogSyncResult = ( | |
| 27 | + input: SourceCatalogSyncResult, | |
| 28 | +): SourceCatalogSyncResult => input; | |
| 29 | + | |
| 30 | +export const snapshotFromSourceCatalogSyncResult = ( | |
| 31 | + syncResult: SourceCatalogSyncResult, | |
| 32 | +): CatalogSnapshotV1 => | |
| 33 | + createCatalogSnapshotV1FromFragments({ | |
| 34 | + import: syncResult.importMetadata, | |
| 35 | + fragments: [syncResult.fragment], | |
| 36 | + }); | |
| @@ -31,6 +31,7 @@ import { · 30 unmodified lines | ||
| 31 | 31 | catalogSyncResultFromMcpManifest, |
| 32 | 32 | } from "./source-adapters/mcp"; |
| 33 | 33 | import { SecretMaterialResolverService } from "./secret-material-providers"; |
| 34 | +import { snapshotFromSourceCatalogSyncResult } from "./source-catalog-support"; | |
| 34 | 35 | import { |
| 35 | 36 | refreshSourceTypeDeclarationInBackground, |
| 36 | 37 | } from "./source-type-declarations"; |
| @@ -139,6 +140,7 @@ const syncSourceCatalogWithDeps = ( · 102 unmodified lines | ||
| 139 | 140 | actorAccountId: input.actorAccountId, |
| 140 | 141 | }), |
| 141 | 142 | }); |
| 143 | + const snapshot = snapshotFromSourceCatalogSyncResult(syncResult); | |
| 142 | 144 | yield* deps.sourceArtifactStore.write({ |
| 143 | 145 | context: workspaceContext, |
| 144 | 146 | sourceId: input.source.id, |
| @@ -172,7 +174,7 @@ const syncSourceCatalogWithDeps = ( · 27 unmodified lines | ||
| 172 | 174 | refreshSourceTypeDeclarationInBackground({ |
| 173 | 175 | context: workspaceContext, |
| 174 | 176 | source: input.source, |
| 175 | − snapshot: syncResult.snapshot, | |
| 177 | + snapshot, | |
| 176 | 178 | }); |
| 177 | 179 | }); |
| 178 | 180 | }).pipe( |
| @@ -203,6 +205,7 @@ const persistMcpCatalogSnapshotFromManifestWithDeps = ( · 24 unmodified lines | ||
| 203 | 205 | endpoint: input.source.endpoint, |
| 204 | 206 | manifest: input.manifest, |
| 205 | 207 | }); |
| 208 | + const snapshot = snapshotFromSourceCatalogSyncResult(syncResult); | |
| 206 | 209 | |
| 207 | 210 | yield* deps.sourceArtifactStore.write({ |
| 208 | 211 | context: workspaceContext, |
| @@ -217,7 +220,7 @@ const persistMcpCatalogSnapshotFromManifestWithDeps = ( · 8 unmodified lines | ||
| 217 | 220 | refreshSourceTypeDeclarationInBackground({ |
| 218 | 221 | context: workspaceContext, |
| 219 | 222 | source: input.source, |
| 220 | − snapshot: syncResult.snapshot, | |
| 223 | + snapshot, | |
| 221 | 224 | }); |
| 222 | 225 | }); |
| 223 | 226 | }); |