@stage-labs/metro 0.1.0-beta.283 → 0.1.0-beta.284
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "metro",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.284",
|
|
4
4
|
"description": "Metro for Claude Code, installed by the metro daemon on this machine: every connector the agent holds as its own MCP server relayed through the daemon, the orchestrator-only guard on the main thread, and the standing rules loaded at each session start. No vendor credential ever sits in a config file.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Bonustrack",
|
|
@@ -17,7 +17,7 @@ interface FetchSchedule {
|
|
|
17
17
|
requestTimeoutMs: number;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
const READ_SCHEDULE: FetchSchedule = { delaysMs: [400, 800], requestTimeoutMs:
|
|
20
|
+
const READ_SCHEDULE: FetchSchedule = { delaysMs: [400, 800], requestTimeoutMs: 18_000 };
|
|
21
21
|
export const INBOUND_FETCH_SCHEDULE: FetchSchedule = {
|
|
22
22
|
delaysMs: [
|
|
23
23
|
2_000, 4_000, 8_000, 15_000, 30_000, 30_000,
|
|
@@ -26,7 +26,7 @@ export const INBOUND_FETCH_SCHEDULE: FetchSchedule = {
|
|
|
26
26
|
requestTimeoutMs: 120_000,
|
|
27
27
|
};
|
|
28
28
|
export const REMOTE_FETCH_ATTEMPTS = READ_SCHEDULE.delaysMs.length + 1;
|
|
29
|
-
const
|
|
29
|
+
const SWARM_GATEWAY = 'https://download.gateway.ethswarm.org/bzz/';
|
|
30
30
|
const SWARM_BZZ_URL = /^https:\/\/[^/]+\/bzz\/([0-9a-f]{64}(?:[0-9a-f]{64})?)\/?$/i;
|
|
31
31
|
|
|
32
32
|
const sleep = (ms: number): Promise<void> =>
|
|
@@ -88,11 +88,9 @@ interface DecodedAttachment {
|
|
|
88
88
|
data: Uint8Array;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
function
|
|
91
|
+
function remoteUrl(url: string): string {
|
|
92
92
|
const ref = SWARM_BZZ_URL.exec(url)?.[1];
|
|
93
|
-
|
|
94
|
-
const fallback = `${SWARM_FALLBACK_GATEWAY}${ref.toLowerCase()}/`;
|
|
95
|
-
return url.toLowerCase().replace(/\/?$/, '/') === fallback ? [url] : [url, fallback];
|
|
93
|
+
return ref === undefined ? url : `${SWARM_GATEWAY}${ref.toLowerCase()}/`;
|
|
96
94
|
}
|
|
97
95
|
|
|
98
96
|
function withTimeout<T>(work: Promise<T>, ms: number, url: string): Promise<T> {
|
|
@@ -122,19 +120,15 @@ async function loadRemote(
|
|
|
122
120
|
r: RemoteEntry,
|
|
123
121
|
schedule: FetchSchedule,
|
|
124
122
|
): Promise<DecodedAttachment> {
|
|
125
|
-
const
|
|
123
|
+
const url = remoteUrl(r.url);
|
|
126
124
|
let last = '';
|
|
127
125
|
for (const delay of [0, ...schedule.delaysMs]) {
|
|
128
126
|
if (delay > 0) await sleep(delay);
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
} catch (err) {
|
|
134
|
-
errors.push(errMsg(err));
|
|
135
|
-
}
|
|
127
|
+
try {
|
|
128
|
+
return await loadFrom(r, url, schedule.requestTimeoutMs);
|
|
129
|
+
} catch (err) {
|
|
130
|
+
last = errMsg(err);
|
|
136
131
|
}
|
|
137
|
-
last = errors.join('; ');
|
|
138
132
|
}
|
|
139
133
|
throw new Error(
|
|
140
134
|
`xmtp remote attachment fetch failed after ${schedule.delaysMs.length + 1} attempts: ${last}`,
|
package/runtime/runtime.json
CHANGED