@ethisyscore/extension-runtime 1.117.0 → 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.
@@ -426,6 +426,9 @@ var WorkerRemoteDomTransport = class {
426
426
  case "ethisys:mcp:invokeTool":
427
427
  this.dispatchMcp(message, "ethisys:mcp:invokeTool:result", (m) => this.handleInvokeTool(m));
428
428
  return;
429
+ case "ethisys:mcp:invokeOperation":
430
+ this.dispatchMcp(message, "ethisys:mcp:invokeOperation:result", (m) => this.handleInvokeOperation(m));
431
+ return;
429
432
  case "ethisys:mcp:getResource":
430
433
  this.dispatchMcp(message, "ethisys:mcp:getResource:result", (m) => this.handleGetResource(m));
431
434
  return;
@@ -523,6 +526,47 @@ var WorkerRemoteDomTransport = class {
523
526
  } catch {
524
527
  }
525
528
  }
529
+ /**
530
+ * The module-address twin of {@link handleInvokeTool}. Identical in every respect a reader
531
+ * should care about - same token mint, same disposed-before-token short circuit, same
532
+ * token-never-crosses-the-port rule - and deliberately NOT folded into one method with a
533
+ * branch: the two differ only in the request kind they build, and a shared method would put
534
+ * that branch inside the one place where getting the token handling wrong is unrecoverable.
535
+ */
536
+ async handleInvokeOperation(message) {
537
+ let token;
538
+ try {
539
+ token = await this.capabilityTokenProvider();
540
+ } catch (err) {
541
+ this.replyError(message.id, "ethisys:mcp:invokeOperation:result", err);
542
+ return;
543
+ }
544
+ if (this.disposed) {
545
+ return;
546
+ }
547
+ try {
548
+ const result = await this.mcpClient.fetch({
549
+ kind: "invokeOperation",
550
+ moduleKey: message.moduleKey,
551
+ operationKey: message.operationKey,
552
+ fallbackToolName: message.fallbackToolName,
553
+ args: message.args,
554
+ capabilityToken: token,
555
+ signal: this.requestSignal(message.id)
556
+ });
557
+ this.reportVersionSkew(result);
558
+ this.safePostMessage({
559
+ id: message.id,
560
+ type: "ethisys:mcp:invokeOperation:result",
561
+ ok: result.ok,
562
+ data: result.data,
563
+ error: result.error,
564
+ code: classifyHostResponse(result)
565
+ });
566
+ } catch (err) {
567
+ this.replyError(message.id, "ethisys:mcp:invokeOperation:result", err);
568
+ }
569
+ }
526
570
  async handleInvokeTool(message) {
527
571
  let token;
528
572
  try {
@@ -958,7 +1002,12 @@ var defaultMockMcpClient = {
958
1002
  }
959
1003
  };
960
1004
  }
961
- const echo = req.kind === "invokeTool" ? { tool: req.name, args: req.args } : { resource: req.uri };
1005
+ const echo = req.kind === "invokeTool" ? { tool: req.name, args: req.args } : req.kind === "invokeOperation" ? {
1006
+ module: req.moduleKey,
1007
+ operation: req.operationKey,
1008
+ tool: req.fallbackToolName,
1009
+ args: req.args
1010
+ } : { resource: req.uri };
962
1011
  return { ok: true, data: { mockHost: true, ...echo } };
963
1012
  }
964
1013
  };