@dsh-plugin/dsh-loader 1.1.0-dev.32278873528 → 1.2.0-dev.32741629392
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/LICENSE +160 -0
- package/README.md +1 -1
- package/README.zh_CN.md +1 -1
- package/dist/adapters/dsh-1-x.js +4 -0
- package/dist/adapters/dsh-1-x.js.map +1 -1
- package/dist/api.d.ts +2 -0
- package/dist/api.js +18 -2
- package/dist/api.js.map +1 -1
- package/dist/client.d.ts +0 -1
- package/dist/client.js +13 -3
- package/dist/client.js.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/patch.d.ts +112 -0
- package/dist/patch.js +179 -0
- package/dist/patch.js.map +1 -0
- package/dist/services/dsh-symbols.d.ts +70 -0
- package/dist/services/dsh-symbols.js +82 -0
- package/dist/services/dsh-symbols.js.map +1 -0
- package/dist/services/llm.d.ts +30 -0
- package/dist/services/llm.js +35 -0
- package/dist/services/llm.js.map +1 -0
- package/dist/services/registry.d.ts +144 -0
- package/dist/services/registry.js +209 -0
- package/dist/services/registry.js.map +1 -0
- package/dist/services/settings.d.ts +6 -0
- package/dist/services/settings.js +29 -1
- package/dist/services/settings.js.map +1 -1
- package/dist/services/web.js +20 -4
- package/dist/services/web.js.map +1 -1
- package/dist/setup.js +17 -1
- package/dist/setup.js.map +1 -1
- package/dist/types.d.ts +55 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/lib/client.js +2775 -4
- package/lib/client.js.map +1 -1
- package/lib/types/adapters/dsh-1-x.d.ts +23 -0
- package/lib/types/adapters/index.d.ts +22 -0
- package/lib/types/client-ui.d.ts +40 -0
- package/lib/types/client.d.ts +156 -0
- package/lib/types/patch.d.ts +112 -0
- package/lib/types/registry.d.ts +35 -0
- package/lib/types/services/dsh-symbols.d.ts +70 -0
- package/lib/types/services/llm.d.ts +30 -0
- package/lib/types/services/registry.d.ts +144 -0
- package/lib/types/services/settings.d.ts +47 -0
- package/lib/types/types.d.ts +166 -0
- package/lib/types/ui/anchors.d.ts +56 -0
- package/lib/types/ui/components.d.ts +159 -0
- package/lib/types/ui/icons.d.ts +142 -0
- package/lib/types/ui/index.d.ts +30 -0
- package/lib/types/ui/menu.d.ts +104 -0
- package/lib/types/ui/slots.d.ts +152 -0
- package/lib/types/ui/style.d.ts +97 -0
- package/lib/types/version.d.ts +2 -0
- package/package.json +45 -11
- package/src/stable/compaction-basic.d.ts +1 -0
- package/src/stable/compaction-basic.js +5 -0
- package/src/stable/credentials.d.ts +1 -0
- package/src/stable/credentials.js +5 -0
- package/src/stable/subagent.d.ts +1 -0
- package/src/stable/subagent.js +5 -0
- package/src/stable/timeout.d.ts +1 -0
- package/src/stable/timeout.js +5 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
6
|
+
of this license document, but changing it is not allowed.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
|
11
|
+
License, supplemented by the additional permissions listed below.
|
|
12
|
+
|
|
13
|
+
0. Additional Definitions.
|
|
14
|
+
|
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
17
|
+
General Public License.
|
|
18
|
+
|
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
|
20
|
+
other than an Application or a Combined Work as defined below.
|
|
21
|
+
|
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
|
25
|
+
of using an interface provided by the Library.
|
|
26
|
+
|
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
|
28
|
+
Application with the Library. The particular version of the Library
|
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
|
30
|
+
Version".
|
|
31
|
+
|
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
|
35
|
+
based on the Application, and not on the Linked Version.
|
|
36
|
+
|
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
|
38
|
+
object code and/or source code for the Application, including any data
|
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
|
41
|
+
|
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
|
43
|
+
|
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
|
46
|
+
|
|
47
|
+
2. Conveying Modified Versions.
|
|
48
|
+
|
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
|
51
|
+
that uses the facility (other than as an argument passed when the
|
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
|
53
|
+
version:
|
|
54
|
+
|
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
|
56
|
+
ensure that, in the event an Application does not supply the
|
|
57
|
+
function or data, the facility still operates, and performs
|
|
58
|
+
whatever part of its purpose remains meaningful, or
|
|
59
|
+
|
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
|
61
|
+
this License applicable to that copy.
|
|
62
|
+
|
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
|
64
|
+
|
|
65
|
+
The object code form of an Application may incorporate material from
|
|
66
|
+
a header file that is part of the Library. You may convey such object
|
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
|
68
|
+
material is not limited to numerical parameters, data structure
|
|
69
|
+
layouts and accessors, or small macros, functions and templates (ten
|
|
70
|
+
or fewer lines in length), you do both of the following:
|
|
71
|
+
|
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
|
73
|
+
Library is used in it and that the Library and its use are covered
|
|
74
|
+
by this License.
|
|
75
|
+
|
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
77
|
+
document.
|
|
78
|
+
|
|
79
|
+
4. Combined Works.
|
|
80
|
+
|
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
|
82
|
+
taken together, effectively do not restrict modification of the
|
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
|
85
|
+
the following:
|
|
86
|
+
|
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
|
88
|
+
the Library is used in it and that the Library and its use are
|
|
89
|
+
covered by this License.
|
|
90
|
+
|
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
92
|
+
document.
|
|
93
|
+
|
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
|
95
|
+
execution, include the copyright notice for the Library among
|
|
96
|
+
these notices, as well as a reference directing the user to the
|
|
97
|
+
copies of the GNU GPL and this license document.
|
|
98
|
+
|
|
99
|
+
d) Do one of the following:
|
|
100
|
+
|
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
|
102
|
+
License, and the Corresponding Application Code in a form
|
|
103
|
+
suitable for, and under terms that permit, the user to
|
|
104
|
+
recombine or relink the Application with a modified version of
|
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
|
107
|
+
Corresponding Source.
|
|
108
|
+
|
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
|
111
|
+
a copy of the Library already present on the user's computer
|
|
112
|
+
system, and (b) will operate properly with a modified version
|
|
113
|
+
of the Library that is interface-compatible with the Linked
|
|
114
|
+
Version.
|
|
115
|
+
|
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
|
117
|
+
be required to provide such information under section 6 of the
|
|
118
|
+
GNU GPL, and only to the extent that such information is
|
|
119
|
+
necessary to install and execute a modified version of the
|
|
120
|
+
Combined Work produced by recombining or relinking the
|
|
121
|
+
Application with a modified version of the Linked Version. (If
|
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
|
126
|
+
for conveying Corresponding Source.)
|
|
127
|
+
|
|
128
|
+
5. Combined Libraries.
|
|
129
|
+
|
|
130
|
+
You may place library facilities that are a work based on the
|
|
131
|
+
Library side by side in a single library together with other library
|
|
132
|
+
facilities that are not Applications and are not covered by this
|
|
133
|
+
License. Such a combined library, if distributed, must be subject to
|
|
134
|
+
this License for the portions of the combined library that are based
|
|
135
|
+
on the Library, and the other library facilities combined with it must
|
|
136
|
+
be subject to terms that permit the user to relink the combined
|
|
137
|
+
library with a modified version of the Library.
|
|
138
|
+
|
|
139
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
|
140
|
+
|
|
141
|
+
The Free Software Foundation may publish revised and/or new versions
|
|
142
|
+
of the GNU Lesser General Public License from time to time. Such new
|
|
143
|
+
versions will be similar in spirit to the present version, but may
|
|
144
|
+
differ in detail to address new problems or concerns.
|
|
145
|
+
|
|
146
|
+
Each version is given a distinguishing version number. If the
|
|
147
|
+
Library as you received it specifies that a certain numbered version
|
|
148
|
+
of the GNU Lesser General Public License "or any later version"
|
|
149
|
+
applies to it, you have the option of following the terms and
|
|
150
|
+
conditions either of that published version or of any later version
|
|
151
|
+
published by the Free Software Foundation. If the Library as you
|
|
152
|
+
received it does not specify a version number of the GNU Lesser
|
|
153
|
+
General Public License, you may choose any version of the GNU Lesser
|
|
154
|
+
General Public License ever published by the Free Software Foundation.
|
|
155
|
+
|
|
156
|
+
If the Library as you received it specifies that a proxy can decide
|
|
157
|
+
whether future versions of the GNU Lesser General Public License shall
|
|
158
|
+
apply, that proxy's public statement of acceptance of any version is
|
|
159
|
+
permanent authorization for you to choose that version for the
|
|
160
|
+
Library.
|
package/README.md
CHANGED
package/README.zh_CN.md
CHANGED
package/dist/adapters/dsh-1-x.js
CHANGED
|
@@ -40,6 +40,10 @@ export const hostPackageAliases = {
|
|
|
40
40
|
'@dsh-plugin/dsh-loader/llm': '@deepseek-ai/dsh-llm',
|
|
41
41
|
'@dsh-plugin/dsh-loader/agent': '@deepseek-ai/dsh-agent',
|
|
42
42
|
'@dsh-plugin/dsh-loader/settings': '@deepseek-ai/dsh-settings',
|
|
43
|
+
'@dsh-plugin/dsh-loader/timeout': '@deepseek-ai/dsh-timeout',
|
|
44
|
+
'@dsh-plugin/dsh-loader/subagent': '@deepseek-ai/dsh-subagent',
|
|
45
|
+
'@dsh-plugin/dsh-loader/credentials': '@deepseek-ai/dsh-credentials',
|
|
46
|
+
'@dsh-plugin/dsh-loader/compaction-basic': '@deepseek-ai/dsh-compaction-basic',
|
|
43
47
|
};
|
|
44
48
|
/**
|
|
45
49
|
* Install a Module._resolveFilename hook that maps old package names to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dsh-1-x.js","sourceRoot":"","sources":["../../src/adapters/dsh-1-x.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,EAAE;AACF,wDAAwD;AACxD,gEAAgE;AAChE,+DAA+D;AAC/D,4DAA4D;AAC5D,+EAA+E;AAC/E,2EAA2E;AAC3E,2DAA2D;AAC3D,uEAAuE;AACvE,uEAAuE;AACvE,gEAAgE;AAChE,EAAE;AACF,0EAA0E;AAC1E,2EAA2E;AAC3E,4DAA4D;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGjF,iEAAi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AAC,CAAC;;YAC9E,MAAM,QAAQ,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC;IAC5D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,qBAAqB,CAAC,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;IAChD,CAAC;IACD,MAAM,UAAU,GAAG,QAAQ;SACxB,QAAQ,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;SACjC,IAAI,CAAC,CAAC,CAAkB,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;IAC7D,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,yCAAyC,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;IAC9G,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,eAAe,CAAC,UAAU,CAAC,EAAE,CAAC;AAC1D,CAAC"}
|
package/dist/api.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type RegistryModules } from './services/registry.js';
|
|
1
2
|
import type { CordisContext, AdapterFactory, HostAdapter, HostAPI } from './types.js';
|
|
2
3
|
/**
|
|
3
4
|
* @param opts
|
|
@@ -10,4 +11,5 @@ export declare function createHostAPI(opts: {
|
|
|
10
11
|
exposeAllNamespaces?: boolean;
|
|
11
12
|
whitelist?: Set<string>;
|
|
12
13
|
hostPackageAliases?: Record<string, string>;
|
|
14
|
+
registryModules?: RegistryModules;
|
|
13
15
|
}): HostAPI;
|
package/dist/api.js
CHANGED
|
@@ -10,12 +10,16 @@ import { LOADER_VERSION } from './version.js';
|
|
|
10
10
|
import { createSettingsAPI } from './services/settings.js';
|
|
11
11
|
import { createWebAPI } from './services/web.js';
|
|
12
12
|
import { createServicesAPI } from './services/services.js';
|
|
13
|
+
import { createRegistryAPI } from './services/registry.js';
|
|
14
|
+
import { createLlmAPI } from './services/llm.js';
|
|
15
|
+
import { createDshSymbolsAPI } from './services/dsh-symbols.js';
|
|
16
|
+
import { createPatchAPI } from './patch.js';
|
|
13
17
|
import { installHostPackageAliases } from './adapters/dsh-1-x.js';
|
|
14
18
|
/**
|
|
15
19
|
* @param opts
|
|
16
20
|
*/
|
|
17
21
|
export function createHostAPI(opts) {
|
|
18
|
-
const { ctx, dshVersion, factory, adapter, exposeAllNamespaces = false, whitelist, hostPackageAliases = {}, } = opts;
|
|
22
|
+
const { ctx, dshVersion, factory, adapter, exposeAllNamespaces = false, whitelist, hostPackageAliases = {}, registryModules, } = opts;
|
|
19
23
|
const base = {
|
|
20
24
|
version: LOADER_VERSION,
|
|
21
25
|
dshVersion,
|
|
@@ -23,9 +27,17 @@ export function createHostAPI(opts) {
|
|
|
23
27
|
};
|
|
24
28
|
// Adapters may override any capability (design.md §4.4 HostAdapter.{settings,
|
|
25
29
|
// web, services}); otherwise the default stable impl is used.
|
|
26
|
-
const settings = adapter?.settings ??
|
|
30
|
+
const settings = adapter?.settings ??
|
|
31
|
+
createSettingsAPI({ ctx, exposeAllNamespaces, whitelist, module: registryModules?.settings });
|
|
27
32
|
const web = adapter?.web ?? createWebAPI({ ctx });
|
|
28
33
|
const services = adapter?.services ?? createServicesAPI({ ctx });
|
|
34
|
+
// `patch` is environment-agnostic and version-independent (the protocol never
|
|
35
|
+
// touches dsh shapes), so no adapter override seam is needed. `registry` DOES
|
|
36
|
+
// name private dsh shapes, so adapters may replace it wholesale.
|
|
37
|
+
const patch = createPatchAPI();
|
|
38
|
+
const registry = adapter?.registry ?? createRegistryAPI({ ctx, modules: registryModules });
|
|
39
|
+
const llm = createLlmAPI({ module: registryModules?.llm });
|
|
40
|
+
const dsh = createDshSymbolsAPI({ modules: registryModules });
|
|
29
41
|
// Runtime host package-name alias registration. The adapter's apply()
|
|
30
42
|
// installs the static set at boot; this method lets plugins add more
|
|
31
43
|
// aliases at runtime (e.g. for packages the adapter didn't know about).
|
|
@@ -40,6 +52,10 @@ export function createHostAPI(opts) {
|
|
|
40
52
|
settings,
|
|
41
53
|
web,
|
|
42
54
|
services,
|
|
55
|
+
patch,
|
|
56
|
+
registry,
|
|
57
|
+
llm,
|
|
58
|
+
dsh,
|
|
43
59
|
registerPackageAlias,
|
|
44
60
|
};
|
|
45
61
|
}
|
package/dist/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,EAAE;AACF,8EAA8E;AAC9E,6EAA6E;AAC7E,8EAA8E;AAC9E,0EAA0E;AAC1E,8EAA8E;AAC9E,oEAAoE;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAWlE;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,EAAE;AACF,8EAA8E;AAC9E,6EAA6E;AAC7E,8EAA8E;AAC9E,0EAA0E;AAC1E,8EAA8E;AAC9E,oEAAoE;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D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,CAAC,CAAC;IACnE,MAAM,GAAG,GAAkB,mBAAmB,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC,CAAC;IAE7E,sEAAsE;IACtE,qEAAqE;IACrE,wEAAwE;IACxE,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACvE,MAAM,oBAAoB,GAAG,CAAC,OAAe,EAAE,OAAe,EAAQ,EAAE;QACtE,kBAAkB,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACzC,4CAA4C;QAC5C,yBAAyB,CAAC,MAAM,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACpE,CAAC,CAAC;IAEF,OAAO;QACL,GAAG,IAAI;QACP,QAAQ;QACR,GAAG;QACH,QAAQ;QACR,KAAK;QACL,QAAQ;QACR,GAAG;QACH,GAAG;QACH,oBAAoB;KACrB,CAAC;AACJ,CAAC"}
|
package/dist/client.d.ts
CHANGED
package/dist/client.js
CHANGED
|
@@ -18,6 +18,15 @@
|
|
|
18
18
|
import { LOADER_VERSION, LOG_PREFIX } from './version.js';
|
|
19
19
|
import { clientAdapters } from './adapters/index.js';
|
|
20
20
|
import { BRIDGE_PREFIX } from './adapters/dsh-1-x.js';
|
|
21
|
+
/**
|
|
22
|
+
* The ambient browser `window`, when this module runs in a browser-like realm.
|
|
23
|
+
* Read off `globalThis` so no DOM lib and no global declaration is required.
|
|
24
|
+
*/
|
|
25
|
+
function ambientWindow() {
|
|
26
|
+
const scope = globalThis;
|
|
27
|
+
const found = scope.window;
|
|
28
|
+
return typeof found === 'object' && found !== null ? found : undefined;
|
|
29
|
+
}
|
|
21
30
|
export class ModuleNotFoundError extends Error {
|
|
22
31
|
specifier;
|
|
23
32
|
constructor(specifier) {
|
|
@@ -109,7 +118,7 @@ export function createClientAPI(opts = {}) {
|
|
|
109
118
|
* Install dshloader into a browser-like environment.
|
|
110
119
|
*/
|
|
111
120
|
export function installClient(opts = {}) {
|
|
112
|
-
const win = opts.window ?? (
|
|
121
|
+
const win = opts.window ?? ambientWindow();
|
|
113
122
|
if (win === undefined)
|
|
114
123
|
return undefined;
|
|
115
124
|
const dshVersion = opts.dshVersion ?? win.__DSHLOADER_VERSION__;
|
|
@@ -289,7 +298,8 @@ export function installSettingsFetchInterceptor(win, bridgePrefix = BRIDGE_PREFI
|
|
|
289
298
|
export const name = '@dsh-plugin/dsh-loader';
|
|
290
299
|
export const inject = [];
|
|
291
300
|
export function apply(ctx) {
|
|
292
|
-
|
|
293
|
-
|
|
301
|
+
const win = ambientWindow();
|
|
302
|
+
if (win !== undefined)
|
|
303
|
+
installClient({ window: win, clientCtx: ctx });
|
|
294
304
|
}
|
|
295
305
|
//# sourceMappingURL=client.js.map
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,EAAE;AACF,yEAAyE;AACzE,oBAAoB;AACpB,6EAA6E;AAC7E,yBAAyB;AACzB,6EAA6E;AAC7E,0EAA0E;AAC1E,oCAAoC;AACpC,0EAA0E;AAC1E,2EAA2E;AAC3E,0EAA0E;AAC1E,2EAA2E;AAC3E,4EAA4E;AAC5E,EAAE;AACF,6EAA6E;AAC7E,kDAAkD;AAClD,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,EAAE;AACF,yEAAyE;AACzE,oBAAoB;AACpB,6EAA6E;AAC7E,yBAAyB;AACzB,6EAA6E;AAC7E,0EAA0E;AAC1E,oCAAoC;AACpC,0EAA0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0E;AAC1E,wEAAwE;AACxE,2EAA2E;AAC3E,yEAAyE;AACzE,wEAAwE;AACxE,yEAAyE;AACzE,sEAAsE;AACtE,2CAA2C;AAC3C,MAAM,CAAC,MAAM,IAAI,GAAG,wBAAwB,CAAA;AAC5C,MAAM,CAAC,MAAM,MAAM,GAAa,EAAE,CAAA;AAClC,MAAM,UAAU,KAAK,CAAC,GAAoC;IACxD,MAAM,GAAG,GAAG,aAAa,EAAE,CAAC;IAC5B,IAAI,GAAG,KAAK,SAAS;QAAE,aAAa,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC;AACxE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import { join, resolve } from 'node:path';
|
|
|
11
11
|
import { AdapterRegistry, detectDshVersion, UnsupportedDshVersionError } from './registry.js';
|
|
12
12
|
import { registerHostAdapters } from './adapters/index.js';
|
|
13
13
|
import { createHostAPI } from './api.js';
|
|
14
|
+
import { preloadRegistryModules } from './services/registry.js';
|
|
14
15
|
export const name = '@dsh-plugin/dsh-loader';
|
|
15
16
|
// dshloader itself depends on `webServer` so its fiber only activates once
|
|
16
17
|
// the real web server is provided — the alias then points `httpServer` at it.
|
|
@@ -61,6 +62,10 @@ export async function applyAdapter(ctx, opts = {}) {
|
|
|
61
62
|
const { factory, mode, dshVersion } = selection;
|
|
62
63
|
const adapter = factory.create(ctx, config);
|
|
63
64
|
await adapter.apply?.();
|
|
65
|
+
// Optional dsh modules the registry facade proxies (sandbox escalation
|
|
66
|
+
// targets, permission-preset folding). Absent modules degrade that facade
|
|
67
|
+
// method to a logged no-op — see services/registry.ts.
|
|
68
|
+
const registryModules = await preloadRegistryModules();
|
|
64
69
|
const api = createHostAPI({
|
|
65
70
|
ctx,
|
|
66
71
|
dshVersion,
|
|
@@ -68,10 +73,11 @@ export async function applyAdapter(ctx, opts = {}) {
|
|
|
68
73
|
adapter,
|
|
69
74
|
exposeAllNamespaces: config.exposeAllNamespaces,
|
|
70
75
|
hostPackageAliases: config.hostPackageAliases,
|
|
76
|
+
registryModules,
|
|
71
77
|
});
|
|
72
78
|
ctx.reflect.provide('dshLoader', api);
|
|
73
79
|
console.log(`${LOG_PREFIX} loaded adapter ${factory.name} for dsh ${dshVersion} (mode: ${mode})`);
|
|
74
|
-
console.log(`${LOG_PREFIX} registered stable API: settings, web, services`);
|
|
80
|
+
console.log(`${LOG_PREFIX} registered stable API: settings, web, services, patch, registry, llm`);
|
|
75
81
|
if (config.exposeAllNamespaces) {
|
|
76
82
|
console.warn(`${LOG_PREFIX} exposeAllNamespaces enabled: bypassing official settings whitelist`);
|
|
77
83
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,oEAAoE;AACpE,yEAAyE;AACzE,wEAAwE;AACxE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAC9F,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,oEAAoE;AACpE,yEAAyE;AACzE,wEAAwE;AACxE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,YA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GAAG,aAAa,CAAC;QACxB,GAAG;QACH,UAAU;QACV,OAAO;QACP,OAAO;QACP,mBAAmB,EAAE,MAAM,CAAC,mBAAmB;QAC/C,kBAAkB,EAAE,MAAM,CAAC,kBAAkB;QAC7C,eAAe;KAChB,CAAC,CAAC;IACH,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;IAEtC,OAAO,CAAC,GAAG,CAAC,GAAG,UAAU,mBAAmB,OAAO,CAAC,IAAI,YAAY,UAAU,WAAW,IAAI,GAAG,CAAC,CAAC;IAClG,OAAO,CAAC,GAAG,CAAC,GAAG,UAAU,uEAAuE,CAAC,CAAC;IAClG,IAAI,MAAM,CAAC,mBAAmB,EAAE,CAAC;QAC/B,OAAO,CAAC,IAAI,CACV,GAAG,UAAU,qEAAqE,CACnF,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;AAC5C,CAAC;AAED,0CAA0C;AAC1C,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,GAAkB;IAC5C,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,KAAK,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,KAAK,MAAM,EAAE,CAAC;QACtF,OAAO,CAAC,GAAG,CAAC,GAAG,UAAU,4BAA4B,CAAC,CAAC;QACvD,OAAO;IACT,CAAC;IACD,MAAM,YAAY,CAAC,GAAG,CAAC,CAAC;AAC1B,CAAC;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
package/dist/patch.d.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The dshloader PATCH protocol (`ctx.dshLoader.patch` / `__dshLoader__.patch`).
|
|
3
|
+
*
|
|
4
|
+
* Monkey-patching a host method or global is the only way to intervene in
|
|
5
|
+
* behaviour dsh exposes no extension point for. Three plugins in this family
|
|
6
|
+
* each hand-rolled the protocol and they did NOT agree:
|
|
7
|
+
*
|
|
8
|
+
* - dsh-loader's own `Module._resolveFilename` hook → identity-checked restore
|
|
9
|
+
* - dsh-network-settings' `globalThis.fetch` wrapper → identity-checked restore
|
|
10
|
+
* - dsh-better-sidebar's `workspaces.openPath` wrap → UNCONDITIONAL restore
|
|
11
|
+
*
|
|
12
|
+
* The last one silently destroys a later plugin's wrapper when it disposes
|
|
13
|
+
* first, even though its own comment promised the opposite. This module is the
|
|
14
|
+
* single correct implementation; every patch site delegates here.
|
|
15
|
+
*
|
|
16
|
+
* The five guarantees:
|
|
17
|
+
*
|
|
18
|
+
* 1. RAW original — each patch captures EXACTLY the value present when it
|
|
19
|
+
* installed (another plugin's wrapper when one is already there) and
|
|
20
|
+
* restores that value verbatim, never a bound copy. This is what lets a
|
|
21
|
+
* chain of wrappers survive disposal in any order.
|
|
22
|
+
* 2. Identity-checked restore — disposal only reverts the slot when it still
|
|
23
|
+
* holds OUR wrapper. If somebody patched on top afterwards, we leave the
|
|
24
|
+
* chain alone (reverting would delete their wrapper).
|
|
25
|
+
* 3. Re-apply safety — re-applying the same `id` recovers the true original
|
|
26
|
+
* first, so HMR / repeated `apply()` can never nest a wrapper in itself.
|
|
27
|
+
* This holds while our patch is the OUTERMOST one; if a foreign patch was
|
|
28
|
+
* layered on top in between, re-applying chains instead (un-nesting a
|
|
29
|
+
* middle wrapper is not possible without rebuilding the whole chain).
|
|
30
|
+
* 4. Cross-instance durability — slot bookkeeping lives in a WeakMap parked on
|
|
31
|
+
* `globalThis` under a `Symbol.for` key, so a reloaded module instance still
|
|
32
|
+
* sees the original captured by its predecessor. Targets are never mutated.
|
|
33
|
+
* 5. Loud misuse — patching a non-function method, or a missing target, throws
|
|
34
|
+
* instead of silently no-op'ing.
|
|
35
|
+
*
|
|
36
|
+
* Pure and environment-agnostic: no DOM, no Node builtins, so the same module
|
|
37
|
+
* serves the host half and the browser half.
|
|
38
|
+
*
|
|
39
|
+
* @module @dsh-plugin/dsh-loader/patch
|
|
40
|
+
*/
|
|
41
|
+
/** A live patch, disposed through {@link PatchHandle.dispose}. */
|
|
42
|
+
export interface PatchHandle {
|
|
43
|
+
/** Remove this patch when the slot still carries its wrapper (idempotent). */
|
|
44
|
+
dispose(): void;
|
|
45
|
+
/** Whether the target slot still carries this patch's wrapper. */
|
|
46
|
+
readonly active: boolean;
|
|
47
|
+
/** The raw value captured before any dshloader patch touched the slot. */
|
|
48
|
+
readonly original: unknown;
|
|
49
|
+
}
|
|
50
|
+
/** Options shared by every patch entry point. */
|
|
51
|
+
export interface PatchOptions {
|
|
52
|
+
/**
|
|
53
|
+
* Stable patch id. Re-applying the same id on the same slot recovers the
|
|
54
|
+
* true original before re-wrapping (guarantee 3), so HMR cannot nest
|
|
55
|
+
* wrappers. Defaults to `'anonymous'` — pass a real id (`'<plugin>:<what>'`)
|
|
56
|
+
* for any patch that can be re-applied.
|
|
57
|
+
*/
|
|
58
|
+
id?: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Patch one slot of `target`. The low-level primitive behind
|
|
62
|
+
* {@link PatchAPI.method} and {@link PatchAPI.global}.
|
|
63
|
+
*
|
|
64
|
+
* @param target - object owning the slot (a service instance, `globalThis`, …).
|
|
65
|
+
* @param key - property key to wrap.
|
|
66
|
+
* @param wrap - receives the value currently in the slot (the previous wrapper
|
|
67
|
+
* when another patch is already installed — chaining is intended) and returns
|
|
68
|
+
* the replacement.
|
|
69
|
+
* @param options - see {@link PatchOptions}.
|
|
70
|
+
* @returns the handle whose `dispose()` reverts this patch.
|
|
71
|
+
*/
|
|
72
|
+
export declare function patchSlot<T = unknown>(target: object, key: PropertyKey, wrap: (original: T) => T, options?: PatchOptions): PatchHandle;
|
|
73
|
+
/** Whether a dshloader patch is currently installed on `target[key]`. */
|
|
74
|
+
export declare function isPatched(target: object, key: PropertyKey): boolean;
|
|
75
|
+
/** The patch id currently installed on `target[key]`, or `undefined`. */
|
|
76
|
+
export declare function patchIdOf(target: object, key: PropertyKey): string | undefined;
|
|
77
|
+
/** The stable `patch` facade exposed on the host and browser APIs. */
|
|
78
|
+
export interface PatchAPI {
|
|
79
|
+
/**
|
|
80
|
+
* Wrap a method of a service / object.
|
|
81
|
+
*
|
|
82
|
+
* ```ts
|
|
83
|
+
* const handle = ctx.dshLoader.patch.method(
|
|
84
|
+
* workspaces, 'openPath',
|
|
85
|
+
* original => (path: string) => takeover(path) ?? original.call(workspaces, path),
|
|
86
|
+
* { id: 'better-sidebar:openPath' },
|
|
87
|
+
* )
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
method<T extends object, K extends keyof T>(target: T, key: K, wrap: (original: T[K]) => T[K], options?: PatchOptions): PatchHandle;
|
|
91
|
+
/**
|
|
92
|
+
* Wrap a global function such as `fetch`. Defaults to `globalThis`; pass
|
|
93
|
+
* `scope` for `window` or a test double.
|
|
94
|
+
*
|
|
95
|
+
* ```ts
|
|
96
|
+
* ctx.dshLoader.patch.global('fetch',
|
|
97
|
+
* original => (input, init) => original(rewrite(input), init),
|
|
98
|
+
* { id: 'network-settings:fetch' })
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
global<T = unknown>(key: PropertyKey, wrap: (original: T) => T, options?: PatchOptions & {
|
|
102
|
+
scope?: object;
|
|
103
|
+
}): PatchHandle;
|
|
104
|
+
/** Low-level primitive; `method`/`global` are thin wrappers over it. */
|
|
105
|
+
slot<T = unknown>(target: object, key: PropertyKey, wrap: (original: T) => T, options?: PatchOptions): PatchHandle;
|
|
106
|
+
/** Whether a dshloader patch currently occupies `target[key]`. */
|
|
107
|
+
isPatched(target: object, key: PropertyKey): boolean;
|
|
108
|
+
/** The patch id currently occupying `target[key]`, if any. */
|
|
109
|
+
patchIdOf(target: object, key: PropertyKey): string | undefined;
|
|
110
|
+
}
|
|
111
|
+
/** Build the `patch` facade. Stateless — all bookkeeping is in the global registry. */
|
|
112
|
+
export declare function createPatchAPI(): PatchAPI;
|