@trebired/code-server-kit 0.2.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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,14 @@
4
4
 
5
5
  - nothing yet
6
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
+
7
15
  ## 0.2.0
8
16
 
9
17
  - add `createCodeServerLaunchPlan()` as the main higher-level launch planning API
package/README.md CHANGED
@@ -1,19 +1,17 @@
1
1
  # @trebired/code-server-kit
2
2
 
3
- Framework-agnostic `code-server` integration helpers for Node.js applications.
3
+ Framework-agnostic `code-server` session runtime for Node.js applications.
4
4
 
5
- `@trebired/code-server-kit` gives host applications a typed, generic layer for resolving an installed `code-server`, building a complete launch plan, waiting for readiness, syncing selected profile data, and preparing the result for direct processes, systemd units, containers, or custom sandboxes.
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
- - describe the final launch command, args, cwd, env, and path-access suggestions
11
- - expose structured errors that host apps can log and branch on
12
- - optionally spawn the process and wait for readiness
13
- - sync allowlisted profile data without copying a whole runtime tree
14
- - help reverse-proxy integrations with trusted-origin and forwarded-header helpers
15
-
16
- 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.
17
15
 
18
16
  ## Install
19
17
 
@@ -23,106 +21,163 @@ Runtime target: Node.js 22+ on Linux first.
23
21
  npm install @trebired/code-server-kit code-server
24
22
  ```
25
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
+
26
49
  ## Quick Start
27
50
 
28
51
  ```ts
29
52
  import {
30
- createCodeServerLaunchPlan,
31
- launchCodeServerProcess,
32
- waitForCodeServerReady,
53
+ createCodeServerSessionManager,
33
54
  } from "@trebired/code-server-kit";
34
55
 
35
- const plan = await createCodeServerLaunchPlan({
36
- dataRoot: "/srv/code-server/session-42",
37
- host: "127.0.0.1",
38
- port: 8080,
56
+ const sessions = createCodeServerSessionManager({
57
+ logger: console,
58
+ });
59
+
60
+ const started = await sessions.start({
61
+ launchStrategy: "direct",
62
+ sessionKey: "workspace-42",
63
+ stateRoot: "/srv/code-server-state",
39
64
  trustedOrigins: [
40
65
  "https://app.example.com",
41
66
  ],
42
67
  workspacePath: "/srv/workspaces/demo",
43
68
  });
44
69
 
45
- const handle = await launchCodeServerProcess({
46
- plan,
47
- stdout(text) {
48
- process.stdout.write(text);
49
- },
50
- stderr(text) {
51
- process.stderr.write(text);
52
- },
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",
53
75
  });
54
76
 
55
- await waitForCodeServerReady({
56
- host: plan.host,
57
- port: plan.port,
58
- process: handle,
59
- timeoutMs: 30_000,
77
+ console.log(status?.ready);
78
+
79
+ await sessions.stop({
80
+ sessionKey: "workspace-42",
81
+ stateRoot: "/srv/code-server-state",
60
82
  });
61
83
  ```
62
84
 
63
- ## Why The Launch Plan Exists
85
+ ## Main Session APIs
64
86
 
65
- Most host apps do not want to know where `code-server` put its real entry file, when to call `node <entry.js>` versus a direct executable, which package directories should be mounted read-only, or which runtime paths must stay writable.
87
+ ### `createCodeServerSessionManager(options?)`
66
88
 
67
- `createCodeServerLaunchPlan()` moves that generic integration work into one reusable contract so host apps can focus on policy instead:
89
+ Creates the main high-level lifecycle object and wires logging through `@trebired/logger-adapter`.
68
90
 
69
- - what workspace should be opened
70
- - which paths should actually be writable in a sandbox
71
- - how processes are supervised
72
- - which users, tokens, or routes exist in the host product
91
+ Manager methods:
73
92
 
74
- ## Main Planning API
93
+ - `start(options)`
94
+ - `stop(options)`
95
+ - `restart(options)`
96
+ - `getStatus(options)`
97
+ - `readDiagnostics(options)`
75
98
 
76
- ### `createCodeServerLaunchPlan(options)`
99
+ ### `startCodeServerSession(options)`
77
100
 
78
- This is the main higher-level API. It returns a structured `CodeServerLaunchPlan` with:
101
+ One-shot helper that creates a manager and starts a session.
79
102
 
80
- - `command`
81
- - `args`
82
- - `cwd`
83
- - `env`
84
- - `entryKind`
85
- - `launchMode`
86
- - `installation`
87
- - `userDataDir`
88
- - `extensionsDir`
89
- - `supportRoot`
90
- - `supportBindings`
91
- - `recommendedReadablePaths`
92
- - `recommendedWritablePaths`
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`
93
143
  - `bindAddr`
94
- - `host`
95
144
  - `port`
96
- - `trustedOrigins`
145
+ - `userDataDir`
146
+ - `extensionsDir`
97
147
  - `workspacePath`
148
+ - `pid` for direct launches
149
+ - `unitName` and `systemdScope` for systemd launches
150
+ - timestamps and normalized failure details
98
151
 
99
- If you pass `dataRoot`, the package derives:
152
+ This disk-backed record is what allows the package to reuse, stop, restart, and inspect sessions across calls.
100
153
 
101
- - `${dataRoot}/user-data`
102
- - `${dataRoot}/extensions`
154
+ ## Reuse Model
103
155
 
104
- If you omit `port` or pass `0`, the package allocates a free TCP port first.
156
+ The package builds a normalized session spec from the effective launch plan plus lifecycle-relevant inputs such as:
105
157
 
106
- Example:
158
+ - launch strategy
159
+ - workspace path
160
+ - trusted origins
161
+ - env overrides
162
+ - profile restore and persist configuration
163
+ - systemd scope and unit naming
107
164
 
108
- ```ts
109
- import { createCodeServerLaunchPlan } from "@trebired/code-server-kit";
165
+ That normalized spec is hashed and stored. Reuse only happens when:
110
166
 
111
- const plan = await createCodeServerLaunchPlan({
112
- dataRoot: "/srv/code-server/session-42",
113
- host: "127.0.0.1",
114
- port: 0,
115
- trustedOrigins: [
116
- "https://app.example.com",
117
- "https://admin.example.com",
118
- ],
119
- workspacePath: "/srv/workspaces/demo",
120
- });
121
- ```
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.
122
177
 
123
178
  ### `resolveCodeServerInstallation(options?)`
124
179
 
125
- Use this lower-level helper when you only need installation metadata:
180
+ Returns installation metadata:
126
181
 
127
182
  - `packageRoot`
128
183
  - `packageJsonPath`
@@ -132,55 +187,51 @@ Use this lower-level helper when you only need installation metadata:
132
187
  - `supportRoot`
133
188
  - `version`
134
189
 
135
- ### `createCodeServerLaunch(options)`
190
+ ### `createCodeServerLaunchPlan(options)`
136
191
 
137
- This remains available as a compatibility-friendly alias for `createCodeServerLaunchPlan()`.
192
+ Returns a structured launch plan with:
138
193
 
139
- ## Launch Specs And Sandbox Helpers
194
+ - `command`
195
+ - `args`
196
+ - `cwd`
197
+ - `env`
198
+ - `entryKind`
199
+ - `launchMode`
200
+ - `installation`
201
+ - `bindAddr`
202
+ - `host`
203
+ - `port`
204
+ - `supportRoot`
205
+ - `supportBindings`
206
+ - `recommendedReadablePaths`
207
+ - `recommendedWritablePaths`
208
+ - `userDataDir`
209
+ - `extensionsDir`
210
+ - `workspacePath`
140
211
 
141
212
  ### `createCodeServerLaunchSpec(plan)`
142
213
 
143
- Converts a launch plan into a smaller execution-oriented shape:
214
+ Converts the launch plan into an execution-oriented shape:
144
215
 
145
216
  - `command`
146
217
  - `args`
147
218
  - `cwd`
148
219
  - `env`
220
+ - `bindings`
149
221
  - `readablePaths`
150
222
  - `writablePaths`
151
- - `bindings`
152
-
153
- This is useful when a caller wants to feed the launch plan into:
154
-
155
- - a direct child-process launch
156
- - a systemd unit generator
157
- - a container wrapper
158
- - a custom sandbox layer
159
223
 
160
- ### `formatCodeServerCommand(planOrSpec)`
224
+ This is useful when a host wants to feed the same plan into a container, custom sandbox, or generated unit file.
161
225
 
162
- Formats the command and arg vector as one safely escaped string for logs, debug output, shell transcripts, or generated unit files.
226
+ ## Direct Launch
163
227
 
164
- ### `normalizeCodeServerStartupFailure(error)`
165
-
166
- Converts package-specific and generic thrown values into one consistent startup-failure shape with:
167
-
168
- - `name`
169
- - `message`
170
- - `code`
171
- - `details`
172
- - `isCodeServerKitError`
173
-
174
- ## Launching Strategies
175
-
176
- ### Direct Child Process
177
-
178
- Use the built-in launcher when you want a plain host-owned child process:
228
+ Use the built-in child-process helper when you want a plain process owned by the current Node.js runtime.
179
229
 
180
230
  ```ts
181
231
  import {
182
232
  createCodeServerLaunchPlan,
183
233
  launchCodeServerProcess,
234
+ waitForCodeServerReady,
184
235
  } from "@trebired/code-server-kit";
185
236
 
186
237
  const plan = await createCodeServerLaunchPlan({
@@ -189,66 +240,52 @@ const plan = await createCodeServerLaunchPlan({
189
240
  });
190
241
 
191
242
  const handle = await launchCodeServerProcess({ plan });
192
- ```
193
243
 
194
- ### Systemd
244
+ await waitForCodeServerReady({
245
+ host: plan.host,
246
+ port: plan.port,
247
+ process: handle,
248
+ });
249
+ ```
195
250
 
196
- Use `createCodeServerLaunchPlan()` or `createCodeServerLaunchSpec()` to generate:
251
+ The lifecycle manager uses this same lower-level path internally for `launchStrategy: "direct"`.
197
252
 
198
- - `ExecStart` from `command` plus `args`
199
- - `WorkingDirectory` from `cwd`
200
- - `Environment` lines from `env`
201
- - read and write path policy from `bindings`, `readablePaths`, and `writablePaths`
253
+ ## Systemd Launch
202
254
 
203
- ### Containers
255
+ Linux systemd support is built into the same package and stays explicit.
204
256
 
205
- Use the launch plan to decide:
257
+ Use `launchStrategy: "systemd"` only when you also provide:
206
258
 
207
- - which package and support paths should be mounted read-only
208
- - which runtime paths should be mounted writable
209
- - the final command and arg vector inside the container
259
+ - `systemd.scope: "user"` or `"system"`
210
260
 
211
- The package does not impose a container layout. It only returns generic path suggestions.
261
+ The package uses transient services through `systemd-run`, not scopes.
212
262
 
213
- ### Custom Sandboxes
263
+ Relevant APIs:
214
264
 
215
- Use `supportBindings`, `recommendedReadablePaths`, and `recommendedWritablePaths` as generic inputs to your own sandbox policy. Host apps can tighten or expand those lists without re-deriving them from package internals.
265
+ - `launchCodeServerWithSystemd(options)`
266
+ - `stopCodeServerSystemdUnit(options)`
267
+ - `readCodeServerSystemdStatus(options)`
268
+ - `readCodeServerSystemdJournal(options)`
269
+ - `createCodeServerSystemdLaunchCommand(options)`
270
+ - `buildSystemdPathProperties(spec)`
216
271
 
217
- ## Readiness Helpers
272
+ The systemd translation layer derives:
218
273
 
219
- ### `waitForCodeServerReady(options)`
274
+ - `--unit`
275
+ - `--working-directory`
276
+ - `--setenv`
277
+ - `BindPaths`
278
+ - `BindReadOnlyPaths`
279
+ - `ReadOnlyPaths`
280
+ - `ReadWritePaths`
220
281
 
221
- Waits for the target TCP port to accept connections and can also:
282
+ That means host applications do not need to rebuild transient unit arguments from raw launch-plan data themselves.
222
283
 
223
- - fail on startup timeout
224
- - fail early if a child process exits first
225
- - run a caller-provided `failureProbe`
284
+ ## Profile Restore And Persist
226
285
 
227
- The readiness helper throws structured errors instead of returning vague booleans.
286
+ Profile sync stays allowlist-based rather than copying the entire runtime tree.
228
287
 
229
- Example:
230
-
231
- ```ts
232
- await waitForCodeServerReady({
233
- host: plan.host,
234
- port: plan.port,
235
- process: handle,
236
- failureProbe({ elapsedMs }) {
237
- if (elapsedMs > 10_000) {
238
- return {
239
- message: "startup looked stalled",
240
- };
241
- }
242
- return null;
243
- },
244
- });
245
- ```
246
-
247
- ## Profile Sync Helpers
248
-
249
- The package now includes generic profile sync helpers built around an allowlist model.
250
-
251
- Supported profile items:
288
+ Supported items:
252
289
 
253
290
  - `settings.json`
254
291
  - `extensions.json`
@@ -256,89 +293,103 @@ Supported profile items:
256
293
  - `snippets`
257
294
  - `extensions`
258
295
 
259
- ### `createCodeServerProfileSyncPlan(options)`
296
+ Lower-level helpers:
260
297
 
261
- Builds a sync plan between two profile roots without copying anything yet.
298
+ - `createCodeServerProfileSyncPlan(options)`
299
+ - `syncCodeServerProfile(options)`
300
+ - `resolveCodeServerProfilePathMap(overrides?)`
262
301
 
263
- ### `syncCodeServerProfile(options)`
302
+ Lifecycle integration:
264
303
 
265
- Copies only the allowlisted profile items. By default it skips missing or unreadable sources cleanly instead of assuming full access to every runtime-owned path.
304
+ - restore before launch with `profile.restoreFrom`
305
+ - persist after stop with `profile.persistTo`
306
+ - skip missing or unreadable sources cleanly by default
266
307
 
267
308
  Example:
268
309
 
269
310
  ```ts
270
- import { syncCodeServerProfile } from "@trebired/code-server-kit";
271
-
272
- const result = await syncCodeServerProfile({
273
- sourceDir: "/srv/persisted-profile",
274
- targetDir: "/srv/runtime-profile",
275
- items: ["settings.json", "snippets", "extensions"],
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",
276
320
  });
277
-
278
- console.log(result.copied.length, result.skipped.length);
279
321
  ```
280
322
 
281
- Default relative paths are also exported through `DEFAULT_CODE_SERVER_PROFILE_PATHS`, and callers can override them when needed through `pathMap`.
282
-
283
- ## Reverse Proxy Helpers
284
-
285
- ### `normalizeTrustedOrigins(origins)`
286
-
287
- Normalizes absolute origins for launch planning and rejects invalid values clearly.
323
+ ## Readiness And Failure Handling
288
324
 
289
- ### `normalizeTrustedOrigin(origin)`
290
-
291
- Normalizes one origin value.
292
-
293
- ### `buildForwardedHeaders(options)`
325
+ ### `waitForCodeServerReady(options)`
294
326
 
295
- Builds a small forwarded-header record for reverse-proxy embedding.
327
+ Waits for the TCP port to accept connections and can also:
296
328
 
297
- ### `isCodeServerHtmlResponse(options)`
329
+ - fail on startup timeout
330
+ - fail on direct-process early exit
331
+ - fail on a caller-provided failure probe
298
332
 
299
- Returns `true` when a response looks like HTML that a host app may want to transform before returning it to a browser.
333
+ The lifecycle manager builds on this and adds strategy-aware supervision:
300
334
 
301
- This helper is intentionally narrow. It does not rewrite routes or inject product-specific markup.
335
+ - direct-process stdout and stderr tails
336
+ - systemd state probing
337
+ - systemd journal collection
338
+ - normalized startup failure metadata
302
339
 
303
340
  ## Structured Errors
304
341
 
305
- The package exposes structured error classes so host apps can log clearly and branch reliably:
342
+ The package throws structured error classes so callers can log and branch on them reliably.
343
+
344
+ Examples:
306
345
 
346
+ - `CodeServerInvalidConfigurationError`
307
347
  - `CodeServerInstallationResolutionError`
308
348
  - `CodeServerEntrypointResolutionError`
309
349
  - `CodeServerLaunchPlanningError`
310
- - `CodeServerInvalidConfigurationError`
311
350
  - `CodeServerPortAllocationError`
312
- - `CodeServerProcessExitedBeforeReadyError`
313
- - `CodeServerStartupProbeError`
314
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:
315
375
 
316
- The earlier compatibility exports are still available:
376
+ - `logger`
377
+ - `loggerAdapter`
317
378
 
318
- - `CodeServerPackageResolutionError`
319
- - `CodeServerBinaryNotFoundError`
379
+ The package resolves those through `@trebired/logger-adapter`, matching the style used by other `@trebired/*` packages. `createCodeServerSessionManager()` also emits `logPackageInitialized()` on creation.
320
380
 
321
- ## Public Surface
381
+ ## `code-server`: Dependency vs Peer Dependency
322
382
 
323
- The current API is centered around these exports:
383
+ Use `code-server` as a normal `dependency` when:
324
384
 
325
- - `resolveCodeServerInstallation()`
326
- - `createCodeServerLaunchPlan()`
327
- - `createCodeServerLaunch()`
328
- - `createCodeServerLaunchSpec()`
329
- - `launchCodeServerProcess()`
330
- - `waitForCodeServerReady()`
331
- - `createCodeServerProfileSyncPlan()`
332
- - `syncCodeServerProfile()`
333
- - `buildForwardedHeaders()`
334
- - `normalizeTrustedOrigins()`
335
- - `normalizeTrustedOrigin()`
336
- - `isCodeServerHtmlResponse()`
337
- - `formatCodeServerCommand()`
338
- - `normalizeCodeServerStartupFailure()`
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
339
388
 
340
- ## Dependency vs Peer Dependency for `code-server`
389
+ Use `code-server` as a `peerDependency` in your own higher-level package when:
341
390
 
342
- 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.
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
343
394
 
344
- 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.
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,4 +1,4 @@
1
- type CodeServerKitErrorCode = "entrypoint_resolution_failed" | "installation_resolution_failed" | "invalid_configuration" | "launch_planning_failed" | "port_allocation_failed" | "process_exited_before_ready" | "startup_probe_failed" | "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>;
@@ -28,6 +28,24 @@ declare class CodeServerStartupTimeoutError extends CodeServerKitError {
28
28
  declare class CodeServerStartupProbeError extends CodeServerKitError {
29
29
  constructor(message: string, details?: Record<string, unknown>);
30
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
+ }
31
49
  declare class CodeServerPackageResolutionError extends CodeServerInstallationResolutionError {
32
50
  constructor(message: string, details?: Record<string, unknown>);
33
51
  }
@@ -35,6 +53,6 @@ declare class CodeServerBinaryNotFoundError extends CodeServerEntrypointResoluti
35
53
  constructor(message: string, details?: Record<string, unknown>);
36
54
  }
37
55
  declare function isCodeServerKitError(value: unknown): value is CodeServerKitError;
38
- export { CodeServerBinaryNotFoundError, CodeServerEntrypointResolutionError, CodeServerInstallationResolutionError, CodeServerInvalidConfigurationError, CodeServerKitError, CodeServerLaunchPlanningError, CodeServerPackageResolutionError, CodeServerPortAllocationError, CodeServerProcessExitedBeforeReadyError, CodeServerStartupProbeError, CodeServerStartupTimeoutError, isCodeServerKitError, };
56
+ export { CodeServerBinaryNotFoundError, CodeServerEntrypointResolutionError, CodeServerInstallationResolutionError, CodeServerInvalidConfigurationError, CodeServerKitError, CodeServerLaunchPlanningError, CodeServerPackageResolutionError, CodeServerPortAllocationError, CodeServerProcessExitedBeforeReadyError, CodeServerSessionLifecycleError, CodeServerSessionReuseConflictError, CodeServerStartupProbeError, CodeServerStartupTimeoutError, CodeServerSystemdCollisionError, CodeServerSystemdJournalError, CodeServerSystemdLaunchError, CodeServerSystemdStatusError, isCodeServerKitError, };
39
57
  export type { CodeServerKitErrorCode };
40
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,8BAA8B,GAC9B,gCAAgC,GAChC,uBAAuB,GACvB,wBAAwB,GACxB,wBAAwB,GACxB,6BAA6B,GAC7B,sBAAsB,GACtB,iBAAiB,CAAC;AAEtB,cAAM,kBAAmB,SAAQ,KAAK;IACpC,IAAI,EAAE,sBAAsB,GAAG,MAAM,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAErB,IAAI,EAAE,sBAAsB,GAAG,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;CAM1G;AAED,cAAM,qCAAsC,SAAQ,kBAAkB;gBACxD,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;CAInE;AAED,cAAM,mCAAoC,SAAQ,kBAAkB;gBACtD,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;CAIn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