@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/dist/index.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
36
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.CORE_PACKAGE_READY = exports.COLLECTION_SCHEMA = exports.SCHEMA_DIR = void 0;
|
|
43
|
+
/**
|
|
44
|
+
* The `@ai-primitives-hub/core` package.
|
|
45
|
+
*
|
|
46
|
+
* Domain types and port interfaces, per the migration plan
|
|
47
|
+
* (.tmp/ai-primitives-hub-next-migration-plan.md §7.3): bundle/collection,
|
|
48
|
+
* source, install/target (full TargetType union), hub/profile/registry,
|
|
49
|
+
* primitive/index, and port interfaces for filesystem, HTTP, GitHub API,
|
|
50
|
+
* clock. Landing incrementally, one bounded context per commit.
|
|
51
|
+
*/
|
|
52
|
+
const path = __importStar(require("node:path"));
|
|
53
|
+
__exportStar(require("./domain"), exports);
|
|
54
|
+
__exportStar(require("./ports"), exports);
|
|
55
|
+
/**
|
|
56
|
+
* Public schema directory path.
|
|
57
|
+
* This directory contains JSON schemas for validation.
|
|
58
|
+
*/
|
|
59
|
+
exports.SCHEMA_DIR = path.join(__dirname, './public/schemas');
|
|
60
|
+
/**
|
|
61
|
+
* Collection schema JSON embedded directly in the bundle.
|
|
62
|
+
* Use this instead of loading from disk to ensure schema is always available
|
|
63
|
+
* in single-executable applications.
|
|
64
|
+
*/
|
|
65
|
+
var collection_schema_json_1 = require("./public/schemas/collection.schema.json");
|
|
66
|
+
Object.defineProperty(exports, "COLLECTION_SCHEMA", { enumerable: true, get: function () { return __importDefault(collection_schema_json_1).default; } });
|
|
67
|
+
/**
|
|
68
|
+
* Phase 1 scaffolding marker, kept until `infra`/`app`/`cli` each have real
|
|
69
|
+
* code of their own to depend on instead of this placeholder re-export
|
|
70
|
+
* chain (see those packages' `src/index.ts`) — removed in Phase 5 once
|
|
71
|
+
* `cli` no longer needs it.
|
|
72
|
+
*/
|
|
73
|
+
exports.CORE_PACKAGE_READY = true;
|
|
74
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;GAQG;AACH,gDAAkC;AAElC,2CAAyB;AACzB,0CAAwB;AAExB;;;GAGG;AACU,QAAA,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;AAEnE;;;;GAIG;AACH,kFAAuF;AAA9E,4IAAA,OAAO,OAAqB;AAErC;;;;;GAKG;AACU,QAAA,kBAAkB,GAAG,IAAI,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AppStorage port — universal, non-VS-Code-specific storage-root
|
|
3
|
+
* resolution for the registry/bookkeeping layer (config, cache,
|
|
4
|
+
* installed-bundle records per scope, profiles, logs).
|
|
5
|
+
*
|
|
6
|
+
* Models exactly the directory/file responsibilities the extension's
|
|
7
|
+
* `RegistryStorage` (`src/storage/registry-storage.ts`) already defines,
|
|
8
|
+
* plus a tiny generic key/value slot for small persisted state (bundle
|
|
9
|
+
* update preferences today) — so path *and* state resolution are both
|
|
10
|
+
* behind one injectable seam instead of being resolved inline against
|
|
11
|
+
* `vscode.ExtensionContext`.
|
|
12
|
+
*
|
|
13
|
+
* Two implementations: the VS Code extension's own adapter, backed by
|
|
14
|
+
* `context.globalStorageUri`/`context.globalState` (kept exactly as-is
|
|
15
|
+
* for existing users — see ADR-0005 decision 3); and `infra`'s
|
|
16
|
+
* `XdgAppStorage`, an XDG Base Directory-compliant default for the CLI
|
|
17
|
+
* and any other non-VS-Code client (ADR-0005 decision 2).
|
|
18
|
+
* @module ports/app-storage
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* The fixed set of paths `RegistryStorage` reads/writes today.
|
|
22
|
+
*/
|
|
23
|
+
export interface AppStoragePaths {
|
|
24
|
+
/** Root directory this app's data lives under. */
|
|
25
|
+
root: string;
|
|
26
|
+
/** Path to the registry config file (sources, profiles, settings). */
|
|
27
|
+
config: string;
|
|
28
|
+
/** Root of the cache subtree. */
|
|
29
|
+
cache: string;
|
|
30
|
+
/** Cached per-source bundle listings. */
|
|
31
|
+
sourcesCache: string;
|
|
32
|
+
/** Cached per-bundle metadata. */
|
|
33
|
+
bundlesCache: string;
|
|
34
|
+
/** Installed-bundle records, workspace scope. */
|
|
35
|
+
installed: string;
|
|
36
|
+
/** Installed-bundle records, user scope. */
|
|
37
|
+
userInstalled: string;
|
|
38
|
+
/** Installed-bundle records for profile-driven installs. */
|
|
39
|
+
profilesInstalled: string;
|
|
40
|
+
/** Profile definitions. */
|
|
41
|
+
profiles: string;
|
|
42
|
+
/** Log output. */
|
|
43
|
+
logs: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Universal storage-root port for the registry/bookkeeping layer.
|
|
47
|
+
*/
|
|
48
|
+
export interface AppStorage {
|
|
49
|
+
/** Resolve the fixed set of directory/file paths this app uses. */
|
|
50
|
+
getPaths(): AppStoragePaths;
|
|
51
|
+
/**
|
|
52
|
+
* Read a small piece of persisted state (e.g. bundle update
|
|
53
|
+
* preferences). Returns `defaultValue` if `key` has never been set.
|
|
54
|
+
* @param key - State key.
|
|
55
|
+
* @param defaultValue - Value to return when `key` is unset.
|
|
56
|
+
*/
|
|
57
|
+
getState<T>(key: string, defaultValue: T): Promise<T>;
|
|
58
|
+
/**
|
|
59
|
+
* Persist a small piece of state under `key`.
|
|
60
|
+
* @param key - State key.
|
|
61
|
+
* @param value - Value to persist.
|
|
62
|
+
*/
|
|
63
|
+
setState<T>(key: string, value: T): Promise<void>;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=app-storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-storage.d.ts","sourceRoot":"","sources":["../../src/ports/app-storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,MAAM,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,yCAAyC;IACzC,YAAY,EAAE,MAAM,CAAC;IACrB,kCAAkC;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,iDAAiD;IACjD,SAAS,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,aAAa,EAAE,MAAM,CAAC;IACtB,4DAA4D;IAC5D,iBAAiB,EAAE,MAAM,CAAC;IAC1B,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,mEAAmE;IACnE,QAAQ,IAAI,eAAe,CAAC;IAC5B;;;;;OAKG;IACH,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACtD;;;;OAIG;IACH,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* AppStorage port — universal, non-VS-Code-specific storage-root
|
|
4
|
+
* resolution for the registry/bookkeeping layer (config, cache,
|
|
5
|
+
* installed-bundle records per scope, profiles, logs).
|
|
6
|
+
*
|
|
7
|
+
* Models exactly the directory/file responsibilities the extension's
|
|
8
|
+
* `RegistryStorage` (`src/storage/registry-storage.ts`) already defines,
|
|
9
|
+
* plus a tiny generic key/value slot for small persisted state (bundle
|
|
10
|
+
* update preferences today) — so path *and* state resolution are both
|
|
11
|
+
* behind one injectable seam instead of being resolved inline against
|
|
12
|
+
* `vscode.ExtensionContext`.
|
|
13
|
+
*
|
|
14
|
+
* Two implementations: the VS Code extension's own adapter, backed by
|
|
15
|
+
* `context.globalStorageUri`/`context.globalState` (kept exactly as-is
|
|
16
|
+
* for existing users — see ADR-0005 decision 3); and `infra`'s
|
|
17
|
+
* `XdgAppStorage`, an XDG Base Directory-compliant default for the CLI
|
|
18
|
+
* and any other non-VS-Code client (ADR-0005 decision 2).
|
|
19
|
+
* @module ports/app-storage
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
//# sourceMappingURL=app-storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-storage.js","sourceRoot":"","sources":["../../src/ports/app-storage.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BundleDownloader port — fetches bundle bytes from a URL and returns
|
|
3
|
+
* them with a SHA-256 digest. Concrete adapters live in `infra`.
|
|
4
|
+
* @module ports/bundle-downloader
|
|
5
|
+
*/
|
|
6
|
+
import type { Installable } from '../domain/install/installable';
|
|
7
|
+
/**
|
|
8
|
+
* Result of a bundle download operation.
|
|
9
|
+
*/
|
|
10
|
+
export interface DownloadResult {
|
|
11
|
+
/** Raw bundle bytes (zip). */
|
|
12
|
+
bytes: Uint8Array;
|
|
13
|
+
/** SHA-256 hex digest of the bytes. */
|
|
14
|
+
sha256: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Downloads bundle bytes and returns them with an integrity digest.
|
|
18
|
+
*/
|
|
19
|
+
export interface BundleDownloader {
|
|
20
|
+
/**
|
|
21
|
+
* Download the bundle referenced by `installable`.
|
|
22
|
+
* @param installable Resolved Installable from the resolver.
|
|
23
|
+
* @returns DownloadResult with bytes and SHA-256.
|
|
24
|
+
* @throws {Error} On network failure or integrity mismatch.
|
|
25
|
+
*/
|
|
26
|
+
download(installable: Installable): Promise<DownloadResult>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=bundle-downloader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-downloader.d.ts","sourceRoot":"","sources":["../../src/ports/bundle-downloader.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EACV,WAAW,EACZ,MAAM,+BAA+B,CAAC;AAEvC;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,8BAA8B;IAC9B,KAAK,EAAE,UAAU,CAAC;IAClB,uCAAuC;IACvC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CAC7D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-downloader.js","sourceRoot":"","sources":["../../src/ports/bundle-downloader.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BundleExtractor port — decodes zip bytes into a path→bytes map.
|
|
3
|
+
* Concrete adapters live in `infra`. Tests inject a dict-backed fake.
|
|
4
|
+
* @module ports/bundle-extractor
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Extracted bundle files: relative path → raw bytes.
|
|
8
|
+
*/
|
|
9
|
+
export type ExtractedFiles = ReadonlyMap<string, Uint8Array>;
|
|
10
|
+
/**
|
|
11
|
+
* Decodes bundle (zip) bytes into a file map.
|
|
12
|
+
*/
|
|
13
|
+
export interface BundleExtractor {
|
|
14
|
+
/**
|
|
15
|
+
* Extract the bundle zip into a path → bytes map.
|
|
16
|
+
* @param bytes Raw bundle bytes from the downloader.
|
|
17
|
+
* @returns Map of relative paths to file contents.
|
|
18
|
+
*/
|
|
19
|
+
extract(bytes: Uint8Array): Promise<ExtractedFiles>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=bundle-extractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-extractor.d.ts","sourceRoot":"","sources":["../../src/ports/bundle-extractor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,OAAO,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CACrD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* BundleExtractor port — decodes zip bytes into a path→bytes map.
|
|
4
|
+
* Concrete adapters live in `infra`. Tests inject a dict-backed fake.
|
|
5
|
+
* @module ports/bundle-extractor
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
//# sourceMappingURL=bundle-extractor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-extractor.js","sourceRoot":"","sources":["../../src/ports/bundle-extractor.ts"],"names":[],"mappings":";AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clock port — time abstraction for deterministic testing.
|
|
3
|
+
*
|
|
4
|
+
* Code that needs "now" (timestamps on `InstalledBundle.installedAt`,
|
|
5
|
+
* lockfile `generatedAt`, cache TTLs, ...) depends on this interface
|
|
6
|
+
* instead of calling `Date.now()`/`new Date()` directly, so tests can
|
|
7
|
+
* inject a fixed or controllable clock. The production adapter
|
|
8
|
+
* (`@ai-primitives-hub/infra`, Phase 3) simply wraps the real `Date`.
|
|
9
|
+
* @module ports/clock
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Minimal clock surface.
|
|
13
|
+
*/
|
|
14
|
+
export interface Clock {
|
|
15
|
+
/** Current time, as epoch milliseconds. */
|
|
16
|
+
now(): number;
|
|
17
|
+
/** Current time, as an ISO-8601 string — the format persisted throughout `core`'s domain types. */
|
|
18
|
+
nowIso(): string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Test-clock extension — the manual `advance()` lever used by the CLI
|
|
22
|
+
* framework's golden tests (`@ai-primitives-hub/cli`'s
|
|
23
|
+
* `framework/test-context.ts`). Production code never sees this type;
|
|
24
|
+
* only the test factory upcasts to `Clock` when handing it to commands.
|
|
25
|
+
*/
|
|
26
|
+
export interface TestClock extends Clock {
|
|
27
|
+
advance(ms: number): void;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=clock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../../src/ports/clock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB,2CAA2C;IAC3C,GAAG,IAAI,MAAM,CAAC;IACd,mGAAmG;IACnG,MAAM,IAAI,MAAM,CAAC;CAClB;AAED;;;;;GAKG;AACH,MAAM,WAAW,SAAU,SAAQ,KAAK;IACtC,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Clock port — time abstraction for deterministic testing.
|
|
4
|
+
*
|
|
5
|
+
* Code that needs "now" (timestamps on `InstalledBundle.installedAt`,
|
|
6
|
+
* lockfile `generatedAt`, cache TTLs, ...) depends on this interface
|
|
7
|
+
* instead of calling `Date.now()`/`new Date()` directly, so tests can
|
|
8
|
+
* inject a fixed or controllable clock. The production adapter
|
|
9
|
+
* (`@ai-primitives-hub/infra`, Phase 3) simply wraps the real `Date`.
|
|
10
|
+
* @module ports/clock
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
//# sourceMappingURL=clock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clock.js","sourceRoot":"","sources":["../../src/ports/clock.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copilot SDK port interface.
|
|
3
|
+
*
|
|
4
|
+
* Abstract interface for Copilot SDK integration — the AI-session
|
|
5
|
+
* backend `app/discovery/recommendation-engine.ts`'s AI-powered path
|
|
6
|
+
* depends on. Infrastructure layer provides concrete implementations
|
|
7
|
+
* (e.g. a real Copilot SDK client for the CLI's `discover --ai`
|
|
8
|
+
* command); this package only depends on the shape.
|
|
9
|
+
*
|
|
10
|
+
* Ported unchanged from the reference branch's
|
|
11
|
+
* `core/src/ports/copilot-sdk.ts`.
|
|
12
|
+
* @module ports/copilot-sdk
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Permission request from Copilot SDK.
|
|
16
|
+
*/
|
|
17
|
+
export interface PermissionRequest {
|
|
18
|
+
/** Kind of permission requested */
|
|
19
|
+
readonly kind: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Permission response to Copilot SDK.
|
|
23
|
+
*/
|
|
24
|
+
export interface PermissionResponse {
|
|
25
|
+
/** Whether permission was approved or denied */
|
|
26
|
+
readonly kind: 'approved' | 'denied';
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Options for creating a Copilot session.
|
|
30
|
+
*/
|
|
31
|
+
export interface SessionOptions {
|
|
32
|
+
/** Model to use for the session */
|
|
33
|
+
readonly model?: string;
|
|
34
|
+
/** Skill directories to load custom skills from */
|
|
35
|
+
readonly skillDirectories: readonly string[];
|
|
36
|
+
/** Permission request handler */
|
|
37
|
+
readonly onPermissionRequest: (request: PermissionRequest) => Promise<PermissionResponse>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Copilot session interface.
|
|
41
|
+
*/
|
|
42
|
+
export interface CopilotSession {
|
|
43
|
+
/**
|
|
44
|
+
* Send a prompt and wait for complete response.
|
|
45
|
+
* @param prompt - The prompt to send.
|
|
46
|
+
* @returns Complete response string.
|
|
47
|
+
*/
|
|
48
|
+
sendAndWait(prompt: string): Promise<string>;
|
|
49
|
+
/**
|
|
50
|
+
* Send a prompt with streaming response.
|
|
51
|
+
* @param prompt - The prompt to send.
|
|
52
|
+
* @param onChunk - Callback for each chunk of the response.
|
|
53
|
+
* @returns Complete response string.
|
|
54
|
+
*/
|
|
55
|
+
sendWithStream(prompt: string, onChunk: (chunk: string) => void): Promise<string>;
|
|
56
|
+
/**
|
|
57
|
+
* Close the session and release resources.
|
|
58
|
+
*/
|
|
59
|
+
close(): Promise<void>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Copilot SDK interface.
|
|
63
|
+
*
|
|
64
|
+
* Abstract interface for AI model integration. Concrete
|
|
65
|
+
* implementations handle specific Copilot SDK versions.
|
|
66
|
+
*/
|
|
67
|
+
export interface CopilotSdk {
|
|
68
|
+
/**
|
|
69
|
+
* Check if Copilot SDK is available.
|
|
70
|
+
* @returns True if SDK is available and can be used.
|
|
71
|
+
*/
|
|
72
|
+
isAvailable(): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Create a Copilot session with custom skills.
|
|
75
|
+
* @param options - Session configuration options.
|
|
76
|
+
* @returns Copilot session instance.
|
|
77
|
+
*/
|
|
78
|
+
createSession(options: SessionOptions): Promise<CopilotSession>;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=copilot-sdk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-sdk.d.ts","sourceRoot":"","sources":["../../src/ports/copilot-sdk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,mCAAmC;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,gDAAgD;IAChD,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,QAAQ,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,mCAAmC;IACnC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,mDAAmD;IACnD,QAAQ,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7C,iCAAiC;IACjC,QAAQ,CAAC,mBAAmB,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAC3F;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE7C;;;;;OAKG;IACH,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAElF;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,WAAW,IAAI,OAAO,CAAC;IAEvB;;;;OAIG;IACH,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CACjE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copilot SDK port interface.
|
|
4
|
+
*
|
|
5
|
+
* Abstract interface for Copilot SDK integration — the AI-session
|
|
6
|
+
* backend `app/discovery/recommendation-engine.ts`'s AI-powered path
|
|
7
|
+
* depends on. Infrastructure layer provides concrete implementations
|
|
8
|
+
* (e.g. a real Copilot SDK client for the CLI's `discover --ai`
|
|
9
|
+
* command); this package only depends on the shape.
|
|
10
|
+
*
|
|
11
|
+
* Ported unchanged from the reference branch's
|
|
12
|
+
* `core/src/ports/copilot-sdk.ts`.
|
|
13
|
+
* @module ports/copilot-sdk
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
//# sourceMappingURL=copilot-sdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-sdk.js","sourceRoot":"","sources":["../../src/ports/copilot-sdk.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FileSystem port — IO abstraction for all file-system operations.
|
|
3
|
+
*
|
|
4
|
+
* The contract every feature layer uses for filesystem access — mirrors
|
|
5
|
+
* the operations `src/services/*` already perform via `fs/promises`
|
|
6
|
+
* today (read/write text and JSON, existence checks, directory
|
|
7
|
+
* creation/listing, removal). Concrete adapters live in
|
|
8
|
+
* `@ai-primitives-hub/infra` (Phase 3); tests supply hand-written
|
|
9
|
+
* in-memory doubles. Keeps `core`/`app` free of direct `node:fs` imports.
|
|
10
|
+
* @module ports/filesystem
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Subset of `fs.Stats` that source adapters/install pipeline code actually
|
|
14
|
+
* uses (file size for bundle sizing, mtime for `lastUpdated`, directory
|
|
15
|
+
* detection). Extended here, rather than in a later commit, because the
|
|
16
|
+
* first concrete adapter (`infra`'s `LocalAdapter`, Phase 3a) needs it
|
|
17
|
+
* immediately.
|
|
18
|
+
*/
|
|
19
|
+
export interface FileStat {
|
|
20
|
+
isDirectory: boolean;
|
|
21
|
+
isFile: boolean;
|
|
22
|
+
/** Bytes; 0 for directories. */
|
|
23
|
+
size: number;
|
|
24
|
+
/** Last-modified time, epoch milliseconds. */
|
|
25
|
+
mtimeMs: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A directory entry as returned by `readDirEntries` — name plus type, so
|
|
29
|
+
* callers don't need a follow-up `stat` just to tell files from
|
|
30
|
+
* directories while scanning.
|
|
31
|
+
*/
|
|
32
|
+
export interface DirEntry {
|
|
33
|
+
name: string;
|
|
34
|
+
isDirectory: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface FileSystem {
|
|
37
|
+
readFile(path: string): Promise<string>;
|
|
38
|
+
writeFile(path: string, contents: string): Promise<void>;
|
|
39
|
+
readJson<T = unknown>(path: string): Promise<T>;
|
|
40
|
+
writeJson(path: string, value: unknown): Promise<void>;
|
|
41
|
+
exists(path: string): Promise<boolean>;
|
|
42
|
+
mkdir(path: string, opts?: {
|
|
43
|
+
recursive?: boolean;
|
|
44
|
+
}): Promise<void>;
|
|
45
|
+
readDir(path: string): Promise<string[]>;
|
|
46
|
+
/** Like `readDir`, but with type information — avoids a stat-per-entry scan. */
|
|
47
|
+
readDirEntries(path: string): Promise<DirEntry[]>;
|
|
48
|
+
stat(path: string): Promise<FileStat>;
|
|
49
|
+
remove(path: string, opts?: {
|
|
50
|
+
recursive?: boolean;
|
|
51
|
+
}): Promise<void>;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=filesystem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filesystem.d.ts","sourceRoot":"","sources":["../../src/ports/filesystem.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;;;GAMG;AACH,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACxC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,QAAQ,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAChD,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACvC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnE,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACzC,gFAAgF;IAChF,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAClD,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACtC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* FileSystem port — IO abstraction for all file-system operations.
|
|
4
|
+
*
|
|
5
|
+
* The contract every feature layer uses for filesystem access — mirrors
|
|
6
|
+
* the operations `src/services/*` already perform via `fs/promises`
|
|
7
|
+
* today (read/write text and JSON, existence checks, directory
|
|
8
|
+
* creation/listing, removal). Concrete adapters live in
|
|
9
|
+
* `@ai-primitives-hub/infra` (Phase 3); tests supply hand-written
|
|
10
|
+
* in-memory doubles. Keeps `core`/`app` free of direct `node:fs` imports.
|
|
11
|
+
* @module ports/filesystem
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
//# sourceMappingURL=filesystem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filesystem.js","sourceRoot":"","sources":["../../src/ports/filesystem.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHubApi port — interface for GitHub REST API interactions.
|
|
3
|
+
*
|
|
4
|
+
* Covers the access patterns `src/adapters/github-adapter.ts` and
|
|
5
|
+
* `src/adapters/skills-adapter.ts` need: JSON GETs (repository contents,
|
|
6
|
+
* tree, releases), text GETs (raw file content), and binary downloads
|
|
7
|
+
* (release/tarball assets). Also covers the ETag-conditional GET the
|
|
8
|
+
* Phase 3b harvest subsystem needs to poll `/commits/:ref` cheaply across
|
|
9
|
+
* many hub sources without spending full rate-limit budget on unchanged
|
|
10
|
+
* repos (`getJsonWithEtag`). Retry/backoff/rate-limit handling is
|
|
11
|
+
* deliberately *not* part of this port — it's a resilience concern of
|
|
12
|
+
* whichever concrete implementation wraps the transport (see
|
|
13
|
+
* `@ai-primitives-hub/infra`'s `GitHubApiClient`), not something every
|
|
14
|
+
* `GitHubApi` implementation (e.g. a test double) needs to reason about.
|
|
15
|
+
* @module ports/github-api
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Result of an ETag-conditional GET. `notModified` means the caller's
|
|
19
|
+
* cached value is still current and nothing was parsed; `ok` carries a
|
|
20
|
+
* fresh value and its new ETag (`undefined` if the response omitted one).
|
|
21
|
+
*/
|
|
22
|
+
export interface EtaggedOk<T> {
|
|
23
|
+
status: 'ok';
|
|
24
|
+
value: T;
|
|
25
|
+
etag: string | undefined;
|
|
26
|
+
}
|
|
27
|
+
export interface EtaggedNotModified {
|
|
28
|
+
status: 'notModified';
|
|
29
|
+
}
|
|
30
|
+
export type EtaggedResult<T> = EtaggedOk<T> | EtaggedNotModified;
|
|
31
|
+
export interface GitHubApi {
|
|
32
|
+
/**
|
|
33
|
+
* GET returning parsed JSON. Throws on a non-2xx response.
|
|
34
|
+
* @param pathOrUrl - Relative API path (e.g. `/repos/{owner}/{repo}`) or absolute URL.
|
|
35
|
+
* @param extraHeaders - Optional additional headers.
|
|
36
|
+
*/
|
|
37
|
+
getJson<T>(pathOrUrl: string, extraHeaders?: Record<string, string>): Promise<T>;
|
|
38
|
+
/**
|
|
39
|
+
* GET returning the raw text body. Throws on a non-2xx response.
|
|
40
|
+
* @param pathOrUrl - Relative API path or absolute URL.
|
|
41
|
+
* @param extraHeaders - Optional additional headers.
|
|
42
|
+
*/
|
|
43
|
+
getText(pathOrUrl: string, extraHeaders?: Record<string, string>): Promise<string>;
|
|
44
|
+
/**
|
|
45
|
+
* GET returning the raw response bytes, for binary assets (release ZIPs,
|
|
46
|
+
* tarballs). Throws on a non-2xx response.
|
|
47
|
+
* @param pathOrUrl - Relative API path or absolute URL.
|
|
48
|
+
* @param extraHeaders - Optional additional headers.
|
|
49
|
+
*/
|
|
50
|
+
download(pathOrUrl: string, extraHeaders?: Record<string, string>): Promise<Uint8Array>;
|
|
51
|
+
/**
|
|
52
|
+
* GET with an `If-None-Match` guard. Returns `{ status: 'notModified' }`
|
|
53
|
+
* on a 304 response instead of throwing; otherwise `{ status: 'ok',
|
|
54
|
+
* value, etag }`. Lets a caller with a previously-seen ETag skip paying
|
|
55
|
+
* for a body transfer — and, on many GitHub endpoints, skip the
|
|
56
|
+
* rate-limit cost too — when nothing changed.
|
|
57
|
+
* @param pathOrUrl - Relative API path or absolute URL.
|
|
58
|
+
* @param etag - Previously-seen ETag for this exact resource, if any.
|
|
59
|
+
*/
|
|
60
|
+
getJsonWithEtag<T>(pathOrUrl: string, etag?: string): Promise<EtaggedResult<T>>;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=github-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-api.d.ts","sourceRoot":"","sources":["../../src/ports/github-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;GAIG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,MAAM,EAAE,IAAI,CAAC;IACb,KAAK,EAAE,CAAC,CAAC;IACT,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B;AACD,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,aAAa,CAAC;CACvB;AACD,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,GAAG,kBAAkB,CAAC;AAEjE,MAAM,WAAW,SAAS;IACxB;;;;OAIG;IACH,OAAO,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAEjF;;;;OAIG;IACH,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEnF;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAExF;;;;;;;;OAQG;IACH,eAAe,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;CACjF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* GitHubApi port — interface for GitHub REST API interactions.
|
|
4
|
+
*
|
|
5
|
+
* Covers the access patterns `src/adapters/github-adapter.ts` and
|
|
6
|
+
* `src/adapters/skills-adapter.ts` need: JSON GETs (repository contents,
|
|
7
|
+
* tree, releases), text GETs (raw file content), and binary downloads
|
|
8
|
+
* (release/tarball assets). Also covers the ETag-conditional GET the
|
|
9
|
+
* Phase 3b harvest subsystem needs to poll `/commits/:ref` cheaply across
|
|
10
|
+
* many hub sources without spending full rate-limit budget on unchanged
|
|
11
|
+
* repos (`getJsonWithEtag`). Retry/backoff/rate-limit handling is
|
|
12
|
+
* deliberately *not* part of this port — it's a resilience concern of
|
|
13
|
+
* whichever concrete implementation wraps the transport (see
|
|
14
|
+
* `@ai-primitives-hub/infra`'s `GitHubApiClient`), not something every
|
|
15
|
+
* `GitHubApi` implementation (e.g. a test double) needs to reason about.
|
|
16
|
+
* @module ports/github-api
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
//# sourceMappingURL=github-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-api.js","sourceRoot":"","sources":["../../src/ports/github-api.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP port — network abstraction for source adapters and the install
|
|
3
|
+
* pipeline.
|
|
4
|
+
*
|
|
5
|
+
* `app`/`infra` non-adapter code depends only on this interface, never on
|
|
6
|
+
* `fetch`/`axios`/`node:http` directly. The production adapter
|
|
7
|
+
* (`@ai-primitives-hub/infra`, Phase 3) wraps the real HTTP client.
|
|
8
|
+
* @module ports/http
|
|
9
|
+
*/
|
|
10
|
+
export interface HttpResponse {
|
|
11
|
+
/** Status code after redirect handling. */
|
|
12
|
+
statusCode: number;
|
|
13
|
+
/** Raw response body bytes. */
|
|
14
|
+
body: Uint8Array;
|
|
15
|
+
/** Final URL after any redirect chain. */
|
|
16
|
+
finalUrl: string;
|
|
17
|
+
/** Lower-cased response headers. */
|
|
18
|
+
headers: Record<string, string>;
|
|
19
|
+
}
|
|
20
|
+
export interface HttpRequest {
|
|
21
|
+
/** Absolute URL. */
|
|
22
|
+
url: string;
|
|
23
|
+
/** Defaults to `'GET'`. */
|
|
24
|
+
method?: 'GET' | 'HEAD' | 'POST';
|
|
25
|
+
/** Request headers (case-insensitive). */
|
|
26
|
+
headers?: Record<string, string>;
|
|
27
|
+
/** Request body, for `POST`. */
|
|
28
|
+
body?: Uint8Array | string;
|
|
29
|
+
/** Maximum redirect chain length; defaults to the adapter's own default. */
|
|
30
|
+
maxRedirects?: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The minimal HTTP surface source adapters and the install pipeline need.
|
|
34
|
+
*/
|
|
35
|
+
export interface HttpClient {
|
|
36
|
+
fetch(request: HttpRequest): Promise<HttpResponse>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Resolves a bearer token for an authenticated request, e.g. to GitHub's
|
|
40
|
+
* API. Host-aware (`host` is the target request's hostname): the harvest
|
|
41
|
+
* subsystem (Phase 3b) can walk many distinct sources/hosts in a single
|
|
42
|
+
* run, and a provider must be able to refuse to hand a host-specific
|
|
43
|
+
* credential (e.g. a GitHub token) to an unrelated host — a redirect
|
|
44
|
+
* target, a different Enterprise instance, a caller-supplied URL that
|
|
45
|
+
* turns out not to be GitHub at all. A concrete provider still closes
|
|
46
|
+
* over whatever source/context it needs (an explicit `RegistrySource.token`,
|
|
47
|
+
* a `gh` CLI lookup, a VS Code authentication session, ...) so callers
|
|
48
|
+
* never need to know which strategy is in play, and infra never needs to
|
|
49
|
+
* depend on delivery-specific auth mechanisms (e.g. the `vscode` module).
|
|
50
|
+
*
|
|
51
|
+
* Called once per request rather than cached by the caller, so a provider
|
|
52
|
+
* backed by a session that can expire/rotate stays correct without infra
|
|
53
|
+
* needing its own retry-on-401 logic.
|
|
54
|
+
*/
|
|
55
|
+
export interface TokenProvider {
|
|
56
|
+
getToken(host: string): Promise<string | undefined>;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/ports/http.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,WAAW,YAAY;IAC3B,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,+BAA+B;IAC/B,IAAI,EAAE,UAAU,CAAC;IACjB,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,oCAAoC;IACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,WAAW;IAC1B,oBAAoB;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,2BAA2B;IAC3B,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;IACjC,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,gCAAgC;IAChC,IAAI,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IAC3B,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CACpD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACrD"}
|