@ggui-ai/registry-core 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/impls/memory-bundle-storage.d.ts.map +1 -1
  2. package/dist/impls/memory-bundle-storage.js +25 -22
  3. package/dist/impls/memory-registry-storage.d.ts.map +1 -1
  4. package/dist/impls/memory-registry-storage.js +10 -0
  5. package/dist/index.d.ts +4 -2
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +4 -1
  8. package/dist/interfaces/bundle-storage.d.ts +55 -31
  9. package/dist/interfaces/bundle-storage.d.ts.map +1 -1
  10. package/dist/interfaces/registry-storage.d.ts +24 -2
  11. package/dist/interfaces/registry-storage.d.ts.map +1 -1
  12. package/dist/mcp-tool-filters.d.ts +23 -0
  13. package/dist/mcp-tool-filters.d.ts.map +1 -0
  14. package/dist/mcp-tool-filters.js +14 -0
  15. package/dist/ops/compile.d.ts.map +1 -1
  16. package/dist/ops/compile.js +19 -1
  17. package/dist/ops/conformance.d.ts +8 -5
  18. package/dist/ops/conformance.d.ts.map +1 -1
  19. package/dist/ops/conformance.js +35 -7
  20. package/dist/ops/list-versions.d.ts +19 -10
  21. package/dist/ops/list-versions.d.ts.map +1 -1
  22. package/dist/ops/list-versions.js +43 -8
  23. package/dist/ops/private-read-authz.d.ts +88 -0
  24. package/dist/ops/private-read-authz.d.ts.map +1 -0
  25. package/dist/ops/private-read-authz.js +58 -0
  26. package/dist/ops/publish.d.ts +30 -0
  27. package/dist/ops/publish.d.ts.map +1 -1
  28. package/dist/ops/publish.js +163 -29
  29. package/dist/ops/read.d.ts +28 -6
  30. package/dist/ops/read.d.ts.map +1 -1
  31. package/dist/ops/read.js +47 -7
  32. package/dist/ops/search.d.ts +18 -3
  33. package/dist/ops/search.d.ts.map +1 -1
  34. package/dist/ops/search.js +54 -2
  35. package/dist/testing/bundle-storage-contract.d.ts.map +1 -1
  36. package/dist/testing/bundle-storage-contract.js +61 -27
  37. package/dist/testing/registry-storage-contract.d.ts.map +1 -1
  38. package/dist/testing/registry-storage-contract.js +148 -1
  39. package/dist/types.d.ts +115 -16
  40. package/dist/types.d.ts.map +1 -1
  41. package/dist/types.js +30 -14
  42. package/dist/utils/lazy-import.d.ts +17 -0
  43. package/dist/utils/lazy-import.d.ts.map +1 -0
  44. package/dist/utils/lazy-import.js +27 -0
  45. package/package.json +11 -5
@@ -1 +1 @@
1
- {"version":3,"file":"memory-bundle-storage.d.ts","sourceRoot":"","sources":["../../src/impls/memory-bundle-storage.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAErE,MAAM,WAAW,4BAA4B;IAC3C;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,wBAAgB,qBAAqB,CACnC,OAAO,GAAE,4BAAiC,GACzC,aAAa,CA2Cf"}
1
+ {"version":3,"file":"memory-bundle-storage.d.ts","sourceRoot":"","sources":["../../src/impls/memory-bundle-storage.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAGrE,MAAM,WAAW,4BAA4B;IAC3C;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,wBAAgB,qBAAqB,CACnC,OAAO,GAAE,4BAAiC,GACzC,aAAa,CAkDf"}
@@ -3,38 +3,41 @@ export function inMemoryBundleStorage(options = {}) {
3
3
  const bundles = new Map();
4
4
  const signatures = new Map();
5
5
  const manifests = new Map();
6
- const key = (scope, name, version) => `${scope}/${name}/${version}`;
6
+ // Visibility segments the key (H1 prefix split) — a blob written
7
+ // `public` must be invisible to a `private` read of the same triple,
8
+ // exactly like the prefix-split object keys of the durable impls.
9
+ const key = (scope, name, version, visibility) => `${visibility}/${scope}/${name}/${version}`;
7
10
  return {
8
- async putBundle(scope, name, version, bytes) {
9
- bundles.set(key(scope, name, version), new Uint8Array(bytes));
10
- return this.bundleUrl(scope, name, version);
11
+ async putBundle(scope, name, version, visibility, bytes) {
12
+ bundles.set(key(scope, name, version, visibility), new Uint8Array(bytes));
13
+ return this.bundleUrl(scope, name, version, visibility);
11
14
  },
12
- async getBundle(scope, name, version) {
13
- const bytes = bundles.get(key(scope, name, version));
15
+ async getBundle(scope, name, version, visibility) {
16
+ const bytes = bundles.get(key(scope, name, version, visibility));
14
17
  return bytes === undefined ? null : new Uint8Array(bytes);
15
18
  },
16
- async putSignature(scope, name, version, signature) {
17
- signatures.set(key(scope, name, version), signature);
18
- return this.signatureUrl(scope, name, version);
19
+ async putSignature(scope, name, version, visibility, signature) {
20
+ signatures.set(key(scope, name, version, visibility), signature);
21
+ return this.signatureUrl(scope, name, version, visibility);
19
22
  },
20
- async getSignature(scope, name, version) {
21
- return signatures.get(key(scope, name, version)) ?? null;
23
+ async getSignature(scope, name, version, visibility) {
24
+ return signatures.get(key(scope, name, version, visibility)) ?? null;
22
25
  },
23
- async putManifest(scope, name, version, manifest) {
24
- manifests.set(key(scope, name, version), manifest);
25
- return this.manifestUrl(scope, name, version);
26
+ async putManifest(scope, name, version, visibility, manifest) {
27
+ manifests.set(key(scope, name, version, visibility), manifest);
28
+ return this.manifestUrl(scope, name, version, visibility);
26
29
  },
27
- async getManifest(scope, name, version) {
28
- return manifests.get(key(scope, name, version)) ?? null;
30
+ async getManifest(scope, name, version, visibility) {
31
+ return manifests.get(key(scope, name, version, visibility)) ?? null;
29
32
  },
30
- bundleUrl(scope, name, version) {
31
- return `${bundleHost}/bundles/${scope}/${name}/${version}/bundle.js`;
33
+ bundleUrl(scope, name, version, visibility) {
34
+ return `${bundleHost}/bundles/${visibility}/${scope}/${name}/${version}/bundle.js`;
32
35
  },
33
- signatureUrl(scope, name, version) {
34
- return `${bundleHost}/bundles/${scope}/${name}/${version}/bundle.js.sig`;
36
+ signatureUrl(scope, name, version, visibility) {
37
+ return `${bundleHost}/bundles/${visibility}/${scope}/${name}/${version}/bundle.js.sig`;
35
38
  },
36
- manifestUrl(scope, name, version) {
37
- return `${bundleHost}/bundles/${scope}/${name}/${version}/manifest.json`;
39
+ manifestUrl(scope, name, version, visibility) {
40
+ return `${bundleHost}/bundles/${visibility}/${scope}/${name}/${version}/manifest.json`;
38
41
  },
39
42
  };
40
43
  }
@@ -1 +1 @@
1
- {"version":3,"file":"memory-registry-storage.d.ts","sourceRoot":"","sources":["../../src/impls/memory-registry-storage.ts"],"names":[],"mappings":"AAmBA,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,mCAAmC,CAAC;AAK3C,wBAAgB,uBAAuB,IAAI,eAAe,CA2JzD"}
1
+ {"version":3,"file":"memory-registry-storage.d.ts","sourceRoot":"","sources":["../../src/impls/memory-registry-storage.ts"],"names":[],"mappings":"AAoBA,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,mCAAmC,CAAC;AAM3C,wBAAgB,uBAAuB,IAAI,eAAe,CA2JzD"}
@@ -1,4 +1,5 @@
1
1
  import { AuthorKeyAlreadyExistsError, } from '../interfaces/registry-storage.js';
2
+ import { matchesMcpToolFilters } from '../mcp-tool-filters.js';
2
3
  const DEFAULT_LIMIT = 50;
3
4
  const MAX_LIMIT = 200;
4
5
  export function inMemoryRegistryStorage() {
@@ -173,10 +174,19 @@ function parseCursor(cursor) {
173
174
  return n;
174
175
  }
175
176
  function rowMatchesFilter(row, q) {
177
+ // #474 — visibility gating lives INSIDE every scanArtifacts impl
178
+ // (the ruled canonical location); the search op's post-filter stays
179
+ // as defense-in-depth. Without this, private rows would consume
180
+ // page slots on self-host impls even though the op filters them out
181
+ // before they ever reach the wire.
182
+ if (row.visibility !== 'public')
183
+ return false;
176
184
  if (q.kind !== undefined && row.kind !== q.kind)
177
185
  return false;
178
186
  if (q.hook !== undefined && row.hook !== q.hook)
179
187
  return false;
188
+ if (!matchesMcpToolFilters(row.mcpTools, q))
189
+ return false;
180
190
  if (q.tag !== undefined) {
181
191
  if (row.tags === undefined || !row.tags.includes(q.tag))
182
192
  return false;
package/dist/index.d.ts CHANGED
@@ -10,11 +10,12 @@
10
10
  export type { AuthnContext } from './interfaces/authn.js';
11
11
  export type { BundleStorage } from './interfaces/bundle-storage.js';
12
12
  export { AuthorKeyAlreadyExistsError, type PutAuthorKeyOptions, type RegistryStorage, type ScopeOwnerExpectation, } from './interfaces/registry-storage.js';
13
- export { ARTIFACTS_METADATA_SK, type ArtifactKind, type ArtifactScanFilter, type ArtifactVersionRow, type ArtifactsMetadataRow, type AuthorKeyListEntry, type AuthorKeyRow, type CompiledBlobRow, DELETE_AUTHOR_KEY_ERROR_CODES, type DeleteAuthorKeyErrorBody, type DeleteAuthorKeyErrorCode, type DeleteAuthorKeyResponseBody, type ErrorBody, LIST_AUTHOR_KEYS_ERROR_CODES, type ListAuthorKeysErrorBody, type ListAuthorKeysErrorCode, type ListAuthorKeysResponseBody, LIST_VERSIONS_ERROR_CODES, type ListVersionsErrorBody, type ListVersionsErrorCode, type ListVersionsResponse, PUBLISH_ERROR_CODES, type PublishErrorBody, type PublishErrorCode, type PublishRequestBody, type PublishResponseBody, READ_ERROR_CODES, type ReadErrorBody, type ReadErrorCode, type ReadPkgResponse, REGISTER_AUTHOR_KEY_ERROR_CODES, type RegisterAuthorKeyErrorBody, type RegisterAuthorKeyErrorCode, type RegisterAuthorKeyRequestBody, type RegisterAuthorKeyResponseBody, SCOPE_VERIFICATIONS, type ScopeOwnerRow, type ScopeVerification, SEARCH_ERROR_CODES, SEARCH_SORT_OPTIONS, unauthorizedErrorBody, type SearchErrorBody, type SearchErrorCode, type SearchResponse, type SearchResultEntry, type SearchSort, type VersionListEntry, type Visibility, } from './types.js';
13
+ export { ARTIFACTS_METADATA_SK, type ArtifactKind, type ArtifactScanFilter, type ArtifactVersionRow, type ArtifactsMetadataRow, type AuthorKeyListEntry, type AuthorKeyRow, type CompiledBlobRow, DELETE_AUTHOR_KEY_ERROR_CODES, type DeleteAuthorKeyErrorBody, type DeleteAuthorKeyErrorCode, type DeleteAuthorKeyResponseBody, type ErrorBody, LIST_AUTHOR_KEYS_ERROR_CODES, type ListAuthorKeysErrorBody, type ListAuthorKeysErrorCode, type ListAuthorKeysResponseBody, LIST_VERSIONS_ERROR_CODES, type ListVersionsErrorBody, type ListVersionsErrorCode, type ListVersionsResponse, PUBLISH_ERROR_CODES, type PublishErrorBody, type PublishErrorCode, type PublishRequestBody, type PublishResponseBody, READ_ERROR_CODES, type ReadErrorBody, type ReadErrorCode, type ReadPkgResponse, REGISTER_AUTHOR_KEY_ERROR_CODES, type RegisterAuthorKeyErrorBody, type RegisterAuthorKeyErrorCode, type RegisterAuthorKeyRequestBody, type RegisterAuthorKeyResponseBody, SAN_ALLOWLIST_INVALID, type SanAllowlistInvalid, SCOPE_VERIFICATIONS, type ScopeOwnerRow, type ScopeVerification, SEARCH_ERROR_CODES, SEARCH_SORT_OPTIONS, unauthorizedErrorBody, type SearchErrorBody, type SearchErrorCode, type SearchResponse, type SearchResultEntry, type SearchSort, type VersionListEntry, type Visibility, } from './types.js';
14
14
  export { compileBlueprint, type CompileBlueprintErr, type CompileBlueprintOk, type CompileBlueprintResult, } from './ops/compile.js';
15
15
  export { checkConformance, MAX_BLUEPRINT_SOURCE_BYTES, type BlueprintProbeRunner, type ConformanceError, type ConformanceErrorCode, type ConformanceFailureCode, type ConformanceRequestPayload, type ConformanceResponseBody, } from './ops/conformance.js';
16
- export { publishArtifact, MAX_BUNDLE_BYTES, RESERVED_SCOPES, type PublishArtifactDeps, type PublishArtifactInput, type PublishArtifactResult, } from './ops/publish.js';
16
+ export { publishArtifact, MAX_BUNDLE_BYTES, RESERVED_SCOPES, type PublishArtifactDeps, type PublishArtifactInput, type PublishArtifactResult, type VerifiedEmailResolver, } from './ops/publish.js';
17
17
  export { readArtifact, type ReadArtifactDeps, type ReadArtifactInput, type ReadArtifactResult, } from './ops/read.js';
18
+ export { artifactScope, canReadPrivateArtifact, createScopeOwnerResolver, } from './ops/private-read-authz.js';
18
19
  export { listArtifactVersions, type ListArtifactVersionsDeps, type ListArtifactVersionsInput, type ListArtifactVersionsResult, } from './ops/list-versions.js';
19
20
  export { searchArtifacts, type SearchArtifactsDeps, type SearchArtifactsInput, type SearchArtifactsResult, } from './ops/search.js';
20
21
  export { registerAuthorKey, type RegisterAuthorKeyDeps, type RegisterAuthorKeyInput, type RegisterAuthorKeyResult, } from './ops/register-author-key.js';
@@ -22,6 +23,7 @@ export { listAuthorKeys, type ListAuthorKeysDeps, type ListAuthorKeysResult, } f
22
23
  export { deleteAuthorKey, type DeleteAuthorKeyDeps, type DeleteAuthorKeyInput, type DeleteAuthorKeyResult, } from './ops/delete-author-key.js';
23
24
  export { inMemoryRegistryStorage } from './impls/memory-registry-storage.js';
24
25
  export { inMemoryBundleStorage, type InMemoryBundleStorageOptions, } from './impls/memory-bundle-storage.js';
26
+ export { matchesMcpToolFilters } from './mcp-tool-filters.js';
25
27
  export { installCommand, type InstallCommandOptions, } from './install-command.js';
26
28
  export { compareSemver } from './utils/semver.js';
27
29
  export { base64Encode, safeBase64Decode, sha384Base64 } from './utils/base64.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,YAAY,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,YAAY,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EACL,2BAA2B,EAC3B,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,qBAAqB,GAC3B,MAAM,kCAAkC,CAAC;AAG1C,OAAO,EACL,qBAAqB,EACrB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,6BAA6B,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,wBAA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AAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAKjF,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC"}
package/dist/index.js CHANGED
@@ -9,12 +9,13 @@
9
9
  */
10
10
  export { AuthorKeyAlreadyExistsError, } from './interfaces/registry-storage.js';
11
11
  // Types — rows + wire shapes
12
- export { ARTIFACTS_METADATA_SK, DELETE_AUTHOR_KEY_ERROR_CODES, LIST_AUTHOR_KEYS_ERROR_CODES, LIST_VERSIONS_ERROR_CODES, PUBLISH_ERROR_CODES, READ_ERROR_CODES, REGISTER_AUTHOR_KEY_ERROR_CODES, SCOPE_VERIFICATIONS, SEARCH_ERROR_CODES, SEARCH_SORT_OPTIONS, unauthorizedErrorBody, } from './types.js';
12
+ export { ARTIFACTS_METADATA_SK, DELETE_AUTHOR_KEY_ERROR_CODES, LIST_AUTHOR_KEYS_ERROR_CODES, LIST_VERSIONS_ERROR_CODES, PUBLISH_ERROR_CODES, READ_ERROR_CODES, REGISTER_AUTHOR_KEY_ERROR_CODES, SAN_ALLOWLIST_INVALID, SCOPE_VERIFICATIONS, SEARCH_ERROR_CODES, SEARCH_SORT_OPTIONS, unauthorizedErrorBody, } from './types.js';
13
13
  // Operations
14
14
  export { compileBlueprint, } from './ops/compile.js';
15
15
  export { checkConformance, MAX_BLUEPRINT_SOURCE_BYTES, } from './ops/conformance.js';
16
16
  export { publishArtifact, MAX_BUNDLE_BYTES, RESERVED_SCOPES, } from './ops/publish.js';
17
17
  export { readArtifact, } from './ops/read.js';
18
+ export { artifactScope, canReadPrivateArtifact, createScopeOwnerResolver, } from './ops/private-read-authz.js';
18
19
  export { listArtifactVersions, } from './ops/list-versions.js';
19
20
  export { searchArtifacts, } from './ops/search.js';
20
21
  export { registerAuthorKey, } from './ops/register-author-key.js';
@@ -23,6 +24,8 @@ export { deleteAuthorKey, } from './ops/delete-author-key.js';
23
24
  // In-memory impls
24
25
  export { inMemoryRegistryStorage } from './impls/memory-registry-storage.js';
25
26
  export { inMemoryBundleStorage, } from './impls/memory-bundle-storage.js';
27
+ // Shared scan-filter semantics
28
+ export { matchesMcpToolFilters } from './mcp-tool-filters.js';
26
29
  // Utils
27
30
  export { installCommand, } from './install-command.js';
28
31
  export { compareSemver } from './utils/semver.js';
@@ -2,8 +2,8 @@
2
2
  * `BundleStorage` — bundle + signature + manifest blob storage. A
3
3
  * hosted implementation may serve blobs from object storage behind a
4
4
  * CDN; the open-source server backs it with the filesystem under
5
- * `<root>/bundles/<scope>/<name>/<version>/`. A memory impl is
6
- * provided for tests.
5
+ * `<root>/bundles/<visibility>/<scope>/<name>/<version>/`. A memory
6
+ * impl is provided for tests.
7
7
  *
8
8
  * Each `put*` method returns the fully-qualified URL the consumer
9
9
  * (iframe runtime, install CLI) can fetch. The URL prefix is
@@ -11,17 +11,33 @@
11
11
  * CDN-fronted implementation, or `http://localhost:9001` (or
12
12
  * whatever the server is bound to) for the open-source server.
13
13
  *
14
- * Bundles are immutable post-publish. Responses MUST emit
15
- * `Cache-Control: public, max-age=31536000, immutable` — SRI integrity
16
- * depends on it. The OSS server's bundle route sets this header
17
- * explicitly; a CDN-fronted implementation sets it via its cache
18
- * policy.
14
+ * ## Visibility-split key layout (load-bearing)
15
+ *
16
+ * Every blob lives under a visibility-segmented key:
17
+ *
18
+ * bundles/public/<scope>/<name>/<version>/{bundle.js,bundle.js.sig,manifest.json}
19
+ * bundles/private/<scope>/<name>/<version>/{...}
20
+ *
21
+ * Placement IS the access-control boundary: the `bundles/public/`
22
+ * prefix may be served anonymously (CDN, static route); the
23
+ * `bundles/private/` prefix MUST only be reachable through an
24
+ * authenticated route that authorizes the caller against the
25
+ * artifact's publisher or scope owner. An impl that flattens the two
26
+ * prefixes back together silently republishes every private artifact.
27
+ *
28
+ * Bundles are immutable post-publish. Public-prefix responses MUST
29
+ * emit `Cache-Control: public, max-age=31536000, immutable` — SRI
30
+ * integrity depends on it. Private-prefix responses stay immutable but
31
+ * MUST NOT be shared-cacheable (`Cache-Control: private, …`). The OSS
32
+ * server's bundle routes set these headers explicitly; a CDN-fronted
33
+ * implementation sets the public policy on its cache behavior.
19
34
  *
20
35
  * ## Protocol & Contract Bar
21
36
  *
22
37
  * **Parties:**
23
38
  * - Producer: {@link publishArtifact} writes bundle (gadgets),
24
- * signature (gadgets), and manifest (always) on every publish.
39
+ * signature (gadgets), and manifest (always) on every publish, at
40
+ * the key the manifest's `visibility` selects.
25
41
  * - Consumer: iframe-runtime (bundleUrl), install CLI (signatureUrl,
26
42
  * manifestUrl), audit tooling (manifestUrl on yanked versions).
27
43
  *
@@ -31,49 +47,57 @@
31
47
  * per-version row immutability invariant on {@link RegistryStorage}
32
48
  * prevents true re-publishes; the bundle-storage layer needs no
33
49
  * conflict semantics).
50
+ * - Key composition MUST segment on `visibility` — a blob written
51
+ * `public` is invisible to a `private` read of the same triple, and
52
+ * vice versa.
34
53
  * - URL composition methods (`bundleUrl`, `signatureUrl`,
35
- * `manifestUrl`) MUST be pure — no I/O, no async. Consumers cache
36
- * URLs liberally.
54
+ * `manifestUrl`) MUST be pure — no I/O, no async — and MUST embed
55
+ * the same visibility segment the corresponding `put*` used, so the
56
+ * persisted row URLs point at the blob's real location. Consumers
57
+ * cache URLs liberally.
37
58
  *
38
59
  * **Failure mode:**
39
60
  * - Transport-level failures throw; the publish op wraps and returns
40
61
  * 500.
41
- * - Missing-blob reads return `null`; never throw.
62
+ * - Missing-blob reads return `null`; never throw. A visibility
63
+ * mismatch reads as a miss.
42
64
  *
43
65
  * **Observable violation:**
44
66
  * - Contract test {@link bundleStorageContract} covers: bundle
45
67
  * round-trip preserves bytes; signature round-trip preserves the
46
68
  * structured object; manifest round-trip preserves the full
47
- * discriminated-union shape; URL methods compose without side effects;
48
- * missing reads return null.
69
+ * discriminated-union shape; URL methods compose without side effects
70
+ * and embed the visibility segment; missing reads return null;
71
+ * cross-visibility reads return null.
49
72
  */
50
73
  import type { ArtifactManifest } from '@ggui-ai/artifact-manifest';
51
74
  import type { GadgetSignature } from '@ggui-ai/gadget-signing';
75
+ import type { Visibility } from '../types.js';
52
76
  export interface BundleStorage {
53
- /** Write gadget bundle bytes. Returns the public URL. */
54
- putBundle(scope: string, name: string, version: string, bytes: Uint8Array): Promise<string>;
55
- /** Read gadget bundle bytes. `null` on miss. */
56
- getBundle(scope: string, name: string, version: string): Promise<Uint8Array | null>;
77
+ /** Write gadget bundle bytes. Returns the fetch URL. */
78
+ putBundle(scope: string, name: string, version: string, visibility: Visibility, bytes: Uint8Array): Promise<string>;
79
+ /** Read gadget bundle bytes. `null` on miss (including visibility mismatch). */
80
+ getBundle(scope: string, name: string, version: string, visibility: Visibility): Promise<Uint8Array | null>;
57
81
  /**
58
- * Write the signature envelope. Returns the public URL.
82
+ * Write the signature envelope. Returns the fetch URL.
59
83
  *
60
84
  * The envelope is a {@link GadgetSignature} — a discriminated union
61
85
  * over `algorithm` (`ed25519` for private gadgets, `sigstore-cosign`
62
86
  * for public). Impls serialize via `JSON.stringify(signature)` and
63
87
  * store the resulting bytes verbatim.
64
88
  */
65
- putSignature(scope: string, name: string, version: string, signature: GadgetSignature): Promise<string>;
66
- /** Read the signature envelope. `null` on miss. */
67
- getSignature(scope: string, name: string, version: string): Promise<GadgetSignature | null>;
68
- /** Write the manifest verbatim. Returns the public URL. */
69
- putManifest(scope: string, name: string, version: string, manifest: ArtifactManifest): Promise<string>;
70
- /** Read the manifest. `null` on miss. */
71
- getManifest(scope: string, name: string, version: string): Promise<ArtifactManifest | null>;
72
- /** Compose the public bundle URL. No I/O. */
73
- bundleUrl(scope: string, name: string, version: string): string;
74
- /** Compose the public signature URL. No I/O. */
75
- signatureUrl(scope: string, name: string, version: string): string;
76
- /** Compose the public manifest URL. No I/O. */
77
- manifestUrl(scope: string, name: string, version: string): string;
89
+ putSignature(scope: string, name: string, version: string, visibility: Visibility, signature: GadgetSignature): Promise<string>;
90
+ /** Read the signature envelope. `null` on miss (including visibility mismatch). */
91
+ getSignature(scope: string, name: string, version: string, visibility: Visibility): Promise<GadgetSignature | null>;
92
+ /** Write the manifest verbatim. Returns the fetch URL. */
93
+ putManifest(scope: string, name: string, version: string, visibility: Visibility, manifest: ArtifactManifest): Promise<string>;
94
+ /** Read the manifest. `null` on miss (including visibility mismatch). */
95
+ getManifest(scope: string, name: string, version: string, visibility: Visibility): Promise<ArtifactManifest | null>;
96
+ /** Compose the bundle URL (embeds the visibility segment). No I/O. */
97
+ bundleUrl(scope: string, name: string, version: string, visibility: Visibility): string;
98
+ /** Compose the signature URL (embeds the visibility segment). No I/O. */
99
+ signatureUrl(scope: string, name: string, version: string, visibility: Visibility): string;
100
+ /** Compose the manifest URL (embeds the visibility segment). No I/O. */
101
+ manifestUrl(scope: string, name: string, version: string, visibility: Visibility): string;
78
102
  }
79
103
  //# sourceMappingURL=bundle-storage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bundle-storage.d.ts","sourceRoot":"","sources":["../../src/interfaces/bundle-storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,MAAM,WAAW,aAAa;IAC5B,yDAAyD;IACzD,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5F,gDAAgD;IAChD,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IAEpF;;;;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AM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,MAAM,CAAC;IACxF,yEAAyE;IACzE,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,MAAM,CAAC;IAC3F,wEAAwE;IACxE,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,MAAM,CAAC;CAC3F"}
@@ -53,6 +53,21 @@
53
53
  * rows MUST come back ordered by `publishedAt` descending (newest
54
54
  * first), globally correct across the full cursor chain. Without an
55
55
  * `order`, consumers MUST treat ordering as non-deterministic.
56
+ * - {@link scanArtifacts} MUST apply the `tool` / `server` filter
57
+ * dimensions with the shared semantics of `matchesMcpToolFilters`:
58
+ * `tool` matches any binding entry with that tool name; `server`
59
+ * matches entries declaring that server (bare entries never match);
60
+ * together they require one entry with exactly that (server, tool)
61
+ * pair. Case-sensitive exact, AND-composed with every other
62
+ * dimension.
63
+ * - {@link scanArtifacts} MUST exclude non-public rows
64
+ * (`visibility !== 'public'`) — visibility gating lives INSIDE every
65
+ * impl, not only at the caller layer (#259 delta-2 final-review
66
+ * ruling, #474). {@link searchArtifacts}'s post-fetch visibility
67
+ * filter is defense-in-depth ONLY; it must never be the sole gate,
68
+ * because a private row that reaches the storage-layer page would
69
+ * consume a `limit` slot before the op ever gets to discard it —
70
+ * an observable underfill on self-host impls.
56
71
  *
57
72
  * **Failure mode:**
58
73
  * - Transport-level failures (store throttling, disk full) throw.
@@ -66,8 +81,11 @@
66
81
  * `putArtifactVersionIfAbsent` rejects on collision, missing returns
67
82
  * null, `listAuthorKeys` returns only keys for the queried subject,
68
83
  * `deleteAuthorKey` true/false idempotency + per-subject isolation,
69
- * and `order: 'recent'` newest-first ordering (single page + across
70
- * the cursor chain).
84
+ * `order: 'recent'` newest-first ordering (single page + across the
85
+ * cursor chain), the `tool` / `server` filter dimensions (tool-only,
86
+ * server-only with bare-entry exclusion, and the exact-pair
87
+ * cross-product case), and non-public rows never appearing in
88
+ * `scanArtifacts` results OR consuming a `limit` page slot.
71
89
  */
72
90
  import type { ArtifactScanFilter, ArtifactVersionRow, ArtifactsMetadataRow, AuthorKeyRow, CompiledBlobRow, ScopeOwnerRow } from '../types.js';
73
91
  /**
@@ -122,6 +140,10 @@ export interface RegistryStorage {
122
140
  * When `filter.order` is `'recent'`, rows MUST be returned newest
123
141
  * first by `publishedAt`, globally correct across the full cursor
124
142
  * chain — see the Obligations section above.
143
+ *
144
+ * `filter.tool` / `filter.server` follow the shared MCP-binding
145
+ * filter semantics (`matchesMcpToolFilters`) — see the Obligations
146
+ * section above.
125
147
  */
126
148
  scanArtifacts(filter: ArtifactScanFilter): Promise<{
127
149
  readonly rows: readonly ArtifactsMetadataRow[];
@@ -1 +1 @@
1
- {"version":3,"file":"registry-storage.d.ts","sourceRoot":"","sources":["../../src/interfaces/registry-storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AACH,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,YAAY,EACZ,eAAe,EACf,aAAa,EACd,MAAM,aAAa,CAAC;AAErB;;;;;;;;;GASG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;;;;;;;GAQG;AACH,qBAAa,2BAA4B,SAAQ,KAAK;IACpD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;gBACX,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;CAQ3C;AAED;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAC7B;IACE,QAAQ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;;;;;;;;;;;;OAmBG;IACH,gBAAgB,CACd,GAAG,EAAE,aAAa,EAClB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC;QAAE,EAAE,EAAE,IAAI,CAAA;KAAE,GAAG;QAAE,QAAQ,EAAE,IAAI,CAAA;KAAE,CAAC,CAAC;IAG9C,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAC3E;;;;;;OAMG;IACH,YAAY,CACV,GAAG,EAAE,YAAY,EACjB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,YAAY,EAAE,CAAC,CAAC;IAClE;;;;;;;;;;;;OAYG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACnE"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Shared MCP-tool search-filter predicate — the reference semantics
3
+ * every {@link RegistryStorage.scanArtifacts} implementation must
4
+ * reproduce for the `tool` / `server` filter dimensions:
5
+ *
6
+ * - `tool` only → any binding entry with that tool name (with or
7
+ * without a `server`).
8
+ * - `server` only → any binding entry declaring that server; bare
9
+ * (server-less) entries never match.
10
+ * - both → a single entry with exactly that (server, tool)
11
+ * pair.
12
+ * - neither → always `true` (the filter is inactive).
13
+ *
14
+ * Matching is case-sensitive exact on both dimensions — MCP tool names
15
+ * are case-sensitive. AND-composes with every other scan-filter
16
+ * dimension; artifacts without bindings never match an active filter.
17
+ */
18
+ import type { McpToolBinding } from '@ggui-ai/artifact-manifest';
19
+ export declare function matchesMcpToolFilters(bindings: ReadonlyArray<McpToolBinding> | undefined, filters: {
20
+ tool?: string;
21
+ server?: string;
22
+ }): boolean;
23
+ //# sourceMappingURL=mcp-tool-filters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-tool-filters.d.ts","sourceRoot":"","sources":["../src/mcp-tool-filters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,aAAa,CAAC,cAAc,CAAC,GAAG,SAAS,EACnD,OAAO,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1C,OAAO,CAST"}
@@ -0,0 +1,14 @@
1
+ export function matchesMcpToolFilters(bindings, filters) {
2
+ const { tool, server } = filters;
3
+ if (tool === undefined && server === undefined)
4
+ return true;
5
+ if (bindings === undefined || bindings.length === 0)
6
+ return false;
7
+ return bindings.some((binding) => {
8
+ if (tool !== undefined && binding.tool !== tool)
9
+ return false;
10
+ if (server !== undefined && binding.server !== server)
11
+ return false;
12
+ return true;
13
+ });
14
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/ops/compile.ts"],"names":[],"mappings":"AAoDA,uEAAuE;AACvE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAClB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED,2EAA2E;AAC3E,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;QAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE;YAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;KAC1E,CAAC,CAAC;CACJ;AAED,MAAM,MAAM,sBAAsB,GAAG,kBAAkB,GAAG,mBAAmB,CAAC;AAE9E;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,sBAAsB,CA4CvE"}
1
+ {"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/ops/compile.ts"],"names":[],"mappings":"AAwEA,uEAAuE;AACvE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAClB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED,2EAA2E;AAC3E,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;QAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE;YAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;KAC1E,CAAC,CAAC;CACJ;AAED,MAAM,MAAM,sBAAsB,GAAG,kBAAkB,GAAG,mBAAmB,CAAC;AAE9E;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,sBAAsB,CA6CvE"}
@@ -46,9 +46,26 @@
46
46
  * load-bearing one (its OUTPUT is what's stored), but the two are
47
47
  * deliberately separate so a `POST /conformance/check` dry-run
48
48
  * remains cheap (no bundle resolution).
49
+ *
50
+ * **Lazy dependency load.** `esbuild` ships its own platform-specific
51
+ * native binary; loading it costs real init time and can fail outright
52
+ * on a host with no matching binary for the running platform. Callers
53
+ * that never reach `compileBlueprint` (most registry operations don't
54
+ * touch blueprint compilation) shouldn't pay that cost just for
55
+ * importing this module. `esbuild` resolves as an ordinary CommonJS
56
+ * package, so a `require()` obtained via `createRequire` defers the
57
+ * load to the first actual call, memoized at module scope so a
58
+ * long-lived process only pays it once — with NO change to
59
+ * {@link compileBlueprint}'s synchronous signature.
49
60
  */
50
- import * as esbuild from 'esbuild';
61
+ import { createRequire } from 'node:module';
51
62
  import { createHash } from 'node:crypto';
63
+ const nodeRequire = createRequire(import.meta.url);
64
+ let esbuildModule;
65
+ /** Lazy, memoized `esbuild` accessor — see the file-level doc above. */
66
+ function loadEsbuild() {
67
+ return (esbuildModule ??= nodeRequire('esbuild'));
68
+ }
52
69
  /**
53
70
  * Compile a blueprint's TSX `source` into canonical compiled JS bytes.
54
71
  *
@@ -63,6 +80,7 @@ import { createHash } from 'node:crypto';
63
80
  */
64
81
  export function compileBlueprint(source) {
65
82
  try {
83
+ const esbuild = loadEsbuild();
66
84
  // esbuild.buildSync would require a virtual-fs layer to handle
67
85
  // imports; we use transformSync which compiles a single text input
68
86
  // and emits a single text output. Tree-shaking is OFF and externals
@@ -65,7 +65,7 @@
65
65
  * registry-core to keep this layer free of DOM-emulation deps.
66
66
  */
67
67
  import { type ArtifactManifest } from '@ggui-ai/artifact-manifest';
68
- import { type StaticExport, type StaticImport } from 'oxc-parser';
68
+ import type { StaticExport, StaticImport } from 'oxc-parser';
69
69
  /**
70
70
  * Body shape of the conformance request. `bundle` is the UTF-8 text of
71
71
  * the compiled gadget entry; required for `kind: "gadget"` manifests,
@@ -116,16 +116,19 @@ export interface ConformanceResponseBody {
116
116
  */
117
117
  export declare const MAX_BLUEPRINT_SOURCE_BYTES: number;
118
118
  /**
119
- * Run the conformance check synchronously. Pure function: no
120
- * network, no env lookups. Returns the locked response body shape.
121
- * Every registry transport and the publish op call this.
119
+ * Run the conformance check. Pure beyond the (memoized, in-process)
120
+ * `oxc-parser` load: no network, no env lookups. Resolves to the
121
+ * locked response body shape. Every registry transport and the
122
+ * publish op call this — all are already async, so awaiting here adds
123
+ * no restructuring on the caller side; see `loadOxcParser`'s doc for
124
+ * why this can't stay synchronous.
122
125
  *
123
126
  * Static gates only — the optional runtime probe lives behind a
124
127
  * {@link BlueprintProbeRunner} seam so registry-core stays free of
125
128
  * DOM-emulation deps (happy-dom + react-dom/server land in the caller
126
129
  * that wants the probe).
127
130
  */
128
- export declare function checkConformance(payload: ConformanceRequestPayload): ConformanceResponseBody;
131
+ export declare function checkConformance(payload: ConformanceRequestPayload): Promise<ConformanceResponseBody>;
129
132
  /**
130
133
  * Runtime-probe seam. Implemented by callers that opt into the
131
134
  * sandboxed render check. registry-core does not provide a default
@@ -1 +1 @@
1
- {"version":3,"file":"conformance.d.ts","sourceRoot":"","sources":["../../src/ops/conformance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AACH,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,YAAY,EAClB,MAAM,YAAY,CAAC;AAGpB;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,oBAAoB,GAC5B,kBAAkB,GAClB,oBAAoB,GACpB,mBAAmB,GACnB,wBAAwB,GACxB,4BAA4B,GAC5B,yBAAyB,GACzB,6BAA6B,GAC7B,kCAAkC,GAClC,8BAA8B,GAC9B,gCAAgC,CAAC;AAErC,MAAM,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AAE1D,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;IACpC,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AC5B,kBAAkB,GAClB,oBAAoB,GACpB,mBAAmB,GACnB,wBAAwB,GACxB,4BAA4B,GAC5B,yBAAyB,GACzB,6BAA6B,GAC7B,kCAAkC,GAClC,8BAA8B,GAC9B,gCAAgC,CAAC;AAErC,MAAM,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AAE1D,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAC7C;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,SAAS,gBAAgB,EAAE,CAAC;CAC9C;AAkBD;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,QAAkB,CAAC;AAE1D;;;;;;;;;;;;GAYG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,uBAAuB,CAAC,CAgBlC;AAqbD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;;OAMG;IACH,KAAK,CACH,QAAQ,EAAE,OAAO,CAAC,gBAAgB,EAAE;QAAE,IAAI,EAAE,WAAW,CAAA;KAAE,CAAC,GACzD,OAAO,CAAC,uBAAuB,CAAC,CAAC;CACrC;AAED,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC"}
@@ -65,7 +65,30 @@
65
65
  * registry-core to keep this layer free of DOM-emulation deps.
66
66
  */
67
67
  import { safeParseArtifactManifest, } from '@ggui-ai/artifact-manifest';
68
- import { parseSync, } from 'oxc-parser';
68
+ import { memoizedRetryingImport } from '../utils/lazy-import.js';
69
+ /**
70
+ * Lazy, memoized `oxc-parser` accessor. `oxc-parser` ships its own
71
+ * platform-specific native binding; loading it costs real init time
72
+ * and can fail outright on a host with no matching binding for the
73
+ * running platform. Callers that never reach the parse gates (most
74
+ * registry operations don't touch bundle/source conformance) shouldn't
75
+ * pay that cost just for importing this module — or the barrel that
76
+ * re-exports it.
77
+ *
78
+ * `oxc-parser` ships ESM-only (no CommonJS entry point), so a dynamic
79
+ * `import()` is the only way to defer the load — unlike `esbuild` in
80
+ * `compile.ts`, there's no synchronous `require()` path available.
81
+ * That's what pushes {@link checkConformance} (and everything that
82
+ * calls it) from a plain synchronous function to one returning a
83
+ * `Promise`. {@link memoizedRetryingImport} memoizes the promise at
84
+ * module scope — concurrent first callers share one in-flight load,
85
+ * and a long-lived process pays the import cost at most once per
86
+ * successful load — while clearing the cache on rejection, so a
87
+ * failed load doesn't poison every later call for the rest of the
88
+ * process (see that helper's doc for why a bare `??=` isn't safe
89
+ * here).
90
+ */
91
+ const loadOxcParser = memoizedRetryingImport(() => import('oxc-parser'));
69
92
  /**
70
93
  * Always-permitted import sources for gadget bundles. Mirrors the
71
94
  * runtime CSP the iframe enforces — these are the only modules the
@@ -91,16 +114,19 @@ const ALWAYS_ALLOWED_IMPORTS = new Set([
91
114
  */
92
115
  export const MAX_BLUEPRINT_SOURCE_BYTES = 5 * 1024 * 1024;
93
116
  /**
94
- * Run the conformance check synchronously. Pure function: no
95
- * network, no env lookups. Returns the locked response body shape.
96
- * Every registry transport and the publish op call this.
117
+ * Run the conformance check. Pure beyond the (memoized, in-process)
118
+ * `oxc-parser` load: no network, no env lookups. Resolves to the
119
+ * locked response body shape. Every registry transport and the
120
+ * publish op call this — all are already async, so awaiting here adds
121
+ * no restructuring on the caller side; see `loadOxcParser`'s doc for
122
+ * why this can't stay synchronous.
97
123
  *
98
124
  * Static gates only — the optional runtime probe lives behind a
99
125
  * {@link BlueprintProbeRunner} seam so registry-core stays free of
100
126
  * DOM-emulation deps (happy-dom + react-dom/server land in the caller
101
127
  * that wants the probe).
102
128
  */
103
- export function checkConformance(payload) {
129
+ export async function checkConformance(payload) {
104
130
  // ── Gate 1: manifest schema ────────────────────────────────────────
105
131
  const manifestResult = safeParseArtifactManifest(payload.manifest);
106
132
  if (!manifestResult.success) {
@@ -120,7 +146,7 @@ export function checkConformance(payload) {
120
146
  * Extracted from {@link checkConformance} so the blueprint branch can
121
147
  * stand on its own without nesting.
122
148
  */
123
- function checkGadgetConformance(manifest, bundle) {
149
+ async function checkGadgetConformance(manifest, bundle) {
124
150
  // ── Gate 2: bundle is parseable ESM ────────────────────────────────
125
151
  if (typeof bundle !== 'string' || bundle.length === 0) {
126
152
  return {
@@ -133,6 +159,7 @@ function checkGadgetConformance(manifest, bundle) {
133
159
  ],
134
160
  };
135
161
  }
162
+ const { parseSync } = await loadOxcParser();
136
163
  const parsed = parseSync('bundle.js', bundle, {
137
164
  lang: 'js',
138
165
  sourceType: 'module',
@@ -204,7 +231,7 @@ function checkGadgetConformance(manifest, bundle) {
204
231
  * shape. Static-only; the runtime probe lives behind the optional
205
232
  * {@link BlueprintProbeRunner} seam.
206
233
  */
207
- function checkBlueprintConformance(manifest) {
234
+ async function checkBlueprintConformance(manifest) {
208
235
  // ── Gate 5: source size ──────────────────────────────────────────
209
236
  const sourceBytes = utf8ByteLength(manifest.source);
210
237
  if (sourceBytes > MAX_BLUEPRINT_SOURCE_BYTES) {
@@ -225,6 +252,7 @@ function checkBlueprintConformance(manifest) {
225
252
  // (not a compiled output) is deliberate — author intent (including
226
253
  // unused imports that signal mis-configured deps) is what the
227
254
  // allow-list gates, not whatever a bundler would optimize away.
255
+ const { parseSync } = await loadOxcParser();
228
256
  const parsed = parseSync('blueprint.tsx', manifest.source, {
229
257
  lang: 'tsx',
230
258
  sourceType: 'module',