@dsh-plugin/dsh-loader 1.0.0 → 1.1.0-dev.32287576957

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 (74) hide show
  1. package/LICENSE +160 -0
  2. package/README.md +251 -226
  3. package/{README.zh-CN.md → README.zh_CN.md} +227 -202
  4. package/bin/dshloader.mjs +42 -42
  5. package/cordis.patch.yml +8 -8
  6. package/dist/adapters/dsh-1-x.d.ts +23 -0
  7. package/dist/adapters/dsh-1-x.js +223 -0
  8. package/dist/adapters/dsh-1-x.js.map +1 -0
  9. package/dist/adapters/index.d.ts +22 -0
  10. package/dist/adapters/index.js +57 -0
  11. package/dist/adapters/index.js.map +1 -0
  12. package/dist/api.d.ts +13 -0
  13. package/dist/api.js +46 -0
  14. package/dist/api.js.map +1 -0
  15. package/dist/client.d.ts +157 -0
  16. package/dist/client.js +295 -0
  17. package/dist/client.js.map +1 -0
  18. package/dist/index.d.ts +52 -0
  19. package/dist/index.js +89 -0
  20. package/dist/index.js.map +1 -0
  21. package/dist/registry.d.ts +35 -0
  22. package/dist/registry.js +229 -0
  23. package/dist/registry.js.map +1 -0
  24. package/dist/services/services.d.ts +4 -0
  25. package/dist/services/services.js +28 -0
  26. package/dist/services/services.js.map +1 -0
  27. package/dist/services/settings.d.ts +41 -0
  28. package/dist/services/settings.js +161 -0
  29. package/dist/services/settings.js.map +1 -0
  30. package/dist/services/web.d.ts +10 -0
  31. package/dist/services/web.js +63 -0
  32. package/dist/services/web.js.map +1 -0
  33. package/dist/setup.d.ts +32 -0
  34. package/dist/setup.js +119 -0
  35. package/dist/setup.js.map +1 -0
  36. package/dist/types.d.ts +111 -0
  37. package/dist/types.js +12 -0
  38. package/dist/types.js.map +1 -0
  39. package/dist/version.d.ts +2 -0
  40. package/{src → dist}/version.js +5 -5
  41. package/dist/version.js.map +1 -0
  42. package/lib/client.js +283 -0
  43. package/lib/client.js.map +1 -0
  44. package/package.json +75 -59
  45. package/src/stable/agent.d.ts +1 -1
  46. package/src/stable/agent.js +2 -2
  47. package/src/stable/llm.d.ts +1 -1
  48. package/src/stable/llm.js +2 -2
  49. package/src/stable/runtime.d.ts +1 -1
  50. package/src/stable/runtime.js +5 -5
  51. package/src/stable/schema-form.d.ts +1 -1
  52. package/src/stable/schema-form.js +2 -2
  53. package/src/stable/settings.d.ts +1 -1
  54. package/src/stable/settings.js +2 -2
  55. package/src/stable/tools.d.ts +1 -1
  56. package/src/stable/tools.js +5 -5
  57. package/src/stable/ui-primitives.d.ts +4 -4
  58. package/src/stable/ui-primitives.js +6 -6
  59. package/src/stable/ui-settings.d.ts +6 -6
  60. package/src/stable/ui-settings.js +4 -4
  61. package/src/stable/ui-slots.d.ts +1 -1
  62. package/src/stable/ui-slots.js +2 -2
  63. package/src/stable/web-react.d.ts +1 -1
  64. package/src/stable/web-react.js +2 -2
  65. package/src/adapters/dsh-1-x.js +0 -236
  66. package/src/adapters/index.js +0 -59
  67. package/src/api.js +0 -56
  68. package/src/client.js +0 -330
  69. package/src/index.js +0 -105
  70. package/src/registry.js +0 -242
  71. package/src/services/services.js +0 -28
  72. package/src/services/settings.js +0 -174
  73. package/src/services/web.js +0 -71
  74. package/src/setup.mjs +0 -125
@@ -0,0 +1,223 @@
1
+ // dsh 1.x host adapter (design.md §7.4 / §5.1 / §3.3.1).
2
+ //
3
+ // Absorbs the verified repairs from dsh-upstream-fixes:
4
+ // - httpServer -> webServer single-hop service alias (fix 2).
5
+ // - settings namespace whitelist bypass bridge, gated behind
6
+ // `exposeAllNamespaces` (fix 5). Two independent paths:
7
+ // * host side: ctx.dshLoader.settings.* (handled by services/settings.ts
8
+ // + the bridge routes registered here for the browser fetch path).
9
+ // * client side: fetch interceptor in src/client.ts.
10
+ // - package-name aliasing for host-side CJS require (createRequire /
11
+ // require()) — intercepts Module._resolveFilename so a renamed dsh
12
+ // package resolves to its new name without plugin rebuilds.
13
+ //
14
+ // All registrations go through ctx.reflect.provide / ctx.effect so cordis
15
+ // auto-recycles them when the dshloader fiber unloads (design.md §4.4). No
16
+ // custom dispose() is needed for v1's covered capabilities.
17
+ import { LOG_PREFIX } from '../version.js';
18
+ import { toNamespaceView, settingsErrorToResult } from '../services/settings.js';
19
+ // Covers the real dsh release line (0.1.0-rc.x, verified against
20
+ // dsh-upstream-fixes) and the anticipated 1.x line. The adapter name keeps
21
+ // the design-doc label "dsh-1-x"; the behavior is identical across both
22
+ // ranges since dsh-upstream-fixes confirms httpServer->webServer + settings
23
+ // bridge work the same way on 0.1.0-rc.7.
24
+ export const supports = '>=0.1.0-rc.1 <2.0.0';
25
+ export const name = 'dsh-1-x';
26
+ // Browser-facing bridge prefix; the client fetch interceptor (src/client.ts)
27
+ // must use the same prefix.
28
+ export const BRIDGE_PREFIX = '/api/dshloader';
29
+ // Host-side package-name aliases. Maps stable @dshloader/* names to the
30
+ // real dsh package names for this version. Plugins should require() from
31
+ // the stable names; the Module._resolveFilename hook maps them to the real
32
+ // package. When dsh renames a host package, only this table changes.
33
+ //
34
+ // This intercepts CJS require() (including createRequire) via
35
+ // Module._resolveFilename; ESM static imports are build-time resolved and
36
+ // cannot be intercepted at runtime (use pnpm overrides / tsconfig paths
37
+ // for those).
38
+ export const hostPackageAliases = {
39
+ '@dsh-plugin/dsh-loader/tools': '@deepseek-ai/dsh-tools',
40
+ '@dsh-plugin/dsh-loader/llm': '@deepseek-ai/dsh-llm',
41
+ '@dsh-plugin/dsh-loader/agent': '@deepseek-ai/dsh-agent',
42
+ '@dsh-plugin/dsh-loader/settings': '@deepseek-ai/dsh-settings',
43
+ };
44
+ /**
45
+ * Install a Module._resolveFilename hook that maps old package names to
46
+ * new ones for CJS require() calls. Returns a dispose function that
47
+ * removes the hook.
48
+ */
49
+ export async function installHostPackageAliases(aliases) {
50
+ const entries = Object.entries(aliases);
51
+ if (entries.length === 0)
52
+ return () => { };
53
+ const aliasMap = new Map(entries);
54
+ // Lazy-import Module to avoid loading it in browser/test contexts.
55
+ let Module;
56
+ try {
57
+ const mod = await import('node:module');
58
+ const nodeModule = mod.default ?? mod.Module ?? mod;
59
+ Module = nodeModule;
60
+ }
61
+ catch {
62
+ return () => { };
63
+ }
64
+ if (!Module || typeof Module._resolveFilename !== 'function')
65
+ return () => { };
66
+ const original = Module._resolveFilename;
67
+ const hooked = function dshloaderResolve(request, parent, ...rest) {
68
+ const mapped = aliasMap.get(request);
69
+ if (mapped !== undefined)
70
+ return original.call(this, mapped, parent, ...rest);
71
+ return original.call(this, request, parent, ...rest);
72
+ };
73
+ Module._resolveFilename = hooked;
74
+ return () => {
75
+ if (Module && Module._resolveFilename === hooked)
76
+ Module._resolveFilename = original;
77
+ };
78
+ }
79
+ /**
80
+ * @param ctx cordis context
81
+ * @param config
82
+ */
83
+ export function create(ctx, config = {}) {
84
+ const exposeAllNamespaces = Boolean(config.exposeAllNamespaces);
85
+ const packageAliases = { ...hostPackageAliases, ...(config.hostPackageAliases ?? {}) };
86
+ async function apply() {
87
+ // --- service alias: httpServer -> webServer (fix 2) ---
88
+ if (ctx.get('httpServer') === undefined) {
89
+ const webServer = ctx.get('webServer');
90
+ if (webServer !== undefined) {
91
+ ctx.reflect.provide('httpServer', webServer);
92
+ console.log(`${LOG_PREFIX} aliased httpServer -> webServer`);
93
+ }
94
+ }
95
+ else {
96
+ console.log(`${LOG_PREFIX} httpServer already exists, skip alias`);
97
+ }
98
+ // --- host package-name aliases (CJS require interception) ---
99
+ if (Object.keys(packageAliases).length > 0) {
100
+ ctx.effect(() => installHostPackageAliases(packageAliases), 'dshloader: host package-name aliases');
101
+ console.log(`${LOG_PREFIX} installed host package aliases: ${Object.keys(packageAliases).join(', ')}`);
102
+ }
103
+ // --- settings bridge routes for the browser fetch path (fix 5, path 2) ---
104
+ // Only registered when the profile explicitly opts in. The host-side
105
+ // stable API (ctx.dshLoader.settings.*) is unaffected by this gate and
106
+ // always available to host plugin code.
107
+ if (exposeAllNamespaces) {
108
+ ctx.effect(() => registerSettingsBridgeRoutes(ctx), 'dshloader: settings namespace bridge routes');
109
+ }
110
+ }
111
+ function dispose() {
112
+ // No cordis-unaware resources held in v1; effect auto-recycle covers
113
+ // everything registered in apply(). Implemented as a no-op to satisfy
114
+ // the HostAdapter interface and future hot-swap scenarios.
115
+ }
116
+ return { supports, name, apply, dispose };
117
+ }
118
+ /**
119
+ * Register host bridge routes that the client fetch interceptor forwards
120
+ * non-whitelisted settings requests to. Mirrors dsh-upstream-fixes/lib/index.js
121
+ * `registerRoutes` (settings section).
122
+ */
123
+ function registerSettingsBridgeRoutes(ctx) {
124
+ const webServer = ctx.get('webServer') ?? ctx.get('httpServer');
125
+ if (webServer === undefined || typeof webServer.register !== 'function')
126
+ return () => { };
127
+ return webServer.register({
128
+ kind: 'prefix',
129
+ path: BRIDGE_PREFIX,
130
+ handler: (req, res) => {
131
+ const json = (status, body) => {
132
+ res.statusCode = status;
133
+ res.setHeader('content-type', 'application/json');
134
+ res.end(JSON.stringify(body));
135
+ };
136
+ const readBody = () => new Promise((done, fail) => {
137
+ let body = '';
138
+ req.on?.('data', (chunk) => {
139
+ body += chunk.toString('utf8');
140
+ });
141
+ req.on?.('end', () => done(body));
142
+ req.on?.('error', fail);
143
+ });
144
+ const url = req.url ?? '/';
145
+ const method = (req.method ?? 'GET').toUpperCase();
146
+ const path = url.split('?')[0] ?? '/';
147
+ void (async () => {
148
+ try {
149
+ // GET /api/dshloader/settings/describe — full redacted namespace list.
150
+ if (method === 'GET' && (path === `${BRIDGE_PREFIX}/settings/describe` || path === `${BRIDGE_PREFIX}/settings/describe/`)) {
151
+ const settings = ctx.get('settings');
152
+ if (settings === undefined) {
153
+ json(200, { ok: false, message: 'settings service unavailable' });
154
+ return;
155
+ }
156
+ json(200, {
157
+ ok: true,
158
+ namespaces: settings.describe({ redactSecrets: true }).map(toNamespaceView),
159
+ });
160
+ return;
161
+ }
162
+ // POST /api/dshloader/settings/{update,mutate,replace} — write seam.
163
+ const writeMatch = /^\/api\/dshloader\/settings\/(update|mutate|replace)$/.exec(path);
164
+ if (method === 'POST' && writeMatch !== null) {
165
+ const mode = writeMatch[1];
166
+ let parsed = {};
167
+ try {
168
+ parsed = JSON.parse(await readBody());
169
+ }
170
+ catch {
171
+ /* keep {} */
172
+ }
173
+ const ns = typeof parsed.ns === 'string' ? parsed.ns : '';
174
+ if (ns.length === 0) {
175
+ json(200, {
176
+ ok: true,
177
+ result: {
178
+ ok: false,
179
+ code: 'settings-rejected',
180
+ message: 'settings write needs a namespace',
181
+ details: {},
182
+ },
183
+ });
184
+ return;
185
+ }
186
+ const settings = ctx.get('settings');
187
+ const result = await runSettingsWrite(settings, mode, ns, mode === 'mutate' ? parsed.ops : parsed.section, parsed.expectedRevision);
188
+ json(200, { ok: true, result });
189
+ return;
190
+ }
191
+ json(404, { ok: false, message: 'not found' });
192
+ }
193
+ catch (error) {
194
+ json(500, { ok: false, message: error instanceof Error ? error.message : String(error) });
195
+ }
196
+ })();
197
+ },
198
+ });
199
+ }
200
+ async function runSettingsWrite(settings, mode, ns, section, expectedRevision) {
201
+ if (settings === undefined) {
202
+ return { ok: false, code: 'internal', message: 'settings service unavailable', details: {} };
203
+ }
204
+ try {
205
+ if (mode === 'update')
206
+ await settings.update(ns, section, expectedRevision);
207
+ else if (mode === 'replace')
208
+ await settings.replace(ns, section, expectedRevision);
209
+ else
210
+ await settings.mutate(ns, section, expectedRevision);
211
+ }
212
+ catch (error) {
213
+ return settingsErrorToResult(error, ns, mode);
214
+ }
215
+ const descriptor = settings
216
+ .describe({ redactSecrets: true })
217
+ .find((d) => String(d.ns) === String(ns));
218
+ if (descriptor === undefined) {
219
+ return { ok: false, code: 'internal', message: 'settings namespace disposed after write', details: { ns } };
220
+ }
221
+ return { ok: true, value: toNamespaceView(descriptor) };
222
+ }
223
+ //# sourceMappingURL=dsh-1-x.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dsh-1-x.js","sourceRoot":"","sources":["../../src/adapters/dsh-1-x.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,EAA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types.js';
2
+ import type { AdapterRegistry } from '../registry.js';
3
+ /** All host adapter factories, in registration order. */
4
+ export declare const hostAdapters: AdapterFactory[];
5
+ /** Register every built-in host adapter onto a registry. */
6
+ export declare function registerHostAdapters(registry: AdapterRegistry): AdapterRegistry;
7
+ export declare const clientAdapters: {
8
+ supports: string;
9
+ name: string;
10
+ moduleAliases: {
11
+ '@deepseek-ai/dsh-client-runtime/src/client/sessions/context-provenance.ts': string;
12
+ 'dsh/runtime/context-provenance': string;
13
+ };
14
+ packageAliases: {
15
+ '@dsh-plugin/dsh-loader/ui-primitives': string;
16
+ '@dsh-plugin/dsh-loader/ui-slots': string;
17
+ '@dsh-plugin/dsh-loader/web-react': string;
18
+ '@dsh-plugin/dsh-loader/schema-form': string;
19
+ '@dsh-plugin/dsh-loader/ui-settings': string;
20
+ '@dsh-plugin/dsh-loader/runtime': string;
21
+ };
22
+ }[];
@@ -0,0 +1,57 @@
1
+ // Adapter registration (design.md §7.4). Imports every host adapter and
2
+ // registers it on the provided AdapterRegistry. Kept as a function so tests
3
+ // can build a fresh registry per case.
4
+ import * as dsh1x from './dsh-1-x.js';
5
+ /** All host adapter factories, in registration order. */
6
+ export const hostAdapters = [
7
+ { supports: dsh1x.supports, name: dsh1x.name, create: dsh1x.create },
8
+ ];
9
+ /** Register every built-in host adapter onto a registry. */
10
+ export function registerHostAdapters(registry) {
11
+ for (const factory of hostAdapters)
12
+ registry.register(factory);
13
+ return registry;
14
+ }
15
+ // Client adapter metadata for dsh 1.x (consumed by src/client.ts).
16
+ //
17
+ // packageAliases serves TWO roles:
18
+ // 1. **Stable name → real name** (primary): plugins import from stable
19
+ // names like '@dshloader/ui-primitives' and the adapter maps them to
20
+ // the real dsh package name for this version. When dsh renames a
21
+ // package, only the adapter changes — plugin source and bundle stay
22
+ // the same.
23
+ // 2. **Old real name → new real name** (fallback): if a plugin bundle
24
+ // was built before adopting stable names and still has
25
+ // `require('@deepseek-ai/dsh-client-ui-primitives')` baked in, the
26
+ // adapter can map the old real name to the new real name as a
27
+ // transition measure.
28
+ export const clientAdapters = [
29
+ {
30
+ supports: dsh1x.supports,
31
+ name: dsh1x.name,
32
+ moduleAliases: {
33
+ // deep source import that breaks when dsh ships no `src/` (fix 1).
34
+ '@deepseek-ai/dsh-client-runtime/src/client/sessions/context-provenance.ts': '@deepseek-ai/dsh-client-runtime/client',
35
+ // stable module name (design.md §3.3.3).
36
+ 'dsh/runtime/context-provenance': '@deepseek-ai/dsh-client-runtime/client',
37
+ },
38
+ // Stable package names → real dsh package names for dsh 1.x.
39
+ // Plugins import from @dsh-plugin/dsh-loader/* subpaths (e.g.
40
+ // '@dsh-plugin/dsh-loader/ui-primitives'); the __ModuleLoader__
41
+ // wrapper (installed by installClient) maps them to the real dsh
42
+ // package before hitting the module table. When dsh renames a
43
+ // package, only this table changes — plugin source and bundle stay
44
+ // the same.
45
+ packageAliases: {
46
+ // Client UI component libraries
47
+ '@dsh-plugin/dsh-loader/ui-primitives': '@deepseek-ai/dsh-client-ui-primitives',
48
+ '@dsh-plugin/dsh-loader/ui-slots': '@deepseek-ai/dsh-client-ui-slots',
49
+ '@dsh-plugin/dsh-loader/web-react': '@deepseek-ai/dsh-client-web-react',
50
+ '@dsh-plugin/dsh-loader/schema-form': '@deepseek-ai/dsh-client-schema-form',
51
+ '@dsh-plugin/dsh-loader/ui-settings': '@deepseek-ai/dsh-client-ui-settings/client',
52
+ // Client runtime
53
+ '@dsh-plugin/dsh-loader/runtime': '@deepseek-ai/dsh-client-runtime/client',
54
+ },
55
+ },
56
+ ];
57
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,4EAA4E;AAC5E,uCAAuC;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAItC,yDAAyD;AACzD,MAAM,CAAC,MAAM,YAAY,GAAqB;IAC5C,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE;CACrE,CAAC;AAEF,4DAA4D;AAC5D,MAAM,UAAU,oBAAoB,CAAC,QAAyB;IAC5D,KAAK,MAAM,OAAO,IAAI,YAAY;QAAE,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC/D,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,mEAAmE;AACnE,EAAE;AACF,mCAAmC;AACnC,yEAAyE;AACzE,0EAA0E;AAC1E,sEAAsE;AACtE,yEAAyE;AACzE,iBAAiB;AACjB,wEAAwE;AACxE,4DAA4D;AAC5D,wEAAwE;AACxE,mEAAmE;AACnE,2BAA2B;AAC3B,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B;QACE,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,aAAa,EAAE;YACb,mEAAmE;YACnE,2EAA2E,EACzE,wCAAwC;YAC1C,yCAAyC;YACzC,gCAAgC,EAAE,wCAAwC;SAC3E;QACD,6DAA6D;QAC7D,8DAA8D;QAC9D,gEAAgE;QAChE,iEAAiE;QACjE,8DAA8D;QAC9D,mEAAmE;QACnE,YAAY;QACZ,cAAc,EAAE;YACd,gCAAgC;YAChC,sCAAsC,EAAE,uCAAuC;YAC/E,iCAAiC,EAAE,kCAAkC;YACrE,kCAAkC,EAAE,mCAAmC;YACvE,oCAAoC,EAAE,qCAAqC;YAC3E,oCAAoC,EAAE,4CAA4C;YAClF,iBAAiB;YACjB,gCAAgC,EAAE,wCAAwC;SAC3E;KACF;CACF,CAAC"}
package/dist/api.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ import type { CordisContext, AdapterFactory, HostAdapter, HostAPI } from './types.js';
2
+ /**
3
+ * @param opts
4
+ */
5
+ export declare function createHostAPI(opts: {
6
+ ctx: CordisContext;
7
+ dshVersion: string;
8
+ factory: AdapterFactory;
9
+ adapter?: HostAdapter;
10
+ exposeAllNamespaces?: boolean;
11
+ whitelist?: Set<string>;
12
+ hostPackageAliases?: Record<string, string>;
13
+ }): HostAPI;
package/dist/api.js ADDED
@@ -0,0 +1,46 @@
1
+ // DshLoaderHostAPI construction (design.md §4.1 / §4.4).
2
+ //
3
+ // `createHostAPI` builds the `ctx.dshLoader` object exposed to other plugins.
4
+ // Each capability (settings / web / services) is constructed from the active
5
+ // adapter's overrides when present, otherwise from the default stable impl in
6
+ // src/services/*.ts. The adapter's `apply()` is invoked separately by the
7
+ // bundle entry (src/index.ts) so service aliases / bridge routes register via
8
+ // cordis effects and auto-recycle on fiber unload (design.md §4.4).
9
+ import { LOADER_VERSION } from './version.js';
10
+ import { createSettingsAPI } from './services/settings.js';
11
+ import { createWebAPI } from './services/web.js';
12
+ import { createServicesAPI } from './services/services.js';
13
+ import { installHostPackageAliases } from './adapters/dsh-1-x.js';
14
+ /**
15
+ * @param opts
16
+ */
17
+ export function createHostAPI(opts) {
18
+ const { ctx, dshVersion, factory, adapter, exposeAllNamespaces = false, whitelist, hostPackageAliases = {}, } = opts;
19
+ const base = {
20
+ version: LOADER_VERSION,
21
+ dshVersion,
22
+ adapterVersion: factory.supports,
23
+ };
24
+ // Adapters may override any capability (design.md §4.4 HostAdapter.{settings,
25
+ // web, services}); otherwise the default stable impl is used.
26
+ const settings = adapter?.settings ?? createSettingsAPI({ ctx, exposeAllNamespaces, whitelist });
27
+ const web = adapter?.web ?? createWebAPI({ ctx });
28
+ const services = adapter?.services ?? createServicesAPI({ ctx });
29
+ // Runtime host package-name alias registration. The adapter's apply()
30
+ // installs the static set at boot; this method lets plugins add more
31
+ // aliases at runtime (e.g. for packages the adapter didn't know about).
32
+ const runtimeHostAliases = new Map(Object.entries(hostPackageAliases));
33
+ const registerPackageAlias = (oldName, newName) => {
34
+ runtimeHostAliases.set(oldName, newName);
35
+ // Re-install the hook with the updated map.
36
+ installHostPackageAliases(Object.fromEntries(runtimeHostAliases));
37
+ };
38
+ return {
39
+ ...base,
40
+ settings,
41
+ web,
42
+ services,
43
+ registerPackageAlias,
44
+ };
45
+ }
46
+ //# sourceMappingURL=api.js.map
@@ -0,0 +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,IAQ7B;IACC,MAAM,EACJ,GAAG,EACH,UAAU,EACV,OAAO,EACP,OAAO,EACP,mBAAmB,GAAG,KAAK,EAC3B,SAAS,EACT,kBAAkB,GAAG,EAAE,GACxB,GAAG,IAAI,CAAC;IAET,MAAM,IAAI,GAAG;QACX,OAAO,EAAE,cAAc;QACvB,UAAU;QACV,cAAc,EAAE,OAAO,CAAC,QAAQ;KACjC,CAAC;IAEF,8EAA8E;IAC9E,8DAA8D;IAC9D,MAAM,QAAQ,GACZ,OAAO,EAAE,QAAQ,IAAI,iBAAiB,CAAC,EAAE,GAAG,EAAE,mBAAmB,EAAE,SAAS,EAAE,CAAC,CAAC;IAClF,MAAM,GAAG,GAAW,OAAO,EAAE,GAAG,IAAI,YAAY,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IAC1D,MAAM,QAAQ,GAAgB,OAAO,EAAE,QAAQ,IAAI,iBAAiB,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IAE9E,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,oBAAoB;KACrB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,157 @@
1
+ /** Browser-only globals dshloader relies on (typed loosely so the module compiles without DOM lib). */
2
+ type FetchImpl = (input: any, init?: any) => Promise<{
3
+ clone(): {
4
+ json(): any;
5
+ };
6
+ json(): any;
7
+ }>;
8
+ interface DshLoaderWindowLike {
9
+ fetch: FetchImpl;
10
+ location?: {
11
+ origin?: string;
12
+ };
13
+ Response?: new (body?: string, init?: {
14
+ status?: number;
15
+ headers?: Record<string, string>;
16
+ }) => any;
17
+ __ModuleLoader__?: {
18
+ load(handoff: {
19
+ id: string;
20
+ factory: (require: (spec: string) => any) => any;
21
+ }): unknown;
22
+ };
23
+ __DSHLOADER_VERSION__?: string;
24
+ __DSHLOADER_CONFIG__?: {
25
+ exposeAllNamespaces?: boolean;
26
+ };
27
+ __dshNativeRequire__?: (spec: string) => any;
28
+ __dshLoader__?: unknown;
29
+ }
30
+ declare global {
31
+ const window: DshLoaderWindowLike;
32
+ }
33
+ export declare class ModuleNotFoundError extends Error {
34
+ specifier: string;
35
+ constructor(specifier: string);
36
+ }
37
+ interface CreateClientAPIOpts {
38
+ dshVersion?: string;
39
+ adapterVersion?: string;
40
+ moduleAliases?: Record<string, string>;
41
+ packageAliases?: Map<string, string> | Record<string, string>;
42
+ requireImpl?: (spec: string) => any;
43
+ fetchBridge?: {
44
+ describe: () => Promise<any>;
45
+ write: (mode: string, payload: object) => Promise<any>;
46
+ };
47
+ clientCtx?: {
48
+ get?: (name: string) => any;
49
+ };
50
+ }
51
+ /**
52
+ * Build the `window.__dshLoader__` API object.
53
+ */
54
+ export declare function createClientAPI(opts?: CreateClientAPIOpts): {
55
+ version: string;
56
+ dshVersion: string | undefined;
57
+ adapterVersion: string | undefined;
58
+ require(specifier: string): any;
59
+ registerModuleAlias(alias: string, target: string): void;
60
+ /**
61
+ * Register a package-name alias for the client module loader's
62
+ * require(). When a plugin's bundle calls require('@old/pkg-name'),
63
+ * the loader's wrapped require remaps it to '@new/pkg-name' before
64
+ * hitting the module table. This lets dsh rename client packages
65
+ * across versions without forcing plugin bundles to rebuild.
66
+ */
67
+ registerPackageAlias(oldName: string, newName: string): void;
68
+ /**
69
+ * Read a client-side cordis service by name.
70
+ * Proxies to `clientCtx.get(name)` — the same ctx.get plugins use
71
+ * inside their client `apply(ctx)`, but exposed through the stable
72
+ * dshloader surface so plugins don't depend on the cordis context
73
+ * shape directly.
74
+ *
75
+ * Only available when dshloader's client apply() received a ctx
76
+ * (cordis client boot). Returns undefined when ctx is not wired.
77
+ */
78
+ services: {
79
+ get(name: string): any;
80
+ };
81
+ rpc: {
82
+ settings: {
83
+ describe: () => Promise<any>;
84
+ update: (ns: string, section: unknown) => Promise<any>;
85
+ replace: (ns: string, section: unknown) => Promise<any>;
86
+ mutate: (ns: string, ops: unknown) => Promise<any>;
87
+ };
88
+ } | undefined;
89
+ };
90
+ interface InstallClientOpts {
91
+ window?: DshLoaderWindowLike;
92
+ dshVersion?: string;
93
+ exposeAllNamespaces?: boolean;
94
+ requireImpl?: (spec: string) => any;
95
+ hostBridgePrefix?: string;
96
+ packageAliases?: Record<string, string>;
97
+ clientCtx?: {
98
+ get?: (name: string) => any;
99
+ };
100
+ }
101
+ /**
102
+ * Install dshloader into a browser-like environment.
103
+ */
104
+ export declare function installClient(opts?: InstallClientOpts): {
105
+ version: string;
106
+ dshVersion: string | undefined;
107
+ adapterVersion: string | undefined;
108
+ require(specifier: string): any;
109
+ registerModuleAlias(alias: string, target: string): void;
110
+ /**
111
+ * Register a package-name alias for the client module loader's
112
+ * require(). When a plugin's bundle calls require('@old/pkg-name'),
113
+ * the loader's wrapped require remaps it to '@new/pkg-name' before
114
+ * hitting the module table. This lets dsh rename client packages
115
+ * across versions without forcing plugin bundles to rebuild.
116
+ */
117
+ registerPackageAlias(oldName: string, newName: string): void;
118
+ /**
119
+ * Read a client-side cordis service by name.
120
+ * Proxies to `clientCtx.get(name)` — the same ctx.get plugins use
121
+ * inside their client `apply(ctx)`, but exposed through the stable
122
+ * dshloader surface so plugins don't depend on the cordis context
123
+ * shape directly.
124
+ *
125
+ * Only available when dshloader's client apply() received a ctx
126
+ * (cordis client boot). Returns undefined when ctx is not wired.
127
+ */
128
+ services: {
129
+ get(name: string): any;
130
+ };
131
+ rpc: {
132
+ settings: {
133
+ describe: () => Promise<any>;
134
+ update: (ns: string, section: unknown) => Promise<any>;
135
+ replace: (ns: string, section: unknown) => Promise<any>;
136
+ mutate: (ns: string, ops: unknown) => Promise<any>;
137
+ };
138
+ } | undefined;
139
+ } | undefined;
140
+ /**
141
+ * Fetch interceptor for settings namespace whitelist bypass (fix 5, path 2).
142
+ * Mirrors dsh-upstream-fixes/lib/client.js (127-223).
143
+ *
144
+ * - /api/settings.describe: merge non-whitelisted namespaces from the host
145
+ * bridge into the official response (rpcId/official fields preserved).
146
+ * - /api/settings.{update,mutate,replace}: route writes for namespaces the
147
+ * official proxy does NOT expose through the host bridge, and rebuild the
148
+ * response envelope as `{ type: 'server-response', rpcId, result }` so the
149
+ * official client can correlate the response with the request.
150
+ */
151
+ export declare function installSettingsFetchInterceptor(win: DshLoaderWindowLike, bridgePrefix?: string): () => void;
152
+ export declare const name = "@dsh-plugin/dsh-loader";
153
+ export declare const inject: string[];
154
+ export declare function apply(ctx: {
155
+ get?: (name: string) => any;
156
+ }): void;
157
+ export {};