@sparkelf/dsh-plus 0.2.8-alpha.50 → 0.2.9-alpha.100

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 (56) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +1 -1
  3. package/README.zh.md +1 -1
  4. package/cordis.patch.yml +29 -7
  5. package/lib/{apply-DmICvIGh.js → apply-CvePS57c.js} +213 -43
  6. package/lib/{apply-08huHfLG.js → apply-DycMqLJO.js} +240 -53
  7. package/lib/apply-c_7SZFSh.js +1193 -0
  8. package/lib/apply.js +2 -2
  9. package/lib/bin.js +20 -319
  10. package/lib/types/apply.d.ts +14 -1
  11. package/lib/types/apply.js +275 -53
  12. package/lib/types/capabilities.js +25 -36
  13. package/lib/types/manifest.d.ts +24 -0
  14. package/lib/types/manifest.js +51 -0
  15. package/lib/types/profile.d.ts +1 -0
  16. package/lib/types/profile.js +14 -3
  17. package/package.json +529 -577
  18. package/patches/approval-allow-policy.patch +3 -3
  19. package/patches/atomic-write-zombie-lock-holder.patch +1 -1
  20. package/patches/bootstrap-exempt-names.patch +6 -6
  21. package/patches/composer-popover-boundaries.patch +41 -283
  22. package/patches/image-offload-hoist-replay.patch +34 -31
  23. package/patches/input-trigger-source-label.patch +63 -0
  24. package/patches/legacy-code-preset.patch +5 -5
  25. package/patches/llm-pi-ai-transport-truncation.patch +4 -4
  26. package/patches/mobile-journal-generation.patch +2 -2
  27. package/patches/office-preview-stable-load.patch +1 -1
  28. package/patches/officecli-deliverables.patch +2 -2
  29. package/patches/ptc-mcp-schema-types.patch +3 -3
  30. package/patches/responses-reasoning-status.patch +197 -48
  31. package/patches/session-controller-image-downgrade-and-tool-visibility.patch +16 -14
  32. package/patches/session-export-chinese.patch +11 -11
  33. package/patches/session-format-legacy-restart.patch +1 -1
  34. package/patches/sidebar-right-tab-menu.patch +119 -0
  35. package/patches/state-dot-brand-blue.patch +2 -2
  36. package/patches/ui-settings-compact-phone.patch +2 -9
  37. package/patches/ui-sidebar-right-global-panel.patch +3 -3
  38. package/patches/workspace-hide-group-rooms.patch +38 -0
  39. package/patches/workspace-storage-restore.patch +21 -5
  40. package/patches/wsl-native-open.patch +8 -8
  41. package/lib/apply-e0aMC4B4.js +0 -601
  42. package/lib/types/standalone-capabilities.d.ts +0 -139
  43. package/lib/types/standalone-capabilities.js +0 -688
  44. package/lib/types/standalone-cli.d.ts +0 -17
  45. package/lib/types/standalone-cli.js +0 -913
  46. package/lib/types/standalone-profile.d.ts +0 -258
  47. package/lib/types/standalone-profile.js +0 -747
  48. package/lib/types/standalone-server.d.ts +0 -70
  49. package/lib/types/standalone-server.js +0 -158
  50. package/patches/browser-auth-mode.patch +0 -127
  51. package/patches/diagram-preview.patch +0 -562
  52. package/patches/dsh-resource-ref-chip.patch +0 -40
  53. package/patches/session-envelope-ignorable.patch +0 -63
  54. package/patches/session-log-trajectory-toolbar.patch +0 -352
  55. package/patches/ui-schedule-plaza-tab.patch +0 -217
  56. package/patches/web-runtime-compat.patch +0 -83
@@ -1,70 +0,0 @@
1
- /**
2
- * Process lifecycle for one standalone Plus server.
3
- *
4
- * A standalone user starts a server and later stops it, so the process outlives the
5
- * command that started it. This module owns the state that makes that possible: a
6
- * pid file beside the profile, an availability probe for the port, and the port
7
- * search that keeps a second instance usable without asking the user to pick one.
8
- */
9
- /** Default port a standalone server binds when the user names none. */
10
- export declare const DEFAULT_PORT = 3080;
11
- /** How many consecutive ports to try before reporting that none is free. */
12
- export declare const PORT_SEARCH_LIMIT = 10;
13
- /** Milliseconds to wait for a stopped server to exit before forcing it. */
14
- export declare const STOP_GRACE_MILLISECONDS = 10000;
15
- /** Recorded state of the running server. */
16
- export interface ServerState {
17
- /** Process id of the running server. */
18
- readonly pid: number;
19
- /** Port the server bound. */
20
- readonly port: number;
21
- /** URL the browser opens. */
22
- readonly url: string;
23
- }
24
- /** Where one installation keeps its runtime state. */
25
- export declare function stateDirectory(home: string): string;
26
- /** Whether a process with this id exists and is signalable. */
27
- export declare function isRunning(pid: number): boolean;
28
- /** Read the recorded server state, or undefined when absent or its process is gone. */
29
- export declare function readState(home: string): ServerState | undefined;
30
- /** Record the running server, replacing any previous record. */
31
- export declare function writeState(home: string, state: ServerState): void;
32
- /** Remove the recorded state, whether or not a process still matches it. */
33
- export declare function clearState(home: string): void;
34
- /** Whether a TCP port on the loopback interface can be bound. */
35
- export declare function portAvailable(port: number, host?: string): Promise<boolean>;
36
- /**
37
- * The first free port at or after `preferred`, so one occupied port never blocks a
38
- * start the way a bare bind failure would.
39
- *
40
- * @param preferred - port the user asked for, or the default.
41
- * @returns the chosen port, or undefined when the whole search window is occupied.
42
- */
43
- export declare function choosePort(preferred: number, host?: string): Promise<number | undefined>;
44
- /** Start a detached server process and return its id. */
45
- export declare function spawnServer(options: {
46
- readonly command: string;
47
- readonly args: readonly string[];
48
- readonly env: NodeJS.ProcessEnv;
49
- readonly logPath: string;
50
- }): number;
51
- /**
52
- * Wait until the server answers, so a start reports success only once the URL works.
53
- *
54
- * @param url - URL to poll.
55
- * @param timeoutMilliseconds - how long to keep polling.
56
- * @returns whether the server answered within the budget.
57
- */
58
- export declare function waitForServer(url: string, timeoutMilliseconds: number): Promise<boolean>;
59
- /**
60
- * Wait until the launcher's log carries the authenticated URL.
61
- *
62
- * Readiness and the printed line are separate events: the server answers before the
63
- * launcher finishes its own startup, so the log is polled here rather than read once.
64
- *
65
- * @param logPath - the launcher's log file.
66
- * @param timeoutMilliseconds - how long to keep polling.
67
- * @returns the printed URL, or undefined when it never appeared.
68
- */
69
- export declare function waitForAuthenticatedUrl(logPath: string, timeoutMilliseconds: number): Promise<string | undefined>;
70
- //# sourceMappingURL=standalone-server.d.ts.map
@@ -1,158 +0,0 @@
1
- /**
2
- * Process lifecycle for one standalone Plus server.
3
- *
4
- * A standalone user starts a server and later stops it, so the process outlives the
5
- * command that started it. This module owns the state that makes that possible: a
6
- * pid file beside the profile, an availability probe for the port, and the port
7
- * search that keeps a second instance usable without asking the user to pick one.
8
- */
9
- import { spawn } from 'node:child_process';
10
- import { createWriteStream, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
11
- import { createServer } from 'node:net';
12
- import { dirname, join } from 'node:path';
13
- /** Default port a standalone server binds when the user names none. */
14
- export const DEFAULT_PORT = 3080;
15
- /** How many consecutive ports to try before reporting that none is free. */
16
- export const PORT_SEARCH_LIMIT = 10;
17
- /** Milliseconds to wait for a stopped server to exit before forcing it. */
18
- export const STOP_GRACE_MILLISECONDS = 10_000;
19
- /** Where one installation keeps its runtime state. */
20
- export function stateDirectory(home) {
21
- return join(home, 'standalone');
22
- }
23
- function statePath(home) {
24
- return join(stateDirectory(home), 'server.json');
25
- }
26
- /** Whether a process with this id exists and is signalable. */
27
- export function isRunning(pid) {
28
- try {
29
- process.kill(pid, 0);
30
- return true;
31
- }
32
- catch {
33
- return false;
34
- }
35
- }
36
- /** Read the recorded server state, or undefined when absent or its process is gone. */
37
- export function readState(home) {
38
- const path = statePath(home);
39
- if (!existsSync(path))
40
- return undefined;
41
- let parsed;
42
- try {
43
- parsed = JSON.parse(readFileSync(path, 'utf8'));
44
- }
45
- catch {
46
- return undefined;
47
- }
48
- if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed))
49
- return undefined;
50
- const record = parsed;
51
- const pid = record.pid;
52
- const port = record.port;
53
- const url = record.url;
54
- if (typeof pid !== 'number' || typeof port !== 'number' || typeof url !== 'string')
55
- return undefined;
56
- if (!isRunning(pid))
57
- return undefined;
58
- return { pid, port, url };
59
- }
60
- /** Record the running server, replacing any previous record. */
61
- export function writeState(home, state) {
62
- mkdirSync(stateDirectory(home), { recursive: true });
63
- writeFileSync(statePath(home), JSON.stringify(state, null, 2) + '\n');
64
- }
65
- /** Remove the recorded state, whether or not a process still matches it. */
66
- export function clearState(home) {
67
- rmSync(statePath(home), { force: true });
68
- }
69
- /** Whether a TCP port on the loopback interface can be bound. */
70
- export function portAvailable(port, host = '127.0.0.1') {
71
- return new Promise((resolveAvailability) => {
72
- const probe = createServer();
73
- probe.once('error', () => { resolveAvailability(false); });
74
- probe.once('listening', () => { probe.close(() => { resolveAvailability(true); }); });
75
- probe.listen(port, host);
76
- });
77
- }
78
- /**
79
- * The first free port at or after `preferred`, so one occupied port never blocks a
80
- * start the way a bare bind failure would.
81
- *
82
- * @param preferred - port the user asked for, or the default.
83
- * @returns the chosen port, or undefined when the whole search window is occupied.
84
- */
85
- export async function choosePort(preferred, host = '127.0.0.1') {
86
- for (let offset = 0; offset < PORT_SEARCH_LIMIT; offset += 1) {
87
- const candidate = preferred + offset;
88
- if (await portAvailable(candidate, host))
89
- return candidate;
90
- }
91
- return undefined;
92
- }
93
- /** Start a detached server process and return its id. */
94
- export function spawnServer(options) {
95
- mkdirSync(dirname(options.logPath), { recursive: true });
96
- const output = spawn(options.command, [...options.args], {
97
- detached: true,
98
- stdio: ['ignore', 'pipe', 'pipe'],
99
- env: options.env,
100
- });
101
- const stream = createWriteStream(options.logPath);
102
- output.stdout.pipe(stream);
103
- output.stderr.pipe(stream);
104
- output.unref();
105
- if (output.pid === undefined)
106
- throw new Error('the server process did not start');
107
- return output.pid;
108
- }
109
- /**
110
- * Wait until the server answers, so a start reports success only once the URL works.
111
- *
112
- * @param url - URL to poll.
113
- * @param timeoutMilliseconds - how long to keep polling.
114
- * @returns whether the server answered within the budget.
115
- */
116
- export async function waitForServer(url, timeoutMilliseconds) {
117
- const deadline = Date.now() + timeoutMilliseconds;
118
- while (Date.now() < deadline) {
119
- try {
120
- await fetch(url, { method: 'GET', redirect: 'manual' });
121
- return true;
122
- }
123
- catch {
124
- await new Promise((resolveDelay) => { setTimeout(resolveDelay, 250); });
125
- }
126
- }
127
- return false;
128
- }
129
- /**
130
- * Wait until the launcher's log carries the authenticated URL.
131
- *
132
- * Readiness and the printed line are separate events: the server answers before the
133
- * launcher finishes its own startup, so the log is polled here rather than read once.
134
- *
135
- * @param logPath - the launcher's log file.
136
- * @param timeoutMilliseconds - how long to keep polling.
137
- * @returns the printed URL, or undefined when it never appeared.
138
- */
139
- export async function waitForAuthenticatedUrl(logPath, timeoutMilliseconds) {
140
- const deadline = Date.now() + timeoutMilliseconds;
141
- for (;;) {
142
- let text = '';
143
- try {
144
- text = readFileSync(logPath, 'utf8');
145
- }
146
- catch {
147
- // The launcher creates the log before it prints, so an absent file is a race
148
- // with its first write rather than an error to report.
149
- }
150
- const found = /dsh web: (http:\/\/\S+)/u.exec(text);
151
- if (found?.[1] !== undefined)
152
- return found[1];
153
- if (Date.now() >= deadline)
154
- return undefined;
155
- await new Promise((resolveDelay) => { setTimeout(resolveDelay, 250); });
156
- }
157
- }
158
- //# sourceMappingURL=standalone-server.js.map
@@ -1,127 +0,0 @@
1
- diff --git a/packages/client/connection/src/browser-auth.ts b/packages/client/connection/src/browser-auth.ts
2
- index 5c8594df6f..e5f5fa9f44 100644
3
- --- a/packages/client/connection/src/browser-auth.ts
4
- +++ b/packages/client/connection/src/browser-auth.ts
5
- @@ -198,12 +198,40 @@ async function initializeSecret(credentials: CredentialProvider): Promise<Buffer
6
- return secret
7
- }
8
-
9
- +/** Browser-session policy selected once while Connection activates. */
10
- +export interface BrowserAuthentication {
11
- + /** Add any authentication input to the clean application URL. */
12
- + authenticatedUrl(baseUrl: string): string
13
- + /** Authorize one frontend index request, owning the response when denied or redirected. */
14
- + authorizeIndex(req: ConnectionIndexRequest, res: ConnectionIndexResponse, secure?: boolean): boolean
15
- + /** Authorize one connect request, owning the response when denied or redirected. */
16
- + authorizeConnect(
17
- + req: ConnectionIndexRequest,
18
- + res: ConnectionIndexResponse,
19
- + secure: boolean,
20
- + publish: (interactions: ConnectionInteractions) => PeerId,
21
- + ): void
22
- + /** Decide whether a trusted Host request has the required browser identity. */
23
- + isAuthenticated(request: ConnectionTrustRequest, secure?: boolean): boolean
24
- + /** Resolve the peer identity of an authenticated API request, or undefined when it is not. */
25
- + authenticateApi(request: ConnectionTrustRequest, secure?: boolean): PeerId | undefined
26
- +}
27
- +
28
- +/** Profile-selected policy that admits every request after the independent Host/Origin fence. */
29
- +export const DISABLED_BROWSER_AUTHENTICATION: BrowserAuthentication = {
30
- + authenticatedUrl: baseUrl => new URL(baseUrl).href,
31
- + authorizeIndex: () => true,
32
- + authorizeConnect: () => undefined,
33
- + isAuthenticated: () => true,
34
- + authenticateApi: () => undefined,
35
- +}
36
- +
37
- /**
38
- * Process launch-token exchange and persistent signed-cookie verification.
39
- * Connection loads the credential provider's signing secret during activation
40
- * and retains it for synchronous request authentication.
41
- */
42
- -export class BrowserAuth {
43
- +export class BrowserAuth implements BrowserAuthentication {
44
- private readonly launchToken: string
45
- private readonly maxAgeMilliseconds: number
46
-
47
- diff --git a/packages/client/connection/src/index.ts b/packages/client/connection/src/index.ts
48
- index d563cd40e8..0c0d2279f8 100644
49
- --- a/packages/client/connection/src/index.ts
50
- +++ b/packages/client/connection/src/index.ts
51
- @@ -10,7 +10,7 @@ import { API_PATH } from './api-path.ts'
52
- import { CONNECT_PATH } from './connect-protocol.ts'
53
- import { bridge, DEFAULT_MAX_REQUEST_BODY_BYTES } from './http-bridge.ts'
54
- import { assertTrustedAuthority } from './api-request-trust.ts'
55
- -import { BrowserAuth } from './browser-auth.ts'
56
- +import { BrowserAuth, DISABLED_BROWSER_AUTHENTICATION } from './browser-auth.ts'
57
- import { HostConnectionService } from './rpc-host.ts'
58
- import { ConnectionRecoveryConfigSchema, resolveConnectionConfig, type ConnectionRecoveryConfig } from './recovery-config.ts'
59
-
60
- @@ -103,6 +103,8 @@ export interface ConnectionConfig {
61
- * an entry here. A non-canonical or non-bare authority fails plugin load.
62
- */
63
- trustedHosts?: string[]
64
- + /** Host API browser identity policy; Host/Origin trust remains independent. Default: `required`. */
65
- + browserAuthentication?: 'required' | 'disabled'
66
- /** Absolute browser and API cookie lifetime in days. Default: 30. */
67
- cookieMaxAgeDays?: number
68
- /** Maximum buffered JSON body for every `/api` request. Default: 300 MiB. */
69
- @@ -112,6 +114,7 @@ export interface ConnectionConfig {
70
- export const Config: z<ConnectionConfig> = z.object({
71
- recovery: ConnectionRecoveryConfigSchema.default({}),
72
- trustedHosts: z.array(String).default([]),
73
- + browserAuthentication: z.union(['required', 'disabled']).default('required'),
74
- cookieMaxAgeDays: z.natural().min(1).default(30),
75
- maxRequestBodyBytes: z.natural().min(1).default(DEFAULT_MAX_REQUEST_BODY_BYTES),
76
- })
77
- @@ -127,16 +130,21 @@ export async function apply(ctx: Context, config?: ConnectionConfig): Promise<vo
78
- const recovery = resolveConnectionConfig(config?.recovery)
79
- // The Loader resolves schema defaults; hand-built test contexts may pass none.
80
- const trustedHosts = config?.trustedHosts ?? []
81
- + const browserAuthentication = config?.browserAuthentication ?? 'required'
82
- const cookieMaxAgeDays = config?.cookieMaxAgeDays ?? 30
83
- const maxRequestBodyBytes = config?.maxRequestBodyBytes ?? DEFAULT_MAX_REQUEST_BODY_BYTES
84
- // Config boundary: a malformed entry fails the load loudly here rather than
85
- // silently authorizing its hostname prefix at request time.
86
- for (const entry of trustedHosts) assertTrustedAuthority(entry)
87
- assertImageBodyCapacity(ctx, maxRequestBodyBytes)
88
- + // 配置在激活时只选择一次策略;disabled不会创建token或credential record。
89
- + const browserAuth = browserAuthentication === 'required'
90
- + ? await BrowserAuth.create(ctx.root, ctx.credentials, cookieMaxAgeDays)
91
- + : DISABLED_BROWSER_AUTHENTICATION
92
- const connection = new HostConnectionService(
93
- ctx,
94
- trustedHosts,
95
- - await BrowserAuth.create(ctx.root, ctx.credentials, cookieMaxAgeDays),
96
- + browserAuth,
97
- )
98
- ctx.inject(['webServer'], (webCtx) => {
99
- assertImageBodyCapacity(webCtx, maxRequestBodyBytes)
100
- diff --git a/packages/client/connection/src/rpc-host.ts b/packages/client/connection/src/rpc-host.ts
101
- index 88e7b48baa..43a3feb74c 100644
102
- --- a/packages/client/connection/src/rpc-host.ts
103
- +++ b/packages/client/connection/src/rpc-host.ts
104
- @@ -13,7 +13,7 @@ import { clientRequestSchema } from './rpc-schema.ts'
105
- import { bridge } from './http-bridge.ts'
106
- import { isRemoteAuthority, isTrustedApiRequest } from './api-request-trust.ts'
107
- import { API_PATH } from './api-path.ts'
108
- -import type { BrowserAuth } from './browser-auth.ts'
109
- +import type { BrowserAuthentication } from './browser-auth.ts'
110
- import { Peer } from './peer.ts'
111
- import type {
112
- PeerAdmission,
113
- @@ -82,12 +82,12 @@ export class HostConnectionService extends Service implements HostConnectionHand
114
- * Provide the Host half over the active HTTP server.
115
- * @param ctx - owning Connection plugin context.
116
- * @param trustedHosts - deployment authorities accepted by the Host/Origin fence.
117
- - * @param browserAuth - process token and persistent browser-session owner.
118
- + * @param browserAuth - profile-selected browser-session policy.
119
- */
120
- constructor(
121
- ctx: Context,
122
- private readonly trustedHosts: readonly string[],
123
- - private readonly browserAuth: BrowserAuth,
124
- + private readonly browserAuth: BrowserAuthentication,
125
- ) {
126
- super(ctx, 'connection')
127
- this.owner = ctx