@trebired/code-server-kit 0.1.0 → 0.3.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +318 -82
  3. package/dist/errors.d.ts +37 -4
  4. package/dist/errors.d.ts.map +1 -1
  5. package/dist/errors.js +73 -7
  6. package/dist/errors.js.map +1 -1
  7. package/dist/index.d.ts +10 -3
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +9 -2
  10. package/dist/index.js.map +1 -1
  11. package/dist/launch.d.ts +2 -3
  12. package/dist/launch.d.ts.map +1 -1
  13. package/dist/launch.js +15 -223
  14. package/dist/launch.js.map +1 -1
  15. package/dist/logging.d.ts +5 -0
  16. package/dist/logging.d.ts.map +1 -0
  17. package/dist/logging.js +11 -0
  18. package/dist/logging.js.map +1 -0
  19. package/dist/plan.d.ts +15 -0
  20. package/dist/plan.d.ts.map +1 -0
  21. package/dist/plan.js +355 -0
  22. package/dist/plan.js.map +1 -0
  23. package/dist/profile.d.ts +8 -0
  24. package/dist/profile.d.ts.map +1 -0
  25. package/dist/profile.js +107 -0
  26. package/dist/profile.js.map +1 -0
  27. package/dist/proxy.d.ts +6 -0
  28. package/dist/proxy.d.ts.map +1 -0
  29. package/dist/proxy.js +92 -0
  30. package/dist/proxy.js.map +1 -0
  31. package/dist/readiness.d.ts.map +1 -1
  32. package/dist/readiness.js +42 -4
  33. package/dist/readiness.js.map +1 -1
  34. package/dist/resolve.d.ts.map +1 -1
  35. package/dist/resolve.js +3 -1
  36. package/dist/resolve.js.map +1 -1
  37. package/dist/session.d.ts +11 -0
  38. package/dist/session.d.ts.map +1 -0
  39. package/dist/session.js +888 -0
  40. package/dist/session.js.map +1 -0
  41. package/dist/spec.d.ts +7 -0
  42. package/dist/spec.d.ts.map +1 -0
  43. package/dist/spec.js +64 -0
  44. package/dist/spec.js.map +1 -0
  45. package/dist/systemd.d.ts +17 -0
  46. package/dist/systemd.d.ts.map +1 -0
  47. package/dist/systemd.js +254 -0
  48. package/dist/systemd.js.map +1 -0
  49. package/dist/types.d.ts +300 -3
  50. package/dist/types.d.ts.map +1 -1
  51. package/package.json +3 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ - nothing yet
6
+
7
+ ## 0.3.0
8
+
9
+ - expand the package from launch planning into a full generic `code-server` session runtime
10
+ - add session lifecycle APIs for start, stop, restart, status, diagnostics, and session-manager creation
11
+ - add Linux-first transient systemd helpers and launch-command builders
12
+ - add disk-backed session metadata, reuse checks, profile restore and persist hooks, and richer startup diagnostics
13
+ - add `@trebired/logger-adapter` support across the higher-level APIs
14
+
15
+ ## 0.2.0
16
+
17
+ - add `createCodeServerLaunchPlan()` as the main higher-level launch planning API
18
+ - add generic launch spec, command formatting, and startup failure normalization helpers
19
+ - add readiness probe support and broader structured error coverage
20
+ - add generic allowlisted profile sync helpers for `code-server` user data and extensions
21
+ - add reverse-proxy helpers for forwarded headers, trusted origins, and HTML response detection
22
+
3
23
  ## 0.1.0
4
24
 
5
25
  - Initial release
package/README.md CHANGED
@@ -1,18 +1,17 @@
1
1
  # @trebired/code-server-kit
2
2
 
3
- Framework-agnostic `code-server` launch planning for Node.js applications.
3
+ Framework-agnostic `code-server` session runtime for Node.js applications.
4
4
 
5
- `@trebired/code-server-kit` gives your app a small, typed layer for finding an installed `code-server`, building a stable launch command, waiting for readiness, and optionally spawning the process without leaking `code-server` package layout details into product code.
5
+ `@trebired/code-server-kit` is the generic Trebired package for owning the full `code-server` lifecycle on Linux-first hosts:
6
6
 
7
- The package stays in one lane:
7
+ - resolve the installed `code-server`
8
+ - build launch plans and sandbox-friendly execution specs
9
+ - restore and persist allowlisted profile data
10
+ - launch directly or through transient systemd services
11
+ - supervise readiness and startup failures
12
+ - reuse, stop, restart, and inspect sessions with structured metadata
8
13
 
9
- - resolve the installed `code-server` package root and launch entrypoint
10
- - build standard `code-server` CLI args for host-managed sessions
11
- - expose the launch command and args for your own sandbox or supervisor
12
- - optionally spawn the process and capture stdout and stderr
13
- - wait for the TCP port to become ready with timeout and early-exit handling
14
-
15
- It does not try to be a `code-server` fork, a sandbox manager, a container runtime, or a product layer with app-specific routes and filesystem rules.
14
+ The package stays generic on purpose. It does not know about products, repositories, organizations, users, routes, or app-specific filesystem conventions.
16
15
 
17
16
  ## Install
18
17
 
@@ -22,138 +21,375 @@ Runtime target: Node.js 22+ on Linux first.
22
21
  npm install @trebired/code-server-kit code-server
23
22
  ```
24
23
 
24
+ ## What Host Apps Still Provide
25
+
26
+ After the session runtime layer is in place, host applications mostly choose policy:
27
+
28
+ - `sessionKey`
29
+ - `stateRoot`
30
+ - `workspacePath`
31
+ - `trustedOrigins`
32
+ - `launchStrategy`
33
+ - systemd `scope` when using systemd
34
+ - optional profile roots
35
+ - optional logging and policy hooks
36
+
37
+ The package owns the generic mechanics:
38
+
39
+ - installation resolution
40
+ - entrypoint resolution
41
+ - `node <entry.js>` vs direct executable launch
42
+ - runtime profile directory defaults
43
+ - direct launch vs systemd launch translation
44
+ - readiness probing
45
+ - session reuse checks
46
+ - session metadata persistence
47
+ - startup diagnostics normalization
48
+
25
49
  ## Quick Start
26
50
 
27
51
  ```ts
28
52
  import {
29
- createCodeServerLaunch,
30
- launchCodeServerProcess,
31
- resolveCodeServerInstallation,
32
- waitForCodeServerReady,
53
+ createCodeServerSessionManager,
33
54
  } from "@trebired/code-server-kit";
34
55
 
35
- const installation = resolveCodeServerInstallation({
36
- resolveFrom: process.cwd(),
56
+ const sessions = createCodeServerSessionManager({
57
+ logger: console,
37
58
  });
38
59
 
39
- const launch = await createCodeServerLaunch({
40
- installation,
41
- dataRoot: "/srv/code-server/session-42",
42
- host: "127.0.0.1",
43
- port: 8080,
60
+ const started = await sessions.start({
61
+ launchStrategy: "direct",
62
+ sessionKey: "workspace-42",
63
+ stateRoot: "/srv/code-server-state",
44
64
  trustedOrigins: [
45
65
  "https://app.example.com",
46
66
  ],
47
67
  workspacePath: "/srv/workspaces/demo",
48
68
  });
49
69
 
50
- const processHandle = await launchCodeServerProcess({
51
- plan: launch,
52
- stdout(text) {
53
- process.stdout.write(text);
54
- },
55
- stderr(text) {
56
- process.stderr.write(text);
57
- },
70
+ console.log(started.status.state, started.status.port);
71
+
72
+ const status = await sessions.getStatus({
73
+ sessionKey: "workspace-42",
74
+ stateRoot: "/srv/code-server-state",
58
75
  });
59
76
 
60
- await waitForCodeServerReady({
61
- host: launch.host,
62
- port: launch.port,
63
- process: processHandle,
64
- timeoutMs: 30_000,
77
+ console.log(status?.ready);
78
+
79
+ await sessions.stop({
80
+ sessionKey: "workspace-42",
81
+ stateRoot: "/srv/code-server-state",
65
82
  });
66
83
  ```
67
84
 
68
- ## Public API
85
+ ## Main Session APIs
86
+
87
+ ### `createCodeServerSessionManager(options?)`
88
+
89
+ Creates the main high-level lifecycle object and wires logging through `@trebired/logger-adapter`.
90
+
91
+ Manager methods:
92
+
93
+ - `start(options)`
94
+ - `stop(options)`
95
+ - `restart(options)`
96
+ - `getStatus(options)`
97
+ - `readDiagnostics(options)`
98
+
99
+ ### `startCodeServerSession(options)`
100
+
101
+ One-shot helper that creates a manager and starts a session.
102
+
103
+ Lifecycle-managed session APIs require:
104
+
105
+ - `sessionKey`
106
+ - `stateRoot`
107
+
108
+ Defaults:
109
+
110
+ - `launchStrategy` defaults to `"direct"`
111
+ - reuse defaults to exact normalized spec match
112
+ - `dataRoot` defaults to `stateRoot/sessions/<sessionKey>/runtime`
113
+ - systemd never defaults its scope
114
+
115
+ ### `stopCodeServerSession(options)`
116
+
117
+ Stops a direct child process or a systemd transient unit using the stored session metadata. If profile persistence is configured, the package persists allowlisted profile items after stop.
118
+
119
+ ### `restartCodeServerSession(options)`
120
+
121
+ Runs stop then start with the same session request shape.
122
+
123
+ ### `getCodeServerSessionStatus(options)`
124
+
125
+ Loads the package-owned session record and re-probes the live backing resource instead of trusting disk alone.
126
+
127
+ ### `readCodeServerSessionDiagnostics(options)`
128
+
129
+ Reads the persisted diagnostics snapshot for a session.
130
+
131
+ ## Session Metadata
132
+
133
+ The package stores generic lifecycle metadata under:
134
+
135
+ - `<stateRoot>/sessions/<safe-session-key>/session.json`
136
+ - `<stateRoot>/sessions/<safe-session-key>/diagnostics.json`
137
+
138
+ The session record tracks values such as:
139
+
140
+ - `state`
141
+ - `launchStrategy`
142
+ - `specHash`
143
+ - `bindAddr`
144
+ - `port`
145
+ - `userDataDir`
146
+ - `extensionsDir`
147
+ - `workspacePath`
148
+ - `pid` for direct launches
149
+ - `unitName` and `systemdScope` for systemd launches
150
+ - timestamps and normalized failure details
151
+
152
+ This disk-backed record is what allows the package to reuse, stop, restart, and inspect sessions across calls.
153
+
154
+ ## Reuse Model
155
+
156
+ The package builds a normalized session spec from the effective launch plan plus lifecycle-relevant inputs such as:
157
+
158
+ - launch strategy
159
+ - workspace path
160
+ - trusted origins
161
+ - env overrides
162
+ - profile restore and persist configuration
163
+ - systemd scope and unit naming
164
+
165
+ That normalized spec is hashed and stored. Reuse only happens when:
166
+
167
+ - the same `sessionKey` is used
168
+ - the spec hash matches exactly
169
+ - the backing process or unit still exists
170
+ - the target port becomes ready again
171
+
172
+ If the hash changes, the package marks the old record stale, stops the old runtime when needed, and starts a fresh session.
173
+
174
+ ## Launch Planning APIs
175
+
176
+ The lower-level launch planning APIs remain available for callers that want policy ownership while still avoiding `code-server` package-layout details.
69
177
 
70
178
  ### `resolveCodeServerInstallation(options?)`
71
179
 
72
- Resolves the installed `code-server` package from a caller-controlled starting path and returns:
180
+ Returns installation metadata:
73
181
 
74
182
  - `packageRoot`
75
183
  - `packageJsonPath`
76
184
  - `entryPoint`
185
+ - `entryRelativePath`
77
186
  - `entryKind`
78
187
  - `supportRoot`
79
188
  - `version`
80
189
 
81
- ### `createCodeServerLaunch(options)`
190
+ ### `createCodeServerLaunchPlan(options)`
82
191
 
83
- Builds a stable launch plan and returns:
192
+ Returns a structured launch plan with:
84
193
 
85
194
  - `command`
86
195
  - `args`
87
- - `codeServerPackageRoot`
88
- - `supportRoot`
89
- - `userDataDir`
90
- - `extensionsDir`
196
+ - `cwd`
197
+ - `env`
198
+ - `entryKind`
199
+ - `launchMode`
200
+ - `installation`
91
201
  - `bindAddr`
92
202
  - `host`
93
203
  - `port`
204
+ - `supportRoot`
205
+ - `supportBindings`
206
+ - `recommendedReadablePaths`
207
+ - `recommendedWritablePaths`
208
+ - `userDataDir`
209
+ - `extensionsDir`
94
210
  - `workspacePath`
95
211
 
96
- If you pass `dataRoot`, the package derives:
212
+ ### `createCodeServerLaunchSpec(plan)`
97
213
 
98
- - `${dataRoot}/user-data`
99
- - `${dataRoot}/extensions`
214
+ Converts the launch plan into an execution-oriented shape:
100
215
 
101
- If you omit `port` or pass `0`, the package allocates a free TCP port first.
216
+ - `command`
217
+ - `args`
218
+ - `cwd`
219
+ - `env`
220
+ - `bindings`
221
+ - `readablePaths`
222
+ - `writablePaths`
102
223
 
103
- ### `waitForCodeServerReady(options)`
224
+ This is useful when a host wants to feed the same plan into a container, custom sandbox, or generated unit file.
104
225
 
105
- Polls the target TCP port until it accepts connections or fails with:
226
+ ## Direct Launch
106
227
 
107
- - `CodeServerProcessExitedBeforeReadyError`
108
- - `CodeServerStartupTimeoutError`
228
+ Use the built-in child-process helper when you want a plain process owned by the current Node.js runtime.
109
229
 
110
- ### `launchCodeServerProcess(options)`
230
+ ```ts
231
+ import {
232
+ createCodeServerLaunchPlan,
233
+ launchCodeServerProcess,
234
+ waitForCodeServerReady,
235
+ } from "@trebired/code-server-kit";
111
236
 
112
- Starts the resolved command directly with `stdout` and `stderr` hooks and returns a typed handle with:
237
+ const plan = await createCodeServerLaunchPlan({
238
+ dataRoot: "/srv/code-server/session-42",
239
+ workspacePath: "/srv/workspaces/demo",
240
+ });
113
241
 
114
- - `child`
115
- - `pid`
116
- - `exit`
117
- - `kill()`
118
- - `getStdout()`
119
- - `getStderr()`
242
+ const handle = await launchCodeServerProcess({ plan });
120
243
 
121
- ## Launch Modes
244
+ await waitForCodeServerReady({
245
+ host: plan.host,
246
+ port: plan.port,
247
+ process: handle,
248
+ });
249
+ ```
250
+
251
+ The lifecycle manager uses this same lower-level path internally for `launchStrategy: "direct"`.
252
+
253
+ ## Systemd Launch
254
+
255
+ Linux systemd support is built into the same package and stays explicit.
256
+
257
+ Use `launchStrategy: "systemd"` only when you also provide:
258
+
259
+ - `systemd.scope: "user"` or `"system"`
260
+
261
+ The package uses transient services through `systemd-run`, not scopes.
122
262
 
123
- `createCodeServerLaunch()` supports two concrete launch modes:
263
+ Relevant APIs:
124
264
 
125
- - `node`, which runs `node <entrypoint> ...`
126
- - `direct`, which runs the resolved entrypoint directly when it is executable
265
+ - `launchCodeServerWithSystemd(options)`
266
+ - `stopCodeServerSystemdUnit(options)`
267
+ - `readCodeServerSystemdStatus(options)`
268
+ - `readCodeServerSystemdJournal(options)`
269
+ - `createCodeServerSystemdLaunchCommand(options)`
270
+ - `buildSystemdPathProperties(spec)`
127
271
 
128
- `auto` is the default. It prefers `node` for JS entry files and `direct` for non-JS executables.
272
+ The systemd translation layer derives:
129
273
 
130
- ## Standard CLI Args
274
+ - `--unit`
275
+ - `--working-directory`
276
+ - `--setenv`
277
+ - `BindPaths`
278
+ - `BindReadOnlyPaths`
279
+ - `ReadOnlyPaths`
280
+ - `ReadWritePaths`
131
281
 
132
- The launch plan always includes:
282
+ That means host applications do not need to rebuild transient unit arguments from raw launch-plan data themselves.
133
283
 
134
- - `--auth none`
135
- - `--bind-addr`
136
- - `--disable-telemetry`
137
- - `--disable-update-check`
138
- - `--disable-workspace-trust`
139
- - `--disable-getting-started-override`
140
- - `--user-data-dir`
141
- - `--extensions-dir`
284
+ ## Profile Restore And Persist
142
285
 
143
- Trusted origins are appended with repeated `--trusted-origins` flags, and `workspacePath` is appended as the positional workspace/folder target when provided.
286
+ Profile sync stays allowlist-based rather than copying the entire runtime tree.
144
287
 
145
- ## Dependency vs Peer Dependency for `code-server`
288
+ Supported items:
146
289
 
147
- For an application, prefer a regular `dependency` on `code-server` when you want one installed runtime and want `@trebired/code-server-kit` to resolve the same package reliably every time.
290
+ - `settings.json`
291
+ - `extensions.json`
292
+ - `keybindings.json`
293
+ - `snippets`
294
+ - `extensions`
148
295
 
149
- For a wrapper library on top of this package, prefer a `peerDependency` on `code-server` when the host application must choose the exact `code-server` version and install location itself. In that setup, document that `code-server` must still be resolvable from the host application's dependency tree, and pass `resolveFrom` when you need to anchor resolution to the host side explicitly.
296
+ Lower-level helpers:
150
297
 
151
- ## Error Types
298
+ - `createCodeServerProfileSyncPlan(options)`
299
+ - `syncCodeServerProfile(options)`
300
+ - `resolveCodeServerProfilePathMap(overrides?)`
152
301
 
153
- The package exposes structured errors for the failure modes that usually matter in integration code:
302
+ Lifecycle integration:
154
303
 
155
- - `CodeServerBinaryNotFoundError`
156
- - `CodeServerPackageResolutionError`
304
+ - restore before launch with `profile.restoreFrom`
305
+ - persist after stop with `profile.persistTo`
306
+ - skip missing or unreadable sources cleanly by default
307
+
308
+ Example:
309
+
310
+ ```ts
311
+ await sessions.start({
312
+ profile: {
313
+ items: ["settings.json", "keybindings.json", "extensions"],
314
+ persistTo: "/srv/profiles/demo",
315
+ restoreFrom: "/srv/profiles/demo",
316
+ },
317
+ sessionKey: "workspace-42",
318
+ stateRoot: "/srv/code-server-state",
319
+ workspacePath: "/srv/workspaces/demo",
320
+ });
321
+ ```
322
+
323
+ ## Readiness And Failure Handling
324
+
325
+ ### `waitForCodeServerReady(options)`
326
+
327
+ Waits for the TCP port to accept connections and can also:
328
+
329
+ - fail on startup timeout
330
+ - fail on direct-process early exit
331
+ - fail on a caller-provided failure probe
332
+
333
+ The lifecycle manager builds on this and adds strategy-aware supervision:
334
+
335
+ - direct-process stdout and stderr tails
336
+ - systemd state probing
337
+ - systemd journal collection
338
+ - normalized startup failure metadata
339
+
340
+ ## Structured Errors
341
+
342
+ The package throws structured error classes so callers can log and branch on them reliably.
343
+
344
+ Examples:
345
+
346
+ - `CodeServerInvalidConfigurationError`
347
+ - `CodeServerInstallationResolutionError`
348
+ - `CodeServerEntrypointResolutionError`
349
+ - `CodeServerLaunchPlanningError`
157
350
  - `CodeServerPortAllocationError`
158
- - `CodeServerProcessExitedBeforeReadyError`
159
351
  - `CodeServerStartupTimeoutError`
352
+ - `CodeServerProcessExitedBeforeReadyError`
353
+ - `CodeServerSessionLifecycleError`
354
+ - `CodeServerSessionReuseConflictError`
355
+ - `CodeServerSystemdLaunchError`
356
+ - `CodeServerSystemdCollisionError`
357
+ - `CodeServerSystemdStatusError`
358
+ - `CodeServerSystemdJournalError`
359
+
360
+ Use `normalizeCodeServerStartupFailure(error)` when you want one tagged object shape for logs or API responses.
361
+
362
+ ## Reverse Proxy Helpers
363
+
364
+ The package also includes a few small generic embedding helpers:
365
+
366
+ - `buildForwardedHeaders(options)`
367
+ - `normalizeTrustedOrigin(value)`
368
+ - `isCodeServerHtmlResponse(options)`
369
+
370
+ These helpers stay intentionally small. They do not add product-specific route rewriting.
371
+
372
+ ## Logging
373
+
374
+ High-level APIs accept:
375
+
376
+ - `logger`
377
+ - `loggerAdapter`
378
+
379
+ The package resolves those through `@trebired/logger-adapter`, matching the style used by other `@trebired/*` packages. `createCodeServerSessionManager()` also emits `logPackageInitialized()` on creation.
380
+
381
+ ## `code-server`: Dependency vs Peer Dependency
382
+
383
+ Use `code-server` as a normal `dependency` when:
384
+
385
+ - this package is part of an application deployment
386
+ - you want the runtime to own the exact installed `code-server`
387
+ - you want installation resolution to succeed without extra host setup
388
+
389
+ Use `code-server` as a `peerDependency` in your own higher-level package when:
390
+
391
+ - your package wraps `@trebired/code-server-kit`
392
+ - the final host application should choose the `code-server` version
393
+ - you want to avoid forcing duplicate `code-server` installs across wrappers
394
+
395
+ `@trebired/code-server-kit` itself depends on `code-server` because the generic runtime layer needs a predictable package to resolve.
package/dist/errors.d.ts CHANGED
@@ -1,13 +1,19 @@
1
- type CodeServerKitErrorCode = "binary_not_found" | "package_resolution_failed" | "port_allocation_failed" | "process_exited_before_ready" | "startup_timeout";
1
+ type CodeServerKitErrorCode = "entrypoint_resolution_failed" | "installation_resolution_failed" | "invalid_configuration" | "launch_planning_failed" | "port_allocation_failed" | "process_exited_before_ready" | "session_lifecycle_failed" | "session_reuse_conflict" | "startup_probe_failed" | "startup_timeout" | "systemd_collision" | "systemd_journal_failed" | "systemd_launch_failed" | "systemd_status_failed";
2
2
  declare class CodeServerKitError extends Error {
3
3
  code: CodeServerKitErrorCode | string;
4
4
  details: Record<string, unknown>;
5
5
  constructor(code: CodeServerKitErrorCode | string, message: string, details?: Record<string, unknown>);
6
6
  }
7
- declare class CodeServerBinaryNotFoundError extends CodeServerKitError {
7
+ declare class CodeServerInstallationResolutionError extends CodeServerKitError {
8
8
  constructor(message: string, details?: Record<string, unknown>);
9
9
  }
10
- declare class CodeServerPackageResolutionError extends CodeServerKitError {
10
+ declare class CodeServerEntrypointResolutionError extends CodeServerKitError {
11
+ constructor(message: string, details?: Record<string, unknown>);
12
+ }
13
+ declare class CodeServerLaunchPlanningError extends CodeServerKitError {
14
+ constructor(message: string, details?: Record<string, unknown>);
15
+ }
16
+ declare class CodeServerInvalidConfigurationError extends CodeServerKitError {
11
17
  constructor(message: string, details?: Record<string, unknown>);
12
18
  }
13
19
  declare class CodeServerPortAllocationError extends CodeServerKitError {
@@ -19,7 +25,34 @@ declare class CodeServerProcessExitedBeforeReadyError extends CodeServerKitError
19
25
  declare class CodeServerStartupTimeoutError extends CodeServerKitError {
20
26
  constructor(message: string, details?: Record<string, unknown>);
21
27
  }
28
+ declare class CodeServerStartupProbeError extends CodeServerKitError {
29
+ constructor(message: string, details?: Record<string, unknown>);
30
+ }
31
+ declare class CodeServerSessionLifecycleError extends CodeServerKitError {
32
+ constructor(message: string, details?: Record<string, unknown>);
33
+ }
34
+ declare class CodeServerSessionReuseConflictError extends CodeServerKitError {
35
+ constructor(message: string, details?: Record<string, unknown>);
36
+ }
37
+ declare class CodeServerSystemdLaunchError extends CodeServerKitError {
38
+ constructor(message: string, details?: Record<string, unknown>);
39
+ }
40
+ declare class CodeServerSystemdCollisionError extends CodeServerKitError {
41
+ constructor(message: string, details?: Record<string, unknown>);
42
+ }
43
+ declare class CodeServerSystemdStatusError extends CodeServerKitError {
44
+ constructor(message: string, details?: Record<string, unknown>);
45
+ }
46
+ declare class CodeServerSystemdJournalError extends CodeServerKitError {
47
+ constructor(message: string, details?: Record<string, unknown>);
48
+ }
49
+ declare class CodeServerPackageResolutionError extends CodeServerInstallationResolutionError {
50
+ constructor(message: string, details?: Record<string, unknown>);
51
+ }
52
+ declare class CodeServerBinaryNotFoundError extends CodeServerEntrypointResolutionError {
53
+ constructor(message: string, details?: Record<string, unknown>);
54
+ }
22
55
  declare function isCodeServerKitError(value: unknown): value is CodeServerKitError;
23
- export { CodeServerBinaryNotFoundError, CodeServerKitError, CodeServerPackageResolutionError, CodeServerPortAllocationError, CodeServerProcessExitedBeforeReadyError, CodeServerStartupTimeoutError, isCodeServerKitError, };
56
+ export { CodeServerBinaryNotFoundError, CodeServerEntrypointResolutionError, CodeServerInstallationResolutionError, CodeServerInvalidConfigurationError, CodeServerKitError, CodeServerLaunchPlanningError, CodeServerPackageResolutionError, CodeServerPortAllocationError, CodeServerProcessExitedBeforeReadyError, CodeServerSessionLifecycleError, CodeServerSessionReuseConflictError, CodeServerStartupProbeError, CodeServerStartupTimeoutError, CodeServerSystemdCollisionError, CodeServerSystemdJournalError, CodeServerSystemdLaunchError, CodeServerSystemdStatusError, isCodeServerKitError, };
24
57
  export type { CodeServerKitErrorCode };
25
58
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,KAAK,sBAAsB,GACvB,kBAAkB,GAClB,2BAA2B,GAC3B,wBAAwB,GACxB,6BAA6B,GAC7B,iBAAiB,CAAC;AAEtB,cAAM,kBAAmB,SAAQ,KAAK;IACpC,IAA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rC,mCAAmC,EACnC,kBAAkB,EAClB,6BAA6B,EAC7B,gCAAgC,EAChC,6BAA6B,EAC7B,uCAAuC,EACvC,+BAA+B,EAC/B,mCAAmC,EACnC,2BAA2B,EAC3B,6BAA6B,EAC7B,+BAA+B,EAC/B,6BAA6B,EAC7B,4BAA4B,EAC5B,4BAA4B,EAC5B,oBAAoB,GACrB,CAAC;AACF,YAAY,EAAE,sBAAsB,EAAE,CAAC"}
package/dist/errors.js CHANGED
@@ -6,16 +6,28 @@ class CodeServerKitError extends Error {
6
6
  this.details = details;
7
7
  }
8
8
  }
9
- class CodeServerBinaryNotFoundError extends CodeServerKitError {
9
+ class CodeServerInstallationResolutionError extends CodeServerKitError {
10
10
  constructor(message, details = {}) {
11
- super("binary_not_found", message, details);
12
- this.name = "CodeServerBinaryNotFoundError";
11
+ super("installation_resolution_failed", message, details);
12
+ this.name = "CodeServerInstallationResolutionError";
13
13
  }
14
14
  }
15
- class CodeServerPackageResolutionError extends CodeServerKitError {
15
+ class CodeServerEntrypointResolutionError extends CodeServerKitError {
16
16
  constructor(message, details = {}) {
17
- super("package_resolution_failed", message, details);
18
- this.name = "CodeServerPackageResolutionError";
17
+ super("entrypoint_resolution_failed", message, details);
18
+ this.name = "CodeServerEntrypointResolutionError";
19
+ }
20
+ }
21
+ class CodeServerLaunchPlanningError extends CodeServerKitError {
22
+ constructor(message, details = {}) {
23
+ super("launch_planning_failed", message, details);
24
+ this.name = "CodeServerLaunchPlanningError";
25
+ }
26
+ }
27
+ class CodeServerInvalidConfigurationError extends CodeServerKitError {
28
+ constructor(message, details = {}) {
29
+ super("invalid_configuration", message, details);
30
+ this.name = "CodeServerInvalidConfigurationError";
19
31
  }
20
32
  }
21
33
  class CodeServerPortAllocationError extends CodeServerKitError {
@@ -36,8 +48,62 @@ class CodeServerStartupTimeoutError extends CodeServerKitError {
36
48
  this.name = "CodeServerStartupTimeoutError";
37
49
  }
38
50
  }
51
+ class CodeServerStartupProbeError extends CodeServerKitError {
52
+ constructor(message, details = {}) {
53
+ super("startup_probe_failed", message, details);
54
+ this.name = "CodeServerStartupProbeError";
55
+ }
56
+ }
57
+ class CodeServerSessionLifecycleError extends CodeServerKitError {
58
+ constructor(message, details = {}) {
59
+ super("session_lifecycle_failed", message, details);
60
+ this.name = "CodeServerSessionLifecycleError";
61
+ }
62
+ }
63
+ class CodeServerSessionReuseConflictError extends CodeServerKitError {
64
+ constructor(message, details = {}) {
65
+ super("session_reuse_conflict", message, details);
66
+ this.name = "CodeServerSessionReuseConflictError";
67
+ }
68
+ }
69
+ class CodeServerSystemdLaunchError extends CodeServerKitError {
70
+ constructor(message, details = {}) {
71
+ super("systemd_launch_failed", message, details);
72
+ this.name = "CodeServerSystemdLaunchError";
73
+ }
74
+ }
75
+ class CodeServerSystemdCollisionError extends CodeServerKitError {
76
+ constructor(message, details = {}) {
77
+ super("systemd_collision", message, details);
78
+ this.name = "CodeServerSystemdCollisionError";
79
+ }
80
+ }
81
+ class CodeServerSystemdStatusError extends CodeServerKitError {
82
+ constructor(message, details = {}) {
83
+ super("systemd_status_failed", message, details);
84
+ this.name = "CodeServerSystemdStatusError";
85
+ }
86
+ }
87
+ class CodeServerSystemdJournalError extends CodeServerKitError {
88
+ constructor(message, details = {}) {
89
+ super("systemd_journal_failed", message, details);
90
+ this.name = "CodeServerSystemdJournalError";
91
+ }
92
+ }
93
+ class CodeServerPackageResolutionError extends CodeServerInstallationResolutionError {
94
+ constructor(message, details = {}) {
95
+ super(message, details);
96
+ this.name = "CodeServerPackageResolutionError";
97
+ }
98
+ }
99
+ class CodeServerBinaryNotFoundError extends CodeServerEntrypointResolutionError {
100
+ constructor(message, details = {}) {
101
+ super(message, details);
102
+ this.name = "CodeServerBinaryNotFoundError";
103
+ }
104
+ }
39
105
  function isCodeServerKitError(value) {
40
106
  return value instanceof CodeServerKitError;
41
107
  }
42
- export { CodeServerBinaryNotFoundError, CodeServerKitError, CodeServerPackageResolutionError, CodeServerPortAllocationError, CodeServerProcessExitedBeforeReadyError, CodeServerStartupTimeoutError, isCodeServerKitError, };
108
+ export { CodeServerBinaryNotFoundError, CodeServerEntrypointResolutionError, CodeServerInstallationResolutionError, CodeServerInvalidConfigurationError, CodeServerKitError, CodeServerLaunchPlanningError, CodeServerPackageResolutionError, CodeServerPortAllocationError, CodeServerProcessExitedBeforeReadyError, CodeServerSessionLifecycleError, CodeServerSessionReuseConflictError, CodeServerStartupProbeError, CodeServerStartupTimeoutError, CodeServerSystemdCollisionError, CodeServerSystemdJournalError, CodeServerSystemdLaunchError, CodeServerSystemdStatusError, isCodeServerKitError, };
43
109
  //# sourceMappingURL=errors.js.map