relay-dsh-plugin-manager 0.1.0-rc.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/CHANGELOG.md +17 -0
- package/LICENSE +21 -0
- package/README.md +105 -0
- package/SPEC.md +85 -0
- package/cordis.patch.yml +5 -0
- package/docs/acceptance/live-codex-2026-08-26.md +67 -0
- package/docs/acceptance/release-candidate-2026-08-26.md +51 -0
- package/docs/acceptance.md +81 -0
- package/docs/releasing.md +46 -0
- package/docs/technical-design.md +153 -0
- package/lib/errors-BGx4K2uq.js +18 -0
- package/lib/errors-BGx4K2uq.js.map +1 -0
- package/lib/index.d.ts +269 -0
- package/lib/index.js +1621 -0
- package/lib/index.js.map +1 -0
- package/lib/search-runtime-Be3SS1k2.d.ts +72 -0
- package/lib/search-runtime.d.ts +2 -0
- package/lib/search-runtime.js +30 -0
- package/lib/search-runtime.js.map +1 -0
- package/package.json +110 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-BGx4K2uq.js","names":[],"sources":["../src/errors.ts"],"sourcesContent":["export type PluginManagerErrorCode =\n | 'INVALID_SOURCE'\n | 'INVALID_NPM_SPEC'\n | 'INVALID_NPM_VERSION'\n | 'INVALID_GITHUB_SPEC'\n | 'INVALID_GITHUB_REF'\n | 'IMMUTABLE_SOURCE_REQUIRED'\n | 'NETWORK_ERROR'\n | 'SOURCE_HTTP_ERROR'\n | 'INVALID_SOURCE_METADATA'\n | 'INVALID_PLUGIN_MANIFEST'\n | 'NOT_DSH_PLUGIN'\n | 'PACKAGE_NAME_MISMATCH'\n | 'NPM_INTEGRITY_MISSING'\n | 'INVALID_SEARCH_QUERY'\n | 'INVALID_ACTION'\n | 'DUPLICATE_SEARCH_PROVIDER'\n | 'PROFILE_READ_FAILED'\n | 'PROFILE_WRITE_FAILED'\n | 'PLUGIN_NOT_INSTALLED'\n | 'PLUGIN_ALREADY_INSTALLED'\n | 'ENABLEMENT_UNSUPPORTED'\n | 'ENABLEMENT_CONFLICT'\n | 'PROTECTED_PLUGIN'\n | 'CONFIRMATION_REQUIRED'\n | 'CONFIRMATION_EXPIRED'\n | 'CONFIRMATION_REPLAYED'\n | 'PLAN_STALE'\n | 'OPERATION_BUSY'\n | 'OPERATION_NOT_FOUND'\n | 'DSH_COMMAND_FAILED'\n | 'POSTCONDITION_FAILED'\n | 'RESTART_UNAVAILABLE'\n\nexport class PluginManagerError extends Error {\n readonly code: PluginManagerErrorCode\n readonly details?: Record<string, unknown>\n\n constructor(code: PluginManagerErrorCode, message: string, details?: Record<string, unknown>) {\n super(message)\n this.name = 'PluginManagerError'\n this.code = code\n this.details = details\n }\n}\n\nexport function fail(\n code: PluginManagerErrorCode,\n message: string,\n details?: Record<string, unknown>,\n): never {\n throw new PluginManagerError(code, message, details)\n}\n"],"mappings":";AAkCA,IAAa,qBAAb,cAAwC,MAAM;CAC5C;CACA;CAEA,YAAY,MAA8B,SAAiB,SAAmC;EAC5F,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,OAAO;EACZ,KAAK,UAAU;CACjB;AACF;AAEA,SAAgB,KACd,MACA,SACA,SACO;CACP,MAAM,IAAI,mBAAmB,MAAM,SAAS,OAAO;AACrD"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { a as FetchOptions, c as inspectPluginSource, i as PluginSearchRuntime, n as PluginSearchProvider, o as PluginInspection, r as PluginSearchRequest, s as PluginSource, t as PluginSearchCandidate } from "./search-runtime-Be3SS1k2.js";
|
|
2
|
+
import { spawn } from "node:child_process";
|
|
3
|
+
import { Context } from "@deepseek-ai/cordis";
|
|
4
|
+
|
|
5
|
+
//#region src/profile.d.ts
|
|
6
|
+
interface PackageSurface {
|
|
7
|
+
packageName: string;
|
|
8
|
+
source: string;
|
|
9
|
+
bundle: boolean;
|
|
10
|
+
bundlePatch: string | null;
|
|
11
|
+
client: boolean;
|
|
12
|
+
entryIds: string[] | null;
|
|
13
|
+
}
|
|
14
|
+
interface PluginStatus {
|
|
15
|
+
packageName: string;
|
|
16
|
+
source: string;
|
|
17
|
+
bundle: boolean;
|
|
18
|
+
enablement: 'enabled' | 'disabled' | 'mixed' | 'unknown';
|
|
19
|
+
runtime: 'active' | 'inactive' | 'failed' | 'loading' | 'unknown';
|
|
20
|
+
restartRequired: boolean;
|
|
21
|
+
entryIds: string[] | null;
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/plans.d.ts
|
|
25
|
+
type MutationAction = 'install' | 'remove' | 'update' | 'enable' | 'disable' | 'restart';
|
|
26
|
+
interface PlanInput {
|
|
27
|
+
action: MutationAction;
|
|
28
|
+
profile: 'web';
|
|
29
|
+
packageName?: string;
|
|
30
|
+
installSpec?: string;
|
|
31
|
+
currentSource?: string;
|
|
32
|
+
impact: string;
|
|
33
|
+
restartExpected: boolean;
|
|
34
|
+
}
|
|
35
|
+
interface ConfirmationPlan extends PlanInput {
|
|
36
|
+
id: string;
|
|
37
|
+
digest: string;
|
|
38
|
+
confirmationToken: string;
|
|
39
|
+
createdAt: string;
|
|
40
|
+
expiresAt: string;
|
|
41
|
+
}
|
|
42
|
+
interface PlanStoreOptions {
|
|
43
|
+
now?: () => number;
|
|
44
|
+
random?: () => string;
|
|
45
|
+
ttlMs?: number;
|
|
46
|
+
}
|
|
47
|
+
declare class PlanStore {
|
|
48
|
+
private readonly plans;
|
|
49
|
+
private readonly used;
|
|
50
|
+
private readonly now;
|
|
51
|
+
private readonly random;
|
|
52
|
+
private readonly ttlMs;
|
|
53
|
+
constructor(options?: PlanStoreOptions);
|
|
54
|
+
create(input: PlanInput): ConfirmationPlan;
|
|
55
|
+
consume(token: string): ConfirmationPlan;
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/operations.d.ts
|
|
59
|
+
type OperationStatus = 'queued' | 'running' | 'succeeded' | 'failed' | 'cancelled';
|
|
60
|
+
interface OperationSnapshot<T = unknown> {
|
|
61
|
+
id: string;
|
|
62
|
+
action: MutationAction;
|
|
63
|
+
target: string;
|
|
64
|
+
status: OperationStatus;
|
|
65
|
+
progress: string;
|
|
66
|
+
startedAt: string;
|
|
67
|
+
finishedAt?: string;
|
|
68
|
+
result?: T;
|
|
69
|
+
error?: {
|
|
70
|
+
code?: string;
|
|
71
|
+
message: string;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
interface OperationContext {
|
|
75
|
+
signal: AbortSignal;
|
|
76
|
+
progress(message: string): void;
|
|
77
|
+
}
|
|
78
|
+
declare class OperationTracker {
|
|
79
|
+
private readonly records;
|
|
80
|
+
private active;
|
|
81
|
+
private readonly random;
|
|
82
|
+
private readonly now;
|
|
83
|
+
constructor(options?: {
|
|
84
|
+
random?: () => string;
|
|
85
|
+
now?: () => number;
|
|
86
|
+
});
|
|
87
|
+
start<T>(action: MutationAction, target: string, execute: (context: OperationContext) => Promise<T>): OperationSnapshot<T>;
|
|
88
|
+
get(id: string): OperationSnapshot;
|
|
89
|
+
cancel(id: string): OperationSnapshot;
|
|
90
|
+
wait(id: string): Promise<OperationSnapshot>;
|
|
91
|
+
}
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region src/runner.d.ts
|
|
94
|
+
interface RunnerResult {
|
|
95
|
+
exitCode: number;
|
|
96
|
+
signal: NodeJS.Signals | null;
|
|
97
|
+
stdout: string;
|
|
98
|
+
stderr: string;
|
|
99
|
+
cancelled: boolean;
|
|
100
|
+
timedOut: boolean;
|
|
101
|
+
}
|
|
102
|
+
interface RunnerOptions {
|
|
103
|
+
env?: NodeJS.ProcessEnv;
|
|
104
|
+
argv?: string[];
|
|
105
|
+
execPath?: string;
|
|
106
|
+
cwd?: string;
|
|
107
|
+
platform?: NodeJS.Platform;
|
|
108
|
+
spawn?: typeof spawn;
|
|
109
|
+
timeoutMs?: number;
|
|
110
|
+
maxOutputBytes?: number;
|
|
111
|
+
}
|
|
112
|
+
declare class DshCliRunner {
|
|
113
|
+
private readonly options;
|
|
114
|
+
constructor(options?: RunnerOptions);
|
|
115
|
+
runPlugin(profile: string, args: readonly string[], signal: AbortSignal, progress?: (message: string) => void): Promise<RunnerResult>;
|
|
116
|
+
}
|
|
117
|
+
//#endregion
|
|
118
|
+
//#region src/hot-runtime.d.ts
|
|
119
|
+
interface HotActivationResult {
|
|
120
|
+
active: boolean;
|
|
121
|
+
restartRequired: boolean;
|
|
122
|
+
reason: string | null;
|
|
123
|
+
}
|
|
124
|
+
interface PluginHandle {
|
|
125
|
+
await(): Promise<unknown>;
|
|
126
|
+
dispose(): Promise<unknown> | void;
|
|
127
|
+
}
|
|
128
|
+
interface HotContext {
|
|
129
|
+
plugin(plugin: unknown, config: unknown): PluginHandle;
|
|
130
|
+
logger?: {
|
|
131
|
+
info?(message: string): void;
|
|
132
|
+
warn?(message: string): void;
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
declare class HotRuntime {
|
|
136
|
+
private readonly handles;
|
|
137
|
+
private sequence;
|
|
138
|
+
private includeClass;
|
|
139
|
+
private readonly ctx;
|
|
140
|
+
private readonly profileDir;
|
|
141
|
+
private readonly timeoutMs;
|
|
142
|
+
private readonly loadInclude?;
|
|
143
|
+
constructor(ctx: HotContext, profileDir: string, timeoutMs?: number, loadInclude?: () => Promise<unknown | null>);
|
|
144
|
+
private hotDir;
|
|
145
|
+
clean(): void;
|
|
146
|
+
private include;
|
|
147
|
+
activate(surface: PackageSurface): Promise<HotActivationResult>;
|
|
148
|
+
deactivate(packageName: string): Promise<boolean>;
|
|
149
|
+
isActive(packageName: string): boolean;
|
|
150
|
+
}
|
|
151
|
+
//#endregion
|
|
152
|
+
//#region src/restart.d.ts
|
|
153
|
+
interface RestarterOptions {
|
|
154
|
+
allowRestart?: boolean;
|
|
155
|
+
env?: NodeJS.ProcessEnv;
|
|
156
|
+
argv?: string[];
|
|
157
|
+
execPath?: string;
|
|
158
|
+
cwd?: string;
|
|
159
|
+
ppid?: number;
|
|
160
|
+
spawn?: typeof spawn;
|
|
161
|
+
terminate?: () => void;
|
|
162
|
+
}
|
|
163
|
+
declare class DshRestarter {
|
|
164
|
+
private readonly options;
|
|
165
|
+
constructor(options?: RestarterOptions);
|
|
166
|
+
available(): boolean;
|
|
167
|
+
schedule(): {
|
|
168
|
+
helperPid: number | undefined;
|
|
169
|
+
logFile: string;
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
//#endregion
|
|
173
|
+
//#region src/manager.d.ts
|
|
174
|
+
interface LoaderEntryLike {
|
|
175
|
+
id?: string;
|
|
176
|
+
disabled?: boolean;
|
|
177
|
+
options?: {
|
|
178
|
+
id?: string;
|
|
179
|
+
name?: string;
|
|
180
|
+
};
|
|
181
|
+
fiber?: {
|
|
182
|
+
state?: number | string;
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
interface LoaderLike {
|
|
186
|
+
entries(): Iterable<LoaderEntryLike>;
|
|
187
|
+
}
|
|
188
|
+
interface PluginManagerDependencies {
|
|
189
|
+
profileDir: string;
|
|
190
|
+
searchRuntime: Pick<PluginSearchRuntime, 'entries'>;
|
|
191
|
+
runner: Pick<DshCliRunner, 'runPlugin'>;
|
|
192
|
+
hot: Pick<HotRuntime, 'activate' | 'deactivate' | 'isActive'>;
|
|
193
|
+
restarter: Pick<DshRestarter, 'available' | 'schedule'>;
|
|
194
|
+
loader?: LoaderLike;
|
|
195
|
+
inspect?: typeof inspectPluginSource;
|
|
196
|
+
plans?: PlanStore;
|
|
197
|
+
operations?: OperationTracker;
|
|
198
|
+
fetchOptions?: Omit<FetchOptions, 'signal'>;
|
|
199
|
+
hmrTimeoutMs?: number;
|
|
200
|
+
}
|
|
201
|
+
interface DiscoverRequest {
|
|
202
|
+
action: 'list' | 'search' | 'inspect' | 'status';
|
|
203
|
+
query?: string;
|
|
204
|
+
target?: string;
|
|
205
|
+
operationId?: string;
|
|
206
|
+
maxResults?: number;
|
|
207
|
+
}
|
|
208
|
+
interface PlanRequest {
|
|
209
|
+
operation: MutationAction;
|
|
210
|
+
target?: string;
|
|
211
|
+
source?: string;
|
|
212
|
+
}
|
|
213
|
+
interface MutationResult {
|
|
214
|
+
action: MutationAction;
|
|
215
|
+
packageName?: string;
|
|
216
|
+
installSpec?: string;
|
|
217
|
+
changed: boolean;
|
|
218
|
+
activated?: boolean;
|
|
219
|
+
restartRequired: boolean;
|
|
220
|
+
reason?: string;
|
|
221
|
+
command?: {
|
|
222
|
+
exitCode: number;
|
|
223
|
+
stdout: string;
|
|
224
|
+
stderr: string;
|
|
225
|
+
};
|
|
226
|
+
restart?: {
|
|
227
|
+
helperPid: number | undefined;
|
|
228
|
+
logFile: string;
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
declare class PluginManager {
|
|
232
|
+
private readonly profileDir;
|
|
233
|
+
private readonly searchRuntime;
|
|
234
|
+
private readonly runner;
|
|
235
|
+
private readonly hot;
|
|
236
|
+
private readonly restarter;
|
|
237
|
+
private readonly loader?;
|
|
238
|
+
private readonly inspect;
|
|
239
|
+
private readonly plans;
|
|
240
|
+
private readonly operations;
|
|
241
|
+
private readonly fetchOptions;
|
|
242
|
+
private readonly hmrTimeoutMs;
|
|
243
|
+
constructor(dependencies: PluginManagerDependencies);
|
|
244
|
+
private loaderEntries;
|
|
245
|
+
list(): PluginStatus[];
|
|
246
|
+
discover(request: DiscoverRequest, signal?: AbortSignal): Promise<unknown>;
|
|
247
|
+
private installed;
|
|
248
|
+
private assertEnablementAllowed;
|
|
249
|
+
private updateInspection;
|
|
250
|
+
plan(request: PlanRequest, signal?: AbortSignal): Promise<ConfirmationPlan>;
|
|
251
|
+
execute(confirmationToken: string): OperationSnapshot;
|
|
252
|
+
operation(id: string): OperationSnapshot;
|
|
253
|
+
cancel(id: string): OperationSnapshot;
|
|
254
|
+
wait(id: string): Promise<OperationSnapshot>;
|
|
255
|
+
private installOrUpdate;
|
|
256
|
+
private remove;
|
|
257
|
+
private toggle;
|
|
258
|
+
}
|
|
259
|
+
//#endregion
|
|
260
|
+
//#region src/index.d.ts
|
|
261
|
+
declare const name = "relay-dsh-plugin-manager";
|
|
262
|
+
declare const inject: string[];
|
|
263
|
+
interface Config {
|
|
264
|
+
allowRestart?: boolean;
|
|
265
|
+
}
|
|
266
|
+
declare function apply(ctx: Context, config?: Config): void;
|
|
267
|
+
//#endregion
|
|
268
|
+
export { Config, type DiscoverRequest, type MutationResult, type PlanRequest, type PluginInspection, PluginManager, type PluginSearchCandidate, type PluginSearchProvider, type PluginSearchRequest, type PluginSource, apply, inject, name };
|
|
269
|
+
//# sourceMappingURL=index.d.ts.map
|