@introspection-ai/recipes 0.24.0 → 0.25.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/README.md +3 -3
- package/dist/channels/tools.js +1 -1
- package/dist/channels/tools.js.map +1 -1
- package/dist/mcp-chunks/{auth-command-4OEOMU2V.js → auth-command-4WFRNU2I.js} +24 -24
- package/dist/mcp-chunks/call-arguments-4DWPBLQP.js +15 -0
- package/dist/mcp-chunks/{call-command-AUEKSBMD.js → call-command-JBIKXOGC.js} +36 -36
- package/dist/mcp-chunks/{chunk-L4CUJJI5.js → chunk-36VIJRYY.js} +4 -4
- package/dist/mcp-chunks/{chunk-PPIXUCYQ.js → chunk-3JGS7LQB.js} +2 -2
- package/dist/mcp-chunks/{chunk-4NDR45CX.js → chunk-3R2WK3NB.js} +28 -9
- package/dist/mcp-chunks/{chunk-YX2NKW6O.js → chunk-3Z7MFS6K.js} +23 -6
- package/dist/mcp-chunks/{chunk-ACTRQW5L.js → chunk-4ZNBWL65.js} +2 -2
- package/dist/mcp-chunks/chunk-53NRFMB3.js +990 -0
- package/dist/mcp-chunks/{chunk-6QH47GNE.js → chunk-6YZW3XAE.js} +68 -6
- package/dist/mcp-chunks/{chunk-X3FOKZ5C.js → chunk-7WOKCV6Q.js} +1 -1
- package/dist/mcp-chunks/{chunk-MOML5C2E.js → chunk-AD3FQ73K.js} +1 -1
- package/dist/mcp-chunks/{chunk-HDUKEFBI.js → chunk-AIKLVBYU.js} +2 -2
- package/dist/mcp-chunks/{chunk-SQTXZR56.js → chunk-ASG4OY3M.js} +21 -604
- package/dist/mcp-chunks/{chunk-V4RYLZM5.js → chunk-B2LNXGAP.js} +1 -1
- package/dist/mcp-chunks/{chunk-XVJAASVZ.js → chunk-BWW4XRUC.js} +16 -16
- package/dist/mcp-chunks/{chunk-MRXSXBZT.js → chunk-C2KNLFZR.js} +2 -2
- package/dist/mcp-chunks/{chunk-KPXFBRTG.js → chunk-CZKDJZER.js} +1 -1
- package/dist/mcp-chunks/{chunk-6CYJ6RN3.js → chunk-DTZHEVKC.js} +1 -1
- package/dist/mcp-chunks/{chunk-PLSS6TQZ.js → chunk-ED2WN5BI.js} +3 -3
- package/dist/mcp-chunks/{chunk-OGFFBNIC.js → chunk-ELA77TDC.js} +4 -4
- package/dist/mcp-chunks/{chunk-5WGJPYOR.js → chunk-EMSNQHZZ.js} +1 -1
- package/dist/mcp-chunks/{chunk-AB7MHBEG.js → chunk-EPT4MYOF.js} +11 -11
- package/dist/mcp-chunks/{chunk-HHMWZ2FZ.js → chunk-FAJPJTOC.js} +1 -1
- package/dist/mcp-chunks/{chunk-TGJOZDKG.js → chunk-FS5JIKT6.js} +2 -2
- package/dist/mcp-chunks/{chunk-IPH6U7SE.js → chunk-FX5NYWBH.js} +3 -3
- package/dist/mcp-chunks/{chunk-SCGMRUKI.js → chunk-G6OMDUNG.js} +5 -5
- package/dist/mcp-chunks/{chunk-47N2EELW.js → chunk-GQ6NSIDS.js} +30 -30
- package/dist/mcp-chunks/{chunk-PPOHGQKM.js → chunk-GUXMP7QB.js} +2 -2
- package/dist/mcp-chunks/{chunk-NMFI6AUD.js → chunk-H3JCYHGS.js} +25 -25
- package/dist/mcp-chunks/{chunk-3VLPWGJL.js → chunk-HCOKLSOB.js} +4 -4
- package/dist/mcp-chunks/{chunk-J6VOMOKI.js → chunk-HLRCUHNO.js} +1 -1
- package/dist/mcp-chunks/{chunk-LWVFSQYX.js → chunk-HN7WPMCA.js} +7806 -3454
- package/dist/mcp-chunks/chunk-I5GI2A2D.js +92 -0
- package/dist/mcp-chunks/{chunk-7KEDX7SE.js → chunk-IME7DGLJ.js} +2 -2
- package/dist/mcp-chunks/{chunk-E4YYMOT2.js → chunk-IPNSPKQK.js} +33 -21
- package/dist/mcp-chunks/{chunk-ZKFG37TB.js → chunk-IRTJXFWA.js} +2 -2
- package/dist/mcp-chunks/{chunk-KMH3PHLA.js → chunk-ITCCROID.js} +13 -7
- package/dist/mcp-chunks/{chunk-ADINDBOF.js → chunk-ITR7FQM3.js} +2 -2
- package/dist/mcp-chunks/{chunk-JILBFEBD.js → chunk-IYWYVHHD.js} +1 -1
- package/dist/mcp-chunks/{chunk-RO2Y34XX.js → chunk-JG4TRUPF.js} +1 -1
- package/dist/mcp-chunks/{chunk-DEYKPG4K.js → chunk-KW3ANJ36.js} +4 -4
- package/dist/mcp-chunks/{chunk-NWLOPQT7.js → chunk-MOEZ43ZL.js} +1 -1
- package/dist/mcp-chunks/{chunk-AFKE4BTR.js → chunk-NTHUNCXJ.js} +21 -21
- package/dist/mcp-chunks/{chunk-J3J3NQ4X.js → chunk-OD3MSMXY.js} +1 -1
- package/dist/mcp-chunks/{chunk-PRZCYXVO.js → chunk-OP3IW2V6.js} +2 -2
- package/dist/mcp-chunks/{chunk-K56RW4HB.js → chunk-PZ323CXI.js} +1 -1
- package/dist/mcp-chunks/{chunk-US57PK4B.js → chunk-QZUC2T72.js} +59 -4
- package/dist/mcp-chunks/{chunk-Z7O6NF7X.js → chunk-RD7NHCRK.js} +19 -19
- package/dist/mcp-chunks/{chunk-756YH7S4.js → chunk-RSTKSBVF.js} +2 -2
- package/dist/mcp-chunks/{chunk-6DL2C6V5.js → chunk-SCOMDV54.js} +1 -1
- package/dist/mcp-chunks/{chunk-SAK5KCLR.js → chunk-SNKXMWDB.js} +1 -1
- package/dist/mcp-chunks/{chunk-LC2CCTQN.js → chunk-TF2YTYE4.js} +1 -1
- package/dist/mcp-chunks/chunk-TPHPAEDH.js +3769 -0
- package/dist/mcp-chunks/{chunk-AF74TOWM.js → chunk-V5AYEKSL.js} +5 -5
- package/dist/mcp-chunks/{chunk-HBDCHBJP.js → chunk-WTMJMM3B.js} +12 -1
- package/dist/mcp-chunks/{chunk-ZZSD2JT7.js → chunk-WYLHHXI6.js} +1 -1
- package/dist/mcp-chunks/{chunk-MFFE5QSH.js → chunk-Y3EDWN2P.js} +1 -1
- package/dist/mcp-chunks/{chunk-ZRZ7C6L3.js → chunk-YIRGLKDA.js} +8 -8
- package/dist/mcp-chunks/{chunk-RE4EVQNC.js → chunk-ZOAQDFAO.js} +62 -7
- package/dist/mcp-chunks/{cli-B7WQQUME.js → cli-XU26MUCN.js} +67 -67
- package/dist/mcp-chunks/client-OT34CKRH.js +21 -0
- package/dist/mcp-chunks/{config-command-FF3JPMOP.js → config-command-UQMMIK2U.js} +37 -30
- package/dist/mcp-chunks/daemon-command-YCIOZGPZ.js +35 -0
- package/dist/mcp-chunks/{dist-V4UB7RTR.js → dist-DM2RXZMU.js} +47 -44
- package/dist/mcp-chunks/{emit-ts-command-4X56IZ32.js → emit-ts-command-KAOL6DAN.js} +16 -16
- package/dist/mcp-chunks/{generate-cli-runner-MIPF73SJ.js → generate-cli-runner-AK6XNRTK.js} +70 -50
- package/dist/mcp-chunks/{inspect-cli-command-GX54ZXKR.js → inspect-cli-command-6FVJO7H2.js} +10 -10
- package/dist/mcp-chunks/{launch-E2LWGPZS.js → launch-EIT73HX4.js} +1 -1
- package/dist/mcp-chunks/{lifecycle-TONHXXXJ.js → lifecycle-QH4TUI3K.js} +1 -1
- package/dist/mcp-chunks/{list-command-YUGRZO4G.js → list-command-UOB2XZK7.js} +30 -30
- package/dist/mcp-chunks/{output-utils-AZY6N2VQ.js → output-utils-6YXH23T7.js} +3 -3
- package/dist/mcp-chunks/{prompt-CH6TK0bC-NSBYYJZH.js → prompt-CH6TK0bC-ZB6RFAXR.js} +1 -1
- package/dist/mcp-chunks/{record-command-25DLELA2.js → record-command-FO5TTERC.js} +5 -5
- package/dist/mcp-chunks/{replay-command-6SLDG6PC.js → replay-command-SCBPCGQ7.js} +6 -6
- package/dist/mcp-chunks/{resource-command-YVOB4JCU.js → resource-command-S2J7XEMV.js} +10 -10
- package/dist/mcp-chunks/{result-utils-ZXB5DM36.js → result-utils-OME6HGS6.js} +4 -4
- package/dist/mcp-chunks/runtime-QIPMLIJI.js +39 -0
- package/dist/mcp-chunks/runtime-wrapper-X4YFKMJI.js +16 -0
- package/dist/mcp-chunks/{serve-command-QYGM2AMB.js → serve-command-DDBZZSG6.js} +28 -28
- package/dist/mcp-chunks/{timeouts-P3TBB3AX.js → timeouts-HNGNKDQN.js} +3 -3
- package/dist/mcp-chunks/{vault-command-VDMPATIX.js → vault-command-TJZYS3YI.js} +8 -7
- package/dist/mcp-chunks/{webapi-BLTNWSB2.js → webapi-4GWO2UBA.js} +887 -703
- package/dist/mcp-daemon.js +31 -31
- package/dist/mcp-run-worker.js +31 -31
- package/docs/channels.md +6 -5
- package/docs/recipe-format.md +6 -3
- package/docs/slack.md +14 -11
- package/package.json +11 -11
- package/dist/mcp-chunks/call-arguments-RPXZJOXL.js +0 -15
- package/dist/mcp-chunks/chunk-7CS27CWE.js +0 -431
- package/dist/mcp-chunks/chunk-LJCZWKGJ.js +0 -372
- package/dist/mcp-chunks/chunk-Q7ESBNJG.js +0 -57
- package/dist/mcp-chunks/client-4ZHIBB67.js +0 -21
- package/dist/mcp-chunks/daemon-command-FKW6YELL.js +0 -35
- package/dist/mcp-chunks/runtime-NOWGTHZ5.js +0 -39
- package/dist/mcp-chunks/runtime-wrapper-ZZPAFQE4.js +0 -14
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
resolveEnvPlaceholders
|
|
4
|
+
} from "./chunk-WTMJMM3B.js";
|
|
5
|
+
|
|
6
|
+
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/runtime/utils.js
|
|
7
|
+
var ENV_PLACEHOLDER_PATTERN = /\$\{(?:env:[^}]*|[A-Za-z_][A-Za-z0-9_]*(?::-[^}]*)?)\}/;
|
|
8
|
+
var MAX_TIMER_DELAY_MS = 2147483647;
|
|
9
|
+
function resolveCommandArgument(value, env = process.env) {
|
|
10
|
+
if (!value) {
|
|
11
|
+
return value;
|
|
12
|
+
}
|
|
13
|
+
if (!value.includes("$")) {
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
const needsInterpolation = value.startsWith("$env:") || ENV_PLACEHOLDER_PATTERN.test(value);
|
|
17
|
+
if (!needsInterpolation) {
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
return resolveEnvPlaceholders(value, env);
|
|
21
|
+
}
|
|
22
|
+
function resolveCommandArguments(args, env = process.env) {
|
|
23
|
+
if (args.length === 0) {
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
return args.map((arg) => resolveCommandArgument(arg, env));
|
|
27
|
+
}
|
|
28
|
+
function normalizeTimeout(raw) {
|
|
29
|
+
if (raw == null) {
|
|
30
|
+
return void 0;
|
|
31
|
+
}
|
|
32
|
+
if (!Number.isFinite(raw)) {
|
|
33
|
+
return void 0;
|
|
34
|
+
}
|
|
35
|
+
const coerced = Math.trunc(raw);
|
|
36
|
+
return coerced > 0 ? Math.min(coerced, MAX_TIMER_DELAY_MS) : void 0;
|
|
37
|
+
}
|
|
38
|
+
function raceWithTimeout(promise, timeoutMs) {
|
|
39
|
+
return new Promise((resolve, reject) => {
|
|
40
|
+
const delayMs = Number.isFinite(timeoutMs) ? Math.min(Math.max(Math.trunc(timeoutMs), 1), MAX_TIMER_DELAY_MS) : MAX_TIMER_DELAY_MS;
|
|
41
|
+
const cancelTimeout = scheduleDeadline(() => {
|
|
42
|
+
reject(new Error("Timeout"));
|
|
43
|
+
}, delayMs);
|
|
44
|
+
promise.then((value) => {
|
|
45
|
+
cancelTimeout();
|
|
46
|
+
resolve(value);
|
|
47
|
+
}, (error) => {
|
|
48
|
+
cancelTimeout();
|
|
49
|
+
reject(error);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function scheduleDeadline(callback, delayMs) {
|
|
54
|
+
const deadline = performance.now() + delayMs;
|
|
55
|
+
let timer;
|
|
56
|
+
let cancelled = false;
|
|
57
|
+
const scheduleNext = () => {
|
|
58
|
+
if (cancelled)
|
|
59
|
+
return;
|
|
60
|
+
const remainingMs = deadline - performance.now();
|
|
61
|
+
if (remainingMs <= 0) {
|
|
62
|
+
callback();
|
|
63
|
+
} else if (remainingMs > 864e5) {
|
|
64
|
+
timer = setTimeout(scheduleNext, 864e5);
|
|
65
|
+
} else if (remainingMs > 36e5) {
|
|
66
|
+
timer = setTimeout(scheduleNext, 36e5);
|
|
67
|
+
} else if (remainingMs > 6e4) {
|
|
68
|
+
timer = setTimeout(scheduleNext, 6e4);
|
|
69
|
+
} else if (remainingMs > 1e3) {
|
|
70
|
+
timer = setTimeout(scheduleNext, 1e3);
|
|
71
|
+
} else if (remainingMs > 100) {
|
|
72
|
+
timer = setTimeout(scheduleNext, 100);
|
|
73
|
+
} else if (remainingMs > 10) {
|
|
74
|
+
timer = setTimeout(scheduleNext, 10);
|
|
75
|
+
} else {
|
|
76
|
+
timer = setTimeout(scheduleNext, 1);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
scheduleNext();
|
|
80
|
+
return () => {
|
|
81
|
+
cancelled = true;
|
|
82
|
+
if (timer)
|
|
83
|
+
clearTimeout(timer);
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export {
|
|
88
|
+
resolveCommandArgument,
|
|
89
|
+
resolveCommandArguments,
|
|
90
|
+
normalizeTimeout,
|
|
91
|
+
raceWithTimeout
|
|
92
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
normalizeHttpUrl
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-G6OMDUNG.js";
|
|
5
5
|
|
|
6
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
6
|
+
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/cli/server-lookup.js
|
|
7
7
|
function findServerByHttpUrl(definitions, urlString) {
|
|
8
8
|
const normalizedTarget = normalizeHttpUrl(urlString);
|
|
9
9
|
if (!normalizedTarget) {
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
buildToolDoc
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-6YZW3XAE.js";
|
|
5
5
|
import {
|
|
6
|
-
buildEmbeddedSchemaMap
|
|
7
|
-
|
|
6
|
+
buildEmbeddedSchemaMap,
|
|
7
|
+
toCliOptionKey
|
|
8
|
+
} from "./chunk-TPHPAEDH.js";
|
|
8
9
|
import {
|
|
9
10
|
parsePositiveInteger
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-AIKLVBYU.js";
|
|
11
12
|
import {
|
|
12
13
|
stableJsonStringify
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-B2LNXGAP.js";
|
|
14
15
|
import {
|
|
15
16
|
MCPORTER_VERSION
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-OD3MSMXY.js";
|
|
17
18
|
|
|
18
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
19
|
+
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/cli/generate/flag-parser.js
|
|
19
20
|
function extractGeneratorFlags(args, options = {}) {
|
|
20
21
|
const result = {};
|
|
21
22
|
let index = 0;
|
|
@@ -57,12 +58,12 @@ function extractGeneratorFlags(args, options = {}) {
|
|
|
57
58
|
return result;
|
|
58
59
|
}
|
|
59
60
|
|
|
60
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
61
|
+
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/cli/generate/template.js
|
|
61
62
|
import { realpathSync } from "node:fs";
|
|
62
63
|
import fs2 from "node:fs/promises";
|
|
63
64
|
import path from "node:path";
|
|
64
65
|
|
|
65
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
66
|
+
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/cli/generate/fs-helpers.js
|
|
66
67
|
import fs from "node:fs/promises";
|
|
67
68
|
async function markExecutable(filePath) {
|
|
68
69
|
try {
|
|
@@ -93,7 +94,7 @@ function shouldIgnorePosixPermissionError(error) {
|
|
|
93
94
|
return code === "EPERM" || code === "EINVAL" || code === "ENOSYS" || code === "EACCES";
|
|
94
95
|
}
|
|
95
96
|
|
|
96
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
97
|
+
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/cli/generate/template-help.js
|
|
97
98
|
function renderEmbeddedHelpSource() {
|
|
98
99
|
return `function configureGeneratedCommandHelp(command: Command): void {
|
|
99
100
|
command.configureHelp({
|
|
@@ -207,7 +208,7 @@ function quickStartExamples(): Array<[string, string]> {
|
|
|
207
208
|
`;
|
|
208
209
|
}
|
|
209
210
|
|
|
210
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
211
|
+
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/cli/generate/template.js
|
|
211
212
|
async function writeTemplate(input) {
|
|
212
213
|
const resolvedOutput = input.outputPath ? path.resolve(input.outputPath) : path.resolve(process.cwd(), `${input.serverName}.ts`);
|
|
213
214
|
const runtimeScriptPath = input.runtimeScriptPath ? path.resolve(input.runtimeScriptPath) : resolvedOutput;
|
|
@@ -236,7 +237,7 @@ function renderTemplate({ runtimeKind, timeoutMs, definition, serverName, tools,
|
|
|
236
237
|
const imports = [
|
|
237
238
|
"import path from 'node:path';",
|
|
238
239
|
"import { fileURLToPath } from 'node:url';",
|
|
239
|
-
"import { Command } from 'commander';",
|
|
240
|
+
"import { Command, Option } from 'commander';",
|
|
240
241
|
"import { createGeneratedKeepAliveRuntime, createRuntime, createServerProxy, handleDaemonCli } from 'mcporter';",
|
|
241
242
|
"import { createCallResult } from 'mcporter';"
|
|
242
243
|
].join("\n");
|
|
@@ -377,6 +378,18 @@ function unwrapRawPayload(value: unknown): unknown {
|
|
|
377
378
|
return value;
|
|
378
379
|
}
|
|
379
380
|
|
|
381
|
+
function defineOption(flags: string, description: string, parser?: (value: string) => unknown) {
|
|
382
|
+
const option = new Option(flags, description);
|
|
383
|
+
if (parser) {
|
|
384
|
+
option.argParser(parser);
|
|
385
|
+
}
|
|
386
|
+
// Flag names come from schema property names, so a leading no- is part of the name.
|
|
387
|
+
// Commander would otherwise read it as a negation, store the value under the stripped
|
|
388
|
+
// name and default it to true whenever the flag is absent.
|
|
389
|
+
option.negate = false;
|
|
390
|
+
return option;
|
|
391
|
+
}
|
|
392
|
+
|
|
380
393
|
function parseArrayOption(value: string, itemType: 'string' | 'number' | 'boolean' | 'json') {
|
|
381
394
|
const trimmed = value.trim();
|
|
382
395
|
if (trimmed.startsWith('[')) {
|
|
@@ -579,6 +592,9 @@ if (process.env.MCPORTER_DISABLE_AUTORUN !== '1') {
|
|
|
579
592
|
}
|
|
580
593
|
`;
|
|
581
594
|
}
|
|
595
|
+
function propertyAccess(target, key) {
|
|
596
|
+
return /^[A-Za-z_$][\w$]*$/.test(key) ? `${target}.${key}` : `${target}[${JSON.stringify(key)}]`;
|
|
597
|
+
}
|
|
582
598
|
function renderToolCommand(tool, defaultTimeout, serverName, existingDoc) {
|
|
583
599
|
const commandName = tool.tool.name.replace(/[^a-zA-Z0-9-]/g, "-");
|
|
584
600
|
const description = tool.tool.description ?? `Invoke the ${tool.tool.name} tool.`;
|
|
@@ -593,15 +609,11 @@ function renderToolCommand(tool, defaultTimeout, serverName, existingDoc) {
|
|
|
593
609
|
flagExtras: [{ text: "--raw <json>" }]
|
|
594
610
|
});
|
|
595
611
|
const buildArgs = tool.options.map((option) => {
|
|
596
|
-
const
|
|
597
|
-
|
|
598
|
-
return `if (${source} !== undefined) args.${option.property} = ${source};`;
|
|
612
|
+
const source = propertyAccess("cmdOpts", toCliOptionKey(option.cliName));
|
|
613
|
+
return `if (${source} !== undefined) ${propertyAccess("args", option.property)} = ${source};`;
|
|
599
614
|
}).join("\n ");
|
|
600
|
-
const requiredChecks = tool.options.filter((option) => option.required).map((option) => {
|
|
601
|
-
|
|
602
|
-
return { option, camelCaseProp };
|
|
603
|
-
});
|
|
604
|
-
const requiredValidation = requiredChecks.length > 0 ? `const missingRequired = [${requiredChecks.map(({ option, camelCaseProp }) => `{ value: cmdOpts.${camelCaseProp}, flag: ${JSON.stringify(`--${option.cliName}`)} }`).join(", ")}].filter((entry) => entry.value === undefined || (typeof entry.value === 'string' && entry.value.trim() === '')).map((entry) => entry.flag);
|
|
615
|
+
const requiredChecks = tool.options.filter((option) => option.required).map((option) => ({ option, camelCaseProp: toCliOptionKey(option.cliName) }));
|
|
616
|
+
const requiredValidation = requiredChecks.length > 0 ? `const missingRequired = [${requiredChecks.map(({ option, camelCaseProp }) => `{ value: ${propertyAccess("cmdOpts", camelCaseProp)}, flag: ${JSON.stringify(`--${option.cliName}`)} }`).join(", ")}].filter((entry) => entry.value === undefined || (typeof entry.value === 'string' && entry.value.trim() === '')).map((entry) => entry.flag);
|
|
605
617
|
if (missingRequired.length > 0) {
|
|
606
618
|
throw new Error('Missing required option' + (missingRequired.length === 1 ? '' : 's') + ': ' + missingRequired.join(', '));
|
|
607
619
|
}` : "";
|
|
@@ -651,7 +663,7 @@ ${aliasSnippet ? ` ${aliasSnippet}` : ""} .action(async (cmdOpts) => {
|
|
|
651
663
|
}
|
|
652
664
|
function renderOption(optionDoc) {
|
|
653
665
|
const parser = optionParser(optionDoc.option);
|
|
654
|
-
return ` .
|
|
666
|
+
return ` .addOption(defineOption(${JSON.stringify(optionDoc.flagLabel)}, ${JSON.stringify(optionDoc.description)}${parser ? `, ${parser}` : ""}))`;
|
|
655
667
|
}
|
|
656
668
|
function computeRelativeStdioCwd(definition, outputPath) {
|
|
657
669
|
if (!outputPath || definition.command.kind !== "stdio") {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
analyzeConnectionError
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QZUC2T72.js";
|
|
5
5
|
|
|
6
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
6
|
+
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/runtime-oauth-support.js
|
|
7
7
|
function maybeEnableOAuth(definition, logger) {
|
|
8
8
|
if (definition.auth === "oauth" || definition.auth === "refreshable_bearer") {
|
|
9
9
|
return void 0;
|
|
@@ -1,25 +1,31 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
findServerByHttpUrl
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-IME7DGLJ.js";
|
|
5
5
|
import {
|
|
6
6
|
persistEphemeralServer,
|
|
7
7
|
resolveEphemeralServer,
|
|
8
8
|
splitCommandLine
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-3R2WK3NB.js";
|
|
10
10
|
import {
|
|
11
11
|
looksLikeHttpUrl,
|
|
12
12
|
normalizeHttpUrlCandidate
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-G6OMDUNG.js";
|
|
14
14
|
|
|
15
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
15
|
+
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/cli/adhoc-help.js
|
|
16
16
|
var ADHOC_SERVER_HELP_ENTRIES = [
|
|
17
17
|
{ flag: "--http-url <url>", description: "Register an HTTP server for this run." },
|
|
18
18
|
{ flag: "--allow-http", description: "Permit plain http:// URLs with --http-url." },
|
|
19
|
-
{
|
|
19
|
+
{
|
|
20
|
+
flag: "--header KEY=value",
|
|
21
|
+
description: "Attach HTTP headers; values support ${VAR}, ${VAR:-fallback}, or whole-value $env:VAR."
|
|
22
|
+
},
|
|
20
23
|
{ flag: "--stdio <command>", description: "Run a stdio MCP server (repeat --stdio-arg for args)." },
|
|
21
24
|
{ flag: "--stdio-arg <value>", description: "Append args to the stdio command (repeatable)." },
|
|
22
|
-
{
|
|
25
|
+
{
|
|
26
|
+
flag: "--env KEY=value",
|
|
27
|
+
description: "Inject stdio env vars; values support ${VAR}, ${VAR:-fallback}, or whole-value $env:VAR."
|
|
28
|
+
},
|
|
23
29
|
{ flag: "--cwd <path>", description: "Working directory for stdio servers." },
|
|
24
30
|
{ flag: "--name <value>", description: "Override the display name for ad-hoc servers." },
|
|
25
31
|
{ flag: "--description <text>", description: "Override the description for ad-hoc servers." },
|
|
@@ -30,7 +36,7 @@ function renderAdhocServerHelpLines(width = 23) {
|
|
|
30
36
|
return ADHOC_SERVER_HELP_ENTRIES.map((entry) => ` ${entry.flag.padEnd(width)}${entry.description}`);
|
|
31
37
|
}
|
|
32
38
|
|
|
33
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
39
|
+
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/cli/ephemeral-target.js
|
|
34
40
|
async function prepareEphemeralServerTarget(options) {
|
|
35
41
|
let target = options.target;
|
|
36
42
|
let spec = options.ephemeral ? { ...options.ephemeral } : void 0;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
|
|
3
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
3
|
+
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/process-utils.js
|
|
4
4
|
function isProcessRunning(pid) {
|
|
5
5
|
if (!Number.isInteger(pid) || pid <= 0) {
|
|
6
6
|
return false;
|
|
@@ -13,7 +13,7 @@ function isProcessRunning(pid) {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
16
|
+
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/fs-json.js
|
|
17
17
|
import crypto from "node:crypto";
|
|
18
18
|
import { constants } from "node:fs";
|
|
19
19
|
import fs from "node:fs/promises";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
|
|
3
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
3
|
+
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/definition-fields.js
|
|
4
4
|
var SHARED_DEFINITION_FIELDS = [
|
|
5
5
|
"auth",
|
|
6
6
|
"tokenCacheDir",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
|
|
3
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
3
|
+
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/lifecycle.js
|
|
4
4
|
var DEFAULT_KEEP_ALIVE = /* @__PURE__ */ new Set(["chrome-devtools", "mobile-mcp", "playwright", "cloudbase"]);
|
|
5
5
|
var includeOverride = parseList(process.env.MCPORTER_KEEPALIVE);
|
|
6
6
|
var excludeOverride = parseList(process.env.MCPORTER_DISABLE_KEEPALIVE ?? process.env.MCPORTER_NO_KEEPALIVE);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
buildRecordCommandEnv
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-FAJPJTOC.js";
|
|
5
5
|
import {
|
|
6
6
|
PRIVATE_RECORDING_FILE_MODE,
|
|
7
7
|
ensurePrivateRecordingDir,
|
|
8
8
|
resolveRecordingConfigPath,
|
|
9
9
|
resolveRecordingPath
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-OP3IW2V6.js";
|
|
11
11
|
|
|
12
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
12
|
+
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/cli/record-replay-command.js
|
|
13
13
|
import { spawn } from "node:child_process";
|
|
14
14
|
import fs from "node:fs/promises";
|
|
15
15
|
async function writeRecordReplayConfig(parsed, mode) {
|
|
@@ -63,7 +63,7 @@ function buildRecordReplayInstructionEnv(mode, sessionName, server) {
|
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
66
|
+
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/cli/record-command.js
|
|
67
67
|
async function handleRecordCli(args) {
|
|
68
68
|
const parsed = parseRecordArgs(args);
|
|
69
69
|
const recordPath = resolveRecordingPath(parsed.sessionName);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
|
|
3
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
3
|
+
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/cli/ephemeral-flags.js
|
|
4
4
|
function extractEphemeralServerFlags(args, options = {}) {
|
|
5
5
|
let spec;
|
|
6
6
|
const ensureSpec = () => {
|
|
@@ -3,39 +3,39 @@ import {
|
|
|
3
3
|
DAEMON_PROTOCOL_VERSION,
|
|
4
4
|
DaemonFrameDecoder,
|
|
5
5
|
isDaemonProgressFrame,
|
|
6
|
-
|
|
7
|
-
} from "./chunk-
|
|
6
|
+
resolveProgressTiming
|
|
7
|
+
} from "./chunk-3Z7MFS6K.js";
|
|
8
8
|
import {
|
|
9
9
|
CHROME_DEVTOOLS_RELAY_RUNTIME_IDENTITY_VERSION,
|
|
10
10
|
resolveChromeDevtoolsRelayRuntimeIdentity
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-BWW4XRUC.js";
|
|
12
12
|
import {
|
|
13
13
|
suppressBrowserLaunchFromEnv
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-DTZHEVKC.js";
|
|
15
15
|
import {
|
|
16
16
|
listConfigLayerPaths
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-RD7NHCRK.js";
|
|
18
18
|
import {
|
|
19
19
|
isProcessRunning,
|
|
20
20
|
withFileLock
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-ITR7FQM3.js";
|
|
22
22
|
import {
|
|
23
23
|
mcporterDir
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-FS5JIKT6.js";
|
|
25
25
|
import {
|
|
26
26
|
expandHome
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-WTMJMM3B.js";
|
|
28
28
|
import {
|
|
29
29
|
keepAliveIdleTimeout
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-JG4TRUPF.js";
|
|
31
31
|
|
|
32
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
32
|
+
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/daemon/client.js
|
|
33
33
|
import crypto, { randomUUID } from "node:crypto";
|
|
34
34
|
import fs2 from "node:fs/promises";
|
|
35
35
|
import net from "node:net";
|
|
36
36
|
import path3 from "node:path";
|
|
37
37
|
|
|
38
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
38
|
+
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/daemon/config-layers.js
|
|
39
39
|
import fs from "node:fs/promises";
|
|
40
40
|
import path from "node:path";
|
|
41
41
|
async function statConfigMtime(configPath) {
|
|
@@ -66,7 +66,7 @@ function normalizeConfigLayers(layers) {
|
|
|
66
66
|
return normalized.toSorted((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
69
|
+
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/daemon/paths.js
|
|
70
70
|
import path2 from "node:path";
|
|
71
71
|
function resolveBaseDir() {
|
|
72
72
|
const override = process.env.MCPORTER_DAEMON_DIR;
|
|
@@ -92,7 +92,7 @@ function getDaemonLogPath(configKey) {
|
|
|
92
92
|
return path2.join(ensureRunDir(), `daemon-${configKey}.log`);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
95
|
+
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/daemon/request-utils.js
|
|
96
96
|
function delay(ms) {
|
|
97
97
|
return new Promise((resolve) => {
|
|
98
98
|
setTimeout(resolve, ms);
|
|
@@ -157,7 +157,7 @@ function buildErrorResponse(id, code, error) {
|
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
160
|
+
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/daemon/startup-readiness.js
|
|
161
161
|
var DAEMON_STARTUP_TIMEOUT_MS = 45e3;
|
|
162
162
|
var DAEMON_STARTUP_SLOW_NOTICE_MS = 5e3;
|
|
163
163
|
var DAEMON_STARTUP_POLL_INTERVAL_MS = 100;
|
|
@@ -200,7 +200,7 @@ function delay2(ms) {
|
|
|
200
200
|
});
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
203
|
+
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/daemon/client.js
|
|
204
204
|
var DEFAULT_DAEMON_TIMEOUT_MS = 3e4;
|
|
205
205
|
var MIN_DAEMON_STATUS_TIMEOUT_MS = 1e3;
|
|
206
206
|
function resolveDaemonPaths(configPath) {
|
|
@@ -313,7 +313,7 @@ var DaemonClient = class {
|
|
|
313
313
|
await this.startingPromise;
|
|
314
314
|
}
|
|
315
315
|
async launchDaemonAndWait() {
|
|
316
|
-
const { launchDaemonDetached } = await import("./launch-
|
|
316
|
+
const { launchDaemonDetached } = await import("./launch-EIT73HX4.js");
|
|
317
317
|
launchDaemonDetached({
|
|
318
318
|
configPath: this.options.configPath,
|
|
319
319
|
configExplicit: this.options.configExplicit,
|
|
@@ -386,13 +386,13 @@ var DaemonClient = class {
|
|
|
386
386
|
return "fresh";
|
|
387
387
|
}
|
|
388
388
|
async sendRequest(method, params, timeoutOverrideMs) {
|
|
389
|
-
const
|
|
389
|
+
const progressTiming = resolveProgressTiming(resolveDaemonTimeout(timeoutOverrideMs));
|
|
390
390
|
const request = {
|
|
391
391
|
id: randomUUID(),
|
|
392
392
|
method,
|
|
393
393
|
params,
|
|
394
394
|
protocolVersion: DAEMON_PROTOCOL_VERSION,
|
|
395
|
-
progressIntervalMs:
|
|
395
|
+
progressIntervalMs: progressTiming.progressIntervalMs
|
|
396
396
|
};
|
|
397
397
|
const payload = JSON.stringify(request);
|
|
398
398
|
const parsed = await new Promise((resolve, reject) => {
|
|
@@ -414,7 +414,7 @@ var DaemonClient = class {
|
|
|
414
414
|
settled = true;
|
|
415
415
|
resolve(value);
|
|
416
416
|
};
|
|
417
|
-
socket.setTimeout(idleTimeoutMs);
|
|
417
|
+
socket.setTimeout(progressTiming.idleTimeoutMs);
|
|
418
418
|
socket.on("timeout", () => {
|
|
419
419
|
socket.destroy(transportError("Daemon request timed out.", "ETIMEDOUT"));
|
|
420
420
|
});
|
|
@@ -422,7 +422,7 @@ var DaemonClient = class {
|
|
|
422
422
|
for (const frame of frames) {
|
|
423
423
|
if (isDaemonProgressFrame(frame)) {
|
|
424
424
|
if (frame.id === request.id) {
|
|
425
|
-
socket.setTimeout(idleTimeoutMs);
|
|
425
|
+
socket.setTimeout(progressTiming.idleTimeoutMs);
|
|
426
426
|
}
|
|
427
427
|
continue;
|
|
428
428
|
}
|
|
@@ -470,7 +470,7 @@ function transportError(message, code) {
|
|
|
470
470
|
}
|
|
471
471
|
function deriveConfigKey(configPath) {
|
|
472
472
|
const absolute = path3.resolve(configPath);
|
|
473
|
-
return crypto.
|
|
473
|
+
return crypto.hash("sha1", absolute, "hex").slice(0, 12);
|
|
474
474
|
}
|
|
475
475
|
function isTransportError(error) {
|
|
476
476
|
if (!error || typeof error !== "object") {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
|
|
3
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
3
|
+
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/version.js
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
var MCPORTER_VERSION = (() => {
|
|
6
6
|
try {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
legacyMcporterDir
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-FS5JIKT6.js";
|
|
5
5
|
|
|
6
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
6
|
+
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/runtime/record-transport.js
|
|
7
7
|
import fs from "node:fs/promises";
|
|
8
8
|
import path from "node:path";
|
|
9
9
|
var initializedRecordingPaths = /* @__PURE__ */ new Map();
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
union,
|
|
27
27
|
unknown,
|
|
28
28
|
url
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-HN7WPMCA.js";
|
|
30
30
|
|
|
31
31
|
// node_modules/.pnpm/@modelcontextprotocol+client@2.0.0/node_modules/@modelcontextprotocol/client/dist/chunk-Br0eD_fh.mjs
|
|
32
32
|
var __create = Object.create;
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
SdkHttpError,
|
|
4
4
|
SseError,
|
|
5
5
|
UnauthorizedError
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-PZ323CXI.js";
|
|
7
7
|
|
|
8
|
-
// node_modules/.pnpm/mcporter@0.13.
|
|
8
|
+
// node_modules/.pnpm/mcporter@0.13.8/node_modules/mcporter/dist/error-classifier.js
|
|
9
9
|
var AUTH_STATUSES = /* @__PURE__ */ new Set([401, 403]);
|
|
10
10
|
var KEYWORD_AUTH_PATTERNS = [/unauthorized/, /invalid_token/, /forbidden/];
|
|
11
11
|
var NUMERIC_AUTH_PATTERNS = [/(?<![0-9a-z_])401(?![0-9a-z_])/i];
|
|
@@ -31,7 +31,6 @@ var OFFLINE_PATTERNS = [
|
|
|
31
31
|
"failed to start",
|
|
32
32
|
"spawn enoent"
|
|
33
33
|
];
|
|
34
|
-
var HTTP_STATUS_FALLBACK = /\bhttps?:\/\/[^\s]+(?:\s+returned\s+)?(?:status|code)?\s*(\d{3})\b/i;
|
|
35
34
|
var STATUS_DIRECT_PATTERN = /\b(?:status(?:\s+code)?|http(?:\s+(?:status|code|error))?)[:\s]*(\d{3})\b/i;
|
|
36
35
|
var STDIO_EXIT_PATTERN = /exit(?:ed)?(?:\s+with)?(?:\s+(?:code|status))\s+(-?\d+)/i;
|
|
37
36
|
var STDIO_SIGNAL_PATTERN = /signal\s+([A-Z0-9]+)/i;
|
|
@@ -109,7 +108,7 @@ function extractStatusCode(message) {
|
|
|
109
108
|
const candidates = [
|
|
110
109
|
message.match(/status code\s*\((\d{3})\)/i)?.[1],
|
|
111
110
|
message.match(STATUS_DIRECT_PATTERN)?.[1],
|
|
112
|
-
message
|
|
111
|
+
extractStatusAfterUrl(message)
|
|
113
112
|
].filter(Boolean);
|
|
114
113
|
for (const candidate of candidates) {
|
|
115
114
|
const parsed = Number.parseInt(candidate, 10);
|
|
@@ -136,6 +135,62 @@ function extractStatusCode(message) {
|
|
|
136
135
|
}
|
|
137
136
|
return void 0;
|
|
138
137
|
}
|
|
138
|
+
function extractStatusAfterUrl(message) {
|
|
139
|
+
const normalized = message.toLowerCase();
|
|
140
|
+
let searchStart = 0;
|
|
141
|
+
while (searchStart < message.length) {
|
|
142
|
+
const urlStart = findNextHttpUrl(normalized, searchStart);
|
|
143
|
+
if (urlStart === -1) {
|
|
144
|
+
return void 0;
|
|
145
|
+
}
|
|
146
|
+
let separatorIndex = urlStart;
|
|
147
|
+
while (separatorIndex < normalized.length && !/\s/.test(normalized.charAt(separatorIndex))) {
|
|
148
|
+
separatorIndex += 1;
|
|
149
|
+
}
|
|
150
|
+
if (separatorIndex < normalized.length) {
|
|
151
|
+
const candidate = extractStatusFromUrlTail(normalized, separatorIndex);
|
|
152
|
+
if (candidate !== void 0) {
|
|
153
|
+
return candidate;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
searchStart = separatorIndex;
|
|
157
|
+
}
|
|
158
|
+
return void 0;
|
|
159
|
+
}
|
|
160
|
+
function extractStatusFromUrlTail(value, start) {
|
|
161
|
+
let cursor = skipWhitespace(value, start);
|
|
162
|
+
for (const prefix of ["returned status", "returned code", "returned", "status", "code"]) {
|
|
163
|
+
if (value.startsWith(prefix, cursor)) {
|
|
164
|
+
cursor = skipWhitespace(value, cursor + prefix.length);
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
const candidate = value.slice(cursor, cursor + 3);
|
|
169
|
+
const boundary = value.charAt(cursor + 3);
|
|
170
|
+
return /^\d{3}$/.test(candidate) && !/[a-z0-9_]/i.test(boundary) ? candidate : void 0;
|
|
171
|
+
}
|
|
172
|
+
function skipWhitespace(value, start) {
|
|
173
|
+
let index = start;
|
|
174
|
+
while (index < value.length && /\s/.test(value.charAt(index))) {
|
|
175
|
+
index += 1;
|
|
176
|
+
}
|
|
177
|
+
return index;
|
|
178
|
+
}
|
|
179
|
+
function findNextHttpUrl(value, searchStart) {
|
|
180
|
+
let index = searchStart;
|
|
181
|
+
while (index < value.length) {
|
|
182
|
+
const candidate = value.indexOf("http", index);
|
|
183
|
+
if (candidate === -1) {
|
|
184
|
+
return -1;
|
|
185
|
+
}
|
|
186
|
+
const isUrl = value.startsWith("http://", candidate) || value.startsWith("https://", candidate);
|
|
187
|
+
if (isUrl && (candidate === 0 || !/[a-z0-9_]/i.test(value.charAt(candidate - 1)))) {
|
|
188
|
+
return candidate;
|
|
189
|
+
}
|
|
190
|
+
index = candidate + 1;
|
|
191
|
+
}
|
|
192
|
+
return -1;
|
|
193
|
+
}
|
|
139
194
|
function matchesAny(patterns, normalizedMessage) {
|
|
140
195
|
return patterns.some((pattern) => pattern.test(normalizedMessage));
|
|
141
196
|
}
|