@dsh-plugin/dsh-loader 1.3.2 → 1.3.3

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 (36) hide show
  1. package/dist/adapters/dsh-1-x.d.ts +2 -0
  2. package/dist/adapters/dsh-1-x.js +39 -0
  3. package/dist/adapters/dsh-1-x.js.map +1 -1
  4. package/dist/adapters/index.d.ts +2 -12
  5. package/dist/adapters/index.js +5 -23
  6. package/dist/adapters/index.js.map +1 -1
  7. package/dist/boot-injection.d.ts +32 -0
  8. package/dist/boot-injection.js +107 -0
  9. package/dist/boot-injection.js.map +1 -0
  10. package/dist/client-connection-api-compat.d.ts +90 -0
  11. package/dist/client-connection-api-compat.js +232 -0
  12. package/dist/client-connection-api-compat.js.map +1 -0
  13. package/dist/client-conversation-compat.d.ts +19 -0
  14. package/dist/client-conversation-compat.js +50 -0
  15. package/dist/client-conversation-compat.js.map +1 -0
  16. package/dist/client.d.ts +3 -0
  17. package/dist/client.js +7 -1
  18. package/dist/client.js.map +1 -1
  19. package/dist/services/settings.js +71 -2
  20. package/dist/services/settings.js.map +1 -1
  21. package/dist/types.d.ts +2 -0
  22. package/dist/version.d.ts +2 -1
  23. package/dist/version.js +6 -1
  24. package/dist/version.js.map +1 -1
  25. package/lib/client.js +233 -10
  26. package/lib/client.js.map +1 -1
  27. package/lib/types/adapters/dsh-1-x.d.ts +2 -0
  28. package/lib/types/adapters/index.d.ts +2 -12
  29. package/lib/types/boot-injection.d.ts +32 -0
  30. package/lib/types/client-connection-api-compat.d.ts +90 -0
  31. package/lib/types/client-conversation-compat.d.ts +19 -0
  32. package/lib/types/client-ui.d.ts +4 -0
  33. package/lib/types/client.d.ts +3 -0
  34. package/lib/types/types.d.ts +2 -0
  35. package/lib/types/version.d.ts +2 -1
  36. 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
@@ -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
- '@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
- };
10
+ moduleAliases: Record<string, string>;
11
+ packageAliases: Record<string, string>;
22
12
  }[];
@@ -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,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,19 @@
1
+ /** The legacy service name consumers inject. */
2
+ export declare const CONVERSATION_EVENTS_SERVICE = "conversationEvents";
3
+ /** The dsh ≥ 0.1.2 service owning the definition registry. */
4
+ export declare const UI_CONVERSATION_SERVICE = "uiConversation";
5
+ /** Minimal cordis client context surface this bridge touches. */
6
+ export interface ConversationCompatContext {
7
+ get?(name: string): unknown;
8
+ provide?(name: string, value: unknown): unknown;
9
+ inject?(inject: string[], callback: (ctx: ConversationCompatContext) => unknown): unknown;
10
+ }
11
+ /**
12
+ * Provide the legacy `conversationEvents` service when the host lacks it.
13
+ *
14
+ * @param ctx - the client plugin's cordis context.
15
+ * @returns true when the bridge was armed (legacy name absent and inject
16
+ * available), false when the host already provides the service or the
17
+ * context cannot order provision.
18
+ */
19
+ export declare function installConversationEventsCompat(ctx: ConversationCompatContext): boolean;
@@ -1,6 +1,8 @@
1
1
  import { type DshLoaderUi } from './ui/index.js';
2
2
  export * from './ui/index.js';
3
3
  export { createClientAPI, ensureDshModulesGlobal, installClient, installSettingsFetchInterceptor, ModuleNotFoundError, } from './client.js';
4
+ export { installConversationEventsCompat } from './client-conversation-compat.js';
5
+ export { installConnectionApiCompat, buildLegacyApiProxy } from './client-connection-api-compat.js';
4
6
  /** cordis plugin name (matches the npm package name and the bundle id). */
5
7
  export declare const name = "@dsh-plugin/dsh-loader";
6
8
  /** dshloader consumes no cordis service; it only provides. */
@@ -28,6 +30,8 @@ interface ClientContextLike {
28
30
  get?: (name: string) => unknown;
29
31
  effect?: (fn: () => unknown) => unknown;
30
32
  provide?: (name: string, value: unknown) => unknown;
33
+ /** Ordered dependent-fiber hook used by the conversationEvents bridge. */
34
+ inject?: (inject: string[], callback: (ctx: ClientContextLike) => unknown) => unknown;
31
35
  /**
32
36
  * The cordis plugin-loader service. dsh 0.1.0-rc.8+ carries the client
33
37
  * module system here (`ctx.loader.internal`) instead of exposing it as the
@@ -1,3 +1,4 @@
1
+ import { BOOT_ALIAS_IDS_FLAG } from './version.js';
1
2
  /** Browser-only globals dshloader relies on (typed loosely so the module compiles without DOM lib). */
2
3
  type FetchImpl = (input: any, init?: any) => Promise<{
3
4
  clone(): {
@@ -26,6 +27,8 @@ interface DshLoaderWindowLike {
26
27
  };
27
28
  __dshNativeRequire__?: (spec: string) => any;
28
29
  __dshLoader__?: unknown;
30
+ /** Alias ids the boot injection (src/boot-injection.ts) already registered. */
31
+ [BOOT_ALIAS_IDS_FLAG]?: string[];
29
32
  }
30
33
  declare global {
31
34
  }
@@ -47,6 +47,8 @@ export interface HostAdapter {
47
47
  export interface HostAdapterConfig {
48
48
  exposeAllNamespaces?: boolean;
49
49
  hostPackageAliases?: Record<string, string>;
50
+ /** Extra client module-table aliases merged over the adapter's tables. */
51
+ clientPackageAliases?: Record<string, string>;
50
52
  }
51
53
  /** Result of AdapterRegistry.select(). */
52
54
  export interface AdapterSelection {
@@ -1,2 +1,3 @@
1
- export declare const LOADER_VERSION = "1.3.2";
1
+ export declare const LOADER_VERSION = "1.3.3";
2
2
  export declare const LOG_PREFIX = "[dshloader]";
3
+ export declare const BOOT_ALIAS_IDS_FLAG = "__dshLoaderBootAliases__";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsh-plugin/dsh-loader",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "description": "Runtime compatibility shim for dsh (DeepSeek Harness) cordis bundle plugins: decouples third-party plugins from real dsh internal service names, module paths, and RPC details via a version-aware adapter registry.",
5
5
  "type": "module",
6
6
  "repository": {