@sparkelf/dsh-plus 0.2.9-alpha.92 → 0.2.9-alpha.94

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.
@@ -1,83 +0,0 @@
1
- diff --git a/packages/bundle/web-app/src/index.ts b/packages/bundle/web-app/src/index.ts
2
- index b93b5596..8b40aae2 100644
3
- --- a/packages/bundle/web-app/src/index.ts
4
- +++ b/packages/bundle/web-app/src/index.ts
5
- @@ -14,13 +14,14 @@
6
-
7
- import { spawn, type ChildProcess } from 'node:child_process'
8
- import { createRequire } from 'node:module'
9
- +import { networkInterfaces } from 'node:os'
10
- import { dirname, join } from 'node:path'
11
- import type { Context } from '@deepseek-ai/cordis'
12
- import z from '@deepseek-ai/schemastery'
13
- import { auditStartupEntries } from '@deepseek-ai/dsh-app-boot'
14
- import type {} from '@deepseek-ai/dsh-client-connection'
15
- import * as FrontendStatic from '@deepseek-ai/dsh-host-frontend-static'
16
- -import { bindUrlHost, isLoopbackHost } from '@deepseek-ai/dsh-host-webserver'
17
- +import { bindUrlHost, isLoopbackHost, isWildcardHost } from '@deepseek-ai/dsh-host-webserver'
18
- import { launchedThroughSsh, launchEnvironmentOf } from '@deepseek-ai/dsh-launch-environment'
19
- import { scrubbedParentEnv } from '@deepseek-ai/dsh-subprocess'
20
- import type {} from '@deepseek-ai/cordis-plugin-loader'
21
- @@ -70,6 +71,17 @@ export interface Config {
22
- * Absent or YAML `null` advertises the bind-address URL.
23
- */
24
- publicUrl?: string
25
- + /**
26
- + * Non-loopback authorities a deployment serves this GUI on, appended to the
27
- + * sampled LAN literals. The listener's own bind address is accepted
28
- + * separately, so this list carries only what the bind cannot name: a reverse
29
- + * proxy's host, or a public origin a browser actually uses.
30
- + *
31
- + * Superseded by the `connection` row's own `trustedHosts`, which is where a
32
- + * deployment adds authorities today. Kept so a profile layer written against
33
- + * the pre-rename row keeps reaching the host fence.
34
- + */
35
- + trustedHosts?: string[]
36
- }
37
-
38
- export const Config: z<Config> = z.object({
39
- @@ -77,6 +89,7 @@ export const Config: z<Config> = z.object({
40
- printUrl: z.boolean().default(true),
41
- surfaceContext: z.boolean().default(true),
42
- publicUrl: z.transform(z.string(), value => parsePublicUrl(value).href),
43
- + trustedHosts: z.array(String).default([]),
44
- })
45
-
46
- /** Environment variable naming the advertised URL of this Web GUI. */
47
- @@ -204,6 +217,36 @@ export function apply(ctx: Context, config: Config): void {
48
- const appRootUrl = (): string => publicUrl ?? ctx.webServer.getOrigin()
49
- ctx.provide('webApp', { getAdvertisedUrl: appRootUrl } satisfies WebApp)
50
- ctx.plugin(FrontendStatic, { distIndex: internals.resolveDistIndex() })
51
- +
52
- + // WEB_RUNTIME_COMPAT: alpha.2 renamed the bind-dependent service from
53
- + // `webRuntime` to `webStartup` and taught its own rows the new name. A
54
- + // third-party bundle cannot follow the rename: dsh-better-sidebar and
55
- + // dsh-video-preview declare `inject: [..., 'webRuntime', ...]`, and Cordis
56
- + // holds an injected row pending until the named service appears. A deployment
57
- + // that mounts them loses the sidebar routes and the video preview that are the
58
- + // whole reason they are mounted, so the old shape is published beside the new
59
- + // one for as long as those bundles ask for it.
60
- + //
61
- + // The shape is the pre-rename service: LAN literals sampled once from a
62
- + // wildcard bind, then this invocation's and the deployment's own authorities.
63
- + // `webStartup` already carries the flag-supplied half, so it is read rather
64
- + // than re-parsed, and `isWildcardHost` is the webserver's own predicate
65
- + // rather than a string comparison against the IPv4 any-address. This row's
66
- + // `trustedHosts` reaches the fence again here: alpha.2 moved the deployment
67
- + // list to the `connection` row, which leaves a profile layer written against
68
- + // the old row — one that serves a reverse-proxied origin — configuring a key
69
- + // nothing reads.
70
- + const compatLanAddresses = isWildcardHost(boundHost)
71
- + ? Object.values(networkInterfaces()).flat()
72
- + .filter((iface): iface is NonNullable<typeof iface> => iface !== undefined && iface.family === 'IPv4' && !iface.internal)
73
- + .map(iface => iface.address)
74
- + : []
75
- + const compatStartup = ctx.get('webStartup') as { trustedHosts?: readonly string[] } | undefined
76
- + ctx.provide('webRuntime', {
77
- + lanAddresses: compatLanAddresses,
78
- + trustedHosts: [...compatLanAddresses, ...config.trustedHosts ?? [], ...compatStartup?.trustedHosts ?? []],
79
- + })
80
- +
81
- if (config.surfaceContext) {
82
- ctx.inject(['shellEnv'], (runtimeCtx) => {
83
- runtimeCtx.shellEnv.register({