@ethisyscore/extension-runtime 1.116.1 → 1.118.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,5 +1,5 @@
1
1
  import { SduiNode } from '@ethisyscore/protocol';
2
- import { h as WorkerCtor, M as McpHttpClient, k as WorkerRemoteDomTransport } from '../transport-Cjpb_qPo.cjs';
2
+ import { h as WorkerCtor, M as McpHttpClient, k as WorkerRemoteDomTransport } from '../transport-DDPhdaXn.cjs';
3
3
  import '../bridge-envelopes-DAuew-fU.cjs';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { SduiNode } from '@ethisyscore/protocol';
2
- import { h as WorkerCtor, M as McpHttpClient, k as WorkerRemoteDomTransport } from '../transport-B9mwIXYs.js';
2
+ import { h as WorkerCtor, M as McpHttpClient, k as WorkerRemoteDomTransport } from '../transport-pNTjXJ3R.js';
3
3
  import '../bridge-envelopes-DAuew-fU.js';
4
4
 
5
5
  /**
@@ -404,6 +404,9 @@ var WorkerRemoteDomTransport = class {
404
404
  case "ethisys:mcp:invokeTool":
405
405
  this.dispatchMcp(message, "ethisys:mcp:invokeTool:result", (m) => this.handleInvokeTool(m));
406
406
  return;
407
+ case "ethisys:mcp:invokeOperation":
408
+ this.dispatchMcp(message, "ethisys:mcp:invokeOperation:result", (m) => this.handleInvokeOperation(m));
409
+ return;
407
410
  case "ethisys:mcp:getResource":
408
411
  this.dispatchMcp(message, "ethisys:mcp:getResource:result", (m) => this.handleGetResource(m));
409
412
  return;
@@ -501,6 +504,47 @@ var WorkerRemoteDomTransport = class {
501
504
  } catch {
502
505
  }
503
506
  }
507
+ /**
508
+ * The module-address twin of {@link handleInvokeTool}. Identical in every respect a reader
509
+ * should care about - same token mint, same disposed-before-token short circuit, same
510
+ * token-never-crosses-the-port rule - and deliberately NOT folded into one method with a
511
+ * branch: the two differ only in the request kind they build, and a shared method would put
512
+ * that branch inside the one place where getting the token handling wrong is unrecoverable.
513
+ */
514
+ async handleInvokeOperation(message) {
515
+ let token;
516
+ try {
517
+ token = await this.capabilityTokenProvider();
518
+ } catch (err) {
519
+ this.replyError(message.id, "ethisys:mcp:invokeOperation:result", err);
520
+ return;
521
+ }
522
+ if (this.disposed) {
523
+ return;
524
+ }
525
+ try {
526
+ const result = await this.mcpClient.fetch({
527
+ kind: "invokeOperation",
528
+ moduleKey: message.moduleKey,
529
+ operationKey: message.operationKey,
530
+ fallbackToolName: message.fallbackToolName,
531
+ args: message.args,
532
+ capabilityToken: token,
533
+ signal: this.requestSignal(message.id)
534
+ });
535
+ this.reportVersionSkew(result);
536
+ this.safePostMessage({
537
+ id: message.id,
538
+ type: "ethisys:mcp:invokeOperation:result",
539
+ ok: result.ok,
540
+ data: result.data,
541
+ error: result.error,
542
+ code: classifyHostResponse(result)
543
+ });
544
+ } catch (err) {
545
+ this.replyError(message.id, "ethisys:mcp:invokeOperation:result", err);
546
+ }
547
+ }
504
548
  async handleInvokeTool(message) {
505
549
  let token;
506
550
  try {
@@ -936,7 +980,12 @@ var defaultMockMcpClient = {
936
980
  }
937
981
  };
938
982
  }
939
- const echo = req.kind === "invokeTool" ? { tool: req.name, args: req.args } : { resource: req.uri };
983
+ const echo = req.kind === "invokeTool" ? { tool: req.name, args: req.args } : req.kind === "invokeOperation" ? {
984
+ module: req.moduleKey,
985
+ operation: req.operationKey,
986
+ tool: req.fallbackToolName,
987
+ args: req.args
988
+ } : { resource: req.uri };
940
989
  return { ok: true, data: { mockHost: true, ...echo } };
941
990
  }
942
991
  };