agentcash 0.4.7 → 0.5.0-mpp.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.
- package/dist/cjs/run-server.cjs +736 -583
- package/dist/esm/{chunk-SMR4AIFH.js → chunk-CK3GCQYQ.js} +10 -5
- package/dist/esm/chunk-CK3GCQYQ.js.map +1 -0
- package/dist/esm/{chunk-N3Q7WRL7.js → chunk-CRYNS6Y3.js} +5 -6
- package/dist/esm/chunk-CRYNS6Y3.js.map +1 -0
- package/dist/esm/{chunk-N4XFC6DI.js → chunk-G4TH4S7M.js} +18 -18
- package/dist/esm/chunk-G4TH4S7M.js.map +1 -0
- package/dist/esm/chunk-HV7BGP42.js +7 -0
- package/dist/esm/chunk-HV7BGP42.js.map +1 -0
- package/dist/esm/{chunk-FQL7T4UN.js → chunk-KEPI2YKC.js} +2 -2
- package/dist/esm/{chunk-4VQ2CL7V.js → chunk-OS6MJ6OG.js} +3 -3
- package/dist/esm/{chunk-NNNL6LXH.js → chunk-UWU3MOEC.js} +16 -12
- package/dist/esm/chunk-UWU3MOEC.js.map +1 -0
- package/dist/esm/{chunk-BAN7B27A.js → chunk-W3OHV4AX.js} +2 -5
- package/dist/esm/chunk-W3OHV4AX.js.map +1 -0
- package/dist/esm/{commands-QUGC5OKY.js → commands-JOZ6UKA6.js} +9 -8
- package/dist/esm/{commands-QUGC5OKY.js.map → commands-JOZ6UKA6.js.map} +1 -1
- package/dist/esm/{fund-OG3VIN7O.js → fund-C24TLKK6.js} +4 -4
- package/dist/esm/index.js +14 -11
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/{install-44EQVZBD.js → install-R2P4LXLN.js} +5 -6
- package/dist/esm/{install-44EQVZBD.js.map → install-R2P4LXLN.js.map} +1 -1
- package/dist/esm/lib.js +2 -1
- package/dist/esm/lib.js.map +1 -1
- package/dist/esm/{server-JQZYW2CQ.js → server-EUPBSNJX.js} +39 -27
- package/dist/esm/server-EUPBSNJX.js.map +1 -0
- package/dist/esm/shared/operations/index.js +5 -4
- package/dist/esm/shared/operations/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/esm/chunk-BAN7B27A.js.map +0 -1
- package/dist/esm/chunk-N3Q7WRL7.js.map +0 -1
- package/dist/esm/chunk-N4XFC6DI.js.map +0 -1
- package/dist/esm/chunk-NNNL6LXH.js.map +0 -1
- package/dist/esm/chunk-SMR4AIFH.js.map +0 -1
- package/dist/esm/server-JQZYW2CQ.js.map +0 -1
- /package/dist/esm/{chunk-FQL7T4UN.js.map → chunk-KEPI2YKC.js.map} +0 -0
- /package/dist/esm/{chunk-4VQ2CL7V.js.map → chunk-OS6MJ6OG.js.map} +0 -0
- /package/dist/esm/{fund-OG3VIN7O.js.map → fund-C24TLKK6.js.map} +0 -0
package/dist/cjs/run-server.cjs
CHANGED
|
@@ -63534,16 +63534,16 @@ var log = {
|
|
|
63534
63534
|
// src/server/index.ts
|
|
63535
63535
|
init_cjs_shims();
|
|
63536
63536
|
|
|
63537
|
-
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
63537
|
+
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
|
|
63538
63538
|
init_cjs_shims();
|
|
63539
63539
|
|
|
63540
|
-
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
63540
|
+
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
|
|
63541
63541
|
init_cjs_shims();
|
|
63542
63542
|
|
|
63543
|
-
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
63543
|
+
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
|
|
63544
63544
|
init_cjs_shims();
|
|
63545
63545
|
|
|
63546
|
-
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
63546
|
+
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
|
|
63547
63547
|
init_cjs_shims();
|
|
63548
63548
|
|
|
63549
63549
|
// ../../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/index.js
|
|
@@ -80350,7 +80350,7 @@ function date4(params) {
|
|
|
80350
80350
|
return _coercedDate(ZodMiniDate, params);
|
|
80351
80351
|
}
|
|
80352
80352
|
|
|
80353
|
-
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
80353
|
+
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
|
|
80354
80354
|
function isZ4Schema(s) {
|
|
80355
80355
|
const schema = s;
|
|
80356
80356
|
return !!schema._zod;
|
|
@@ -80494,7 +80494,7 @@ function getLiteralValue(schema) {
|
|
|
80494
80494
|
return void 0;
|
|
80495
80495
|
}
|
|
80496
80496
|
|
|
80497
|
-
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
80497
|
+
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
|
|
80498
80498
|
init_cjs_shims();
|
|
80499
80499
|
|
|
80500
80500
|
// ../../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/index.js
|
|
@@ -82660,7 +82660,7 @@ function date7(params) {
|
|
|
82660
82660
|
// ../../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/external.js
|
|
82661
82661
|
config(en_default2());
|
|
82662
82662
|
|
|
82663
|
-
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
82663
|
+
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
|
|
82664
82664
|
var LATEST_PROTOCOL_VERSION = "2025-11-25";
|
|
82665
82665
|
var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"];
|
|
82666
82666
|
var RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
|
|
@@ -84178,13 +84178,13 @@ var UrlElicitationRequiredError = class extends McpError {
|
|
|
84178
84178
|
}
|
|
84179
84179
|
};
|
|
84180
84180
|
|
|
84181
|
-
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
84181
|
+
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
|
|
84182
84182
|
init_cjs_shims();
|
|
84183
84183
|
function isTerminal(status) {
|
|
84184
84184
|
return status === "completed" || status === "failed" || status === "cancelled";
|
|
84185
84185
|
}
|
|
84186
84186
|
|
|
84187
|
-
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
84187
|
+
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
|
|
84188
84188
|
init_cjs_shims();
|
|
84189
84189
|
|
|
84190
84190
|
// ../../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/index.js
|
|
@@ -85524,7 +85524,7 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
85524
85524
|
return combined;
|
|
85525
85525
|
};
|
|
85526
85526
|
|
|
85527
|
-
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
85527
|
+
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
|
|
85528
85528
|
function mapMiniTarget(t) {
|
|
85529
85529
|
if (!t)
|
|
85530
85530
|
return "draft-7";
|
|
@@ -85566,7 +85566,7 @@ function parseWithCompat(schema, data) {
|
|
|
85566
85566
|
return result.data;
|
|
85567
85567
|
}
|
|
85568
85568
|
|
|
85569
|
-
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
85569
|
+
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
|
|
85570
85570
|
var DEFAULT_REQUEST_TIMEOUT_MSEC = 6e4;
|
|
85571
85571
|
var Protocol = class {
|
|
85572
85572
|
constructor(_options) {
|
|
@@ -86514,7 +86514,7 @@ function mergeCapabilities(base, additional) {
|
|
|
86514
86514
|
return result;
|
|
86515
86515
|
}
|
|
86516
86516
|
|
|
86517
|
-
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
86517
|
+
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
|
|
86518
86518
|
init_cjs_shims();
|
|
86519
86519
|
var import_ajv = __toESM(require_ajv(), 1);
|
|
86520
86520
|
var import_ajv_formats = __toESM(require_dist(), 1);
|
|
@@ -86583,7 +86583,7 @@ var AjvJsonSchemaValidator = class {
|
|
|
86583
86583
|
}
|
|
86584
86584
|
};
|
|
86585
86585
|
|
|
86586
|
-
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
86586
|
+
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
|
|
86587
86587
|
init_cjs_shims();
|
|
86588
86588
|
var ExperimentalServerTasks = class {
|
|
86589
86589
|
constructor(_server) {
|
|
@@ -86606,6 +86606,147 @@ var ExperimentalServerTasks = class {
|
|
|
86606
86606
|
requestStream(request, resultSchema, options) {
|
|
86607
86607
|
return this._server.requestStream(request, resultSchema, options);
|
|
86608
86608
|
}
|
|
86609
|
+
/**
|
|
86610
|
+
* Sends a sampling request and returns an AsyncGenerator that yields response messages.
|
|
86611
|
+
* The generator is guaranteed to end with either a 'result' or 'error' message.
|
|
86612
|
+
*
|
|
86613
|
+
* For task-augmented requests, yields 'taskCreated' and 'taskStatus' messages
|
|
86614
|
+
* before the final result.
|
|
86615
|
+
*
|
|
86616
|
+
* @example
|
|
86617
|
+
* ```typescript
|
|
86618
|
+
* const stream = server.experimental.tasks.createMessageStream({
|
|
86619
|
+
* messages: [{ role: 'user', content: { type: 'text', text: 'Hello' } }],
|
|
86620
|
+
* maxTokens: 100
|
|
86621
|
+
* }, {
|
|
86622
|
+
* onprogress: (progress) => {
|
|
86623
|
+
* // Handle streaming tokens via progress notifications
|
|
86624
|
+
* console.log('Progress:', progress.message);
|
|
86625
|
+
* }
|
|
86626
|
+
* });
|
|
86627
|
+
*
|
|
86628
|
+
* for await (const message of stream) {
|
|
86629
|
+
* switch (message.type) {
|
|
86630
|
+
* case 'taskCreated':
|
|
86631
|
+
* console.log('Task created:', message.task.taskId);
|
|
86632
|
+
* break;
|
|
86633
|
+
* case 'taskStatus':
|
|
86634
|
+
* console.log('Task status:', message.task.status);
|
|
86635
|
+
* break;
|
|
86636
|
+
* case 'result':
|
|
86637
|
+
* console.log('Final result:', message.result);
|
|
86638
|
+
* break;
|
|
86639
|
+
* case 'error':
|
|
86640
|
+
* console.error('Error:', message.error);
|
|
86641
|
+
* break;
|
|
86642
|
+
* }
|
|
86643
|
+
* }
|
|
86644
|
+
* ```
|
|
86645
|
+
*
|
|
86646
|
+
* @param params - The sampling request parameters
|
|
86647
|
+
* @param options - Optional request options (timeout, signal, task creation params, onprogress, etc.)
|
|
86648
|
+
* @returns AsyncGenerator that yields ResponseMessage objects
|
|
86649
|
+
*
|
|
86650
|
+
* @experimental
|
|
86651
|
+
*/
|
|
86652
|
+
createMessageStream(params, options) {
|
|
86653
|
+
const clientCapabilities = this._server.getClientCapabilities();
|
|
86654
|
+
if ((params.tools || params.toolChoice) && !clientCapabilities?.sampling?.tools) {
|
|
86655
|
+
throw new Error("Client does not support sampling tools capability.");
|
|
86656
|
+
}
|
|
86657
|
+
if (params.messages.length > 0) {
|
|
86658
|
+
const lastMessage = params.messages[params.messages.length - 1];
|
|
86659
|
+
const lastContent = Array.isArray(lastMessage.content) ? lastMessage.content : [lastMessage.content];
|
|
86660
|
+
const hasToolResults = lastContent.some((c) => c.type === "tool_result");
|
|
86661
|
+
const previousMessage = params.messages.length > 1 ? params.messages[params.messages.length - 2] : void 0;
|
|
86662
|
+
const previousContent = previousMessage ? Array.isArray(previousMessage.content) ? previousMessage.content : [previousMessage.content] : [];
|
|
86663
|
+
const hasPreviousToolUse = previousContent.some((c) => c.type === "tool_use");
|
|
86664
|
+
if (hasToolResults) {
|
|
86665
|
+
if (lastContent.some((c) => c.type !== "tool_result")) {
|
|
86666
|
+
throw new Error("The last message must contain only tool_result content if any is present");
|
|
86667
|
+
}
|
|
86668
|
+
if (!hasPreviousToolUse) {
|
|
86669
|
+
throw new Error("tool_result blocks are not matching any tool_use from the previous message");
|
|
86670
|
+
}
|
|
86671
|
+
}
|
|
86672
|
+
if (hasPreviousToolUse) {
|
|
86673
|
+
const toolUseIds = new Set(previousContent.filter((c) => c.type === "tool_use").map((c) => c.id));
|
|
86674
|
+
const toolResultIds = new Set(lastContent.filter((c) => c.type === "tool_result").map((c) => c.toolUseId));
|
|
86675
|
+
if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every((id) => toolResultIds.has(id))) {
|
|
86676
|
+
throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match");
|
|
86677
|
+
}
|
|
86678
|
+
}
|
|
86679
|
+
}
|
|
86680
|
+
return this.requestStream({
|
|
86681
|
+
method: "sampling/createMessage",
|
|
86682
|
+
params
|
|
86683
|
+
}, CreateMessageResultSchema, options);
|
|
86684
|
+
}
|
|
86685
|
+
/**
|
|
86686
|
+
* Sends an elicitation request and returns an AsyncGenerator that yields response messages.
|
|
86687
|
+
* The generator is guaranteed to end with either a 'result' or 'error' message.
|
|
86688
|
+
*
|
|
86689
|
+
* For task-augmented requests (especially URL-based elicitation), yields 'taskCreated'
|
|
86690
|
+
* and 'taskStatus' messages before the final result.
|
|
86691
|
+
*
|
|
86692
|
+
* @example
|
|
86693
|
+
* ```typescript
|
|
86694
|
+
* const stream = server.experimental.tasks.elicitInputStream({
|
|
86695
|
+
* mode: 'url',
|
|
86696
|
+
* message: 'Please authenticate',
|
|
86697
|
+
* elicitationId: 'auth-123',
|
|
86698
|
+
* url: 'https://example.com/auth'
|
|
86699
|
+
* }, {
|
|
86700
|
+
* task: { ttl: 300000 } // Task-augmented for long-running auth flow
|
|
86701
|
+
* });
|
|
86702
|
+
*
|
|
86703
|
+
* for await (const message of stream) {
|
|
86704
|
+
* switch (message.type) {
|
|
86705
|
+
* case 'taskCreated':
|
|
86706
|
+
* console.log('Task created:', message.task.taskId);
|
|
86707
|
+
* break;
|
|
86708
|
+
* case 'taskStatus':
|
|
86709
|
+
* console.log('Task status:', message.task.status);
|
|
86710
|
+
* break;
|
|
86711
|
+
* case 'result':
|
|
86712
|
+
* console.log('User action:', message.result.action);
|
|
86713
|
+
* break;
|
|
86714
|
+
* case 'error':
|
|
86715
|
+
* console.error('Error:', message.error);
|
|
86716
|
+
* break;
|
|
86717
|
+
* }
|
|
86718
|
+
* }
|
|
86719
|
+
* ```
|
|
86720
|
+
*
|
|
86721
|
+
* @param params - The elicitation request parameters
|
|
86722
|
+
* @param options - Optional request options (timeout, signal, task creation params, etc.)
|
|
86723
|
+
* @returns AsyncGenerator that yields ResponseMessage objects
|
|
86724
|
+
*
|
|
86725
|
+
* @experimental
|
|
86726
|
+
*/
|
|
86727
|
+
elicitInputStream(params, options) {
|
|
86728
|
+
const clientCapabilities = this._server.getClientCapabilities();
|
|
86729
|
+
const mode = params.mode ?? "form";
|
|
86730
|
+
switch (mode) {
|
|
86731
|
+
case "url": {
|
|
86732
|
+
if (!clientCapabilities?.elicitation?.url) {
|
|
86733
|
+
throw new Error("Client does not support url elicitation.");
|
|
86734
|
+
}
|
|
86735
|
+
break;
|
|
86736
|
+
}
|
|
86737
|
+
case "form": {
|
|
86738
|
+
if (!clientCapabilities?.elicitation?.form) {
|
|
86739
|
+
throw new Error("Client does not support form elicitation.");
|
|
86740
|
+
}
|
|
86741
|
+
break;
|
|
86742
|
+
}
|
|
86743
|
+
}
|
|
86744
|
+
const normalizedParams = mode === "form" && params.mode === void 0 ? { ...params, mode: "form" } : params;
|
|
86745
|
+
return this.requestStream({
|
|
86746
|
+
method: "elicitation/create",
|
|
86747
|
+
params: normalizedParams
|
|
86748
|
+
}, ElicitResultSchema, options);
|
|
86749
|
+
}
|
|
86609
86750
|
/**
|
|
86610
86751
|
* Gets the current status of a task.
|
|
86611
86752
|
*
|
|
@@ -86656,7 +86797,7 @@ var ExperimentalServerTasks = class {
|
|
|
86656
86797
|
}
|
|
86657
86798
|
};
|
|
86658
86799
|
|
|
86659
|
-
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
86800
|
+
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
|
|
86660
86801
|
init_cjs_shims();
|
|
86661
86802
|
function assertToolsCallTaskCapability(requests, method, entityName) {
|
|
86662
86803
|
if (!requests) {
|
|
@@ -86692,7 +86833,7 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
|
|
|
86692
86833
|
}
|
|
86693
86834
|
}
|
|
86694
86835
|
|
|
86695
|
-
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
86836
|
+
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
|
|
86696
86837
|
var Server = class extends Protocol {
|
|
86697
86838
|
/**
|
|
86698
86839
|
* Initializes this server with the given name and version information.
|
|
@@ -87072,7 +87213,7 @@ var Server = class extends Protocol {
|
|
|
87072
87213
|
}
|
|
87073
87214
|
};
|
|
87074
87215
|
|
|
87075
|
-
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
87216
|
+
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
|
|
87076
87217
|
init_cjs_shims();
|
|
87077
87218
|
var COMPLETABLE_SYMBOL = /* @__PURE__ */ Symbol.for("mcp.completable");
|
|
87078
87219
|
function isCompletable(schema) {
|
|
@@ -87087,10 +87228,10 @@ var McpZodTypeKind;
|
|
|
87087
87228
|
McpZodTypeKind2["Completable"] = "McpCompletable";
|
|
87088
87229
|
})(McpZodTypeKind || (McpZodTypeKind = {}));
|
|
87089
87230
|
|
|
87090
|
-
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
87231
|
+
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/uriTemplate.js
|
|
87091
87232
|
init_cjs_shims();
|
|
87092
87233
|
|
|
87093
|
-
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
87234
|
+
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
|
|
87094
87235
|
init_cjs_shims();
|
|
87095
87236
|
var TOOL_NAME_REGEX = /^[A-Za-z0-9._-]{1,128}$/;
|
|
87096
87237
|
function validateToolName(name) {
|
|
@@ -87149,7 +87290,7 @@ function validateAndWarnToolName(name) {
|
|
|
87149
87290
|
return result.isValid;
|
|
87150
87291
|
}
|
|
87151
87292
|
|
|
87152
|
-
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
87293
|
+
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
|
|
87153
87294
|
init_cjs_shims();
|
|
87154
87295
|
var ExperimentalMcpServerTasks = class {
|
|
87155
87296
|
constructor(_mcpServer) {
|
|
@@ -87169,7 +87310,7 @@ var ExperimentalMcpServerTasks = class {
|
|
|
87169
87310
|
init_cjs_shims();
|
|
87170
87311
|
var zod_default = external_exports3;
|
|
87171
87312
|
|
|
87172
|
-
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
87313
|
+
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
|
|
87173
87314
|
var McpServer = class {
|
|
87174
87315
|
constructor(serverInfo, options) {
|
|
87175
87316
|
this._registeredResources = {};
|
|
@@ -87955,11 +88096,11 @@ var EMPTY_COMPLETION_RESULT = {
|
|
|
87955
88096
|
}
|
|
87956
88097
|
};
|
|
87957
88098
|
|
|
87958
|
-
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
88099
|
+
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
87959
88100
|
init_cjs_shims();
|
|
87960
88101
|
var import_node_process = __toESM(require("process"), 1);
|
|
87961
88102
|
|
|
87962
|
-
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
88103
|
+
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
|
|
87963
88104
|
init_cjs_shims();
|
|
87964
88105
|
var ReadBuffer = class {
|
|
87965
88106
|
append(chunk) {
|
|
@@ -87988,7 +88129,7 @@ function serializeMessage(message) {
|
|
|
87988
88129
|
return JSON.stringify(message) + "\n";
|
|
87989
88130
|
}
|
|
87990
88131
|
|
|
87991
|
-
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.
|
|
88132
|
+
// ../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
87992
88133
|
var StdioServerTransport = class {
|
|
87993
88134
|
constructor(_stdin = import_node_process.default.stdin, _stdout = import_node_process.default.stdout) {
|
|
87994
88135
|
this._stdin = _stdin;
|
|
@@ -88831,19 +88972,19 @@ var ExactEvmScheme = class {
|
|
|
88831
88972
|
}
|
|
88832
88973
|
};
|
|
88833
88974
|
|
|
88834
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
88975
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/client/index.js
|
|
88835
88976
|
init_cjs_shims();
|
|
88836
88977
|
|
|
88837
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
88978
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/Expires.js
|
|
88838
88979
|
init_cjs_shims();
|
|
88839
88980
|
function minutes(n) {
|
|
88840
88981
|
return new Date(Date.now() + n * 60 * 1e3).toISOString();
|
|
88841
88982
|
}
|
|
88842
88983
|
|
|
88843
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
88984
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/client/Methods.js
|
|
88844
88985
|
init_cjs_shims();
|
|
88845
88986
|
|
|
88846
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
88987
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/Credential.js
|
|
88847
88988
|
init_cjs_shims();
|
|
88848
88989
|
|
|
88849
88990
|
// ../../../node_modules/.pnpm/ox@0.12.4_typescript@5.9.3_zod@4.3.6/node_modules/ox/_esm/index.js
|
|
@@ -91266,7 +91407,7 @@ function verify3(options) {
|
|
|
91266
91407
|
// ../../../node_modules/.pnpm/ox@0.12.4_typescript@5.9.3_zod@4.3.6/node_modules/ox/_esm/index.js
|
|
91267
91408
|
init_Withdrawal();
|
|
91268
91409
|
|
|
91269
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
91410
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/Challenge.js
|
|
91270
91411
|
var Challenge_exports = {};
|
|
91271
91412
|
__export(Challenge_exports, {
|
|
91272
91413
|
Schema: () => Schema,
|
|
@@ -91280,7 +91421,7 @@ __export(Challenge_exports, {
|
|
|
91280
91421
|
});
|
|
91281
91422
|
init_cjs_shims();
|
|
91282
91423
|
|
|
91283
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
91424
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/PaymentRequest.js
|
|
91284
91425
|
init_cjs_shims();
|
|
91285
91426
|
function deserialize(encoded) {
|
|
91286
91427
|
const json3 = Base64_exports.toString(encoded);
|
|
@@ -91294,13 +91435,13 @@ function serialize(request) {
|
|
|
91294
91435
|
return Base64_exports.fromString(json3, { pad: false, url: true });
|
|
91295
91436
|
}
|
|
91296
91437
|
|
|
91297
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
91438
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/zod.js
|
|
91298
91439
|
init_cjs_shims();
|
|
91299
91440
|
|
|
91300
91441
|
// ../../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/mini/index.js
|
|
91301
91442
|
init_cjs_shims();
|
|
91302
91443
|
|
|
91303
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
91444
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/zod.js
|
|
91304
91445
|
function amount() {
|
|
91305
91446
|
return external_exports2.string().check(external_exports2.regex(/^\d+(\.\d+)?$/, "Invalid amount"));
|
|
91306
91447
|
}
|
|
@@ -91314,7 +91455,7 @@ function signature() {
|
|
|
91314
91455
|
return external_exports2.string().check(external_exports2.regex(/^0x[0-9a-fA-F]+$/, "Invalid signature"));
|
|
91315
91456
|
}
|
|
91316
91457
|
|
|
91317
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
91458
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/Challenge.js
|
|
91318
91459
|
var Schema = object({
|
|
91319
91460
|
/** Optional human-readable description of the payment. */
|
|
91320
91461
|
description: optional(string2()),
|
|
@@ -91441,7 +91582,7 @@ function constantTimeEqual(a, b) {
|
|
|
91441
91582
|
return result === 0;
|
|
91442
91583
|
}
|
|
91443
91584
|
|
|
91444
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
91585
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/Credential.js
|
|
91445
91586
|
function serialize3(credential) {
|
|
91446
91587
|
const wire = {
|
|
91447
91588
|
challenge: {
|
|
@@ -91456,7 +91597,7 @@ function serialize3(credential) {
|
|
|
91456
91597
|
return `Payment ${encoded}`;
|
|
91457
91598
|
}
|
|
91458
91599
|
|
|
91459
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
91600
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/Method.js
|
|
91460
91601
|
init_cjs_shims();
|
|
91461
91602
|
function from10(method) {
|
|
91462
91603
|
return method;
|
|
@@ -96062,10 +96203,10 @@ init_getAddress2();
|
|
|
96062
96203
|
init_toFunctionSelector();
|
|
96063
96204
|
init_formatUnits();
|
|
96064
96205
|
|
|
96065
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
96206
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/tempo/client/index.js
|
|
96066
96207
|
init_cjs_shims();
|
|
96067
96208
|
|
|
96068
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
96209
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/tempo/client/Charge.js
|
|
96069
96210
|
init_cjs_shims();
|
|
96070
96211
|
|
|
96071
96212
|
// ../../../node_modules/.pnpm/viem@2.46.2_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.3.6/node_modules/viem/_esm/actions/index.js
|
|
@@ -102304,7 +102445,7 @@ async function updateSync(client, parameters) {
|
|
|
102304
102445
|
return { receipt };
|
|
102305
102446
|
}
|
|
102306
102447
|
|
|
102307
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
102448
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/viem/Account.js
|
|
102308
102449
|
init_cjs_shims();
|
|
102309
102450
|
|
|
102310
102451
|
// ../../../node_modules/.pnpm/viem@2.46.2_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.3.6/node_modules/viem/_esm/accounts/index.js
|
|
@@ -102467,7 +102608,7 @@ function privateKeyToAccount(privateKey, options = {}) {
|
|
|
102467
102608
|
// ../../../node_modules/.pnpm/viem@2.46.2_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.3.6/node_modules/viem/_esm/accounts/index.js
|
|
102468
102609
|
init_parseAccount();
|
|
102469
102610
|
|
|
102470
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
102611
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/viem/Account.js
|
|
102471
102612
|
function getResolver(parameters = {}) {
|
|
102472
102613
|
const { account: defaultAccount } = parameters;
|
|
102473
102614
|
return (client, { account: override } = {}) => {
|
|
@@ -102481,7 +102622,7 @@ function getResolver(parameters = {}) {
|
|
|
102481
102622
|
};
|
|
102482
102623
|
}
|
|
102483
102624
|
|
|
102484
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
102625
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/viem/Client.js
|
|
102485
102626
|
init_cjs_shims();
|
|
102486
102627
|
function getResolver2(parameters) {
|
|
102487
102628
|
const { chain: chain2, getClient, rpcUrl: rpcUrl2 } = parameters;
|
|
@@ -102501,7 +102642,7 @@ function getResolver2(parameters) {
|
|
|
102501
102642
|
};
|
|
102502
102643
|
}
|
|
102503
102644
|
|
|
102504
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
102645
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/tempo/Attribution.js
|
|
102505
102646
|
init_cjs_shims();
|
|
102506
102647
|
var tag = Hex_exports.slice(Hash_exports.keccak256(Bytes_exports.fromString("mpp"), { as: "Hex" }), 0, 4);
|
|
102507
102648
|
var version6 = 1;
|
|
@@ -102522,7 +102663,7 @@ function encode5(parameters) {
|
|
|
102522
102663
|
return Hex_exports.fromBytes(buf);
|
|
102523
102664
|
}
|
|
102524
102665
|
|
|
102525
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
102666
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/tempo/internal/defaults.js
|
|
102526
102667
|
init_cjs_shims();
|
|
102527
102668
|
var rpcUrl = {
|
|
102528
102669
|
4217: "https://rpc.tempo.xyz",
|
|
@@ -102534,7 +102675,7 @@ var escrowContract = {
|
|
|
102534
102675
|
};
|
|
102535
102676
|
var decimals = 6;
|
|
102536
102677
|
|
|
102537
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
102678
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/tempo/Methods.js
|
|
102538
102679
|
init_cjs_shims();
|
|
102539
102680
|
var charge = from10({
|
|
102540
102681
|
name: "tempo",
|
|
@@ -102635,7 +102776,7 @@ var session = from10({
|
|
|
102635
102776
|
}
|
|
102636
102777
|
});
|
|
102637
102778
|
|
|
102638
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
102779
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/tempo/client/Charge.js
|
|
102639
102780
|
function charge2(parameters = {}) {
|
|
102640
102781
|
const { clientId } = parameters;
|
|
102641
102782
|
const getClient = getResolver2({
|
|
@@ -102678,13 +102819,13 @@ function charge2(parameters = {}) {
|
|
|
102678
102819
|
});
|
|
102679
102820
|
}
|
|
102680
102821
|
|
|
102681
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
102822
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/tempo/client/Methods.js
|
|
102682
102823
|
init_cjs_shims();
|
|
102683
102824
|
|
|
102684
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
102825
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/tempo/client/Session.js
|
|
102685
102826
|
init_cjs_shims();
|
|
102686
102827
|
|
|
102687
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
102828
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/tempo/stream/Voucher.js
|
|
102688
102829
|
init_cjs_shims();
|
|
102689
102830
|
var DOMAIN_NAME = "Tempo Stream Channel";
|
|
102690
102831
|
var DOMAIN_VERSION = "1";
|
|
@@ -102724,13 +102865,13 @@ async function signVoucher(client, account, message, escrowContract2, chainId, a
|
|
|
102724
102865
|
return signature2;
|
|
102725
102866
|
}
|
|
102726
102867
|
|
|
102727
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
102868
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/tempo/client/ChannelOps.js
|
|
102728
102869
|
init_cjs_shims();
|
|
102729
102870
|
|
|
102730
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
102871
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/tempo/stream/Chain.js
|
|
102731
102872
|
init_cjs_shims();
|
|
102732
102873
|
|
|
102733
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
102874
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/tempo/stream/escrow.abi.js
|
|
102734
102875
|
init_cjs_shims();
|
|
102735
102876
|
var escrowAbi = [
|
|
102736
102877
|
{
|
|
@@ -103492,7 +103633,7 @@ var escrowAbi = [
|
|
|
103492
103633
|
}
|
|
103493
103634
|
];
|
|
103494
103635
|
|
|
103495
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
103636
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/tempo/stream/Chain.js
|
|
103496
103637
|
var UINT128_MAX = 2n ** 128n - 1n;
|
|
103497
103638
|
async function getOnChainChannel(client, escrowContract2, channelId) {
|
|
103498
103639
|
return readContract(client, {
|
|
@@ -103505,7 +103646,7 @@ async function getOnChainChannel(client, escrowContract2, channelId) {
|
|
|
103505
103646
|
var escrowOpenSelector = /* @__PURE__ */ toFunctionSelector(getAbiItem({ abi: escrowAbi, name: "open" }));
|
|
103506
103647
|
var escrowTopUpSelector = /* @__PURE__ */ toFunctionSelector(getAbiItem({ abi: escrowAbi, name: "topUp" }));
|
|
103507
103648
|
|
|
103508
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
103649
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/tempo/stream/Channel.js
|
|
103509
103650
|
init_cjs_shims();
|
|
103510
103651
|
function computeId2(parameters) {
|
|
103511
103652
|
const encoded = AbiParameters_exports.encode(AbiParameters_exports.from([
|
|
@@ -103528,7 +103669,7 @@ function computeId2(parameters) {
|
|
|
103528
103669
|
return Hash_exports.keccak256(encoded);
|
|
103529
103670
|
}
|
|
103530
103671
|
|
|
103531
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
103672
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/tempo/client/ChannelOps.js
|
|
103532
103673
|
function resolveEscrow(challenge2, chainId, escrowContractOverride) {
|
|
103533
103674
|
const challengeEscrow = challenge2.request.methodDetails?.escrowContract;
|
|
103534
103675
|
const escrow = challengeEscrow ?? escrowContractOverride ?? escrowContract[chainId];
|
|
@@ -103624,7 +103765,7 @@ async function tryRecoverChannel(client, escrowContract2, channelId, chainId) {
|
|
|
103624
103765
|
return void 0;
|
|
103625
103766
|
}
|
|
103626
103767
|
|
|
103627
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
103768
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/tempo/client/Session.js
|
|
103628
103769
|
var streamContextSchema = object({
|
|
103629
103770
|
account: optional(custom()),
|
|
103630
103771
|
action: optional(_enum2(["open", "topUp", "voucher", "close"])),
|
|
@@ -103826,10 +103967,10 @@ function session2(parameters = {}) {
|
|
|
103826
103967
|
});
|
|
103827
103968
|
}
|
|
103828
103969
|
|
|
103829
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
103970
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/tempo/client/SessionManager.js
|
|
103830
103971
|
init_cjs_shims();
|
|
103831
103972
|
|
|
103832
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
103973
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/client/internal/Fetch.js
|
|
103833
103974
|
init_cjs_shims();
|
|
103834
103975
|
var originalFetch;
|
|
103835
103976
|
function from19(config2) {
|
|
@@ -103871,14 +104012,14 @@ async function resolveCredential(challenge2, mi, context2) {
|
|
|
103871
104012
|
return mi.createCredential(parsedContext !== void 0 ? { challenge: challenge2, context: parsedContext } : { challenge: challenge2 });
|
|
103872
104013
|
}
|
|
103873
104014
|
|
|
103874
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
104015
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/tempo/stream/Receipt.js
|
|
103875
104016
|
init_cjs_shims();
|
|
103876
104017
|
function deserializeStreamReceipt(encoded) {
|
|
103877
104018
|
const json3 = Base64_exports.toString(encoded);
|
|
103878
104019
|
return JSON.parse(json3);
|
|
103879
104020
|
}
|
|
103880
104021
|
|
|
103881
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
104022
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/tempo/stream/Sse.js
|
|
103882
104023
|
init_cjs_shims();
|
|
103883
104024
|
function parseEvent(raw) {
|
|
103884
104025
|
let eventType = "message";
|
|
@@ -103907,7 +104048,7 @@ function parseEvent(raw) {
|
|
|
103907
104048
|
}
|
|
103908
104049
|
}
|
|
103909
104050
|
|
|
103910
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
104051
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/tempo/client/SessionManager.js
|
|
103911
104052
|
function sessionManager(parameters) {
|
|
103912
104053
|
const fetchFn = parameters.fetch ?? globalThis.fetch;
|
|
103913
104054
|
let channel = null;
|
|
@@ -104082,7 +104223,7 @@ function sessionManager(parameters) {
|
|
|
104082
104223
|
return self2;
|
|
104083
104224
|
}
|
|
104084
104225
|
|
|
104085
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
104226
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/tempo/client/Methods.js
|
|
104086
104227
|
function tempo2(parameters = {}) {
|
|
104087
104228
|
return [charge2(parameters), session2(parameters)];
|
|
104088
104229
|
}
|
|
@@ -104091,7 +104232,7 @@ function tempo2(parameters = {}) {
|
|
|
104091
104232
|
tempo3.session = sessionManager;
|
|
104092
104233
|
})(tempo2 || (tempo2 = {}));
|
|
104093
104234
|
|
|
104094
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
104235
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/client/Mppx.js
|
|
104095
104236
|
var Mppx_exports = {};
|
|
104096
104237
|
__export(Mppx_exports, {
|
|
104097
104238
|
create: () => create4,
|
|
@@ -104099,7 +104240,7 @@ __export(Mppx_exports, {
|
|
|
104099
104240
|
});
|
|
104100
104241
|
init_cjs_shims();
|
|
104101
104242
|
|
|
104102
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
104243
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/client/Transport.js
|
|
104103
104244
|
init_cjs_shims();
|
|
104104
104245
|
function from20(transport) {
|
|
104105
104246
|
return transport;
|
|
@@ -104121,7 +104262,7 @@ function http2() {
|
|
|
104121
104262
|
});
|
|
104122
104263
|
}
|
|
104123
104264
|
|
|
104124
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
104265
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/client/Mppx.js
|
|
104125
104266
|
function create4(config2) {
|
|
104126
104267
|
const { onChallenge, polyfill: polyfill2 = true, transport = http2() } = config2;
|
|
104127
104268
|
const methods = config2.methods.flat();
|
|
@@ -104302,6 +104443,10 @@ init_cjs_shims();
|
|
|
104302
104443
|
var TEMPO_RPC_URL = "https://eng:acard-melody-fashion-finish@rpc.mainnet.tempo.xyz";
|
|
104303
104444
|
var TEMPO_TOKEN_ADDRESS = "0x20c0000000000000000000000000000000000000";
|
|
104304
104445
|
|
|
104446
|
+
// src/shared/mpp-enabled.ts
|
|
104447
|
+
init_cjs_shims();
|
|
104448
|
+
var isMppEnabled = () => "0.5.0-mpp.0".includes("-mpp");
|
|
104449
|
+
|
|
104305
104450
|
// src/shared/operations/fetch-with-payment.ts
|
|
104306
104451
|
init_cjs_shims();
|
|
104307
104452
|
|
|
@@ -108603,10 +108748,10 @@ var safeCreateSIWxPayload = (surface2, serverInfo, signer) => {
|
|
|
108603
108748
|
// src/shared/neverthrow/mpp/index.ts
|
|
108604
108749
|
init_cjs_shims();
|
|
108605
108750
|
|
|
108606
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
108751
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/index.js
|
|
108607
108752
|
init_cjs_shims();
|
|
108608
108753
|
|
|
108609
|
-
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.
|
|
108754
|
+
// ../../../node_modules/.pnpm/mppx@0.2.4_@modelcontextprotocol+sdk@1.27.0_zod@4.3.6__express@5.2.1_hono@4.11.9_typesc_33cae9d69c6682928549d87734ba44a3/node_modules/mppx/dist/Receipt.js
|
|
108610
108755
|
var Receipt_exports = {};
|
|
108611
108756
|
__export(Receipt_exports, {
|
|
108612
108757
|
Schema: () => Schema2,
|
|
@@ -108687,9 +108832,11 @@ var safeGetMppReceipt = (surface2, response) => {
|
|
|
108687
108832
|
init_cjs_shims();
|
|
108688
108833
|
function detectPaymentProtocols(response) {
|
|
108689
108834
|
const protocols = [];
|
|
108690
|
-
|
|
108691
|
-
|
|
108692
|
-
|
|
108835
|
+
if (isMppEnabled()) {
|
|
108836
|
+
const wwwAuth = response.headers.get("WWW-Authenticate");
|
|
108837
|
+
if (wwwAuth?.startsWith("Payment")) {
|
|
108838
|
+
protocols.push("mpp");
|
|
108839
|
+
}
|
|
108693
108840
|
}
|
|
108694
108841
|
const paymentRequired = response.headers.get("payment-required");
|
|
108695
108842
|
if (paymentRequired) {
|
|
@@ -108709,6 +108856,488 @@ var tokenStringToNumber = (amount2, decimals2 = 6) => {
|
|
|
108709
108856
|
|
|
108710
108857
|
// src/shared/balance.ts
|
|
108711
108858
|
init_cjs_shims();
|
|
108859
|
+
var X402SCAN_BASE = "https://x402scan.com";
|
|
108860
|
+
var getBalance3 = async ({
|
|
108861
|
+
address,
|
|
108862
|
+
surface: surface2
|
|
108863
|
+
}) => {
|
|
108864
|
+
const url3 = `${X402SCAN_BASE}/api/rpc/balance/${address}`;
|
|
108865
|
+
const res = await safeFetchJson(
|
|
108866
|
+
surface2,
|
|
108867
|
+
new Request(url3, {
|
|
108868
|
+
method: "GET",
|
|
108869
|
+
headers: {
|
|
108870
|
+
accept: "application/json"
|
|
108871
|
+
}
|
|
108872
|
+
}),
|
|
108873
|
+
zod_default.object({
|
|
108874
|
+
chain: zod_default.number(),
|
|
108875
|
+
balance: zod_default.coerce.number()
|
|
108876
|
+
})
|
|
108877
|
+
);
|
|
108878
|
+
return res;
|
|
108879
|
+
};
|
|
108880
|
+
|
|
108881
|
+
// src/shared/tempo-balance.ts
|
|
108882
|
+
init_cjs_shims();
|
|
108883
|
+
var MPPSCAN_BASE = "https://mppscan.com";
|
|
108884
|
+
async function getTempoBalance({
|
|
108885
|
+
address,
|
|
108886
|
+
tokenAddress
|
|
108887
|
+
}) {
|
|
108888
|
+
const url3 = `${MPPSCAN_BASE}/api/balance/${address}`;
|
|
108889
|
+
const res = await fetch(url3, {
|
|
108890
|
+
method: "GET",
|
|
108891
|
+
headers: { accept: "application/json" }
|
|
108892
|
+
});
|
|
108893
|
+
if (!res.ok) {
|
|
108894
|
+
throw new Error(`mppscan balance request failed: ${res.status}`);
|
|
108895
|
+
}
|
|
108896
|
+
const data = await res.json();
|
|
108897
|
+
return {
|
|
108898
|
+
chainId: tempo.id,
|
|
108899
|
+
chainName: tempo.name,
|
|
108900
|
+
balance: BigInt(data.balance),
|
|
108901
|
+
tokenAddress
|
|
108902
|
+
};
|
|
108903
|
+
}
|
|
108904
|
+
|
|
108905
|
+
// src/shared/operations/fetch-with-payment.ts
|
|
108906
|
+
function createFetchWithPayment(options) {
|
|
108907
|
+
const { surface: surface2, clients, paymentMethod, beforePayment, timeout } = options;
|
|
108908
|
+
return async (request) => {
|
|
108909
|
+
const clonedRequest = request.clone();
|
|
108910
|
+
const fallbackRequest = request.clone();
|
|
108911
|
+
const probeResult = await safeFetch(surface2, request, timeout);
|
|
108912
|
+
if (probeResult.isErr()) {
|
|
108913
|
+
return fetchErr(surface2, probeResult.error);
|
|
108914
|
+
}
|
|
108915
|
+
if (probeResult.value.status !== 402) {
|
|
108916
|
+
return probeResult.andThen(
|
|
108917
|
+
(response2) => fetchOk({ response: response2, paymentInfo: null })
|
|
108918
|
+
);
|
|
108919
|
+
}
|
|
108920
|
+
const response = probeResult.value;
|
|
108921
|
+
if (paymentMethod !== "auto") {
|
|
108922
|
+
if (paymentMethod === "mpp") {
|
|
108923
|
+
return handleMppPayment(surface2, response, clonedRequest, options);
|
|
108924
|
+
}
|
|
108925
|
+
return handleX402Payment(
|
|
108926
|
+
surface2,
|
|
108927
|
+
response,
|
|
108928
|
+
clonedRequest,
|
|
108929
|
+
clients.x402,
|
|
108930
|
+
beforePayment,
|
|
108931
|
+
timeout
|
|
108932
|
+
);
|
|
108933
|
+
}
|
|
108934
|
+
const available = detectPaymentProtocols(response);
|
|
108935
|
+
let preferred;
|
|
108936
|
+
if (available.length === 1) {
|
|
108937
|
+
preferred = available[0];
|
|
108938
|
+
} else {
|
|
108939
|
+
preferred = await pickByBalance(surface2, response, options);
|
|
108940
|
+
}
|
|
108941
|
+
const fallback = available.length > 1 ? preferred === "mpp" ? "x402" : "mpp" : null;
|
|
108942
|
+
const result = preferred === "mpp" ? await handleMppPayment(surface2, response, clonedRequest, options) : await handleX402Payment(
|
|
108943
|
+
surface2,
|
|
108944
|
+
response,
|
|
108945
|
+
clonedRequest,
|
|
108946
|
+
clients.x402,
|
|
108947
|
+
beforePayment,
|
|
108948
|
+
timeout
|
|
108949
|
+
);
|
|
108950
|
+
if (result.isErr() && fallback) {
|
|
108951
|
+
return fallback === "mpp" ? handleMppPayment(surface2, response, fallbackRequest, options) : handleX402Payment(
|
|
108952
|
+
surface2,
|
|
108953
|
+
response,
|
|
108954
|
+
fallbackRequest,
|
|
108955
|
+
clients.x402,
|
|
108956
|
+
beforePayment,
|
|
108957
|
+
timeout
|
|
108958
|
+
);
|
|
108959
|
+
}
|
|
108960
|
+
return result;
|
|
108961
|
+
};
|
|
108962
|
+
}
|
|
108963
|
+
async function pickByBalance(surface2, response, options) {
|
|
108964
|
+
const { account } = options;
|
|
108965
|
+
const x402BalanceResult = await resultFromPromise(
|
|
108966
|
+
"balance",
|
|
108967
|
+
surface2,
|
|
108968
|
+
getBalance3({
|
|
108969
|
+
address: account.address,
|
|
108970
|
+
surface: surface2
|
|
108971
|
+
}).then((r) => r.isOk() ? r.value.balance : 0),
|
|
108972
|
+
() => ({
|
|
108973
|
+
cause: "x402_balance",
|
|
108974
|
+
message: "Failed to get x402 balance"
|
|
108975
|
+
})
|
|
108976
|
+
);
|
|
108977
|
+
if (x402BalanceResult.isErr()) {
|
|
108978
|
+
log.debug("Balance comparison failed, defaulting to mpp");
|
|
108979
|
+
return "mpp";
|
|
108980
|
+
}
|
|
108981
|
+
const x402Balance = x402BalanceResult.value;
|
|
108982
|
+
let mppBalance = 0;
|
|
108983
|
+
const challengeResult = safeGetMppChallenge(surface2, response);
|
|
108984
|
+
if (challengeResult.isOk()) {
|
|
108985
|
+
const currency = challengeResult.value.request.currency;
|
|
108986
|
+
const decimals2 = challengeResult.value.request.decimals ?? 6;
|
|
108987
|
+
if (currency) {
|
|
108988
|
+
const tempoResult = await resultFromPromise(
|
|
108989
|
+
"tempo",
|
|
108990
|
+
surface2,
|
|
108991
|
+
getTempoBalance({
|
|
108992
|
+
address: account.address,
|
|
108993
|
+
tokenAddress: currency
|
|
108994
|
+
}),
|
|
108995
|
+
() => ({
|
|
108996
|
+
cause: "tempo_balance",
|
|
108997
|
+
message: "Tempo balance check failed"
|
|
108998
|
+
})
|
|
108999
|
+
);
|
|
109000
|
+
if (tempoResult.isOk()) {
|
|
109001
|
+
mppBalance = Number(formatUnits(tempoResult.value.balance, decimals2));
|
|
109002
|
+
}
|
|
109003
|
+
}
|
|
109004
|
+
}
|
|
109005
|
+
log.info(`Protocol selection \u2014 x402: $${x402Balance}, mpp: $${mppBalance}`);
|
|
109006
|
+
return x402Balance >= mppBalance ? "x402" : "mpp";
|
|
109007
|
+
}
|
|
109008
|
+
async function handleX402Payment(surface2, response, clonedRequest, client, beforePayment, timeout) {
|
|
109009
|
+
const paymentRequiredResult = await safeGetPaymentRequired(
|
|
109010
|
+
surface2,
|
|
109011
|
+
client,
|
|
109012
|
+
response
|
|
109013
|
+
);
|
|
109014
|
+
if (paymentRequiredResult.isErr()) {
|
|
109015
|
+
return paymentRequiredResult;
|
|
109016
|
+
}
|
|
109017
|
+
const paymentRequired = paymentRequiredResult.value;
|
|
109018
|
+
if (beforePayment) {
|
|
109019
|
+
const accept = paymentRequired.accepts[0];
|
|
109020
|
+
if (accept) {
|
|
109021
|
+
const amount2 = tokenStringToNumber(accept.amount);
|
|
109022
|
+
const hookResult = await resultFromPromise(
|
|
109023
|
+
"x402",
|
|
109024
|
+
surface2,
|
|
109025
|
+
beforePayment({
|
|
109026
|
+
protocol: "x402",
|
|
109027
|
+
amount: amount2,
|
|
109028
|
+
currency: "USDC",
|
|
109029
|
+
network: accept.network
|
|
109030
|
+
}),
|
|
109031
|
+
(e) => ({
|
|
109032
|
+
cause: "payment_already_attempted",
|
|
109033
|
+
message: e instanceof Error ? e.message : "Before-payment hook failed"
|
|
109034
|
+
})
|
|
109035
|
+
);
|
|
109036
|
+
if (hookResult.isErr()) {
|
|
109037
|
+
return x402Err(surface2, hookResult.error);
|
|
109038
|
+
}
|
|
109039
|
+
}
|
|
109040
|
+
}
|
|
109041
|
+
const paymentPayloadResult = await safeCreatePaymentPayload(
|
|
109042
|
+
surface2,
|
|
109043
|
+
client,
|
|
109044
|
+
paymentRequired
|
|
109045
|
+
);
|
|
109046
|
+
if (paymentPayloadResult.isErr()) {
|
|
109047
|
+
return paymentPayloadResult;
|
|
109048
|
+
}
|
|
109049
|
+
const paymentPayload = paymentPayloadResult.value;
|
|
109050
|
+
const paymentHeaders = client.encodePaymentSignatureHeader(paymentPayload);
|
|
109051
|
+
if (clonedRequest.headers.has("PAYMENT-SIGNATURE") || clonedRequest.headers.has("X-PAYMENT")) {
|
|
109052
|
+
return x402Err(surface2, {
|
|
109053
|
+
cause: "payment_already_attempted",
|
|
109054
|
+
message: "Payment already attempted"
|
|
109055
|
+
});
|
|
109056
|
+
}
|
|
109057
|
+
for (const [key, value] of Object.entries(paymentHeaders)) {
|
|
109058
|
+
clonedRequest.headers.set(key, value);
|
|
109059
|
+
}
|
|
109060
|
+
clonedRequest.headers.set(
|
|
109061
|
+
"Access-Control-Expose-Headers",
|
|
109062
|
+
"PAYMENT-RESPONSE,X-PAYMENT-RESPONSE"
|
|
109063
|
+
);
|
|
109064
|
+
return await safeFetch(surface2, clonedRequest, timeout).andThen(
|
|
109065
|
+
(paidResponse) => {
|
|
109066
|
+
const settlementResult = safeGetPaymentSettlement(
|
|
109067
|
+
surface2,
|
|
109068
|
+
client,
|
|
109069
|
+
paidResponse
|
|
109070
|
+
);
|
|
109071
|
+
return x402Ok({
|
|
109072
|
+
response: paidResponse,
|
|
109073
|
+
paymentInfo: {
|
|
109074
|
+
protocol: "x402",
|
|
109075
|
+
price: tokenStringToNumber(
|
|
109076
|
+
paymentPayload.accepted.amount
|
|
109077
|
+
).toLocaleString("en-US", {
|
|
109078
|
+
style: "currency",
|
|
109079
|
+
currency: "USD"
|
|
109080
|
+
}),
|
|
109081
|
+
...settlementResult.isOk() ? {
|
|
109082
|
+
payment: {
|
|
109083
|
+
success: settlementResult.value.success,
|
|
109084
|
+
transactionHash: settlementResult.value.transaction
|
|
109085
|
+
}
|
|
109086
|
+
} : {}
|
|
109087
|
+
}
|
|
109088
|
+
});
|
|
109089
|
+
}
|
|
109090
|
+
);
|
|
109091
|
+
}
|
|
109092
|
+
async function handleMppPayment(surface2, response, clonedRequest, options) {
|
|
109093
|
+
const { clients, beforePayment, timeout } = options;
|
|
109094
|
+
const mppxClient = clients.mpp;
|
|
109095
|
+
if (clonedRequest.headers.has("Authorization")) {
|
|
109096
|
+
return mppErr(surface2, {
|
|
109097
|
+
cause: "mpp_payment_already_attempted",
|
|
109098
|
+
message: "MPP payment already attempted"
|
|
109099
|
+
});
|
|
109100
|
+
}
|
|
109101
|
+
const challengeResult = safeGetMppChallenge(surface2, response);
|
|
109102
|
+
if (challengeResult.isErr()) {
|
|
109103
|
+
return challengeResult;
|
|
109104
|
+
}
|
|
109105
|
+
const challenge2 = challengeResult.value;
|
|
109106
|
+
const amount2 = challenge2.request.amount;
|
|
109107
|
+
const decimals2 = challenge2.request.decimals ?? 6;
|
|
109108
|
+
const currency = challenge2.request.currency;
|
|
109109
|
+
if (beforePayment && amount2 && currency) {
|
|
109110
|
+
const numericAmount = Number(formatUnits(BigInt(amount2), decimals2));
|
|
109111
|
+
const hookResult = await resultFromPromise(
|
|
109112
|
+
"mpp",
|
|
109113
|
+
surface2,
|
|
109114
|
+
beforePayment({
|
|
109115
|
+
protocol: "mpp",
|
|
109116
|
+
amount: numericAmount,
|
|
109117
|
+
currency,
|
|
109118
|
+
network: `tempo:${challenge2.method}`
|
|
109119
|
+
}),
|
|
109120
|
+
(e) => ({
|
|
109121
|
+
cause: "mpp_payment_already_attempted",
|
|
109122
|
+
message: e instanceof Error ? e.message : "Before-payment hook failed"
|
|
109123
|
+
})
|
|
109124
|
+
);
|
|
109125
|
+
if (hookResult.isErr()) {
|
|
109126
|
+
return mppErr(surface2, hookResult.error);
|
|
109127
|
+
}
|
|
109128
|
+
}
|
|
109129
|
+
const credentialResult = await safeCreateMppCredential(
|
|
109130
|
+
surface2,
|
|
109131
|
+
mppxClient,
|
|
109132
|
+
response
|
|
109133
|
+
);
|
|
109134
|
+
if (credentialResult.isErr()) {
|
|
109135
|
+
return credentialResult;
|
|
109136
|
+
}
|
|
109137
|
+
const credential = credentialResult.value;
|
|
109138
|
+
clonedRequest.headers.set("Authorization", credential);
|
|
109139
|
+
return await safeFetch(surface2, clonedRequest, timeout).andThen(
|
|
109140
|
+
(paidResponse) => {
|
|
109141
|
+
const receiptResult = safeGetMppReceipt(surface2, paidResponse);
|
|
109142
|
+
const priceDisplay = amount2 ? Number(formatUnits(BigInt(amount2), decimals2)).toLocaleString(
|
|
109143
|
+
"en-US",
|
|
109144
|
+
{
|
|
109145
|
+
style: "currency",
|
|
109146
|
+
currency: "USD"
|
|
109147
|
+
}
|
|
109148
|
+
) : void 0;
|
|
109149
|
+
return mppOk({
|
|
109150
|
+
response: paidResponse,
|
|
109151
|
+
paymentInfo: {
|
|
109152
|
+
protocol: "mpp",
|
|
109153
|
+
...priceDisplay ? { price: priceDisplay } : {},
|
|
109154
|
+
...receiptResult.isOk() ? {
|
|
109155
|
+
payment: {
|
|
109156
|
+
success: true,
|
|
109157
|
+
transactionHash: receiptResult.value.reference
|
|
109158
|
+
}
|
|
109159
|
+
} : {}
|
|
109160
|
+
}
|
|
109161
|
+
});
|
|
109162
|
+
}
|
|
109163
|
+
);
|
|
109164
|
+
}
|
|
109165
|
+
|
|
109166
|
+
// src/server/tools/response/index.ts
|
|
109167
|
+
init_cjs_shims();
|
|
109168
|
+
|
|
109169
|
+
// src/server/tools/response/success.ts
|
|
109170
|
+
init_cjs_shims();
|
|
109171
|
+
|
|
109172
|
+
// src/shared/neverthrow/json/index.ts
|
|
109173
|
+
init_cjs_shims();
|
|
109174
|
+
var type3 = "json";
|
|
109175
|
+
var jsonErr = (surface2, error48) => {
|
|
109176
|
+
return err2(type3, surface2, error48);
|
|
109177
|
+
};
|
|
109178
|
+
var safeStringifyJson = (surface2, value) => {
|
|
109179
|
+
return resultFromThrowable(
|
|
109180
|
+
type3,
|
|
109181
|
+
surface2,
|
|
109182
|
+
() => JSON.stringify(value, null, 2),
|
|
109183
|
+
() => ({
|
|
109184
|
+
cause: "stringify",
|
|
109185
|
+
message: "Could not stringify JSON"
|
|
109186
|
+
})
|
|
109187
|
+
);
|
|
109188
|
+
};
|
|
109189
|
+
var toJsonObject = (value) => JSON.parse(JSON.stringify(value));
|
|
109190
|
+
var safeParseJson = (surface2, value) => {
|
|
109191
|
+
return resultFromThrowable(
|
|
109192
|
+
type3,
|
|
109193
|
+
surface2,
|
|
109194
|
+
() => JSON.parse(value),
|
|
109195
|
+
(e) => ({
|
|
109196
|
+
cause: "parse",
|
|
109197
|
+
message: e instanceof Error ? e.message : "Could not parse JSON"
|
|
109198
|
+
})
|
|
109199
|
+
);
|
|
109200
|
+
};
|
|
109201
|
+
|
|
109202
|
+
// src/server/tools/response/error.ts
|
|
109203
|
+
init_cjs_shims();
|
|
109204
|
+
|
|
109205
|
+
// src/server/tools/response/lib.ts
|
|
109206
|
+
init_cjs_shims();
|
|
109207
|
+
var parsedResponseToToolContentPart = (data) => {
|
|
109208
|
+
switch (data.type) {
|
|
109209
|
+
case "json":
|
|
109210
|
+
return {
|
|
109211
|
+
type: "text",
|
|
109212
|
+
text: JSON.stringify(data.data)
|
|
109213
|
+
};
|
|
109214
|
+
case "image":
|
|
109215
|
+
return {
|
|
109216
|
+
type: "image",
|
|
109217
|
+
mimeType: data.mimeType,
|
|
109218
|
+
data: Buffer.from(data.data).toString("base64")
|
|
109219
|
+
};
|
|
109220
|
+
case "audio":
|
|
109221
|
+
return {
|
|
109222
|
+
type: "audio",
|
|
109223
|
+
mimeType: data.mimeType,
|
|
109224
|
+
data: Buffer.from(data.data).toString("base64")
|
|
109225
|
+
};
|
|
109226
|
+
case "text":
|
|
109227
|
+
return { type: "text", text: data.data };
|
|
109228
|
+
default:
|
|
109229
|
+
return {
|
|
109230
|
+
type: "text",
|
|
109231
|
+
text: `Unsupported response type: ${data.type}`
|
|
109232
|
+
};
|
|
109233
|
+
}
|
|
109234
|
+
};
|
|
109235
|
+
|
|
109236
|
+
// src/server/tools/response/error.ts
|
|
109237
|
+
var buildMcpError = (content) => {
|
|
109238
|
+
return {
|
|
109239
|
+
content,
|
|
109240
|
+
isError: true
|
|
109241
|
+
};
|
|
109242
|
+
};
|
|
109243
|
+
var mcpErrorJson = (error48) => {
|
|
109244
|
+
return safeStringifyJson("mcp-error-json", error48).match(
|
|
109245
|
+
(success3) => buildMcpError([{ type: "text", text: success3 }]),
|
|
109246
|
+
(error49) => buildMcpError([
|
|
109247
|
+
{ type: "text", text: JSON.stringify(error49, null, 2) }
|
|
109248
|
+
])
|
|
109249
|
+
);
|
|
109250
|
+
};
|
|
109251
|
+
var mcpError = async (err3) => {
|
|
109252
|
+
const { error: error48 } = err3;
|
|
109253
|
+
if (isFetchError(error48)) {
|
|
109254
|
+
switch (error48.cause) {
|
|
109255
|
+
case "network":
|
|
109256
|
+
case "parse":
|
|
109257
|
+
return mcpErrorJson({ ...error48 });
|
|
109258
|
+
case "http":
|
|
109259
|
+
const { response, ...rest } = error48;
|
|
109260
|
+
const parseResponseResult = await safeParseResponse(
|
|
109261
|
+
"mcp-error-fetch-parse-response",
|
|
109262
|
+
response
|
|
109263
|
+
);
|
|
109264
|
+
const httpContent = [
|
|
109265
|
+
{ type: "text", text: JSON.stringify(rest, null, 2) },
|
|
109266
|
+
...parseResponseResult.match(
|
|
109267
|
+
(success3) => [parsedResponseToToolContentPart(success3)],
|
|
109268
|
+
() => []
|
|
109269
|
+
)
|
|
109270
|
+
];
|
|
109271
|
+
return buildMcpError(httpContent);
|
|
109272
|
+
}
|
|
109273
|
+
}
|
|
109274
|
+
return mcpErrorJson({ ...error48 });
|
|
109275
|
+
};
|
|
109276
|
+
var mcpErrorFetch = async (surface2, response) => {
|
|
109277
|
+
return mcpError(fetchHttpErr(surface2, response));
|
|
109278
|
+
};
|
|
109279
|
+
|
|
109280
|
+
// src/server/tools/response/success.ts
|
|
109281
|
+
var buildMcpSuccess = (content) => {
|
|
109282
|
+
return {
|
|
109283
|
+
content
|
|
109284
|
+
};
|
|
109285
|
+
};
|
|
109286
|
+
var mcpSuccessJson = (data) => {
|
|
109287
|
+
return safeStringifyJson("mcp-success-text", data).match(
|
|
109288
|
+
(success3) => buildMcpSuccess([{ type: "text", text: success3 }]),
|
|
109289
|
+
(error48) => mcpErrorJson(error48)
|
|
109290
|
+
);
|
|
109291
|
+
};
|
|
109292
|
+
var mcpSuccessStructuredJson = (data) => {
|
|
109293
|
+
return safeStringifyJson("mcp-success-structured", data).match(
|
|
109294
|
+
(success3) => ({
|
|
109295
|
+
content: [{ type: "text", text: success3 }],
|
|
109296
|
+
structuredContent: data
|
|
109297
|
+
}),
|
|
109298
|
+
(error48) => mcpErrorJson(error48)
|
|
109299
|
+
);
|
|
109300
|
+
};
|
|
109301
|
+
var mcpSuccessResponse = (data, extra) => {
|
|
109302
|
+
const parsedExtra = extra ? safeStringifyJson("mcp-success-extra", extra).match(
|
|
109303
|
+
(success3) => success3,
|
|
109304
|
+
() => void 0
|
|
109305
|
+
) : void 0;
|
|
109306
|
+
return buildMcpSuccess([
|
|
109307
|
+
parsedResponseToToolContentPart(data),
|
|
109308
|
+
...parsedExtra ? [{ type: "text", text: parsedExtra }] : []
|
|
109309
|
+
]);
|
|
109310
|
+
};
|
|
109311
|
+
|
|
109312
|
+
// src/server/tools/lib/request.ts
|
|
109313
|
+
init_cjs_shims();
|
|
109314
|
+
var requestSchema = zod_default.object({
|
|
109315
|
+
url: zod_default.url().describe("The endpoint URL"),
|
|
109316
|
+
method: zod_default.enum(["GET", "POST", "PUT", "DELETE", "PATCH"]).optional().describe("HTTP method. Defaults to GET for fetch operations."),
|
|
109317
|
+
body: zod_default.unknown().optional().describe("Request body for POST/PUT/PATCH methods"),
|
|
109318
|
+
headers: zod_default.record(zod_default.string(), zod_default.string()).optional().describe("Additional headers to include").default({}),
|
|
109319
|
+
timeout: zod_default.number().int().positive().optional().describe("Request timeout in milliseconds")
|
|
109320
|
+
});
|
|
109321
|
+
var buildRequest2 = ({
|
|
109322
|
+
input,
|
|
109323
|
+
address,
|
|
109324
|
+
sessionId,
|
|
109325
|
+
provider
|
|
109326
|
+
}) => {
|
|
109327
|
+
return new Request(input.url, {
|
|
109328
|
+
method: input.method ?? "GET",
|
|
109329
|
+
body: input.body ? typeof input.body === "string" ? input.body : JSON.stringify(input.body) : void 0,
|
|
109330
|
+
headers: {
|
|
109331
|
+
...input.body ? { "Content-Type": "application/json" } : {},
|
|
109332
|
+
...input.headers,
|
|
109333
|
+
...address ? { "X-Wallet-Address": address, "X-Client-ID": provider } : {},
|
|
109334
|
+
...sessionId ? { "X-Session-ID": sessionId } : {}
|
|
109335
|
+
}
|
|
109336
|
+
});
|
|
109337
|
+
};
|
|
109338
|
+
|
|
109339
|
+
// src/server/tools/lib/check-balance.ts
|
|
109340
|
+
init_cjs_shims();
|
|
108712
109341
|
|
|
108713
109342
|
// src/shared/utils.ts
|
|
108714
109343
|
init_cjs_shims();
|
|
@@ -109355,490 +109984,7 @@ var openDepositLink = async (address, flags) => {
|
|
|
109355
109984
|
await open_default(depositLink);
|
|
109356
109985
|
};
|
|
109357
109986
|
|
|
109358
|
-
// src/shared/balance.ts
|
|
109359
|
-
var getBalance3 = async ({
|
|
109360
|
-
address,
|
|
109361
|
-
flags,
|
|
109362
|
-
surface: surface2
|
|
109363
|
-
}) => {
|
|
109364
|
-
const url3 = `${getBaseUrl(flags.dev)}/api/rpc/balance/${address}`;
|
|
109365
|
-
const res = await safeFetchJson(
|
|
109366
|
-
surface2,
|
|
109367
|
-
new Request(url3, {
|
|
109368
|
-
method: "GET",
|
|
109369
|
-
headers: {
|
|
109370
|
-
accept: "application/json"
|
|
109371
|
-
}
|
|
109372
|
-
}),
|
|
109373
|
-
zod_default.object({
|
|
109374
|
-
chain: zod_default.number(),
|
|
109375
|
-
balance: zod_default.coerce.number()
|
|
109376
|
-
})
|
|
109377
|
-
);
|
|
109378
|
-
return res;
|
|
109379
|
-
};
|
|
109380
|
-
|
|
109381
|
-
// src/shared/tempo-balance.ts
|
|
109382
|
-
init_cjs_shims();
|
|
109383
|
-
var MPPSCAN_BASE = "https://mppscan.com";
|
|
109384
|
-
async function getTempoBalance({
|
|
109385
|
-
address,
|
|
109386
|
-
tokenAddress
|
|
109387
|
-
}) {
|
|
109388
|
-
const url3 = `${MPPSCAN_BASE}/api/balance/${address}`;
|
|
109389
|
-
const res = await fetch(url3, {
|
|
109390
|
-
method: "GET",
|
|
109391
|
-
headers: { accept: "application/json" }
|
|
109392
|
-
});
|
|
109393
|
-
if (!res.ok) {
|
|
109394
|
-
throw new Error(`mppscan balance request failed: ${res.status}`);
|
|
109395
|
-
}
|
|
109396
|
-
const data = await res.json();
|
|
109397
|
-
return {
|
|
109398
|
-
chainId: tempo.id,
|
|
109399
|
-
chainName: tempo.name,
|
|
109400
|
-
balance: BigInt(data.balance),
|
|
109401
|
-
tokenAddress
|
|
109402
|
-
};
|
|
109403
|
-
}
|
|
109404
|
-
|
|
109405
|
-
// src/shared/operations/fetch-with-payment.ts
|
|
109406
|
-
function createFetchWithPayment(options) {
|
|
109407
|
-
const { surface: surface2, clients, paymentMethod, beforePayment, timeout } = options;
|
|
109408
|
-
return async (request) => {
|
|
109409
|
-
const clonedRequest = request.clone();
|
|
109410
|
-
const fallbackRequest = request.clone();
|
|
109411
|
-
const probeResult = await safeFetch(surface2, request, timeout);
|
|
109412
|
-
if (probeResult.isErr()) {
|
|
109413
|
-
return fetchErr(surface2, probeResult.error);
|
|
109414
|
-
}
|
|
109415
|
-
if (probeResult.value.status !== 402) {
|
|
109416
|
-
return probeResult.andThen(
|
|
109417
|
-
(response2) => fetchOk({ response: response2, paymentInfo: null })
|
|
109418
|
-
);
|
|
109419
|
-
}
|
|
109420
|
-
const response = probeResult.value;
|
|
109421
|
-
if (paymentMethod !== "auto") {
|
|
109422
|
-
if (paymentMethod === "mpp") {
|
|
109423
|
-
return handleMppPayment(surface2, response, clonedRequest, options);
|
|
109424
|
-
}
|
|
109425
|
-
return handleX402Payment(
|
|
109426
|
-
surface2,
|
|
109427
|
-
response,
|
|
109428
|
-
clonedRequest,
|
|
109429
|
-
clients.x402,
|
|
109430
|
-
beforePayment,
|
|
109431
|
-
timeout
|
|
109432
|
-
);
|
|
109433
|
-
}
|
|
109434
|
-
const available = detectPaymentProtocols(response);
|
|
109435
|
-
let preferred;
|
|
109436
|
-
if (available.length === 1) {
|
|
109437
|
-
preferred = available[0];
|
|
109438
|
-
} else {
|
|
109439
|
-
preferred = await pickByBalance(surface2, response, options);
|
|
109440
|
-
}
|
|
109441
|
-
const fallback = available.length > 1 ? preferred === "mpp" ? "x402" : "mpp" : null;
|
|
109442
|
-
const result = preferred === "mpp" ? await handleMppPayment(surface2, response, clonedRequest, options) : await handleX402Payment(
|
|
109443
|
-
surface2,
|
|
109444
|
-
response,
|
|
109445
|
-
clonedRequest,
|
|
109446
|
-
clients.x402,
|
|
109447
|
-
beforePayment,
|
|
109448
|
-
timeout
|
|
109449
|
-
);
|
|
109450
|
-
if (result.isErr() && fallback) {
|
|
109451
|
-
return fallback === "mpp" ? handleMppPayment(surface2, response, fallbackRequest, options) : handleX402Payment(
|
|
109452
|
-
surface2,
|
|
109453
|
-
response,
|
|
109454
|
-
fallbackRequest,
|
|
109455
|
-
clients.x402,
|
|
109456
|
-
beforePayment,
|
|
109457
|
-
timeout
|
|
109458
|
-
);
|
|
109459
|
-
}
|
|
109460
|
-
return result;
|
|
109461
|
-
};
|
|
109462
|
-
}
|
|
109463
|
-
async function pickByBalance(surface2, response, options) {
|
|
109464
|
-
const { account, flags } = options;
|
|
109465
|
-
const x402BalanceResult = await resultFromPromise(
|
|
109466
|
-
"balance",
|
|
109467
|
-
surface2,
|
|
109468
|
-
getBalance3({
|
|
109469
|
-
address: account.address,
|
|
109470
|
-
flags,
|
|
109471
|
-
surface: surface2
|
|
109472
|
-
}).then((r) => r.isOk() ? r.value.balance : 0),
|
|
109473
|
-
() => ({
|
|
109474
|
-
cause: "x402_balance",
|
|
109475
|
-
message: "Failed to get x402 balance"
|
|
109476
|
-
})
|
|
109477
|
-
);
|
|
109478
|
-
if (x402BalanceResult.isErr()) {
|
|
109479
|
-
log.debug("Balance comparison failed, defaulting to mpp");
|
|
109480
|
-
return "mpp";
|
|
109481
|
-
}
|
|
109482
|
-
const x402Balance = x402BalanceResult.value;
|
|
109483
|
-
let mppBalance = 0;
|
|
109484
|
-
const challengeResult = safeGetMppChallenge(surface2, response);
|
|
109485
|
-
if (challengeResult.isOk()) {
|
|
109486
|
-
const currency = challengeResult.value.request.currency;
|
|
109487
|
-
const decimals2 = challengeResult.value.request.decimals ?? 6;
|
|
109488
|
-
if (currency) {
|
|
109489
|
-
const tempoResult = await resultFromPromise(
|
|
109490
|
-
"tempo",
|
|
109491
|
-
surface2,
|
|
109492
|
-
getTempoBalance({
|
|
109493
|
-
address: account.address,
|
|
109494
|
-
tokenAddress: currency
|
|
109495
|
-
}),
|
|
109496
|
-
() => ({
|
|
109497
|
-
cause: "tempo_balance",
|
|
109498
|
-
message: "Tempo balance check failed"
|
|
109499
|
-
})
|
|
109500
|
-
);
|
|
109501
|
-
if (tempoResult.isOk()) {
|
|
109502
|
-
mppBalance = Number(formatUnits(tempoResult.value.balance, decimals2));
|
|
109503
|
-
}
|
|
109504
|
-
}
|
|
109505
|
-
}
|
|
109506
|
-
log.info(`Protocol selection \u2014 x402: $${x402Balance}, mpp: $${mppBalance}`);
|
|
109507
|
-
return x402Balance >= mppBalance ? "x402" : "mpp";
|
|
109508
|
-
}
|
|
109509
|
-
async function handleX402Payment(surface2, response, clonedRequest, client, beforePayment, timeout) {
|
|
109510
|
-
const paymentRequiredResult = await safeGetPaymentRequired(
|
|
109511
|
-
surface2,
|
|
109512
|
-
client,
|
|
109513
|
-
response
|
|
109514
|
-
);
|
|
109515
|
-
if (paymentRequiredResult.isErr()) {
|
|
109516
|
-
return paymentRequiredResult;
|
|
109517
|
-
}
|
|
109518
|
-
const paymentRequired = paymentRequiredResult.value;
|
|
109519
|
-
if (beforePayment) {
|
|
109520
|
-
const accept = paymentRequired.accepts[0];
|
|
109521
|
-
if (accept) {
|
|
109522
|
-
const amount2 = tokenStringToNumber(accept.amount);
|
|
109523
|
-
const hookResult = await resultFromPromise(
|
|
109524
|
-
"x402",
|
|
109525
|
-
surface2,
|
|
109526
|
-
beforePayment({
|
|
109527
|
-
protocol: "x402",
|
|
109528
|
-
amount: amount2,
|
|
109529
|
-
currency: "USDC",
|
|
109530
|
-
network: accept.network
|
|
109531
|
-
}),
|
|
109532
|
-
(e) => ({
|
|
109533
|
-
cause: "payment_already_attempted",
|
|
109534
|
-
message: e instanceof Error ? e.message : "Before-payment hook failed"
|
|
109535
|
-
})
|
|
109536
|
-
);
|
|
109537
|
-
if (hookResult.isErr()) {
|
|
109538
|
-
return x402Err(surface2, hookResult.error);
|
|
109539
|
-
}
|
|
109540
|
-
}
|
|
109541
|
-
}
|
|
109542
|
-
const paymentPayloadResult = await safeCreatePaymentPayload(
|
|
109543
|
-
surface2,
|
|
109544
|
-
client,
|
|
109545
|
-
paymentRequired
|
|
109546
|
-
);
|
|
109547
|
-
if (paymentPayloadResult.isErr()) {
|
|
109548
|
-
return paymentPayloadResult;
|
|
109549
|
-
}
|
|
109550
|
-
const paymentPayload = paymentPayloadResult.value;
|
|
109551
|
-
const paymentHeaders = client.encodePaymentSignatureHeader(paymentPayload);
|
|
109552
|
-
if (clonedRequest.headers.has("PAYMENT-SIGNATURE") || clonedRequest.headers.has("X-PAYMENT")) {
|
|
109553
|
-
return x402Err(surface2, {
|
|
109554
|
-
cause: "payment_already_attempted",
|
|
109555
|
-
message: "Payment already attempted"
|
|
109556
|
-
});
|
|
109557
|
-
}
|
|
109558
|
-
for (const [key, value] of Object.entries(paymentHeaders)) {
|
|
109559
|
-
clonedRequest.headers.set(key, value);
|
|
109560
|
-
}
|
|
109561
|
-
clonedRequest.headers.set(
|
|
109562
|
-
"Access-Control-Expose-Headers",
|
|
109563
|
-
"PAYMENT-RESPONSE,X-PAYMENT-RESPONSE"
|
|
109564
|
-
);
|
|
109565
|
-
return await safeFetch(surface2, clonedRequest, timeout).andThen(
|
|
109566
|
-
(paidResponse) => {
|
|
109567
|
-
const settlementResult = safeGetPaymentSettlement(
|
|
109568
|
-
surface2,
|
|
109569
|
-
client,
|
|
109570
|
-
paidResponse
|
|
109571
|
-
);
|
|
109572
|
-
return x402Ok({
|
|
109573
|
-
response: paidResponse,
|
|
109574
|
-
paymentInfo: {
|
|
109575
|
-
protocol: "x402",
|
|
109576
|
-
price: tokenStringToNumber(
|
|
109577
|
-
paymentPayload.accepted.amount
|
|
109578
|
-
).toLocaleString("en-US", {
|
|
109579
|
-
style: "currency",
|
|
109580
|
-
currency: "USD"
|
|
109581
|
-
}),
|
|
109582
|
-
...settlementResult.isOk() ? {
|
|
109583
|
-
payment: {
|
|
109584
|
-
success: settlementResult.value.success,
|
|
109585
|
-
transactionHash: settlementResult.value.transaction
|
|
109586
|
-
}
|
|
109587
|
-
} : {}
|
|
109588
|
-
}
|
|
109589
|
-
});
|
|
109590
|
-
}
|
|
109591
|
-
);
|
|
109592
|
-
}
|
|
109593
|
-
async function handleMppPayment(surface2, response, clonedRequest, options) {
|
|
109594
|
-
const { clients, beforePayment, timeout } = options;
|
|
109595
|
-
const mppxClient = clients.mpp;
|
|
109596
|
-
if (clonedRequest.headers.has("Authorization")) {
|
|
109597
|
-
return mppErr(surface2, {
|
|
109598
|
-
cause: "mpp_payment_already_attempted",
|
|
109599
|
-
message: "MPP payment already attempted"
|
|
109600
|
-
});
|
|
109601
|
-
}
|
|
109602
|
-
const challengeResult = safeGetMppChallenge(surface2, response);
|
|
109603
|
-
if (challengeResult.isErr()) {
|
|
109604
|
-
return challengeResult;
|
|
109605
|
-
}
|
|
109606
|
-
const challenge2 = challengeResult.value;
|
|
109607
|
-
const amount2 = challenge2.request.amount;
|
|
109608
|
-
const decimals2 = challenge2.request.decimals ?? 6;
|
|
109609
|
-
const currency = challenge2.request.currency;
|
|
109610
|
-
if (beforePayment && amount2 && currency) {
|
|
109611
|
-
const numericAmount = Number(formatUnits(BigInt(amount2), decimals2));
|
|
109612
|
-
const hookResult = await resultFromPromise(
|
|
109613
|
-
"mpp",
|
|
109614
|
-
surface2,
|
|
109615
|
-
beforePayment({
|
|
109616
|
-
protocol: "mpp",
|
|
109617
|
-
amount: numericAmount,
|
|
109618
|
-
currency,
|
|
109619
|
-
network: `tempo:${challenge2.method}`
|
|
109620
|
-
}),
|
|
109621
|
-
(e) => ({
|
|
109622
|
-
cause: "mpp_payment_already_attempted",
|
|
109623
|
-
message: e instanceof Error ? e.message : "Before-payment hook failed"
|
|
109624
|
-
})
|
|
109625
|
-
);
|
|
109626
|
-
if (hookResult.isErr()) {
|
|
109627
|
-
return mppErr(surface2, hookResult.error);
|
|
109628
|
-
}
|
|
109629
|
-
}
|
|
109630
|
-
const credentialResult = await safeCreateMppCredential(
|
|
109631
|
-
surface2,
|
|
109632
|
-
mppxClient,
|
|
109633
|
-
response
|
|
109634
|
-
);
|
|
109635
|
-
if (credentialResult.isErr()) {
|
|
109636
|
-
return credentialResult;
|
|
109637
|
-
}
|
|
109638
|
-
const credential = credentialResult.value;
|
|
109639
|
-
clonedRequest.headers.set("Authorization", credential);
|
|
109640
|
-
return await safeFetch(surface2, clonedRequest, timeout).andThen(
|
|
109641
|
-
(paidResponse) => {
|
|
109642
|
-
const receiptResult = safeGetMppReceipt(surface2, paidResponse);
|
|
109643
|
-
const priceDisplay = amount2 ? Number(formatUnits(BigInt(amount2), decimals2)).toLocaleString(
|
|
109644
|
-
"en-US",
|
|
109645
|
-
{
|
|
109646
|
-
style: "currency",
|
|
109647
|
-
currency: "USD"
|
|
109648
|
-
}
|
|
109649
|
-
) : void 0;
|
|
109650
|
-
return mppOk({
|
|
109651
|
-
response: paidResponse,
|
|
109652
|
-
paymentInfo: {
|
|
109653
|
-
protocol: "mpp",
|
|
109654
|
-
...priceDisplay ? { price: priceDisplay } : {},
|
|
109655
|
-
...receiptResult.isOk() ? {
|
|
109656
|
-
payment: {
|
|
109657
|
-
success: true,
|
|
109658
|
-
transactionHash: receiptResult.value.reference
|
|
109659
|
-
}
|
|
109660
|
-
} : {}
|
|
109661
|
-
}
|
|
109662
|
-
});
|
|
109663
|
-
}
|
|
109664
|
-
);
|
|
109665
|
-
}
|
|
109666
|
-
|
|
109667
|
-
// src/server/tools/response/index.ts
|
|
109668
|
-
init_cjs_shims();
|
|
109669
|
-
|
|
109670
|
-
// src/server/tools/response/success.ts
|
|
109671
|
-
init_cjs_shims();
|
|
109672
|
-
|
|
109673
|
-
// src/shared/neverthrow/json/index.ts
|
|
109674
|
-
init_cjs_shims();
|
|
109675
|
-
var type3 = "json";
|
|
109676
|
-
var jsonErr = (surface2, error48) => {
|
|
109677
|
-
return err2(type3, surface2, error48);
|
|
109678
|
-
};
|
|
109679
|
-
var safeStringifyJson = (surface2, value) => {
|
|
109680
|
-
return resultFromThrowable(
|
|
109681
|
-
type3,
|
|
109682
|
-
surface2,
|
|
109683
|
-
() => JSON.stringify(value, null, 2),
|
|
109684
|
-
() => ({
|
|
109685
|
-
cause: "stringify",
|
|
109686
|
-
message: "Could not stringify JSON"
|
|
109687
|
-
})
|
|
109688
|
-
);
|
|
109689
|
-
};
|
|
109690
|
-
var toJsonObject = (value) => JSON.parse(JSON.stringify(value));
|
|
109691
|
-
var safeParseJson = (surface2, value) => {
|
|
109692
|
-
return resultFromThrowable(
|
|
109693
|
-
type3,
|
|
109694
|
-
surface2,
|
|
109695
|
-
() => JSON.parse(value),
|
|
109696
|
-
(e) => ({
|
|
109697
|
-
cause: "parse",
|
|
109698
|
-
message: e instanceof Error ? e.message : "Could not parse JSON"
|
|
109699
|
-
})
|
|
109700
|
-
);
|
|
109701
|
-
};
|
|
109702
|
-
|
|
109703
|
-
// src/server/tools/response/error.ts
|
|
109704
|
-
init_cjs_shims();
|
|
109705
|
-
|
|
109706
|
-
// src/server/tools/response/lib.ts
|
|
109707
|
-
init_cjs_shims();
|
|
109708
|
-
var parsedResponseToToolContentPart = (data) => {
|
|
109709
|
-
switch (data.type) {
|
|
109710
|
-
case "json":
|
|
109711
|
-
return {
|
|
109712
|
-
type: "text",
|
|
109713
|
-
text: JSON.stringify(data.data)
|
|
109714
|
-
};
|
|
109715
|
-
case "image":
|
|
109716
|
-
return {
|
|
109717
|
-
type: "image",
|
|
109718
|
-
mimeType: data.mimeType,
|
|
109719
|
-
data: Buffer.from(data.data).toString("base64")
|
|
109720
|
-
};
|
|
109721
|
-
case "audio":
|
|
109722
|
-
return {
|
|
109723
|
-
type: "audio",
|
|
109724
|
-
mimeType: data.mimeType,
|
|
109725
|
-
data: Buffer.from(data.data).toString("base64")
|
|
109726
|
-
};
|
|
109727
|
-
case "text":
|
|
109728
|
-
return { type: "text", text: data.data };
|
|
109729
|
-
default:
|
|
109730
|
-
return {
|
|
109731
|
-
type: "text",
|
|
109732
|
-
text: `Unsupported response type: ${data.type}`
|
|
109733
|
-
};
|
|
109734
|
-
}
|
|
109735
|
-
};
|
|
109736
|
-
|
|
109737
|
-
// src/server/tools/response/error.ts
|
|
109738
|
-
var buildMcpError = (content) => {
|
|
109739
|
-
return {
|
|
109740
|
-
content,
|
|
109741
|
-
isError: true
|
|
109742
|
-
};
|
|
109743
|
-
};
|
|
109744
|
-
var mcpErrorJson = (error48) => {
|
|
109745
|
-
return safeStringifyJson("mcp-error-json", error48).match(
|
|
109746
|
-
(success3) => buildMcpError([{ type: "text", text: success3 }]),
|
|
109747
|
-
(error49) => buildMcpError([
|
|
109748
|
-
{ type: "text", text: JSON.stringify(error49, null, 2) }
|
|
109749
|
-
])
|
|
109750
|
-
);
|
|
109751
|
-
};
|
|
109752
|
-
var mcpError = async (err3) => {
|
|
109753
|
-
const { error: error48 } = err3;
|
|
109754
|
-
if (isFetchError(error48)) {
|
|
109755
|
-
switch (error48.cause) {
|
|
109756
|
-
case "network":
|
|
109757
|
-
case "parse":
|
|
109758
|
-
return mcpErrorJson({ ...error48 });
|
|
109759
|
-
case "http":
|
|
109760
|
-
const { response, ...rest } = error48;
|
|
109761
|
-
const parseResponseResult = await safeParseResponse(
|
|
109762
|
-
"mcp-error-fetch-parse-response",
|
|
109763
|
-
response
|
|
109764
|
-
);
|
|
109765
|
-
const httpContent = [
|
|
109766
|
-
{ type: "text", text: JSON.stringify(rest, null, 2) },
|
|
109767
|
-
...parseResponseResult.match(
|
|
109768
|
-
(success3) => [parsedResponseToToolContentPart(success3)],
|
|
109769
|
-
() => []
|
|
109770
|
-
)
|
|
109771
|
-
];
|
|
109772
|
-
return { content: httpContent };
|
|
109773
|
-
}
|
|
109774
|
-
}
|
|
109775
|
-
return mcpErrorJson({ ...error48 });
|
|
109776
|
-
};
|
|
109777
|
-
var mcpErrorFetch = async (surface2, response) => {
|
|
109778
|
-
return mcpError(fetchHttpErr(surface2, response));
|
|
109779
|
-
};
|
|
109780
|
-
|
|
109781
|
-
// src/server/tools/response/success.ts
|
|
109782
|
-
var buildMcpSuccess = (content) => {
|
|
109783
|
-
return {
|
|
109784
|
-
content
|
|
109785
|
-
};
|
|
109786
|
-
};
|
|
109787
|
-
var mcpSuccessJson = (data) => {
|
|
109788
|
-
return safeStringifyJson("mcp-success-text", data).match(
|
|
109789
|
-
(success3) => buildMcpSuccess([{ type: "text", text: success3 }]),
|
|
109790
|
-
(error48) => mcpErrorJson(error48)
|
|
109791
|
-
);
|
|
109792
|
-
};
|
|
109793
|
-
var mcpSuccessStructuredJson = (data) => {
|
|
109794
|
-
return safeStringifyJson("mcp-success-structured", data).match(
|
|
109795
|
-
(success3) => ({
|
|
109796
|
-
content: [{ type: "text", text: success3 }],
|
|
109797
|
-
structuredContent: data
|
|
109798
|
-
}),
|
|
109799
|
-
(error48) => mcpErrorJson(error48)
|
|
109800
|
-
);
|
|
109801
|
-
};
|
|
109802
|
-
var mcpSuccessResponse = (data, extra) => {
|
|
109803
|
-
const parsedExtra = extra ? safeStringifyJson("mcp-success-extra", extra).match(
|
|
109804
|
-
(success3) => success3,
|
|
109805
|
-
() => void 0
|
|
109806
|
-
) : void 0;
|
|
109807
|
-
return buildMcpSuccess([
|
|
109808
|
-
parsedResponseToToolContentPart(data),
|
|
109809
|
-
...parsedExtra ? [{ type: "text", text: parsedExtra }] : []
|
|
109810
|
-
]);
|
|
109811
|
-
};
|
|
109812
|
-
|
|
109813
|
-
// src/server/tools/lib/request.ts
|
|
109814
|
-
init_cjs_shims();
|
|
109815
|
-
var requestSchema = zod_default.object({
|
|
109816
|
-
url: zod_default.url().describe("The endpoint URL"),
|
|
109817
|
-
method: zod_default.enum(["GET", "POST", "PUT", "DELETE", "PATCH"]).optional().describe("HTTP method. Defaults to GET for fetch operations."),
|
|
109818
|
-
body: zod_default.unknown().optional().describe("Request body for POST/PUT/PATCH methods"),
|
|
109819
|
-
headers: zod_default.record(zod_default.string(), zod_default.string()).optional().describe("Additional headers to include").default({}),
|
|
109820
|
-
timeout: zod_default.number().int().positive().optional().describe("Request timeout in milliseconds")
|
|
109821
|
-
});
|
|
109822
|
-
var buildRequest2 = ({
|
|
109823
|
-
input,
|
|
109824
|
-
address,
|
|
109825
|
-
sessionId,
|
|
109826
|
-
provider
|
|
109827
|
-
}) => {
|
|
109828
|
-
return new Request(input.url, {
|
|
109829
|
-
method: input.method ?? "GET",
|
|
109830
|
-
body: input.body ? typeof input.body === "string" ? input.body : JSON.stringify(input.body) : void 0,
|
|
109831
|
-
headers: {
|
|
109832
|
-
...input.body ? { "Content-Type": "application/json" } : {},
|
|
109833
|
-
...input.headers,
|
|
109834
|
-
...address ? { "X-Wallet-Address": address, "X-Client-ID": provider } : {},
|
|
109835
|
-
...sessionId ? { "X-Session-ID": sessionId } : {}
|
|
109836
|
-
}
|
|
109837
|
-
});
|
|
109838
|
-
};
|
|
109839
|
-
|
|
109840
109987
|
// src/server/tools/lib/check-balance.ts
|
|
109841
|
-
init_cjs_shims();
|
|
109842
109988
|
var checkBalance = async ({
|
|
109843
109989
|
server,
|
|
109844
109990
|
address,
|
|
@@ -109847,7 +109993,7 @@ var checkBalance = async ({
|
|
|
109847
109993
|
flags,
|
|
109848
109994
|
surface: surface2
|
|
109849
109995
|
}) => {
|
|
109850
|
-
const balanceResult = await getBalance3({ address,
|
|
109996
|
+
const balanceResult = await getBalance3({ address, surface: surface2 });
|
|
109851
109997
|
if (balanceResult.isErr()) {
|
|
109852
109998
|
log.error(JSON.stringify(balanceResult.error, null, 2));
|
|
109853
109999
|
return;
|
|
@@ -109921,8 +110067,9 @@ Insufficient Tempo balance for this payment.`
|
|
|
109921
110067
|
|
|
109922
110068
|
// src/server/tools/fetch.ts
|
|
109923
110069
|
var toolName = "fetch";
|
|
110070
|
+
var paymentMethodEnum = isMppEnabled() ? external_exports3.enum(["x402", "mpp", "auto"]) : external_exports3.enum(["x402", "auto"]);
|
|
109924
110071
|
var fetchInputSchema = requestSchema.extend({
|
|
109925
|
-
paymentMethod:
|
|
110072
|
+
paymentMethod: paymentMethodEnum.default("auto").optional().describe("Payment protocol to use. Defaults to auto-detect.")
|
|
109926
110073
|
});
|
|
109927
110074
|
var registerFetchTool = ({
|
|
109928
110075
|
server,
|
|
@@ -109951,15 +110098,20 @@ var registerFetchTool = ({
|
|
|
109951
110098
|
]
|
|
109952
110099
|
});
|
|
109953
110100
|
const x402HttpClient = new x402HTTPClient(coreClient);
|
|
109954
|
-
const mppxClient = Mppx_exports.create({
|
|
110101
|
+
const mppxClient = isMppEnabled() ? Mppx_exports.create({
|
|
109955
110102
|
polyfill: false,
|
|
109956
110103
|
methods: [
|
|
109957
110104
|
tempo2({
|
|
109958
110105
|
account,
|
|
109959
|
-
getClient: () => createClient({
|
|
110106
|
+
getClient: () => createClient({
|
|
110107
|
+
chain: tempo,
|
|
110108
|
+
transport: http(TEMPO_RPC_URL)
|
|
110109
|
+
})
|
|
109960
110110
|
})
|
|
109961
110111
|
]
|
|
109962
|
-
})
|
|
110112
|
+
}) : {
|
|
110113
|
+
createCredential: () => Promise.reject(new Error("MPP disabled"))
|
|
110114
|
+
};
|
|
109963
110115
|
const beforePayment = async (ctx) => {
|
|
109964
110116
|
if (ctx.protocol === "x402") {
|
|
109965
110117
|
await checkBalance({
|
|
@@ -109970,7 +110122,7 @@ var registerFetchTool = ({
|
|
|
109970
110122
|
message: (balance) => `This request costs ${ctx.amount} USDC. Your current balance is ${balance} USDC.`,
|
|
109971
110123
|
flags
|
|
109972
110124
|
});
|
|
109973
|
-
} else {
|
|
110125
|
+
} else if (isMppEnabled()) {
|
|
109974
110126
|
await checkTempoBalance({
|
|
109975
110127
|
surface: toolName,
|
|
109976
110128
|
server,
|
|
@@ -110153,23 +110305,24 @@ init_cjs_shims();
|
|
|
110153
110305
|
// src/shared/operations/wallet-info.ts
|
|
110154
110306
|
init_cjs_shims();
|
|
110155
110307
|
async function getWalletInfo(surface2, address, flags) {
|
|
110156
|
-
const
|
|
110157
|
-
getBalance3({ address,
|
|
110158
|
-
getTempoBalance({ address, tokenAddress: TEMPO_TOKEN_ADDRESS }).then((r) => Number(formatUnits(r.balance, 6))).catch((e) => {
|
|
110308
|
+
const balancePromises = [
|
|
110309
|
+
getBalance3({ address, surface: surface2 }),
|
|
110310
|
+
isMppEnabled() ? getTempoBalance({ address, tokenAddress: TEMPO_TOKEN_ADDRESS }).then((r) => Number(formatUnits(r.balance, 6))).catch((e) => {
|
|
110159
110311
|
log.info(`Failed to fetch Tempo balance: ${e}`);
|
|
110160
110312
|
return null;
|
|
110161
|
-
})
|
|
110162
|
-
]
|
|
110313
|
+
}) : Promise.resolve(null)
|
|
110314
|
+
];
|
|
110315
|
+
const [balanceResult, tempoResult] = await Promise.all(balancePromises);
|
|
110163
110316
|
if (balanceResult.isErr()) {
|
|
110164
110317
|
return balanceResult;
|
|
110165
110318
|
}
|
|
110166
110319
|
const baseBalance = balanceResult.value.balance;
|
|
110167
110320
|
const tempoBalance = tempoResult ?? 0;
|
|
110168
110321
|
const totalBalance = baseBalance + tempoBalance;
|
|
110169
|
-
const chains = [
|
|
110170
|
-
|
|
110171
|
-
{ chain: "Tempo", balance: tempoBalance }
|
|
110172
|
-
|
|
110322
|
+
const chains = [{ chain: "Base", balance: baseBalance }];
|
|
110323
|
+
if (isMppEnabled()) {
|
|
110324
|
+
chains.push({ chain: "Tempo", balance: tempoBalance });
|
|
110325
|
+
}
|
|
110173
110326
|
return ok2({
|
|
110174
110327
|
address,
|
|
110175
110328
|
balance: totalBalance,
|
|
@@ -110573,7 +110726,7 @@ async function probeMethod({
|
|
|
110573
110726
|
} else if (endpointSchemaResult.isErr()) {
|
|
110574
110727
|
log.debug(`Failed to fetch OpenAPI schema for: ${url3}`);
|
|
110575
110728
|
}
|
|
110576
|
-
if (protocols.includes("mpp")) {
|
|
110729
|
+
if (isMppEnabled() && protocols.includes("mpp")) {
|
|
110577
110730
|
for (const challenge2 of parseMppChallenges(response)) {
|
|
110578
110731
|
const currency = challenge2.request.currency;
|
|
110579
110732
|
const amount2 = challenge2.request.amount;
|
|
@@ -110876,7 +111029,7 @@ var import_path2 = require("path");
|
|
|
110876
111029
|
var import_url = require("url");
|
|
110877
111030
|
function getVersion2() {
|
|
110878
111031
|
if (true) {
|
|
110879
|
-
return "0.
|
|
111032
|
+
return "0.5.0-mpp.0";
|
|
110880
111033
|
}
|
|
110881
111034
|
const __dirname3 = (0, import_path2.dirname)((0, import_url.fileURLToPath)(importMetaUrl));
|
|
110882
111035
|
const pkg = JSON.parse(
|
|
@@ -111204,18 +111357,21 @@ var registerOrigins = ({ server }) => {
|
|
|
111204
111357
|
},
|
|
111205
111358
|
async (uri) => {
|
|
111206
111359
|
const baseUrl = uri.toString().replace("api://", "https://");
|
|
111207
|
-
const
|
|
111360
|
+
const wellKnownPromises = [
|
|
111208
111361
|
safeFetchJson(
|
|
111209
111362
|
surface,
|
|
111210
111363
|
new Request(`${baseUrl}/.well-known/x402`),
|
|
111211
111364
|
wellKnownSchema
|
|
111212
111365
|
),
|
|
111213
|
-
|
|
111214
|
-
|
|
111215
|
-
|
|
111216
|
-
|
|
111217
|
-
|
|
111218
|
-
|
|
111366
|
+
...isMppEnabled() ? [
|
|
111367
|
+
safeFetchJson(
|
|
111368
|
+
surface,
|
|
111369
|
+
new Request(`${baseUrl}/.well-known/mpp`),
|
|
111370
|
+
wellKnownSchema
|
|
111371
|
+
)
|
|
111372
|
+
] : []
|
|
111373
|
+
];
|
|
111374
|
+
const [x402WellKnown, mppWellKnown] = await Promise.all(wellKnownPromises);
|
|
111219
111375
|
const allResourceUrls = /* @__PURE__ */ new Set();
|
|
111220
111376
|
const addResource = (r) => {
|
|
111221
111377
|
if (typeof r === "string") {
|
|
@@ -111225,12 +111381,12 @@ var registerOrigins = ({ server }) => {
|
|
|
111225
111381
|
const url3 = r.path ? `${baseUrl}${r.path}` : r.url ?? "";
|
|
111226
111382
|
if (url3) allResourceUrls.add(url3);
|
|
111227
111383
|
};
|
|
111228
|
-
if (x402WellKnown
|
|
111384
|
+
if (x402WellKnown?.isOk()) {
|
|
111229
111385
|
for (const r of x402WellKnown.value.resources) {
|
|
111230
111386
|
addResource(r);
|
|
111231
111387
|
}
|
|
111232
111388
|
}
|
|
111233
|
-
if (mppWellKnown
|
|
111389
|
+
if (mppWellKnown?.isOk()) {
|
|
111234
111390
|
for (const r of mppWellKnown.value.resources) {
|
|
111235
111391
|
addResource(r);
|
|
111236
111392
|
}
|
|
@@ -111238,8 +111394,8 @@ var registerOrigins = ({ server }) => {
|
|
|
111238
111394
|
if (allResourceUrls.size === 0) {
|
|
111239
111395
|
console.error(
|
|
111240
111396
|
`Failed to fetch well-known for ${origin}:`,
|
|
111241
|
-
x402WellKnown
|
|
111242
|
-
mppWellKnown
|
|
111397
|
+
x402WellKnown?.isErr() ? x402WellKnown.error : "no x402",
|
|
111398
|
+
mppWellKnown?.isErr() ? mppWellKnown.error : "no mpp"
|
|
111243
111399
|
);
|
|
111244
111400
|
return {
|
|
111245
111401
|
contents: [
|
|
@@ -111358,7 +111514,7 @@ var getResourceResponse = async (resource, request) => {
|
|
|
111358
111514
|
const protocols = detectPaymentProtocols(response);
|
|
111359
111515
|
let mppInfo = null;
|
|
111360
111516
|
let x402Info = null;
|
|
111361
|
-
if (protocols.includes("mpp")) {
|
|
111517
|
+
if (isMppEnabled() && protocols.includes("mpp")) {
|
|
111362
111518
|
const challengeResult = safeGetMppChallenge(surface, response);
|
|
111363
111519
|
if (challengeResult.isOk()) {
|
|
111364
111520
|
const challenge2 = challengeResult.value;
|
|
@@ -111617,7 +111773,7 @@ var import_path3 = require("path");
|
|
|
111617
111773
|
var import_url2 = require("url");
|
|
111618
111774
|
function getVersion3() {
|
|
111619
111775
|
if (true) {
|
|
111620
|
-
return "0.
|
|
111776
|
+
return "0.5.0-mpp.0";
|
|
111621
111777
|
}
|
|
111622
111778
|
const __dirname3 = (0, import_path3.dirname)((0, import_url2.fileURLToPath)(importMetaUrl));
|
|
111623
111779
|
const pkg = JSON.parse(
|
|
@@ -111683,19 +111839,16 @@ async function reconcileLegacyWallet(current, isNew) {
|
|
|
111683
111839
|
if (legacyAccount.address === current.address) {
|
|
111684
111840
|
return noChange;
|
|
111685
111841
|
}
|
|
111686
|
-
const flags = { dev: false };
|
|
111687
111842
|
const balancesResult = await resultFromPromise(
|
|
111688
111843
|
"wallet",
|
|
111689
111844
|
reconcileSurface,
|
|
111690
111845
|
Promise.all([
|
|
111691
111846
|
getBalance3({
|
|
111692
111847
|
address: legacyAccount.address,
|
|
111693
|
-
flags,
|
|
111694
111848
|
surface: reconcileSurface
|
|
111695
111849
|
}),
|
|
111696
111850
|
getBalance3({
|
|
111697
111851
|
address: current.address,
|
|
111698
|
-
flags,
|
|
111699
111852
|
surface: reconcileSurface
|
|
111700
111853
|
})
|
|
111701
111854
|
]),
|