@dsh-plugin/dsh-loader 1.3.2-dev.33147555949 → 1.3.3-dev.33217535464
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/dist/adapters/dsh-1-x.d.ts +2 -0
- package/dist/adapters/dsh-1-x.js +39 -0
- package/dist/adapters/dsh-1-x.js.map +1 -1
- package/dist/adapters/index.d.ts +2 -12
- package/dist/adapters/index.js +5 -23
- package/dist/adapters/index.js.map +1 -1
- package/dist/boot-injection.d.ts +32 -0
- package/dist/boot-injection.js +107 -0
- package/dist/boot-injection.js.map +1 -0
- package/dist/client-connection-api-compat.d.ts +90 -0
- package/dist/client-connection-api-compat.js +232 -0
- package/dist/client-connection-api-compat.js.map +1 -0
- package/dist/client-conversation-compat.d.ts +19 -0
- package/dist/client-conversation-compat.js +50 -0
- package/dist/client-conversation-compat.js.map +1 -0
- package/dist/client.d.ts +3 -0
- package/dist/client.js +7 -1
- package/dist/client.js.map +1 -1
- package/dist/services/settings.js +71 -2
- package/dist/services/settings.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/version.d.ts +2 -1
- package/dist/version.js +6 -1
- package/dist/version.js.map +1 -1
- package/lib/client.js +233 -10
- package/lib/client.js.map +1 -1
- package/lib/types/adapters/dsh-1-x.d.ts +2 -0
- package/lib/types/adapters/index.d.ts +2 -12
- package/lib/types/boot-injection.d.ts +32 -0
- package/lib/types/client-connection-api-compat.d.ts +90 -0
- package/lib/types/client-conversation-compat.d.ts +19 -0
- package/lib/types/client-ui.d.ts +4 -0
- package/lib/types/client.d.ts +3 -0
- package/lib/types/types.d.ts +2 -0
- package/lib/types/version.d.ts +2 -1
- package/package.json +1 -1
|
@@ -3,6 +3,8 @@ export declare const supports = ">=0.1.0-rc.1 <2.0.0";
|
|
|
3
3
|
export declare const name = "dsh-1-x";
|
|
4
4
|
export declare const BRIDGE_PREFIX = "/api/dshloader";
|
|
5
5
|
export declare const hostPackageAliases: Record<string, string>;
|
|
6
|
+
export declare const clientModuleAliases: Record<string, string>;
|
|
7
|
+
export declare const clientPackageAliases: Record<string, string>;
|
|
6
8
|
/**
|
|
7
9
|
* Install a Module._resolveFilename hook that maps old package names to
|
|
8
10
|
* new ones for CJS require() calls. Returns a dispose function that
|
package/dist/adapters/dsh-1-x.js
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
// auto-recycles them when the dshloader fiber unloads (design.md §4.4). No
|
|
16
16
|
// custom dispose() is needed for v1's covered capabilities.
|
|
17
17
|
import { LOG_PREFIX } from '../version.js';
|
|
18
|
+
import { installBootAliasInjection } from '../boot-injection.js';
|
|
18
19
|
import { toNamespaceView, settingsErrorToResult } from '../services/settings.js';
|
|
19
20
|
// Covers the real dsh release line (0.1.0-rc.x, verified against
|
|
20
21
|
// dsh-upstream-fixes) and the anticipated 1.x line. The adapter name keeps
|
|
@@ -51,6 +52,33 @@ export const hostPackageAliases = {
|
|
|
51
52
|
'@dsh-plugin/dsh-loader/credentials': '@deepseek-ai/dsh-credentials',
|
|
52
53
|
'@dsh-plugin/dsh-loader/compaction-basic': '@deepseek-ai/dsh-compaction-basic',
|
|
53
54
|
};
|
|
55
|
+
// Client-side deep-import module aliases (registered as module-table alias
|
|
56
|
+
// factories): deep source imports that break when dsh ships no `src/`
|
|
57
|
+
// (fix 1), plus the stable module name form (design.md §3.3.3).
|
|
58
|
+
export const clientModuleAliases = {
|
|
59
|
+
'@deepseek-ai/dsh-client-runtime/src/client/sessions/context-provenance.ts': '@deepseek-ai/dsh-client-runtime/client',
|
|
60
|
+
'dsh/runtime/context-provenance': '@deepseek-ai/dsh-client-runtime/client',
|
|
61
|
+
};
|
|
62
|
+
// Client-side stable package names → real dsh package names for dsh 1.x.
|
|
63
|
+
// Plugins import from @dsh-plugin/dsh-loader/* subpaths (e.g.
|
|
64
|
+
// '@dsh-plugin/dsh-loader/ui-primitives'); the boot-alias injection
|
|
65
|
+
// (src/boot-injection.ts) pre-registers an alias factory per entry before
|
|
66
|
+
// any client entry materializes, and the apply-time __ModuleLoader__ load
|
|
67
|
+
// wrapper (installClient) covers late arrivals. When dsh renames a package,
|
|
68
|
+
// only this table changes — plugin source and bundle stay the same.
|
|
69
|
+
//
|
|
70
|
+
// The table ALSO accepts old-real-name → new-real-name entries as a
|
|
71
|
+
// transition measure for plugin bundles built before adopting stable names.
|
|
72
|
+
export const clientPackageAliases = {
|
|
73
|
+
// Client UI component libraries
|
|
74
|
+
'@dsh-plugin/dsh-loader/ui-primitives': '@deepseek-ai/dsh-client-ui-primitives',
|
|
75
|
+
'@dsh-plugin/dsh-loader/ui-slots': '@deepseek-ai/dsh-client-ui-slots',
|
|
76
|
+
'@dsh-plugin/dsh-loader/web-react': '@deepseek-ai/dsh-client-web-react',
|
|
77
|
+
'@dsh-plugin/dsh-loader/schema-form': '@deepseek-ai/dsh-client-schema-form',
|
|
78
|
+
'@dsh-plugin/dsh-loader/ui-settings': '@deepseek-ai/dsh-client-ui-settings/client',
|
|
79
|
+
// Client runtime
|
|
80
|
+
'@dsh-plugin/dsh-loader/runtime': '@deepseek-ai/dsh-client-runtime/client',
|
|
81
|
+
};
|
|
54
82
|
/**
|
|
55
83
|
* Install a Module._resolveFilename hook that maps old package names to
|
|
56
84
|
* new ones for CJS require() calls. Returns a dispose function that
|
|
@@ -110,6 +138,17 @@ export function create(ctx, config = {}) {
|
|
|
110
138
|
ctx.effect(() => installHostPackageAliases(packageAliases), 'dshloader: host package-name aliases');
|
|
111
139
|
console.log(`${LOG_PREFIX} installed host package aliases: ${Object.keys(packageAliases).join(', ')}`);
|
|
112
140
|
}
|
|
141
|
+
// --- client boot-alias injection (order-independent alias factories) ---
|
|
142
|
+
// dsh ≥ 0.1.2 imports every client entry concurrently, so a dependent can
|
|
143
|
+
// materialize before dshloader's client apply registers the alias
|
|
144
|
+
// factories. Injecting them into the index page removes the ordering
|
|
145
|
+
// dependency on every covered version.
|
|
146
|
+
const clientAliases = {
|
|
147
|
+
...clientModuleAliases,
|
|
148
|
+
...clientPackageAliases,
|
|
149
|
+
...(config.clientPackageAliases ?? {}),
|
|
150
|
+
};
|
|
151
|
+
ctx.effect(() => installBootAliasInjection(ctx, clientAliases), 'dshloader: client boot-alias injection');
|
|
113
152
|
// --- settings bridge routes for the browser fetch path (fix 5, path 2) ---
|
|
114
153
|
// Only registered when the profile explicitly opts in. The host-side
|
|
115
154
|
// stable API (ctx.dshLoader.settings.*) is unaffected by this gate and
|
|
@@ -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,iEAAiE;AACjE,2EAA2E;AAC3E,wEAAwE;AACxE,4EAA4E;AAC5E,0CAA0C;AAC1C,EAAE;AACF,2EAA2E;AAC3E,0EAA0E;AAC1E,wEAAwE;AACxE,uEAAuE;AACvE,mBAAmB;AACnB,MAAM,CAAC,MAAM,QAAQ,GAAG,qBAAqB,CAAC;AAC9C,MAAM,CAAC,MAAM,IAAI,GAAG,SAAS,CAAC;AAE9B,6EAA6E;AAC7E,4BAA4B;AAC5B,MAAM,CAAC,MAAM,aAAa,GAAG,gBAAgB,CAAC;AAE9C,wEAAwE;AACxE,yEAAyE;AACzE,2EAA2E;AAC3E,qEAAqE;AACrE,EAAE;AACF,8DAA8D;AAC9D,0EAA0E;AAC1E,wEAAwE;AACxE,cAAc;AACd,MAAM,CAAC,MAAM,k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AAE,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/adapters/index.d.ts
CHANGED
|
@@ -7,16 +7,6 @@ export declare function registerHostAdapters(registry: AdapterRegistry): Adapter
|
|
|
7
7
|
export declare const clientAdapters: {
|
|
8
8
|
supports: string;
|
|
9
9
|
name: string;
|
|
10
|
-
moduleAliases:
|
|
11
|
-
|
|
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
|
-
};
|
|
10
|
+
moduleAliases: Record<string, string>;
|
|
11
|
+
packageAliases: Record<string, string>;
|
|
22
12
|
}[];
|
package/dist/adapters/index.js
CHANGED
|
@@ -29,29 +29,11 @@ export const clientAdapters = [
|
|
|
29
29
|
{
|
|
30
30
|
supports: dsh1x.supports,
|
|
31
31
|
name: dsh1x.name,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
},
|
|
32
|
+
// Alias tables live on the dsh-1-x adapter module (consumed there by the
|
|
33
|
+
// host-side boot-alias injection) so host and client share one source of
|
|
34
|
+
// truth without a module cycle.
|
|
35
|
+
moduleAliases: dsh1x.clientModuleAliases,
|
|
36
|
+
packageAliases: dsh1x.clientPackageAliases,
|
|
55
37
|
},
|
|
56
38
|
];
|
|
57
39
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AA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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,yEAAyE;QACzE,yEAAyE;QACzE,gCAAgC;QAChC,aAAa,EAAE,KAAK,CAAC,mBAAmB;QACxC,cAAc,EAAE,KAAK,CAAC,oBAAoB;KAC3C;CACF,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { CordisContext } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Build the inline boot script registering one module-table alias factory
|
|
4
|
+
* per `aliases` entry (stable name → real dsh package name).
|
|
5
|
+
*
|
|
6
|
+
* The script is realm-safe in both facade states: when `__ModuleLoader__`
|
|
7
|
+
* already exists it registers immediately; otherwise it installs a
|
|
8
|
+
* property interceptor that catches the bootstrap queue script's
|
|
9
|
+
* `window.__ModuleLoader__ = {...}` assignment, registers into the fresh
|
|
10
|
+
* facade's pending queue, and restores a plain writable data property so
|
|
11
|
+
* later code (facade `create`, dshloader's apply-time load wrapper) sees a
|
|
12
|
+
* normal global.
|
|
13
|
+
*
|
|
14
|
+
* @param aliases - alias module id → real module id.
|
|
15
|
+
* @returns JavaScript source for an inline classic script.
|
|
16
|
+
*/
|
|
17
|
+
export declare function buildBootAliasScript(aliases: Record<string, string>): string;
|
|
18
|
+
/**
|
|
19
|
+
* Contribute the boot-alias script to every rendered index page.
|
|
20
|
+
*
|
|
21
|
+
* The listener pushes one `{ kind: 'script', placement: 'head' }` row onto
|
|
22
|
+
* the injection table the host webserver gathers per index render. On dsh
|
|
23
|
+
* versions whose webserver never emits `webserver/index-inject` the
|
|
24
|
+
* listener simply never fires and only the apply-time path registers
|
|
25
|
+
* aliases — the pre-0.1.2 behaviour that already worked there.
|
|
26
|
+
*
|
|
27
|
+
* @param ctx - host plugin context.
|
|
28
|
+
* @param aliases - alias module id → real module id (both the package and
|
|
29
|
+
* the deep-import module alias tables).
|
|
30
|
+
* @returns Dispose function removing the listener.
|
|
31
|
+
*/
|
|
32
|
+
export declare function installBootAliasInjection(ctx: CordisContext, aliases: Record<string, string>): () => void;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// Client boot-alias injection (host side).
|
|
2
|
+
//
|
|
3
|
+
// Why this exists: dshloader's stable client module names
|
|
4
|
+
// (`@dsh-plugin/dsh-loader/ui-primitives` and friends, plus the deep-import
|
|
5
|
+
// module aliases) resolve through alias factories registered with the
|
|
6
|
+
// browser module system. Registering them from dshloader's own client
|
|
7
|
+
// `apply` is order-dependent: dsh ≥ 0.1.2 imports every client entry
|
|
8
|
+
// CONCURRENTLY (`Promise.all(rows.map(loader.create))` in the web boot
|
|
9
|
+
// kernel), so a dependent entry can materialize — and hit
|
|
10
|
+
// `require("@dsh-plugin/dsh-loader/ui-primitives")` — before dshloader's
|
|
11
|
+
// client apply ever ran, crashing boot with "missed the module table".
|
|
12
|
+
//
|
|
13
|
+
// The fix moves the alias-factory registration out of cordis activation
|
|
14
|
+
// order entirely: the host adapter contributes one inline head script via
|
|
15
|
+
// the webserver's `webserver/index-inject` table. That script runs while
|
|
16
|
+
// the document parses — before the shell boots the module system and long
|
|
17
|
+
// before any entry import — and registers every alias factory with the
|
|
18
|
+
// `__ModuleLoader__` facade directly. The facade contract (queue-mode
|
|
19
|
+
// `load(registration)` appending to a pending queue, live-mode registering
|
|
20
|
+
// immediately) is identical on dsh 0.1.0-rc.x through 0.1.2+, so one script
|
|
21
|
+
// covers every version; versions without the facade simply never fire the
|
|
22
|
+
// setter and dshloader's apply-time registration stays the fallback.
|
|
23
|
+
//
|
|
24
|
+
// `installClient` (src/client.ts) reads {@link BOOT_ALIAS_IDS_FLAG} to skip
|
|
25
|
+
// re-registering the same factories (the live module system throws on
|
|
26
|
+
// duplicate factory ids).
|
|
27
|
+
import { BOOT_ALIAS_IDS_FLAG } from './version.js';
|
|
28
|
+
/** The `webserver/index-inject` event name (dsh ≥ 0.1.0-rc.x host webserver). */
|
|
29
|
+
const INDEX_INJECT_EVENT = 'webserver/index-inject';
|
|
30
|
+
/**
|
|
31
|
+
* Build the inline boot script registering one module-table alias factory
|
|
32
|
+
* per `aliases` entry (stable name → real dsh package name).
|
|
33
|
+
*
|
|
34
|
+
* The script is realm-safe in both facade states: when `__ModuleLoader__`
|
|
35
|
+
* already exists it registers immediately; otherwise it installs a
|
|
36
|
+
* property interceptor that catches the bootstrap queue script's
|
|
37
|
+
* `window.__ModuleLoader__ = {...}` assignment, registers into the fresh
|
|
38
|
+
* facade's pending queue, and restores a plain writable data property so
|
|
39
|
+
* later code (facade `create`, dshloader's apply-time load wrapper) sees a
|
|
40
|
+
* normal global.
|
|
41
|
+
*
|
|
42
|
+
* @param aliases - alias module id → real module id.
|
|
43
|
+
* @returns JavaScript source for an inline classic script.
|
|
44
|
+
*/
|
|
45
|
+
export function buildBootAliasScript(aliases) {
|
|
46
|
+
const table = JSON.stringify(aliases);
|
|
47
|
+
return `!function(){
|
|
48
|
+
var w=window,F=${JSON.stringify(BOOT_ALIAS_IDS_FLAG)};
|
|
49
|
+
if(w[F])return;
|
|
50
|
+
var A=${table};
|
|
51
|
+
var ids=Object.keys(A);
|
|
52
|
+
function reg(loader){
|
|
53
|
+
for(var i=0;i<ids.length;i++){
|
|
54
|
+
var id=ids[i];
|
|
55
|
+
loader.load({id:id,factory:function(t,a){return function(require){
|
|
56
|
+
var mod=require(t);
|
|
57
|
+
if(a.endsWith("context-provenance.ts")||a.endsWith("context-provenance"))return{contextProvenance:mod.contextProvenance};
|
|
58
|
+
return mod;
|
|
59
|
+
}}(A[id],id)});
|
|
60
|
+
}
|
|
61
|
+
w[F]=ids;
|
|
62
|
+
}
|
|
63
|
+
var facade=w.__ModuleLoader__;
|
|
64
|
+
if(facade&&typeof facade.load==="function"){reg(facade);return;}
|
|
65
|
+
var cur;
|
|
66
|
+
Object.defineProperty(w,"__ModuleLoader__",{
|
|
67
|
+
configurable:true,enumerable:true,
|
|
68
|
+
get:function(){return cur;},
|
|
69
|
+
set:function(v){
|
|
70
|
+
if(v&&typeof v.load==="function"){
|
|
71
|
+
reg(v);
|
|
72
|
+
Object.defineProperty(w,"__ModuleLoader__",{configurable:true,enumerable:true,writable:true,value:v});
|
|
73
|
+
}else{cur=v;}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}();
|
|
77
|
+
`;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Contribute the boot-alias script to every rendered index page.
|
|
81
|
+
*
|
|
82
|
+
* The listener pushes one `{ kind: 'script', placement: 'head' }` row onto
|
|
83
|
+
* the injection table the host webserver gathers per index render. On dsh
|
|
84
|
+
* versions whose webserver never emits `webserver/index-inject` the
|
|
85
|
+
* listener simply never fires and only the apply-time path registers
|
|
86
|
+
* aliases — the pre-0.1.2 behaviour that already worked there.
|
|
87
|
+
*
|
|
88
|
+
* @param ctx - host plugin context.
|
|
89
|
+
* @param aliases - alias module id → real module id (both the package and
|
|
90
|
+
* the deep-import module alias tables).
|
|
91
|
+
* @returns Dispose function removing the listener.
|
|
92
|
+
*/
|
|
93
|
+
export function installBootAliasInjection(ctx, aliases) {
|
|
94
|
+
if (Object.keys(aliases).length === 0 || typeof ctx.on !== 'function')
|
|
95
|
+
return () => { };
|
|
96
|
+
const row = { kind: 'script', placement: 'head', text: buildBootAliasScript(aliases) };
|
|
97
|
+
const listener = (table) => {
|
|
98
|
+
table.push(row);
|
|
99
|
+
};
|
|
100
|
+
const dispose = ctx.on(INDEX_INJECT_EVENT, listener);
|
|
101
|
+
if (typeof dispose === 'function')
|
|
102
|
+
return dispose;
|
|
103
|
+
return () => {
|
|
104
|
+
ctx.off?.(INDEX_INJECT_EVENT, listener);
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=boot-injection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boot-injection.js","sourceRoot":"","sources":["../src/boot-injection.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,EAAE;AACF,0DAA0D;AAC1D,4EAA4E;AAC5E,sEAAsE;AACtE,sEAAsE;AACtE,qEAAqE;AACrE,uEAAuE;AACvE,0DAA0D;AAC1D,yEAAyE;AACzE,uEAAuE;AACvE,EAAE;AACF,wEAAwE;AACxE,0EAA0E;AAC1E,yEAAyE;AACzE,0EAA0E;AAC1E,uEAAuE;AACvE,sEAAsE;AACtE,2EAA2E;AAC3E,4EAA4E;AAC5E,0EAA0E;AAC1E,qEAAqE;AACrE,EAAE;AACF,4EAA4E;AAC5E,sEAAsE;AACtE,0BAA0B;AAE1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGnD,iFAAiF;AACjF,MAAM,kBAAkB,GAAG,wBAAwB,CAAC;AAEpD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAA+B;IAClE,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACtC,OAAO;iBACQ,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC;;QAE5C,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BZ,CAAC;AACF,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,yBAAyB,CACvC,GAAkB,EAClB,OAA+B;IAE/B,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,GAAG,CAAC,EAAE,KAAK,UAAU;QAAE,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;IACvF,MAAM,GAAG,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,CAAC,OAAO,CAAC,EAAE,CAAC;IACvF,MAAM,QAAQ,GAAG,CAAC,KAAgB,EAAQ,EAAE;QAC1C,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC;IACF,MAAM,OAAO,GAAG,GAAG,CAAC,EAAE,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC;IACrD,IAAI,OAAO,OAAO,KAAK,UAAU;QAAE,OAAO,OAAO,CAAC;IAClD,OAAO,GAAG,EAAE;QACT,GAA4E,CAAC,GAAG,EAAE,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC;IACpH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/** The legacy RPC proxy property checked on the connection handle. */
|
|
2
|
+
export declare const CONNECTION_SERVICE = "connection";
|
|
3
|
+
/** The dsh ≥ 0.1.2 Typert application-RPC service. */
|
|
4
|
+
export declare const REMOTE_SERVICE = "remote";
|
|
5
|
+
/** Minimal cordis client context surface this bridge touches. */
|
|
6
|
+
export interface ConnectionApiCompatContext {
|
|
7
|
+
get?(name: string): unknown;
|
|
8
|
+
inject?(inject: string[], callback: (ctx: ConnectionApiCompatContext) => unknown): unknown;
|
|
9
|
+
}
|
|
10
|
+
/** Bare RpcResult the 0.1.2 Typert remote resolves to. */
|
|
11
|
+
export interface RpcResultOk<T> {
|
|
12
|
+
ok: true;
|
|
13
|
+
value: T;
|
|
14
|
+
}
|
|
15
|
+
export interface RpcResultError {
|
|
16
|
+
ok: false;
|
|
17
|
+
error: {
|
|
18
|
+
code: string;
|
|
19
|
+
message: string;
|
|
20
|
+
details?: unknown;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export type RpcResult<T> = RpcResultOk<T> | RpcResultError;
|
|
24
|
+
/** The legacy 0.1.1 response envelope consumers unwrap with `valueOf`. */
|
|
25
|
+
export interface RpcResponse<T> {
|
|
26
|
+
result: RpcResult<T>;
|
|
27
|
+
}
|
|
28
|
+
interface LlmProviderInfoLike {
|
|
29
|
+
id: string;
|
|
30
|
+
label?: string;
|
|
31
|
+
}
|
|
32
|
+
interface LlmConfigurableProviderLike {
|
|
33
|
+
provider: string;
|
|
34
|
+
displayName: string;
|
|
35
|
+
settingsNs: string;
|
|
36
|
+
settingsPath?: readonly string[];
|
|
37
|
+
declared?: boolean;
|
|
38
|
+
}
|
|
39
|
+
/** The remote namespaces this bridge adapts. */
|
|
40
|
+
interface RemoteLike {
|
|
41
|
+
llm?: {
|
|
42
|
+
listProviders?(): Promise<RpcResult<readonly LlmProviderInfoLike[]>>;
|
|
43
|
+
listConfigurableProviders?(): Promise<RpcResult<readonly LlmConfigurableProviderLike[]>>;
|
|
44
|
+
};
|
|
45
|
+
session?: {
|
|
46
|
+
modelCatalog?(): Promise<RpcResult<unknown>>;
|
|
47
|
+
};
|
|
48
|
+
settings?: {
|
|
49
|
+
describe?(): Promise<RpcResult<SettingsDescribeLike>>;
|
|
50
|
+
/** 0.1.2: merge a patch into the namespace's stored user section. */
|
|
51
|
+
update?(ns: string, patch: Record<string, unknown>, expectedRevision?: number): Promise<RpcResult<unknown>>;
|
|
52
|
+
/** 0.1.2: replace the namespace's stored user section wholesale. */
|
|
53
|
+
replace?(ns: string, section: Record<string, unknown>, expectedRevision?: number): Promise<RpcResult<unknown>>;
|
|
54
|
+
mutate?(ns: string, ops: readonly unknown[], expectedRevision?: number): Promise<RpcResult<unknown>>;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
interface SettingsNamespaceViewLike {
|
|
58
|
+
ns: string;
|
|
59
|
+
user?: unknown;
|
|
60
|
+
revision?: number;
|
|
61
|
+
}
|
|
62
|
+
interface SettingsDescribeLike {
|
|
63
|
+
namespaces: readonly SettingsNamespaceViewLike[];
|
|
64
|
+
writable?: boolean;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Build the legacy `connection.api` proxy over a 0.1.2 `ctx.remote` face.
|
|
68
|
+
* Namespaces or methods missing from the remote degrade to a `transport`
|
|
69
|
+
* failure response rather than a synchronous throw, so one absent method does
|
|
70
|
+
* not take down the whole proxy.
|
|
71
|
+
*/
|
|
72
|
+
export declare function buildLegacyApiProxy(remote: RemoteLike): Record<string, unknown>;
|
|
73
|
+
/**
|
|
74
|
+
* Install the legacy `connection.api` proxy when the host's connection
|
|
75
|
+
* handle lacks one.
|
|
76
|
+
*
|
|
77
|
+
* The inject list names every nested Remote service the proxy touches:
|
|
78
|
+
* cordis guards nested service access (`remote.session` etc.) behind the
|
|
79
|
+
* caller fiber's inject declarations, so the namespaces are resolved through
|
|
80
|
+
* `scope.get('remote.<name>')` inside the ordered fiber rather than by
|
|
81
|
+
* walking properties off the `remote` service.
|
|
82
|
+
*
|
|
83
|
+
* @param ctx - the client plugin's cordis context.
|
|
84
|
+
* @param onReady - invoked once the proxy question is settled: synchronously
|
|
85
|
+
* when no bridge is needed (legacy host, or a context without inject), or
|
|
86
|
+
* from the ordered inject fiber after the proxy was attached.
|
|
87
|
+
* @returns true when the ready signal was delivered synchronously.
|
|
88
|
+
*/
|
|
89
|
+
export declare function installConnectionApiCompat(ctx: ConnectionApiCompatContext, onReady: () => void): boolean;
|
|
90
|
+
export {};
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
// connection.api compatibility bridge (browser half).
|
|
2
|
+
//
|
|
3
|
+
// dsh ≤ 0.1.1 exposed the browser RPC proxy as `connection.api`: namespace
|
|
4
|
+
// objects (`llm` / `settings` / …) whose methods take one request object and
|
|
5
|
+
// resolve to an RpcResponse (`{result: {ok, value | error}}`). dsh 0.1.2
|
|
6
|
+
// restructured the wire: `connection` is a transport handle (`rpc`,
|
|
7
|
+
// `generation`, `start`) and the application RPC face moved to the
|
|
8
|
+
// `ctx.remote` Typert proxy, whose methods are positional and resolve to a
|
|
9
|
+
// bare RpcResult (`{ok, value | error}`). Method names moved too:
|
|
10
|
+
//
|
|
11
|
+
// api.llm.providers({}) → remote.llm.listProviders() +
|
|
12
|
+
// remote.llm.listConfigurableProviders()
|
|
13
|
+
// api.llm.models({}) → remote.session.modelCatalog()
|
|
14
|
+
// api.settings.describe({}) → remote.settings.describe()
|
|
15
|
+
// api.settings.update({ns,patch}) → deep-merge into the user section, then
|
|
16
|
+
// remote.settings.update(ns, merged, rev)
|
|
17
|
+
//
|
|
18
|
+
// When `connection.api` is absent this module synthesises the legacy proxy
|
|
19
|
+
// from `ctx.remote`, so consumers written against the 0.1.1 face work
|
|
20
|
+
// unchanged on 0.1.2. Provision is ordered through
|
|
21
|
+
// `ctx.inject(['connection','remote'], …)`: the caller's `onReady` fires only
|
|
22
|
+
// after the proxy is in place, letting dependent plugins hold a cordis
|
|
23
|
+
// service inject on the ordering signal. On hosts where `connection.api`
|
|
24
|
+
// already exists the bridge is a synchronous no-op.
|
|
25
|
+
/** The legacy RPC proxy property checked on the connection handle. */
|
|
26
|
+
export const CONNECTION_SERVICE = 'connection';
|
|
27
|
+
/** The dsh ≥ 0.1.2 Typert application-RPC service. */
|
|
28
|
+
export const REMOTE_SERVICE = 'remote';
|
|
29
|
+
/** Wrap a bare RpcResult promise into the legacy RpcResponse envelope. */
|
|
30
|
+
async function wrapRpc(operation) {
|
|
31
|
+
try {
|
|
32
|
+
return { result: await operation };
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
return {
|
|
36
|
+
result: {
|
|
37
|
+
ok: false,
|
|
38
|
+
error: {
|
|
39
|
+
code: 'transport',
|
|
40
|
+
message: error instanceof Error ? error.message : String(error),
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function isPlainRecord(value) {
|
|
47
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Join the registered route list with the declared configurable-provider
|
|
51
|
+
* directory, mirroring 0.1.2's joinProviderDirectory: declared rows in
|
|
52
|
+
* declaration order, then live routes with no declaration.
|
|
53
|
+
*/
|
|
54
|
+
function joinProviderDirectory(registered, declared) {
|
|
55
|
+
const active = new Set(registered.map((provider) => provider.id));
|
|
56
|
+
const declaredKeys = new Set(declared.map((entry) => entry.provider));
|
|
57
|
+
const rows = declared.map((entry) => ({
|
|
58
|
+
provider: entry.provider,
|
|
59
|
+
displayName: entry.displayName,
|
|
60
|
+
settingsNs: entry.settingsNs,
|
|
61
|
+
settingsPath: [...(entry.settingsPath ?? [])],
|
|
62
|
+
active: active.has(entry.provider),
|
|
63
|
+
...(entry.declared === undefined ? {} : { declared: entry.declared }),
|
|
64
|
+
}));
|
|
65
|
+
for (const provider of registered) {
|
|
66
|
+
if (declaredKeys.has(provider.id))
|
|
67
|
+
continue;
|
|
68
|
+
rows.push({
|
|
69
|
+
provider: provider.id,
|
|
70
|
+
displayName: provider.label ?? provider.id,
|
|
71
|
+
settingsNs: '',
|
|
72
|
+
settingsPath: [],
|
|
73
|
+
active: true,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return rows;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Build the legacy `connection.api` proxy over a 0.1.2 `ctx.remote` face.
|
|
80
|
+
* Namespaces or methods missing from the remote degrade to a `transport`
|
|
81
|
+
* failure response rather than a synchronous throw, so one absent method does
|
|
82
|
+
* not take down the whole proxy.
|
|
83
|
+
*/
|
|
84
|
+
export function buildLegacyApiProxy(remote) {
|
|
85
|
+
const missing = (name) => Promise.resolve({
|
|
86
|
+
result: { ok: false, error: { code: 'transport', message: `[dshloader] connection.api: remote.${name} unavailable` } },
|
|
87
|
+
});
|
|
88
|
+
const llm = {
|
|
89
|
+
providers: async () => {
|
|
90
|
+
const list = remote.llm?.listProviders;
|
|
91
|
+
const listConfigurable = remote.llm?.listConfigurableProviders;
|
|
92
|
+
if (list === undefined || listConfigurable === undefined)
|
|
93
|
+
return missing('llm.listProviders');
|
|
94
|
+
const [registered, declared] = await Promise.all([
|
|
95
|
+
wrapRpc(list.call(remote.llm)),
|
|
96
|
+
wrapRpc(listConfigurable.call(remote.llm)),
|
|
97
|
+
]);
|
|
98
|
+
if (!registered.result.ok)
|
|
99
|
+
return { result: registered.result };
|
|
100
|
+
if (!declared.result.ok)
|
|
101
|
+
return { result: declared.result };
|
|
102
|
+
return {
|
|
103
|
+
result: {
|
|
104
|
+
ok: true,
|
|
105
|
+
value: { providers: joinProviderDirectory(registered.result.value, declared.result.value) },
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
},
|
|
109
|
+
models: async () => {
|
|
110
|
+
const catalog = remote.session?.modelCatalog;
|
|
111
|
+
if (catalog === undefined)
|
|
112
|
+
return missing('session.modelCatalog');
|
|
113
|
+
return wrapRpc(catalog.call(remote.session));
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
const settings = {
|
|
117
|
+
describe: async () => {
|
|
118
|
+
const describe = remote.settings?.describe;
|
|
119
|
+
if (describe === undefined)
|
|
120
|
+
return missing('settings.describe');
|
|
121
|
+
return wrapRpc(describe.call(remote.settings));
|
|
122
|
+
},
|
|
123
|
+
/**
|
|
124
|
+
* Legacy patch write: `{ns, patch, expectedRevision}` maps straight onto
|
|
125
|
+
* 0.1.2's `update(ns, patch, expectedRevision)` — a host-side deep merge
|
|
126
|
+
* into the stored user section, so unknown keys survive and the revision
|
|
127
|
+
* CAS guards the merge with no client read-modify-write window. A caller
|
|
128
|
+
* passing `{ns, section}` (full replacement intent) is routed to
|
|
129
|
+
* `replace(ns, section, expectedRevision)`.
|
|
130
|
+
*/
|
|
131
|
+
update: async (request) => {
|
|
132
|
+
const update = remote.settings?.update;
|
|
133
|
+
const replace = remote.settings?.replace;
|
|
134
|
+
if (update === undefined)
|
|
135
|
+
return missing('settings.update');
|
|
136
|
+
if (typeof request?.ns !== 'string') {
|
|
137
|
+
return {
|
|
138
|
+
result: { ok: false, error: { code: 'invalid-request', message: '[dshloader] connection.api: settings.update requires an ns string' } },
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
if (request.section !== undefined && replace !== undefined) {
|
|
142
|
+
const section = isPlainRecord(request.section) ? request.section : {};
|
|
143
|
+
return wrapRpc(replace.call(remote.settings, request.ns, section, request.expectedRevision));
|
|
144
|
+
}
|
|
145
|
+
const patch = request.section !== undefined ? request.section : request.patch;
|
|
146
|
+
return wrapRpc(update.call(remote.settings, request.ns, isPlainRecord(patch) ? patch : {}, request.expectedRevision));
|
|
147
|
+
},
|
|
148
|
+
mutate: async (request) => {
|
|
149
|
+
const mutate = remote.settings?.mutate;
|
|
150
|
+
if (mutate === undefined)
|
|
151
|
+
return missing('settings.mutate');
|
|
152
|
+
if (typeof request?.ns !== 'string' || !Array.isArray(request.ops)) {
|
|
153
|
+
return {
|
|
154
|
+
result: { ok: false, error: { code: 'invalid-request', message: '[dshloader] connection.api: settings.mutate requires ns and ops' } },
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
return wrapRpc(mutate.call(remote.settings, request.ns, request.ops, request.expectedRevision));
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
return { llm, settings };
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Install the legacy `connection.api` proxy when the host's connection
|
|
164
|
+
* handle lacks one.
|
|
165
|
+
*
|
|
166
|
+
* The inject list names every nested Remote service the proxy touches:
|
|
167
|
+
* cordis guards nested service access (`remote.session` etc.) behind the
|
|
168
|
+
* caller fiber's inject declarations, so the namespaces are resolved through
|
|
169
|
+
* `scope.get('remote.<name>')` inside the ordered fiber rather than by
|
|
170
|
+
* walking properties off the `remote` service.
|
|
171
|
+
*
|
|
172
|
+
* @param ctx - the client plugin's cordis context.
|
|
173
|
+
* @param onReady - invoked once the proxy question is settled: synchronously
|
|
174
|
+
* when no bridge is needed (legacy host, or a context without inject), or
|
|
175
|
+
* from the ordered inject fiber after the proxy was attached.
|
|
176
|
+
* @returns true when the ready signal was delivered synchronously.
|
|
177
|
+
*/
|
|
178
|
+
export function installConnectionApiCompat(ctx, onReady) {
|
|
179
|
+
const connection = ctx.get?.(CONNECTION_SERVICE);
|
|
180
|
+
if (connection?.api !== undefined) {
|
|
181
|
+
onReady();
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
184
|
+
if (typeof ctx.inject !== 'function') {
|
|
185
|
+
// No ordered hook: keep the legacy degraded behaviour rather than
|
|
186
|
+
// blocking a dependent plugin forever on a face that may never exist.
|
|
187
|
+
onReady();
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
190
|
+
// Stage A: wait for the connection handle alone — it exists on every host
|
|
191
|
+
// version. The remote.* nested services below are 0.1.2+ only, so they must
|
|
192
|
+
// NOT share this fiber: on a 0.1.0/0.1.1 host they never materialize and a
|
|
193
|
+
// combined inject list would pend forever, starving dependents of the
|
|
194
|
+
// ready signal (observed: dshLoaderUi never provided, boot stuck).
|
|
195
|
+
let ready = false;
|
|
196
|
+
const readyOnce = () => {
|
|
197
|
+
if (ready)
|
|
198
|
+
return;
|
|
199
|
+
ready = true;
|
|
200
|
+
onReady();
|
|
201
|
+
};
|
|
202
|
+
ctx.inject([CONNECTION_SERVICE], (scope) => {
|
|
203
|
+
const conn = scope.get?.(CONNECTION_SERVICE);
|
|
204
|
+
if (conn === undefined || conn.api !== undefined) {
|
|
205
|
+
readyOnce();
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
// Stage B (0.1.2+): bridge from the Typert remote faces. They appear only
|
|
209
|
+
// after the gateway connects, and cordis guards nested service access
|
|
210
|
+
// behind the caller fiber's inject declarations — hence a second fiber
|
|
211
|
+
// naming each nested service.
|
|
212
|
+
ctx.inject?.([CONNECTION_SERVICE, `${REMOTE_SERVICE}.llm`, `${REMOTE_SERVICE}.session`, `${REMOTE_SERVICE}.settings`], (inner) => {
|
|
213
|
+
const innerConn = inner.get?.(CONNECTION_SERVICE);
|
|
214
|
+
if (innerConn !== undefined && innerConn.api === undefined) {
|
|
215
|
+
innerConn.api = buildLegacyApiProxy({
|
|
216
|
+
llm: inner.get?.(`${REMOTE_SERVICE}.llm`),
|
|
217
|
+
session: inner.get?.(`${REMOTE_SERVICE}.session`),
|
|
218
|
+
settings: inner.get?.(`${REMOTE_SERVICE}.settings`),
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
readyOnce();
|
|
222
|
+
});
|
|
223
|
+
// A host without connection.api AND without the remote faces (so stage B
|
|
224
|
+
// never fires) must not hold dependents forever: release them unbridged
|
|
225
|
+
// after a generous window; their per-call reads then fail loudly instead
|
|
226
|
+
// of the whole boot stalling on a service that will never exist.
|
|
227
|
+
const timer = setTimeout(readyOnce, 15000);
|
|
228
|
+
timer.unref?.();
|
|
229
|
+
});
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
//# sourceMappingURL=client-connection-api-compat.js.map
|