@huaqiu/hardware-artifacts 0.7.18 → 0.7.20
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/lib/index.d.mts +61 -8
- package/lib/index.mjs +2610 -6
- package/lib/routes-D78ML_ef.d.mts +438 -0
- package/lib/routes.d.mts +2 -18
- package/lib/routes.mjs +156 -41
- package/lib/{service-CtVn7z8b.d.mts → service-BGecln85.d.mts} +119 -28
- package/lib/{service-Yrc2C_eo.mjs → service-Bo58tzXv.mjs} +570 -167
- package/lib/service.d.mts +1 -1
- package/lib/service.mjs +1 -1
- package/package.json +2 -1
- package/src/index.ts +124 -5
- package/src/order.ts +22 -0
- package/src/package.ts +282 -0
- package/src/routes.ts +127 -48
- package/src/service.ts +1635 -1651
- package/src/toolchain/dialog.ts +240 -0
- package/src/toolchain/discovery.ts +266 -0
- package/src/toolchain/index.ts +36 -0
- package/src/toolchain/install.ts +430 -0
- package/src/toolchain/lzma.ts +384 -0
- package/src/toolchain/manager.ts +596 -0
- package/src/toolchain/manifest.ts +234 -0
- package/src/toolchain/resolve.ts +325 -0
- package/src/toolchain/zip.ts +495 -0
- package/src/tools.ts +470 -0
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
import { l as HardwareArtifactService } from "./service-BGecln85.mjs";
|
|
2
|
+
import { IncomingMessage, ServerResponse } from "node:http";
|
|
3
|
+
//#region src/toolchain/dialog.d.ts
|
|
4
|
+
/** One file-type filter row. */
|
|
5
|
+
interface FileFilter {
|
|
6
|
+
readonly name: string;
|
|
7
|
+
/** Glob patterns, e.g. `['kicad-cli.exe']`. */
|
|
8
|
+
readonly patterns: readonly string[];
|
|
9
|
+
}
|
|
10
|
+
/** What to ask the operator for. */
|
|
11
|
+
interface PickFileRequest {
|
|
12
|
+
readonly title: string;
|
|
13
|
+
readonly filters?: readonly FileFilter[];
|
|
14
|
+
readonly initialDirectory?: string;
|
|
15
|
+
}
|
|
16
|
+
/** How the chooser ended. */
|
|
17
|
+
type PickFileResult = {
|
|
18
|
+
readonly kind: 'picked';
|
|
19
|
+
readonly path: string;
|
|
20
|
+
readonly mechanism: string;
|
|
21
|
+
} | {
|
|
22
|
+
readonly kind: 'cancelled';
|
|
23
|
+
readonly mechanism: string;
|
|
24
|
+
} | {
|
|
25
|
+
readonly kind: 'unsupported';
|
|
26
|
+
readonly message: string;
|
|
27
|
+
};
|
|
28
|
+
/** Injectable command runner so every platform branch is testable. */
|
|
29
|
+
type DialogRunner = (command: string, args: readonly string[], options: {
|
|
30
|
+
readonly timeoutMs: number;
|
|
31
|
+
readonly signal?: AbortSignal;
|
|
32
|
+
}) => Promise<{
|
|
33
|
+
readonly stdout: string;
|
|
34
|
+
readonly stderr: string;
|
|
35
|
+
readonly exitCode: number | null;
|
|
36
|
+
}>;
|
|
37
|
+
/**
|
|
38
|
+
* Show the platform's file chooser and wait for the operator.
|
|
39
|
+
* @param request - title, filters and starting directory.
|
|
40
|
+
* @param internals - platform/runner/timeout injection.
|
|
41
|
+
* @returns the picked path, a cancellation, or an unsupported-platform notice.
|
|
42
|
+
*/
|
|
43
|
+
declare function pickFile(request: PickFileRequest, internals?: {
|
|
44
|
+
readonly platform?: NodeJS.Platform;
|
|
45
|
+
readonly run?: DialogRunner;
|
|
46
|
+
readonly timeoutMs?: number;
|
|
47
|
+
readonly signal?: AbortSignal;
|
|
48
|
+
}): Promise<PickFileResult>;
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/toolchain/resolve.d.ts
|
|
51
|
+
/** The two tools this product configures. */
|
|
52
|
+
type ToolchainId = 'kicad' | 'solidcraft';
|
|
53
|
+
/** How a configured path was obtained; persisted for display only. */
|
|
54
|
+
type ToolchainSource = 'manual' | 'browse' | 'download' | 'detected';
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/toolchain/discovery.d.ts
|
|
57
|
+
/** Where one candidate came from; used for display and for the tie-break. */
|
|
58
|
+
type CandidateOrigin = 'managed' | 'system' | 'user-local';
|
|
59
|
+
/** One installation directory discovery looked at. */
|
|
60
|
+
interface DiscoveryCandidate {
|
|
61
|
+
/** Installation root that was checked. */
|
|
62
|
+
readonly path: string;
|
|
63
|
+
readonly origin: CandidateOrigin;
|
|
64
|
+
/** True only when the executable exists and answered a version probe. */
|
|
65
|
+
readonly valid: boolean;
|
|
66
|
+
readonly version?: string;
|
|
67
|
+
/** Normalised CLI the candidate resolved to, when it produced one. */
|
|
68
|
+
readonly cli?: string;
|
|
69
|
+
readonly error?: string;
|
|
70
|
+
}
|
|
71
|
+
/** Discovery state for one tool, as the UI shows it. */
|
|
72
|
+
interface ToolDiscovery {
|
|
73
|
+
readonly tool: ToolchainId;
|
|
74
|
+
readonly state: 'idle' | 'running' | 'done' | 'failed';
|
|
75
|
+
readonly candidates: readonly DiscoveryCandidate[];
|
|
76
|
+
/** The candidate discovery would configure, by the documented policy. */
|
|
77
|
+
readonly selected?: DiscoveryCandidate;
|
|
78
|
+
readonly error?: string;
|
|
79
|
+
readonly finishedAt?: number;
|
|
80
|
+
}
|
|
81
|
+
/** Filesystem/probe injection so discovery is testable without a machine. */
|
|
82
|
+
interface DiscoveryInternals {
|
|
83
|
+
readonly readdir?: (path: string) => readonly string[];
|
|
84
|
+
readonly exists?: (path: string) => boolean;
|
|
85
|
+
readonly probeVersion?: (executable: string, tool: ToolchainId) => string | undefined;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Probe one directory the user named or a dialog returned.
|
|
89
|
+
* @param tool - which toolchain.
|
|
90
|
+
* @param root - installation root to probe.
|
|
91
|
+
* @param internals - probe injection.
|
|
92
|
+
* @returns validity with the reason, for the "Validate and save" error path.
|
|
93
|
+
*/
|
|
94
|
+
declare function probeInstallation(tool: ToolchainId, root: string, internals?: DiscoveryInternals): {
|
|
95
|
+
ok: boolean;
|
|
96
|
+
version?: string;
|
|
97
|
+
error?: string;
|
|
98
|
+
cli?: string;
|
|
99
|
+
app?: string;
|
|
100
|
+
};
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/toolchain/manifest.d.ts
|
|
103
|
+
/** One downloadable distribution. */
|
|
104
|
+
interface ManifestEntry {
|
|
105
|
+
/** Distributor version string, e.g. `10.0.7-2`. */
|
|
106
|
+
readonly version: string;
|
|
107
|
+
/** Lower-case hex SHA-256 of the archive the URL serves. */
|
|
108
|
+
readonly sha256: string;
|
|
109
|
+
/** Platform the archive targets (`win` | `darwin` | `linux`). */
|
|
110
|
+
readonly platform: string;
|
|
111
|
+
/** Architecture the archive targets (`x64` | `arm64`). */
|
|
112
|
+
readonly arch: string;
|
|
113
|
+
/** HTTPS URL of the archive. */
|
|
114
|
+
readonly url: string;
|
|
115
|
+
}
|
|
116
|
+
/** A manifest that passed validation, with the per-tool selections. */
|
|
117
|
+
interface ToolchainManifest {
|
|
118
|
+
readonly schemaVersion: number;
|
|
119
|
+
/** Every validated entry, per tool, in manifest order. */
|
|
120
|
+
readonly entries: Readonly<Record<ToolchainId, readonly ManifestEntry[]>>;
|
|
121
|
+
/** The entry this host may install, per tool (absent when none matches). */
|
|
122
|
+
readonly selected: Readonly<Partial<Record<ToolchainId, ManifestEntry>>>;
|
|
123
|
+
/** Platform/architecture the selection was made for. */
|
|
124
|
+
readonly target: {
|
|
125
|
+
readonly platform: string;
|
|
126
|
+
readonly arch: string;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/** Why the manifest could not be used. */
|
|
130
|
+
type ManifestFailureCode = 'network' | 'http' | 'invalid-json' | 'unsupported-schema' | 'invalid-entry' | 'unsupported-platform' | 'no-entry';
|
|
131
|
+
/** A manifest this host cannot install from, with an operator-facing reason. */
|
|
132
|
+
interface ManifestFailure {
|
|
133
|
+
readonly ok: false;
|
|
134
|
+
readonly code: ManifestFailureCode;
|
|
135
|
+
readonly message: string;
|
|
136
|
+
}
|
|
137
|
+
/** A manifest this host may install from. */
|
|
138
|
+
interface ManifestSuccess {
|
|
139
|
+
readonly ok: true;
|
|
140
|
+
readonly manifest: ToolchainManifest;
|
|
141
|
+
}
|
|
142
|
+
/** Outcome of reading the manifest. */
|
|
143
|
+
type ManifestResult = ManifestSuccess | ManifestFailure;
|
|
144
|
+
/** Injectable HTTP so the manifest reader is testable without a network. */
|
|
145
|
+
interface ManifestFetchOptions {
|
|
146
|
+
readonly url?: string;
|
|
147
|
+
readonly fetchImpl?: typeof fetch;
|
|
148
|
+
readonly signal?: AbortSignal;
|
|
149
|
+
readonly timeoutMs?: number;
|
|
150
|
+
readonly platform?: NodeJS.Platform;
|
|
151
|
+
readonly arch?: string;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Fetch and validate the manifest.
|
|
155
|
+
*
|
|
156
|
+
* A network or HTTP failure is a *download-unavailable* state, not a setup
|
|
157
|
+
* error: manual configuration and browsing stay available (§14.2), so the
|
|
158
|
+
* failure is reported as data rather than thrown.
|
|
159
|
+
* @param options - URL/transport/timeout and the target platform.
|
|
160
|
+
* @returns the validated manifest or the reason it is unavailable.
|
|
161
|
+
*/
|
|
162
|
+
declare function fetchManifest(options?: ManifestFetchOptions): Promise<ManifestResult>;
|
|
163
|
+
//#endregion
|
|
164
|
+
//#region src/toolchain/install.d.ts
|
|
165
|
+
/** Stage a job is in; the first five are transient, the last three terminal. */
|
|
166
|
+
type InstallPhase = 'download' | 'verify' | 'extract' | 'layout' | 'promote' | 'done' | 'failed' | 'cancelled';
|
|
167
|
+
/** A stable error vocabulary for the UI, independent of Node's error text. */
|
|
168
|
+
type InstallErrorCode = 'http' | 'network' | 'checksum-mismatch' | 'invalid-zip' | 'unsafe-entry' | 'archive-too-large' | 'unsupported-compression' | 'unsupported-zip64' | 'duplicate-entry' | 'layout' | 'validation' | 'disk' | 'cancelled' | 'internal';
|
|
169
|
+
/** One job's observable state, as the UI polls it. */
|
|
170
|
+
interface InstallJobSnapshot {
|
|
171
|
+
readonly id: string;
|
|
172
|
+
readonly tool: ToolchainId;
|
|
173
|
+
readonly version: string;
|
|
174
|
+
readonly phase: InstallPhase;
|
|
175
|
+
/** Bytes received so far (download), or written so far (extract). */
|
|
176
|
+
readonly received: number;
|
|
177
|
+
/** Total bytes when the server or the archive declared a reliable one. */
|
|
178
|
+
readonly total?: number;
|
|
179
|
+
/** Whole-percent progress, present only when `total` is known. */
|
|
180
|
+
readonly percent?: number;
|
|
181
|
+
/** Operator-facing line for the current stage. */
|
|
182
|
+
readonly message: string;
|
|
183
|
+
readonly errorCode?: InstallErrorCode;
|
|
184
|
+
readonly error?: string;
|
|
185
|
+
/** Installation root the job registered, on success only. */
|
|
186
|
+
readonly installPath?: string;
|
|
187
|
+
readonly startedAt: number;
|
|
188
|
+
readonly finishedAt?: number;
|
|
189
|
+
}
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region src/toolchain/manager.d.ts
|
|
192
|
+
/** Persisted configuration the manager reads; every field is user-owned. */
|
|
193
|
+
interface ToolchainSettings {
|
|
194
|
+
readonly kicadRoot?: string;
|
|
195
|
+
readonly solidcraftRoot?: string;
|
|
196
|
+
readonly kicadVersion?: string;
|
|
197
|
+
readonly kicadSource?: string;
|
|
198
|
+
readonly kicadValidatedAt?: number;
|
|
199
|
+
readonly solidcraftVersion?: string;
|
|
200
|
+
readonly solidcraftSource?: string;
|
|
201
|
+
readonly solidcraftValidatedAt?: number;
|
|
202
|
+
}
|
|
203
|
+
/** The patch written back after a successful install or an in-app validation. */
|
|
204
|
+
type ToolchainConfigPatch = Partial<Record<'kicadRoot' | 'solidcraftRoot' | 'kicadVersion' | 'kicadSource' | 'kicadValidatedAt' | 'solidcraftVersion' | 'solidcraftSource' | 'solidcraftValidatedAt', string | number>>;
|
|
205
|
+
/** One tool's status, as the UI renders it. */
|
|
206
|
+
interface ToolStatus {
|
|
207
|
+
readonly tool: ToolchainId;
|
|
208
|
+
/** `validating` covers the window before the first probe answers. */
|
|
209
|
+
readonly state: 'unconfigured' | 'validating' | 'configured' | 'invalid';
|
|
210
|
+
readonly installPath?: string;
|
|
211
|
+
readonly cliPath?: string;
|
|
212
|
+
readonly appPath?: string;
|
|
213
|
+
readonly version?: string;
|
|
214
|
+
readonly source?: ToolchainSource;
|
|
215
|
+
readonly validatedAt?: number;
|
|
216
|
+
readonly error?: string;
|
|
217
|
+
readonly discovery: ToolDiscovery;
|
|
218
|
+
/** Manifest entry this host could install, when one is available. */
|
|
219
|
+
readonly download?: {
|
|
220
|
+
readonly version: string;
|
|
221
|
+
readonly url: string;
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
/** Everything the settings/wizard surface needs, in one poll. */
|
|
225
|
+
interface ToolchainStatus {
|
|
226
|
+
readonly kicad: ToolStatus;
|
|
227
|
+
readonly solidcraft: ToolStatus;
|
|
228
|
+
readonly manifest: {
|
|
229
|
+
readonly state: 'unknown' | 'loading';
|
|
230
|
+
} | {
|
|
231
|
+
readonly state: 'ready';
|
|
232
|
+
readonly schemaVersion: number;
|
|
233
|
+
readonly url: string;
|
|
234
|
+
} | {
|
|
235
|
+
readonly state: 'unavailable';
|
|
236
|
+
readonly code: string;
|
|
237
|
+
readonly message: string;
|
|
238
|
+
};
|
|
239
|
+
/** Platform/architecture the download flow targets (§7.3). */
|
|
240
|
+
readonly target: {
|
|
241
|
+
readonly platform: string;
|
|
242
|
+
readonly arch: string;
|
|
243
|
+
readonly downloadsSupported: boolean;
|
|
244
|
+
};
|
|
245
|
+
/** Official pages offered when the download flow cannot be used (§9.3). */
|
|
246
|
+
readonly official: Readonly<Record<ToolchainId, string>>;
|
|
247
|
+
/** The running or last finished jobs the caller asked about — one per tool. */
|
|
248
|
+
readonly jobs?: readonly InstallJobSnapshot[];
|
|
249
|
+
/** First of `jobs`, kept for callers that still ask about a single run. */
|
|
250
|
+
readonly job?: InstallJobSnapshot;
|
|
251
|
+
}
|
|
252
|
+
/** Result of "validate and save" for one path. */
|
|
253
|
+
interface ValidationOutcome {
|
|
254
|
+
readonly ok: boolean;
|
|
255
|
+
readonly installPath?: string;
|
|
256
|
+
readonly cliPath?: string;
|
|
257
|
+
readonly appPath?: string;
|
|
258
|
+
readonly version?: string;
|
|
259
|
+
readonly error?: string;
|
|
260
|
+
}
|
|
261
|
+
/** Result of a native browse request. */
|
|
262
|
+
interface BrowseOutcome {
|
|
263
|
+
readonly kind: 'picked' | 'cancelled' | 'unsupported';
|
|
264
|
+
readonly path?: string;
|
|
265
|
+
/** Which chooser answered: the plugin's file dialog or DSH's own seam. */
|
|
266
|
+
readonly mechanism?: string;
|
|
267
|
+
readonly message?: string;
|
|
268
|
+
}
|
|
269
|
+
/** Injectable boundaries of the capability. */
|
|
270
|
+
interface ToolchainManagerOptions {
|
|
271
|
+
/** Live read of the persisted configuration. */
|
|
272
|
+
readonly settings: () => ToolchainSettings;
|
|
273
|
+
/** Persist a patch through the Host's own settings service. */
|
|
274
|
+
readonly persist?: (patch: ToolchainConfigPatch) => Promise<boolean>;
|
|
275
|
+
/** Per-user toolchain root (`<DSH home>/toolchains`). */
|
|
276
|
+
readonly managedRoot?: string;
|
|
277
|
+
readonly home?: string;
|
|
278
|
+
readonly platform?: NodeJS.Platform;
|
|
279
|
+
readonly arch?: string;
|
|
280
|
+
readonly env?: Readonly<Record<string, string | undefined>>;
|
|
281
|
+
readonly fetchImpl?: typeof fetch;
|
|
282
|
+
readonly manifestUrl?: string;
|
|
283
|
+
/** Version probe for one executable, answering the tool's raw report. */
|
|
284
|
+
readonly versionProbe?: (executable: string, tool: ToolchainId) => Promise<string | undefined>;
|
|
285
|
+
/** DSH's own native directory chooser, used when the file dialog is unavailable. */
|
|
286
|
+
readonly pickFolder?: (title: string) => Promise<string | null>;
|
|
287
|
+
/** Plugin-level native file dialog (overridable for tests). */
|
|
288
|
+
readonly pickFile?: (request: Parameters<typeof pickFile>[0], internals: {
|
|
289
|
+
signal?: AbortSignal;
|
|
290
|
+
}) => Promise<PickFileResult>;
|
|
291
|
+
readonly discoveryInternals?: DiscoveryInternals;
|
|
292
|
+
readonly now?: () => number;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Discovery is asynchronous by construction: `state: 'running'` is answered
|
|
296
|
+
* immediately, and the verdicts arrive through {@link ToolchainManager.status}.
|
|
297
|
+
*/
|
|
298
|
+
declare class ToolchainManager {
|
|
299
|
+
private readonly options;
|
|
300
|
+
private readonly installer;
|
|
301
|
+
private readonly managedRoot;
|
|
302
|
+
private readonly platform;
|
|
303
|
+
private readonly arch;
|
|
304
|
+
private readonly env;
|
|
305
|
+
private readonly home;
|
|
306
|
+
private readonly now;
|
|
307
|
+
private readonly probeCache;
|
|
308
|
+
private readonly discovery;
|
|
309
|
+
private readonly discovering;
|
|
310
|
+
private manifestCache?;
|
|
311
|
+
private manifestPending?;
|
|
312
|
+
constructor(options: ToolchainManagerOptions);
|
|
313
|
+
/** The per-user root this capability installs into, for diagnostics. */
|
|
314
|
+
get toolchainRoot(): string;
|
|
315
|
+
/** Probe one executable, memoised briefly; an install invalidates it. */
|
|
316
|
+
private versionOf;
|
|
317
|
+
/** Resolve one configured path into its executables and validated state. */
|
|
318
|
+
private resolve;
|
|
319
|
+
/** The persisted path for one tool, as the settings service holds it. */
|
|
320
|
+
private roots;
|
|
321
|
+
/** Status of one tool, from its configured path. */
|
|
322
|
+
private toolStatus;
|
|
323
|
+
/**
|
|
324
|
+
* Full status for the settings/wizard surfaces.
|
|
325
|
+
* @param jobIds - optional jobs whose progress the caller wants included. Both
|
|
326
|
+
* tools can be downloading at once, so this is a list: asking for one id at a
|
|
327
|
+
* time is exactly how the second download used to erase the first one's bar.
|
|
328
|
+
* @returns both tools plus the manifest and target facts.
|
|
329
|
+
*/
|
|
330
|
+
status(jobIds?: readonly string[]): Promise<ToolchainStatus>;
|
|
331
|
+
/** Manifest projection for the status poll. */
|
|
332
|
+
private manifestState;
|
|
333
|
+
private manifestProjection;
|
|
334
|
+
/** Fetch the manifest once; concurrent callers share one request. */
|
|
335
|
+
loadManifest(force?: boolean): Promise<Awaited<ReturnType<typeof fetchManifest>>> | undefined;
|
|
336
|
+
/** The validated manifest entry for one tool, when the manifest answered. */
|
|
337
|
+
private selectedEntry;
|
|
338
|
+
/** Validated manifest for the installer; a refusal keeps manual paths usable. */
|
|
339
|
+
manifest(): Promise<{
|
|
340
|
+
readonly ok: true;
|
|
341
|
+
readonly manifest: ToolchainManifest;
|
|
342
|
+
} | ManifestFailure>;
|
|
343
|
+
/**
|
|
344
|
+
* Validate one user-supplied path without persisting anything (§6.3).
|
|
345
|
+
* @param tool - which toolchain.
|
|
346
|
+
* @param input - installation root, `bin` directory or executable path.
|
|
347
|
+
* @returns resolution verdict with the normalised root to persist on success.
|
|
348
|
+
*/
|
|
349
|
+
validate(tool: ToolchainId, input: string): Promise<ValidationOutcome>;
|
|
350
|
+
/** Persist a validated configuration; the host settings service stays authoritative. */
|
|
351
|
+
save(tool: ToolchainId, input: string, source: ToolchainSource): Promise<ValidationOutcome>;
|
|
352
|
+
/**
|
|
353
|
+
* Start background discovery for one tool (or both).
|
|
354
|
+
*
|
|
355
|
+
* Returns the current discovery state immediately: the run continues off-request
|
|
356
|
+
* and the UI polls {@link ToolchainManager.status} (§4.2/§5.5).
|
|
357
|
+
* @param tool - tool to discover; both when omitted.
|
|
358
|
+
* @returns the discovery state at the moment the request was answered.
|
|
359
|
+
*/
|
|
360
|
+
startDiscovery(tool?: ToolchainId): {
|
|
361
|
+
kicad: ToolDiscovery;
|
|
362
|
+
solidcraft: ToolDiscovery;
|
|
363
|
+
};
|
|
364
|
+
/** One bounded discovery run; a failure is recorded, never thrown at the UI. */
|
|
365
|
+
private runDiscovery;
|
|
366
|
+
/**
|
|
367
|
+
* Probe candidates asynchronously, then rank them with the shared policy.
|
|
368
|
+
*
|
|
369
|
+
* The ranking stays in {@link validateCandidates}; this method only supplies
|
|
370
|
+
* the asynchronous probes it needs, keyed by the executable the resolver will
|
|
371
|
+
* actually ask about, so discovery and manual validation cannot disagree about
|
|
372
|
+
* what counts as valid.
|
|
373
|
+
*/
|
|
374
|
+
private validateDiscoveryCandidates;
|
|
375
|
+
/** One directory probe for a diagnostics path (no version process). */
|
|
376
|
+
probeDirectory(tool: ToolchainId, root: string): ReturnType<typeof probeInstallation>;
|
|
377
|
+
/** Install the manifest entry for one tool; the job reports progress. */
|
|
378
|
+
install(tool: ToolchainId): Promise<{
|
|
379
|
+
readonly snapshot?: InstallJobSnapshot;
|
|
380
|
+
readonly error?: ManifestFailure;
|
|
381
|
+
}>;
|
|
382
|
+
/** Persist the completed installation and drop stale probes (§8.5). */
|
|
383
|
+
private afterInstall;
|
|
384
|
+
/** One job's snapshot. */
|
|
385
|
+
job(id: string): InstallJobSnapshot | undefined;
|
|
386
|
+
/** Cancel one running job. */
|
|
387
|
+
cancel(id: string): boolean;
|
|
388
|
+
/**
|
|
389
|
+
* Open the native chooser for one tool.
|
|
390
|
+
*
|
|
391
|
+
* The plugin-owned file dialog answers first (it can filter to the expected
|
|
392
|
+
* executable); when it is unavailable the Host's own native folder chooser
|
|
393
|
+
* answers instead, so a native picker exists on every supported desktop.
|
|
394
|
+
* @param tool - which toolchain the choice is for.
|
|
395
|
+
* @param signal - request lifetime; abort dismisses the chooser.
|
|
396
|
+
* @returns the picked path, a cancellation, or an unsupported notice.
|
|
397
|
+
*/
|
|
398
|
+
browse(tool: ToolchainId, signal?: AbortSignal): Promise<BrowseOutcome>;
|
|
399
|
+
/**
|
|
400
|
+
* Compact capability facts for the agent (§12.1).
|
|
401
|
+
*
|
|
402
|
+
* Versions and availability only: an agent needs to know whether an export is
|
|
403
|
+
* possible, not where the binary lives, and the tools resolve the executable
|
|
404
|
+
* themselves from the same configuration.
|
|
405
|
+
*/
|
|
406
|
+
capabilities(): Promise<{
|
|
407
|
+
readonly kicad: {
|
|
408
|
+
readonly available: boolean;
|
|
409
|
+
readonly version?: string;
|
|
410
|
+
};
|
|
411
|
+
readonly solidcraft: {
|
|
412
|
+
readonly available: boolean;
|
|
413
|
+
readonly version?: string;
|
|
414
|
+
readonly cliAvailable: boolean;
|
|
415
|
+
};
|
|
416
|
+
}>;
|
|
417
|
+
}
|
|
418
|
+
//#endregion
|
|
419
|
+
//#region src/routes.d.ts
|
|
420
|
+
declare const HARDWARE_ROUTE_PREFIX = "/api/v1/hardware";
|
|
421
|
+
/** Prefix owned by the toolchain capability, beside the artifact routes. */
|
|
422
|
+
declare const TOOLCHAIN_ROUTE_PREFIX = "/api/v1/hardware/toolchain";
|
|
423
|
+
/**
|
|
424
|
+
* Resolve the workspace root of one DSH session, host-side.
|
|
425
|
+
*
|
|
426
|
+
* Supplied by the plugin from the `sessions` service, so the base for an
|
|
427
|
+
* authorization check comes from the session header rather than from a value
|
|
428
|
+
* the browser sent — and never from whichever session discovered last.
|
|
429
|
+
*/
|
|
430
|
+
type WorkspaceResolver = (sessionId: string) => Promise<string | undefined> | string | undefined;
|
|
431
|
+
interface HardwareHandlerOptions {
|
|
432
|
+
readonly resolveWorkspace?: WorkspaceResolver;
|
|
433
|
+
/** Toolchain status/validation/discovery/install surface, when mounted. */
|
|
434
|
+
readonly toolchain?: ToolchainManager;
|
|
435
|
+
}
|
|
436
|
+
declare function createHardwareHandler(service: HardwareArtifactService, options?: HardwareHandlerOptions): (req: IncomingMessage, res: ServerResponse) => void;
|
|
437
|
+
//#endregion
|
|
438
|
+
export { ManifestFailure as _, createHardwareHandler as a, ToolchainSource as b, ToolchainManager as c, ToolchainStatus as d, ValidationOutcome as f, ManifestEntry as g, InstallPhase as h, WorkspaceResolver as i, ToolchainManagerOptions as l, InstallJobSnapshot as m, HardwareHandlerOptions as n, ToolStatus as o, InstallErrorCode as p, TOOLCHAIN_ROUTE_PREFIX as r, ToolchainConfigPatch as s, HARDWARE_ROUTE_PREFIX as t, ToolchainSettings as u, ToolDiscovery as v, ToolchainId as y };
|
package/lib/routes.d.mts
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
//#region src/routes.d.ts
|
|
4
|
-
declare const HARDWARE_ROUTE_PREFIX = "/api/v1/hardware";
|
|
5
|
-
/**
|
|
6
|
-
* Resolve the workspace root of one DSH session, host-side.
|
|
7
|
-
*
|
|
8
|
-
* Supplied by the plugin from the `sessions` service, so the base for an
|
|
9
|
-
* authorization check comes from the session header rather than from a value
|
|
10
|
-
* the browser sent — and never from whichever session discovered last.
|
|
11
|
-
*/
|
|
12
|
-
type WorkspaceResolver = (sessionId: string) => Promise<string | undefined> | string | undefined;
|
|
13
|
-
interface HardwareHandlerOptions {
|
|
14
|
-
readonly resolveWorkspace?: WorkspaceResolver;
|
|
15
|
-
}
|
|
16
|
-
declare function createHardwareHandler(service: HardwareArtifactService, options?: HardwareHandlerOptions): (req: IncomingMessage, res: ServerResponse) => void;
|
|
17
|
-
//#endregion
|
|
18
|
-
export { HARDWARE_ROUTE_PREFIX, HardwareHandlerOptions, WorkspaceResolver, createHardwareHandler };
|
|
1
|
+
import { a as createHardwareHandler, i as WorkspaceResolver, n as HardwareHandlerOptions, r as TOOLCHAIN_ROUTE_PREFIX, t as HARDWARE_ROUTE_PREFIX } from "./routes-D78ML_ef.mjs";
|
|
2
|
+
export { HARDWARE_ROUTE_PREFIX, HardwareHandlerOptions, TOOLCHAIN_ROUTE_PREFIX, WorkspaceResolver, createHardwareHandler };
|