@ai-primitives-hub/core 0.0.1-alpha.1
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.
- package/README.md +18 -0
- package/dist/domain/bundle/id.d.ts +60 -0
- package/dist/domain/bundle/id.d.ts.map +1 -0
- package/dist/domain/bundle/id.js +75 -0
- package/dist/domain/bundle/id.js.map +1 -0
- package/dist/domain/bundle/identity-matcher.d.ts +48 -0
- package/dist/domain/bundle/identity-matcher.d.ts.map +1 -0
- package/dist/domain/bundle/identity-matcher.js +57 -0
- package/dist/domain/bundle/identity-matcher.js.map +1 -0
- package/dist/domain/bundle/types.d.ts +138 -0
- package/dist/domain/bundle/types.d.ts.map +1 -0
- package/dist/domain/bundle/types.js +17 -0
- package/dist/domain/bundle/types.js.map +1 -0
- package/dist/domain/bundle/version.d.ts +51 -0
- package/dist/domain/bundle/version.d.ts.map +1 -0
- package/dist/domain/bundle/version.js +176 -0
- package/dist/domain/bundle/version.js.map +1 -0
- package/dist/domain/collection/manifest-validator.d.ts +47 -0
- package/dist/domain/collection/manifest-validator.d.ts.map +1 -0
- package/dist/domain/collection/manifest-validator.js +83 -0
- package/dist/domain/collection/manifest-validator.js.map +1 -0
- package/dist/domain/collection/types.d.ts +201 -0
- package/dist/domain/collection/types.d.ts.map +1 -0
- package/dist/domain/collection/types.js +17 -0
- package/dist/domain/collection/types.js.map +1 -0
- package/dist/domain/collection/validate.d.ts +51 -0
- package/dist/domain/collection/validate.d.ts.map +1 -0
- package/dist/domain/collection/validate.js +263 -0
- package/dist/domain/collection/validate.js.map +1 -0
- package/dist/domain/discovery/types.d.ts +95 -0
- package/dist/domain/discovery/types.d.ts.map +1 -0
- package/dist/domain/discovery/types.js +13 -0
- package/dist/domain/discovery/types.js.map +1 -0
- package/dist/domain/errors.d.ts +23 -0
- package/dist/domain/errors.d.ts.map +1 -0
- package/dist/domain/errors.js +41 -0
- package/dist/domain/errors.js.map +1 -0
- package/dist/domain/hub/types.d.ts +254 -0
- package/dist/domain/hub/types.d.ts.map +1 -0
- package/dist/domain/hub/types.js +11 -0
- package/dist/domain/hub/types.js.map +1 -0
- package/dist/domain/hub/validate.d.ts +40 -0
- package/dist/domain/hub/validate.d.ts.map +1 -0
- package/dist/domain/hub/validate.js +89 -0
- package/dist/domain/hub/validate.js.map +1 -0
- package/dist/domain/index.d.ts +31 -0
- package/dist/domain/index.d.ts.map +1 -0
- package/dist/domain/index.js +47 -0
- package/dist/domain/index.js.map +1 -0
- package/dist/domain/install/copilot-file-type.d.ts +84 -0
- package/dist/domain/install/copilot-file-type.d.ts.map +1 -0
- package/dist/domain/install/copilot-file-type.js +190 -0
- package/dist/domain/install/copilot-file-type.js.map +1 -0
- package/dist/domain/install/installable.d.ts +58 -0
- package/dist/domain/install/installable.d.ts.map +1 -0
- package/dist/domain/install/installable.js +36 -0
- package/dist/domain/install/installable.js.map +1 -0
- package/dist/domain/install/layout.d.ts +84 -0
- package/dist/domain/install/layout.d.ts.map +1 -0
- package/dist/domain/install/layout.js +70 -0
- package/dist/domain/install/layout.js.map +1 -0
- package/dist/domain/install/target.d.ts +70 -0
- package/dist/domain/install/target.d.ts.map +1 -0
- package/dist/domain/install/target.js +43 -0
- package/dist/domain/install/target.js.map +1 -0
- package/dist/domain/install/transform.d.ts +47 -0
- package/dist/domain/install/transform.d.ts.map +1 -0
- package/dist/domain/install/transform.js +24 -0
- package/dist/domain/install/transform.js.map +1 -0
- package/dist/domain/install/types.d.ts +51 -0
- package/dist/domain/install/types.d.ts.map +1 -0
- package/dist/domain/install/types.js +3 -0
- package/dist/domain/install/types.js.map +1 -0
- package/dist/domain/primitive/types.d.ts +59 -0
- package/dist/domain/primitive/types.d.ts.map +1 -0
- package/dist/domain/primitive/types.js +22 -0
- package/dist/domain/primitive/types.js.map +1 -0
- package/dist/domain/registry/guards.d.ts +28 -0
- package/dist/domain/registry/guards.d.ts.map +1 -0
- package/dist/domain/registry/guards.js +33 -0
- package/dist/domain/registry/guards.js.map +1 -0
- package/dist/domain/registry/settings.d.ts +49 -0
- package/dist/domain/registry/settings.d.ts.map +1 -0
- package/dist/domain/registry/settings.js +3 -0
- package/dist/domain/registry/settings.js.map +1 -0
- package/dist/domain/registry/types.d.ts +91 -0
- package/dist/domain/registry/types.d.ts.map +1 -0
- package/dist/domain/registry/types.js +3 -0
- package/dist/domain/registry/types.js.map +1 -0
- package/dist/domain/registry-error.d.ts +69 -0
- package/dist/domain/registry-error.d.ts.map +1 -0
- package/dist/domain/registry-error.js +87 -0
- package/dist/domain/registry-error.js.map +1 -0
- package/dist/domain/scaffold/index.d.ts +9 -0
- package/dist/domain/scaffold/index.d.ts.map +1 -0
- package/dist/domain/scaffold/index.js +13 -0
- package/dist/domain/scaffold/index.js.map +1 -0
- package/dist/domain/scaffold/types.d.ts +135 -0
- package/dist/domain/scaffold/types.d.ts.map +1 -0
- package/dist/domain/scaffold/types.js +44 -0
- package/dist/domain/scaffold/types.js.map +1 -0
- package/dist/domain/skill/validate.d.ts +52 -0
- package/dist/domain/skill/validate.d.ts.map +1 -0
- package/dist/domain/skill/validate.js +108 -0
- package/dist/domain/skill/validate.js.map +1 -0
- package/dist/domain/source/types.d.ts +72 -0
- package/dist/domain/source/types.d.ts.map +1 -0
- package/dist/domain/source/types.js +14 -0
- package/dist/domain/source/types.js.map +1 -0
- package/dist/domain/source-id.d.ts +41 -0
- package/dist/domain/source-id.d.ts.map +1 -0
- package/dist/domain/source-id.js +90 -0
- package/dist/domain/source-id.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +74 -0
- package/dist/index.js.map +1 -0
- package/dist/ports/app-storage.d.ts +65 -0
- package/dist/ports/app-storage.d.ts.map +1 -0
- package/dist/ports/app-storage.js +22 -0
- package/dist/ports/app-storage.js.map +1 -0
- package/dist/ports/bundle-downloader.d.ts +28 -0
- package/dist/ports/bundle-downloader.d.ts.map +1 -0
- package/dist/ports/bundle-downloader.js +3 -0
- package/dist/ports/bundle-downloader.js.map +1 -0
- package/dist/ports/bundle-extractor.d.ts +21 -0
- package/dist/ports/bundle-extractor.d.ts.map +1 -0
- package/dist/ports/bundle-extractor.js +8 -0
- package/dist/ports/bundle-extractor.js.map +1 -0
- package/dist/ports/clock.d.ts +29 -0
- package/dist/ports/clock.d.ts.map +1 -0
- package/dist/ports/clock.js +13 -0
- package/dist/ports/clock.js.map +1 -0
- package/dist/ports/copilot-sdk.d.ts +80 -0
- package/dist/ports/copilot-sdk.d.ts.map +1 -0
- package/dist/ports/copilot-sdk.js +16 -0
- package/dist/ports/copilot-sdk.js.map +1 -0
- package/dist/ports/filesystem.d.ts +53 -0
- package/dist/ports/filesystem.d.ts.map +1 -0
- package/dist/ports/filesystem.js +14 -0
- package/dist/ports/filesystem.js.map +1 -0
- package/dist/ports/github-api.d.ts +62 -0
- package/dist/ports/github-api.d.ts.map +1 -0
- package/dist/ports/github-api.js +19 -0
- package/dist/ports/github-api.js.map +1 -0
- package/dist/ports/http.d.ts +58 -0
- package/dist/ports/http.d.ts.map +1 -0
- package/dist/ports/http.js +12 -0
- package/dist/ports/http.js.map +1 -0
- package/dist/ports/index.d.ts +23 -0
- package/dist/ports/index.d.ts.map +1 -0
- package/dist/ports/index.js +39 -0
- package/dist/ports/index.js.map +1 -0
- package/dist/ports/layout-config-loader.d.ts +27 -0
- package/dist/ports/layout-config-loader.d.ts.map +1 -0
- package/dist/ports/layout-config-loader.js +3 -0
- package/dist/ports/layout-config-loader.js.map +1 -0
- package/dist/ports/process-runner.d.ts +31 -0
- package/dist/ports/process-runner.d.ts.map +1 -0
- package/dist/ports/process-runner.js +14 -0
- package/dist/ports/process-runner.js.map +1 -0
- package/dist/ports/registry-operations.d.ts +157 -0
- package/dist/ports/registry-operations.d.ts.map +1 -0
- package/dist/ports/registry-operations.js +3 -0
- package/dist/ports/registry-operations.js.map +1 -0
- package/dist/ports/resource-transformer.d.ts +28 -0
- package/dist/ports/resource-transformer.d.ts.map +1 -0
- package/dist/ports/resource-transformer.js +3 -0
- package/dist/ports/resource-transformer.js.map +1 -0
- package/dist/ports/source-adapter.d.ts +43 -0
- package/dist/ports/source-adapter.d.ts.map +1 -0
- package/dist/ports/source-adapter.js +3 -0
- package/dist/ports/source-adapter.js.map +1 -0
- package/dist/ports/source-resolver.d.ts +19 -0
- package/dist/ports/source-resolver.d.ts.map +1 -0
- package/dist/ports/source-resolver.js +3 -0
- package/dist/ports/source-resolver.js.map +1 -0
- package/dist/ports/target-writer.d.ts +37 -0
- package/dist/ports/target-writer.d.ts.map +1 -0
- package/dist/ports/target-writer.js +3 -0
- package/dist/ports/target-writer.js.map +1 -0
- package/dist/ports/telemetry.d.ts +22 -0
- package/dist/ports/telemetry.d.ts.map +1 -0
- package/dist/ports/telemetry.js +11 -0
- package/dist/ports/telemetry.js.map +1 -0
- package/dist/ports/update-notifier.d.ts +22 -0
- package/dist/ports/update-notifier.d.ts.map +1 -0
- package/dist/ports/update-notifier.js +12 -0
- package/dist/ports/update-notifier.js.map +1 -0
- package/dist/ports/update-store.d.ts +25 -0
- package/dist/ports/update-store.d.ts.map +1 -0
- package/dist/ports/update-store.js +12 -0
- package/dist/ports/update-store.js.map +1 -0
- package/dist/public/schemas/apm.schema.json +59 -0
- package/dist/public/schemas/collection.schema.json +345 -0
- package/dist/public/schemas/default-hubs-config.schema.json +68 -0
- package/dist/public/schemas/hub-config.schema.json +389 -0
- package/dist/public/schemas/lockfile.schema.json +243 -0
- package/package.json +50 -0
package/README.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# @ai-primitives-hub/core
|
|
2
|
+
|
|
3
|
+
Domain types and port interfaces for AI Primitives Hub. Depends on nothing
|
|
4
|
+
else in this workspace — every other package depends on `core`, `core`
|
|
5
|
+
depends on no `@ai-primitives-hub/*` package.
|
|
6
|
+
|
|
7
|
+
Status: **scaffolding only** (Phase 1 of `.tmp/ai-primitives-hub-next-migration-plan.md`).
|
|
8
|
+
Real domain types land in Phase 2 (§7.3): `bundle`, `collection`, `source`,
|
|
9
|
+
`install`/`target`, `hub`/`profile`/`registry`, `primitive`/index, and the
|
|
10
|
+
port interfaces adapters in `@ai-primitives-hub/infra` implement.
|
|
11
|
+
|
|
12
|
+
## Development
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pnpm --filter @ai-primitives-hub/core build
|
|
16
|
+
pnpm --filter @ai-primitives-hub/core test
|
|
17
|
+
pnpm --filter @ai-primitives-hub/core lint
|
|
18
|
+
```
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain layer — Bundle ID generation.
|
|
3
|
+
*
|
|
4
|
+
* IMPORTANT: this logic must stay in sync with `src/utils/bundleNameUtils.ts`
|
|
5
|
+
* (`generateBuildScriptBundleId`) and `lib/src/bundle-id.ts`
|
|
6
|
+
* (`generateBundleId`) until those call sites are migrated onto this
|
|
7
|
+
* implementation (migration plan §7.5/§7.7). The format is unchanged:
|
|
8
|
+
* `{owner}-{repo}-{collectionId}-v{version}`.
|
|
9
|
+
* @module domain/bundle/id
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Generate the canonical bundle ID for a collection.
|
|
13
|
+
* @param repoSlug - Repository slug (`owner/repo` or already-hyphenated `owner-repo`).
|
|
14
|
+
* @param collectionId - Collection identifier.
|
|
15
|
+
* @param version - Version string, without a leading `v`.
|
|
16
|
+
* @returns Canonical bundle ID, e.g. `owner-repo-my-collection-v1.0.0`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function generateBundleId(repoSlug: string, collectionId: string, version: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Generate the canonical bundle ID for a GitHub release, as fetched at
|
|
21
|
+
* runtime by the GitHub source adapter.
|
|
22
|
+
*
|
|
23
|
+
* IMPORTANT: this is a *distinct* format from {@link generateBundleId}
|
|
24
|
+
* (ported from `src/utils/bundleNameUtils.ts`'s `generateGitHubBundleId`,
|
|
25
|
+
* not `generateBuildScriptBundleId`) — no `v` prefix before the version,
|
|
26
|
+
* and it falls back to the raw release tag when the manifest doesn't
|
|
27
|
+
* declare its own collection id. Do not consolidate these two: they are
|
|
28
|
+
* used by different producers (build-time collection bundler vs. the
|
|
29
|
+
* runtime GitHub adapter reading whatever a release happens to contain)
|
|
30
|
+
* that must keep matching their own historical ID format for
|
|
31
|
+
* already-published bundles.
|
|
32
|
+
* @param owner - Repository owner.
|
|
33
|
+
* @param repo - Repository name.
|
|
34
|
+
* @param tagName - Git tag name of the release (e.g. `v1.0.0`).
|
|
35
|
+
* @param manifestId - Collection id from the release's deployment manifest, if present.
|
|
36
|
+
* @param manifestVersion - Version from the release's deployment manifest, if present.
|
|
37
|
+
* @returns Canonical bundle ID, e.g. `owner-repo-my-collection-1.0.0` or, lacking
|
|
38
|
+
* a manifest id, `owner-repo-v1.0.0`.
|
|
39
|
+
*/
|
|
40
|
+
export declare function generateGitHubReleaseBundleId(owner: string, repo: string, tagName: string, manifestId?: string, manifestVersion?: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* Check whether a manifest's declared id/version match a bundle id.
|
|
43
|
+
*
|
|
44
|
+
* For GitHub-sourced collection bundles, the manifest may declare just
|
|
45
|
+
* the collection id (e.g. `my-collection`) while the bundle id is the
|
|
46
|
+
* full computed id produced by {@link generateGitHubReleaseBundleId}
|
|
47
|
+
* (e.g. `owner-repo-my-collection-1.0.0` or `owner-repo-my-collection-v1.0.0`).
|
|
48
|
+
* This accepts an exact match as well as both suffix forms, with or
|
|
49
|
+
* without the `v` version prefix.
|
|
50
|
+
*
|
|
51
|
+
* IMPORTANT: this logic must stay in sync with
|
|
52
|
+
* `src/utils/bundle-name-utils.ts` (`isManifestIdMatch`) until that
|
|
53
|
+
* call site is migrated onto this implementation (migration plan §7.5/§7.7).
|
|
54
|
+
* @param manifestId - The `id` field from the deployment manifest.
|
|
55
|
+
* @param manifestVersion - The `version` field from the deployment manifest.
|
|
56
|
+
* @param bundleId - The computed bundle id to match against.
|
|
57
|
+
* @returns `true` if `manifestId`/`manifestVersion` identify `bundleId`.
|
|
58
|
+
*/
|
|
59
|
+
export declare function isManifestIdMatch(manifestId: string, manifestVersion: string, bundleId: string): boolean;
|
|
60
|
+
//# sourceMappingURL=id.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"id.d.ts","sourceRoot":"","sources":["../../../src/domain/bundle/id.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAGhG;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,UAAU,CAAC,EAAE,MAAM,EACnB,eAAe,CAAC,EAAE,MAAM,GACvB,MAAM,CAGR;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAIxG"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Domain layer — Bundle ID generation.
|
|
4
|
+
*
|
|
5
|
+
* IMPORTANT: this logic must stay in sync with `src/utils/bundleNameUtils.ts`
|
|
6
|
+
* (`generateBuildScriptBundleId`) and `lib/src/bundle-id.ts`
|
|
7
|
+
* (`generateBundleId`) until those call sites are migrated onto this
|
|
8
|
+
* implementation (migration plan §7.5/§7.7). The format is unchanged:
|
|
9
|
+
* `{owner}-{repo}-{collectionId}-v{version}`.
|
|
10
|
+
* @module domain/bundle/id
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.generateBundleId = generateBundleId;
|
|
14
|
+
exports.generateGitHubReleaseBundleId = generateGitHubReleaseBundleId;
|
|
15
|
+
exports.isManifestIdMatch = isManifestIdMatch;
|
|
16
|
+
/**
|
|
17
|
+
* Generate the canonical bundle ID for a collection.
|
|
18
|
+
* @param repoSlug - Repository slug (`owner/repo` or already-hyphenated `owner-repo`).
|
|
19
|
+
* @param collectionId - Collection identifier.
|
|
20
|
+
* @param version - Version string, without a leading `v`.
|
|
21
|
+
* @returns Canonical bundle ID, e.g. `owner-repo-my-collection-v1.0.0`.
|
|
22
|
+
*/
|
|
23
|
+
function generateBundleId(repoSlug, collectionId, version) {
|
|
24
|
+
const normalizedSlug = repoSlug.replaceAll('/', '-');
|
|
25
|
+
return `${normalizedSlug}-${collectionId}-v${version}`;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Generate the canonical bundle ID for a GitHub release, as fetched at
|
|
29
|
+
* runtime by the GitHub source adapter.
|
|
30
|
+
*
|
|
31
|
+
* IMPORTANT: this is a *distinct* format from {@link generateBundleId}
|
|
32
|
+
* (ported from `src/utils/bundleNameUtils.ts`'s `generateGitHubBundleId`,
|
|
33
|
+
* not `generateBuildScriptBundleId`) — no `v` prefix before the version,
|
|
34
|
+
* and it falls back to the raw release tag when the manifest doesn't
|
|
35
|
+
* declare its own collection id. Do not consolidate these two: they are
|
|
36
|
+
* used by different producers (build-time collection bundler vs. the
|
|
37
|
+
* runtime GitHub adapter reading whatever a release happens to contain)
|
|
38
|
+
* that must keep matching their own historical ID format for
|
|
39
|
+
* already-published bundles.
|
|
40
|
+
* @param owner - Repository owner.
|
|
41
|
+
* @param repo - Repository name.
|
|
42
|
+
* @param tagName - Git tag name of the release (e.g. `v1.0.0`).
|
|
43
|
+
* @param manifestId - Collection id from the release's deployment manifest, if present.
|
|
44
|
+
* @param manifestVersion - Version from the release's deployment manifest, if present.
|
|
45
|
+
* @returns Canonical bundle ID, e.g. `owner-repo-my-collection-1.0.0` or, lacking
|
|
46
|
+
* a manifest id, `owner-repo-v1.0.0`.
|
|
47
|
+
*/
|
|
48
|
+
function generateGitHubReleaseBundleId(owner, repo, tagName, manifestId, manifestVersion) {
|
|
49
|
+
const cleanVersion = manifestVersion ?? tagName.replace(/^v/, '');
|
|
50
|
+
return manifestId ? `${owner}-${repo}-${manifestId}-${cleanVersion}` : `${owner}-${repo}-${tagName}`;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Check whether a manifest's declared id/version match a bundle id.
|
|
54
|
+
*
|
|
55
|
+
* For GitHub-sourced collection bundles, the manifest may declare just
|
|
56
|
+
* the collection id (e.g. `my-collection`) while the bundle id is the
|
|
57
|
+
* full computed id produced by {@link generateGitHubReleaseBundleId}
|
|
58
|
+
* (e.g. `owner-repo-my-collection-1.0.0` or `owner-repo-my-collection-v1.0.0`).
|
|
59
|
+
* This accepts an exact match as well as both suffix forms, with or
|
|
60
|
+
* without the `v` version prefix.
|
|
61
|
+
*
|
|
62
|
+
* IMPORTANT: this logic must stay in sync with
|
|
63
|
+
* `src/utils/bundle-name-utils.ts` (`isManifestIdMatch`) until that
|
|
64
|
+
* call site is migrated onto this implementation (migration plan §7.5/§7.7).
|
|
65
|
+
* @param manifestId - The `id` field from the deployment manifest.
|
|
66
|
+
* @param manifestVersion - The `version` field from the deployment manifest.
|
|
67
|
+
* @param bundleId - The computed bundle id to match against.
|
|
68
|
+
* @returns `true` if `manifestId`/`manifestVersion` identify `bundleId`.
|
|
69
|
+
*/
|
|
70
|
+
function isManifestIdMatch(manifestId, manifestVersion, bundleId) {
|
|
71
|
+
return manifestId === bundleId
|
|
72
|
+
|| bundleId.endsWith(`-${manifestId}-v${manifestVersion}`)
|
|
73
|
+
|| bundleId.endsWith(`-${manifestId}-${manifestVersion}`);
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"id.js","sourceRoot":"","sources":["../../../src/domain/bundle/id.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AASH,4CAGC;AAuBD,sEASC;AAoBD,8CAIC;AAlED;;;;;;GAMG;AACH,SAAgB,gBAAgB,CAAC,QAAgB,EAAE,YAAoB,EAAE,OAAe;IACtF,MAAM,cAAc,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACrD,OAAO,GAAG,cAAc,IAAI,YAAY,KAAK,OAAO,EAAE,CAAC;AACzD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,6BAA6B,CAC3C,KAAa,EACb,IAAY,EACZ,OAAe,EACf,UAAmB,EACnB,eAAwB;IAExB,MAAM,YAAY,GAAG,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAClE,OAAO,UAAU,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,IAAI,IAAI,UAAU,IAAI,YAAY,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,IAAI,IAAI,OAAO,EAAE,CAAC;AACvG,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,iBAAiB,CAAC,UAAkB,EAAE,eAAuB,EAAE,QAAgB;IAC7F,OAAO,UAAU,KAAK,QAAQ;WACzB,QAAQ,CAAC,QAAQ,CAAC,IAAI,UAAU,KAAK,eAAe,EAAE,CAAC;WACvD,QAAQ,CAAC,QAAQ,CAAC,IAAI,UAAU,IAAI,eAAe,EAAE,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain layer — Cross-source-type bundle identity matching.
|
|
3
|
+
*
|
|
4
|
+
* Ported from the extension's `src/utils/bundle-identity-matcher.ts`
|
|
5
|
+
* (`BundleIdentityMatcher`). Provides centralized logic for matching
|
|
6
|
+
* bundle identities across different source types: for GitHub sources,
|
|
7
|
+
* matches by identity (owner-repo) ignoring version suffixes; for other
|
|
8
|
+
* sources, requires an exact ID match.
|
|
9
|
+
* @module domain/bundle/identity-matcher
|
|
10
|
+
*/
|
|
11
|
+
import type { SourceType } from '../source/types';
|
|
12
|
+
/**
|
|
13
|
+
* Version suffix regex pattern used across the codebase.
|
|
14
|
+
*/
|
|
15
|
+
export declare const VERSION_SUFFIX_REGEX: RegExp;
|
|
16
|
+
/**
|
|
17
|
+
* Check if two bundle IDs match based on source type
|
|
18
|
+
* @param bundleId1 - First bundle ID to compare
|
|
19
|
+
* @param bundleId2 - Second bundle ID to compare
|
|
20
|
+
* @param sourceType - Source type determining matching strategy
|
|
21
|
+
* @returns True if bundles match according to source type rules
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* // GitHub bundles match by identity (ignoring version)
|
|
25
|
+
* bundleIdentitiesMatch('owner-repo-v1.0.0', 'owner-repo-v2.0.0', 'github'); // true
|
|
26
|
+
*
|
|
27
|
+
* // Non-GitHub bundles require exact match
|
|
28
|
+
* bundleIdentitiesMatch('local-bundle-v1.0.0', 'local-bundle-v2.0.0', 'local'); // false
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function bundleIdentitiesMatch(bundleId1: string, bundleId2: string, sourceType: SourceType): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Extract base ID without version suffix
|
|
34
|
+
* @param bundleId - Bundle ID potentially containing version suffix
|
|
35
|
+
* @returns Base bundle ID without version
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* extractBaseBundleId('my-bundle-v1.0.0'); // 'my-bundle'
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function extractBaseBundleId(bundleId: string): string;
|
|
42
|
+
/**
|
|
43
|
+
* Check if bundle ID contains a version suffix
|
|
44
|
+
* @param bundleId - Bundle ID to check
|
|
45
|
+
* @returns True if bundle ID contains version suffix
|
|
46
|
+
*/
|
|
47
|
+
export declare function bundleIdHasVersionSuffix(bundleId: string): boolean;
|
|
48
|
+
//# sourceMappingURL=identity-matcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity-matcher.d.ts","sourceRoot":"","sources":["../../../src/domain/bundle/identity-matcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EACV,UAAU,EACX,MAAM,iBAAiB,CAAC;AAKzB;;GAEG;AACH,eAAO,MAAM,oBAAoB,QAA8C,CAAC;AAEhF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,CAU3G;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAElE"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VERSION_SUFFIX_REGEX = void 0;
|
|
4
|
+
exports.bundleIdentitiesMatch = bundleIdentitiesMatch;
|
|
5
|
+
exports.extractBaseBundleId = extractBaseBundleId;
|
|
6
|
+
exports.bundleIdHasVersionSuffix = bundleIdHasVersionSuffix;
|
|
7
|
+
const version_1 = require("./version");
|
|
8
|
+
/**
|
|
9
|
+
* Version suffix regex pattern used across the codebase.
|
|
10
|
+
*/
|
|
11
|
+
exports.VERSION_SUFFIX_REGEX = /-v?\d{1,3}\.\d{1,3}\.\d{1,3}(?:-[\w.]+)?$/;
|
|
12
|
+
/**
|
|
13
|
+
* Check if two bundle IDs match based on source type
|
|
14
|
+
* @param bundleId1 - First bundle ID to compare
|
|
15
|
+
* @param bundleId2 - Second bundle ID to compare
|
|
16
|
+
* @param sourceType - Source type determining matching strategy
|
|
17
|
+
* @returns True if bundles match according to source type rules
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* // GitHub bundles match by identity (ignoring version)
|
|
21
|
+
* bundleIdentitiesMatch('owner-repo-v1.0.0', 'owner-repo-v2.0.0', 'github'); // true
|
|
22
|
+
*
|
|
23
|
+
* // Non-GitHub bundles require exact match
|
|
24
|
+
* bundleIdentitiesMatch('local-bundle-v1.0.0', 'local-bundle-v2.0.0', 'local'); // false
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
function bundleIdentitiesMatch(bundleId1, bundleId2, sourceType) {
|
|
28
|
+
if (sourceType === 'github') {
|
|
29
|
+
// For GitHub, extract identity without version suffix
|
|
30
|
+
const identity1 = (0, version_1.extractBundleIdentity)(bundleId1, sourceType);
|
|
31
|
+
const identity2 = (0, version_1.extractBundleIdentity)(bundleId2, sourceType);
|
|
32
|
+
return identity1 === identity2;
|
|
33
|
+
}
|
|
34
|
+
// For non-GitHub sources, exact match required
|
|
35
|
+
return bundleId1 === bundleId2;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Extract base ID without version suffix
|
|
39
|
+
* @param bundleId - Bundle ID potentially containing version suffix
|
|
40
|
+
* @returns Base bundle ID without version
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* extractBaseBundleId('my-bundle-v1.0.0'); // 'my-bundle'
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
function extractBaseBundleId(bundleId) {
|
|
47
|
+
return bundleId.replace(exports.VERSION_SUFFIX_REGEX, '');
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Check if bundle ID contains a version suffix
|
|
51
|
+
* @param bundleId - Bundle ID to check
|
|
52
|
+
* @returns True if bundle ID contains version suffix
|
|
53
|
+
*/
|
|
54
|
+
function bundleIdHasVersionSuffix(bundleId) {
|
|
55
|
+
return exports.VERSION_SUFFIX_REGEX.test(bundleId);
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=identity-matcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity-matcher.js","sourceRoot":"","sources":["../../../src/domain/bundle/identity-matcher.ts"],"names":[],"mappings":";;;AAqCA,sDAUC;AAWD,kDAEC;AAOD,4DAEC;AAxDD,uCAEmB;AAEnB;;GAEG;AACU,QAAA,oBAAoB,GAAG,2CAA2C,CAAC;AAEhF;;;;;;;;;;;;;;GAcG;AACH,SAAgB,qBAAqB,CAAC,SAAiB,EAAE,SAAiB,EAAE,UAAsB;IAChG,IAAI,UAAU,KAAK,QAAQ,EAAE,CAAC;QAC5B,sDAAsD;QACtD,MAAM,SAAS,GAAG,IAAA,+BAAqB,EAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAC/D,MAAM,SAAS,GAAG,IAAA,+BAAqB,EAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAC/D,OAAO,SAAS,KAAK,SAAS,CAAC;IACjC,CAAC;IAED,+CAA+C;IAC/C,OAAO,SAAS,KAAK,SAAS,CAAC;AACjC,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,mBAAmB,CAAC,QAAgB;IAClD,OAAO,QAAQ,CAAC,OAAO,CAAC,4BAAoB,EAAE,EAAE,CAAC,CAAC;AACpD,CAAC;AAED;;;;GAIG;AACH,SAAgB,wBAAwB,CAAC,QAAgB;IACvD,OAAO,4BAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain layer — Bundle types.
|
|
3
|
+
*
|
|
4
|
+
* `Bundle` is the catalog/runtime entry as fetched from a source adapter and
|
|
5
|
+
* shown to users (Marketplace, `cli index search`, etc.). It is distinct
|
|
6
|
+
* from `Collection` (`../collection/types.ts`), which is the pre-build,
|
|
7
|
+
* author-facing shape of a `deployment-manifest.yml`.
|
|
8
|
+
*
|
|
9
|
+
* Mirrors the shape already in production at
|
|
10
|
+
* `src/types/registry.ts` (`Bundle`, `BundleDependency`, `BundleUpdate`) so
|
|
11
|
+
* that the extension's `RegistryManager`/`BundleInstaller` can eventually
|
|
12
|
+
* delegate to this type with zero field-mapping (see migration plan §7.5).
|
|
13
|
+
* @module domain/bundle/types
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Bundle metadata as surfaced by a source adapter.
|
|
17
|
+
*/
|
|
18
|
+
export interface Bundle {
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
version: string;
|
|
22
|
+
description: string;
|
|
23
|
+
author: string;
|
|
24
|
+
sourceId: string;
|
|
25
|
+
environments: string[];
|
|
26
|
+
tags: string[];
|
|
27
|
+
downloads?: number;
|
|
28
|
+
rating?: number;
|
|
29
|
+
lastUpdated: string;
|
|
30
|
+
size: string;
|
|
31
|
+
dependencies: BundleDependency[];
|
|
32
|
+
homepage?: string;
|
|
33
|
+
repository?: string;
|
|
34
|
+
license: string;
|
|
35
|
+
manifestUrl: string;
|
|
36
|
+
downloadUrl: string;
|
|
37
|
+
/** True if the bundle was surfaced via a curated hub rather than a raw source. */
|
|
38
|
+
isCurated?: boolean;
|
|
39
|
+
/** Name of the curated hub, when `isCurated` is true. */
|
|
40
|
+
hubName?: string;
|
|
41
|
+
checksum?: {
|
|
42
|
+
algorithm: string;
|
|
43
|
+
hash: string;
|
|
44
|
+
};
|
|
45
|
+
/** URL to the README asset (if available). */
|
|
46
|
+
readmeUrl?: string;
|
|
47
|
+
/** Cached README text content. */
|
|
48
|
+
readme?: string;
|
|
49
|
+
/** Source revision the cached readme corresponds to (e.g. release tag, commit sha). */
|
|
50
|
+
readmeRevision?: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* A dependency a bundle declares on another bundle.
|
|
54
|
+
*/
|
|
55
|
+
export interface BundleDependency {
|
|
56
|
+
bundleId: string;
|
|
57
|
+
versionRange: string;
|
|
58
|
+
optional: boolean;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Result of comparing an installed bundle's version against its source.
|
|
62
|
+
*/
|
|
63
|
+
export interface BundleUpdate {
|
|
64
|
+
bundleId: string;
|
|
65
|
+
currentVersion: string;
|
|
66
|
+
latestVersion: string;
|
|
67
|
+
changelog?: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Identifies one specific bundle version from one specific source, for the
|
|
71
|
+
* harvest/search subsystem (`infra/harvest`, `infra/search`). Distinct
|
|
72
|
+
* from `Bundle` above: `Bundle` is the rich, source-adapter-shaped catalog
|
|
73
|
+
* entry (name/description/downloads/checksum/... for the Marketplace UI);
|
|
74
|
+
* `BundleRef` is the minimal, stable coordinate a `Primitive` (below) is
|
|
75
|
+
* harvested from and a `BundleProvider` enumerates — no adapter needs to
|
|
76
|
+
* exist yet for a `BundleRef` to make sense (e.g. a local folder scan).
|
|
77
|
+
*/
|
|
78
|
+
export interface BundleRef {
|
|
79
|
+
sourceId: string;
|
|
80
|
+
sourceType: string;
|
|
81
|
+
bundleId: string;
|
|
82
|
+
bundleVersion: string;
|
|
83
|
+
installed: boolean;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The subset of a `deployment-manifest.yml` (or legacy `collection.yml`)
|
|
87
|
+
* the harvester's primitive extractor reads: per-item kind/title/tags
|
|
88
|
+
* hints, plus top-level tags/author as fallbacks. Permissive — unknown
|
|
89
|
+
* keys pass through via the index signature so forward-compat manifest
|
|
90
|
+
* fields don't need a schema bump here.
|
|
91
|
+
*/
|
|
92
|
+
export interface BundleManifest {
|
|
93
|
+
id: string;
|
|
94
|
+
version: string;
|
|
95
|
+
name?: string;
|
|
96
|
+
description?: string;
|
|
97
|
+
tags?: string[];
|
|
98
|
+
author?: string;
|
|
99
|
+
items?: {
|
|
100
|
+
path: string;
|
|
101
|
+
kind: string;
|
|
102
|
+
title?: string;
|
|
103
|
+
description?: string;
|
|
104
|
+
tags?: string[];
|
|
105
|
+
}[];
|
|
106
|
+
mcp?: {
|
|
107
|
+
items?: Record<string, {
|
|
108
|
+
type?: string;
|
|
109
|
+
command?: string;
|
|
110
|
+
args?: string[];
|
|
111
|
+
url?: string;
|
|
112
|
+
description?: string;
|
|
113
|
+
}>;
|
|
114
|
+
};
|
|
115
|
+
[key: string]: unknown;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* A single file read from a bundle during harvest, relative-path + raw
|
|
119
|
+
* UTF-8 content — the unit `extractFromFile` (`infra/harvest/extractor.ts`)
|
|
120
|
+
* turns into zero or one `Primitive`.
|
|
121
|
+
*/
|
|
122
|
+
export interface HarvestedFile {
|
|
123
|
+
path: string;
|
|
124
|
+
content: string;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Adapter-agnostic bundle enumeration + read surface for the harvester.
|
|
128
|
+
* Anything that can list bundles and read their files can feed the
|
|
129
|
+
* harvester: a GitHub tree walk, a local folder scan, an awesome-copilot
|
|
130
|
+
* collection listing, etc. Concrete implementations live in
|
|
131
|
+
* `infra/harvest/bundle-providers/*`.
|
|
132
|
+
*/
|
|
133
|
+
export interface BundleProvider {
|
|
134
|
+
listBundles(): AsyncIterable<BundleRef>;
|
|
135
|
+
readManifest(ref: BundleRef): Promise<BundleManifest>;
|
|
136
|
+
readFile(ref: BundleRef, relPath: string): Promise<string>;
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/domain/bundle/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Domain layer — Bundle types.
|
|
4
|
+
*
|
|
5
|
+
* `Bundle` is the catalog/runtime entry as fetched from a source adapter and
|
|
6
|
+
* shown to users (Marketplace, `cli index search`, etc.). It is distinct
|
|
7
|
+
* from `Collection` (`../collection/types.ts`), which is the pre-build,
|
|
8
|
+
* author-facing shape of a `deployment-manifest.yml`.
|
|
9
|
+
*
|
|
10
|
+
* Mirrors the shape already in production at
|
|
11
|
+
* `src/types/registry.ts` (`Bundle`, `BundleDependency`, `BundleUpdate`) so
|
|
12
|
+
* that the extension's `RegistryManager`/`BundleInstaller` can eventually
|
|
13
|
+
* delegate to this type with zero field-mapping (see migration plan §7.5).
|
|
14
|
+
* @module domain/bundle/types
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/domain/bundle/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { SourceType } from '../source/types';
|
|
2
|
+
/**
|
|
3
|
+
* Compare two semantic versions using semver.compare()
|
|
4
|
+
*
|
|
5
|
+
* Comparison strategy:
|
|
6
|
+
* 1. Try semver.clean() for standard versions
|
|
7
|
+
* 2. Fall back to semver.coerce() for non-standard versions
|
|
8
|
+
* 3. Last resort: lexicographic string comparison
|
|
9
|
+
* @param v1 - First version string
|
|
10
|
+
* @param v2 - Second version string
|
|
11
|
+
* @returns -1 if v1 < v2, 0 if equal, 1 if v1 > v2
|
|
12
|
+
* @throws {Error} if either version is empty or exceeds maximum length
|
|
13
|
+
*/
|
|
14
|
+
export declare function compareVersions(v1: string, v2: string): number;
|
|
15
|
+
/**
|
|
16
|
+
* Determine if an update is available using semver.gt()
|
|
17
|
+
* @param installedVersion - Currently installed version
|
|
18
|
+
* @param latestVersion - Latest available version
|
|
19
|
+
* @returns True if update available (latest > installed)
|
|
20
|
+
* @throws {Error} if either version is empty or invalid
|
|
21
|
+
*/
|
|
22
|
+
export declare function isUpdateAvailable(installedVersion: string, latestVersion: string): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Extract bundle identity from GitHub bundle ID by removing version suffix
|
|
25
|
+
*
|
|
26
|
+
* GitHub bundle IDs follow the format: {owner}-{repo}-{version}
|
|
27
|
+
* This method extracts {owner}-{repo} by identifying and removing the version suffix.
|
|
28
|
+
*
|
|
29
|
+
* For non-GitHub sources, the bundle ID is returned unchanged.
|
|
30
|
+
* @example
|
|
31
|
+
* extractBundleIdentity('microsoft-vscode-v1.0.0', 'github') // 'microsoft-vscode'
|
|
32
|
+
* extractBundleIdentity('my-org-my-repo-2.1.3', 'github') // 'my-org-my-repo'
|
|
33
|
+
* extractBundleIdentity('owner-123-v1.0.0', 'github') // 'owner-123'
|
|
34
|
+
* extractBundleIdentity('bundle-id', 'local') // 'bundle-id' (unchanged)
|
|
35
|
+
* @param bundleId - Bundle ID potentially containing version suffix
|
|
36
|
+
* @param sourceType - Source type of the bundle
|
|
37
|
+
* @returns Bundle identity without version suffix (GitHub only)
|
|
38
|
+
* @throws {Error} if bundleId exceeds maximum length
|
|
39
|
+
*/
|
|
40
|
+
export declare function extractBundleIdentity(bundleId: string, sourceType: SourceType): string;
|
|
41
|
+
/**
|
|
42
|
+
* Check if two bundle IDs represent the same bundle identity
|
|
43
|
+
* Handles versioned IDs and different source types
|
|
44
|
+
* @param id1 - First bundle ID
|
|
45
|
+
* @param type1 - Source type of first bundle
|
|
46
|
+
* @param id2 - Second bundle ID
|
|
47
|
+
* @param type2 - Source type of second bundle
|
|
48
|
+
* @returns True if they represent the same bundle identity
|
|
49
|
+
*/
|
|
50
|
+
export declare function isSameBundleIdentity(id1: string, type1: SourceType, id2: string, type2: SourceType): boolean;
|
|
51
|
+
//# sourceMappingURL=version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/domain/bundle/version.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACV,UAAU,EACX,MAAM,iBAAiB,CAAC;AAwBzB;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAwB9D;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,gBAAgB,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAkB1F;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,MAAM,CAwBtF;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAE5G"}
|