@ethisyscore/extension-runtime 1.122.0 → 1.124.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.
@@ -1,8 +1,8 @@
1
1
  import { ReactNode, ReactElement } from 'react';
2
2
  import { C as ComponentRegistry } from '../registry-DpCx_LxF.cjs';
3
3
  import { SduiNode } from '@ethisyscore/protocol';
4
- import { M as McpTransport, U as UploadDocumentMeta, f as UploadDocumentResult } from '../bridge-envelopes-DAuew-fU.cjs';
5
- import { P as PortBridgeClient, T as ThemePayload, L as LocalePayload, D as DensityPayload, A as A11yPayload, N as NavPayload, S as SessionTokenPayload } from '../bridge-client-D0fogVGd.cjs';
4
+ import { M as McpTransport, U as UploadDocumentMeta, f as UploadDocumentResult } from '../bridge-envelopes-M5a42rAy.cjs';
5
+ import { P as PortBridgeClient, T as ThemePayload, L as LocalePayload, D as DensityPayload, A as A11yPayload, N as NavPayload, S as SessionTokenPayload } from '../bridge-client-D9EYFq1l.cjs';
6
6
 
7
7
  /**
8
8
  * Handler for a mocked tool invocation. The handler receives the request
@@ -1,8 +1,8 @@
1
1
  import { ReactNode, ReactElement } from 'react';
2
2
  import { C as ComponentRegistry } from '../registry-DpCx_LxF.js';
3
3
  import { SduiNode } from '@ethisyscore/protocol';
4
- import { M as McpTransport, U as UploadDocumentMeta, f as UploadDocumentResult } from '../bridge-envelopes-DAuew-fU.js';
5
- import { P as PortBridgeClient, T as ThemePayload, L as LocalePayload, D as DensityPayload, A as A11yPayload, N as NavPayload, S as SessionTokenPayload } from '../bridge-client-tIK_iYT9.js';
4
+ import { M as McpTransport, U as UploadDocumentMeta, f as UploadDocumentResult } from '../bridge-envelopes-M5a42rAy.js';
5
+ import { P as PortBridgeClient, T as ThemePayload, L as LocalePayload, D as DensityPayload, A as A11yPayload, N as NavPayload, S as SessionTokenPayload } from '../bridge-client-RJOl8WlU.js';
6
6
 
7
7
  /**
8
8
  * Handler for a mocked tool invocation. The handler receives the request
@@ -78,7 +78,7 @@ function useModuleTool(moduleKey, operationKey, fallbackToolName, opts) {
78
78
  };
79
79
  }, []);
80
80
  const invoke = react.useCallback(
81
- async (req) => {
81
+ async (req, fallbackReq) => {
82
82
  const controller = new AbortController();
83
83
  controllerRef.current?.abort();
84
84
  controllerRef.current = controller;
@@ -97,7 +97,8 @@ function useModuleTool(moduleKey, operationKey, fallbackToolName, opts) {
97
97
  operationKey,
98
98
  fallbackToolName,
99
99
  req,
100
- controller.signal
100
+ controller.signal,
101
+ fallbackReq
101
102
  );
102
103
  if (mountedRef.current && !controller.signal.aborted) {
103
104
  setLoading(false);
@@ -118,12 +119,13 @@ function useModuleTool(moduleKey, operationKey, fallbackToolName, opts) {
118
119
  }
119
120
  function useModuleQuery(moduleKey, operationKey, fallbackToolName, args, options) {
120
121
  const enabled = options?.enabled ?? true;
122
+ const fallbackArgs = options?.fallbackArgs;
121
123
  const { invoke } = useModuleTool(moduleKey, operationKey, fallbackToolName);
122
124
  const [data, setData] = react.useState(void 0);
123
125
  const [loading, setLoading] = react.useState(enabled);
124
126
  const [error, setError] = react.useState(void 0);
125
127
  const [tick, setTick] = react.useState(0);
126
- const argsKey = JSON.stringify(args);
128
+ const argsKey = JSON.stringify([args, fallbackArgs]);
127
129
  react.useEffect(() => {
128
130
  if (!enabled) {
129
131
  setLoading(false);
@@ -131,7 +133,7 @@ function useModuleQuery(moduleKey, operationKey, fallbackToolName, args, options
131
133
  }
132
134
  let cancelled = false;
133
135
  setLoading(true);
134
- invoke(args).then((result) => {
136
+ invoke(args, fallbackArgs).then((result) => {
135
137
  if (cancelled) {
136
138
  return;
137
139
  }
@@ -737,12 +739,17 @@ function createPortMcpTransport(port, options = {}) {
737
739
  const data = await send(WIRE_INVOKE_TOOL_REQUEST, { name, args }, signal);
738
740
  return data;
739
741
  },
740
- async invokeOperation(moduleKey, operationKey, fallbackToolName, args, signal) {
741
- const data = await send(
742
- WIRE_INVOKE_OPERATION_REQUEST,
743
- { moduleKey, operationKey, fallbackToolName, args },
744
- signal
745
- );
742
+ async invokeOperation(moduleKey, operationKey, fallbackToolName, args, signal, fallbackArgs) {
743
+ const body = {
744
+ moduleKey,
745
+ operationKey,
746
+ fallbackToolName,
747
+ args
748
+ };
749
+ if (fallbackArgs !== void 0) {
750
+ body.fallbackArgs = fallbackArgs;
751
+ }
752
+ const data = await send(WIRE_INVOKE_OPERATION_REQUEST, body, signal);
746
753
  return data;
747
754
  },
748
755
  async uploadDocument(meta, buffer, signal) {