vana-cli 0.24.4 → 0.25.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 (70) hide show
  1. package/dist/cli/auth.d.ts.map +1 -1
  2. package/dist/cli/auth.js +20 -1
  3. package/dist/cli/auth.js.map +1 -1
  4. package/dist/cli/index.d.ts +2 -0
  5. package/dist/cli/index.d.ts.map +1 -1
  6. package/dist/cli/index.js +98 -14
  7. package/dist/cli/index.js.map +1 -1
  8. package/dist/connectors/registry.d.ts +2 -0
  9. package/dist/connectors/registry.d.ts.map +1 -1
  10. package/dist/connectors/registry.js +18 -2
  11. package/dist/connectors/registry.js.map +1 -1
  12. package/dist/core/cli-types.d.ts +44 -0
  13. package/dist/core/cli-types.d.ts.map +1 -1
  14. package/dist/core/cli-types.js +14 -0
  15. package/dist/core/cli-types.js.map +1 -1
  16. package/dist/core/state-store.d.ts +6 -0
  17. package/dist/core/state-store.d.ts.map +1 -1
  18. package/dist/core/state-store.js.map +1 -1
  19. package/dist/pdpp/host.d.ts +66 -0
  20. package/dist/pdpp/host.d.ts.map +1 -0
  21. package/dist/pdpp/host.js +283 -0
  22. package/dist/pdpp/host.js.map +1 -0
  23. package/dist/pdpp/installer.d.ts +17 -0
  24. package/dist/pdpp/installer.d.ts.map +1 -0
  25. package/dist/pdpp/installer.js +117 -0
  26. package/dist/pdpp/installer.js.map +1 -0
  27. package/dist/pdpp/local.d.ts +14 -0
  28. package/dist/pdpp/local.d.ts.map +1 -0
  29. package/dist/pdpp/local.js +76 -0
  30. package/dist/pdpp/local.js.map +1 -0
  31. package/dist/pdpp/pins.d.ts +23 -0
  32. package/dist/pdpp/pins.d.ts.map +1 -0
  33. package/dist/pdpp/pins.js +18 -0
  34. package/dist/pdpp/pins.js.map +1 -0
  35. package/dist/pdpp/profile.d.ts +49 -0
  36. package/dist/pdpp/profile.d.ts.map +1 -0
  37. package/dist/pdpp/profile.js +17 -0
  38. package/dist/pdpp/profile.js.map +1 -0
  39. package/dist/pdpp/protocol.d.ts +79 -0
  40. package/dist/pdpp/protocol.d.ts.map +1 -0
  41. package/dist/pdpp/protocol.js +372 -0
  42. package/dist/pdpp/protocol.js.map +1 -0
  43. package/dist/pdpp/runtime.d.ts +43 -0
  44. package/dist/pdpp/runtime.d.ts.map +1 -0
  45. package/dist/pdpp/runtime.js +387 -0
  46. package/dist/pdpp/runtime.js.map +1 -0
  47. package/dist/pdpp/store.d.ts +43 -0
  48. package/dist/pdpp/store.d.ts.map +1 -0
  49. package/dist/pdpp/store.js +100 -0
  50. package/dist/pdpp/store.js.map +1 -0
  51. package/dist/runtime/core/contracts.d.ts +2 -0
  52. package/dist/runtime/core/contracts.d.ts.map +1 -1
  53. package/dist/runtime/managed-playwright.d.ts +7 -0
  54. package/dist/runtime/managed-playwright.d.ts.map +1 -1
  55. package/dist/runtime/managed-playwright.js +7 -0
  56. package/dist/runtime/managed-playwright.js.map +1 -1
  57. package/dist/vendor/pdpp-connector-manager/LICENSE +202 -0
  58. package/dist/vendor/pdpp-connector-manager/NOTICE +2 -0
  59. package/dist/vendor/pdpp-connector-manager/VENDOR.md +27 -0
  60. package/dist/vendor/pdpp-connector-manager/catalog-schema-data.mjs +168 -0
  61. package/dist/vendor/pdpp-connector-manager/catalog-schema.mjs +62 -0
  62. package/dist/vendor/pdpp-connector-manager/index.d.mts +49 -0
  63. package/dist/vendor/pdpp-connector-manager/index.mjs +1646 -0
  64. package/dist/vendor/pdpp-connector-manager/oci-catalog.mjs +93 -0
  65. package/dist/vendor/pdpp-connector-manager/oci-registry.mjs +1002 -0
  66. package/dist/vendor/pdpp-connector-manager/oci-verify.mjs +515 -0
  67. package/dist/vendor/pdpp-connector-manager/package.json +51 -0
  68. package/dist/vendor/pdpp-connector-manager/retry.mjs +142 -0
  69. package/dist/vendor/pdpp-connector-manager/tar-stream.mjs +685 -0
  70. package/package.json +7 -2
@@ -0,0 +1,93 @@
1
+ // Copyright The PDP-Connect Contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { assertCatalog, isCatalogTimestamp } from "./catalog-schema.mjs";
5
+ import {
6
+ DEFAULT_OCI_REGISTRY,
7
+ OciRegistryError,
8
+ fetchBlob,
9
+ fetchManifestByDigest,
10
+ isValidDigest,
11
+ parseOciReference,
12
+ resolveVersionToDigest,
13
+ } from "./oci-registry.mjs";
14
+ import {
15
+ DEFAULT_OCI_SIGSTORE_CERTIFICATE_IDENTITY,
16
+ verifyOciSignature,
17
+ } from "./oci-verify.mjs";
18
+
19
+ export const CATALOG_MEDIA_TYPE = "application/vnd.pdpp.connector-catalog.v1+json";
20
+ export const CATALOG_REPOSITORY = "pdp-connect/connector-catalog";
21
+ const MAX_CATALOG_BYTES = 8 * 1024 * 1024;
22
+
23
+ /** Fetch a signed discovery catalog; callers persist generated_at after acceptance. */
24
+ export async function fetchCatalog({
25
+ registry = DEFAULT_OCI_REGISTRY,
26
+ identity = DEFAULT_OCI_SIGSTORE_CERTIFICATE_IDENTITY,
27
+ lastAcceptedGeneratedAt,
28
+ // Explicit caller-owned transport/trust hooks for the local registry fixture.
29
+ scheme = "https",
30
+ timeoutMs = 30000,
31
+ fetchImpl = fetch,
32
+ retryOptions = {},
33
+ allowedRegistries,
34
+ sigstoreVerifier,
35
+ } = {}) {
36
+ parseOciReference({ registry, repository: CATALOG_REPOSITORY, version: "latest", allowedRegistries });
37
+ if (typeof identity !== "string" || identity.length === 0) {
38
+ throw new OciRegistryError("Catalog requires a trusted certificate identity", "misidentified");
39
+ }
40
+ if (lastAcceptedGeneratedAt !== undefined && !isCatalogTimestamp(lastAcceptedGeneratedAt)) {
41
+ throw new OciRegistryError("Invalid lastAcceptedGeneratedAt", "invalid-reference");
42
+ }
43
+ const previous = lastAcceptedGeneratedAt === undefined ? null : Date.parse(lastAcceptedGeneratedAt);
44
+ const transport = {
45
+ registry,
46
+ repository: CATALOG_REPOSITORY,
47
+ scheme,
48
+ timeoutMs,
49
+ fetchImpl,
50
+ retryOptions,
51
+ };
52
+ const digest = await resolveVersionToDigest({ ...transport, version: "latest" });
53
+ const { manifest } = await fetchManifestByDigest({ ...transport, digest });
54
+ await verifyOciSignature({
55
+ ...transport,
56
+ digest,
57
+ certificateIdentityResolver: () => identity,
58
+ sigstoreVerifier,
59
+ });
60
+
61
+ const layer = manifest?.layers?.[0];
62
+ if (
63
+ manifest?.schemaVersion !== 2 ||
64
+ manifest?.mediaType !== "application/vnd.oci.image.manifest.v1+json" ||
65
+ manifest?.artifactType !== CATALOG_MEDIA_TYPE ||
66
+ !Array.isArray(manifest.layers) || manifest.layers.length !== 1 ||
67
+ layer?.mediaType !== CATALOG_MEDIA_TYPE
68
+ ) {
69
+ throw new OciRegistryError("Catalog must have exactly one catalog JSON layer in an OCI image manifest", "unsupported-layer");
70
+ }
71
+ if (!isValidDigest(layer.digest) || !Number.isSafeInteger(layer.size) || layer.size < 0 || layer.size > MAX_CATALOG_BYTES) {
72
+ throw new OciRegistryError("Catalog layer has an invalid digest or size", "tampered");
73
+ }
74
+ const bytes = await fetchBlob({ ...transport, digest: layer.digest, maxBytes: MAX_CATALOG_BYTES });
75
+ if (bytes.length !== layer.size) {
76
+ throw new OciRegistryError("Catalog layer size does not match its descriptor", "tampered");
77
+ }
78
+ let catalog;
79
+ try {
80
+ catalog = JSON.parse(bytes.toString("utf8"));
81
+ } catch {
82
+ throw new OciRegistryError("Catalog layer is not JSON", "invalid-catalog");
83
+ }
84
+ try {
85
+ assertCatalog(catalog);
86
+ } catch (error) {
87
+ throw new OciRegistryError(`Invalid catalog: ${error.message}`, "invalid-catalog");
88
+ }
89
+ if (previous !== null && Date.parse(catalog.generated_at) < previous) {
90
+ throw new OciRegistryError(`Catalog generated_at ${catalog.generated_at} is older than ${lastAcceptedGeneratedAt}`, "stale-catalog");
91
+ }
92
+ return { catalog, digest };
93
+ }