@trebired/code-server-kit 0.3.0 → 1.0.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 +9 -0
- package/README.md +175 -208
- package/dist/diagnostics.d.ts +6 -0
- package/dist/diagnostics.d.ts.map +1 -0
- package/dist/diagnostics.js +150 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/errors.d.ts +5 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +7 -1
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +9 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/dist/plan.d.ts +3 -2
- package/dist/plan.d.ts.map +1 -1
- package/dist/plan.js +68 -68
- package/dist/plan.js.map +1 -1
- package/dist/preparation.d.ts +5 -0
- package/dist/preparation.d.ts.map +1 -0
- package/dist/preparation.js +194 -0
- package/dist/preparation.js.map +1 -0
- package/dist/profile.d.ts +5 -2
- package/dist/profile.d.ts.map +1 -1
- package/dist/profile.js +122 -1
- package/dist/profile.js.map +1 -1
- package/dist/proxy.d.ts +4 -2
- package/dist/proxy.d.ts.map +1 -1
- package/dist/proxy.js +62 -1
- package/dist/proxy.js.map +1 -1
- package/dist/resolve.d.ts.map +1 -1
- package/dist/resolve.js +43 -1
- package/dist/resolve.js.map +1 -1
- package/dist/session.d.ts +2 -2
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +416 -534
- package/dist/session.js.map +1 -1
- package/dist/spec.d.ts +3 -3
- package/dist/spec.d.ts.map +1 -1
- package/dist/spec.js +2 -33
- package/dist/spec.js.map +1 -1
- package/dist/systemd.d.ts +5 -2
- package/dist/systemd.d.ts.map +1 -1
- package/dist/systemd.js +57 -6
- package/dist/systemd.js.map +1 -1
- package/dist/types.d.ts +215 -67
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
- nothing yet
|
|
6
6
|
|
|
7
|
+
## 1.0.0
|
|
8
|
+
|
|
9
|
+
- expand the package from a session helper into a fuller generic `code-server` integration layer
|
|
10
|
+
- add package preparation status and auto-repair helpers for the installed `code-server` dependency
|
|
11
|
+
- add richer integration planning, diagnostics normalization, redaction, and proxy websocket helpers
|
|
12
|
+
- add profile snapshot and deduplicated persistence helpers
|
|
13
|
+
- strengthen session lifecycle ownership with inflight dedup, richer status metadata, and persisted diagnostics
|
|
14
|
+
- expand systemd helpers with restart, journal summarization, and structured failure extraction
|
|
15
|
+
|
|
7
16
|
## 0.3.0
|
|
8
17
|
|
|
9
18
|
- expand the package from launch planning into a full generic `code-server` session runtime
|
package/README.md
CHANGED
|
@@ -1,52 +1,37 @@
|
|
|
1
1
|
# @trebired/code-server-kit
|
|
2
2
|
|
|
3
|
-
Framework-agnostic `code-server`
|
|
3
|
+
Framework-agnostic `code-server` integration layer for Node.js applications.
|
|
4
4
|
|
|
5
|
-
`@trebired/code-server-kit` is the generic Trebired package for owning the
|
|
5
|
+
`@trebired/code-server-kit` is the generic Trebired package for owning the real `code-server` integration lifecycle on Linux-first hosts:
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
7
|
+
- package preparation and bootstrap repair
|
|
8
|
+
- installation and support-root resolution
|
|
9
|
+
- launch and sandbox path planning
|
|
10
|
+
- direct and transient systemd launching
|
|
11
|
+
- session reuse, restart, stop, and status refresh
|
|
12
|
+
- startup diagnostics and redaction
|
|
13
|
+
- allowlisted profile restore and persistence
|
|
14
|
+
- proxy-facing helpers for forwarded and websocket headers
|
|
13
15
|
|
|
14
|
-
The package stays generic on purpose. It does not know about products, repositories, organizations,
|
|
16
|
+
The package stays generic on purpose. It does not know about products, repositories, organizations, routes, or app-specific filesystem conventions.
|
|
15
17
|
|
|
16
18
|
## Install
|
|
17
19
|
|
|
18
20
|
Runtime target: Node.js 22+ on Linux first.
|
|
19
21
|
|
|
20
22
|
```sh
|
|
21
|
-
npm install @trebired/code-server-kit
|
|
23
|
+
npm install @trebired/code-server-kit
|
|
22
24
|
```
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
`code-server` is installed as a normal dependency of this package. A host application only needs a separate direct `code-server` dependency when it intentionally wants to override how resolution happens.
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
## Preferred Flow
|
|
27
29
|
|
|
28
|
-
|
|
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
|
|
30
|
+
The preferred host integration flow is now:
|
|
48
31
|
|
|
49
|
-
|
|
32
|
+
1. Create a session manager.
|
|
33
|
+
2. Start a session with `sessionKey`, `stateRoot`, `workspacePath`, and trusted origins.
|
|
34
|
+
3. Let the package prepare `code-server`, restore profile data, choose launch mechanics, supervise readiness, and persist diagnostics.
|
|
50
35
|
|
|
51
36
|
```ts
|
|
52
37
|
import {
|
|
@@ -58,7 +43,6 @@ const sessions = createCodeServerSessionManager({
|
|
|
58
43
|
});
|
|
59
44
|
|
|
60
45
|
const started = await sessions.start({
|
|
61
|
-
launchStrategy: "direct",
|
|
62
46
|
sessionKey: "workspace-42",
|
|
63
47
|
stateRoot: "/srv/code-server-state",
|
|
64
48
|
trustedOrigins: [
|
|
@@ -82,11 +66,39 @@ await sessions.stop({
|
|
|
82
66
|
});
|
|
83
67
|
```
|
|
84
68
|
|
|
85
|
-
##
|
|
69
|
+
## What The Package Owns
|
|
70
|
+
|
|
71
|
+
High-level APIs now own generic mechanics that host apps previously had to rebuild:
|
|
72
|
+
|
|
73
|
+
- checking whether the installed `code-server` package is fully prepared
|
|
74
|
+
- running the package-owned bootstrap script when preparation is repairable
|
|
75
|
+
- resolving the true entrypoint and support root
|
|
76
|
+
- deriving support-tree read-only bind suggestions
|
|
77
|
+
- deciding `node <entry.js>` vs direct execution
|
|
78
|
+
- preparing profile directories and syncing only allowlisted items
|
|
79
|
+
- handling missing optional native watchdog support with a non-fatal fallback mode
|
|
80
|
+
- deduplicating concurrent starts for the same `sessionKey`
|
|
81
|
+
- reusing healthy sessions when the effective spec still matches
|
|
82
|
+
- invalidating stale sessions and restarting cleanly when the spec changes
|
|
83
|
+
- collecting and sanitizing startup diagnostics
|
|
84
|
+
- translating launch plans into transient systemd unit arguments
|
|
85
|
+
|
|
86
|
+
Host applications mostly provide:
|
|
87
|
+
|
|
88
|
+
- `sessionKey`
|
|
89
|
+
- `stateRoot`
|
|
90
|
+
- `workspacePath`
|
|
91
|
+
- `trustedOrigins`
|
|
92
|
+
- `launchStrategy`
|
|
93
|
+
- systemd `scope` when using systemd
|
|
94
|
+
- optional profile and sanitization policy
|
|
95
|
+
- optional logging
|
|
96
|
+
|
|
97
|
+
## Main High-Level APIs
|
|
86
98
|
|
|
87
99
|
### `createCodeServerSessionManager(options?)`
|
|
88
100
|
|
|
89
|
-
Creates the main
|
|
101
|
+
Creates the main lifecycle object.
|
|
90
102
|
|
|
91
103
|
Manager methods:
|
|
92
104
|
|
|
@@ -98,120 +110,78 @@ Manager methods:
|
|
|
98
110
|
|
|
99
111
|
### `startCodeServerSession(options)`
|
|
100
112
|
|
|
101
|
-
One-shot helper
|
|
102
|
-
|
|
103
|
-
Lifecycle-managed session APIs require:
|
|
104
|
-
|
|
105
|
-
- `sessionKey`
|
|
106
|
-
- `stateRoot`
|
|
113
|
+
One-shot helper around the session manager.
|
|
107
114
|
|
|
108
115
|
Defaults:
|
|
109
116
|
|
|
110
117
|
- `launchStrategy` defaults to `"direct"`
|
|
111
|
-
-
|
|
112
|
-
-
|
|
113
|
-
-
|
|
114
|
-
|
|
115
|
-
|
|
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.
|
|
118
|
+
- preparation defaults to auto-ensure
|
|
119
|
+
- exact-spec inflight starts join each other
|
|
120
|
+
- conflicting inflight starts fail with a structured conflict error
|
|
121
|
+
- profile restore defaults to `"if-missing-or-empty"`
|
|
122
|
+
- profile persist defaults to `"if-changed"`
|
|
122
123
|
|
|
123
124
|
### `getCodeServerSessionStatus(options)`
|
|
124
125
|
|
|
125
|
-
|
|
126
|
+
Returns a refreshed status object with:
|
|
126
127
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
- `state`
|
|
129
|
+
- `health`
|
|
130
|
+
- `ready`
|
|
131
|
+
- `preparation`
|
|
132
|
+
- `watchdogMode`
|
|
133
|
+
- `lastStartSummary`
|
|
134
|
+
- `sanitizedDiagnostics`
|
|
130
135
|
|
|
131
|
-
|
|
136
|
+
### `readCodeServerSessionDiagnostics(options)`
|
|
132
137
|
|
|
133
|
-
|
|
138
|
+
Reads the persisted diagnostics snapshot under:
|
|
134
139
|
|
|
135
140
|
- `<stateRoot>/sessions/<safe-session-key>/session.json`
|
|
136
141
|
- `<stateRoot>/sessions/<safe-session-key>/diagnostics.json`
|
|
137
142
|
|
|
138
|
-
|
|
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.
|
|
143
|
+
## Preparation APIs
|
|
153
144
|
|
|
154
|
-
|
|
145
|
+
### `getCodeServerPreparationStatus(options?)`
|
|
155
146
|
|
|
156
|
-
|
|
147
|
+
Checks whether the installed package looks ready to run and reports:
|
|
157
148
|
|
|
158
|
-
-
|
|
159
|
-
-
|
|
160
|
-
-
|
|
161
|
-
-
|
|
162
|
-
-
|
|
163
|
-
-
|
|
149
|
+
- package root
|
|
150
|
+
- support root
|
|
151
|
+
- bootstrap script path
|
|
152
|
+
- preparation state
|
|
153
|
+
- issues
|
|
154
|
+
- watchdog mode
|
|
164
155
|
|
|
165
|
-
|
|
156
|
+
### `ensureCodeServerPrepared(options?)`
|
|
166
157
|
|
|
167
|
-
- the
|
|
168
|
-
- the spec hash matches exactly
|
|
169
|
-
- the backing process or unit still exists
|
|
170
|
-
- the target port becomes ready again
|
|
158
|
+
Runs the package-owned bootstrap script when the installation is repairable.
|
|
171
159
|
|
|
172
|
-
|
|
160
|
+
Use this explicitly when a host wants a preflight step. Otherwise the session manager runs it automatically.
|
|
173
161
|
|
|
174
162
|
## Launch Planning APIs
|
|
175
163
|
|
|
176
|
-
The lower-level
|
|
164
|
+
The lower-level planning APIs still exist for hosts that want custom execution layers.
|
|
177
165
|
|
|
178
|
-
### `
|
|
166
|
+
### `createCodeServerIntegrationPlan(options)`
|
|
179
167
|
|
|
180
|
-
|
|
168
|
+
This is the preferred lower-level planning API. It returns:
|
|
181
169
|
|
|
182
|
-
- `
|
|
183
|
-
- `
|
|
184
|
-
-
|
|
185
|
-
-
|
|
186
|
-
-
|
|
187
|
-
-
|
|
188
|
-
-
|
|
170
|
+
- final `command` and `args`
|
|
171
|
+
- `cwd` and `env`
|
|
172
|
+
- preparation status
|
|
173
|
+
- support-root bind suggestions
|
|
174
|
+
- readable and writable path suggestions
|
|
175
|
+
- host-visible and sandbox-visible path lists
|
|
176
|
+
- translated path pairs
|
|
189
177
|
|
|
190
178
|
### `createCodeServerLaunchPlan(options)`
|
|
191
179
|
|
|
192
|
-
|
|
193
|
-
|
|
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`
|
|
180
|
+
Compatibility-friendly alias for callers that still want the previous naming. It now routes through the richer integration-plan path.
|
|
211
181
|
|
|
212
182
|
### `createCodeServerLaunchSpec(plan)`
|
|
213
183
|
|
|
214
|
-
Converts the
|
|
184
|
+
Converts the plan into a smaller execution-oriented shape:
|
|
215
185
|
|
|
216
186
|
- `command`
|
|
217
187
|
- `args`
|
|
@@ -221,11 +191,9 @@ Converts the launch plan into an execution-oriented shape:
|
|
|
221
191
|
- `readablePaths`
|
|
222
192
|
- `writablePaths`
|
|
223
193
|
|
|
224
|
-
|
|
194
|
+
## Direct And Systemd Launching
|
|
225
195
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
Use the built-in child-process helper when you want a plain process owned by the current Node.js runtime.
|
|
196
|
+
### Direct
|
|
229
197
|
|
|
230
198
|
```ts
|
|
231
199
|
import {
|
|
@@ -248,42 +216,67 @@ await waitForCodeServerReady({
|
|
|
248
216
|
});
|
|
249
217
|
```
|
|
250
218
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
## Systemd Launch
|
|
219
|
+
### Systemd
|
|
254
220
|
|
|
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.
|
|
221
|
+
Linux-first transient systemd support is built into the same package and stays explicit.
|
|
262
222
|
|
|
263
223
|
Relevant APIs:
|
|
264
224
|
|
|
265
225
|
- `launchCodeServerWithSystemd(options)`
|
|
226
|
+
- `restartCodeServerSystemdUnit(options)`
|
|
266
227
|
- `stopCodeServerSystemdUnit(options)`
|
|
267
228
|
- `readCodeServerSystemdStatus(options)`
|
|
268
229
|
- `readCodeServerSystemdJournal(options)`
|
|
230
|
+
- `summarizeCodeServerSystemdJournal(options)`
|
|
231
|
+
- `extractCodeServerSystemdFailure(options)`
|
|
269
232
|
- `createCodeServerSystemdLaunchCommand(options)`
|
|
270
|
-
- `buildSystemdPathProperties(spec)`
|
|
271
233
|
|
|
272
|
-
|
|
234
|
+
`systemd` launches require an explicit scope:
|
|
235
|
+
|
|
236
|
+
- `scope: "user"`
|
|
237
|
+
- `scope: "system"`
|
|
238
|
+
|
|
239
|
+
There is no package default.
|
|
273
240
|
|
|
274
|
-
|
|
275
|
-
- `--working-directory`
|
|
276
|
-
- `--setenv`
|
|
277
|
-
- `BindPaths`
|
|
278
|
-
- `BindReadOnlyPaths`
|
|
279
|
-
- `ReadOnlyPaths`
|
|
280
|
-
- `ReadWritePaths`
|
|
241
|
+
## Diagnostics And Redaction
|
|
281
242
|
|
|
282
|
-
|
|
243
|
+
### `collectCodeServerStartupDiagnostics(options)`
|
|
283
244
|
|
|
284
|
-
|
|
245
|
+
Builds a structured diagnostic object with:
|
|
285
246
|
|
|
286
|
-
|
|
247
|
+
- category
|
|
248
|
+
- code
|
|
249
|
+
- summary
|
|
250
|
+
- machine-readable details
|
|
251
|
+
- launch strategy
|
|
252
|
+
- watchdog mode
|
|
253
|
+
- stderr and stdout tails
|
|
254
|
+
- systemd journal summary
|
|
255
|
+
|
|
256
|
+
Supported normalized categories include:
|
|
257
|
+
|
|
258
|
+
- `startup_timeout`
|
|
259
|
+
- `process_exited_before_ready`
|
|
260
|
+
- `systemd_launch_failed`
|
|
261
|
+
- `systemd_unit_failed`
|
|
262
|
+
- `entrypoint_resolution_failed`
|
|
263
|
+
- `missing_runtime_dependency`
|
|
264
|
+
- `preparation_failed`
|
|
265
|
+
- `invalid_configuration`
|
|
266
|
+
|
|
267
|
+
### `sanitizeCodeServerDiagnostics(diagnostics, options)`
|
|
268
|
+
|
|
269
|
+
Supports:
|
|
270
|
+
|
|
271
|
+
- path-prefix redaction
|
|
272
|
+
- exact-value redaction
|
|
273
|
+
- a custom replacer hook
|
|
274
|
+
|
|
275
|
+
The package only sanitizes when a host asks for it.
|
|
276
|
+
|
|
277
|
+
## Profile Lifecycle
|
|
278
|
+
|
|
279
|
+
Profile sync stays allowlist-based instead of copying the whole runtime tree.
|
|
287
280
|
|
|
288
281
|
Supported items:
|
|
289
282
|
|
|
@@ -293,56 +286,36 @@ Supported items:
|
|
|
293
286
|
- `snippets`
|
|
294
287
|
- `extensions`
|
|
295
288
|
|
|
296
|
-
Lower-level
|
|
289
|
+
Lower-level APIs:
|
|
297
290
|
|
|
298
291
|
- `createCodeServerProfileSyncPlan(options)`
|
|
299
292
|
- `syncCodeServerProfile(options)`
|
|
300
|
-
- `
|
|
301
|
-
|
|
302
|
-
|
|
293
|
+
- `readCodeServerProfileSnapshot(options)`
|
|
294
|
+
- `readCodeServerProfileSignature(options)`
|
|
295
|
+
- `persistCodeServerProfileIfChanged(options)`
|
|
303
296
|
|
|
304
|
-
-
|
|
305
|
-
- persist after stop with `profile.persistTo`
|
|
306
|
-
- skip missing or unreadable sources cleanly by default
|
|
297
|
+
Session-manager integration now handles:
|
|
307
298
|
|
|
308
|
-
|
|
299
|
+
- restore only when runtime profile data is missing or empty by default
|
|
300
|
+
- persistence only when the allowlisted signature changed by default
|
|
301
|
+
- optional extension snapshotting in the signature
|
|
309
302
|
|
|
310
|
-
|
|
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)`
|
|
303
|
+
## Proxy Helpers
|
|
326
304
|
|
|
327
|
-
|
|
305
|
+
Generic proxy-facing helpers now include:
|
|
328
306
|
|
|
329
|
-
-
|
|
330
|
-
-
|
|
331
|
-
-
|
|
332
|
-
|
|
333
|
-
The lifecycle manager builds on this and adds strategy-aware supervision:
|
|
307
|
+
- `buildForwardedHeaders(options)`
|
|
308
|
+
- `buildCodeServerWebSocketHeaders(options)`
|
|
309
|
+
- `isCodeServerHtmlResponse(options)`
|
|
310
|
+
- `classifyCodeServerProxyFailure(options)`
|
|
334
311
|
|
|
335
|
-
|
|
336
|
-
- systemd state probing
|
|
337
|
-
- systemd journal collection
|
|
338
|
-
- normalized startup failure metadata
|
|
312
|
+
These helpers stay framework-agnostic and do not add product-specific route rewriting.
|
|
339
313
|
|
|
340
314
|
## Structured Errors
|
|
341
315
|
|
|
342
|
-
The package throws structured error classes so callers can log and branch on them reliably.
|
|
343
|
-
|
|
344
316
|
Examples:
|
|
345
317
|
|
|
318
|
+
- `CodeServerPreparationError`
|
|
346
319
|
- `CodeServerInvalidConfigurationError`
|
|
347
320
|
- `CodeServerInstallationResolutionError`
|
|
348
321
|
- `CodeServerEntrypointResolutionError`
|
|
@@ -357,39 +330,33 @@ Examples:
|
|
|
357
330
|
- `CodeServerSystemdStatusError`
|
|
358
331
|
- `CodeServerSystemdJournalError`
|
|
359
332
|
|
|
360
|
-
Use `normalizeCodeServerStartupFailure(error)` when you want one
|
|
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:
|
|
333
|
+
Use `normalizeCodeServerStartupFailure(error)` when you want one consistent structured startup-failure payload.
|
|
375
334
|
|
|
376
|
-
|
|
377
|
-
- `loggerAdapter`
|
|
335
|
+
## Migration Note
|
|
378
336
|
|
|
379
|
-
|
|
337
|
+
Existing host apps should delete generic glue for:
|
|
380
338
|
|
|
381
|
-
|
|
339
|
+
- reading from `node_modules/code-server/...` directly
|
|
340
|
+
- running `code-server` postinstall repair themselves
|
|
341
|
+
- discovering support roots or remapping entrypoints manually
|
|
342
|
+
- building support-tree read-only bind lists manually
|
|
343
|
+
- translating host paths into sandbox-visible `code-server` paths
|
|
344
|
+
- deduplicating concurrent starts for the same session key
|
|
345
|
+
- comparing profile state before persisting
|
|
346
|
+
- parsing raw startup output into user-facing summaries
|
|
347
|
+
- building websocket proxy headers and classifying common upstream failures
|
|
382
348
|
|
|
383
|
-
|
|
349
|
+
Prefer:
|
|
384
350
|
|
|
385
|
-
-
|
|
386
|
-
-
|
|
387
|
-
- you want installation resolution to succeed without extra host setup
|
|
351
|
+
- `createCodeServerSessionManager()`
|
|
352
|
+
- `startCodeServerSession()`
|
|
388
353
|
|
|
389
|
-
|
|
354
|
+
Keep low-level APIs only when you truly need a custom execution layer.
|
|
390
355
|
|
|
391
|
-
|
|
392
|
-
- the final host application should choose the `code-server` version
|
|
393
|
-
- you want to avoid forcing duplicate `code-server` installs across wrappers
|
|
356
|
+
## Intentionally Deferred
|
|
394
357
|
|
|
395
|
-
|
|
358
|
+
- non-Linux lifecycle orchestration
|
|
359
|
+
- container runtime wrappers
|
|
360
|
+
- host-specific sandbox policy
|
|
361
|
+
- Windows and macOS service-management behavior
|
|
362
|
+
- a stronger watchdog strategy than preparation plus disabled-fallback classification, unless future `code-server` versions expose a cleaner supported switch
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CodeServerSanitizedDiagnostics, CodeServerSanitizerOptions, CodeServerStartupDiagnostics, CollectCodeServerStartupDiagnosticsOptions, NormalizedCodeServerStartupFailure } from "./types.js";
|
|
2
|
+
declare function collectCodeServerStartupDiagnostics(options?: CollectCodeServerStartupDiagnosticsOptions): CodeServerStartupDiagnostics;
|
|
3
|
+
declare function sanitizeCodeServerDiagnostics(diagnostics: Pick<CodeServerStartupDiagnostics, "details" | "summary">, options: CodeServerSanitizerOptions): CodeServerSanitizedDiagnostics;
|
|
4
|
+
declare function normalizeCodeServerStartupFailure(error: unknown, options?: Omit<CollectCodeServerStartupDiagnosticsOptions, "error">): NormalizedCodeServerStartupFailure;
|
|
5
|
+
export { collectCodeServerStartupDiagnostics, normalizeCodeServerStartupFailure, sanitizeCodeServerDiagnostics, };
|
|
6
|
+
//# sourceMappingURL=diagnostics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,8BAA8B,EAC9B,0BAA0B,EAC1B,4BAA4B,EAE5B,0CAA0C,EAC1C,kCAAkC,EACnC,MAAM,YAAY,CAAC;AAEpB,iBAAS,mCAAmC,CAAC,OAAO,GAAE,0CAA+C,GAAG,4BAA4B,CAgCnI;AAED,iBAAS,6BAA6B,CACpC,WAAW,EAAE,IAAI,CAAC,4BAA4B,EAAE,SAAS,GAAG,SAAS,CAAC,EACtE,OAAO,EAAE,0BAA0B,GAClC,8BAA8B,CAOhC;AAED,iBAAS,iCAAiC,CACxC,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,IAAI,CAAC,0CAA0C,EAAE,OAAO,CAAM,GACtE,kCAAkC,CAYpC;AAoHD,OAAO,EACL,mCAAmC,EACnC,iCAAiC,EACjC,6BAA6B,GAC9B,CAAC"}
|