@mgsoftwarebv/mg-dashboard-mcp 7.4.4 → 7.4.5
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/index.js +350 -174
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -703,10 +703,10 @@ var TRIGGER_TOOL_MODULE_MAP = {
|
|
|
703
703
|
"trigger-env": "settings"
|
|
704
704
|
};
|
|
705
705
|
async function discoverInstance(projectSlug, conn, proxy, sshExec2) {
|
|
706
|
-
const
|
|
706
|
+
const sql27 = `SELECT re.\\"apiKey\\" || '~~' || p.\\"externalRef\\" FROM \\"RuntimeEnvironment\\" re JOIN \\"Project\\" p ON re.\\"projectId\\" = p.id WHERE p.slug='${projectSlug}' AND re.slug='prod' LIMIT 1`;
|
|
707
707
|
const cmd = [
|
|
708
708
|
`PORT=$(docker port "${WA_CONTAINER}" 3000/tcp 2>/dev/null | head -1 | sed 's/.*://')`,
|
|
709
|
-
`ROW=$(docker exec "${PG_CONTAINER}" psql -U postgres -d main -t -A -c "${
|
|
709
|
+
`ROW=$(docker exec "${PG_CONTAINER}" psql -U postgres -d main -t -A -c "${sql27}" 2>/dev/null | tr -d '[:space:]')`,
|
|
710
710
|
'echo "$PORT|$ROW"'
|
|
711
711
|
].join(" && ");
|
|
712
712
|
const result = await sshExec2(conn, cmd, proxy);
|
|
@@ -728,8 +728,8 @@ async function discoverInstance(projectSlug, conn, proxy, sshExec2) {
|
|
|
728
728
|
return { port, apiKey: apiKey2, projectRef: projectRef || "" };
|
|
729
729
|
}
|
|
730
730
|
async function fetchRunLogs(runId, conn, proxy, sshExec2) {
|
|
731
|
-
const
|
|
732
|
-
const cmd = `docker exec "${PG_CONTAINER}" psql -U postgres -d main -t -A -c "${
|
|
731
|
+
const sql27 = `SELECT level, message, \\"isError\\", \\"createdAt\\" FROM \\"TaskEvent\\" WHERE \\"runId\\" = '${runId}' AND level IN ('INFO','WARN','ERROR','DEBUG','LOG','TRACE') ORDER BY \\"startTime\\" ASC LIMIT 200`;
|
|
732
|
+
const cmd = `docker exec "${PG_CONTAINER}" psql -U postgres -d main -t -A -c "${sql27}" 2>/dev/null`;
|
|
733
733
|
const result = await sshExec2(conn, cmd, proxy);
|
|
734
734
|
const output = result.stdout.trim();
|
|
735
735
|
if (!output) return "";
|
|
@@ -811,8 +811,8 @@ async function handleTriggerTool(name, args2, deps) {
|
|
|
811
811
|
switch (name) {
|
|
812
812
|
// -----------------------------------------------------------------
|
|
813
813
|
case "trigger-list": {
|
|
814
|
-
const
|
|
815
|
-
const cmd = `docker exec "${PG_CONTAINER}" psql -U postgres -d main -t -A -c "${
|
|
814
|
+
const sql27 = 'SELECT slug, name FROM \\"Project\\" ORDER BY name';
|
|
815
|
+
const cmd = `docker exec "${PG_CONTAINER}" psql -U postgres -d main -t -A -c "${sql27}" 2>/dev/null`;
|
|
816
816
|
const result = await sshExec2(conn, cmd, proxy);
|
|
817
817
|
const output = result.stdout.trim();
|
|
818
818
|
if (!output) {
|
|
@@ -990,9 +990,9 @@ ${raw2.substring(0, 500)}` }] };
|
|
|
990
990
|
return { content: [{ type: "text", text: `No environment variables for ${project}/${env}.` }] };
|
|
991
991
|
}
|
|
992
992
|
const lines = vars.map((v) => `${v.isSecret ? "[secret]" : " "} ${v.name}`).sort();
|
|
993
|
-
const
|
|
993
|
+
const text11 = `Env vars for ${project}/${env} (${vars.length}) \u2014 values hidden, use action="get" with a key:
|
|
994
994
|
` + "-".repeat(50) + "\n" + lines.join("\n");
|
|
995
|
-
return { content: [{ type: "text", text:
|
|
995
|
+
return { content: [{ type: "text", text: text11 }] };
|
|
996
996
|
}
|
|
997
997
|
if (action === "get") {
|
|
998
998
|
const key2 = String(args2.key ?? "");
|
|
@@ -1079,9 +1079,9 @@ async function fetchAndFormatRun(conn, proxy, sshExec2, instance, runId) {
|
|
|
1079
1079
|
return { content: [{ type: "text", text: `Invalid API response:
|
|
1080
1080
|
${rawJson.substring(0, 500)}` }] };
|
|
1081
1081
|
}
|
|
1082
|
-
let
|
|
1083
|
-
if (logs)
|
|
1084
|
-
return { content: [{ type: "text", text:
|
|
1082
|
+
let text11 = formatRunDetail(run);
|
|
1083
|
+
if (logs) text11 += "\n\n--- Logs ---\n" + logs;
|
|
1084
|
+
return { content: [{ type: "text", text: text11 }] };
|
|
1085
1085
|
}
|
|
1086
1086
|
async function waitForCompletion(conn, proxy, sshExec2, instance, runId, waitSeconds) {
|
|
1087
1087
|
const pollInterval = 3e3;
|
|
@@ -1103,10 +1103,10 @@ async function waitForCompletion(conn, proxy, sshExec2, instance, runId, waitSec
|
|
|
1103
1103
|
continue;
|
|
1104
1104
|
}
|
|
1105
1105
|
if (TERMINAL_STATUSES.has(run.status)) {
|
|
1106
|
-
let
|
|
1106
|
+
let text11 = formatRunDetail(run);
|
|
1107
1107
|
const logs = await fetchRunLogs(runId, conn, proxy, sshExec2);
|
|
1108
|
-
if (logs)
|
|
1109
|
-
return { content: [{ type: "text", text:
|
|
1108
|
+
if (logs) text11 += "\n\n--- Logs ---\n" + logs;
|
|
1109
|
+
return { content: [{ type: "text", text: text11 }] };
|
|
1110
1110
|
}
|
|
1111
1111
|
}
|
|
1112
1112
|
return {
|
|
@@ -1968,7 +1968,7 @@ var ZodType = class {
|
|
|
1968
1968
|
const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
|
|
1969
1969
|
return handleResult(ctx, result);
|
|
1970
1970
|
}
|
|
1971
|
-
refine(
|
|
1971
|
+
refine(check3, message) {
|
|
1972
1972
|
const getIssueProperties = (val) => {
|
|
1973
1973
|
if (typeof message === "string" || typeof message === "undefined") {
|
|
1974
1974
|
return { message };
|
|
@@ -1979,7 +1979,7 @@ var ZodType = class {
|
|
|
1979
1979
|
}
|
|
1980
1980
|
};
|
|
1981
1981
|
return this._refinement((val, ctx) => {
|
|
1982
|
-
const result =
|
|
1982
|
+
const result = check3(val);
|
|
1983
1983
|
const setError = () => ctx.addIssue({
|
|
1984
1984
|
code: ZodIssueCode.custom,
|
|
1985
1985
|
...getIssueProperties(val)
|
|
@@ -2002,9 +2002,9 @@ var ZodType = class {
|
|
|
2002
2002
|
}
|
|
2003
2003
|
});
|
|
2004
2004
|
}
|
|
2005
|
-
refinement(
|
|
2005
|
+
refinement(check3, refinementData) {
|
|
2006
2006
|
return this._refinement((val, ctx) => {
|
|
2007
|
-
if (!
|
|
2007
|
+
if (!check3(val)) {
|
|
2008
2008
|
ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData);
|
|
2009
2009
|
return false;
|
|
2010
2010
|
} else {
|
|
@@ -2224,70 +2224,70 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
2224
2224
|
}
|
|
2225
2225
|
const status = new ParseStatus();
|
|
2226
2226
|
let ctx = void 0;
|
|
2227
|
-
for (const
|
|
2228
|
-
if (
|
|
2229
|
-
if (input.data.length <
|
|
2227
|
+
for (const check3 of this._def.checks) {
|
|
2228
|
+
if (check3.kind === "min") {
|
|
2229
|
+
if (input.data.length < check3.value) {
|
|
2230
2230
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
2231
2231
|
addIssueToContext(ctx, {
|
|
2232
2232
|
code: ZodIssueCode.too_small,
|
|
2233
|
-
minimum:
|
|
2233
|
+
minimum: check3.value,
|
|
2234
2234
|
type: "string",
|
|
2235
2235
|
inclusive: true,
|
|
2236
2236
|
exact: false,
|
|
2237
|
-
message:
|
|
2237
|
+
message: check3.message
|
|
2238
2238
|
});
|
|
2239
2239
|
status.dirty();
|
|
2240
2240
|
}
|
|
2241
|
-
} else if (
|
|
2242
|
-
if (input.data.length >
|
|
2241
|
+
} else if (check3.kind === "max") {
|
|
2242
|
+
if (input.data.length > check3.value) {
|
|
2243
2243
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
2244
2244
|
addIssueToContext(ctx, {
|
|
2245
2245
|
code: ZodIssueCode.too_big,
|
|
2246
|
-
maximum:
|
|
2246
|
+
maximum: check3.value,
|
|
2247
2247
|
type: "string",
|
|
2248
2248
|
inclusive: true,
|
|
2249
2249
|
exact: false,
|
|
2250
|
-
message:
|
|
2250
|
+
message: check3.message
|
|
2251
2251
|
});
|
|
2252
2252
|
status.dirty();
|
|
2253
2253
|
}
|
|
2254
|
-
} else if (
|
|
2255
|
-
const tooBig = input.data.length >
|
|
2256
|
-
const tooSmall = input.data.length <
|
|
2254
|
+
} else if (check3.kind === "length") {
|
|
2255
|
+
const tooBig = input.data.length > check3.value;
|
|
2256
|
+
const tooSmall = input.data.length < check3.value;
|
|
2257
2257
|
if (tooBig || tooSmall) {
|
|
2258
2258
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
2259
2259
|
if (tooBig) {
|
|
2260
2260
|
addIssueToContext(ctx, {
|
|
2261
2261
|
code: ZodIssueCode.too_big,
|
|
2262
|
-
maximum:
|
|
2262
|
+
maximum: check3.value,
|
|
2263
2263
|
type: "string",
|
|
2264
2264
|
inclusive: true,
|
|
2265
2265
|
exact: true,
|
|
2266
|
-
message:
|
|
2266
|
+
message: check3.message
|
|
2267
2267
|
});
|
|
2268
2268
|
} else if (tooSmall) {
|
|
2269
2269
|
addIssueToContext(ctx, {
|
|
2270
2270
|
code: ZodIssueCode.too_small,
|
|
2271
|
-
minimum:
|
|
2271
|
+
minimum: check3.value,
|
|
2272
2272
|
type: "string",
|
|
2273
2273
|
inclusive: true,
|
|
2274
2274
|
exact: true,
|
|
2275
|
-
message:
|
|
2275
|
+
message: check3.message
|
|
2276
2276
|
});
|
|
2277
2277
|
}
|
|
2278
2278
|
status.dirty();
|
|
2279
2279
|
}
|
|
2280
|
-
} else if (
|
|
2280
|
+
} else if (check3.kind === "email") {
|
|
2281
2281
|
if (!emailRegex.test(input.data)) {
|
|
2282
2282
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
2283
2283
|
addIssueToContext(ctx, {
|
|
2284
2284
|
validation: "email",
|
|
2285
2285
|
code: ZodIssueCode.invalid_string,
|
|
2286
|
-
message:
|
|
2286
|
+
message: check3.message
|
|
2287
2287
|
});
|
|
2288
2288
|
status.dirty();
|
|
2289
2289
|
}
|
|
2290
|
-
} else if (
|
|
2290
|
+
} else if (check3.kind === "emoji") {
|
|
2291
2291
|
if (!emojiRegex) {
|
|
2292
2292
|
emojiRegex = new RegExp(_emojiRegex, "u");
|
|
2293
2293
|
}
|
|
@@ -2296,61 +2296,61 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
2296
2296
|
addIssueToContext(ctx, {
|
|
2297
2297
|
validation: "emoji",
|
|
2298
2298
|
code: ZodIssueCode.invalid_string,
|
|
2299
|
-
message:
|
|
2299
|
+
message: check3.message
|
|
2300
2300
|
});
|
|
2301
2301
|
status.dirty();
|
|
2302
2302
|
}
|
|
2303
|
-
} else if (
|
|
2303
|
+
} else if (check3.kind === "uuid") {
|
|
2304
2304
|
if (!uuidRegex.test(input.data)) {
|
|
2305
2305
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
2306
2306
|
addIssueToContext(ctx, {
|
|
2307
2307
|
validation: "uuid",
|
|
2308
2308
|
code: ZodIssueCode.invalid_string,
|
|
2309
|
-
message:
|
|
2309
|
+
message: check3.message
|
|
2310
2310
|
});
|
|
2311
2311
|
status.dirty();
|
|
2312
2312
|
}
|
|
2313
|
-
} else if (
|
|
2313
|
+
} else if (check3.kind === "nanoid") {
|
|
2314
2314
|
if (!nanoidRegex.test(input.data)) {
|
|
2315
2315
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
2316
2316
|
addIssueToContext(ctx, {
|
|
2317
2317
|
validation: "nanoid",
|
|
2318
2318
|
code: ZodIssueCode.invalid_string,
|
|
2319
|
-
message:
|
|
2319
|
+
message: check3.message
|
|
2320
2320
|
});
|
|
2321
2321
|
status.dirty();
|
|
2322
2322
|
}
|
|
2323
|
-
} else if (
|
|
2323
|
+
} else if (check3.kind === "cuid") {
|
|
2324
2324
|
if (!cuidRegex.test(input.data)) {
|
|
2325
2325
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
2326
2326
|
addIssueToContext(ctx, {
|
|
2327
2327
|
validation: "cuid",
|
|
2328
2328
|
code: ZodIssueCode.invalid_string,
|
|
2329
|
-
message:
|
|
2329
|
+
message: check3.message
|
|
2330
2330
|
});
|
|
2331
2331
|
status.dirty();
|
|
2332
2332
|
}
|
|
2333
|
-
} else if (
|
|
2333
|
+
} else if (check3.kind === "cuid2") {
|
|
2334
2334
|
if (!cuid2Regex.test(input.data)) {
|
|
2335
2335
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
2336
2336
|
addIssueToContext(ctx, {
|
|
2337
2337
|
validation: "cuid2",
|
|
2338
2338
|
code: ZodIssueCode.invalid_string,
|
|
2339
|
-
message:
|
|
2339
|
+
message: check3.message
|
|
2340
2340
|
});
|
|
2341
2341
|
status.dirty();
|
|
2342
2342
|
}
|
|
2343
|
-
} else if (
|
|
2343
|
+
} else if (check3.kind === "ulid") {
|
|
2344
2344
|
if (!ulidRegex.test(input.data)) {
|
|
2345
2345
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
2346
2346
|
addIssueToContext(ctx, {
|
|
2347
2347
|
validation: "ulid",
|
|
2348
2348
|
code: ZodIssueCode.invalid_string,
|
|
2349
|
-
message:
|
|
2349
|
+
message: check3.message
|
|
2350
2350
|
});
|
|
2351
2351
|
status.dirty();
|
|
2352
2352
|
}
|
|
2353
|
-
} else if (
|
|
2353
|
+
} else if (check3.kind === "url") {
|
|
2354
2354
|
try {
|
|
2355
2355
|
new URL(input.data);
|
|
2356
2356
|
} catch {
|
|
@@ -2358,153 +2358,153 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
2358
2358
|
addIssueToContext(ctx, {
|
|
2359
2359
|
validation: "url",
|
|
2360
2360
|
code: ZodIssueCode.invalid_string,
|
|
2361
|
-
message:
|
|
2361
|
+
message: check3.message
|
|
2362
2362
|
});
|
|
2363
2363
|
status.dirty();
|
|
2364
2364
|
}
|
|
2365
|
-
} else if (
|
|
2366
|
-
|
|
2367
|
-
const testResult =
|
|
2365
|
+
} else if (check3.kind === "regex") {
|
|
2366
|
+
check3.regex.lastIndex = 0;
|
|
2367
|
+
const testResult = check3.regex.test(input.data);
|
|
2368
2368
|
if (!testResult) {
|
|
2369
2369
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
2370
2370
|
addIssueToContext(ctx, {
|
|
2371
2371
|
validation: "regex",
|
|
2372
2372
|
code: ZodIssueCode.invalid_string,
|
|
2373
|
-
message:
|
|
2373
|
+
message: check3.message
|
|
2374
2374
|
});
|
|
2375
2375
|
status.dirty();
|
|
2376
2376
|
}
|
|
2377
|
-
} else if (
|
|
2377
|
+
} else if (check3.kind === "trim") {
|
|
2378
2378
|
input.data = input.data.trim();
|
|
2379
|
-
} else if (
|
|
2380
|
-
if (!input.data.includes(
|
|
2379
|
+
} else if (check3.kind === "includes") {
|
|
2380
|
+
if (!input.data.includes(check3.value, check3.position)) {
|
|
2381
2381
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
2382
2382
|
addIssueToContext(ctx, {
|
|
2383
2383
|
code: ZodIssueCode.invalid_string,
|
|
2384
|
-
validation: { includes:
|
|
2385
|
-
message:
|
|
2384
|
+
validation: { includes: check3.value, position: check3.position },
|
|
2385
|
+
message: check3.message
|
|
2386
2386
|
});
|
|
2387
2387
|
status.dirty();
|
|
2388
2388
|
}
|
|
2389
|
-
} else if (
|
|
2389
|
+
} else if (check3.kind === "toLowerCase") {
|
|
2390
2390
|
input.data = input.data.toLowerCase();
|
|
2391
|
-
} else if (
|
|
2391
|
+
} else if (check3.kind === "toUpperCase") {
|
|
2392
2392
|
input.data = input.data.toUpperCase();
|
|
2393
|
-
} else if (
|
|
2394
|
-
if (!input.data.startsWith(
|
|
2393
|
+
} else if (check3.kind === "startsWith") {
|
|
2394
|
+
if (!input.data.startsWith(check3.value)) {
|
|
2395
2395
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
2396
2396
|
addIssueToContext(ctx, {
|
|
2397
2397
|
code: ZodIssueCode.invalid_string,
|
|
2398
|
-
validation: { startsWith:
|
|
2399
|
-
message:
|
|
2398
|
+
validation: { startsWith: check3.value },
|
|
2399
|
+
message: check3.message
|
|
2400
2400
|
});
|
|
2401
2401
|
status.dirty();
|
|
2402
2402
|
}
|
|
2403
|
-
} else if (
|
|
2404
|
-
if (!input.data.endsWith(
|
|
2403
|
+
} else if (check3.kind === "endsWith") {
|
|
2404
|
+
if (!input.data.endsWith(check3.value)) {
|
|
2405
2405
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
2406
2406
|
addIssueToContext(ctx, {
|
|
2407
2407
|
code: ZodIssueCode.invalid_string,
|
|
2408
|
-
validation: { endsWith:
|
|
2409
|
-
message:
|
|
2408
|
+
validation: { endsWith: check3.value },
|
|
2409
|
+
message: check3.message
|
|
2410
2410
|
});
|
|
2411
2411
|
status.dirty();
|
|
2412
2412
|
}
|
|
2413
|
-
} else if (
|
|
2414
|
-
const regex = datetimeRegex(
|
|
2413
|
+
} else if (check3.kind === "datetime") {
|
|
2414
|
+
const regex = datetimeRegex(check3);
|
|
2415
2415
|
if (!regex.test(input.data)) {
|
|
2416
2416
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
2417
2417
|
addIssueToContext(ctx, {
|
|
2418
2418
|
code: ZodIssueCode.invalid_string,
|
|
2419
2419
|
validation: "datetime",
|
|
2420
|
-
message:
|
|
2420
|
+
message: check3.message
|
|
2421
2421
|
});
|
|
2422
2422
|
status.dirty();
|
|
2423
2423
|
}
|
|
2424
|
-
} else if (
|
|
2424
|
+
} else if (check3.kind === "date") {
|
|
2425
2425
|
const regex = dateRegex;
|
|
2426
2426
|
if (!regex.test(input.data)) {
|
|
2427
2427
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
2428
2428
|
addIssueToContext(ctx, {
|
|
2429
2429
|
code: ZodIssueCode.invalid_string,
|
|
2430
2430
|
validation: "date",
|
|
2431
|
-
message:
|
|
2431
|
+
message: check3.message
|
|
2432
2432
|
});
|
|
2433
2433
|
status.dirty();
|
|
2434
2434
|
}
|
|
2435
|
-
} else if (
|
|
2436
|
-
const regex = timeRegex(
|
|
2435
|
+
} else if (check3.kind === "time") {
|
|
2436
|
+
const regex = timeRegex(check3);
|
|
2437
2437
|
if (!regex.test(input.data)) {
|
|
2438
2438
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
2439
2439
|
addIssueToContext(ctx, {
|
|
2440
2440
|
code: ZodIssueCode.invalid_string,
|
|
2441
2441
|
validation: "time",
|
|
2442
|
-
message:
|
|
2442
|
+
message: check3.message
|
|
2443
2443
|
});
|
|
2444
2444
|
status.dirty();
|
|
2445
2445
|
}
|
|
2446
|
-
} else if (
|
|
2446
|
+
} else if (check3.kind === "duration") {
|
|
2447
2447
|
if (!durationRegex.test(input.data)) {
|
|
2448
2448
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
2449
2449
|
addIssueToContext(ctx, {
|
|
2450
2450
|
validation: "duration",
|
|
2451
2451
|
code: ZodIssueCode.invalid_string,
|
|
2452
|
-
message:
|
|
2452
|
+
message: check3.message
|
|
2453
2453
|
});
|
|
2454
2454
|
status.dirty();
|
|
2455
2455
|
}
|
|
2456
|
-
} else if (
|
|
2457
|
-
if (!isValidIP(input.data,
|
|
2456
|
+
} else if (check3.kind === "ip") {
|
|
2457
|
+
if (!isValidIP(input.data, check3.version)) {
|
|
2458
2458
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
2459
2459
|
addIssueToContext(ctx, {
|
|
2460
2460
|
validation: "ip",
|
|
2461
2461
|
code: ZodIssueCode.invalid_string,
|
|
2462
|
-
message:
|
|
2462
|
+
message: check3.message
|
|
2463
2463
|
});
|
|
2464
2464
|
status.dirty();
|
|
2465
2465
|
}
|
|
2466
|
-
} else if (
|
|
2467
|
-
if (!isValidJWT(input.data,
|
|
2466
|
+
} else if (check3.kind === "jwt") {
|
|
2467
|
+
if (!isValidJWT(input.data, check3.alg)) {
|
|
2468
2468
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
2469
2469
|
addIssueToContext(ctx, {
|
|
2470
2470
|
validation: "jwt",
|
|
2471
2471
|
code: ZodIssueCode.invalid_string,
|
|
2472
|
-
message:
|
|
2472
|
+
message: check3.message
|
|
2473
2473
|
});
|
|
2474
2474
|
status.dirty();
|
|
2475
2475
|
}
|
|
2476
|
-
} else if (
|
|
2477
|
-
if (!isValidCidr(input.data,
|
|
2476
|
+
} else if (check3.kind === "cidr") {
|
|
2477
|
+
if (!isValidCidr(input.data, check3.version)) {
|
|
2478
2478
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
2479
2479
|
addIssueToContext(ctx, {
|
|
2480
2480
|
validation: "cidr",
|
|
2481
2481
|
code: ZodIssueCode.invalid_string,
|
|
2482
|
-
message:
|
|
2482
|
+
message: check3.message
|
|
2483
2483
|
});
|
|
2484
2484
|
status.dirty();
|
|
2485
2485
|
}
|
|
2486
|
-
} else if (
|
|
2486
|
+
} else if (check3.kind === "base64") {
|
|
2487
2487
|
if (!base64Regex.test(input.data)) {
|
|
2488
2488
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
2489
2489
|
addIssueToContext(ctx, {
|
|
2490
2490
|
validation: "base64",
|
|
2491
2491
|
code: ZodIssueCode.invalid_string,
|
|
2492
|
-
message:
|
|
2492
|
+
message: check3.message
|
|
2493
2493
|
});
|
|
2494
2494
|
status.dirty();
|
|
2495
2495
|
}
|
|
2496
|
-
} else if (
|
|
2496
|
+
} else if (check3.kind === "base64url") {
|
|
2497
2497
|
if (!base64urlRegex.test(input.data)) {
|
|
2498
2498
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
2499
2499
|
addIssueToContext(ctx, {
|
|
2500
2500
|
validation: "base64url",
|
|
2501
2501
|
code: ZodIssueCode.invalid_string,
|
|
2502
|
-
message:
|
|
2502
|
+
message: check3.message
|
|
2503
2503
|
});
|
|
2504
2504
|
status.dirty();
|
|
2505
2505
|
}
|
|
2506
2506
|
} else {
|
|
2507
|
-
util.assertNever(
|
|
2507
|
+
util.assertNever(check3);
|
|
2508
2508
|
}
|
|
2509
2509
|
}
|
|
2510
2510
|
return { status: status.value, value: input.data };
|
|
@@ -2516,10 +2516,10 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
2516
2516
|
...errorUtil.errToObj(message)
|
|
2517
2517
|
});
|
|
2518
2518
|
}
|
|
2519
|
-
_addCheck(
|
|
2519
|
+
_addCheck(check3) {
|
|
2520
2520
|
return new _ZodString({
|
|
2521
2521
|
...this._def,
|
|
2522
|
-
checks: [...this._def.checks,
|
|
2522
|
+
checks: [...this._def.checks, check3]
|
|
2523
2523
|
});
|
|
2524
2524
|
}
|
|
2525
2525
|
email(message) {
|
|
@@ -2784,67 +2784,67 @@ var ZodNumber = class _ZodNumber extends ZodType {
|
|
|
2784
2784
|
}
|
|
2785
2785
|
let ctx = void 0;
|
|
2786
2786
|
const status = new ParseStatus();
|
|
2787
|
-
for (const
|
|
2788
|
-
if (
|
|
2787
|
+
for (const check3 of this._def.checks) {
|
|
2788
|
+
if (check3.kind === "int") {
|
|
2789
2789
|
if (!util.isInteger(input.data)) {
|
|
2790
2790
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
2791
2791
|
addIssueToContext(ctx, {
|
|
2792
2792
|
code: ZodIssueCode.invalid_type,
|
|
2793
2793
|
expected: "integer",
|
|
2794
2794
|
received: "float",
|
|
2795
|
-
message:
|
|
2795
|
+
message: check3.message
|
|
2796
2796
|
});
|
|
2797
2797
|
status.dirty();
|
|
2798
2798
|
}
|
|
2799
|
-
} else if (
|
|
2800
|
-
const tooSmall =
|
|
2799
|
+
} else if (check3.kind === "min") {
|
|
2800
|
+
const tooSmall = check3.inclusive ? input.data < check3.value : input.data <= check3.value;
|
|
2801
2801
|
if (tooSmall) {
|
|
2802
2802
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
2803
2803
|
addIssueToContext(ctx, {
|
|
2804
2804
|
code: ZodIssueCode.too_small,
|
|
2805
|
-
minimum:
|
|
2805
|
+
minimum: check3.value,
|
|
2806
2806
|
type: "number",
|
|
2807
|
-
inclusive:
|
|
2807
|
+
inclusive: check3.inclusive,
|
|
2808
2808
|
exact: false,
|
|
2809
|
-
message:
|
|
2809
|
+
message: check3.message
|
|
2810
2810
|
});
|
|
2811
2811
|
status.dirty();
|
|
2812
2812
|
}
|
|
2813
|
-
} else if (
|
|
2814
|
-
const tooBig =
|
|
2813
|
+
} else if (check3.kind === "max") {
|
|
2814
|
+
const tooBig = check3.inclusive ? input.data > check3.value : input.data >= check3.value;
|
|
2815
2815
|
if (tooBig) {
|
|
2816
2816
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
2817
2817
|
addIssueToContext(ctx, {
|
|
2818
2818
|
code: ZodIssueCode.too_big,
|
|
2819
|
-
maximum:
|
|
2819
|
+
maximum: check3.value,
|
|
2820
2820
|
type: "number",
|
|
2821
|
-
inclusive:
|
|
2821
|
+
inclusive: check3.inclusive,
|
|
2822
2822
|
exact: false,
|
|
2823
|
-
message:
|
|
2823
|
+
message: check3.message
|
|
2824
2824
|
});
|
|
2825
2825
|
status.dirty();
|
|
2826
2826
|
}
|
|
2827
|
-
} else if (
|
|
2828
|
-
if (floatSafeRemainder(input.data,
|
|
2827
|
+
} else if (check3.kind === "multipleOf") {
|
|
2828
|
+
if (floatSafeRemainder(input.data, check3.value) !== 0) {
|
|
2829
2829
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
2830
2830
|
addIssueToContext(ctx, {
|
|
2831
2831
|
code: ZodIssueCode.not_multiple_of,
|
|
2832
|
-
multipleOf:
|
|
2833
|
-
message:
|
|
2832
|
+
multipleOf: check3.value,
|
|
2833
|
+
message: check3.message
|
|
2834
2834
|
});
|
|
2835
2835
|
status.dirty();
|
|
2836
2836
|
}
|
|
2837
|
-
} else if (
|
|
2837
|
+
} else if (check3.kind === "finite") {
|
|
2838
2838
|
if (!Number.isFinite(input.data)) {
|
|
2839
2839
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
2840
2840
|
addIssueToContext(ctx, {
|
|
2841
2841
|
code: ZodIssueCode.not_finite,
|
|
2842
|
-
message:
|
|
2842
|
+
message: check3.message
|
|
2843
2843
|
});
|
|
2844
2844
|
status.dirty();
|
|
2845
2845
|
}
|
|
2846
2846
|
} else {
|
|
2847
|
-
util.assertNever(
|
|
2847
|
+
util.assertNever(check3);
|
|
2848
2848
|
}
|
|
2849
2849
|
}
|
|
2850
2850
|
return { status: status.value, value: input.data };
|
|
@@ -2875,10 +2875,10 @@ var ZodNumber = class _ZodNumber extends ZodType {
|
|
|
2875
2875
|
]
|
|
2876
2876
|
});
|
|
2877
2877
|
}
|
|
2878
|
-
_addCheck(
|
|
2878
|
+
_addCheck(check3) {
|
|
2879
2879
|
return new _ZodNumber({
|
|
2880
2880
|
...this._def,
|
|
2881
|
-
checks: [...this._def.checks,
|
|
2881
|
+
checks: [...this._def.checks, check3]
|
|
2882
2882
|
});
|
|
2883
2883
|
}
|
|
2884
2884
|
int(message) {
|
|
@@ -3013,45 +3013,45 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
|
3013
3013
|
}
|
|
3014
3014
|
let ctx = void 0;
|
|
3015
3015
|
const status = new ParseStatus();
|
|
3016
|
-
for (const
|
|
3017
|
-
if (
|
|
3018
|
-
const tooSmall =
|
|
3016
|
+
for (const check3 of this._def.checks) {
|
|
3017
|
+
if (check3.kind === "min") {
|
|
3018
|
+
const tooSmall = check3.inclusive ? input.data < check3.value : input.data <= check3.value;
|
|
3019
3019
|
if (tooSmall) {
|
|
3020
3020
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
3021
3021
|
addIssueToContext(ctx, {
|
|
3022
3022
|
code: ZodIssueCode.too_small,
|
|
3023
3023
|
type: "bigint",
|
|
3024
|
-
minimum:
|
|
3025
|
-
inclusive:
|
|
3026
|
-
message:
|
|
3024
|
+
minimum: check3.value,
|
|
3025
|
+
inclusive: check3.inclusive,
|
|
3026
|
+
message: check3.message
|
|
3027
3027
|
});
|
|
3028
3028
|
status.dirty();
|
|
3029
3029
|
}
|
|
3030
|
-
} else if (
|
|
3031
|
-
const tooBig =
|
|
3030
|
+
} else if (check3.kind === "max") {
|
|
3031
|
+
const tooBig = check3.inclusive ? input.data > check3.value : input.data >= check3.value;
|
|
3032
3032
|
if (tooBig) {
|
|
3033
3033
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
3034
3034
|
addIssueToContext(ctx, {
|
|
3035
3035
|
code: ZodIssueCode.too_big,
|
|
3036
3036
|
type: "bigint",
|
|
3037
|
-
maximum:
|
|
3038
|
-
inclusive:
|
|
3039
|
-
message:
|
|
3037
|
+
maximum: check3.value,
|
|
3038
|
+
inclusive: check3.inclusive,
|
|
3039
|
+
message: check3.message
|
|
3040
3040
|
});
|
|
3041
3041
|
status.dirty();
|
|
3042
3042
|
}
|
|
3043
|
-
} else if (
|
|
3044
|
-
if (input.data %
|
|
3043
|
+
} else if (check3.kind === "multipleOf") {
|
|
3044
|
+
if (input.data % check3.value !== BigInt(0)) {
|
|
3045
3045
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
3046
3046
|
addIssueToContext(ctx, {
|
|
3047
3047
|
code: ZodIssueCode.not_multiple_of,
|
|
3048
|
-
multipleOf:
|
|
3049
|
-
message:
|
|
3048
|
+
multipleOf: check3.value,
|
|
3049
|
+
message: check3.message
|
|
3050
3050
|
});
|
|
3051
3051
|
status.dirty();
|
|
3052
3052
|
}
|
|
3053
3053
|
} else {
|
|
3054
|
-
util.assertNever(
|
|
3054
|
+
util.assertNever(check3);
|
|
3055
3055
|
}
|
|
3056
3056
|
}
|
|
3057
3057
|
return { status: status.value, value: input.data };
|
|
@@ -3091,10 +3091,10 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
|
3091
3091
|
]
|
|
3092
3092
|
});
|
|
3093
3093
|
}
|
|
3094
|
-
_addCheck(
|
|
3094
|
+
_addCheck(check3) {
|
|
3095
3095
|
return new _ZodBigInt({
|
|
3096
3096
|
...this._def,
|
|
3097
|
-
checks: [...this._def.checks,
|
|
3097
|
+
checks: [...this._def.checks, check3]
|
|
3098
3098
|
});
|
|
3099
3099
|
}
|
|
3100
3100
|
positive(message) {
|
|
@@ -3214,35 +3214,35 @@ var ZodDate = class _ZodDate extends ZodType {
|
|
|
3214
3214
|
}
|
|
3215
3215
|
const status = new ParseStatus();
|
|
3216
3216
|
let ctx = void 0;
|
|
3217
|
-
for (const
|
|
3218
|
-
if (
|
|
3219
|
-
if (input.data.getTime() <
|
|
3217
|
+
for (const check3 of this._def.checks) {
|
|
3218
|
+
if (check3.kind === "min") {
|
|
3219
|
+
if (input.data.getTime() < check3.value) {
|
|
3220
3220
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
3221
3221
|
addIssueToContext(ctx, {
|
|
3222
3222
|
code: ZodIssueCode.too_small,
|
|
3223
|
-
message:
|
|
3223
|
+
message: check3.message,
|
|
3224
3224
|
inclusive: true,
|
|
3225
3225
|
exact: false,
|
|
3226
|
-
minimum:
|
|
3226
|
+
minimum: check3.value,
|
|
3227
3227
|
type: "date"
|
|
3228
3228
|
});
|
|
3229
3229
|
status.dirty();
|
|
3230
3230
|
}
|
|
3231
|
-
} else if (
|
|
3232
|
-
if (input.data.getTime() >
|
|
3231
|
+
} else if (check3.kind === "max") {
|
|
3232
|
+
if (input.data.getTime() > check3.value) {
|
|
3233
3233
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
3234
3234
|
addIssueToContext(ctx, {
|
|
3235
3235
|
code: ZodIssueCode.too_big,
|
|
3236
|
-
message:
|
|
3236
|
+
message: check3.message,
|
|
3237
3237
|
inclusive: true,
|
|
3238
3238
|
exact: false,
|
|
3239
|
-
maximum:
|
|
3239
|
+
maximum: check3.value,
|
|
3240
3240
|
type: "date"
|
|
3241
3241
|
});
|
|
3242
3242
|
status.dirty();
|
|
3243
3243
|
}
|
|
3244
3244
|
} else {
|
|
3245
|
-
util.assertNever(
|
|
3245
|
+
util.assertNever(check3);
|
|
3246
3246
|
}
|
|
3247
3247
|
}
|
|
3248
3248
|
return {
|
|
@@ -3250,10 +3250,10 @@ var ZodDate = class _ZodDate extends ZodType {
|
|
|
3250
3250
|
value: new Date(input.data.getTime())
|
|
3251
3251
|
};
|
|
3252
3252
|
}
|
|
3253
|
-
_addCheck(
|
|
3253
|
+
_addCheck(check3) {
|
|
3254
3254
|
return new _ZodDate({
|
|
3255
3255
|
...this._def,
|
|
3256
|
-
checks: [...this._def.checks,
|
|
3256
|
+
checks: [...this._def.checks, check3]
|
|
3257
3257
|
});
|
|
3258
3258
|
}
|
|
3259
3259
|
min(minDate, message) {
|
|
@@ -5113,10 +5113,10 @@ function cleanParams(params, data) {
|
|
|
5113
5113
|
const p2 = typeof p === "string" ? { message: p } : p;
|
|
5114
5114
|
return p2;
|
|
5115
5115
|
}
|
|
5116
|
-
function custom(
|
|
5117
|
-
if (
|
|
5116
|
+
function custom(check3, _params = {}, fatal) {
|
|
5117
|
+
if (check3)
|
|
5118
5118
|
return ZodAny.create().superRefine((data, ctx) => {
|
|
5119
|
-
const r =
|
|
5119
|
+
const r = check3(data);
|
|
5120
5120
|
if (r instanceof Promise) {
|
|
5121
5121
|
return r.then((r2) => {
|
|
5122
5122
|
if (!r2) {
|
|
@@ -6253,6 +6253,42 @@ pgTable(
|
|
|
6253
6253
|
index("content_ingestion_runs_project_idx").on(table.projectKey)
|
|
6254
6254
|
]
|
|
6255
6255
|
);
|
|
6256
|
+
pgTable(
|
|
6257
|
+
"refront_source_sync_state",
|
|
6258
|
+
{
|
|
6259
|
+
id: text("id").primaryKey().default("singleton"),
|
|
6260
|
+
boilerHeadSha: text("boiler_head_sha"),
|
|
6261
|
+
boilerTreeHash: text("boiler_tree_hash"),
|
|
6262
|
+
webHeadSha: text("web_head_sha"),
|
|
6263
|
+
webTreeHash: text("web_tree_hash"),
|
|
6264
|
+
status: text("status").notNull().default("idle"),
|
|
6265
|
+
direction: text("direction"),
|
|
6266
|
+
prRepoFullName: text("pr_repo_full_name"),
|
|
6267
|
+
prNumber: integer("pr_number"),
|
|
6268
|
+
prUrl: text("pr_url"),
|
|
6269
|
+
prBranch: text("pr_branch"),
|
|
6270
|
+
prExpectedTreeHash: text("pr_expected_tree_hash"),
|
|
6271
|
+
pendingBoilerHeadSha: text("pending_boiler_head_sha"),
|
|
6272
|
+
pendingBoilerTreeHash: text("pending_boiler_tree_hash"),
|
|
6273
|
+
pendingWebHeadSha: text("pending_web_head_sha"),
|
|
6274
|
+
pendingWebTreeHash: text("pending_web_tree_hash"),
|
|
6275
|
+
consumedWebHeadSha: text("consumed_web_head_sha"),
|
|
6276
|
+
consumedWebTreeHash: text("consumed_web_tree_hash"),
|
|
6277
|
+
conflictAttemptCount: integer("conflict_attempt_count").notNull().default(0),
|
|
6278
|
+
errorMessage: text("error_message"),
|
|
6279
|
+
lastCheckedAt: timestamp("last_checked_at", { withTimezone: true }),
|
|
6280
|
+
syncStartedAt: timestamp("sync_started_at", { withTimezone: true }),
|
|
6281
|
+
completedAt: timestamp("completed_at", { withTimezone: true }),
|
|
6282
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
6283
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
6284
|
+
},
|
|
6285
|
+
(table) => [
|
|
6286
|
+
check(
|
|
6287
|
+
"refront_source_sync_state_singleton_check",
|
|
6288
|
+
sql`${table.id} = 'singleton'`
|
|
6289
|
+
)
|
|
6290
|
+
]
|
|
6291
|
+
);
|
|
6256
6292
|
var repoFunnel = pgTable(
|
|
6257
6293
|
"repo_funnel",
|
|
6258
6294
|
{
|
|
@@ -7710,7 +7746,7 @@ function getEncryptionKey() {
|
|
|
7710
7746
|
throw new Error("ENCRYPTION_KEY must be a 64-character hex string");
|
|
7711
7747
|
return buf;
|
|
7712
7748
|
}
|
|
7713
|
-
function encrypt(
|
|
7749
|
+
function encrypt(text11) {
|
|
7714
7750
|
const key = getEncryptionKey();
|
|
7715
7751
|
const iv = randomBytes(ENC_IV_LENGTH);
|
|
7716
7752
|
const cipher = createCipheriv(
|
|
@@ -7718,7 +7754,7 @@ function encrypt(text10) {
|
|
|
7718
7754
|
new Uint8Array(key),
|
|
7719
7755
|
new Uint8Array(iv)
|
|
7720
7756
|
);
|
|
7721
|
-
let encrypted = cipher.update(
|
|
7757
|
+
let encrypted = cipher.update(text11, "utf8", "hex");
|
|
7722
7758
|
encrypted += cipher.final("hex");
|
|
7723
7759
|
const authTag = cipher.getAuthTag();
|
|
7724
7760
|
return Buffer.concat([
|
|
@@ -8438,10 +8474,10 @@ async function r2GetObjectRange(bucket, key, range) {
|
|
|
8438
8474
|
const body = result.Body;
|
|
8439
8475
|
if (!body?.transformToString)
|
|
8440
8476
|
throw new Error("R2 returned no readable body");
|
|
8441
|
-
const
|
|
8477
|
+
const text11 = await body.transformToString();
|
|
8442
8478
|
const header = `# range: bytes ${range.offset}-${end} of ${size} (${effectiveLen} bytes)`;
|
|
8443
8479
|
return `${header}
|
|
8444
|
-
${
|
|
8480
|
+
${text11}`;
|
|
8445
8481
|
} catch (e) {
|
|
8446
8482
|
throw r2WrapError(bucket, key, e);
|
|
8447
8483
|
}
|
|
@@ -8804,15 +8840,15 @@ async function sftpRead(opts, filePath, proxy, options) {
|
|
|
8804
8840
|
clearTimeout(timer);
|
|
8805
8841
|
cleanup?.();
|
|
8806
8842
|
cleanup = void 0;
|
|
8807
|
-
const
|
|
8843
|
+
const text11 = Buffer.concat(
|
|
8808
8844
|
chunks.map((ch) => new Uint8Array(ch))
|
|
8809
8845
|
).toString("utf-8");
|
|
8810
8846
|
if (!isWholeFileRequest) {
|
|
8811
8847
|
const header = `# range: bytes ${offset}-${offset + effectiveLen - 1} of ${total} (${effectiveLen} bytes)`;
|
|
8812
8848
|
resolve(`${header}
|
|
8813
|
-
${
|
|
8849
|
+
${text11}`);
|
|
8814
8850
|
} else {
|
|
8815
|
-
resolve(
|
|
8851
|
+
resolve(text11);
|
|
8816
8852
|
}
|
|
8817
8853
|
});
|
|
8818
8854
|
rs.on("error", (e) => {
|
|
@@ -8959,11 +8995,11 @@ function getKnownContainers(serverId, maxAgeMs = 5 * 6e4) {
|
|
|
8959
8995
|
if (Date.now() - e.capturedAt > maxAgeMs) return void 0;
|
|
8960
8996
|
return e.names;
|
|
8961
8997
|
}
|
|
8962
|
-
function truncateForLLM(
|
|
8963
|
-
const totalBytes = Buffer.byteLength(
|
|
8998
|
+
function truncateForLLM(text11, maxBytes) {
|
|
8999
|
+
const totalBytes = Buffer.byteLength(text11, "utf8");
|
|
8964
9000
|
if (totalBytes <= maxBytes)
|
|
8965
|
-
return { text:
|
|
8966
|
-
const buf = Buffer.from(
|
|
9001
|
+
return { text: text11, truncated: false, totalBytes, shownBytes: totalBytes };
|
|
9002
|
+
const buf = Buffer.from(text11, "utf8");
|
|
8967
9003
|
let cut = maxBytes;
|
|
8968
9004
|
while (cut > 0 && (buf[cut] & 192) === 128) cut--;
|
|
8969
9005
|
const head = buf.subarray(0, cut).toString("utf8");
|
|
@@ -8994,10 +9030,10 @@ function postprocessResult(result, meta) {
|
|
|
8994
9030
|
if (!result.content?.length) return result;
|
|
8995
9031
|
if (RAW_JSON_TOOLS.has(meta.toolName)) return result;
|
|
8996
9032
|
const block = result.content[0];
|
|
8997
|
-
let
|
|
8998
|
-
const trunc = truncateForLLM(
|
|
9033
|
+
let text11 = String(block.text ?? "");
|
|
9034
|
+
const trunc = truncateForLLM(text11, RESPONSE_MAX_BYTES);
|
|
8999
9035
|
if (trunc.truncated) {
|
|
9000
|
-
|
|
9036
|
+
text11 = trunc.text + "\n\n... " + buildTruncationHint(
|
|
9001
9037
|
meta.toolName,
|
|
9002
9038
|
meta.args,
|
|
9003
9039
|
trunc.totalBytes,
|
|
@@ -9011,11 +9047,11 @@ function postprocessResult(result, meta) {
|
|
|
9011
9047
|
const parts = [`took ${tookStr}`, sizeStr];
|
|
9012
9048
|
if (meta.serverIdLabel) parts.push(`server: ${meta.serverIdLabel}`);
|
|
9013
9049
|
if (meta.cached) parts.push("cached");
|
|
9014
|
-
|
|
9050
|
+
text11 = `${text11}
|
|
9015
9051
|
|
|
9016
9052
|
[${parts.join(", ")}]`;
|
|
9017
9053
|
}
|
|
9018
|
-
return { ...result, content: [{ ...block, text:
|
|
9054
|
+
return { ...result, content: [{ ...block, text: text11 }] };
|
|
9019
9055
|
}
|
|
9020
9056
|
function buildPipelineScript(commands, shell, marker, stopOnError) {
|
|
9021
9057
|
if (shell === "powershell") {
|
|
@@ -9801,11 +9837,11 @@ CREATE TABLE IF NOT EXISTS _mcp_migrations (
|
|
|
9801
9837
|
applied_by TEXT
|
|
9802
9838
|
);
|
|
9803
9839
|
`.trim();
|
|
9804
|
-
function normaliseMigrationSql(
|
|
9805
|
-
return
|
|
9840
|
+
function normaliseMigrationSql(sql27) {
|
|
9841
|
+
return sql27.replace(/\r\n/g, "\n").trim() + "\n";
|
|
9806
9842
|
}
|
|
9807
|
-
function migrationSha256(
|
|
9808
|
-
return createHash("sha256").update(
|
|
9843
|
+
function migrationSha256(sql27) {
|
|
9844
|
+
return createHash("sha256").update(sql27.replace(/\r\n/g, "\n"), "utf8").digest("hex");
|
|
9809
9845
|
}
|
|
9810
9846
|
function dollarQuoteTag(value) {
|
|
9811
9847
|
let tag = "_mcp";
|
|
@@ -11522,6 +11558,38 @@ var TOOLS = [
|
|
|
11522
11558
|
}
|
|
11523
11559
|
}
|
|
11524
11560
|
},
|
|
11561
|
+
{
|
|
11562
|
+
name: "search-wiki",
|
|
11563
|
+
description: "Search the team's curated knowledge wiki (the distilled layer ABOVE team memory): compiled pages about how systems actually work, customer setups/quirks, and known recurring issues with their standard fixes. Check this BEFORE search-team-memory \u2014 it is smaller, curated, and deduplicated, so a hit here is usually the complete answer. Every page lists its `sources` (team-memory ids, ticket numbers, commits): follow those with get-team-memory for full raw detail instead of broad searches. Fall back to search-team-memory when nothing relevant comes back or the page's `updated` date looks stale.",
|
|
11564
|
+
inputSchema: {
|
|
11565
|
+
type: "object",
|
|
11566
|
+
properties: {
|
|
11567
|
+
query: {
|
|
11568
|
+
type: "string",
|
|
11569
|
+
description: "The topic/problem in natural language, e.g. 'deploy pipeline failure modes' or 'customer acme integrations'."
|
|
11570
|
+
},
|
|
11571
|
+
limit: {
|
|
11572
|
+
type: "number",
|
|
11573
|
+
description: "Max pages to return (1-20, default 5)."
|
|
11574
|
+
}
|
|
11575
|
+
},
|
|
11576
|
+
required: ["query"]
|
|
11577
|
+
}
|
|
11578
|
+
},
|
|
11579
|
+
{
|
|
11580
|
+
name: "get-wiki-page",
|
|
11581
|
+
description: "Fetch one full knowledge-wiki page (markdown + frontmatter + sources) by the `slug` from a search-wiki result. The `sources` list is the provenance: team-memory ids (fetch via get-team-memory), ticket numbers, and commits.",
|
|
11582
|
+
inputSchema: {
|
|
11583
|
+
type: "object",
|
|
11584
|
+
properties: {
|
|
11585
|
+
slug: {
|
|
11586
|
+
type: "string",
|
|
11587
|
+
description: "Page slug from a search-wiki hit, e.g. 'wiki/engineering/team-memory'."
|
|
11588
|
+
}
|
|
11589
|
+
},
|
|
11590
|
+
required: ["slug"]
|
|
11591
|
+
}
|
|
11592
|
+
},
|
|
11525
11593
|
// ----- Cursor Remote (Agent Control) -----
|
|
11526
11594
|
{
|
|
11527
11595
|
name: "cursor-remote-list",
|
|
@@ -11943,6 +12011,114 @@ ${facets.join(", ")}` : ""),
|
|
|
11943
12011
|
]
|
|
11944
12012
|
};
|
|
11945
12013
|
}
|
|
12014
|
+
// ----- Knowledge wiki: search -----
|
|
12015
|
+
case "search-wiki": {
|
|
12016
|
+
const query = typeof a.query === "string" ? a.query.trim() : "";
|
|
12017
|
+
if (!query) {
|
|
12018
|
+
return { content: [{ type: "text", text: "Error: query is required" }] };
|
|
12019
|
+
}
|
|
12020
|
+
const res = await fetch(`${dashboardBaseUrl}/api/wiki/search`, {
|
|
12021
|
+
method: "POST",
|
|
12022
|
+
headers: {
|
|
12023
|
+
"content-type": "application/json",
|
|
12024
|
+
authorization: `Bearer ${apiKey}`
|
|
12025
|
+
},
|
|
12026
|
+
body: JSON.stringify({
|
|
12027
|
+
query,
|
|
12028
|
+
limit: typeof a.limit === "number" ? a.limit : void 0
|
|
12029
|
+
})
|
|
12030
|
+
});
|
|
12031
|
+
if (!res.ok) {
|
|
12032
|
+
const detail = await res.text().catch(() => "");
|
|
12033
|
+
return {
|
|
12034
|
+
content: [
|
|
12035
|
+
{
|
|
12036
|
+
type: "text",
|
|
12037
|
+
text: `Error: wiki search failed (${res.status}). ${detail.slice(0, 300)}`
|
|
12038
|
+
}
|
|
12039
|
+
]
|
|
12040
|
+
};
|
|
12041
|
+
}
|
|
12042
|
+
const data = await res.json();
|
|
12043
|
+
if (data.count === 0) {
|
|
12044
|
+
return {
|
|
12045
|
+
content: [
|
|
12046
|
+
{
|
|
12047
|
+
type: "text",
|
|
12048
|
+
text: "No wiki pages matched. Fall back to search-team-memory for raw history \u2014 repeated misses here become insight-scout signals automatically."
|
|
12049
|
+
}
|
|
12050
|
+
]
|
|
12051
|
+
};
|
|
12052
|
+
}
|
|
12053
|
+
const lines = data.hits.map((hit, index8) => {
|
|
12054
|
+
const sim = hit.similarity !== null ? ` \xB7 ${Math.round(hit.similarity * 100)}% match` : "";
|
|
12055
|
+
const tags = hit.tags.length ? ` \xB7 ${hit.tags.slice(0, 5).join(", ")}` : "";
|
|
12056
|
+
const sources = hit.sources.length ? `
|
|
12057
|
+
sources: ${hit.sources.slice(0, 6).map((s) => `${s.type}:${s.ref}`).join(", ")}` : "";
|
|
12058
|
+
return `${index8 + 1}. [${hit.status} \xB7 updated ${hit.pageUpdatedOn ?? "unknown"}${sim}${tags}] ${hit.title}
|
|
12059
|
+
slug: ${hit.slug}${sources}
|
|
12060
|
+
${(hit.summary ?? hit.snippet).replace(/\s+/g, " ").slice(0, 400)}`;
|
|
12061
|
+
});
|
|
12062
|
+
return {
|
|
12063
|
+
content: [
|
|
12064
|
+
{
|
|
12065
|
+
type: "text",
|
|
12066
|
+
text: `Found ${data.count} wiki page(s) (${data.mode} search) \u2014 curated team knowledge.
|
|
12067
|
+
Call get-wiki-page with a slug for the full page; follow its sources (team-memory ids, tickets) for raw detail. Treat stale \`updated\` dates as a signal to also check team memory.
|
|
12068
|
+
|
|
12069
|
+
` + lines.join("\n\n")
|
|
12070
|
+
}
|
|
12071
|
+
]
|
|
12072
|
+
};
|
|
12073
|
+
}
|
|
12074
|
+
// ----- Knowledge wiki: full page -----
|
|
12075
|
+
case "get-wiki-page": {
|
|
12076
|
+
const slug = typeof a.slug === "string" ? a.slug.trim() : "";
|
|
12077
|
+
if (!slug) {
|
|
12078
|
+
return { content: [{ type: "text", text: "Error: slug is required" }] };
|
|
12079
|
+
}
|
|
12080
|
+
const res = await fetch(`${dashboardBaseUrl}/api/wiki/page`, {
|
|
12081
|
+
method: "POST",
|
|
12082
|
+
headers: {
|
|
12083
|
+
"content-type": "application/json",
|
|
12084
|
+
authorization: `Bearer ${apiKey}`
|
|
12085
|
+
},
|
|
12086
|
+
body: JSON.stringify({ slug })
|
|
12087
|
+
});
|
|
12088
|
+
if (!res.ok) {
|
|
12089
|
+
const detail = await res.text().catch(() => "");
|
|
12090
|
+
return {
|
|
12091
|
+
content: [
|
|
12092
|
+
{
|
|
12093
|
+
type: "text",
|
|
12094
|
+
text: `Error: wiki page fetch failed (${res.status}). ${detail.slice(0, 300)}`
|
|
12095
|
+
}
|
|
12096
|
+
]
|
|
12097
|
+
};
|
|
12098
|
+
}
|
|
12099
|
+
const data = await res.json();
|
|
12100
|
+
if (!data.found || !data.page) {
|
|
12101
|
+
return {
|
|
12102
|
+
content: [
|
|
12103
|
+
{ type: "text", text: `No wiki page found for slug "${slug}".` }
|
|
12104
|
+
]
|
|
12105
|
+
};
|
|
12106
|
+
}
|
|
12107
|
+
const page = data.page;
|
|
12108
|
+
const sources = page.sources.length ? `
|
|
12109
|
+
Sources: ${page.sources.map((s) => `${s.type}:${s.ref}`).join(", ")}` : "";
|
|
12110
|
+
return {
|
|
12111
|
+
content: [
|
|
12112
|
+
{
|
|
12113
|
+
type: "text",
|
|
12114
|
+
text: `# ${page.title}
|
|
12115
|
+
[${page.slug} \xB7 ${page.status} \xB7 updated ${page.pageUpdatedOn ?? "unknown"}` + (page.tags.length ? ` \xB7 ${page.tags.join(", ")}` : "") + `]${sources}
|
|
12116
|
+
|
|
12117
|
+
` + page.content
|
|
12118
|
+
}
|
|
12119
|
+
]
|
|
12120
|
+
};
|
|
12121
|
+
}
|
|
11946
12122
|
// ----- Cursor Remote (Agent Control) -----
|
|
11947
12123
|
case "cursor-remote-list": {
|
|
11948
12124
|
const onlineOnly = a.onlineOnly === true;
|
|
@@ -13026,8 +13202,8 @@ ${sample.join("\n")}${files.length > 5 ? `
|
|
|
13026
13202
|
};
|
|
13027
13203
|
const filtered = sortRows(applyFilter(only.rows));
|
|
13028
13204
|
if (format === "json") {
|
|
13029
|
-
const
|
|
13030
|
-
return { content: [{ type: "text", text:
|
|
13205
|
+
const text12 = filtered.map((c) => JSON.stringify(c)).join("\n") || "(no containers)";
|
|
13206
|
+
return { content: [{ type: "text", text: text12 }] };
|
|
13031
13207
|
}
|
|
13032
13208
|
if (groupByProject) {
|
|
13033
13209
|
const groups = /* @__PURE__ */ new Map();
|
|
@@ -13054,8 +13230,8 @@ ${sample.join("\n")}${files.length > 5 ? `
|
|
|
13054
13230
|
}
|
|
13055
13231
|
const header = `${"NAMES".padEnd(36)} ${"IMAGE".padEnd(40)} ${"STATUS".padEnd(24)} ${"HEALTH".padEnd(10)} ${"PORTS".padEnd(40)} PROJECT`;
|
|
13056
13232
|
const body = filtered.map((r) => `${fmtRow(r)} ${r.Project || ""}`);
|
|
13057
|
-
const
|
|
13058
|
-
return { content: [{ type: "text", text:
|
|
13233
|
+
const text11 = filtered.length === 0 ? "(no containers match)" : [header, ...body].join("\n");
|
|
13234
|
+
return { content: [{ type: "text", text: text11 }] };
|
|
13059
13235
|
}
|
|
13060
13236
|
if (format === "json") {
|
|
13061
13237
|
const lines = [];
|
package/package.json
CHANGED