@agentwonderland/mcp 0.1.32 → 0.1.34

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.
@@ -90,8 +90,14 @@ export async function uploadLocalFiles(input) {
90
90
  if (!isLocalFilePath(value))
91
91
  continue;
92
92
  const resolved = resolvePath(value);
93
- if (!existsSync(resolved))
94
- continue;
93
+ if (!existsSync(resolved)) {
94
+ throw new Error(`File not found at "${value}" (for input field "${key}"). ` +
95
+ `This MCP server reads files from its own filesystem — if your client ` +
96
+ `sandboxes attachments (e.g. a web session with a /mnt/... path), the ` +
97
+ `bytes aren't reachable here. Fix: pass a public URL for "${key}", or ` +
98
+ `save the file to a real local path first (e.g. ~/Downloads/${basename(resolved)}) ` +
99
+ `and retry.`);
100
+ }
95
101
  try {
96
102
  const url = await uploadFile(value);
97
103
  result[key] = url;
package/dist/tools/run.js CHANGED
@@ -10,25 +10,52 @@ import { storeFeedbackToken } from "./_token-cache.js";
10
10
  import { getOrCreatePendingCardSetup, formatCardSetupBlocks } from "../core/card-setup.js";
11
11
  import { formatPaymentLabel, formatRunConfirmationCommand, resolveConfirmationMethod, } from "./_payment-confirmation.js";
12
12
  const POLL_INTERVAL_MS = 3000;
13
- const POLL_MAX_MS = 120000;
13
+ const POLL_MAX_MS = 300000;
14
+ // Collects every wallet address the consumer has configured so the poll below
15
+ // works regardless of which chain the job's `callerAddress` was stored on.
16
+ // `run_agent` runs can land as the MPP payer address, the MPP caller address,
17
+ // or (for credit-pack runs) the consumer principal — any of these may differ
18
+ // from `getWalletAddress(paymentMethod)`, which only returns one chain.
19
+ async function collectWalletAddresses(paymentMethod) {
20
+ const addresses = new Set();
21
+ const primary = await getWalletAddress(paymentMethod);
22
+ if (primary)
23
+ addresses.add(primary);
24
+ for (const chain of ["tempo", "base", "solana"]) {
25
+ const addr = await getWalletAddress(chain);
26
+ if (addr)
27
+ addresses.add(addr);
28
+ }
29
+ return [...addresses];
30
+ }
14
31
  async function pollJobUntilDone(jobId, paymentMethod) {
15
32
  const deadline = Date.now() + POLL_MAX_MS;
16
- const walletAddress = await getWalletAddress(paymentMethod);
17
- const walletParam = walletAddress ? `?wallet=${walletAddress}` : "";
33
+ const walletAddresses = await collectWalletAddresses(paymentMethod);
34
+ const walletParams = walletAddresses.length > 0
35
+ ? walletAddresses.map((a) => `?wallet=${encodeURIComponent(a)}`)
36
+ : [""];
18
37
  while (Date.now() < deadline) {
19
38
  await new Promise((r) => setTimeout(r, POLL_INTERVAL_MS));
20
- try {
21
- const job = await apiGet(`/jobs/${jobId}${walletParam}`);
22
- if (job.status === "completed") {
23
- return { status: "completed", output: job.output };
39
+ for (const walletParam of walletParams) {
40
+ try {
41
+ const job = await apiGet(`/jobs/${jobId}${walletParam}`);
42
+ if (job.status === "completed") {
43
+ return { status: "completed", output: job.output };
44
+ }
45
+ if (job.status === "failed") {
46
+ return { status: "failed", output: job.output, error_code: job.error_code };
47
+ }
48
+ // status === "processing" — break out to next poll interval.
49
+ break;
24
50
  }
25
- if (job.status === "failed") {
26
- return { status: "failed", output: job.output, error_code: job.error_code };
51
+ catch (err) {
52
+ const status = err?.status;
53
+ // 404 means wrong wallet for this job — try the next address.
54
+ // Any other error: give up for this interval and retry after the sleep.
55
+ if (status !== 404)
56
+ break;
27
57
  }
28
58
  }
29
- catch {
30
- // Ignore poll errors until timeout.
31
- }
32
59
  }
33
60
  return { status: "failed", error_code: "POLL_TIMEOUT" };
34
61
  }
@@ -10,25 +10,44 @@ import { storeFeedbackToken } from "./_token-cache.js";
10
10
  import { formatPaymentLabel, formatSolveConfirmationCommand, makeSolvePendingKey, resolveConfirmationMethod, } from "./_payment-confirmation.js";
11
11
  import { getActiveCreditPack, getCreditPackInventory, getCreditPackProgram } from "../core/passes.js";
12
12
  const POLL_INTERVAL_MS = 3000;
13
- const POLL_MAX_MS = 120000;
13
+ const POLL_MAX_MS = 300000;
14
+ async function collectWalletAddresses(paymentMethod) {
15
+ const addresses = new Set();
16
+ const primary = await getWalletAddress(paymentMethod);
17
+ if (primary)
18
+ addresses.add(primary);
19
+ for (const chain of ["tempo", "base", "solana"]) {
20
+ const addr = await getWalletAddress(chain);
21
+ if (addr)
22
+ addresses.add(addr);
23
+ }
24
+ return [...addresses];
25
+ }
14
26
  async function pollSolveJob(jobId, paymentMethod) {
15
27
  const deadline = Date.now() + POLL_MAX_MS;
16
- const walletAddress = await getWalletAddress(paymentMethod);
17
- const walletParam = walletAddress ? `?wallet=${walletAddress}` : "";
28
+ const walletAddresses = await collectWalletAddresses(paymentMethod);
29
+ const walletParams = walletAddresses.length > 0
30
+ ? walletAddresses.map((a) => `?wallet=${encodeURIComponent(a)}`)
31
+ : [""];
18
32
  while (Date.now() < deadline) {
19
33
  await new Promise((r) => setTimeout(r, POLL_INTERVAL_MS));
20
- try {
21
- const job = await apiGet(`/jobs/${jobId}${walletParam}`);
22
- if (job.status === "completed") {
23
- return { status: "completed", output: job.output };
34
+ for (const walletParam of walletParams) {
35
+ try {
36
+ const job = await apiGet(`/jobs/${jobId}${walletParam}`);
37
+ if (job.status === "completed") {
38
+ return { status: "completed", output: job.output };
39
+ }
40
+ if (job.status === "failed") {
41
+ return { status: "failed", output: job.output, error_code: job.error_code };
42
+ }
43
+ break;
24
44
  }
25
- if (job.status === "failed") {
26
- return { status: "failed", output: job.output, error_code: job.error_code };
45
+ catch (err) {
46
+ const status = err?.status;
47
+ if (status !== 404)
48
+ break;
27
49
  }
28
50
  }
29
- catch {
30
- // Ignore poll errors and keep trying.
31
- }
32
51
  }
33
52
  return { status: "failed", error_code: "POLL_TIMEOUT" };
34
53
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentwonderland/mcp",
3
- "version": "0.1.32",
3
+ "version": "0.1.34",
4
4
  "type": "module",
5
5
  "description": "MCP server for the Agent Wonderland AI agent marketplace",
6
6
  "bin": {
@@ -112,7 +112,16 @@ export async function uploadLocalFiles(
112
112
  if (!isLocalFilePath(value)) continue;
113
113
 
114
114
  const resolved = resolvePath(value);
115
- if (!existsSync(resolved)) continue;
115
+ if (!existsSync(resolved)) {
116
+ throw new Error(
117
+ `File not found at "${value}" (for input field "${key}"). ` +
118
+ `This MCP server reads files from its own filesystem — if your client ` +
119
+ `sandboxes attachments (e.g. a web session with a /mnt/... path), the ` +
120
+ `bytes aren't reachable here. Fix: pass a public URL for "${key}", or ` +
121
+ `save the file to a real local path first (e.g. ~/Downloads/${basename(resolved)}) ` +
122
+ `and retry.`,
123
+ );
124
+ }
116
125
 
117
126
  try {
118
127
  const url = await uploadFile(value);
package/src/tools/run.ts CHANGED
@@ -29,33 +29,58 @@ import {
29
29
  import type { AgentRecord } from "../core/types.js";
30
30
 
31
31
  const POLL_INTERVAL_MS = 3000;
32
- const POLL_MAX_MS = 120000;
32
+ const POLL_MAX_MS = 300000;
33
+
34
+ // Collects every wallet address the consumer has configured so the poll below
35
+ // works regardless of which chain the job's `callerAddress` was stored on.
36
+ // `run_agent` runs can land as the MPP payer address, the MPP caller address,
37
+ // or (for credit-pack runs) the consumer principal — any of these may differ
38
+ // from `getWalletAddress(paymentMethod)`, which only returns one chain.
39
+ async function collectWalletAddresses(paymentMethod?: string): Promise<string[]> {
40
+ const addresses = new Set<string>();
41
+ const primary = await getWalletAddress(paymentMethod);
42
+ if (primary) addresses.add(primary);
43
+ for (const chain of ["tempo", "base", "solana"]) {
44
+ const addr = await getWalletAddress(chain);
45
+ if (addr) addresses.add(addr);
46
+ }
47
+ return [...addresses];
48
+ }
33
49
 
34
50
  async function pollJobUntilDone(
35
51
  jobId: string,
36
52
  paymentMethod?: string,
37
53
  ): Promise<{ status: string; output?: unknown; error_code?: string }> {
38
54
  const deadline = Date.now() + POLL_MAX_MS;
39
- const walletAddress = await getWalletAddress(paymentMethod);
40
- const walletParam = walletAddress ? `?wallet=${walletAddress}` : "";
55
+ const walletAddresses = await collectWalletAddresses(paymentMethod);
56
+ const walletParams = walletAddresses.length > 0
57
+ ? walletAddresses.map((a) => `?wallet=${encodeURIComponent(a)}`)
58
+ : [""];
41
59
 
42
60
  while (Date.now() < deadline) {
43
61
  await new Promise((r) => setTimeout(r, POLL_INTERVAL_MS));
44
- try {
45
- const job = await apiGet<{
46
- status: string;
47
- output?: unknown;
48
- error_code?: string;
49
- }>(`/jobs/${jobId}${walletParam}`);
50
-
51
- if (job.status === "completed") {
52
- return { status: "completed", output: job.output };
53
- }
54
- if (job.status === "failed") {
55
- return { status: "failed", output: job.output, error_code: job.error_code };
62
+ for (const walletParam of walletParams) {
63
+ try {
64
+ const job = await apiGet<{
65
+ status: string;
66
+ output?: unknown;
67
+ error_code?: string;
68
+ }>(`/jobs/${jobId}${walletParam}`);
69
+
70
+ if (job.status === "completed") {
71
+ return { status: "completed", output: job.output };
72
+ }
73
+ if (job.status === "failed") {
74
+ return { status: "failed", output: job.output, error_code: job.error_code };
75
+ }
76
+ // status === "processing" — break out to next poll interval.
77
+ break;
78
+ } catch (err) {
79
+ const status = (err as { status?: number })?.status;
80
+ // 404 means wrong wallet for this job — try the next address.
81
+ // Any other error: give up for this interval and retry after the sleep.
82
+ if (status !== 404) break;
56
83
  }
57
- } catch {
58
- // Ignore poll errors until timeout.
59
84
  }
60
85
  }
61
86
 
@@ -27,33 +27,50 @@ import {
27
27
  import { getActiveCreditPack, getCreditPackInventory, getCreditPackProgram } from "../core/passes.js";
28
28
 
29
29
  const POLL_INTERVAL_MS = 3000;
30
- const POLL_MAX_MS = 120000;
30
+ const POLL_MAX_MS = 300000;
31
+
32
+ async function collectWalletAddresses(paymentMethod?: string): Promise<string[]> {
33
+ const addresses = new Set<string>();
34
+ const primary = await getWalletAddress(paymentMethod);
35
+ if (primary) addresses.add(primary);
36
+ for (const chain of ["tempo", "base", "solana"]) {
37
+ const addr = await getWalletAddress(chain);
38
+ if (addr) addresses.add(addr);
39
+ }
40
+ return [...addresses];
41
+ }
31
42
 
32
43
  async function pollSolveJob(
33
44
  jobId: string,
34
45
  paymentMethod?: string,
35
46
  ): Promise<{ status: string; output?: unknown; error_code?: string }> {
36
47
  const deadline = Date.now() + POLL_MAX_MS;
37
- const walletAddress = await getWalletAddress(paymentMethod);
38
- const walletParam = walletAddress ? `?wallet=${walletAddress}` : "";
48
+ const walletAddresses = await collectWalletAddresses(paymentMethod);
49
+ const walletParams = walletAddresses.length > 0
50
+ ? walletAddresses.map((a) => `?wallet=${encodeURIComponent(a)}`)
51
+ : [""];
39
52
 
40
53
  while (Date.now() < deadline) {
41
54
  await new Promise((r) => setTimeout(r, POLL_INTERVAL_MS));
42
- try {
43
- const job = await apiGet<{
44
- status: string;
45
- output?: unknown;
46
- error_code?: string;
47
- }>(`/jobs/${jobId}${walletParam}`);
48
-
49
- if (job.status === "completed") {
50
- return { status: "completed", output: job.output };
51
- }
52
- if (job.status === "failed") {
53
- return { status: "failed", output: job.output, error_code: job.error_code };
55
+ for (const walletParam of walletParams) {
56
+ try {
57
+ const job = await apiGet<{
58
+ status: string;
59
+ output?: unknown;
60
+ error_code?: string;
61
+ }>(`/jobs/${jobId}${walletParam}`);
62
+
63
+ if (job.status === "completed") {
64
+ return { status: "completed", output: job.output };
65
+ }
66
+ if (job.status === "failed") {
67
+ return { status: "failed", output: job.output, error_code: job.error_code };
68
+ }
69
+ break;
70
+ } catch (err) {
71
+ const status = (err as { status?: number })?.status;
72
+ if (status !== 404) break;
54
73
  }
55
- } catch {
56
- // Ignore poll errors and keep trying.
57
74
  }
58
75
  }
59
76