@devframes/plugin-code-server 0.9.11 → 0.9.15

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.
@@ -6,6 +6,5 @@ import { CacHandle, CreateCacOptions } from "devframe/adapters/cac";
6
6
  * `mcp` subcommands, backed by {@link createCodeServerDevframe}. Used by the package
7
7
  * `bin` (`devframe-code-server`).
8
8
  */
9
- declare function createCodeServerCli(options?: CodeServerOptions, cliOptions?: CreateCacOptions): CacHandle;
10
- //#endregion
11
- export { createCodeServerCli };
9
+ export declare function createCodeServerCli(options?: CodeServerOptions, cliOptions?: CreateCacOptions): CacHandle;
10
+ //#endregion
package/dist/node/cli.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as createCodeServerDevframe } from "../node-DTJ1PTi5.mjs";
1
+ import { t as createCodeServerDevframe } from "../node-BSnbBCzY.mjs";
2
2
  import { createCac } from "devframe/adapters/cac";
3
3
  //#region src/node/cli.ts
4
4
  /**
@@ -18,6 +18,6 @@ import { DevframeDefinition } from "devframe";
18
18
  * export default createCodeServerDevframe({ serverPort: 8080 })
19
19
  * ```
20
20
  */
21
- declare function createCodeServerDevframe(options?: CodeServerOptions): DevframeDefinition;
21
+ export declare function createCodeServerDevframe(options?: CodeServerOptions): DevframeDefinition;
22
22
  //#endregion
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 };
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 as default, getCookieSessionName };
@@ -1,3 +1,3 @@
1
- import { t as createCodeServerDevframe } from "../node-DTJ1PTi5.mjs";
1
+ import { t as createCodeServerDevframe } from "../node-BSnbBCzY.mjs";
2
2
  import { DEFAULT_CODE_SERVER_PORT, DEFAULT_PORT, PLUGIN_ID, STATE_KEY, getCookieSessionName } from "./constants.mjs";
3
3
  export { DEFAULT_CODE_SERVER_PORT, DEFAULT_PORT, PLUGIN_ID, STATE_KEY, createCodeServerDevframe, createCodeServerDevframe as default, getCookieSessionName };
@@ -2,7 +2,7 @@ import { CodeServerDetection, CodeServerSharedState, CodeServerStartRequest, Cod
2
2
  import "../index.mjs";
3
3
  import { RpcDefinitionsToFunctions } from "devframe/rpc";
4
4
  //#region src/node/rpc/index.d.ts
5
- declare const serverFunctions: readonly [{
5
+ export declare const serverFunctions: readonly [{
6
6
  name: "devframes:plugin:code-server:detect";
7
7
  type?: "query" | undefined;
8
8
  cacheable?: boolean;
@@ -65,5 +65,4 @@ declare module 'devframe' {
65
65
  'devframes:plugin:code-server:state': CodeServerSharedState;
66
66
  }
67
67
  }
68
- //#endregion
69
- export { serverFunctions };
68
+ //#endregion
@@ -12,7 +12,7 @@ import { DevframeNodeContext } from "devframe";
12
12
  *
13
13
  * Depends only on the core devframe context (shared state), not on the hub.
14
14
  */
15
- declare class CodeServerSupervisor {
15
+ export declare class CodeServerSupervisor {
16
16
  private readonly ctx;
17
17
  private readonly mode;
18
18
  private readonly explicitBackend?;
@@ -60,6 +60,13 @@ declare class CodeServerSupervisor {
60
60
  detect(): Promise<CodeServerDetection>;
61
61
  /** Current status (+ connect info when running) for the launcher UI. */
62
62
  status(): CodeServerStatusResult;
63
+ /**
64
+ * The server info projected to clients and shared state, tagged with the
65
+ * live hub terminal session id when one exists so the launcher can offer a
66
+ * "view in terminal" jump. Standalone runtimes hold no session and leave it
67
+ * undefined.
68
+ */
69
+ private serverInfo;
63
70
  /**
64
71
  * Launch the editor (if not already up) and resolve once it is reachable.
65
72
  * Idempotent while starting/running; returns the live status instead of
@@ -70,7 +77,11 @@ declare class CodeServerSupervisor {
70
77
  start(req?: CodeServerStartRequest): Promise<CodeServerStartResult>;
71
78
  /** Adopt an already-running local server on the target port, if one answers. */
72
79
  private tryAdopt;
73
- /** Resolve the port to launch on: 0 for tunnels/dynamic, a forced port, or a free one. */
80
+ /**
81
+ * Resolve the port to launch on: 0 for tunnels/dynamic launches, otherwise a
82
+ * free port starting from the forced port (if any) or the default -
83
+ * verified free before it's ever handed to the editor binary's `--port`.
84
+ */
74
85
  private resolveInitialPort;
75
86
  /** The child's environment: inherited env, caller overrides, then profile shaping. */
76
87
  private buildLaunchEnv;
@@ -186,11 +197,11 @@ interface CodeServerProfile {
186
197
  }) => CodeServerConnect;
187
198
  }
188
199
  /** Resolve the launch profile for a mode + backend. */
189
- declare function resolveProfile(mode: CodeServerMode, backend: CodeServerBackend): CodeServerProfile;
200
+ export declare function resolveProfile(mode: CodeServerMode, backend: CodeServerBackend): CodeServerProfile;
190
201
  //#endregion
191
202
  //#region src/node/context.d.ts
192
- declare function setCodeServerSupervisor(ctx: DevframeNodeContext, supervisor: CodeServerSupervisor): void;
193
- declare function getCodeServerSupervisor(ctx: DevframeNodeContext): CodeServerSupervisor;
203
+ export declare function setCodeServerSupervisor(ctx: DevframeNodeContext, supervisor: CodeServerSupervisor): void;
204
+ export declare function getCodeServerSupervisor(ctx: DevframeNodeContext): CodeServerSupervisor;
194
205
  //#endregion
195
206
  //#region src/node/detect.d.ts
196
207
  interface DetectCodeServerResult {
@@ -210,7 +221,7 @@ interface DetectCodeServerResult {
210
221
  * noise (e.g. an `i18next: …` initialization line printed before the version)
211
222
  * from leaking into the reported version.
212
223
  */
213
- declare function detectCodeServer(bin?: string, timeoutMs?: number): Promise<DetectCodeServerResult>;
224
+ export declare function detectCodeServer(bin?: string, timeoutMs?: number): Promise<DetectCodeServerResult>;
214
225
  //#endregion
215
226
  //#region ../../node_modules/.pnpm/nostics@1.2.0/node_modules/nostics/dist/diagnostic-wduO7saY.d.mts
216
227
  //#region src/utils.d.ts
@@ -446,7 +457,7 @@ type ExtractReportersOptions<Reporters extends readonly any[]> = Reporters exten
446
457
  * `DP_CODE_SERVER_` prefix per the built-in plugin convention, keeping it
447
458
  * collision-free with devframe core (`DF`) and the hub (`DF8xxx`).
448
459
  */
449
- declare const diagnostics: Diagnostics<{
460
+ export declare const diagnostics: Diagnostics<{
450
461
  readonly DP_CODE_SERVER_0001: {
451
462
  readonly why: (p: {
452
463
  bin: string;
@@ -496,6 +507,6 @@ declare const diagnostics: Diagnostics<{
496
507
  * Works in any devframe runtime (CLI, Vite, embedded, build), since it only relies
497
508
  * on the core `ctx.rpc` shared-state surface, not on the hub.
498
509
  */
499
- declare function setupCodeServer(ctx: DevframeNodeContext, options?: CodeServerOptions): Promise<CodeServerSupervisor>;
510
+ export declare function setupCodeServer(ctx: DevframeNodeContext, options?: CodeServerOptions): Promise<CodeServerSupervisor>;
500
511
  //#endregion
501
- export { type CodeServerProfile, type CodeServerProfileKind, CodeServerSupervisor, detectCodeServer, diagnostics, getCodeServerSupervisor, resolveProfile, setCodeServerSupervisor, setupCodeServer };
512
+ export type { CodeServerProfile, CodeServerProfileKind };
@@ -321,11 +321,23 @@ var CodeServerSupervisor = class {
321
321
  status() {
322
322
  return {
323
323
  detection: { ...this.detection },
324
- server: { ...this.server },
324
+ server: this.serverInfo(),
325
325
  connect: this.connectInfo()
326
326
  };
327
327
  }
328
328
  /**
329
+ * The server info projected to clients and shared state, tagged with the
330
+ * live hub terminal session id when one exists so the launcher can offer a
331
+ * "view in terminal" jump. Standalone runtimes hold no session and leave it
332
+ * undefined.
333
+ */
334
+ serverInfo() {
335
+ return this.session ? {
336
+ ...this.server,
337
+ terminalSessionId: this.sessionId
338
+ } : { ...this.server };
339
+ }
340
+ /**
329
341
  * Launch the editor (if not already up) and resolve once it is reachable.
330
342
  * Idempotent while starting/running; returns the live status instead of
331
343
  * spawning a second process. In tunnel mode it resolves as soon as either
@@ -401,14 +413,16 @@ var CodeServerSupervisor = class {
401
413
  this.publish();
402
414
  return this.status();
403
415
  }
404
- /** Resolve the port to launch on: 0 for tunnels/dynamic, a forced port, or a free one. */
416
+ /**
417
+ * Resolve the port to launch on: 0 for tunnels/dynamic launches, otherwise a
418
+ * free port starting from the forced port (if any) or the default -
419
+ * verified free before it's ever handed to the editor binary's `--port`.
420
+ */
405
421
  async resolveInitialPort(isLocal) {
406
- if (!isLocal) return 0;
407
- if (this.forcedPort !== void 0 && this.forcedPort !== 0) return this.forcedPort;
408
- if (this.forcedPort === 0) return 0;
422
+ if (!isLocal || this.forcedPort === 0) return 0;
409
423
  return getPort({
410
424
  host: "127.0.0.1",
411
- port: DEFAULT_CODE_SERVER_PORT
425
+ port: this.forcedPort ?? 8080
412
426
  });
413
427
  }
414
428
  /** The child's environment: inherited env, caller overrides, then profile shaping. */
@@ -731,7 +745,7 @@ var CodeServerSupervisor = class {
731
745
  publish() {
732
746
  this.state?.mutate((draft) => {
733
747
  draft.detection = { ...this.detection };
734
- draft.server = { ...this.server };
748
+ draft.server = this.serverInfo();
735
749
  });
736
750
  }
737
751
  /**
@@ -1,6 +1,6 @@
1
1
  //#region src/node/types.d.ts
2
2
  /** Lifecycle state of the managed editor process. */
3
- type CodeServerStatus = 'stopped' | 'starting' | 'running' | 'error';
3
+ export type CodeServerStatus = 'stopped' | 'starting' | 'running' | 'error';
4
4
  /**
5
5
  * Which editor server binary the plugin launches in `mode: 'local'`:
6
6
  *
@@ -13,7 +13,7 @@ type CodeServerStatus = 'stopped' | 'starting' | 'running' | 'error';
13
13
  * (ships with the `code` CLI). The plugin generates a connection token and
14
14
  * hands it to the client as a `?tkn=` query parameter.
15
15
  */
16
- type CodeServerBackend = 'code-server' | 'ms-code-serve-web';
16
+ export type CodeServerBackend = 'code-server' | 'ms-code-serve-web';
17
17
  /**
18
18
  * How the editor is served:
19
19
  *
@@ -24,13 +24,13 @@ type CodeServerBackend = 'code-server' | 'ms-code-serve-web';
24
24
  * prompt (surfaced as {@link CodeServerLogin}); authentication is handled by
25
25
  * `vscode.dev` itself, not this plugin.
26
26
  */
27
- type CodeServerMode = 'local' | 'tunnel';
27
+ export type CodeServerMode = 'local' | 'tunnel';
28
28
  /**
29
29
  * Result of probing the host for a usable editor binary. Drives the launcher
30
30
  * UI: when `installed` is false the SPA renders install instructions instead of
31
31
  * a launch button.
32
32
  */
33
- interface CodeServerDetection {
33
+ export interface CodeServerDetection {
34
34
  /** Whether detection has run at least once on this context. */
35
35
  checked: boolean;
36
36
  /** Whether the resolved binary reported a version. */
@@ -48,14 +48,14 @@ interface CodeServerDetection {
48
48
  * A device-login prompt emitted by `code tunnel` on first launch. Surfaced to
49
49
  * the client so the user can complete authentication in their browser.
50
50
  */
51
- interface CodeServerLogin {
51
+ export interface CodeServerLogin {
52
52
  /** The verification URL to open (e.g. `https://github.com/login/device`). */
53
53
  url: string;
54
54
  /** The one-time code to enter there. */
55
55
  code: string;
56
56
  }
57
57
  /** Serializable, secret-free description of the editor process. */
58
- interface CodeServerServerInfo {
58
+ export interface CodeServerServerInfo {
59
59
  status: CodeServerStatus;
60
60
  /** Port the local server is bound to, when starting/running. */
61
61
  port?: number;
@@ -67,12 +67,20 @@ interface CodeServerServerInfo {
67
67
  error?: string;
68
68
  /** Device-login prompt while a tunnel is authenticating. */
69
69
  login?: CodeServerLogin;
70
+ /**
71
+ * Id of the hub terminal session mirroring this process, present only when
72
+ * the editor was launched through the hub's terminals subsystem
73
+ * (`ctx.terminals`). The launcher uses it to jump the user to that session
74
+ * in the terminals dock via `hub:docks:activate`; standalone runtimes have
75
+ * no hub session and leave it undefined.
76
+ */
77
+ terminalSessionId?: string;
70
78
  }
71
79
  /**
72
80
  * The full shared-state payload broadcast to subscribed clients. Deliberately
73
81
  * carries no authentication material; see {@link CodeServerConnect}.
74
82
  */
75
- interface CodeServerSharedState {
83
+ export interface CodeServerSharedState {
76
84
  detection: CodeServerDetection;
77
85
  server: CodeServerServerInfo;
78
86
  }
@@ -87,7 +95,7 @@ interface CodeServerSharedState {
87
95
  * `cookie` is present, sets it (cookies are port-agnostic, so a cookie set on
88
96
  * the launcher's origin reaches the editor on its own port) before loading.
89
97
  */
90
- interface CodeServerConnect {
98
+ export interface CodeServerConnect {
91
99
  /** Absolute URL to embed. When set, used verbatim (tunnel mode). */
92
100
  url?: string;
93
101
  /** Path + query to open relative to the editor origin (local mode). */
@@ -99,18 +107,18 @@ interface CodeServerConnect {
99
107
  };
100
108
  }
101
109
  /** Result of the `status` query: shared state plus connect info when running. */
102
- interface CodeServerStatusResult extends CodeServerSharedState {
110
+ export interface CodeServerStatusResult extends CodeServerSharedState {
103
111
  connect?: CodeServerConnect;
104
112
  }
105
113
  /** Result of the `start` action, identical shape to {@link CodeServerStatusResult}. */
106
- type CodeServerStartResult = CodeServerStatusResult;
114
+ export type CodeServerStartResult = CodeServerStatusResult;
107
115
  /** Wire payload for the `start` RPC. */
108
- interface CodeServerStartRequest {
116
+ export interface CodeServerStartRequest {
109
117
  /** Workspace folder to open. Defaults to the configured / context cwd. */
110
118
  folder?: string;
111
119
  }
112
120
  /** Options accepted by {@link import('./index').createCodeServerDevframe}. */
113
- interface CodeServerOptions {
121
+ export interface CodeServerOptions {
114
122
  /**
115
123
  * How the editor is served (default `'local'`). `'tunnel'` uses Microsoft's
116
124
  * `code tunnel` and embeds `vscode.dev`.
@@ -176,12 +184,11 @@ interface CodeServerOptions {
176
184
  auth?: boolean;
177
185
  }
178
186
  /** Options for `mode: 'tunnel'`. */
179
- interface CodeServerTunnelOptions {
187
+ export interface CodeServerTunnelOptions {
180
188
  /**
181
189
  * The machine name registered with the tunnel service and used to build the
182
190
  * `vscode.dev/tunnel/<name>` URL. Defaults to the device hostname.
183
191
  */
184
192
  name?: string;
185
193
  }
186
- //#endregion
187
- export { CodeServerBackend, CodeServerConnect, CodeServerDetection, CodeServerLogin, CodeServerMode, CodeServerOptions, CodeServerServerInfo, CodeServerSharedState, CodeServerStartRequest, CodeServerStartResult, CodeServerStatus, CodeServerStatusResult, CodeServerTunnelOptions };
194
+ //#endregion
@@ -1,7 +1,7 @@
1
1
  import { CodeServerOptions } from "./types.mjs";
2
2
  import { DevframeViteBridgeOptions, DevframeVitePlugin } from "@devframes/vite/single";
3
3
  //#region src/node/vite.d.ts
4
- interface CodeServerViteOptions extends CodeServerOptions {
4
+ export interface CodeServerViteOptions extends CodeServerOptions {
5
5
  /** Forwarded to the underlying `devframeViteBridge`/`devframeVitePlugin` (mount base, etc.). */
6
6
  vite?: DevframeViteBridgeOptions;
7
7
  }
@@ -12,6 +12,5 @@ interface CodeServerViteOptions extends CodeServerOptions {
12
12
  * the bundled SPA at the mount base. The bridge is listed first so its
13
13
  * `__connection.json` route is matched ahead of the SPA fallback.
14
14
  */
15
- declare function codeServerVite(options?: CodeServerViteOptions): DevframeVitePlugin[];
16
- //#endregion
17
- export { CodeServerViteOptions, codeServerVite };
15
+ export declare function codeServerVite(options?: CodeServerViteOptions): DevframeVitePlugin[];
16
+ //#endregion
@@ -1,4 +1,4 @@
1
- import { t as createCodeServerDevframe } from "../node-DTJ1PTi5.mjs";
1
+ import { t as createCodeServerDevframe } from "../node-BSnbBCzY.mjs";
2
2
  import { devframeViteBridge, devframeVitePlugin } from "@devframes/vite/single";
3
3
  //#region src/node/vite.ts
4
4
  /**
@@ -2,7 +2,7 @@ import { PLUGIN_ID } from "./node/constants.mjs";
2
2
  import { defineDevframe } from "devframe";
3
3
  //#region package.json
4
4
  var name = "@devframes/plugin-code-server";
5
- var version = "0.9.11";
5
+ var version = "0.9.15";
6
6
  var description = "Devframe plugin that runs VS Code in the browser as an embedded editor panel.";
7
7
  var homepage = "https://github.com/devframes/devframe#readme";
8
8
  //#endregion
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@devframes/plugin-code-server",
3
3
  "type": "module",
4
- "version": "0.9.11",
4
+ "version": "0.9.15",
5
5
  "description": "Devframe plugin that runs VS Code in the browser as an embedded editor panel.",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -39,8 +39,8 @@
39
39
  "dist"
40
40
  ],
41
41
  "peerDependencies": {
42
- "@devframes/plugin-code-server--assets": "0.9.11",
43
- "devframe": "0.9.11",
42
+ "@devframes/plugin-code-server--assets": "0.9.15",
43
+ "devframe": "0.9.15",
44
44
  "vite": "^8.0.0"
45
45
  },
46
46
  "peerDependenciesMeta": {
@@ -52,26 +52,26 @@
52
52
  }
53
53
  },
54
54
  "dependencies": {
55
- "@devframes/vite": "0.9.11",
55
+ "@devframes/vite": "0.9.15",
56
56
  "cac": "^7.0.0"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@antfu/design": "^0.4.0",
60
- "@devframes/plugin-code-server--assets": "0.9.11",
60
+ "@devframes/plugin-code-server--assets": "0.9.15",
61
61
  "@iconify-json/ph": "^1.2.2",
62
- "@storybook/addon-docs": "^10.5.10",
63
- "@storybook/vue3-vite": "^10.5.10",
64
- "@types/node": "^26.4.0",
62
+ "@storybook/addon-docs": "^10.6.0",
63
+ "@storybook/vue3-vite": "^10.6.0",
64
+ "@types/node": "^26.5.0",
65
65
  "@vitejs/plugin-vue": "^6.0.8",
66
66
  "colorjs.io": "^0.7.1",
67
- "devframe": "0.9.11",
68
- "h3": "^2.0.1-rc.29",
67
+ "devframe": "0.9.15",
68
+ "h3": "^2.0.1-rc.31",
69
69
  "pathe": "^2.0.3",
70
- "storybook": "^10.5.10",
71
- "tsdown": "^0.22.14",
72
- "unocss": "^66.8.1",
70
+ "storybook": "^10.6.0",
71
+ "tsdown": "^0.23.0",
72
+ "unocss": "^66.10.0",
73
73
  "vite": "^8.2.2",
74
- "vitest": "^4.1.11",
74
+ "vitest": "^5.0.0",
75
75
  "vue": "^3.5.42"
76
76
  },
77
77
  "scripts": {