@swmansion/argent 0.35.1-next.24 → 0.35.1-next.26
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/cli-cmds.mjs +29 -15
- package/dist/installer.mjs +1 -1
- package/dist/mcp-server.mjs +1 -1
- package/dist/tool-server.cjs +100 -30
- package/package.json +2 -2
package/dist/cli-cmds.mjs
CHANGED
|
@@ -34936,7 +34936,7 @@ async function downloadAndExtractArchive(handle, data, dir, signal) {
|
|
|
34936
34936
|
async function materializeArtifacts(result, ctx) {
|
|
34937
34937
|
const images = [];
|
|
34938
34938
|
const fetchFn = ctx.fetchImpl ?? fetch;
|
|
34939
|
-
const
|
|
34939
|
+
const authHeaders4 = ctx.authToken ? { Authorization: `Bearer ${ctx.authToken}` } : {};
|
|
34940
34940
|
const dir = artifactDir(ctx.deviceId);
|
|
34941
34941
|
let dirReady = false;
|
|
34942
34942
|
async function ensureDir() {
|
|
@@ -34976,7 +34976,7 @@ async function materializeArtifacts(result, ctx) {
|
|
|
34976
34976
|
return null;
|
|
34977
34977
|
}
|
|
34978
34978
|
const res = await fetchFn(`${ctx.toolsUrl}/artifacts/${value.id}`, {
|
|
34979
|
-
headers:
|
|
34979
|
+
headers: authHeaders4,
|
|
34980
34980
|
signal: ctx.signal
|
|
34981
34981
|
});
|
|
34982
34982
|
if (!res.ok) return null;
|
|
@@ -35005,9 +35005,9 @@ async function materializeArtifacts(result, ctx) {
|
|
|
35005
35005
|
try {
|
|
35006
35006
|
const res = await fetchFn(`${ctx.toolsUrl}/artifacts/${value.id}`, {
|
|
35007
35007
|
headers: value.archive ? {
|
|
35008
|
-
...
|
|
35008
|
+
...authHeaders4,
|
|
35009
35009
|
Accept: ARCHIVE_FORMATS.map((f) => ARCHIVE_CONTENT_TYPES[f]).join(", ")
|
|
35010
|
-
} :
|
|
35010
|
+
} : authHeaders4,
|
|
35011
35011
|
signal: ctx.signal
|
|
35012
35012
|
});
|
|
35013
35013
|
if (!res.ok) return null;
|
|
@@ -38595,7 +38595,7 @@ function isCi(env = process.env) {
|
|
|
38595
38595
|
var SESSION_ID2 = randomUUID5();
|
|
38596
38596
|
function readCliVersion() {
|
|
38597
38597
|
if (true) {
|
|
38598
|
-
return "0.35.1-next.
|
|
38598
|
+
return "0.35.1-next.26";
|
|
38599
38599
|
}
|
|
38600
38600
|
return "0.0.0";
|
|
38601
38601
|
}
|
|
@@ -41827,7 +41827,7 @@ async function startCmd(argv, paths) {
|
|
|
41827
41827
|
if (!isLoopback(flags2.host)) {
|
|
41828
41828
|
if (token) {
|
|
41829
41829
|
process.stderr.write(
|
|
41830
|
-
`Note: tool-server will be reachable on ${flags2.host}:${port} over plain HTTP (bearer-token auth, no TLS). Keep it to a trusted network or VPN.
|
|
41830
|
+
`Note: tool-server will be reachable on ${flags2.host}:${port} over plain HTTP (bearer-token auth, no TLS). Clients on other machines need the token for every route, including /preview. Keep it to a trusted network or VPN.
|
|
41831
41831
|
`
|
|
41832
41832
|
);
|
|
41833
41833
|
} else {
|
|
@@ -42446,10 +42446,10 @@ function parseSseBuffer(buffer) {
|
|
|
42446
42446
|
}
|
|
42447
42447
|
return { events, rest };
|
|
42448
42448
|
}
|
|
42449
|
-
async function* lensEvents(baseUrl, signal) {
|
|
42449
|
+
async function* lensEvents(baseUrl, signal, authHeaders4 = {}) {
|
|
42450
42450
|
const res = await fetch(`${baseUrl}/preview/lens-stream`, {
|
|
42451
42451
|
signal,
|
|
42452
|
-
headers: { Accept: "text/event-stream" }
|
|
42452
|
+
headers: { Accept: "text/event-stream", ...authHeaders4 }
|
|
42453
42453
|
});
|
|
42454
42454
|
if (!res.ok || !res.body) {
|
|
42455
42455
|
throw new Error(`lens-stream: HTTP ${res.status}`);
|
|
@@ -42537,6 +42537,7 @@ var LIVENESS_POLL_MS = 1200;
|
|
|
42537
42537
|
var SPAWN_GRACE_MS = 8e3;
|
|
42538
42538
|
var DEATH_CONFIRMATIONS = 3;
|
|
42539
42539
|
var SSE_RECONNECT_MS = 1e3;
|
|
42540
|
+
var authHeaders3 = {};
|
|
42540
42541
|
function sleep2(ms) {
|
|
42541
42542
|
return new Promise((resolve26) => setTimeout(resolve26, ms));
|
|
42542
42543
|
}
|
|
@@ -42769,7 +42770,9 @@ async function lens(argv, options) {
|
|
|
42769
42770
|
const client2 = createToolsClient({ paths: options.paths });
|
|
42770
42771
|
let baseUrl;
|
|
42771
42772
|
try {
|
|
42772
|
-
|
|
42773
|
+
const handle = await client2.baseUrl();
|
|
42774
|
+
baseUrl = handle.url;
|
|
42775
|
+
if (handle.token) authHeaders3 = { Authorization: `Bearer ${handle.token}` };
|
|
42773
42776
|
} catch (err) {
|
|
42774
42777
|
process.stderr.write(`lens: could not reach the tool-server: ${errMsg(err)}
|
|
42775
42778
|
`);
|
|
@@ -42779,13 +42782,13 @@ async function lens(argv, options) {
|
|
|
42779
42782
|
try {
|
|
42780
42783
|
const res = await fetch(`${baseUrl}/preview/cli-session`, {
|
|
42781
42784
|
method: "POST",
|
|
42782
|
-
headers: { "Content-Type": "application/json" },
|
|
42785
|
+
headers: { "Content-Type": "application/json", ...authHeaders3 },
|
|
42783
42786
|
body: JSON.stringify({
|
|
42784
42787
|
active: true,
|
|
42785
42788
|
agents: choices.map((a2) => ({ id: a2.id, name: a2.displayName }))
|
|
42786
42789
|
})
|
|
42787
42790
|
});
|
|
42788
|
-
if (!res.ok) throw new Error(
|
|
42791
|
+
if (!res.ok) throw new Error(await httpErrorMessage(res));
|
|
42789
42792
|
} catch (err) {
|
|
42790
42793
|
process.stderr.write(`lens: failed to start the Lens session: ${errMsg(err)}
|
|
42791
42794
|
`);
|
|
@@ -42897,7 +42900,7 @@ async function awaitAgentChoiceViaStream(baseUrl) {
|
|
|
42897
42900
|
try {
|
|
42898
42901
|
while (!ac.signal.aborted && reconnects <= AGENT_CHOICE_MAX_RECONNECTS) {
|
|
42899
42902
|
try {
|
|
42900
|
-
for await (const ev of lensEvents(baseUrl, ac.signal)) {
|
|
42903
|
+
for await (const ev of lensEvents(baseUrl, ac.signal, authHeaders3)) {
|
|
42901
42904
|
reconnects = 0;
|
|
42902
42905
|
if (ev.event === "session-end") return null;
|
|
42903
42906
|
if (ev.event === "agent-choice") {
|
|
@@ -42960,7 +42963,7 @@ async function runRelaySession(baseUrl, inject, registerDeath, quiet) {
|
|
|
42960
42963
|
}
|
|
42961
42964
|
while (alive && !ac.signal.aborted) {
|
|
42962
42965
|
try {
|
|
42963
|
-
for await (const ev of lensEvents(baseUrl, ac.signal)) {
|
|
42966
|
+
for await (const ev of lensEvents(baseUrl, ac.signal, authHeaders3)) {
|
|
42964
42967
|
if (!alive) break;
|
|
42965
42968
|
if (ev.event === "session-end") return;
|
|
42966
42969
|
if (ev.event !== "outcome") continue;
|
|
@@ -42987,8 +42990,19 @@ async function runRelaySession(baseUrl, inject, registerDeath, quiet) {
|
|
|
42987
42990
|
if (alive && !ac.signal.aborted) await sleep2(SSE_RECONNECT_MS);
|
|
42988
42991
|
}
|
|
42989
42992
|
}
|
|
42993
|
+
async function httpErrorMessage(res) {
|
|
42994
|
+
try {
|
|
42995
|
+
const body = await res.json();
|
|
42996
|
+
if (typeof body.error === "string") return `HTTP ${res.status}: ${body.error}`;
|
|
42997
|
+
} catch {
|
|
42998
|
+
}
|
|
42999
|
+
return `HTTP ${res.status}`;
|
|
43000
|
+
}
|
|
42990
43001
|
async function fetchOutcomeOnce(baseUrl) {
|
|
42991
|
-
const res = await fetch(`${baseUrl}/preview/outcome`, {
|
|
43002
|
+
const res = await fetch(`${baseUrl}/preview/outcome`, {
|
|
43003
|
+
cache: "no-store",
|
|
43004
|
+
headers: authHeaders3
|
|
43005
|
+
});
|
|
42992
43006
|
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
42993
43007
|
const body = await res.json();
|
|
42994
43008
|
return body.outcome && body.outcome.status === "completed" ? body.outcome : null;
|
|
@@ -42997,7 +43011,7 @@ async function endSession(baseUrl) {
|
|
|
42997
43011
|
try {
|
|
42998
43012
|
await fetch(`${baseUrl}/preview/cli-session`, {
|
|
42999
43013
|
method: "POST",
|
|
43000
|
-
headers: { "Content-Type": "application/json" },
|
|
43014
|
+
headers: { "Content-Type": "application/json", ...authHeaders3 },
|
|
43001
43015
|
body: JSON.stringify({ active: false })
|
|
43002
43016
|
});
|
|
43003
43017
|
} catch {
|
package/dist/installer.mjs
CHANGED
|
@@ -17117,7 +17117,7 @@ function isCi(env = process.env) {
|
|
|
17117
17117
|
var SESSION_ID = randomUUID4();
|
|
17118
17118
|
function readCliVersion() {
|
|
17119
17119
|
if (true) {
|
|
17120
|
-
return "0.35.1-next.
|
|
17120
|
+
return "0.35.1-next.26";
|
|
17121
17121
|
}
|
|
17122
17122
|
return "0.0.0";
|
|
17123
17123
|
}
|
package/dist/mcp-server.mjs
CHANGED
|
@@ -38067,7 +38067,7 @@ async function startMcpServer(options) {
|
|
|
38067
38067
|
const autoDescribeOn = autoDescribeEnabled();
|
|
38068
38068
|
const whatsNewOn = whatsNewEnabled();
|
|
38069
38069
|
const installedVersion = getInstalledVersion();
|
|
38070
|
-
const highlightsVersion = true ? "0.35.1-next.
|
|
38070
|
+
const highlightsVersion = true ? "0.35.1-next.26" : installedVersion;
|
|
38071
38071
|
const captureTimeoutMs = options.captureTimeoutMs ?? CAPTURE_TIMEOUT_MS;
|
|
38072
38072
|
const trees = createTreeMemory();
|
|
38073
38073
|
const screenshots = createScreenshotMemory();
|
package/dist/tool-server.cjs
CHANGED
|
@@ -4329,9 +4329,9 @@ function parseURLObject(trimmed, def) {
|
|
|
4329
4329
|
function stripTabAndNewline(value) {
|
|
4330
4330
|
return value.replace(asciiTabOrNewline, "");
|
|
4331
4331
|
}
|
|
4332
|
-
function urlHostnameOk(url2,
|
|
4333
|
-
|
|
4334
|
-
return
|
|
4332
|
+
function urlHostnameOk(url2, hostname6) {
|
|
4333
|
+
hostname6.lastIndex = 0;
|
|
4334
|
+
return hostname6.test(url2.hostname);
|
|
4335
4335
|
}
|
|
4336
4336
|
function urlProtocolOk(url2, protocol) {
|
|
4337
4337
|
protocol.lastIndex = 0;
|
|
@@ -46664,10 +46664,10 @@ var require_request = __commonJS({
|
|
|
46664
46664
|
return addrs;
|
|
46665
46665
|
});
|
|
46666
46666
|
defineGetter(req, "subdomains", function subdomains() {
|
|
46667
|
-
var
|
|
46668
|
-
if (!
|
|
46667
|
+
var hostname6 = this.hostname;
|
|
46668
|
+
if (!hostname6) return [];
|
|
46669
46669
|
var offset = this.app.get("subdomain offset");
|
|
46670
|
-
var subdomains2 = !isIP(
|
|
46670
|
+
var subdomains2 = !isIP(hostname6) ? hostname6.split(".").reverse() : [hostname6];
|
|
46671
46671
|
return subdomains2.slice(offset);
|
|
46672
46672
|
});
|
|
46673
46673
|
defineGetter(req, "path", function path76() {
|
|
@@ -46683,7 +46683,7 @@ var require_request = __commonJS({
|
|
|
46683
46683
|
}
|
|
46684
46684
|
return val || void 0;
|
|
46685
46685
|
});
|
|
46686
|
-
defineGetter(req, "hostname", function
|
|
46686
|
+
defineGetter(req, "hostname", function hostname6() {
|
|
46687
46687
|
var host = this.host;
|
|
46688
46688
|
if (!host) return;
|
|
46689
46689
|
var offset = host[0] === "[" ? host.indexOf("]") + 1 : 0;
|
|
@@ -72978,7 +72978,7 @@ function isCi(env = process.env) {
|
|
|
72978
72978
|
var SESSION_ID = (0, import_node_crypto3.randomUUID)();
|
|
72979
72979
|
function readCliVersion() {
|
|
72980
72980
|
if (true) {
|
|
72981
|
-
return "0.35.1-next.
|
|
72981
|
+
return "0.35.1-next.26";
|
|
72982
72982
|
}
|
|
72983
72983
|
return "0.0.0";
|
|
72984
72984
|
}
|
|
@@ -103801,7 +103801,7 @@ var os8 = __toESM(require("node:os"));
|
|
|
103801
103801
|
function metroOriginCandidates(wsUrl) {
|
|
103802
103802
|
const { protocol, host, port } = new URL(wsUrl);
|
|
103803
103803
|
const scheme = protocol === "wss:" ? "https://" : "http://";
|
|
103804
|
-
const at = (
|
|
103804
|
+
const at = (hostname6) => `${scheme}${bracketed(hostname6)}${port ? `:${port}` : ""}`;
|
|
103805
103805
|
const candidates = [
|
|
103806
103806
|
scheme + host.replace("localhost", "127.0.0.1"),
|
|
103807
103807
|
at("localhost"),
|
|
@@ -103830,8 +103830,8 @@ async function expoManifestOrigin(wsUrl) {
|
|
|
103830
103830
|
function lanAddresses() {
|
|
103831
103831
|
return Object.values(os8.networkInterfaces()).flat().filter((address) => address && !address.internal && address.family === "IPv4").map((address) => address.address);
|
|
103832
103832
|
}
|
|
103833
|
-
function bracketed(
|
|
103834
|
-
return
|
|
103833
|
+
function bracketed(hostname6) {
|
|
103834
|
+
return hostname6.includes(":") && !hostname6.startsWith("[") ? `[${hostname6}]` : hostname6;
|
|
103835
103835
|
}
|
|
103836
103836
|
|
|
103837
103837
|
// ../tool-server/src/utils/debugger/scripts/await-promise.ts
|
|
@@ -113734,8 +113734,17 @@ function attachChromiumServerWebsocket(httpServer, basePath, resolveServer, auth
|
|
|
113734
113734
|
httpServer.on("upgrade", (req, socket, head) => {
|
|
113735
113735
|
const url2 = req.url ?? "";
|
|
113736
113736
|
if (!url2.startsWith(basePath) || !url2.endsWith("/ws")) return;
|
|
113737
|
-
|
|
113738
|
-
|
|
113737
|
+
const denial = authorizeUpgrade(req);
|
|
113738
|
+
if (denial) {
|
|
113739
|
+
const body = JSON.stringify({ error: denial.error });
|
|
113740
|
+
socket.end(
|
|
113741
|
+
`HTTP/1.1 ${denial.status} ${denial.status === 401 ? "Unauthorized" : "Forbidden"}\r
|
|
113742
|
+
Content-Type: application/json\r
|
|
113743
|
+
Content-Length: ${Buffer.byteLength(body)}\r
|
|
113744
|
+
Connection: close\r
|
|
113745
|
+
\r
|
|
113746
|
+
` + body
|
|
113747
|
+
);
|
|
113739
113748
|
return;
|
|
113740
113749
|
}
|
|
113741
113750
|
const server = resolveServer(req);
|
|
@@ -124362,8 +124371,8 @@ function isAllowedSourceMapURL(raw) {
|
|
|
124362
124371
|
}
|
|
124363
124372
|
if (parsed2.protocol !== "http:" && parsed2.protocol !== "https:") return false;
|
|
124364
124373
|
if (!parsed2.pathname.endsWith(".map")) return false;
|
|
124365
|
-
const
|
|
124366
|
-
return ALLOWED_SOURCE_MAP_HOSTS.has(
|
|
124374
|
+
const hostname6 = parsed2.hostname.startsWith("[") && parsed2.hostname.endsWith("]") ? parsed2.hostname.slice(1, -1) : parsed2.hostname;
|
|
124375
|
+
return ALLOWED_SOURCE_MAP_HOSTS.has(hostname6);
|
|
124367
124376
|
}
|
|
124368
124377
|
var MAX_SOURCE_MAP_BYTES = 64 * 1024 * 1024;
|
|
124369
124378
|
async function drainCappedBody(res, maxBytes = MAX_SOURCE_MAP_BYTES) {
|
|
@@ -125331,16 +125340,62 @@ function hostnameFromOrigin(origin) {
|
|
|
125331
125340
|
if (schemeEnd === -1) return null;
|
|
125332
125341
|
return extractHostname(origin.slice(schemeEnd + 3));
|
|
125333
125342
|
}
|
|
125334
|
-
function
|
|
125335
|
-
|
|
125336
|
-
|
|
125337
|
-
|
|
125338
|
-
const origin = headers
|
|
125339
|
-
if (origin
|
|
125340
|
-
|
|
125341
|
-
|
|
125343
|
+
function isHostAllowed(host, allowed) {
|
|
125344
|
+
return host !== void 0 && allowed.has(extractHostname(host).toLowerCase());
|
|
125345
|
+
}
|
|
125346
|
+
function isOriginAllowed(headers, policy) {
|
|
125347
|
+
const { origin, host } = headers;
|
|
125348
|
+
if (origin === void 0) return true;
|
|
125349
|
+
const originHost = hostnameFromOrigin(origin);
|
|
125350
|
+
if (originHost === null || !policy.allowedHostnames.has(originHost.toLowerCase())) return false;
|
|
125351
|
+
if (host === void 0) return false;
|
|
125352
|
+
try {
|
|
125353
|
+
const o = new URL(origin);
|
|
125354
|
+
if (o.protocol !== "http:" && o.protocol !== "https:") return false;
|
|
125355
|
+
return o.host === new URL(`${o.protocol}//${host}`).host;
|
|
125356
|
+
} catch {
|
|
125357
|
+
return false;
|
|
125342
125358
|
}
|
|
125343
|
-
|
|
125359
|
+
}
|
|
125360
|
+
var FORWARDING_HEADERS = ["forwarded", "x-forwarded-for", "x-real-ip"];
|
|
125361
|
+
function checkTokenExemptAccess(req, policy) {
|
|
125362
|
+
const { headers } = req;
|
|
125363
|
+
if (!isOriginAllowed(headers, policy)) {
|
|
125364
|
+
return {
|
|
125365
|
+
status: 403,
|
|
125366
|
+
error: `Refusing cross-origin request from Origin "${headers.origin}". /preview and the Chromium WebSocket accept only pages served by this tool-server.`
|
|
125367
|
+
};
|
|
125368
|
+
}
|
|
125369
|
+
const provided = extractBearerToken(headers.authorization);
|
|
125370
|
+
if (policy.expectedToken && provided && constantTimeEqual(provided, policy.expectedToken)) {
|
|
125371
|
+
return null;
|
|
125372
|
+
}
|
|
125373
|
+
const forwarded = FORWARDING_HEADERS.some((h) => headers[h] !== void 0);
|
|
125374
|
+
if (!policy.expectedToken || isLocalConnection(req.socket) && !forwarded) {
|
|
125375
|
+
if (isHostAllowed(headers.host, policy.allowedHostnames)) return null;
|
|
125376
|
+
return {
|
|
125377
|
+
status: 403,
|
|
125378
|
+
error: `Refusing request with Host "${headers.host ?? ""}" without a token. Open the preview at http://127.0.0.1:<port>/preview/, or send \`Authorization: Bearer <token>\`.`
|
|
125379
|
+
};
|
|
125380
|
+
}
|
|
125381
|
+
const from2 = forwarded ? "through a proxy" : `from ${req.socket.remoteAddress ?? "the network"}`;
|
|
125382
|
+
return {
|
|
125383
|
+
status: 401,
|
|
125384
|
+
error: `This request came ${from2}. Without a token, the tool-server serves /preview and its WebSocket only to clients on its own machine. Send \`Authorization: Bearer <token>\` (the token is in ~/.argent/tool-server.json on the server's machine and is printed by \`argent server start\`), or reach the server through an SSH tunnel to 127.0.0.1.`
|
|
125385
|
+
};
|
|
125386
|
+
}
|
|
125387
|
+
function interfaceAddresses() {
|
|
125388
|
+
const out = [];
|
|
125389
|
+
for (const list of Object.values((0, import_node_os9.networkInterfaces)())) {
|
|
125390
|
+
for (const a of list ?? []) out.push(a.address.split("%")[0]);
|
|
125391
|
+
}
|
|
125392
|
+
return out;
|
|
125393
|
+
}
|
|
125394
|
+
function machineHostnames() {
|
|
125395
|
+
const name = (0, import_node_os9.hostname)().toLowerCase();
|
|
125396
|
+
if (!name) return [];
|
|
125397
|
+
const bare = name.endsWith(".local") ? name.slice(0, -".local".length) : name;
|
|
125398
|
+
return [bare, `${bare}.local`];
|
|
125344
125399
|
}
|
|
125345
125400
|
var UPLOAD_TTL_MS = 15 * 60 * 1e3;
|
|
125346
125401
|
var MAX_UPLOAD_STREAM_BYTES = 2 * 1024 * 1024 * 1024;
|
|
@@ -125380,6 +125435,7 @@ function createHttpApp(registry2, options) {
|
|
|
125380
125435
|
if (!isLoopbackHost(bindHost) && !isWildcardHost(bindHost)) {
|
|
125381
125436
|
allowedHostnames.add(bindHost);
|
|
125382
125437
|
}
|
|
125438
|
+
const tokenExemptHostnames = () => hostGuardDisabled ? /* @__PURE__ */ new Set([...allowedHostnames, ...interfaceAddresses(), ...machineHostnames()]) : allowedHostnames;
|
|
125383
125439
|
const homeId = argentHomeId();
|
|
125384
125440
|
app.use((req, res, next) => {
|
|
125385
125441
|
if (isLocalConnection(req.socket)) res.setHeader(ARGENT_HOME_HEADER, homeId);
|
|
@@ -125395,8 +125451,8 @@ function createHttpApp(registry2, options) {
|
|
|
125395
125451
|
res.status(400).json({ error: "Missing Host header" });
|
|
125396
125452
|
return;
|
|
125397
125453
|
}
|
|
125398
|
-
const
|
|
125399
|
-
if (!allowedHostnames.has(
|
|
125454
|
+
const hostname6 = extractHostname(host);
|
|
125455
|
+
if (!allowedHostnames.has(hostname6)) {
|
|
125400
125456
|
res.status(403).json({
|
|
125401
125457
|
error: `Refusing request with Host "${host}". The tool-server accepts loopback hostnames (127.0.0.1, localhost, ::1)` + (isLoopbackHost(bindHost) ? "" : ` and its bind host (${bindHost})`) + ` to defend against DNS-rebinding. If you are reaching this from your own client, use one of those instead of a public hostname.`
|
|
125402
125458
|
});
|
|
@@ -125412,11 +125468,11 @@ function createHttpApp(registry2, options) {
|
|
|
125412
125468
|
);
|
|
125413
125469
|
}
|
|
125414
125470
|
app.use((req, res, next) => {
|
|
125415
|
-
if (
|
|
125471
|
+
if (req.path === "/preview" || req.path.startsWith("/preview/")) {
|
|
125416
125472
|
next();
|
|
125417
125473
|
return;
|
|
125418
125474
|
}
|
|
125419
|
-
if (
|
|
125475
|
+
if (!expectedToken) {
|
|
125420
125476
|
next();
|
|
125421
125477
|
return;
|
|
125422
125478
|
}
|
|
@@ -125429,7 +125485,21 @@ function createHttpApp(registry2, options) {
|
|
|
125429
125485
|
}
|
|
125430
125486
|
next();
|
|
125431
125487
|
});
|
|
125432
|
-
app.use(
|
|
125488
|
+
app.use(
|
|
125489
|
+
"/preview",
|
|
125490
|
+
(req, res, next) => {
|
|
125491
|
+
const denial = checkTokenExemptAccess(req, {
|
|
125492
|
+
allowedHostnames: tokenExemptHostnames(),
|
|
125493
|
+
expectedToken
|
|
125494
|
+
});
|
|
125495
|
+
if (denial) {
|
|
125496
|
+
res.status(denial.status).json({ error: denial.error });
|
|
125497
|
+
return;
|
|
125498
|
+
}
|
|
125499
|
+
next();
|
|
125500
|
+
},
|
|
125501
|
+
createPreviewRouter(registry2)
|
|
125502
|
+
);
|
|
125433
125503
|
if (isFlagEnabled(ARTIFACTS_LIST_ENDPOINT_FLAG)) {
|
|
125434
125504
|
app.get("/artifacts", makeArtifactListRoute(registry2));
|
|
125435
125505
|
}
|
|
@@ -125946,7 +126016,7 @@ function createHttpApp(registry2, options) {
|
|
|
125946
126016
|
if (!api) return null;
|
|
125947
126017
|
return api.server;
|
|
125948
126018
|
},
|
|
125949
|
-
(req) =>
|
|
126019
|
+
(req) => checkTokenExemptAccess(req, { allowedHostnames: tokenExemptHostnames(), expectedToken })
|
|
125950
126020
|
);
|
|
125951
126021
|
}
|
|
125952
126022
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swmansion/argent",
|
|
3
|
-
"version": "0.35.1-next.
|
|
3
|
+
"version": "0.35.1-next.26",
|
|
4
4
|
"mcpName": "io.github.software-mansion/argent",
|
|
5
5
|
"description": "MCP server for iOS Simulator, Android Emulator, Chromium app and Mac app control",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -98,5 +98,5 @@
|
|
|
98
98
|
"vitest": "^5.0.5",
|
|
99
99
|
"yaml": "^2.9.1"
|
|
100
100
|
},
|
|
101
|
-
"gitHead": "
|
|
101
|
+
"gitHead": "93cffd2dde24dd3f36a66339cbdbc6d576fe4b40"
|
|
102
102
|
}
|