@kb-labs/marketplace-contracts 2.31.0 → 2.32.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.
- package/dist/index.d.ts +75 -6
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -91,6 +91,40 @@ interface PackageSource {
|
|
|
91
91
|
/** Publish a package (optional — only registry source supports it) */
|
|
92
92
|
publish?(tarball: Buffer, metadata: PublishMetadata): Promise<PublishResult>;
|
|
93
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* A marketplace scope. Each scope has its own independent `marketplace.lock`
|
|
96
|
+
* and manifest cache, rooted at a different directory.
|
|
97
|
+
*
|
|
98
|
+
* - `platform` — global installs shared across projects (in the platform root).
|
|
99
|
+
* - `project` — installs local to a single project (in the project root).
|
|
100
|
+
* - `all` — only valid as a query scope (`list`). Returns merged entries
|
|
101
|
+
* from both scopes with `scope` field attached to each entry.
|
|
102
|
+
*/
|
|
103
|
+
type MarketplaceScope = 'platform' | 'project';
|
|
104
|
+
type MarketplaceQueryScope = MarketplaceScope | 'all';
|
|
105
|
+
/**
|
|
106
|
+
* Per-call scope binding for mutating operations (`install`, `link`,
|
|
107
|
+
* `unlink`, `enable`, `disable`, `update`, `sync`) and for read operations
|
|
108
|
+
* (`list`, `getEntry`).
|
|
109
|
+
*
|
|
110
|
+
* - `scope` — which lock this call targets.
|
|
111
|
+
* - `projectRoot` — required for `scope: 'project'` (ignored otherwise).
|
|
112
|
+
* Absolute path. The service validates that this directory
|
|
113
|
+
* exists and contains a `.kb/kb.config.{json,jsonc}` and is
|
|
114
|
+
* not equal to the platform root.
|
|
115
|
+
*/
|
|
116
|
+
interface ScopeContext {
|
|
117
|
+
scope: MarketplaceScope;
|
|
118
|
+
projectRoot?: string;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Read-side context. Same as `ScopeContext`, but also admits `'all'` to merge
|
|
122
|
+
* platform and project lists.
|
|
123
|
+
*/
|
|
124
|
+
interface QueryScopeContext {
|
|
125
|
+
scope: MarketplaceQueryScope;
|
|
126
|
+
projectRoot?: string;
|
|
127
|
+
}
|
|
94
128
|
/**
|
|
95
129
|
* Public read-only API of MarketplaceService exposed to strategies.
|
|
96
130
|
* Strategies must not depend on the full implementation.
|
|
@@ -99,13 +133,32 @@ interface PackageSource {
|
|
|
99
133
|
type MarketplaceEntryWithId = MarketplaceEntry & {
|
|
100
134
|
id: string;
|
|
101
135
|
};
|
|
136
|
+
/**
|
|
137
|
+
* Marketplace entry annotated with the scope it came from. Returned by
|
|
138
|
+
* `list()` so callers can always tell where a package was installed, without
|
|
139
|
+
* having to probe locks themselves.
|
|
140
|
+
*/
|
|
141
|
+
type ScopedMarketplaceEntry = MarketplaceEntryWithId & {
|
|
142
|
+
scope: MarketplaceScope;
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Non-fatal warning surfaced by a marketplace operation.
|
|
146
|
+
* Examples: a collision between platform and project lock (platform wins),
|
|
147
|
+
* a project-scope config ignored because the field is platform-only, etc.
|
|
148
|
+
*/
|
|
149
|
+
interface MarketplaceDiagnostic {
|
|
150
|
+
code: string;
|
|
151
|
+
message: string;
|
|
152
|
+
packageId?: string;
|
|
153
|
+
scope?: MarketplaceScope;
|
|
154
|
+
}
|
|
102
155
|
interface MarketplaceServiceAPI {
|
|
103
156
|
/** List installed entries, optionally filtered by kind */
|
|
104
|
-
list(filter?: {
|
|
157
|
+
list(ctx: QueryScopeContext, filter?: {
|
|
105
158
|
kind?: EntityKind;
|
|
106
|
-
}): Promise<
|
|
159
|
+
}): Promise<ScopedMarketplaceEntry[]>;
|
|
107
160
|
/** Get a single entry by package ID */
|
|
108
|
-
getEntry(packageId: string): Promise<MarketplaceEntry | null>;
|
|
161
|
+
getEntry(ctx: ScopeContext, packageId: string): Promise<MarketplaceEntry | null>;
|
|
109
162
|
}
|
|
110
163
|
/**
|
|
111
164
|
* Strategy for handling a specific entity kind in the marketplace.
|
|
@@ -136,13 +189,16 @@ interface EntityKindStrategy {
|
|
|
136
189
|
/**
|
|
137
190
|
* Post-install hook. Called after the package is installed and written to lock.
|
|
138
191
|
* Example: adapter strategy validates that required adapter dependencies are installed.
|
|
192
|
+
*
|
|
193
|
+
* The `ctx` argument carries the scope of the triggering install/link so the
|
|
194
|
+
* strategy can query/modify the correct lock (e.g. via `service.list(ctx)`).
|
|
139
195
|
*/
|
|
140
|
-
afterInstall?(packageId: string, packageRoot: string, service: MarketplaceServiceAPI): Promise<void>;
|
|
196
|
+
afterInstall?(packageId: string, packageRoot: string, service: MarketplaceServiceAPI, ctx: ScopeContext): Promise<void>;
|
|
141
197
|
/**
|
|
142
198
|
* Pre-uninstall hook. Called before the package is removed.
|
|
143
199
|
* Example: adapter strategy checks if other adapters depend on this one.
|
|
144
200
|
*/
|
|
145
|
-
beforeUninstall?(packageId: string, service: MarketplaceServiceAPI): Promise<void>;
|
|
201
|
+
beforeUninstall?(packageId: string, service: MarketplaceServiceAPI, ctx: ScopeContext): Promise<void>;
|
|
146
202
|
}
|
|
147
203
|
/**
|
|
148
204
|
* Cached manifest entry. Stored in .kb/marketplace.manifests.json.
|
|
@@ -172,10 +228,23 @@ interface InstallResultEntry {
|
|
|
172
228
|
primaryKind: EntityKind;
|
|
173
229
|
provides: EntityKind[];
|
|
174
230
|
packageRoot: string;
|
|
231
|
+
/** Scope this entry was written to. */
|
|
232
|
+
scope: MarketplaceScope;
|
|
175
233
|
}
|
|
176
234
|
interface InstallResult {
|
|
177
235
|
installed: InstallResultEntry[];
|
|
178
236
|
warnings: string[];
|
|
237
|
+
/**
|
|
238
|
+
* Scope the install was executed in. Echoed back so callers (API, CLI)
|
|
239
|
+
* can render scope-aware output without tracking the request side.
|
|
240
|
+
*/
|
|
241
|
+
scope: MarketplaceScope;
|
|
242
|
+
/**
|
|
243
|
+
* Non-fatal diagnostics produced during the operation (e.g. collisions).
|
|
244
|
+
* Separate from `warnings` (which are free-form strings) so that downstream
|
|
245
|
+
* consumers can render them uniformly.
|
|
246
|
+
*/
|
|
247
|
+
diagnostics?: MarketplaceDiagnostic[];
|
|
179
248
|
}
|
|
180
249
|
interface SyncResult {
|
|
181
250
|
added: Array<{
|
|
@@ -201,4 +270,4 @@ interface DoctorReport {
|
|
|
201
270
|
issues: DoctorIssue[];
|
|
202
271
|
}
|
|
203
272
|
|
|
204
|
-
export type { DoctorIssue, DoctorReport, EntityKindStrategy, InstallResult, InstallResultEntry, InstalledPackage, ManifestCache, ManifestCacheEntry, MarketplaceEntryWithId, MarketplaceServiceAPI, PackageListing, PackageSource, PublishMetadata, PublishResult, ResolvedPackage, SyncResult };
|
|
273
|
+
export type { DoctorIssue, DoctorReport, EntityKindStrategy, InstallResult, InstallResultEntry, InstalledPackage, ManifestCache, ManifestCacheEntry, MarketplaceDiagnostic, MarketplaceEntryWithId, MarketplaceQueryScope, MarketplaceScope, MarketplaceServiceAPI, PackageListing, PackageSource, PublishMetadata, PublishResult, QueryScopeContext, ResolvedPackage, ScopeContext, ScopedMarketplaceEntry, SyncResult };
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
-
"@kb-labs/core-discovery": "2.
|
|
4
|
-
"@kb-labs/core-platform": "2.
|
|
5
|
-
"@kb-labs/plugin-contracts": "2.
|
|
3
|
+
"@kb-labs/core-discovery": "2.32.0",
|
|
4
|
+
"@kb-labs/core-platform": "2.32.0",
|
|
5
|
+
"@kb-labs/plugin-contracts": "2.32.0"
|
|
6
6
|
},
|
|
7
7
|
"description": "Shared types and interfaces for KB Labs marketplace",
|
|
8
8
|
"devDependencies": {
|
|
9
9
|
"tsup": "^8.5.0",
|
|
10
10
|
"typescript": "^5",
|
|
11
11
|
"vitest": "^3.2.4",
|
|
12
|
-
"@kb-labs/devkit": "2.
|
|
12
|
+
"@kb-labs/devkit": "2.32.0"
|
|
13
13
|
},
|
|
14
14
|
"engines": {
|
|
15
15
|
"node": ">=20.0.0",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"sideEffects": false,
|
|
32
32
|
"type": "module",
|
|
33
33
|
"types": "./dist/index.d.ts",
|
|
34
|
-
"version": "2.
|
|
34
|
+
"version": "2.32.0",
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "tsup",
|
|
37
37
|
"clean": "rimraf dist",
|