@devframes/plugin-code-server 0.9.9 → 0.9.11

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/bin.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import process from 'node:process'
3
- import { createCodeServerCli } from './dist/cli.mjs'
3
+ import { createCodeServerCli } from './dist/node/cli.mjs'
4
4
 
5
5
  async function main() {
6
6
  const cli = createCodeServerCli()
@@ -1,4 +1,4 @@
1
- //#region src/constants.d.ts
1
+ //#region src/node/constants.d.ts
2
2
  /** Stable devframe id for the code-server plugin. */
3
3
  declare const PLUGIN_ID = "devframes_plugin_code-server";
4
4
  /**
@@ -1,6 +1,6 @@
1
1
  import { CodeServerOptions } from "./types.mjs";
2
2
  import { CacHandle, CreateCacOptions } from "devframe/adapters/cac";
3
- //#region src/cli.d.ts
3
+ //#region src/node/cli.d.ts
4
4
  /**
5
5
  * Build a standalone CLI for the code-server panel, exposing `dev` / `build` /
6
6
  * `mcp` subcommands, backed by {@link createCodeServerDevframe}. Used by the package
@@ -1,6 +1,6 @@
1
- import { t as createCodeServerDevframe } from "./src-5dhTkOqj.mjs";
1
+ import { t as createCodeServerDevframe } from "../node-DTJ1PTi5.mjs";
2
2
  import { createCac } from "devframe/adapters/cac";
3
- //#region src/cli.ts
3
+ //#region src/node/cli.ts
4
4
  /**
5
5
  * Build a standalone CLI for the code-server panel, exposing `dev` / `build` /
6
6
  * `mcp` subcommands, backed by {@link createCodeServerDevframe}. Used by the package
@@ -1,2 +1,2 @@
1
- import { a as SESSION_COOKIE_BASE, c as TERMINAL_SESSION_TITLE, i as PLUGIN_ID, l as getCookieSessionName, n as DEFAULT_PORT, o as STATE_KEY, r as DEFAULT_START_TIMEOUT, s as TERMINAL_SESSION_ICON, t as DEFAULT_CODE_SERVER_PORT } from "./constants-BbInB7V-.mjs";
1
+ import { a as SESSION_COOKIE_BASE, c as TERMINAL_SESSION_TITLE, i as PLUGIN_ID, l as getCookieSessionName, n as DEFAULT_PORT, o as STATE_KEY, r as DEFAULT_START_TIMEOUT, s as TERMINAL_SESSION_ICON, t as DEFAULT_CODE_SERVER_PORT } from "../constants-DTS2klFC.mjs";
2
2
  export { DEFAULT_CODE_SERVER_PORT, DEFAULT_PORT, DEFAULT_START_TIMEOUT, PLUGIN_ID, SESSION_COOKIE_BASE, STATE_KEY, TERMINAL_SESSION_ICON, TERMINAL_SESSION_TITLE, getCookieSessionName };
@@ -1,4 +1,4 @@
1
- //#region src/constants.ts
1
+ //#region src/node/constants.ts
2
2
  /** Stable devframe id for the code-server plugin. */
3
3
  const PLUGIN_ID = "devframes_plugin_code-server";
4
4
  /**
@@ -1,501 +1,23 @@
1
- import { CodeServerBackend, CodeServerConnect, CodeServerDetection, CodeServerLogin, CodeServerMode, CodeServerOptions, CodeServerStartRequest, CodeServerStartResult, CodeServerStatusResult } from "../types.mjs";
2
- import { DevframeNodeContext } from "devframe";
3
- //#region src/node/supervisor.d.ts
4
- /**
5
- * Owns the lifecycle of a single editor child process. Resolves a launch
6
- * {@link CodeServerProfile} (Coder `code-server`, Microsoft `code serve-web`,
7
- * or `code tunnel`), detects the binary, launches it with freshly generated
8
- * auth material, waits for readiness, and mirrors a secret-free status into
9
- * shared state. The connect descriptor (session cookie / connection token /
10
- * tunnel URL) is handed back only through `start()` / `status()` so the
11
- * already-authorized client can open the editor without a login page.
12
- *
13
- * Depends only on the core devframe context (shared state), not on the hub.
14
- */
15
- declare class CodeServerSupervisor {
16
- private readonly ctx;
17
- private readonly mode;
18
- private readonly explicitBackend?;
19
- private readonly explicitBin?;
20
- private readonly workspace;
21
- private readonly host;
22
- private readonly forcedPort?;
23
- private readonly extraArgs;
24
- private readonly extraEnv;
25
- private readonly cookieSuffix?;
26
- private readonly cookieName;
27
- private readonly startTimeout;
28
- private readonly reuseExistingServer;
29
- private readonly tunnelName;
30
- /** Resolved after the first detection. */
31
- private backend;
32
- private bin;
33
- private profile;
34
- private state?;
35
- private detection;
36
- private server;
37
- private proc?;
38
- /** Context of the live launch, used to compute the client connect descriptor. */
39
- private launchCtx?;
40
- /** Whether the running server was adopted (reused) rather than launched. */
41
- private adopted;
42
- /** Captured `vscode.dev` URL for a running tunnel. */
43
- private readyUrl?;
44
- private logBuffer;
45
- private exitHandler?;
46
- /** Stable id of the hub terminal session, reused across start/stop. */
47
- private readonly sessionId;
48
- /** The live hub terminal session when launched through `ctx.terminals`. */
49
- private session?;
50
- constructor(ctx: DevframeNodeContext, options?: CodeServerOptions);
51
- /** Resolve shared state, register process-exit cleanup, run first detection. */
52
- init(): Promise<void>;
53
- /**
54
- * Probe for a usable editor binary and publish the result. Resolves the
55
- * backend + binary when the caller left them implicit: tunnel mode always
56
- * uses `code`; an explicit backend or `bin` is honored as-is; otherwise the
57
- * plugin tries each {@link AUTO_DETECT_ORDER} candidate and keeps the first
58
- * that is installed.
59
- */
60
- detect(): Promise<CodeServerDetection>;
61
- /** Current status (+ connect info when running) for the launcher UI. */
62
- status(): CodeServerStatusResult;
63
- /**
64
- * Launch the editor (if not already up) and resolve once it is reachable.
65
- * Idempotent while starting/running; returns the live status instead of
66
- * spawning a second process. In tunnel mode it resolves as soon as either
67
- * the `vscode.dev` URL or a device-login prompt is seen, so the action never
68
- * blocks on interactive authentication.
69
- */
70
- start(req?: CodeServerStartRequest): Promise<CodeServerStartResult>;
71
- /** Adopt an already-running local server on the target port, if one answers. */
72
- private tryAdopt;
73
- /** Resolve the port to launch on: 0 for tunnels/dynamic, a forced port, or a free one. */
74
- private resolveInitialPort;
75
- /** The child's environment: inherited env, caller overrides, then profile shaping. */
76
- private buildLaunchEnv;
77
- /** Buffer output and latch the port / login / ready-URL signals from each line. */
78
- private consumeOutput;
79
- private latchPort;
80
- private latchLogin;
81
- private latchReadyUrl;
82
- private handleChildError;
83
- private handleChildExit;
84
- /** Wait for the dynamic port then readiness, and flip to `running`. */
85
- private finalizeLocalStart;
86
- private handleStartFailure;
87
- /** Stop the editor process and reset to `stopped`. */
88
- stop(): CodeServerStatusResult;
89
- /** Kill the process on host shutdown / test teardown. */
90
- dispose(): void;
91
- /** Resolved backend for tests / callers. */
92
- get resolvedBackend(): CodeServerBackend;
93
- private setResolved;
94
- private baseCtx;
95
- /** Clear per-launch process state (keeps `server`/`detection`). */
96
- private reset;
97
- /**
98
- * Resolve start() for a tunnel: succeed as soon as the `vscode.dev` URL
99
- * appears (→ running) or a device-login prompt is seen (→ starting, so the
100
- * user can authenticate while the log stream continues to a running URL).
101
- */
102
- private awaitTunnel;
103
- private connectInfo;
104
- private terminate;
105
- /**
106
- * Resolve the hub's terminals subsystem when this devframe is mounted in a
107
- * hub. `ctx.terminals` only exists on a `DevframeHubContext`, so it is
108
- * duck-typed: standalone runtimes (CLI / Vite / build) have no such property
109
- * and fall back to a direct child process.
110
- */
111
- private resolveHubTerminals;
112
- /** Update the mirrored hub terminal session's status, when one exists. */
113
- private reflectHub;
114
- /**
115
- * Launch the editor binary. In a hub, spawn it through `ctx.terminals` so it
116
- * shows up as a read-only terminal session (proper icon + name) whose output
117
- * the hub streams to its terminals panel; standalone, spawn it directly.
118
- * Either way, return the underlying {@link ChildProcess} so the shared
119
- * readiness / port / log wiring in `start()` is identical.
120
- */
121
- private launchProcess;
122
- /** Spawn through the hub's terminals subsystem so it shows as a terminal session. */
123
- private launchViaHub;
124
- /** Spawn the editor binary directly (standalone runtimes with no hub). */
125
- private launchDirect;
126
- private appendLog;
127
- private lastLog;
128
- private publish;
129
- /**
130
- * Poll the server's readiness path until it responds or the timeout elapses.
131
- * Returns false if the process exits first.
132
- */
133
- private waitForReady;
134
- private registerCleanup;
135
- }
136
- //#endregion
137
- //#region src/node/backends.d.ts
138
- /**
139
- * The internal launch profile the supervisor drives. One of three "kinds":
140
- * the two local {@link CodeServerBackend}s plus the `code tunnel` profile
141
- * selected by `mode: 'tunnel'`. Each profile owns the backend-specific pieces
142
- * (binary, arguments, auth env, readiness detection, and how the client
143
- * ultimately reaches the editor), while the supervisor owns the shared
144
- * spawn / log / publish lifecycle.
145
- */
146
- type CodeServerProfileKind = 'code-server' | 'serve-web' | 'tunnel';
147
- /** Everything a profile needs to build a launch and the client's connect info. */
148
- interface ProfileContext {
149
- host: string;
150
- /** Resolved local port (0 until dynamically allocated). Unused by tunnel. */
151
- port: number;
152
- folder: string;
153
- /** Fresh per-launch secret (session token / connection token). */
154
- secret: string;
155
- /** Session cookie name for the `code-server` backend. */
156
- cookieName: string;
157
- extraArgs: string[];
158
- /** Machine name for the tunnel profile. */
159
- tunnelName: string;
160
- }
161
- interface CodeServerProfile {
162
- kind: CodeServerProfileKind;
163
- /** Public backend id (tunnel reports `ms-code-serve-web`'s sibling `code` binary). */
164
- backend: CodeServerBackend;
165
- /** Default binary when the caller doesn't override `bin`. */
166
- defaultBin: string;
167
- /** Build the argv passed to the binary. */
168
- buildArgs: (c: ProfileContext) => string[];
169
- /** Merge auth material into the child environment. */
170
- buildEnv: (c: ProfileContext, base: Record<string, string>) => Record<string, string>;
171
- /** Local readiness path polled over HTTP, or `null` for log-driven (tunnel). */
172
- healthPath: string | null;
173
- /** Parse a log line for a dynamically-bound local port. */
174
- matchPort?: (line: string) => number | undefined;
175
- /** Parse a log line for the tunnel's `vscode.dev` URL (marks it ready). */
176
- matchReadyUrl?: (line: string) => string | undefined;
177
- /** Parse a log line for a device-login prompt. */
178
- matchLogin?: (line: string) => CodeServerLogin | undefined;
179
- /** Compute the client connect descriptor for a freshly launched server. */
180
- connect: (c: ProfileContext & {
181
- readyUrl?: string;
182
- }) => CodeServerConnect;
183
- /** Connect descriptor for an adopted (reused) server we didn't launch. */
184
- connectReused: (c: {
185
- port: number;
186
- }) => CodeServerConnect;
187
- }
188
- /** Resolve the launch profile for a mode + backend. */
189
- declare function resolveProfile(mode: CodeServerMode, backend: CodeServerBackend): CodeServerProfile;
190
- //#endregion
191
- //#region src/node/context.d.ts
192
- declare function setCodeServerSupervisor(ctx: DevframeNodeContext, supervisor: CodeServerSupervisor): void;
193
- declare function getCodeServerSupervisor(ctx: DevframeNodeContext): CodeServerSupervisor;
194
- //#endregion
195
- //#region src/node/detect.d.ts
196
- interface DetectCodeServerResult {
197
- installed: boolean;
198
- version?: string;
199
- bin: string;
200
- }
201
- /**
202
- * Probe the host for a usable code-server binary by running
203
- * `<bin> --version`. Resolves to `installed: false` when the binary is
204
- * missing (ENOENT), errors, or exits non-zero (never throws), so the
205
- * launcher can fall back to install instructions.
206
- *
207
- * `code-server --version` prints e.g. `4.96.4 abc123 with Code 1.96.4`; the
208
- * first semver-looking token is taken as the version. Matching a semver
209
- * pattern (rather than the leading whitespace token) keeps cold-start i18n
210
- * noise (e.g. an `i18next: …` initialization line printed before the version)
211
- * from leaking into the reported version.
212
- */
213
- declare function detectCodeServer(bin?: string, timeoutMs?: number): Promise<DetectCodeServerResult>;
214
- //#endregion
215
- //#region ../../node_modules/.pnpm/nostics@1.2.0/node_modules/nostics/dist/diagnostic-wduO7saY.d.mts
216
- //#region src/utils.d.ts
217
- /**
218
- * A value of type T, or a function that resolves T from a single params object.
219
- *
220
- * @internal
221
- */
222
- type ValueOrFn<T, P = any> = T | ((params: P) => T);
223
- /**
224
- * Extracts the param type from a single-arg function, or `never` for
225
- * non-function inputs. Pairs with {@link ValueOrFn}.
226
- *
227
- * @internal
228
- */
229
- type ExtractFnParam<T> = T extends ((params: infer P) => any) ? P : never;
230
- /**
231
- * Converts a union of types to their intersection.
232
- *
233
- * @internal
234
- */
235
- type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
236
- /**
237
- * `true` when `T` is the `any` type.
238
- *
239
- * @internal
240
- */
241
- type IsAny<Type> = 0 extends 1 & Type ? true : false;
242
- /**
243
- * `true` when `T` is the `unknown` type (and not `any`).
244
- *
245
- * @internal
246
- */
247
- type IsUnknown<Type> = IsAny<Type> extends true ? false : unknown extends Type ? true : false;
248
- /**
249
- * Expands a type to its property listing so editor hovers show the resolved
250
- * shape instead of a chain of aliases / intersections.
251
- *
252
- * @internal
253
- */
254
- type Prettify<Type> = { [Key in keyof Type]: Type[Key]; };
255
- //#endregion
256
- //#region src/diagnostic.d.ts
257
- /**
258
- * Define-time shape of a diagnostic. Each field can be a static value or a
259
- * function that resolves it from a shared `params` object passed at call
260
- * time. Runtime-only fields (`cause`, `sources`) from {@link DiagnosticInit}
261
- * are intentionally omitted: they're only meaningful at the call site.
262
- */
263
- interface DiagnosticDefinition<P = any> {
264
- /**
265
- * The error message: why this failed. String, or a function of `params`.
266
- *
267
- * @example
268
- * ```ts
269
- * why: (p: { name: string }) => `module "${p.name}" failed to load`
270
- * ```
271
- */
272
- why: ValueOrFn<string, P>;
273
- /**
274
- * Actionable instructions on how to resolve the problem. String, or a
275
- * function of `params`.
276
- *
277
- * @example
278
- * ```ts
279
- * fix: (p: { name: string }) => `run "npm install ${p.name}"`
280
- * ```
281
- */
282
- fix?: ValueOrFn<string, P>;
283
- /**
284
- * Per-code docs URL. A string overrides
285
- * {@link DefineDiagnosticsOptions.docsBase} for this code; `false` opts this
286
- * code out entirely, even when `docsBase` is set. When omitted, the URL is
287
- * derived from `docsBase`.
288
- */
289
- docs?: string | false;
290
- }
291
- /**
292
- * Runtime-only fields that can be passed alongside the interpolation params
293
- * at call time. Merged into the same object so callers pass everything in
294
- * one place.
295
- */
296
- interface DiagnosticCallParams {
297
- /**
298
- * Original error or exception that triggered this diagnostic. Pass it
299
- * through when re-throwing so the original stack trace is preserved.
300
- */
301
- cause?: unknown;
302
- /**
303
- * Locations in user code that contributed to this diagnostic, in
304
- * `file:line:column` format. Useful for compilers and other tools where the
305
- * JS stack trace doesn't reflect the user's source.
306
- */
307
- sources?: string[];
308
- }
309
- /**
310
- * Structured initializer for a {@link Diagnostic}. `why` is the only required
311
- * field: it becomes the {@link Diagnostic.message}. The remaining fields are
312
- * optional metadata that reporters and consumers can render or forward.
313
- */
314
- interface DiagnosticInit extends DiagnosticCallParams {
315
- /**
316
- * The diagnostic code, e.g. `MATH_E001`. Appear as {@link Diagnostic.name}.
317
- */
318
- code: string;
319
- /**
320
- * The actual error message: why this failed.
321
- * Mirrored to `Error.message`.
322
- */
323
- why: string;
324
- /**
325
- * Optional actionable instructions on how to resolve the problem.
326
- */
327
- fix?: string;
328
- /**
329
- * URL to extended documentation for this diagnostic.
330
- */
331
- docs?: string;
332
- }
333
- /**
334
- * Permissive reporter constraint used internally so reporters with 1 arg,
335
- * required options, or optional options all satisfy the array constraint.
336
- *
337
- * @internal
338
- */
339
- type AnyDiagnosticReporter = (diagnostic: Diagnostic, options: any) => void;
340
- /**
341
- * Resolves the `params` type a code expects from the intersection of params
342
- * across all function-typed fields, falling back to `{}` when every field is
343
- * static. Merged with {@link DiagnosticCallParams} at the call site.
344
- *
345
- * @internal
346
- */
347
- type InferCodeParams<Def> = [ExtractFnParam<Def[keyof Def]>] extends [never] ? {} : UnionToIntersection<ExtractFnParam<Def[keyof Def]>>;
348
- /**
349
- * The first positional argument of a {@link DiagnosticHandle} call:
350
- * interpolation params merged with the runtime-only call-site fields
351
- * (`cause`, `sources`).
352
- *
353
- * @internal
354
- */
355
- type CallSiteParams<Params> = Params & DiagnosticCallParams;
1
+ import { CodeServerBackend, CodeServerConnect, CodeServerDetection, CodeServerLogin, CodeServerMode, CodeServerOptions, CodeServerServerInfo, CodeServerSharedState, CodeServerStartRequest, CodeServerStartResult, CodeServerStatus, CodeServerStatusResult, CodeServerTunnelOptions } from "./types.mjs";
2
+ import { i as PLUGIN_ID, l as getCookieSessionName, n as DEFAULT_PORT, o as STATE_KEY, t as DEFAULT_CODE_SERVER_PORT } from "../constants-DTS2klFC.mjs";
3
+ import { DevframeDefinition } from "devframe";
4
+ //#region src/node/index.d.ts
356
5
  /**
357
- * Resolves the full argument tuple for a {@link DiagnosticHandle} call.
358
- * Branches on whether params and reporter options each have required fields.
359
- * Required positions become required tuple elements, all-optional ones
360
- * become `?`, and when no reporter declares any options the parameter is
361
- * omitted entirely.
6
+ * Build a {@link DevframeDefinition} for the code-server panel. The same
7
+ * definition runs standalone (`createCac`), mounts into a Vite host
8
+ * (`/vite`), or docks inside a hub, since its `setup` only relies on the core
9
+ * devframe RPC + shared-state surface.
362
10
  *
363
- * @internal
364
- */
365
- type ActionArgs<Params, ReporterOpts> = keyof ReporterOpts extends never ? {} extends Params ? [params?: CallSiteParams<Params>] : [params: CallSiteParams<Params>] : {} extends ReporterOpts ? {} extends Params ? [params?: CallSiteParams<Params>, reporterOptions?: ReporterOpts] : [params: CallSiteParams<Params>, reporterOptions?: ReporterOpts] : {} extends Params ? [params: CallSiteParams<Params> | undefined, reporterOptions: ReporterOpts] : [params: CallSiteParams<Params>, reporterOptions: ReporterOpts];
366
- /**
367
- * Per-code handle exposed by {@link defineDiagnostics}. Each code is a
368
- * callable: invoke it to build the diagnostic and run every reporter, or
369
- * prefix the call with `throw` to raise it.
11
+ * @experimental This plugin is experimental and may change without a major
12
+ * version bump until it stabilizes.
370
13
  *
371
14
  * @example
372
15
  * ```ts
373
- * diagnostics.MATH_E001({ name: 'x' }) // report
374
- * throw diagnostics.MATH_E001({ name: 'x' }) // throw
375
- * ```
376
- */
377
- interface DiagnosticHandle<Params, ReporterOpts> {
378
- /**
379
- * Builds the diagnostic, runs every reporter, and returns the diagnostic
380
- * instance. The returned diagnostic can be inspected, attached as `cause`,
381
- * or thrown with `throw`.
382
- */
383
- (...args: ActionArgs<Params, ReporterOpts>): Diagnostic;
384
- }
385
- /**
386
- * Return type of {@link defineDiagnostics}.
387
- */
388
- type Diagnostics<Codes extends Record<string, DiagnosticDefinition>, Reporters extends readonly AnyDiagnosticReporter[]> = { [Code in keyof Codes]: DiagnosticHandle<InferCodeParams<Codes[Code]>, Prettify<ExtractReportersOptions<Reporters>>>; };
389
- declare class Diagnostic extends Error {
390
- name: string;
391
- /**
392
- * The diagnostic code, e.g. `MATH_E001`.
393
- * Also appears as the `name` property.
394
- */
395
- code: string;
396
- /**
397
- * URL to extended documentation for this diagnostic code.
398
- * Auto-generated from {@link DefineDiagnosticsOptions.docsBase}.
399
- */
400
- docs?: string;
401
- /**
402
- * Optional actionable instructions on how to resolve the problem.
403
- */
404
- fix?: string;
405
- /**
406
- * Locations in user code that contributed to this diagnostic, in
407
- * `file:line:column` format. Relevant when the stack trace doesn't reflect
408
- * the user's source (e.g. compilers, bundlers), otherwise redundant with the
409
- * stack and should be omitted.
410
- */
411
- sources?: string[];
412
- /**
413
- * Alias for {@link Error.message}: the reason this diagnostic was raised.
414
- */
415
- get why(): string;
416
- /**
417
- * @param init structured initializer; `why` is required
418
- * @param captureFrom V8 stack-cutoff frame. Defaults to {@link Diagnostic}
419
- * so the top of the trace is the `new Diagnostic(...)` call site.
420
- * `defineDiagnostics` passes its action method to strip its own frames too.
421
- * Ignored on engines without `Error.captureStackTrace`.
422
- */
423
- constructor(init: DiagnosticInit, captureFrom?: Function);
424
- /**
425
- * Converts the diagnostic into a serializable structured object.
426
- */
427
- toJSON(): object;
428
- }
429
- /**
430
- * Extracts the options object a reporter accepts as its 2nd argument. Returns
431
- * `{}` when the reporter has no 2nd arg (so it contributes nothing to the
432
- * merged shape).
433
- */
434
- type ExtractSingleReporterOptions<Reporter> = Reporter extends ((diagnostic: Diagnostic, options: infer ReporterOpts) => any) ? IsUnknown<ReporterOpts> extends true ? {} : Exclude<ReporterOpts, undefined> : {};
435
- /**
436
- * Intersects every reporter's options shape into a single object. If any
437
- * reporter has a required field, the merged shape has a required field, and
438
- * {@link ActionArgs} flips `reporterOptions` from optional to required via
439
- * `{} extends Merged`.
440
- */
441
- type ExtractReportersOptions<Reporters extends readonly any[]> = Reporters extends readonly [infer First, ...infer Rest] ? ExtractSingleReporterOptions<First> & ExtractReportersOptions<Rest> : {};
442
- //#endregion
443
- //#region src/node/diagnostics.d.ts
444
- /**
445
- * Structured diagnostics for the code-server plugin. Uses the plugin's own
446
- * `DP_CODE_SERVER_` prefix per the built-in plugin convention, keeping it
447
- * collision-free with devframe core (`DF`) and the hub (`DF8xxx`).
448
- */
449
- declare const diagnostics: Diagnostics<{
450
- readonly DP_CODE_SERVER_0001: {
451
- readonly why: (p: {
452
- bin: string;
453
- }) => string;
454
- readonly fix: "Install Coder code-server (`curl -fsSL https://code-server.dev/install.sh | sh`) or the Microsoft `code` CLI, or set the `bin` option to its path. See https://coder.com/docs/code-server/latest/install";
455
- };
456
- readonly DP_CODE_SERVER_0002: {
457
- readonly why: (p: {
458
- port: number;
459
- timeout: number;
460
- }) => string;
461
- readonly fix: "Check the editor logs for startup errors, raise `startTimeout`, or free the port.";
462
- };
463
- readonly DP_CODE_SERVER_0003: {
464
- readonly why: (p: {
465
- bin: string;
466
- reason: string;
467
- }) => string;
468
- };
469
- readonly DP_CODE_SERVER_0004: {
470
- readonly why: "code-server supervisor is not initialised on this context";
471
- readonly fix: "Call setupCodeServer(ctx) (or use createCodeServerDevframe) before invoking the code-server RPCs.";
472
- };
473
- readonly DP_CODE_SERVER_0005: {
474
- readonly why: (p: {
475
- code: number;
476
- }) => string;
477
- readonly fix: "Inspect the captured output in the launcher and re-launch.";
478
- };
479
- readonly DP_CODE_SERVER_0006: {
480
- readonly why: (p: {
481
- timeout: number;
482
- }) => string;
483
- readonly fix: "Check the tunnel logs, ensure the `code` CLI is signed in, or raise `startTimeout`.";
484
- };
485
- }, readonly [(d: Diagnostic, { method }?: {
486
- method?: "log" | "warn" | "error";
487
- }) => void]>;
488
- //#endregion
489
- //#region src/node/index.d.ts
490
- /**
491
- * Wire the code-server subsystem onto a devframe node context: create the
492
- * {@link CodeServerSupervisor}, run the initial binary detection, publish
493
- * status into shared state, and register the control RPC functions. Returns
494
- * the supervisor so callers can launch/stop or dispose it on shutdown.
16
+ * import { createCodeServerDevframe } from '@devframes/plugin-code-server'
495
17
  *
496
- * Works in any devframe runtime (CLI, Vite, embedded, build), since it only relies
497
- * on the core `ctx.rpc` shared-state surface, not on the hub.
18
+ * export default createCodeServerDevframe({ serverPort: 8080 })
19
+ * ```
498
20
  */
499
- declare function setupCodeServer(ctx: DevframeNodeContext, options?: CodeServerOptions): Promise<CodeServerSupervisor>;
21
+ declare function createCodeServerDevframe(options?: CodeServerOptions): DevframeDefinition;
500
22
  //#endregion
501
- export { type CodeServerProfile, type CodeServerProfileKind, CodeServerSupervisor, detectCodeServer, diagnostics, getCodeServerSupervisor, resolveProfile, setCodeServerSupervisor, setupCodeServer };
23
+ export { type CodeServerBackend, type CodeServerConnect, type CodeServerDetection, type CodeServerLogin, type CodeServerMode, type CodeServerOptions, type CodeServerServerInfo, type CodeServerSharedState, type CodeServerStartRequest, type CodeServerStartResult, type CodeServerStatus, type CodeServerStatusResult, type CodeServerTunnelOptions, DEFAULT_CODE_SERVER_PORT, DEFAULT_PORT, PLUGIN_ID, STATE_KEY, createCodeServerDevframe, createCodeServerDevframe as default, getCookieSessionName };