better-dsh 0.3.0-e → 0.3.0-g
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/README.md +12 -11
- package/cordis.patch.yml +1 -29
- package/docs/adr/0015-independent-bundles-agent-remote.md +40 -0
- package/docs/remote-tools.md +52 -0
- package/docs/specs/remote-tool-enhancement/spec.md +203 -0
- package/lib/{LaunchOptions-DXdeJis3.js → LaunchOptions-CLEBmZeM.js} +1 -1
- package/lib/LaunchOptions-CjYFNZFS.js +4 -0
- package/lib/{bidi-CwtLGgcA.js → bidi-Bs8owg1e.js} +1 -1
- package/lib/client/index.js +23 -0
- package/lib/{index-browser-Bp3vxHC3.js → index-browser-pHtsz007.js} +4 -4
- package/lib/{main-CKFNYpqT.js → main-CBC7_uE-.js} +4 -2
- package/lib/{main-BXwPLuYr.js → main-RqgDOjH9.js} +1 -1
- package/lib/mobile/plugin.d.ts +1 -1
- package/lib/{puppeteer-core-Bliv_vNf.js → puppeteer-core-DnI7gBFU.js} +5 -5
- package/lib/remote/plugin.d.ts +427 -5
- package/lib/remote/plugin.js +3106 -209
- package/lib/url-schemes/index.d.ts +11 -11
- package/lib/url-schemes/index.js +3 -3
- package/lib/web-password.d.ts +7 -7
- package/lib/web-password.js +1 -1
- package/lib/{web-trust-C_Y6o8Z2.d.ts → web-trust-RwK0P74B.d.ts} +11 -11
- package/lib/web-trust.d.ts +1 -1
- package/lib/welcome-notice.d.ts +5 -7
- package/lib/welcome-notice.js +9 -48
- package/package.json +3 -11
- package/lib/LaunchOptions-3peHoOAx.js +0 -4
- package/lib/hmr.d.ts +0 -32
- package/lib/hmr.js +0 -49
- package/lib/webserver.d.ts +0 -10
- package/lib/webserver.js +0 -19
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Context } from "@deepseek-ai/cordis";
|
|
2
2
|
import { ToolDefinition } from "@deepseek-ai/dsh-tools";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _deepseek_ai_schemastery1 from "@deepseek-ai/schemastery";
|
|
4
4
|
|
|
5
5
|
//#region src/url-schemes/tools/write.d.ts
|
|
6
6
|
|
|
@@ -50,12 +50,12 @@ declare const inject: string[];
|
|
|
50
50
|
* real patch-line config. Schema-level defaults (both ON — the service is
|
|
51
51
|
* opt-out) survive every overlay layer, per the v0.2.2a ruling.
|
|
52
52
|
*/
|
|
53
|
-
declare const Config:
|
|
54
|
-
urlSchemes:
|
|
55
|
-
hashline:
|
|
53
|
+
declare const Config: _deepseek_ai_schemastery1.default<Schemastery.ObjectS<NoInfer<{
|
|
54
|
+
urlSchemes: _deepseek_ai_schemastery1.default<boolean, boolean, "defined">;
|
|
55
|
+
hashline: _deepseek_ai_schemastery1.default<boolean, boolean, "defined">;
|
|
56
56
|
}>>, Schemastery.ObjectT<NoInfer<{
|
|
57
|
-
urlSchemes:
|
|
58
|
-
hashline:
|
|
57
|
+
urlSchemes: _deepseek_ai_schemastery1.default<boolean, boolean, "defined">;
|
|
58
|
+
hashline: _deepseek_ai_schemastery1.default<boolean, boolean, "defined">;
|
|
59
59
|
}>>, "plain">;
|
|
60
60
|
/** Register the four URL-aware tools on one agent's own scope layer. */
|
|
61
61
|
/**
|
|
@@ -75,12 +75,12 @@ declare function apply(ctx: Context, config: UrlSchemesConfig | undefined): void
|
|
|
75
75
|
declare const _default: {
|
|
76
76
|
name: string;
|
|
77
77
|
inject: string[];
|
|
78
|
-
Config:
|
|
79
|
-
urlSchemes:
|
|
80
|
-
hashline:
|
|
78
|
+
Config: _deepseek_ai_schemastery1.default<Schemastery.ObjectS<NoInfer<{
|
|
79
|
+
urlSchemes: _deepseek_ai_schemastery1.default<boolean, boolean, "defined">;
|
|
80
|
+
hashline: _deepseek_ai_schemastery1.default<boolean, boolean, "defined">;
|
|
81
81
|
}>>, Schemastery.ObjectT<NoInfer<{
|
|
82
|
-
urlSchemes:
|
|
83
|
-
hashline:
|
|
82
|
+
urlSchemes: _deepseek_ai_schemastery1.default<boolean, boolean, "defined">;
|
|
83
|
+
hashline: _deepseek_ai_schemastery1.default<boolean, boolean, "defined">;
|
|
84
84
|
}>>, "plain">;
|
|
85
85
|
apply: typeof apply;
|
|
86
86
|
};
|
package/lib/url-schemes/index.js
CHANGED
|
@@ -6,7 +6,6 @@ import { a as createHttpHandler, c as listDvcDevices, d as UrlResolver, f as Url
|
|
|
6
6
|
import { n as Parser } from "../web-tree-sitter-CPrPD4J2.js";
|
|
7
7
|
import { a as primaryServerForFile, c as serversForFile, n as findWorkspaceRoot, o as resolveCommandPath, r as installHintFor, s as serverByName } from "../lsp-server-registry-D4VLs1Sm.js";
|
|
8
8
|
import { createRequire } from "node:module";
|
|
9
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
10
9
|
import { createHash, randomUUID } from "node:crypto";
|
|
11
10
|
import { accessSync, constants, existsSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
12
11
|
import * as path$1 from "node:path";
|
|
@@ -16,13 +15,14 @@ import { homedir, tmpdir } from "node:os";
|
|
|
16
15
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
17
16
|
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
18
17
|
import * as fsPromises from "node:fs/promises";
|
|
19
|
-
import { mkdir, mkdtemp, readFile, readdir, rename, rm, stat, unlink, writeFile } from "node:fs/promises";
|
|
18
|
+
import { lstat, mkdir, mkdtemp, readFile, readdir, readlink, rename, rm, stat, unlink, writeFile } from "node:fs/promises";
|
|
20
19
|
import { FsError } from "@deepseek-ai/dsh-fs";
|
|
21
20
|
import { ESCALATION_TARGETS, approveEscalation, escalationHintMarker, sandboxDenialMarker, validateEscalationArgs } from "@deepseek-ai/dsh-sandbox";
|
|
22
21
|
import { gunzipSync } from "node:zlib";
|
|
23
22
|
import { SessionId } from "@deepseek-ai/dsh-session";
|
|
24
23
|
import { resolveDshHome } from "@deepseek-ai/dsh-home-paths";
|
|
25
24
|
import { DatabaseSync } from "node:sqlite";
|
|
25
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
26
26
|
|
|
27
27
|
//#region src/devices/ast/engine/grammar-manifest.mjs
|
|
28
28
|
/**
|
|
@@ -1435,7 +1435,7 @@ const PUPPETEER_CORE_VERSION = "25.3.0";
|
|
|
1435
1435
|
*/
|
|
1436
1436
|
async function loadPuppeteer() {
|
|
1437
1437
|
if (puppeteerModule === void 0) try {
|
|
1438
|
-
puppeteerModule = await import("../puppeteer-core-
|
|
1438
|
+
puppeteerModule = await import("../puppeteer-core-DnI7gBFU.js");
|
|
1439
1439
|
} catch {
|
|
1440
1440
|
try {
|
|
1441
1441
|
puppeteerModule = await import(pathToFileURL((await ensureVendored({
|
package/lib/web-password.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Context } from "@deepseek-ai/cordis";
|
|
2
2
|
import { CredentialRecord } from "@deepseek-ai/dsh-credentials";
|
|
3
3
|
import { IncomingMessage } from "node:http";
|
|
4
|
-
import * as
|
|
4
|
+
import * as _deepseek_ai_schemastery21 from "@deepseek-ai/schemastery";
|
|
5
5
|
|
|
6
6
|
//#region src/web-password.d.ts
|
|
7
7
|
|
|
@@ -123,10 +123,10 @@ interface WebPasswordConfig {
|
|
|
123
123
|
/** Absolute browser-session lifetime in days. Default: 30 (the native default). */
|
|
124
124
|
cookieMaxAgeDays?: number;
|
|
125
125
|
}
|
|
126
|
-
declare const Config:
|
|
127
|
-
cookieMaxAgeDays:
|
|
126
|
+
declare const Config: _deepseek_ai_schemastery21.default<Schemastery.ObjectS<NoInfer<{
|
|
127
|
+
cookieMaxAgeDays: _deepseek_ai_schemastery21.default<number, number, "defined">;
|
|
128
128
|
}>>, Schemastery.ObjectT<NoInfer<{
|
|
129
|
-
cookieMaxAgeDays:
|
|
129
|
+
cookieMaxAgeDays: _deepseek_ai_schemastery21.default<number, number, "defined">;
|
|
130
130
|
}>>, "plain">;
|
|
131
131
|
/** Cordis plugin name; also the scope of this row's credential record. */
|
|
132
132
|
declare const name = "dashr-web-password";
|
|
@@ -145,10 +145,10 @@ declare function apply(ctx: Context, config?: WebPasswordConfig): void;
|
|
|
145
145
|
declare const _default: {
|
|
146
146
|
name: string;
|
|
147
147
|
inject: string[];
|
|
148
|
-
Config:
|
|
149
|
-
cookieMaxAgeDays:
|
|
148
|
+
Config: _deepseek_ai_schemastery21.default<Schemastery.ObjectS<NoInfer<{
|
|
149
|
+
cookieMaxAgeDays: _deepseek_ai_schemastery21.default<number, number, "defined">;
|
|
150
150
|
}>>, Schemastery.ObjectT<NoInfer<{
|
|
151
|
-
cookieMaxAgeDays:
|
|
151
|
+
cookieMaxAgeDays: _deepseek_ai_schemastery21.default<number, number, "defined">;
|
|
152
152
|
}>>, "plain">;
|
|
153
153
|
apply: typeof apply;
|
|
154
154
|
};
|
package/lib/web-password.js
CHANGED
|
@@ -335,7 +335,7 @@ async function resolveDistIndex() {
|
|
|
335
335
|
* @returns the markup with `<base href="./">` after the head open tag.
|
|
336
336
|
*/
|
|
337
337
|
function withBaseHref(html) {
|
|
338
|
-
return html.replace(/<head(?:\s[^>]*)?>/i, (open) => `${open}<base href="./">`);
|
|
338
|
+
return html.replace(/<head(?:\s[^>]*)?>/i, (open$1) => `${open$1}<base href="./">`);
|
|
339
339
|
}
|
|
340
340
|
/**
|
|
341
341
|
* The root-route gate: one exact `/` handler owning the door, and the only
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Context } from "@deepseek-ai/cordis";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _deepseek_ai_schemastery11 from "@deepseek-ai/schemastery";
|
|
3
3
|
|
|
4
4
|
//#region src/web-trust.d.ts
|
|
5
5
|
|
|
@@ -76,12 +76,12 @@ interface TrustConfig {
|
|
|
76
76
|
trustedPageAuthorities?: readonly string[];
|
|
77
77
|
}
|
|
78
78
|
/** Row config schema (schema-level default derives from `DSH_TRUSTED_HOSTS`). */
|
|
79
|
-
declare const Config:
|
|
80
|
-
trustAllHosts:
|
|
81
|
-
trustedPageAuthorities:
|
|
79
|
+
declare const Config: _deepseek_ai_schemastery11.default<Schemastery.ObjectS<NoInfer<{
|
|
80
|
+
trustAllHosts: _deepseek_ai_schemastery11.default<boolean, boolean, "defined">;
|
|
81
|
+
trustedPageAuthorities: _deepseek_ai_schemastery11.default<string[], string[], "defined">;
|
|
82
82
|
}>>, Schemastery.ObjectT<NoInfer<{
|
|
83
|
-
trustAllHosts:
|
|
84
|
-
trustedPageAuthorities:
|
|
83
|
+
trustAllHosts: _deepseek_ai_schemastery11.default<boolean, boolean, "defined">;
|
|
84
|
+
trustedPageAuthorities: _deepseek_ai_schemastery11.default<string[], string[], "defined">;
|
|
85
85
|
}>>, "plain">;
|
|
86
86
|
/** Cordis plugin name. */
|
|
87
87
|
declare const name = "dashr-web-trust";
|
|
@@ -100,12 +100,12 @@ declare function apply(ctx: Context, config: TrustConfig | undefined): void;
|
|
|
100
100
|
declare const _default: {
|
|
101
101
|
name: string;
|
|
102
102
|
inject: string[];
|
|
103
|
-
Config:
|
|
104
|
-
trustAllHosts:
|
|
105
|
-
trustedPageAuthorities:
|
|
103
|
+
Config: _deepseek_ai_schemastery11.default<Schemastery.ObjectS<NoInfer<{
|
|
104
|
+
trustAllHosts: _deepseek_ai_schemastery11.default<boolean, boolean, "defined">;
|
|
105
|
+
trustedPageAuthorities: _deepseek_ai_schemastery11.default<string[], string[], "defined">;
|
|
106
106
|
}>>, Schemastery.ObjectT<NoInfer<{
|
|
107
|
-
trustAllHosts:
|
|
108
|
-
trustedPageAuthorities:
|
|
107
|
+
trustAllHosts: _deepseek_ai_schemastery11.default<boolean, boolean, "defined">;
|
|
108
|
+
trustedPageAuthorities: _deepseek_ai_schemastery11.default<string[], string[], "defined">;
|
|
109
109
|
}>>, "plain">;
|
|
110
110
|
apply: typeof apply;
|
|
111
111
|
};
|
package/lib/web-trust.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as _default, c as buildTrustScript, d as name, i as TrustConfig, l as deriveDefaultPageAuthorities, n as Config, o as apply, r as MobileConfig, s as buildMobileScript, t as BootScriptRow, u as inject } from "./web-trust-
|
|
1
|
+
import { a as _default, c as buildTrustScript, d as name, i as TrustConfig, l as deriveDefaultPageAuthorities, n as Config, o as apply, r as MobileConfig, s as buildMobileScript, t as BootScriptRow, u as inject } from "./web-trust-RwK0P74B.js";
|
|
2
2
|
export { BootScriptRow, Config, MobileConfig, TrustConfig, apply, buildMobileScript, buildTrustScript, _default as default, deriveDefaultPageAuthorities, inject, name };
|
package/lib/welcome-notice.d.ts
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
import * as _deepseek_ai_schemastery0 from "@deepseek-ai/schemastery";
|
|
2
3
|
|
|
3
4
|
//#region src/welcome-notice.d.ts
|
|
4
5
|
declare const name = "dashr-welcome-notice";
|
|
5
6
|
declare const inject: string[];
|
|
6
|
-
|
|
7
|
-
declare function
|
|
8
|
-
/** Resolve from the owning DSH installation, never from this plugin's build dependencies. */
|
|
9
|
-
declare function readHostWelcomeVersion(installAnchor: string): string;
|
|
10
|
-
/** Keep the original settings namespace and native UI; project policy before startup settles. */
|
|
11
|
-
declare function apply(ctx: Context): Promise<(() => Promise<void>) | undefined>;
|
|
7
|
+
declare const Config: _deepseek_ai_schemastery0.default<NoInfer<Schemastery.ObjectS<{}>>, NoInfer<Schemastery.ObjectT<{}>>, "volatile">;
|
|
8
|
+
declare function apply(ctx: Context): void;
|
|
12
9
|
declare const _default: {
|
|
13
10
|
name: string;
|
|
14
11
|
inject: string[];
|
|
12
|
+
Config: _deepseek_ai_schemastery0.default<NoInfer<Schemastery.ObjectS<{}>>, NoInfer<Schemastery.ObjectT<{}>>, "volatile">;
|
|
15
13
|
apply: typeof apply;
|
|
16
14
|
};
|
|
17
15
|
//#endregion
|
|
18
|
-
export { apply, _default as default, inject, name
|
|
16
|
+
export { Config, apply, _default as default, inject, name };
|
package/lib/welcome-notice.js
CHANGED
|
@@ -1,59 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { readFileSync } from "node:fs";
|
|
1
|
+
import { t as Schema } from "./lib-C8_jXvwA.js";
|
|
3
2
|
|
|
4
3
|
//#region src/welcome-notice.ts
|
|
5
4
|
const name = "dashr-welcome-notice";
|
|
6
|
-
const inject = [
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (values.length !== 1) throw new Error("dashr-welcome-notice: expected one WELCOME_NOTICE_VERSION in the installed Models client; check the upstream bundle layout or disable this entry");
|
|
13
|
-
return values[0][2];
|
|
14
|
-
}
|
|
15
|
-
/** Resolve from the owning DSH installation, never from this plugin's build dependencies. */
|
|
16
|
-
function readHostWelcomeVersion(installAnchor) {
|
|
17
|
-
return parseWelcomeVersion(readFileSync(createRequire(createRequire(installAnchor).resolve("@deepseek-ai/dsh-web-app/package.json")).resolve("@deepseek-ai/dsh-client-ui-settings-models/client"), "utf8"));
|
|
18
|
-
}
|
|
19
|
-
/** Keep the original settings namespace and native UI; project policy before startup settles. */
|
|
20
|
-
async function apply(ctx) {
|
|
21
|
-
const entry = [...ctx.loader.entries()].find((entry$1) => entry$1.options.id === NAMESPACE);
|
|
22
|
-
if (entry === void 0 || entry.disabled) return;
|
|
23
|
-
const version = readHostWelcomeVersion(ctx.profileContext.installAnchor);
|
|
24
|
-
const original = { ...entry.options.config ?? {} };
|
|
25
|
-
const unhook = ctx.on("internal/config", function(_raw, next) {
|
|
26
|
-
const config = next();
|
|
27
|
-
return this.entry?.options.id === NAMESPACE ? {
|
|
28
|
-
...config,
|
|
29
|
-
[FIELD]: version
|
|
30
|
-
} : config;
|
|
31
|
-
}, { global: true });
|
|
32
|
-
try {
|
|
33
|
-
if (entry.fiber === void 0) await entry.init();
|
|
34
|
-
await entry.fiber?.await();
|
|
35
|
-
await entry.update({ config: {
|
|
36
|
-
...original,
|
|
37
|
-
[FIELD]: version
|
|
38
|
-
} });
|
|
39
|
-
} catch (error) {
|
|
40
|
-
unhook();
|
|
41
|
-
throw error;
|
|
42
|
-
}
|
|
43
|
-
return async () => {
|
|
44
|
-
unhook();
|
|
45
|
-
if (entry.fiber === void 0 || entry.disabled) return;
|
|
46
|
-
const config = { ...entry.options.config ?? {} };
|
|
47
|
-
if (Object.hasOwn(original, FIELD)) config[FIELD] = original[FIELD];
|
|
48
|
-
else delete config[FIELD];
|
|
49
|
-
await entry.update({ config });
|
|
50
|
-
};
|
|
5
|
+
const inject = [];
|
|
6
|
+
const Config = Schema.object({}).volatile();
|
|
7
|
+
function apply(ctx) {
|
|
8
|
+
ctx.inject(["settings"], (child) => {
|
|
9
|
+
child.effect(() => child.settings.configure({ auto: false }, ctx.fiber));
|
|
10
|
+
});
|
|
51
11
|
}
|
|
52
12
|
var welcome_notice_default = {
|
|
53
13
|
name,
|
|
54
14
|
inject,
|
|
15
|
+
Config,
|
|
55
16
|
apply
|
|
56
17
|
};
|
|
57
18
|
|
|
58
19
|
//#endregion
|
|
59
|
-
export { apply, welcome_notice_default as default, inject, name
|
|
20
|
+
export { Config, apply, welcome_notice_default as default, inject, name };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "better-dsh",
|
|
3
|
-
"version": "0.3.0-
|
|
3
|
+
"version": "0.3.0-g",
|
|
4
4
|
"description": "Make your dsh ready for serious coding tasks. (Tools x Schemas)^REPL. `skill://`, `ctx://`, `agent://`, `dvc://`, `dsh://`, IPython REPL, Context as Variables, cross compactions recallable, full context revive. `hash-edit`, `dvc://browser`, subagent as function, workflow as function.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -55,14 +55,6 @@
|
|
|
55
55
|
"./welcome-notice": {
|
|
56
56
|
"types": "./lib/welcome-notice.d.ts",
|
|
57
57
|
"default": "./lib/welcome-notice.js"
|
|
58
|
-
},
|
|
59
|
-
"./webserver": {
|
|
60
|
-
"types": "./lib/webserver.d.ts",
|
|
61
|
-
"default": "./lib/webserver.js"
|
|
62
|
-
},
|
|
63
|
-
"./hmr": {
|
|
64
|
-
"types": "./lib/hmr.d.ts",
|
|
65
|
-
"default": "./lib/hmr.js"
|
|
66
58
|
}
|
|
67
59
|
},
|
|
68
60
|
"imports": {
|
|
@@ -174,7 +166,7 @@
|
|
|
174
166
|
"@deepseek-ai/dsh-atomic-write": ">=0.1.5-0 <0.3.0-0",
|
|
175
167
|
"@deepseek-ai/dsh-cmdline": ">=0.1.5-0 <0.3.0-0",
|
|
176
168
|
"@deepseek-ai/dsh-plugin-manager": ">=0.1.5-0 <0.3.0-0",
|
|
177
|
-
"@deepseek-ai/dsh-
|
|
169
|
+
"@deepseek-ai/dsh-jobs": ">=0.1.5-0 <0.3.0-0"
|
|
178
170
|
},
|
|
179
171
|
"peerDependenciesMeta": {
|
|
180
172
|
"@deepseek-ai/cordis": {
|
|
@@ -363,7 +355,7 @@
|
|
|
363
355
|
"@deepseek-ai/dsh-plugin-manager": {
|
|
364
356
|
"optional": true
|
|
365
357
|
},
|
|
366
|
-
"@deepseek-ai/dsh-
|
|
358
|
+
"@deepseek-ai/dsh-jobs": {
|
|
367
359
|
"optional": true
|
|
368
360
|
}
|
|
369
361
|
},
|
package/lib/hmr.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import Hmr, { HmrConfig } from "@deepseek-ai/dsh-hmr";
|
|
2
|
-
import { Context } from "@deepseek-ai/cordis";
|
|
3
|
-
|
|
4
|
-
//#region src/hmr.d.ts
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Native runExclusive keeps a boolean in ALS. HTTP servers created while
|
|
8
|
-
* replacing webServer inherit that boolean after the transaction finishes,
|
|
9
|
-
* so subsequent native Plugin Manager requests are refused as nested.
|
|
10
|
-
*
|
|
11
|
-
* The public runExclusive/watchConfig APIs expose no selective context reset.
|
|
12
|
-
* AsyncLocalStorage.snapshot() also resets AgentRegistry initiator attribution
|
|
13
|
-
* and its teardown lineage, so it cannot safely repair this host transaction.
|
|
14
|
-
* This compatibility bridge reads the native TS-private `executing` storage
|
|
15
|
-
* after checking its runtime shape. It never replaces that storage or changes
|
|
16
|
-
* upstream files: only exit() clears its inherited value while the unchanged
|
|
17
|
-
* native method establishes the next transaction. Native queue, closing,
|
|
18
|
-
* exact watchers, module reload and disposal retain their original semantics.
|
|
19
|
-
*
|
|
20
|
-
* The mutable token rejects nesting only while its operation is still active;
|
|
21
|
-
* resources created by that operation can initiate later transactions.
|
|
22
|
-
* A native implementation change fails initialization explicitly instead of
|
|
23
|
-
* silently dropping queue or lifecycle guarantees.
|
|
24
|
-
*/
|
|
25
|
-
declare class BetterHmr extends Hmr {
|
|
26
|
-
private readonly nativeTransactions;
|
|
27
|
-
private readonly liveTransactions;
|
|
28
|
-
constructor(ctx: Context, config: HmrConfig);
|
|
29
|
-
runExclusive<T>(operation: () => Promise<T>): Promise<T>;
|
|
30
|
-
}
|
|
31
|
-
//#endregion
|
|
32
|
-
export { BetterHmr as default };
|
package/lib/hmr.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
-
import Hmr from "@deepseek-ai/dsh-hmr";
|
|
3
|
-
|
|
4
|
-
//#region src/hmr.ts
|
|
5
|
-
/**
|
|
6
|
-
* Native runExclusive keeps a boolean in ALS. HTTP servers created while
|
|
7
|
-
* replacing webServer inherit that boolean after the transaction finishes,
|
|
8
|
-
* so subsequent native Plugin Manager requests are refused as nested.
|
|
9
|
-
*
|
|
10
|
-
* The public runExclusive/watchConfig APIs expose no selective context reset.
|
|
11
|
-
* AsyncLocalStorage.snapshot() also resets AgentRegistry initiator attribution
|
|
12
|
-
* and its teardown lineage, so it cannot safely repair this host transaction.
|
|
13
|
-
* This compatibility bridge reads the native TS-private `executing` storage
|
|
14
|
-
* after checking its runtime shape. It never replaces that storage or changes
|
|
15
|
-
* upstream files: only exit() clears its inherited value while the unchanged
|
|
16
|
-
* native method establishes the next transaction. Native queue, closing,
|
|
17
|
-
* exact watchers, module reload and disposal retain their original semantics.
|
|
18
|
-
*
|
|
19
|
-
* The mutable token rejects nesting only while its operation is still active;
|
|
20
|
-
* resources created by that operation can initiate later transactions.
|
|
21
|
-
* A native implementation change fails initialization explicitly instead of
|
|
22
|
-
* silently dropping queue or lifecycle guarantees.
|
|
23
|
-
*/
|
|
24
|
-
var BetterHmr = class extends Hmr {
|
|
25
|
-
nativeTransactions;
|
|
26
|
-
liveTransactions = new AsyncLocalStorage();
|
|
27
|
-
constructor(ctx, config) {
|
|
28
|
-
super(ctx, config);
|
|
29
|
-
const storage = this.executing;
|
|
30
|
-
if (!(storage instanceof AsyncLocalStorage) || typeof storage.getStore !== "function" || typeof storage.exit !== "function" || typeof storage.run !== "function") throw new Error("Better Dash HMR cannot reset this native HMR transaction context: expected executing AsyncLocalStorage");
|
|
31
|
-
this.nativeTransactions = storage;
|
|
32
|
-
}
|
|
33
|
-
runExclusive(operation) {
|
|
34
|
-
if (this.liveTransactions.getStore()?.active) return Promise.reject(/* @__PURE__ */ new Error("HMR transactions cannot be nested"));
|
|
35
|
-
return this.nativeTransactions.exit(() => super.runExclusive(() => {
|
|
36
|
-
const token = { active: true };
|
|
37
|
-
return this.liveTransactions.run(token, async () => {
|
|
38
|
-
try {
|
|
39
|
-
return await operation();
|
|
40
|
-
} finally {
|
|
41
|
-
token.active = false;
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}));
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
//#endregion
|
|
49
|
-
export { BetterHmr as default };
|
package/lib/webserver.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Service } from "@deepseek-ai/cordis";
|
|
2
|
-
import { WebServer } from "@deepseek-ai/dsh-host-webserver";
|
|
3
|
-
|
|
4
|
-
//#region src/webserver.d.ts
|
|
5
|
-
declare class BetterWebServer extends WebServer {
|
|
6
|
-
static inject: string[];
|
|
7
|
-
[Service.init](): Promise<void>;
|
|
8
|
-
}
|
|
9
|
-
//#endregion
|
|
10
|
-
export { BetterWebServer as default };
|
package/lib/webserver.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Service } from "@deepseek-ai/cordis";
|
|
2
|
-
import { WebServer } from "@deepseek-ai/dsh-host-webserver";
|
|
3
|
-
|
|
4
|
-
//#region src/webserver.ts
|
|
5
|
-
var BetterWebServer = class extends WebServer {
|
|
6
|
-
static inject = ["loader"];
|
|
7
|
-
async [Service.init]() {
|
|
8
|
-
const welcome = [...this.ctx.loader.entries()].find((entry) => entry.options.id === "dashr-welcome-notice");
|
|
9
|
-
if (welcome !== void 0 && !welcome.disabled) {
|
|
10
|
-
if (welcome.fiber === void 0) await welcome.init();
|
|
11
|
-
await welcome.fiber?.await();
|
|
12
|
-
}
|
|
13
|
-
this.ctx.fiber.assertActive();
|
|
14
|
-
await super[Service.init]();
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
//#endregion
|
|
19
|
-
export { BetterWebServer as default };
|