@ethisyscore/extension-runtime 1.34.0 → 1.35.0

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 (33) hide show
  1. package/dist/{bridge-client-UK3qcGoi.d.ts → bridge-client-DD99netz.d.ts} +2 -33
  2. package/dist/{bridge-client-CIThO7jZ.d.cts → bridge-client-DzRcKIJT.d.cts} +2 -33
  3. package/dist/bridge-envelopes-DA6vxbyb.d.cts +151 -0
  4. package/dist/bridge-envelopes-DA6vxbyb.d.ts +151 -0
  5. package/dist/host/index.cjs +76 -2
  6. package/dist/host/index.cjs.map +1 -1
  7. package/dist/host/index.d.cts +3 -3
  8. package/dist/host/index.d.ts +3 -3
  9. package/dist/host/index.js +76 -2
  10. package/dist/host/index.js.map +1 -1
  11. package/dist/mock-host/cli.cjs +87 -2
  12. package/dist/mock-host/cli.cjs.map +1 -1
  13. package/dist/mock-host/cli.d.cts +2 -2
  14. package/dist/mock-host/cli.d.ts +2 -2
  15. package/dist/mock-host/cli.js +87 -2
  16. package/dist/mock-host/cli.js.map +1 -1
  17. package/dist/mock-host/index.cjs +41 -1
  18. package/dist/mock-host/index.cjs.map +1 -1
  19. package/dist/mock-host/index.d.cts +19 -7
  20. package/dist/mock-host/index.d.ts +19 -7
  21. package/dist/mock-host/index.js +41 -1
  22. package/dist/mock-host/index.js.map +1 -1
  23. package/dist/plugin/index.cjs +15 -3
  24. package/dist/plugin/index.cjs.map +1 -1
  25. package/dist/plugin/index.d.cts +13 -5
  26. package/dist/plugin/index.d.ts +13 -5
  27. package/dist/plugin/index.js +15 -4
  28. package/dist/plugin/index.js.map +1 -1
  29. package/dist/{transport-BN9Mzn_m.d.cts → transport-CHa8ESUx.d.ts} +39 -4
  30. package/dist/{transport-Jfd9KXAh.d.ts → transport-DJE6ljme.d.cts} +39 -4
  31. package/package.json +1 -1
  32. package/dist/bridge-envelopes-BRKGSiSC.d.cts +0 -63
  33. package/dist/bridge-envelopes-BRKGSiSC.d.ts +0 -63
@@ -1,10 +1,11 @@
1
- import { M as McpTransport, P as PortBridgeClient, T as ThemePayload, L as LocalePayload } from '../bridge-client-CIThO7jZ.cjs';
2
- export { A as A11yPayload, B as BridgePortShim, D as DensityPayload, N as NavPayload, S as SessionTokenPayload, c as createPortBridgeClient } from '../bridge-client-CIThO7jZ.cjs';
1
+ import { M as McpTransport } from '../bridge-envelopes-DA6vxbyb.cjs';
2
+ export { U as UploadDocumentMeta, f as UploadDocumentResult } from '../bridge-envelopes-DA6vxbyb.cjs';
3
3
  import * as react from 'react';
4
4
  import { ReactNode } from 'react';
5
5
  import { SduiNode, RenderMode } from '@ethisyscore/protocol';
6
6
  import { RemoteConnection } from '@remote-dom/core';
7
- import '../bridge-envelopes-BRKGSiSC.cjs';
7
+ import { P as PortBridgeClient, T as ThemePayload, L as LocalePayload } from '../bridge-client-DzRcKIJT.cjs';
8
+ export { A as A11yPayload, B as BridgePortShim, D as DensityPayload, N as NavPayload, S as SessionTokenPayload, c as createPortBridgeClient } from '../bridge-client-DzRcKIJT.cjs';
8
9
 
9
10
  /**
10
11
  * A single client-push event delivered from the host to a plugin surface. The host
@@ -198,6 +199,13 @@ interface ExtensionRuntimeProviderProps {
198
199
  * shard work across multiple hosts.
199
200
  */
200
201
  declare function ExtensionRuntimeProvider({ transport, clientPush, identity, realtime, children }: ExtensionRuntimeProviderProps): ReactNode;
202
+ /**
203
+ * Internal helper used by the hooks. Returns the explicit override when
204
+ * supplied, otherwise falls back to the context. Throws a deterministic
205
+ * error if neither is available so misconfiguration fails loudly at the
206
+ * first render rather than producing silent no-ops.
207
+ */
208
+ declare function useExtensionRuntimeTransport(override?: McpTransport): McpTransport;
201
209
 
202
210
  interface UseMcpResourceOptions {
203
211
  /**
@@ -564,7 +572,7 @@ interface PortShim {
564
572
  removeEventListener(type: "message", listener: (event: {
565
573
  data: unknown;
566
574
  }) => void): void;
567
- postMessage(value: unknown): void;
575
+ postMessage(value: unknown, transfer?: Transferable[]): void;
568
576
  }
569
577
  /**
570
578
  * Construct an {@link McpTransport} backed by a MessagePort.
@@ -666,4 +674,4 @@ interface UseAuthResult {
666
674
  */
667
675
  declare function useAuth(transport: McpTransport): UseAuthResult;
668
676
 
669
- export { BridgeClientContext, type ClientPushChannel, ClientPushContext, type ClientPushEvent, type ClientPushSubscribeOptions, type CreatePortMcpTransportOptions, type CreateRemoteRootOptions, type DeclarativePluginConfig, type EthisysPluginConfig, ExtensionRuntimeProvider, type ExtensionRuntimeProviderProps, type HostIdentity, HostIdentityContext, type HostIdentityUser, type HostPermission, type ItemsResponse, LocalePayload, McpTransport, PluginRealtimeContext, type PluginRealtimeSource, PortBridgeClient, type PortShim, type RemoteRoot, ThemePayload, type UseAuthResult, type UseClientPushSubscriptionOptions, type UseFrontendSessionTokenResult, type UseMcpQueryOptions, type UseMcpQueryResult, type UseMcpResourceOptions, type UseMcpResourceResult, type UseMcpToolOptions, type UseMcpToolResult, createPortMcpTransport, createRemoteRoot, decodeJwtPayload, defineDeclarativePlugin, defineEthisysPlugin, unwrapItems, useAuth, useBridgeClient, useBridgeLocale, useBridgeTheme, useClientPushSubscription, useFrontendSessionToken, useHostIdentity, useMcpQuery, useMcpResource, useMcpTool, usePluginRealtimeSource };
677
+ export { BridgeClientContext, type ClientPushChannel, ClientPushContext, type ClientPushEvent, type ClientPushSubscribeOptions, type CreatePortMcpTransportOptions, type CreateRemoteRootOptions, type DeclarativePluginConfig, type EthisysPluginConfig, ExtensionRuntimeProvider, type ExtensionRuntimeProviderProps, type HostIdentity, HostIdentityContext, type HostIdentityUser, type HostPermission, type ItemsResponse, LocalePayload, McpTransport, PluginRealtimeContext, type PluginRealtimeSource, PortBridgeClient, type PortShim, type RemoteRoot, ThemePayload, type UseAuthResult, type UseClientPushSubscriptionOptions, type UseFrontendSessionTokenResult, type UseMcpQueryOptions, type UseMcpQueryResult, type UseMcpResourceOptions, type UseMcpResourceResult, type UseMcpToolOptions, type UseMcpToolResult, createPortMcpTransport, createRemoteRoot, decodeJwtPayload, defineDeclarativePlugin, defineEthisysPlugin, unwrapItems, useAuth, useBridgeClient, useBridgeLocale, useBridgeTheme, useClientPushSubscription, useExtensionRuntimeTransport, useFrontendSessionToken, useHostIdentity, useMcpQuery, useMcpResource, useMcpTool, usePluginRealtimeSource };
@@ -1,10 +1,11 @@
1
- import { M as McpTransport, P as PortBridgeClient, T as ThemePayload, L as LocalePayload } from '../bridge-client-UK3qcGoi.js';
2
- export { A as A11yPayload, B as BridgePortShim, D as DensityPayload, N as NavPayload, S as SessionTokenPayload, c as createPortBridgeClient } from '../bridge-client-UK3qcGoi.js';
1
+ import { M as McpTransport } from '../bridge-envelopes-DA6vxbyb.js';
2
+ export { U as UploadDocumentMeta, f as UploadDocumentResult } from '../bridge-envelopes-DA6vxbyb.js';
3
3
  import * as react from 'react';
4
4
  import { ReactNode } from 'react';
5
5
  import { SduiNode, RenderMode } from '@ethisyscore/protocol';
6
6
  import { RemoteConnection } from '@remote-dom/core';
7
- import '../bridge-envelopes-BRKGSiSC.js';
7
+ import { P as PortBridgeClient, T as ThemePayload, L as LocalePayload } from '../bridge-client-DD99netz.js';
8
+ export { A as A11yPayload, B as BridgePortShim, D as DensityPayload, N as NavPayload, S as SessionTokenPayload, c as createPortBridgeClient } from '../bridge-client-DD99netz.js';
8
9
 
9
10
  /**
10
11
  * A single client-push event delivered from the host to a plugin surface. The host
@@ -198,6 +199,13 @@ interface ExtensionRuntimeProviderProps {
198
199
  * shard work across multiple hosts.
199
200
  */
200
201
  declare function ExtensionRuntimeProvider({ transport, clientPush, identity, realtime, children }: ExtensionRuntimeProviderProps): ReactNode;
202
+ /**
203
+ * Internal helper used by the hooks. Returns the explicit override when
204
+ * supplied, otherwise falls back to the context. Throws a deterministic
205
+ * error if neither is available so misconfiguration fails loudly at the
206
+ * first render rather than producing silent no-ops.
207
+ */
208
+ declare function useExtensionRuntimeTransport(override?: McpTransport): McpTransport;
201
209
 
202
210
  interface UseMcpResourceOptions {
203
211
  /**
@@ -564,7 +572,7 @@ interface PortShim {
564
572
  removeEventListener(type: "message", listener: (event: {
565
573
  data: unknown;
566
574
  }) => void): void;
567
- postMessage(value: unknown): void;
575
+ postMessage(value: unknown, transfer?: Transferable[]): void;
568
576
  }
569
577
  /**
570
578
  * Construct an {@link McpTransport} backed by a MessagePort.
@@ -666,4 +674,4 @@ interface UseAuthResult {
666
674
  */
667
675
  declare function useAuth(transport: McpTransport): UseAuthResult;
668
676
 
669
- export { BridgeClientContext, type ClientPushChannel, ClientPushContext, type ClientPushEvent, type ClientPushSubscribeOptions, type CreatePortMcpTransportOptions, type CreateRemoteRootOptions, type DeclarativePluginConfig, type EthisysPluginConfig, ExtensionRuntimeProvider, type ExtensionRuntimeProviderProps, type HostIdentity, HostIdentityContext, type HostIdentityUser, type HostPermission, type ItemsResponse, LocalePayload, McpTransport, PluginRealtimeContext, type PluginRealtimeSource, PortBridgeClient, type PortShim, type RemoteRoot, ThemePayload, type UseAuthResult, type UseClientPushSubscriptionOptions, type UseFrontendSessionTokenResult, type UseMcpQueryOptions, type UseMcpQueryResult, type UseMcpResourceOptions, type UseMcpResourceResult, type UseMcpToolOptions, type UseMcpToolResult, createPortMcpTransport, createRemoteRoot, decodeJwtPayload, defineDeclarativePlugin, defineEthisysPlugin, unwrapItems, useAuth, useBridgeClient, useBridgeLocale, useBridgeTheme, useClientPushSubscription, useFrontendSessionToken, useHostIdentity, useMcpQuery, useMcpResource, useMcpTool, usePluginRealtimeSource };
677
+ export { BridgeClientContext, type ClientPushChannel, ClientPushContext, type ClientPushEvent, type ClientPushSubscribeOptions, type CreatePortMcpTransportOptions, type CreateRemoteRootOptions, type DeclarativePluginConfig, type EthisysPluginConfig, ExtensionRuntimeProvider, type ExtensionRuntimeProviderProps, type HostIdentity, HostIdentityContext, type HostIdentityUser, type HostPermission, type ItemsResponse, LocalePayload, McpTransport, PluginRealtimeContext, type PluginRealtimeSource, PortBridgeClient, type PortShim, type RemoteRoot, ThemePayload, type UseAuthResult, type UseClientPushSubscriptionOptions, type UseFrontendSessionTokenResult, type UseMcpQueryOptions, type UseMcpQueryResult, type UseMcpResourceOptions, type UseMcpResourceResult, type UseMcpToolOptions, type UseMcpToolResult, createPortMcpTransport, createRemoteRoot, decodeJwtPayload, defineDeclarativePlugin, defineEthisysPlugin, unwrapItems, useAuth, useBridgeClient, useBridgeLocale, useBridgeTheme, useClientPushSubscription, useExtensionRuntimeTransport, useFrontendSessionToken, useHostIdentity, useMcpQuery, useMcpResource, useMcpTool, usePluginRealtimeSource };
@@ -467,13 +467,15 @@ var WIRE_INVOKE_TOOL_REQUEST = "ethisys:mcp:invokeTool";
467
467
  var WIRE_INVOKE_TOOL_RESULT = "ethisys:mcp:invokeTool:result";
468
468
  var WIRE_GET_RESOURCE_REQUEST = "ethisys:mcp:getResource";
469
469
  var WIRE_GET_RESOURCE_RESULT = "ethisys:mcp:getResource:result";
470
+ var WIRE_UPLOAD_DOCUMENT_REQUEST = "ethisys:mcp:uploadDocument";
471
+ var WIRE_UPLOAD_DOCUMENT_RESULT = "ethisys:mcp:uploadDocument:result";
470
472
  var WIRE_ABORT = "ethisys:mcp:abort";
471
473
  function isMcpResultEnvelope(value) {
472
474
  if (value === null || typeof value !== "object") {
473
475
  return false;
474
476
  }
475
477
  const v = value;
476
- return (v.type === WIRE_INVOKE_TOOL_RESULT || v.type === WIRE_GET_RESOURCE_RESULT) && typeof v.id === "string";
478
+ return (v.type === WIRE_INVOKE_TOOL_RESULT || v.type === WIRE_GET_RESOURCE_RESULT || v.type === WIRE_UPLOAD_DOCUMENT_RESULT) && typeof v.id === "string";
477
479
  }
478
480
  function createPortMcpTransport(port, options = {}) {
479
481
  if (port === void 0 || port === null) {
@@ -509,7 +511,7 @@ function createPortMcpTransport(port, options = {}) {
509
511
  if (!options.portShimForTests && typeof realPort.start === "function") {
510
512
  realPort.start();
511
513
  }
512
- function send(requestType, body, signal) {
514
+ function send(requestType, body, signal, transfer) {
513
515
  const id = factory();
514
516
  return new Promise((resolve, reject) => {
515
517
  if (signal?.aborted === true) {
@@ -526,7 +528,7 @@ function createPortMcpTransport(port, options = {}) {
526
528
  reject(abortError());
527
529
  };
528
530
  signal?.addEventListener("abort", onAbort, { once: true });
529
- shim.postMessage({ type: requestType, id, ...body });
531
+ shim.postMessage({ type: requestType, id, ...body }, transfer);
530
532
  });
531
533
  }
532
534
  return {
@@ -537,6 +539,15 @@ function createPortMcpTransport(port, options = {}) {
537
539
  async invokeTool(name, args, signal) {
538
540
  const data = await send(WIRE_INVOKE_TOOL_REQUEST, { name, args }, signal);
539
541
  return data;
542
+ },
543
+ async uploadDocument(meta, buffer, signal) {
544
+ const data = await send(
545
+ WIRE_UPLOAD_DOCUMENT_REQUEST,
546
+ { meta, buffer },
547
+ signal,
548
+ [buffer]
549
+ );
550
+ return data;
540
551
  }
541
552
  };
542
553
  }
@@ -791,6 +802,6 @@ function useAuth(transport) {
791
802
  };
792
803
  }
793
804
 
794
- export { BridgeClientContext, ClientPushContext, ExtensionRuntimeProvider, HostIdentityContext, PluginRealtimeContext, createPortBridgeClient, createPortMcpTransport, createRemoteRoot, decodeJwtPayload, defineDeclarativePlugin, defineEthisysPlugin, unwrapItems, useAuth, useBridgeClient, useBridgeLocale, useBridgeTheme, useClientPushSubscription, useFrontendSessionToken, useHostIdentity, useMcpQuery, useMcpResource, useMcpTool, usePluginRealtimeSource };
805
+ export { BridgeClientContext, ClientPushContext, ExtensionRuntimeProvider, HostIdentityContext, PluginRealtimeContext, createPortBridgeClient, createPortMcpTransport, createRemoteRoot, decodeJwtPayload, defineDeclarativePlugin, defineEthisysPlugin, unwrapItems, useAuth, useBridgeClient, useBridgeLocale, useBridgeTheme, useClientPushSubscription, useExtensionRuntimeTransport, useFrontendSessionToken, useHostIdentity, useMcpQuery, useMcpResource, useMcpTool, usePluginRealtimeSource };
795
806
  //# sourceMappingURL=index.js.map
796
807
  //# sourceMappingURL=index.js.map