@hasna/todos 0.15.46 → 0.15.49
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/dashboard/dist/assets/index-BNQ4gJua.js +342 -0
- package/dashboard/dist/assets/index-DjzvHUWt.css +1 -0
- package/dashboard/dist/index.html +2 -2
- package/dist/cli/commands/query-commands.d.ts.map +1 -1
- package/dist/cli/components/Dashboard.d.ts +1 -1
- package/dist/cli/components/Dashboard.d.ts.map +1 -1
- package/dist/cli/components/Header.d.ts +1 -1
- package/dist/cli/components/Header.d.ts.map +1 -1
- package/dist/cli/components/ProjectList.d.ts +1 -1
- package/dist/cli/components/ProjectList.d.ts.map +1 -1
- package/dist/cli/components/SearchView.d.ts +1 -1
- package/dist/cli/components/SearchView.d.ts.map +1 -1
- package/dist/cli/components/TaskDetail.d.ts +1 -1
- package/dist/cli/components/TaskDetail.d.ts.map +1 -1
- package/dist/cli/components/TaskForm.d.ts +1 -1
- package/dist/cli/components/TaskForm.d.ts.map +1 -1
- package/dist/cli/components/TaskList.d.ts +1 -1
- package/dist/cli/components/TaskList.d.ts.map +1 -1
- package/dist/cli/index.js +671 -155
- package/dist/contracts.js +396 -82
- package/dist/db/task-crud.d.ts +6 -0
- package/dist/db/task-crud.d.ts.map +1 -1
- package/dist/db/tasks.d.ts +1 -1
- package/dist/db/tasks.d.ts.map +1 -1
- package/dist/db/webhooks.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +561 -143
- package/dist/lib/dedupe-projection.d.ts +48 -0
- package/dist/lib/dedupe-projection.d.ts.map +1 -0
- package/dist/lib/redaction.d.ts.map +1 -1
- package/dist/lib/task-dedupe.d.ts +5 -9
- package/dist/lib/task-dedupe.d.ts.map +1 -1
- package/dist/mcp/index.js +621 -154
- package/dist/mcp/tools/task-crud.d.ts.map +1 -1
- package/dist/mcp.js +6 -4
- package/dist/project-registration.js +502 -141
- package/dist/registry.js +396 -82
- package/dist/release-provenance.json +5 -5
- package/dist/server/cloud.d.ts.map +1 -1
- package/dist/server/index.js +1278 -342
- package/dist/server/routes.d.ts.map +1 -1
- package/dist/server/v1.d.ts.map +1 -1
- package/dist/storage/postgres-adapter.d.ts.map +1 -1
- package/dist/storage/postgres-errors.d.ts +15 -0
- package/dist/storage/postgres-errors.d.ts.map +1 -0
- package/dist/storage/postgres-sync.d.ts +7 -0
- package/dist/storage/postgres-sync.d.ts.map +1 -1
- package/dist/storage/shadow-outbox.d.ts.map +1 -1
- package/dist/storage/shadow.d.ts.map +1 -1
- package/dist/storage.js +510 -137
- package/dist/task-manifest.js +118 -47
- package/dist/task-subtree-transfer.js +326 -44
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +6 -4
- package/dashboard/dist/assets/index-DJm6m6Yy.css +0 -1
- package/dashboard/dist/assets/index-DVotjwab.js +0 -346
package/dist/server/index.js
CHANGED
|
@@ -70,7 +70,7 @@ var package_default;
|
|
|
70
70
|
var init_package = __esm(() => {
|
|
71
71
|
package_default = {
|
|
72
72
|
name: "@hasna/todos",
|
|
73
|
-
version: "0.15.
|
|
73
|
+
version: "0.15.49",
|
|
74
74
|
description: "Universal task management for AI coding agents - CLI + MCP server + interactive TUI",
|
|
75
75
|
type: "module",
|
|
76
76
|
main: "dist/index.js",
|
|
@@ -134,6 +134,7 @@ var init_package = __esm(() => {
|
|
|
134
134
|
],
|
|
135
135
|
scripts: {
|
|
136
136
|
build: "rm -rf dist dashboard/dist && cd dashboard && bun install --frozen-lockfile && bun run build && cd .. && bun build src/cli/index.tsx --outdir dist/cli --target bun --external ink --external react --external chalk --external @modelcontextprotocol/sdk --external '@hasna/contracts' --external '@hasna/contracts/*' && bun build src/mcp/index.ts --outdir dist/mcp --target bun --external @modelcontextprotocol/sdk --external '@hasna/contracts' --external '@hasna/contracts/*' && bun build src/server/index.ts --outdir dist/server --target bun && bun build src/sdk/index.ts --outdir dist/sdk --target bun --external '@hasna/contracts' --external '@hasna/contracts/*' && bun build src/index.ts src/mcp.ts src/registry.ts src/contracts.ts src/storage.ts src/testing.ts src/project-registration.ts src/task-manifest.ts src/task-subtree-transfer.ts --outdir dist --root src --target bun --external '@hasna/contracts' --external '@hasna/contracts/*' && tsc --emitDeclarationOnly --outDir dist",
|
|
137
|
+
"build:js": "rm -rf dist && bun build src/cli/index.tsx --outdir dist/cli --target bun --external ink --external react --external chalk --external @modelcontextprotocol/sdk --external '@hasna/contracts' --external '@hasna/contracts/*' && bun build src/mcp/index.ts --outdir dist/mcp --target bun --external @modelcontextprotocol/sdk --external '@hasna/contracts' --external '@hasna/contracts/*' && bun build src/server/index.ts --outdir dist/server --target bun && bun build src/sdk/index.ts --outdir dist/sdk --target bun --external '@hasna/contracts' --external '@hasna/contracts/*' && bun build src/index.ts src/mcp.ts src/registry.ts src/contracts.ts src/storage.ts src/testing.ts src/project-registration.ts src/task-manifest.ts src/task-subtree-transfer.ts --outdir dist --root src --target bun --external '@hasna/contracts' --external '@hasna/contracts/*' && tsc --emitDeclarationOnly --outDir dist",
|
|
137
138
|
"build:server": "rm -rf dist && bun build src/cli/index.tsx --outdir dist/cli --target bun --external ink --external react --external chalk --external @modelcontextprotocol/sdk --external '@hasna/contracts' --external '@hasna/contracts/*' && bun build src/mcp/index.ts --outdir dist/mcp --target bun --external @modelcontextprotocol/sdk --external '@hasna/contracts' --external '@hasna/contracts/*' && bun build src/server/index.ts --outdir dist/server --target bun && bun build src/sdk/index.ts --outdir dist/sdk --target bun --external '@hasna/contracts' --external '@hasna/contracts/*' && bun build src/index.ts src/mcp.ts src/registry.ts src/contracts.ts src/storage.ts src/testing.ts src/project-registration.ts src/task-manifest.ts src/task-subtree-transfer.ts --outdir dist --target bun --external '@hasna/contracts' --external '@hasna/contracts/*'",
|
|
138
139
|
migrate: "bun run src/server/index.ts migrate",
|
|
139
140
|
"backfill:comment-redaction": "bun run src/server/index.ts redact-comments",
|
|
@@ -188,18 +189,19 @@ var init_package = __esm(() => {
|
|
|
188
189
|
author: "Andrei Hasna <andrei@hasna.com>",
|
|
189
190
|
license: "Apache-2.0",
|
|
190
191
|
dependencies: {
|
|
191
|
-
"@hasna/contracts": "0.
|
|
192
|
+
"@hasna/contracts": "0.14.0",
|
|
192
193
|
"@hasna/events": "^0.1.11",
|
|
193
194
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
194
195
|
chalk: "^5.4.1",
|
|
195
196
|
commander: "^13.1.0",
|
|
196
197
|
ink: "^5.2.0",
|
|
197
198
|
react: "^18.3.1",
|
|
198
|
-
zod: "
|
|
199
|
+
zod: "3.25.76"
|
|
199
200
|
},
|
|
200
201
|
overrides: {
|
|
201
202
|
ajv: "8.20.0",
|
|
202
|
-
"fast-uri": "3.1.2"
|
|
203
|
+
"fast-uri": "3.1.2",
|
|
204
|
+
zod: "3.25.76"
|
|
203
205
|
},
|
|
204
206
|
devDependencies: {
|
|
205
207
|
"@types/bun": "^1.2.4",
|
|
@@ -223,7 +225,7 @@ var init_package_version = __esm(() => {
|
|
|
223
225
|
init_package();
|
|
224
226
|
});
|
|
225
227
|
|
|
226
|
-
// node_modules/.bun/@hasna+contracts@0.
|
|
228
|
+
// node_modules/.bun/@hasna+contracts@0.14.0+619f74e7b30eeaf4/node_modules/@hasna/contracts/dist/auth/index.js
|
|
227
229
|
import { createHash, createHmac, randomBytes, timingSafeEqual } from "crypto";
|
|
228
230
|
function isValidTenantId(value) {
|
|
229
231
|
return typeof value === "string" && TENANT_ID_PATTERN.test(value);
|
|
@@ -1646,13 +1648,15 @@ function upsertSecretSafetyConfig(input) {
|
|
|
1646
1648
|
saveConfig({ ...config, secret_safety: next });
|
|
1647
1649
|
return next;
|
|
1648
1650
|
}
|
|
1649
|
-
var DEFAULT_SECRET_PATTERNS, DEFAULT_SECRET_KEY_PATTERN, NON_SECRET_USAGE_KEYS, REDACTION_PLACEHOLDER;
|
|
1651
|
+
var XAI_PREFIX, DEFAULT_SECRET_PATTERNS, DEFAULT_SECRET_KEY_PATTERN, NON_SECRET_USAGE_KEYS, REDACTION_PLACEHOLDER;
|
|
1650
1652
|
var init_redaction = __esm(() => {
|
|
1651
1653
|
init_config2();
|
|
1654
|
+
XAI_PREFIX = ["x", "ai", "-"].join("");
|
|
1652
1655
|
DEFAULT_SECRET_PATTERNS = [
|
|
1653
1656
|
{ name: "aws-access-key", regex: /\b(AKIA|ASIA)[0-9A-Z]{16}\b/g, replacement: "[REDACTED_AWS_KEY]" },
|
|
1654
1657
|
{ name: "private-key", regex: /-----BEGIN (?:RSA |EC |OPENSSH |)PRIVATE KEY-----[\s\S]*?-----END (?:RSA |EC |OPENSSH |)PRIVATE KEY-----/g, replacement: "[REDACTED_PRIVATE_KEY]" },
|
|
1655
1658
|
{ name: "openai-token", regex: /\bsk-[A-Za-z0-9_-]{12,}\b/g, replacement: "[REDACTED_TOKEN]" },
|
|
1659
|
+
{ name: `${XAI_PREFIX}token`, regex: /\bxai[-][A-Za-z0-9]{20,80}\b/g, replacement: "[REDACTED_TOKEN]" },
|
|
1656
1660
|
{ name: "npm-token", regex: /\bnpm_[A-Za-z0-9]{20,}\b/g, replacement: "[REDACTED_NPM_TOKEN]" },
|
|
1657
1661
|
{ name: "github-fine-grained-token", regex: /\bgithub_pat_[A-Za-z0-9_]{20,}\b/g, replacement: "[REDACTED_GITHUB_TOKEN]" },
|
|
1658
1662
|
{ name: "github-token", regex: /\bgh[opsu]_[A-Za-z0-9]{20,}\b/g, replacement: "[REDACTED_GITHUB_TOKEN]" },
|
|
@@ -2059,6 +2063,27 @@ function validateSnapshotRoutingDestinationConflicts(projects, taskLists, existi
|
|
|
2059
2063
|
return errors;
|
|
2060
2064
|
}
|
|
2061
2065
|
|
|
2066
|
+
// src/storage/postgres-errors.ts
|
|
2067
|
+
function isPostgresUniqueViolation(error) {
|
|
2068
|
+
if (typeof error !== "object" || error === null)
|
|
2069
|
+
return false;
|
|
2070
|
+
const candidate = error;
|
|
2071
|
+
const states = [candidate.code, candidate.errno, candidate.sqlState, candidate.sqlstate];
|
|
2072
|
+
if (typeof candidate.cause === "object" && candidate.cause !== null) {
|
|
2073
|
+
const cause = candidate.cause;
|
|
2074
|
+
states.push(cause.code, cause.errno, cause.sqlState, cause.sqlstate);
|
|
2075
|
+
}
|
|
2076
|
+
return states.some((state) => String(state) === "23505");
|
|
2077
|
+
}
|
|
2078
|
+
function postgresConstraintName(error) {
|
|
2079
|
+
if (typeof error !== "object" || error === null)
|
|
2080
|
+
return "";
|
|
2081
|
+
const candidate = error;
|
|
2082
|
+
const cause = typeof candidate.cause === "object" && candidate.cause !== null ? candidate.cause : undefined;
|
|
2083
|
+
const constraint = candidate.constraint ?? candidate.constraint_name ?? cause?.constraint ?? cause?.constraint_name;
|
|
2084
|
+
return typeof constraint === "string" ? constraint : "";
|
|
2085
|
+
}
|
|
2086
|
+
|
|
2062
2087
|
// src/storage/postgres-sync.ts
|
|
2063
2088
|
function postgresTodosSyncSchemaSql(tableName = DEFAULT_TODOS_POSTGRES_SYNC_TABLE, cursorTableName = DEFAULT_TODOS_POSTGRES_CURSOR_TABLE) {
|
|
2064
2089
|
assertSafeIdentifier(tableName);
|
|
@@ -2253,53 +2278,98 @@ class PostgresTodosSyncStore {
|
|
|
2253
2278
|
if (routingErrors.length > 0) {
|
|
2254
2279
|
throw new Error(`Invalid snapshot routing metadata: ${routingErrors.join("; ")}`);
|
|
2255
2280
|
}
|
|
2256
|
-
const
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
const
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2281
|
+
const push = async (client) => {
|
|
2282
|
+
const existing = await client.query(`SELECT object_type, object_id, payload, updated_at, deleted_at, source_machine_id, version
|
|
2283
|
+
FROM ${this.tableName}
|
|
2284
|
+
WHERE service = $1 AND object_type IN ($2, $3) AND deleted_at IS NULL`, [this.service, "projects", "task_lists"]);
|
|
2285
|
+
const existingProjects = [];
|
|
2286
|
+
const existingTaskLists = [];
|
|
2287
|
+
for (const row of existing.rows) {
|
|
2288
|
+
const payload = payloadRecord(row.payload);
|
|
2289
|
+
if (row.object_type === "projects")
|
|
2290
|
+
existingProjects.push(payload);
|
|
2291
|
+
if (row.object_type === "task_lists")
|
|
2292
|
+
existingTaskLists.push(payload);
|
|
2293
|
+
}
|
|
2294
|
+
const destinationErrors = validateSnapshotRoutingDestinationConflicts(snapshot.projects, snapshot.taskLists, existingProjects, existingTaskLists);
|
|
2295
|
+
if (destinationErrors.length > 0) {
|
|
2296
|
+
throw new ResourceConflictError("SNAPSHOT_DESTINATION_CONFLICT", `Snapshot routing conflicts with destination: ${destinationErrors.join("; ")}`);
|
|
2297
|
+
}
|
|
2298
|
+
const result = { records: 0, objectTypes: {} };
|
|
2299
|
+
const sourceMachineId = context.requestId ?? this.sourceMachineId ?? null;
|
|
2300
|
+
for (const entry of snapshotEntries(snapshot)) {
|
|
2301
|
+
if (entry.deletedAt === null)
|
|
2302
|
+
assertCanonicalScopedSlugEntry(entry);
|
|
2303
|
+
try {
|
|
2304
|
+
await client.query(`INSERT INTO ${this.tableName} (
|
|
2305
|
+
service, object_type, object_id, payload, updated_at,
|
|
2306
|
+
deleted_at, source_machine_id, version
|
|
2307
|
+
) VALUES ($1, $2, $3, $4::jsonb, $5::timestamptz, $6::timestamptz, $7, $8)
|
|
2308
|
+
ON CONFLICT (service, object_type, object_id) DO UPDATE SET
|
|
2309
|
+
payload = EXCLUDED.payload,
|
|
2310
|
+
updated_at = EXCLUDED.updated_at,
|
|
2311
|
+
deleted_at = EXCLUDED.deleted_at,
|
|
2312
|
+
source_machine_id = EXCLUDED.source_machine_id,
|
|
2313
|
+
version = EXCLUDED.version
|
|
2314
|
+
WHERE ${this.tableName}.updated_at < EXCLUDED.updated_at
|
|
2315
|
+
OR (${this.tableName}.updated_at = EXCLUDED.updated_at
|
|
2316
|
+
AND COALESCE(${this.tableName}.version, 0) <= COALESCE(EXCLUDED.version, 0))`, [
|
|
2317
|
+
this.service,
|
|
2318
|
+
entry.type,
|
|
2319
|
+
entry.id,
|
|
2320
|
+
entry.payload,
|
|
2321
|
+
entry.updatedAt,
|
|
2322
|
+
entry.deletedAt,
|
|
2323
|
+
sourceMachineId,
|
|
2324
|
+
entry.version
|
|
2325
|
+
]);
|
|
2326
|
+
} catch (error) {
|
|
2327
|
+
await this.classifySyncInsertConflict(error, entry);
|
|
2328
|
+
}
|
|
2329
|
+
result.records += 1;
|
|
2330
|
+
result.objectTypes[entry.type] = (result.objectTypes[entry.type] ?? 0) + 1;
|
|
2331
|
+
}
|
|
2332
|
+
return result;
|
|
2333
|
+
};
|
|
2334
|
+
if (typeof this.client.transaction === "function") {
|
|
2335
|
+
return this.client.transaction((client) => push(client));
|
|
2301
2336
|
}
|
|
2302
|
-
return
|
|
2337
|
+
return push(this.client);
|
|
2338
|
+
}
|
|
2339
|
+
async classifySyncInsertConflict(error, entry) {
|
|
2340
|
+
if (!isPostgresUniqueViolation(error))
|
|
2341
|
+
throw error;
|
|
2342
|
+
const payload = entry.payload;
|
|
2343
|
+
const taskListSlug = String(payload["slug"] ?? "");
|
|
2344
|
+
const projectSlug = String(payload["task_list_id"] ?? "");
|
|
2345
|
+
const constraintName = postgresConstraintName(error);
|
|
2346
|
+
if (entry.type === "projects" && constraintName.includes("project_task_list_slug_uidx")) {
|
|
2347
|
+
throw new ResourceConflictError("PROJECT_SLUG_CONFLICT", `Project slug "${projectSlug}" already exists`);
|
|
2348
|
+
}
|
|
2349
|
+
if (entry.type === "task_lists" && constraintName.includes("task_list_scope_slug_uidx")) {
|
|
2350
|
+
throw new ResourceConflictError("TASK_LIST_SLUG_CONFLICT", `Task list with slug "${taskListSlug}" already exists in this scope`);
|
|
2351
|
+
}
|
|
2352
|
+
if (entry.type === "task_lists") {
|
|
2353
|
+
const scope = typeof payload["project_id"] === "string" ? payload["project_id"] : "";
|
|
2354
|
+
const conflict = await this.client.query(`/* todos:classify-sync-task-list-conflict */ SELECT EXISTS (
|
|
2355
|
+
SELECT 1 FROM ${this.tableName}
|
|
2356
|
+
WHERE service = $1 AND object_type = 'task_lists' AND object_id <> $2
|
|
2357
|
+
AND deleted_at IS NULL AND COALESCE(payload->>'project_id','') = $3 AND payload->>'slug' = $4
|
|
2358
|
+
) AS conflict`, [this.service, entry.id, scope, taskListSlug]);
|
|
2359
|
+
if (conflict.rows[0]?.conflict) {
|
|
2360
|
+
throw new ResourceConflictError("TASK_LIST_SLUG_CONFLICT", `Task list with slug "${taskListSlug}" already exists in this scope`);
|
|
2361
|
+
}
|
|
2362
|
+
} else if (entry.type === "projects") {
|
|
2363
|
+
const conflict = await this.client.query(`/* todos:classify-sync-project-conflict */ SELECT EXISTS (
|
|
2364
|
+
SELECT 1 FROM ${this.tableName}
|
|
2365
|
+
WHERE service = $1 AND object_type = 'projects' AND object_id <> $2
|
|
2366
|
+
AND deleted_at IS NULL AND payload->>'task_list_id' = $3
|
|
2367
|
+
) AS conflict`, [this.service, entry.id, projectSlug]);
|
|
2368
|
+
if (conflict.rows[0]?.conflict) {
|
|
2369
|
+
throw new ResourceConflictError("PROJECT_SLUG_CONFLICT", `Project slug "${projectSlug}" already exists`);
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
throw error;
|
|
2303
2373
|
}
|
|
2304
2374
|
async pullSnapshot(options = {}) {
|
|
2305
2375
|
const params = [this.service];
|
|
@@ -2456,6 +2526,7 @@ function assertSafeIdentifier(value) {
|
|
|
2456
2526
|
}
|
|
2457
2527
|
var DEFAULT_TODOS_POSTGRES_SYNC_TABLE = "todos_sync_records", DEFAULT_TODOS_POSTGRES_CURSOR_TABLE = "todos_sync_cursors", PostgresScopedSlugMigrationConflictError, PostgresScopedSlugIndexBuildError;
|
|
2458
2528
|
var init_postgres_sync = __esm(() => {
|
|
2529
|
+
init_types();
|
|
2459
2530
|
PostgresScopedSlugMigrationConflictError = class PostgresScopedSlugMigrationConflictError extends Error {
|
|
2460
2531
|
conflicts;
|
|
2461
2532
|
constructor(conflicts) {
|
|
@@ -2954,9 +3025,11 @@ class PostgresJsonRecordStore {
|
|
|
2954
3025
|
async ensureSchema() {
|
|
2955
3026
|
if (!this.schemaReady) {
|
|
2956
3027
|
this.schemaReady = (async () => {
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
3028
|
+
await retryOnTransientPostgresError(async () => {
|
|
3029
|
+
for (const sql of postgresTodosSyncSchemaSql(this.tableName, this.cursorTableName)) {
|
|
3030
|
+
await this.options.client.query(sql);
|
|
3031
|
+
}
|
|
3032
|
+
});
|
|
2960
3033
|
})().catch((error) => {
|
|
2961
3034
|
this.schemaReady = null;
|
|
2962
3035
|
throw error;
|
|
@@ -3370,13 +3443,14 @@ class PostgresJsonRecordStore {
|
|
|
3370
3443
|
throw new Error(divergentAuditHistoryReplayError(value.id));
|
|
3371
3444
|
}
|
|
3372
3445
|
async withTaskParentIntegrityTransaction(fn) {
|
|
3373
|
-
|
|
3446
|
+
const transaction = this.options.client.transaction;
|
|
3447
|
+
if (typeof transaction !== "function") {
|
|
3374
3448
|
throw new Error("TASK_PARENT_ATOMICITY_UNAVAILABLE: PostgreSQL parent writes and task deletion require transaction(callback)");
|
|
3375
3449
|
}
|
|
3376
|
-
return
|
|
3450
|
+
return retryOnTransientPostgresError(() => transaction(async (client) => {
|
|
3377
3451
|
await client.query("/* todos:task-parent-integrity-lock */ SELECT pg_advisory_xact_lock(hashtextextended($1 || ':task-parent-integrity', 0))", [this.service]);
|
|
3378
3452
|
return fn(client);
|
|
3379
|
-
});
|
|
3453
|
+
}));
|
|
3380
3454
|
}
|
|
3381
3455
|
async upsertTaskWithPlanMembershipGuard(value, guardedPlanIds, explicitProject, context = {}, parentGuard, queryClient) {
|
|
3382
3456
|
const planIds = [...new Set(guardedPlanIds.filter(Boolean))].sort();
|
|
@@ -5259,7 +5333,7 @@ function compareClock(left, right) {
|
|
|
5259
5333
|
function numberValue2(value) {
|
|
5260
5334
|
return typeof value === "number" && Number.isSafeInteger(value) ? value : null;
|
|
5261
5335
|
}
|
|
5262
|
-
function
|
|
5336
|
+
function isTransientPostgresError(error) {
|
|
5263
5337
|
if (typeof error !== "object" || error === null)
|
|
5264
5338
|
return false;
|
|
5265
5339
|
const candidate = error;
|
|
@@ -5268,17 +5342,27 @@ function isPostgresUniqueViolation(error) {
|
|
|
5268
5342
|
const cause = candidate.cause;
|
|
5269
5343
|
states.push(cause.code, cause.errno, cause.sqlState, cause.sqlstate);
|
|
5270
5344
|
}
|
|
5271
|
-
|
|
5345
|
+
if (states.some((state) => typeof state === "string" && TRANSIENT_POSTGRES_SQLSTATES.has(state))) {
|
|
5346
|
+
return true;
|
|
5347
|
+
}
|
|
5348
|
+
const message = typeof candidate.message === "string" ? candidate.message : candidate.cause?.message;
|
|
5349
|
+
return typeof message === "string" && TRANSIENT_POSTGRES_MESSAGE_MARKERS.some((marker) => message.includes(marker));
|
|
5272
5350
|
}
|
|
5273
|
-
function
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5351
|
+
async function retryOnTransientPostgresError(fn, attempts = 2, delayMs = 150) {
|
|
5352
|
+
let lastError;
|
|
5353
|
+
for (let attempt = 1;attempt <= attempts; attempt += 1) {
|
|
5354
|
+
try {
|
|
5355
|
+
return await fn();
|
|
5356
|
+
} catch (error) {
|
|
5357
|
+
lastError = error;
|
|
5358
|
+
if (!isTransientPostgresError(error) || attempt === attempts)
|
|
5359
|
+
throw error;
|
|
5360
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs * attempt));
|
|
5361
|
+
}
|
|
5362
|
+
}
|
|
5363
|
+
throw lastError;
|
|
5280
5364
|
}
|
|
5281
|
-
var CLOUD_LOCK_EXPIRY_MINUTES = 30, TASK_ORDER_TIEBREAK = "CASE payload->>'priority' WHEN 'critical' THEN 0 WHEN 'high' THEN 1 WHEN 'medium' THEN 2 WHEN 'low' THEN 3 ELSE 4 END ASC, payload->>'created_at' ASC, payload->>'id' ASC", TASK_ORDER_BY;
|
|
5365
|
+
var CLOUD_LOCK_EXPIRY_MINUTES = 30, TASK_ORDER_TIEBREAK = "CASE payload->>'priority' WHEN 'critical' THEN 0 WHEN 'high' THEN 1 WHEN 'medium' THEN 2 WHEN 'low' THEN 3 ELSE 4 END ASC, payload->>'created_at' ASC, payload->>'id' ASC", TASK_ORDER_BY, TRANSIENT_POSTGRES_SQLSTATES, TRANSIENT_POSTGRES_MESSAGE_MARKERS;
|
|
5282
5366
|
var init_postgres_adapter = __esm(() => {
|
|
5283
5367
|
init_types();
|
|
5284
5368
|
init_creator_identity();
|
|
@@ -5292,6 +5376,12 @@ var init_postgres_adapter = __esm(() => {
|
|
|
5292
5376
|
init_audit_history_import();
|
|
5293
5377
|
init_canonical();
|
|
5294
5378
|
TASK_ORDER_BY = `ORDER BY ${TASK_ORDER_TIEBREAK}`;
|
|
5379
|
+
TRANSIENT_POSTGRES_SQLSTATES = new Set(["55P03", "40P01", "40001"]);
|
|
5380
|
+
TRANSIENT_POSTGRES_MESSAGE_MARKERS = [
|
|
5381
|
+
"canceling statement due to lock timeout",
|
|
5382
|
+
"deadlock detected",
|
|
5383
|
+
"could not serialize access"
|
|
5384
|
+
];
|
|
5295
5385
|
});
|
|
5296
5386
|
|
|
5297
5387
|
// src/pr-groups/types.ts
|
|
@@ -13245,8 +13335,9 @@ var init_event_hooks = __esm(() => {
|
|
|
13245
13335
|
VALID_TARGETS = new Set(["stdout", "file", "socket", "script"]);
|
|
13246
13336
|
});
|
|
13247
13337
|
|
|
13248
|
-
// node_modules/.bun/@hasna+events@0.1.
|
|
13338
|
+
// node_modules/.bun/@hasna+events@0.1.16/node_modules/@hasna/events/dist/index.js
|
|
13249
13339
|
import { chmod, mkdir, readFile, rename, writeFile } from "fs/promises";
|
|
13340
|
+
import { Buffer as Buffer2 } from "buffer";
|
|
13250
13341
|
import { existsSync as existsSync6 } from "fs";
|
|
13251
13342
|
import { homedir as homedir2 } from "os";
|
|
13252
13343
|
import { join as join5 } from "path";
|
|
@@ -13355,11 +13446,13 @@ function getEventsDataDir(override) {
|
|
|
13355
13446
|
|
|
13356
13447
|
class JsonEventsStore {
|
|
13357
13448
|
dataDir;
|
|
13449
|
+
runtime;
|
|
13358
13450
|
channelsPath;
|
|
13359
13451
|
eventsPath;
|
|
13360
13452
|
deliveriesPath;
|
|
13361
13453
|
constructor(dataDir = getEventsDataDir()) {
|
|
13362
13454
|
this.dataDir = dataDir;
|
|
13455
|
+
this.runtime = localJsonRuntime(dataDir);
|
|
13363
13456
|
this.channelsPath = join5(dataDir, "channels.json");
|
|
13364
13457
|
this.eventsPath = join5(dataDir, "events.json");
|
|
13365
13458
|
this.deliveriesPath = join5(dataDir, "deliveries.json");
|
|
@@ -13407,13 +13500,58 @@ class JsonEventsStore {
|
|
|
13407
13500
|
await this.writeJson(this.eventsPath, events);
|
|
13408
13501
|
return event;
|
|
13409
13502
|
}
|
|
13410
|
-
async
|
|
13503
|
+
async appendEventOnce(event, options = {}) {
|
|
13504
|
+
await this.init();
|
|
13505
|
+
const events = await this.readJson(this.eventsPath, []);
|
|
13506
|
+
const dedupe = options.dedupe !== false;
|
|
13507
|
+
if (dedupe) {
|
|
13508
|
+
const existing = findEventByIdentity(events, { id: event.id, dedupeKey: event.dedupeKey });
|
|
13509
|
+
if (existing) {
|
|
13510
|
+
return {
|
|
13511
|
+
event: existing,
|
|
13512
|
+
stored: false,
|
|
13513
|
+
deduped: true,
|
|
13514
|
+
identity: { id: existing.id, dedupeKey: existing.dedupeKey }
|
|
13515
|
+
};
|
|
13516
|
+
}
|
|
13517
|
+
}
|
|
13518
|
+
events.push(event);
|
|
13519
|
+
await this.writeJson(this.eventsPath, events);
|
|
13520
|
+
return {
|
|
13521
|
+
event,
|
|
13522
|
+
stored: true,
|
|
13523
|
+
deduped: false,
|
|
13524
|
+
identity: { id: event.id, dedupeKey: event.dedupeKey }
|
|
13525
|
+
};
|
|
13526
|
+
}
|
|
13527
|
+
async listEvents(options = {}) {
|
|
13528
|
+
await this.init();
|
|
13529
|
+
const events = await this.readJson(this.eventsPath, []);
|
|
13530
|
+
return queryEvents(events, options);
|
|
13531
|
+
}
|
|
13532
|
+
async listEventsPage(options = {}) {
|
|
13411
13533
|
await this.init();
|
|
13412
|
-
|
|
13534
|
+
const events = await this.readJson(this.eventsPath, []);
|
|
13535
|
+
const queried = queryEvents(events, {
|
|
13536
|
+
eventId: options.eventId,
|
|
13537
|
+
source: options.source,
|
|
13538
|
+
type: options.type
|
|
13539
|
+
});
|
|
13540
|
+
const offset = decodeLocalJsonEventCursor(options.cursor, options);
|
|
13541
|
+
const limit = normalizeEventPageLimit(options.limit);
|
|
13542
|
+
const pageEvents = queried.slice(offset, offset + limit);
|
|
13543
|
+
const nextOffset = offset + pageEvents.length;
|
|
13544
|
+
const hasMore = nextOffset < queried.length;
|
|
13545
|
+
return {
|
|
13546
|
+
events: pageEvents,
|
|
13547
|
+
cursor: options.cursor,
|
|
13548
|
+
nextCursor: hasMore ? encodeLocalJsonEventCursor(nextOffset, options) : undefined,
|
|
13549
|
+
hasMore
|
|
13550
|
+
};
|
|
13413
13551
|
}
|
|
13414
13552
|
async findEventByIdentity(identity) {
|
|
13415
13553
|
const events = await this.listEvents();
|
|
13416
|
-
return events
|
|
13554
|
+
return findEventByIdentity(events, identity);
|
|
13417
13555
|
}
|
|
13418
13556
|
async appendDelivery(result) {
|
|
13419
13557
|
await this.init();
|
|
@@ -13464,6 +13602,83 @@ class JsonEventsStore {
|
|
|
13464
13602
|
});
|
|
13465
13603
|
}
|
|
13466
13604
|
}
|
|
13605
|
+
function localJsonRuntime(dataDir = getEventsDataDir()) {
|
|
13606
|
+
return {
|
|
13607
|
+
mode: "local-files",
|
|
13608
|
+
name: "json-events-store",
|
|
13609
|
+
remote: false,
|
|
13610
|
+
localFiles: true,
|
|
13611
|
+
localSqlite: false,
|
|
13612
|
+
postgres: false,
|
|
13613
|
+
s3: false,
|
|
13614
|
+
aws: false,
|
|
13615
|
+
durable: true,
|
|
13616
|
+
idempotency: "best-effort-local",
|
|
13617
|
+
replayCursors: true,
|
|
13618
|
+
description: `Local JSON files in ${dataDir}; no SQLite, Postgres, S3, or AWS runtime is configured by this store.`
|
|
13619
|
+
};
|
|
13620
|
+
}
|
|
13621
|
+
function encodeLocalJsonEventCursor(offset, options = {}) {
|
|
13622
|
+
if (!Number.isInteger(offset) || offset < 0)
|
|
13623
|
+
throw new Error(`Invalid event cursor offset: ${offset}`);
|
|
13624
|
+
const payload = {
|
|
13625
|
+
offset,
|
|
13626
|
+
eventId: options.eventId,
|
|
13627
|
+
source: options.source,
|
|
13628
|
+
type: options.type
|
|
13629
|
+
};
|
|
13630
|
+
return `${LOCAL_JSON_EVENT_CURSOR_PREFIX}${Buffer2.from(JSON.stringify(payload), "utf-8").toString("base64url")}`;
|
|
13631
|
+
}
|
|
13632
|
+
function decodeLocalJsonEventCursor(cursor, options = {}) {
|
|
13633
|
+
if (!cursor)
|
|
13634
|
+
return 0;
|
|
13635
|
+
if (!cursor.startsWith(LOCAL_JSON_EVENT_CURSOR_PREFIX))
|
|
13636
|
+
throw new Error(`Invalid local JSON event cursor: ${cursor}`);
|
|
13637
|
+
const rawPayload = cursor.slice(LOCAL_JSON_EVENT_CURSOR_PREFIX.length);
|
|
13638
|
+
let payload;
|
|
13639
|
+
try {
|
|
13640
|
+
payload = JSON.parse(Buffer2.from(rawPayload, "base64url").toString("utf-8"));
|
|
13641
|
+
} catch {
|
|
13642
|
+
throw new Error(`Invalid local JSON event cursor: ${cursor}`);
|
|
13643
|
+
}
|
|
13644
|
+
const offset = payload.offset;
|
|
13645
|
+
if (!Number.isInteger(offset) || offset < 0)
|
|
13646
|
+
throw new Error(`Invalid local JSON event cursor: ${cursor}`);
|
|
13647
|
+
assertCursorFilter("eventId", payload.eventId, options.eventId);
|
|
13648
|
+
assertCursorFilter("source", payload.source, options.source);
|
|
13649
|
+
assertCursorFilter("type", payload.type, options.type);
|
|
13650
|
+
return offset;
|
|
13651
|
+
}
|
|
13652
|
+
function normalizeEventPageLimit(limit) {
|
|
13653
|
+
if (limit === undefined)
|
|
13654
|
+
return DEFAULT_EVENT_PAGE_LIMIT;
|
|
13655
|
+
if (!Number.isInteger(limit) || limit < 1)
|
|
13656
|
+
throw new Error(`Event page limit must be a positive integer, got ${limit}`);
|
|
13657
|
+
return Math.min(limit, MAX_EVENT_PAGE_LIMIT);
|
|
13658
|
+
}
|
|
13659
|
+
function queryEvents(events, options) {
|
|
13660
|
+
let rows = events;
|
|
13661
|
+
if (options.eventId)
|
|
13662
|
+
rows = rows.filter((event) => event.id === options.eventId);
|
|
13663
|
+
if (options.source)
|
|
13664
|
+
rows = rows.filter((event) => event.source === options.source);
|
|
13665
|
+
if (options.type)
|
|
13666
|
+
rows = rows.filter((event) => event.type === options.type);
|
|
13667
|
+
if (options.cursor) {
|
|
13668
|
+
const offset = decodeLocalJsonEventCursor(options.cursor, options);
|
|
13669
|
+
rows = rows.slice(offset);
|
|
13670
|
+
}
|
|
13671
|
+
if (options.limit !== undefined)
|
|
13672
|
+
rows = rows.slice(0, normalizeEventPageLimit(options.limit));
|
|
13673
|
+
return rows;
|
|
13674
|
+
}
|
|
13675
|
+
function assertCursorFilter(name, cursorValue, optionValue) {
|
|
13676
|
+
if (cursorValue !== optionValue)
|
|
13677
|
+
throw new Error(`Local JSON event cursor ${name} filter mismatch`);
|
|
13678
|
+
}
|
|
13679
|
+
function findEventByIdentity(events, identity) {
|
|
13680
|
+
return events.find((event) => identity.id !== undefined && event.id === identity.id || identity.dedupeKey !== undefined && event.dedupeKey === identity.dedupeKey);
|
|
13681
|
+
}
|
|
13467
13682
|
function buildSignatureBase(timestamp2, body) {
|
|
13468
13683
|
return `${timestamp2}.${body}`;
|
|
13469
13684
|
}
|
|
@@ -13477,21 +13692,27 @@ function now2() {
|
|
|
13477
13692
|
function truncate(value, max = 4096) {
|
|
13478
13693
|
return value.length > max ? `${value.slice(0, max)}...` : value;
|
|
13479
13694
|
}
|
|
13480
|
-
function buildWebhookRequest(event, channel) {
|
|
13695
|
+
function buildWebhookRequest(event, channel, options = {}) {
|
|
13481
13696
|
if (!channel.webhook)
|
|
13482
13697
|
throw new Error(`Channel ${channel.id} has no webhook config`);
|
|
13698
|
+
for (const name of Object.keys(channel.webhook.headers ?? {})) {
|
|
13699
|
+
if (/^x-hasna-/i.test(name)) {
|
|
13700
|
+
throw new Error(`Webhook header ${name} is reserved for signed delivery metadata`);
|
|
13701
|
+
}
|
|
13702
|
+
}
|
|
13483
13703
|
const body = JSON.stringify(event);
|
|
13484
|
-
const timestamp2 =
|
|
13704
|
+
const timestamp2 = options.timestamp ?? new Date().toISOString();
|
|
13485
13705
|
const headers = {
|
|
13486
13706
|
"Content-Type": "application/json",
|
|
13487
13707
|
"User-Agent": "@hasna/events",
|
|
13488
13708
|
"X-Hasna-Event-Id": event.id,
|
|
13489
13709
|
"X-Hasna-Event-Type": event.type,
|
|
13490
|
-
|
|
13491
|
-
|
|
13710
|
+
...channel.webhook.headers,
|
|
13711
|
+
"X-Hasna-Timestamp": timestamp2
|
|
13492
13712
|
};
|
|
13493
|
-
|
|
13494
|
-
|
|
13713
|
+
const secret = options.secret ?? channel.webhook.secret;
|
|
13714
|
+
if (secret) {
|
|
13715
|
+
headers["X-Hasna-Signature"] = signPayload(secret, timestamp2, body);
|
|
13495
13716
|
}
|
|
13496
13717
|
return { body, headers };
|
|
13497
13718
|
}
|
|
@@ -13499,7 +13720,21 @@ async function dispatchWebhook(event, channel, options = {}) {
|
|
|
13499
13720
|
if (!channel.webhook)
|
|
13500
13721
|
throw new Error(`Channel ${channel.id} has no webhook config`);
|
|
13501
13722
|
const startedAt = now2();
|
|
13502
|
-
|
|
13723
|
+
let secret = channel.webhook.secret;
|
|
13724
|
+
if (channel.webhook.secretRef) {
|
|
13725
|
+
if (!options.secretResolver) {
|
|
13726
|
+
return failedAttempt(startedAt, "Webhook secret reference has no runtime resolver");
|
|
13727
|
+
}
|
|
13728
|
+
try {
|
|
13729
|
+
secret = await options.secretResolver(channel.webhook.secretRef);
|
|
13730
|
+
} catch {
|
|
13731
|
+
return failedAttempt(startedAt, "Webhook secret reference could not be resolved");
|
|
13732
|
+
}
|
|
13733
|
+
if (!secret)
|
|
13734
|
+
return failedAttempt(startedAt, "Webhook secret reference could not be resolved");
|
|
13735
|
+
}
|
|
13736
|
+
const timestamp2 = (options.now?.() ?? new Date).toISOString();
|
|
13737
|
+
const { body, headers } = buildWebhookRequest(event, channel, { secret, timestamp: timestamp2 });
|
|
13503
13738
|
const controller = new AbortController;
|
|
13504
13739
|
const timeout = setTimeout(() => controller.abort(), channel.webhook.timeoutMs ?? 15000);
|
|
13505
13740
|
try {
|
|
@@ -13531,6 +13766,15 @@ async function dispatchWebhook(event, channel, options = {}) {
|
|
|
13531
13766
|
clearTimeout(timeout);
|
|
13532
13767
|
}
|
|
13533
13768
|
}
|
|
13769
|
+
function failedAttempt(startedAt, error) {
|
|
13770
|
+
return {
|
|
13771
|
+
attempt: 1,
|
|
13772
|
+
status: "failed",
|
|
13773
|
+
startedAt,
|
|
13774
|
+
completedAt: now2(),
|
|
13775
|
+
error
|
|
13776
|
+
};
|
|
13777
|
+
}
|
|
13534
13778
|
async function dispatchCommand(event, channel) {
|
|
13535
13779
|
if (!channel.command)
|
|
13536
13780
|
throw new Error(`Channel ${channel.id} has no command config`);
|
|
@@ -13619,6 +13863,76 @@ function createDeliveryResult(event, channel, attempts) {
|
|
|
13619
13863
|
completedAt: attempts.at(-1)?.completedAt ?? now2()
|
|
13620
13864
|
};
|
|
13621
13865
|
}
|
|
13866
|
+
|
|
13867
|
+
class EventTypeCatalog {
|
|
13868
|
+
definitions = new Map;
|
|
13869
|
+
register(definition) {
|
|
13870
|
+
this.definitions.set(definition.type, definition);
|
|
13871
|
+
return this;
|
|
13872
|
+
}
|
|
13873
|
+
unregister(type) {
|
|
13874
|
+
return this.definitions.delete(type);
|
|
13875
|
+
}
|
|
13876
|
+
has(type) {
|
|
13877
|
+
return this.definitions.has(type);
|
|
13878
|
+
}
|
|
13879
|
+
get(type) {
|
|
13880
|
+
return this.definitions.get(type);
|
|
13881
|
+
}
|
|
13882
|
+
list() {
|
|
13883
|
+
return [...this.definitions.values()];
|
|
13884
|
+
}
|
|
13885
|
+
validateEvent(event) {
|
|
13886
|
+
const definition = this.definitions.get(event.type);
|
|
13887
|
+
if (!definition)
|
|
13888
|
+
return { ok: true };
|
|
13889
|
+
return definition.validate(event.data, event);
|
|
13890
|
+
}
|
|
13891
|
+
assertEventValid(event) {
|
|
13892
|
+
const result = this.validateEvent(event);
|
|
13893
|
+
if (!result.ok) {
|
|
13894
|
+
throw new EventValidationError(event.type, result.issues);
|
|
13895
|
+
}
|
|
13896
|
+
}
|
|
13897
|
+
}
|
|
13898
|
+
function redactPaths(event, paths, replacement = "[REDACTED]") {
|
|
13899
|
+
if (paths.length === 0)
|
|
13900
|
+
return event;
|
|
13901
|
+
const copy = structuredClone(event);
|
|
13902
|
+
for (const path of paths) {
|
|
13903
|
+
setPath(copy, path, replacement);
|
|
13904
|
+
}
|
|
13905
|
+
return copy;
|
|
13906
|
+
}
|
|
13907
|
+
function redactSensitiveKeys(event, replacement = "[REDACTED]") {
|
|
13908
|
+
return redactValue2(event, replacement);
|
|
13909
|
+
}
|
|
13910
|
+
function shouldRedactKey(key) {
|
|
13911
|
+
return /secret|token|password|api[_-]?key|authorization/i.test(key);
|
|
13912
|
+
}
|
|
13913
|
+
function redactValue2(value, replacement) {
|
|
13914
|
+
if (Array.isArray(value))
|
|
13915
|
+
return value.map((item) => redactValue2(item, replacement));
|
|
13916
|
+
if (!value || typeof value !== "object")
|
|
13917
|
+
return value;
|
|
13918
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => [
|
|
13919
|
+
key,
|
|
13920
|
+
shouldRedactKey(key) ? replacement : redactValue2(item, replacement)
|
|
13921
|
+
]));
|
|
13922
|
+
}
|
|
13923
|
+
function setPath(input, path, replacement) {
|
|
13924
|
+
const parts = path.split(".");
|
|
13925
|
+
let cursor = input;
|
|
13926
|
+
for (const part of parts.slice(0, -1)) {
|
|
13927
|
+
const next = cursor[part];
|
|
13928
|
+
if (!next || typeof next !== "object")
|
|
13929
|
+
return;
|
|
13930
|
+
cursor = next;
|
|
13931
|
+
}
|
|
13932
|
+
const last = parts.at(-1);
|
|
13933
|
+
if (last && last in cursor)
|
|
13934
|
+
cursor[last] = replacement;
|
|
13935
|
+
}
|
|
13622
13936
|
function createEvent(input) {
|
|
13623
13937
|
return {
|
|
13624
13938
|
id: input.id ?? randomUUID22(),
|
|
@@ -13639,10 +13953,18 @@ class EventsClient {
|
|
|
13639
13953
|
store;
|
|
13640
13954
|
redactors;
|
|
13641
13955
|
transportOptions;
|
|
13956
|
+
catalog;
|
|
13957
|
+
validateCatalogTypes;
|
|
13642
13958
|
constructor(options = {}) {
|
|
13643
13959
|
this.store = options.store ?? new JsonEventsStore(options.dataDir);
|
|
13644
13960
|
this.redactors = options.redactors ?? [];
|
|
13645
|
-
this.transportOptions = {
|
|
13961
|
+
this.transportOptions = {
|
|
13962
|
+
fetchImpl: options.fetchImpl,
|
|
13963
|
+
secretResolver: options.secretResolver,
|
|
13964
|
+
now: options.now
|
|
13965
|
+
};
|
|
13966
|
+
this.catalog = options.catalog ?? defaultEventTypeCatalog;
|
|
13967
|
+
this.validateCatalogTypes = options.validateCatalogTypes ?? false;
|
|
13646
13968
|
}
|
|
13647
13969
|
async addChannel(input) {
|
|
13648
13970
|
const timestamp2 = new Date().toISOString();
|
|
@@ -13660,18 +13982,40 @@ class EventsClient {
|
|
|
13660
13982
|
}
|
|
13661
13983
|
async emit(input, options = {}) {
|
|
13662
13984
|
const event = options.redactSensitiveData === false ? createEvent(input) : redactSensitiveKeys(createEvent(input));
|
|
13663
|
-
if (options.
|
|
13664
|
-
|
|
13665
|
-
|
|
13666
|
-
|
|
13667
|
-
|
|
13668
|
-
|
|
13669
|
-
|
|
13670
|
-
const deliveries = options.deliver === false ? [] : await this.deliver(event);
|
|
13671
|
-
return { event, deliveries, deduped: false };
|
|
13672
|
-
}
|
|
13673
|
-
async listEvents() {
|
|
13674
|
-
|
|
13985
|
+
if (options.validate ?? this.validateCatalogTypes) {
|
|
13986
|
+
this.catalog.assertEventValid(event);
|
|
13987
|
+
}
|
|
13988
|
+
const append = await this.appendEvent(event, { dedupe: options.dedupe !== false });
|
|
13989
|
+
if (append.deduped) {
|
|
13990
|
+
return { event: append.event, deliveries: [], deduped: true };
|
|
13991
|
+
}
|
|
13992
|
+
const deliveries = options.deliver === false ? [] : await this.deliver(append.event);
|
|
13993
|
+
return { event: append.event, deliveries, deduped: false };
|
|
13994
|
+
}
|
|
13995
|
+
async listEvents(options = {}) {
|
|
13996
|
+
if (Object.keys(options).length === 0)
|
|
13997
|
+
return this.store.listEvents();
|
|
13998
|
+
return queryClientEvents(await this.store.listEvents(), options);
|
|
13999
|
+
}
|
|
14000
|
+
async listEventsPage(options = {}) {
|
|
14001
|
+
if (this.store.listEventsPage)
|
|
14002
|
+
return this.store.listEventsPage(options);
|
|
14003
|
+
const events = queryClientEvents(await this.store.listEvents(), {
|
|
14004
|
+
eventId: options.eventId,
|
|
14005
|
+
source: options.source,
|
|
14006
|
+
type: options.type
|
|
14007
|
+
});
|
|
14008
|
+
const offset = decodeLocalJsonEventCursor(options.cursor, options);
|
|
14009
|
+
const limit = normalizeEventPageLimit(options.limit);
|
|
14010
|
+
const pageEvents = events.slice(offset, offset + limit);
|
|
14011
|
+
const nextOffset = offset + pageEvents.length;
|
|
14012
|
+
const hasMore = nextOffset < events.length;
|
|
14013
|
+
return {
|
|
14014
|
+
events: pageEvents,
|
|
14015
|
+
cursor: options.cursor,
|
|
14016
|
+
nextCursor: hasMore ? encodeLocalJsonEventCursor(nextOffset, options) : undefined,
|
|
14017
|
+
hasMore
|
|
14018
|
+
};
|
|
13675
14019
|
}
|
|
13676
14020
|
async listDeliveries() {
|
|
13677
14021
|
return this.store.listDeliveries();
|
|
@@ -13739,22 +14083,37 @@ class EventsClient {
|
|
|
13739
14083
|
return result;
|
|
13740
14084
|
}
|
|
13741
14085
|
async replay(options = {}) {
|
|
13742
|
-
const
|
|
13743
|
-
if (options.eventId && event.id !== options.eventId)
|
|
13744
|
-
return false;
|
|
13745
|
-
if (options.source && event.source !== options.source)
|
|
13746
|
-
return false;
|
|
13747
|
-
if (options.type && event.type !== options.type)
|
|
13748
|
-
return false;
|
|
13749
|
-
return true;
|
|
13750
|
-
});
|
|
14086
|
+
const page = options.cursor || options.limit !== undefined ? await this.listEventsPage(options) : { events: await this.listEvents(options), hasMore: false };
|
|
13751
14087
|
if (options.dryRun)
|
|
13752
|
-
return { events, deliveries: [] };
|
|
14088
|
+
return { events: page.events, deliveries: [], cursor: page.cursor, nextCursor: page.nextCursor, hasMore: page.hasMore };
|
|
13753
14089
|
const deliveries = [];
|
|
13754
|
-
for (const event of events) {
|
|
14090
|
+
for (const event of page.events) {
|
|
13755
14091
|
deliveries.push(...await this.deliver(event));
|
|
13756
14092
|
}
|
|
13757
|
-
return { events, deliveries };
|
|
14093
|
+
return { events: page.events, deliveries, cursor: page.cursor, nextCursor: page.nextCursor, hasMore: page.hasMore };
|
|
14094
|
+
}
|
|
14095
|
+
async appendEvent(event, options) {
|
|
14096
|
+
if (this.store.appendEventOnce) {
|
|
14097
|
+
return this.store.appendEventOnce(event, { dedupe: options.dedupe });
|
|
14098
|
+
}
|
|
14099
|
+
if (options.dedupe) {
|
|
14100
|
+
const existing = await this.store.findEventByIdentity({ id: event.id, dedupeKey: event.dedupeKey });
|
|
14101
|
+
if (existing) {
|
|
14102
|
+
return {
|
|
14103
|
+
event: existing,
|
|
14104
|
+
stored: false,
|
|
14105
|
+
deduped: true,
|
|
14106
|
+
identity: { id: existing.id, dedupeKey: existing.dedupeKey }
|
|
14107
|
+
};
|
|
14108
|
+
}
|
|
14109
|
+
}
|
|
14110
|
+
const stored = await this.store.appendEvent(event);
|
|
14111
|
+
return {
|
|
14112
|
+
event: stored,
|
|
14113
|
+
stored: true,
|
|
14114
|
+
deduped: false,
|
|
14115
|
+
identity: { id: stored.id, dedupeKey: stored.dedupeKey }
|
|
14116
|
+
};
|
|
13758
14117
|
}
|
|
13759
14118
|
async applyRedaction(event, channel) {
|
|
13760
14119
|
let next = redactPaths(event, channel.redact?.paths ?? [], channel.redact?.replacement ?? "[REDACTED]");
|
|
@@ -13781,43 +14140,19 @@ class EventsClient {
|
|
|
13781
14140
|
return createDeliveryResult(event, channel, attempts);
|
|
13782
14141
|
}
|
|
13783
14142
|
}
|
|
13784
|
-
function
|
|
13785
|
-
|
|
13786
|
-
|
|
13787
|
-
|
|
13788
|
-
|
|
13789
|
-
|
|
13790
|
-
|
|
13791
|
-
|
|
13792
|
-
|
|
13793
|
-
|
|
13794
|
-
|
|
13795
|
-
|
|
13796
|
-
|
|
13797
|
-
return /secret|token|password|api[_-]?key|authorization/i.test(key);
|
|
13798
|
-
}
|
|
13799
|
-
function redactValue2(value, replacement) {
|
|
13800
|
-
if (Array.isArray(value))
|
|
13801
|
-
return value.map((item) => redactValue2(item, replacement));
|
|
13802
|
-
if (!value || typeof value !== "object")
|
|
13803
|
-
return value;
|
|
13804
|
-
return Object.fromEntries(Object.entries(value).map(([key, item]) => [
|
|
13805
|
-
key,
|
|
13806
|
-
shouldRedactKey(key) ? replacement : redactValue2(item, replacement)
|
|
13807
|
-
]));
|
|
13808
|
-
}
|
|
13809
|
-
function setPath(input, path, replacement) {
|
|
13810
|
-
const parts = path.split(".");
|
|
13811
|
-
let cursor = input;
|
|
13812
|
-
for (const part of parts.slice(0, -1)) {
|
|
13813
|
-
const next = cursor[part];
|
|
13814
|
-
if (!next || typeof next !== "object")
|
|
13815
|
-
return;
|
|
13816
|
-
cursor = next;
|
|
13817
|
-
}
|
|
13818
|
-
const last = parts.at(-1);
|
|
13819
|
-
if (last && last in cursor)
|
|
13820
|
-
cursor[last] = replacement;
|
|
14143
|
+
function queryClientEvents(events, options) {
|
|
14144
|
+
let rows = events;
|
|
14145
|
+
if (options.eventId)
|
|
14146
|
+
rows = rows.filter((event) => event.id === options.eventId);
|
|
14147
|
+
if (options.source)
|
|
14148
|
+
rows = rows.filter((event) => event.source === options.source);
|
|
14149
|
+
if (options.type)
|
|
14150
|
+
rows = rows.filter((event) => event.type === options.type);
|
|
14151
|
+
if (options.cursor)
|
|
14152
|
+
rows = rows.slice(decodeLocalJsonEventCursor(options.cursor, options));
|
|
14153
|
+
if (options.limit !== undefined)
|
|
14154
|
+
rows = rows.slice(0, normalizeEventPageLimit(options.limit));
|
|
14155
|
+
return rows;
|
|
13821
14156
|
}
|
|
13822
14157
|
function normalizeTime(value) {
|
|
13823
14158
|
if (!value)
|
|
@@ -13831,9 +14166,22 @@ function normalizeRetryPolicy(policy) {
|
|
|
13831
14166
|
multiplier: Math.max(1, policy?.multiplier ?? 2)
|
|
13832
14167
|
};
|
|
13833
14168
|
}
|
|
13834
|
-
var HASNA_EVENTS_DIR_ENV = "HASNA_EVENTS_DIR", HASNA_EVENTS_HOME_ENV = "HASNA_EVENTS_HOME", DEFAULT_SIGNATURE_TOLERANCE_MS;
|
|
14169
|
+
var HASNA_EVENTS_DIR_ENV = "HASNA_EVENTS_DIR", HASNA_EVENTS_HOME_ENV = "HASNA_EVENTS_HOME", LOCAL_JSON_EVENT_CURSOR_PREFIX = "local-json-v1:", DEFAULT_EVENT_PAGE_LIMIT = 100, MAX_EVENT_PAGE_LIMIT = 1000, DEFAULT_SIGNATURE_TOLERANCE_MS, EventValidationError, defaultEventTypeCatalog, APP_EVENT_V1_MAX_DATA_BYTES;
|
|
13835
14170
|
var init_dist = __esm(() => {
|
|
13836
14171
|
DEFAULT_SIGNATURE_TOLERANCE_MS = 5 * 60 * 1000;
|
|
14172
|
+
EventValidationError = class EventValidationError extends Error {
|
|
14173
|
+
eventType;
|
|
14174
|
+
issues;
|
|
14175
|
+
constructor(eventType, issues) {
|
|
14176
|
+
const detail = issues.map((issue) => `${issue.path || "<root>"}: ${issue.message}`).join("; ");
|
|
14177
|
+
super(`Event validation failed for type "${eventType}": ${detail}`);
|
|
14178
|
+
this.name = "EventValidationError";
|
|
14179
|
+
this.eventType = eventType;
|
|
14180
|
+
this.issues = issues;
|
|
14181
|
+
}
|
|
14182
|
+
};
|
|
14183
|
+
defaultEventTypeCatalog = new EventTypeCatalog;
|
|
14184
|
+
APP_EVENT_V1_MAX_DATA_BYTES = 32 * 1024;
|
|
13837
14185
|
});
|
|
13838
14186
|
|
|
13839
14187
|
// src/db/task-lists.ts
|
|
@@ -14672,8 +15020,12 @@ async function deliverWebhook(wh, event, body, attempt, db) {
|
|
|
14672
15020
|
const sig = await crypto.subtle.sign("HMAC", key, encoder.encode(body));
|
|
14673
15021
|
headers["X-Webhook-Signature"] = Array.from(new Uint8Array(sig)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
14674
15022
|
}
|
|
14675
|
-
const resp = await fetch(wh.url, { method: "POST", headers, body });
|
|
15023
|
+
const resp = await fetch(wh.url, { method: "POST", headers, body, redirect: "manual" });
|
|
14676
15024
|
const respText = await resp.text().catch(() => "");
|
|
15025
|
+
if (resp.status >= 300 && resp.status < 400) {
|
|
15026
|
+
logDelivery(db, wh.id, event, body, resp.status, "Blocked: webhook URL returned a 3xx redirect; redirects are never followed (SSRF prevention)", attempt);
|
|
15027
|
+
return;
|
|
15028
|
+
}
|
|
14677
15029
|
logDelivery(db, wh.id, event, body, resp.status, respText.slice(0, 1000), attempt);
|
|
14678
15030
|
if (resp.status >= 400 && attempt < MAX_RETRY_ATTEMPTS) {
|
|
14679
15031
|
const delay = RETRY_BASE_DELAY_MS * Math.pow(2, attempt - 1);
|
|
@@ -16250,6 +16602,12 @@ function listTasks2(filter = {}, db) {
|
|
|
16250
16602
|
const d = db || getDatabase();
|
|
16251
16603
|
const { clearExpiredLocks: clearExpiredLocks2 } = (init_database(), __toCommonJS(exports_database));
|
|
16252
16604
|
clearExpiredLocks2(d);
|
|
16605
|
+
if (filter.limit !== undefined) {
|
|
16606
|
+
const limit = filter.limit;
|
|
16607
|
+
if (!Number.isSafeInteger(limit) || limit <= 0 || limit > MAX_TASK_LIST_LIMIT) {
|
|
16608
|
+
throw new TypeError(`listTasks limit must be a positive integer between 1 and ${MAX_TASK_LIST_LIMIT}; got ${String(limit)}`);
|
|
16609
|
+
}
|
|
16610
|
+
}
|
|
16253
16611
|
const conditions = [];
|
|
16254
16612
|
const params = [];
|
|
16255
16613
|
if (filter.project_id) {
|
|
@@ -16783,6 +17141,7 @@ function deleteTask(id, db) {
|
|
|
16783
17141
|
}
|
|
16784
17142
|
return result.changes > 0;
|
|
16785
17143
|
}
|
|
17144
|
+
var MAX_TASK_LIST_LIMIT = 1e5;
|
|
16786
17145
|
var init_task_crud = __esm(() => {
|
|
16787
17146
|
init_types();
|
|
16788
17147
|
init_database();
|
|
@@ -19697,7 +20056,8 @@ __export(exports_tasks, {
|
|
|
19697
20056
|
buildTaskBoardSnapshot: () => buildTaskBoardSnapshot,
|
|
19698
20057
|
archiveTasks: () => archiveTasks,
|
|
19699
20058
|
archiveCompletedTasks: () => archiveCompletedTasks,
|
|
19700
|
-
addDependency: () => addDependency2
|
|
20059
|
+
addDependency: () => addDependency2,
|
|
20060
|
+
MAX_TASK_LIST_LIMIT: () => MAX_TASK_LIST_LIMIT
|
|
19701
20061
|
});
|
|
19702
20062
|
var init_tasks = __esm(() => {
|
|
19703
20063
|
init_task_crud();
|
|
@@ -30204,6 +30564,13 @@ function resolveSigningSecret(env = process.env) {
|
|
|
30204
30564
|
function isPostgresBackendConfigured(env = process.env) {
|
|
30205
30565
|
return Boolean(resolveCloudDatabaseUrl(env));
|
|
30206
30566
|
}
|
|
30567
|
+
function schemaRetryMinIntervalMs(env = process.env) {
|
|
30568
|
+
const raw = env.HASNA_TODOS_SCHEMA_RETRY_MIN_MS;
|
|
30569
|
+
if (!raw)
|
|
30570
|
+
return DEFAULT_SCHEMA_RETRY_MIN_MS;
|
|
30571
|
+
const parsed = Number(raw);
|
|
30572
|
+
return Number.isFinite(parsed) && parsed >= 0 ? parsed : DEFAULT_SCHEMA_RETRY_MIN_MS;
|
|
30573
|
+
}
|
|
30207
30574
|
function getCloudTenantId() {
|
|
30208
30575
|
return process.env.HASNA_TODOS_TENANT_ID ?? "default";
|
|
30209
30576
|
}
|
|
@@ -30299,6 +30666,10 @@ function getCloudVerifier() {
|
|
|
30299
30666
|
async function ensureCloudSchema() {
|
|
30300
30667
|
if (schemaEnsured)
|
|
30301
30668
|
return schemaEnsured;
|
|
30669
|
+
if (lastSchemaFailure !== null && Date.now() - lastSchemaAttemptAtMs < schemaRetryMinIntervalMs()) {
|
|
30670
|
+
throw lastSchemaFailure;
|
|
30671
|
+
}
|
|
30672
|
+
lastSchemaAttemptAtMs = Date.now();
|
|
30302
30673
|
schemaEnsured = (async () => {
|
|
30303
30674
|
const client = getClient();
|
|
30304
30675
|
for (const sql of postgresTodosSyncSchemaSql()) {
|
|
@@ -30319,6 +30690,7 @@ async function ensureCloudSchema() {
|
|
|
30319
30690
|
await getApiKeyStore().ensureSchema();
|
|
30320
30691
|
})().catch((error) => {
|
|
30321
30692
|
schemaEnsured = null;
|
|
30693
|
+
lastSchemaFailure = error;
|
|
30322
30694
|
throw error;
|
|
30323
30695
|
});
|
|
30324
30696
|
return schemaEnsured;
|
|
@@ -30366,8 +30738,10 @@ async function closeCloud() {
|
|
|
30366
30738
|
cachedTaskManifestAuthority = null;
|
|
30367
30739
|
cachedTaskSubtreeTransferAuthority = null;
|
|
30368
30740
|
schemaEnsured = null;
|
|
30741
|
+
lastSchemaAttemptAtMs = 0;
|
|
30742
|
+
lastSchemaFailure = null;
|
|
30369
30743
|
}
|
|
30370
|
-
var TODOS_APP_SLUG = "todos", cachedClient = null, cachedAdapter = null, cachedStore = null, cachedVerifier = null, cachedPrGroupLedger = null, cachedProjectRegistrationAuthority = null, cachedTaskManifestAuthority = null, cachedTaskSubtreeTransferAuthority = null, schemaEnsured = null;
|
|
30744
|
+
var TODOS_APP_SLUG = "todos", cachedClient = null, cachedAdapter = null, cachedStore = null, cachedVerifier = null, cachedPrGroupLedger = null, cachedProjectRegistrationAuthority = null, cachedTaskManifestAuthority = null, cachedTaskSubtreeTransferAuthority = null, schemaEnsured = null, lastSchemaAttemptAtMs = 0, lastSchemaFailure = null, DEFAULT_SCHEMA_RETRY_MIN_MS = 1e4;
|
|
30371
30745
|
var init_cloud = __esm(() => {
|
|
30372
30746
|
init_auth();
|
|
30373
30747
|
init_auth();
|
|
@@ -31380,6 +31754,19 @@ function taskStatusQueryParam(url) {
|
|
|
31380
31754
|
return { ok: false, message: result.message };
|
|
31381
31755
|
return { ok: true, value: collapseEnumValues(result.values) };
|
|
31382
31756
|
}
|
|
31757
|
+
function parsePaginationQueryParam(url, name) {
|
|
31758
|
+
const raw = url.searchParams.get(name);
|
|
31759
|
+
if (raw === null)
|
|
31760
|
+
return { ok: true, value: undefined };
|
|
31761
|
+
const min = name === "limit" ? 1 : 0;
|
|
31762
|
+
const message = name === "limit" ? "limit must be a positive integer" : "offset must be a non-negative integer";
|
|
31763
|
+
if (!/^\d+$/.test(raw))
|
|
31764
|
+
return { ok: false, message };
|
|
31765
|
+
const value = Number(raw);
|
|
31766
|
+
if (!Number.isSafeInteger(value) || value < min)
|
|
31767
|
+
return { ok: false, message };
|
|
31768
|
+
return { ok: true, value };
|
|
31769
|
+
}
|
|
31383
31770
|
async function handleListTasks(_req, url, _ctx, json5, taskToSummary2) {
|
|
31384
31771
|
const statusParam = taskStatusQueryParam(url);
|
|
31385
31772
|
if (!statusParam.ok)
|
|
@@ -31387,16 +31774,20 @@ async function handleListTasks(_req, url, _ctx, json5, taskToSummary2) {
|
|
|
31387
31774
|
const projectId = url.searchParams.get("project_id") || undefined;
|
|
31388
31775
|
const sessionId = url.searchParams.get("session_id") || undefined;
|
|
31389
31776
|
const agentId = url.searchParams.get("agent_id") || undefined;
|
|
31390
|
-
const limitParam = url
|
|
31391
|
-
|
|
31777
|
+
const limitParam = parsePaginationQueryParam(url, "limit");
|
|
31778
|
+
if (!limitParam.ok)
|
|
31779
|
+
return json5({ error: limitParam.message }, 400);
|
|
31780
|
+
const offsetParam = parsePaginationQueryParam(url, "offset");
|
|
31781
|
+
if (!offsetParam.ok)
|
|
31782
|
+
return json5({ error: offsetParam.message }, 400);
|
|
31392
31783
|
const fields = parseFieldsParam(url);
|
|
31393
31784
|
const tasks = listTasks2({
|
|
31394
31785
|
status: statusParam.value,
|
|
31395
31786
|
project_id: projectId,
|
|
31396
31787
|
session_id: sessionId,
|
|
31397
31788
|
agent_id: agentId,
|
|
31398
|
-
limit: limitParam
|
|
31399
|
-
offset: offsetParam
|
|
31789
|
+
limit: limitParam.value,
|
|
31790
|
+
offset: offsetParam.value
|
|
31400
31791
|
});
|
|
31401
31792
|
return json5(tasks.map((t) => taskToSummary2(t, fields)));
|
|
31402
31793
|
}
|
|
@@ -32188,6 +32579,12 @@ class TodosShadowOutbox {
|
|
|
32188
32579
|
this.onEvent?.({ type: "mirrored", objectType: row.object_type, id: row.object_id, lagMs });
|
|
32189
32580
|
} catch (error) {
|
|
32190
32581
|
const message = error instanceof Error ? error.message : String(error);
|
|
32582
|
+
if (error instanceof ResourceConflictError) {
|
|
32583
|
+
this.metrics.lastError = message;
|
|
32584
|
+
this.db.run(`UPDATE shadow_outbox SET attempts=?, last_error=?, status='failed' WHERE seq=? AND revision=?`, [row.attempts + 1, message, row.seq, row.revision]);
|
|
32585
|
+
this.onEvent?.({ type: "parked", objectType: row.object_type, id: row.object_id, error: message });
|
|
32586
|
+
return;
|
|
32587
|
+
}
|
|
32191
32588
|
this.metrics.retries += 1;
|
|
32192
32589
|
this.metrics.lastError = message;
|
|
32193
32590
|
const attempts = row.attempts + 1;
|
|
@@ -32310,6 +32707,7 @@ function emptySnapshot() {
|
|
|
32310
32707
|
}
|
|
32311
32708
|
var MAX_BACKOFF_MS;
|
|
32312
32709
|
var init_shadow_outbox = __esm(() => {
|
|
32710
|
+
init_types();
|
|
32313
32711
|
init_local_sqlite();
|
|
32314
32712
|
init_postgres_sync();
|
|
32315
32713
|
init_shadow_outbox_schema();
|
|
@@ -36608,6 +37006,26 @@ function parseSinceCursor(raw) {
|
|
|
36608
37006
|
}
|
|
36609
37007
|
return { ok: true, value: new Date(parsed).toISOString() };
|
|
36610
37008
|
}
|
|
37009
|
+
function paginationQueryParam(url, name) {
|
|
37010
|
+
const raw = url.searchParams.get(name);
|
|
37011
|
+
if (raw === null)
|
|
37012
|
+
return { ok: true, value: undefined };
|
|
37013
|
+
const min = name === "limit" ? 1 : 0;
|
|
37014
|
+
if (!/^\d+$/.test(raw)) {
|
|
37015
|
+
return {
|
|
37016
|
+
ok: false,
|
|
37017
|
+
response: error(400, name === "limit" ? "limit must be a positive integer" : "offset must be a non-negative integer")
|
|
37018
|
+
};
|
|
37019
|
+
}
|
|
37020
|
+
const value = Number(raw);
|
|
37021
|
+
if (!Number.isSafeInteger(value) || value < min) {
|
|
37022
|
+
return {
|
|
37023
|
+
ok: false,
|
|
37024
|
+
response: error(400, name === "limit" ? "limit must be a positive integer" : "offset must be a non-negative integer")
|
|
37025
|
+
};
|
|
37026
|
+
}
|
|
37027
|
+
return { ok: true, value };
|
|
37028
|
+
}
|
|
36611
37029
|
function validateTaskCompletion(value) {
|
|
36612
37030
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
36613
37031
|
return { ok: false, message: "completion body must be an object" };
|
|
@@ -37136,6 +37554,12 @@ async function handleV1Request(req, url, dependencies = {}) {
|
|
|
37136
37554
|
if (updatedAfter !== null && !updatedAfter.ok) {
|
|
37137
37555
|
return error(400, updatedAfter.message);
|
|
37138
37556
|
}
|
|
37557
|
+
const limitParam = paginationQueryParam(url, "limit");
|
|
37558
|
+
if (!limitParam.ok)
|
|
37559
|
+
return limitParam.response;
|
|
37560
|
+
const offsetParam = paginationQueryParam(url, "offset");
|
|
37561
|
+
if (!offsetParam.ok)
|
|
37562
|
+
return offsetParam.response;
|
|
37139
37563
|
const filter = {
|
|
37140
37564
|
...updatedAfter !== null && updatedAfter.ok ? { updated_after: updatedAfter.value } : {},
|
|
37141
37565
|
...url.searchParams.get("q") ? { query: url.searchParams.get("q") } : {},
|
|
@@ -37152,8 +37576,8 @@ async function handleV1Request(req, url, dependencies = {}) {
|
|
|
37152
37576
|
...url.searchParams.get("tags") ? {
|
|
37153
37577
|
tags: url.searchParams.get("tags").split(",").map((tag) => tag.trim()).filter(Boolean)
|
|
37154
37578
|
} : {},
|
|
37155
|
-
...
|
|
37156
|
-
...
|
|
37579
|
+
...limitParam.value !== undefined ? { limit: limitParam.value } : {},
|
|
37580
|
+
...offsetParam.value !== undefined ? { offset: offsetParam.value } : {}
|
|
37157
37581
|
};
|
|
37158
37582
|
const tasks = await store.tasks.list(filter);
|
|
37159
37583
|
const { limit: _l, offset: _o, ...countFilter } = filter;
|
|
@@ -38180,6 +38604,152 @@ var init_v1 = __esm(() => {
|
|
|
38180
38604
|
RFC3339_DATE_TIME = /^(\d{4})-(\d{2})-(\d{2})[Tt]\d{2}:\d{2}:\d{2}(\.\d+)?([Zz]|[+-]\d{2}:\d{2})$/;
|
|
38181
38605
|
});
|
|
38182
38606
|
|
|
38607
|
+
// node_modules/.bun/content-type@1.0.5/node_modules/content-type/index.js
|
|
38608
|
+
var require_content_type = __commonJS((exports) => {
|
|
38609
|
+
/*!
|
|
38610
|
+
* content-type
|
|
38611
|
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
38612
|
+
* MIT Licensed
|
|
38613
|
+
*/
|
|
38614
|
+
var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;
|
|
38615
|
+
var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/;
|
|
38616
|
+
var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
38617
|
+
var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g;
|
|
38618
|
+
var QUOTE_REGEXP = /([\\"])/g;
|
|
38619
|
+
var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
38620
|
+
exports.format = format;
|
|
38621
|
+
exports.parse = parse;
|
|
38622
|
+
function format(obj) {
|
|
38623
|
+
if (!obj || typeof obj !== "object") {
|
|
38624
|
+
throw new TypeError("argument obj is required");
|
|
38625
|
+
}
|
|
38626
|
+
var parameters = obj.parameters;
|
|
38627
|
+
var type = obj.type;
|
|
38628
|
+
if (!type || !TYPE_REGEXP.test(type)) {
|
|
38629
|
+
throw new TypeError("invalid type");
|
|
38630
|
+
}
|
|
38631
|
+
var string = type;
|
|
38632
|
+
if (parameters && typeof parameters === "object") {
|
|
38633
|
+
var param;
|
|
38634
|
+
var params = Object.keys(parameters).sort();
|
|
38635
|
+
for (var i = 0;i < params.length; i++) {
|
|
38636
|
+
param = params[i];
|
|
38637
|
+
if (!TOKEN_REGEXP.test(param)) {
|
|
38638
|
+
throw new TypeError("invalid parameter name");
|
|
38639
|
+
}
|
|
38640
|
+
string += "; " + param + "=" + qstring(parameters[param]);
|
|
38641
|
+
}
|
|
38642
|
+
}
|
|
38643
|
+
return string;
|
|
38644
|
+
}
|
|
38645
|
+
function parse(string) {
|
|
38646
|
+
if (!string) {
|
|
38647
|
+
throw new TypeError("argument string is required");
|
|
38648
|
+
}
|
|
38649
|
+
var header = typeof string === "object" ? getcontenttype(string) : string;
|
|
38650
|
+
if (typeof header !== "string") {
|
|
38651
|
+
throw new TypeError("argument string is required to be a string");
|
|
38652
|
+
}
|
|
38653
|
+
var index = header.indexOf(";");
|
|
38654
|
+
var type = index !== -1 ? header.slice(0, index).trim() : header.trim();
|
|
38655
|
+
if (!TYPE_REGEXP.test(type)) {
|
|
38656
|
+
throw new TypeError("invalid media type");
|
|
38657
|
+
}
|
|
38658
|
+
var obj = new ContentType(type.toLowerCase());
|
|
38659
|
+
if (index !== -1) {
|
|
38660
|
+
var key2;
|
|
38661
|
+
var match;
|
|
38662
|
+
var value;
|
|
38663
|
+
PARAM_REGEXP.lastIndex = index;
|
|
38664
|
+
while (match = PARAM_REGEXP.exec(header)) {
|
|
38665
|
+
if (match.index !== index) {
|
|
38666
|
+
throw new TypeError("invalid parameter format");
|
|
38667
|
+
}
|
|
38668
|
+
index += match[0].length;
|
|
38669
|
+
key2 = match[1].toLowerCase();
|
|
38670
|
+
value = match[2];
|
|
38671
|
+
if (value.charCodeAt(0) === 34) {
|
|
38672
|
+
value = value.slice(1, -1);
|
|
38673
|
+
if (value.indexOf("\\") !== -1) {
|
|
38674
|
+
value = value.replace(QESC_REGEXP, "$1");
|
|
38675
|
+
}
|
|
38676
|
+
}
|
|
38677
|
+
obj.parameters[key2] = value;
|
|
38678
|
+
}
|
|
38679
|
+
if (index !== header.length) {
|
|
38680
|
+
throw new TypeError("invalid parameter format");
|
|
38681
|
+
}
|
|
38682
|
+
}
|
|
38683
|
+
return obj;
|
|
38684
|
+
}
|
|
38685
|
+
function getcontenttype(obj) {
|
|
38686
|
+
var header;
|
|
38687
|
+
if (typeof obj.getHeader === "function") {
|
|
38688
|
+
header = obj.getHeader("content-type");
|
|
38689
|
+
} else if (typeof obj.headers === "object") {
|
|
38690
|
+
header = obj.headers && obj.headers["content-type"];
|
|
38691
|
+
}
|
|
38692
|
+
if (typeof header !== "string") {
|
|
38693
|
+
throw new TypeError("content-type header is missing from object");
|
|
38694
|
+
}
|
|
38695
|
+
return header;
|
|
38696
|
+
}
|
|
38697
|
+
function qstring(val) {
|
|
38698
|
+
var str = String(val);
|
|
38699
|
+
if (TOKEN_REGEXP.test(str)) {
|
|
38700
|
+
return str;
|
|
38701
|
+
}
|
|
38702
|
+
if (str.length > 0 && !TEXT_REGEXP.test(str)) {
|
|
38703
|
+
throw new TypeError("invalid parameter value");
|
|
38704
|
+
}
|
|
38705
|
+
return '"' + str.replace(QUOTE_REGEXP, "\\$1") + '"';
|
|
38706
|
+
}
|
|
38707
|
+
function ContentType(type) {
|
|
38708
|
+
this.parameters = Object.create(null);
|
|
38709
|
+
this.type = type;
|
|
38710
|
+
}
|
|
38711
|
+
});
|
|
38712
|
+
|
|
38713
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js
|
|
38714
|
+
function mediaTypeEssence(header) {
|
|
38715
|
+
if (!header) {
|
|
38716
|
+
return;
|
|
38717
|
+
}
|
|
38718
|
+
try {
|
|
38719
|
+
return import_content_type.default.parse(header).type;
|
|
38720
|
+
} catch {
|
|
38721
|
+
const essence = (header.split(";", 1)[0] ?? "").trim().toLowerCase();
|
|
38722
|
+
if (essence === "" || header.slice(essence.length).includes(",")) {
|
|
38723
|
+
return;
|
|
38724
|
+
}
|
|
38725
|
+
return essence;
|
|
38726
|
+
}
|
|
38727
|
+
}
|
|
38728
|
+
function isJsonContentType(header) {
|
|
38729
|
+
if (header === "application/json") {
|
|
38730
|
+
return true;
|
|
38731
|
+
}
|
|
38732
|
+
return mediaTypeEssence(header) === "application/json";
|
|
38733
|
+
}
|
|
38734
|
+
var import_content_type;
|
|
38735
|
+
var init_mediaType = __esm(() => {
|
|
38736
|
+
import_content_type = __toESM(require_content_type(), 1);
|
|
38737
|
+
});
|
|
38738
|
+
|
|
38739
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.js
|
|
38740
|
+
function armSseKeepAlive(intervalMs, onTick) {
|
|
38741
|
+
if (!Number.isFinite(intervalMs) || intervalMs < 1) {
|
|
38742
|
+
return;
|
|
38743
|
+
}
|
|
38744
|
+
const timer = setInterval(onTick, Math.min(intervalMs, MAX_TIMER_DELAY_MS));
|
|
38745
|
+
timer.unref?.();
|
|
38746
|
+
return timer;
|
|
38747
|
+
}
|
|
38748
|
+
var DEFAULT_SSE_KEEP_ALIVE_MS = 15000, MAX_TIMER_DELAY_MS;
|
|
38749
|
+
var init_sseKeepAlive = __esm(() => {
|
|
38750
|
+
MAX_TIMER_DELAY_MS = 2 ** 31 - 1;
|
|
38751
|
+
});
|
|
38752
|
+
|
|
38183
38753
|
// node_modules/.bun/zod@3.25.76/node_modules/zod/v4/core/core.js
|
|
38184
38754
|
function $constructor(name, initializer, params) {
|
|
38185
38755
|
function init(inst, def) {
|
|
@@ -42766,7 +43336,7 @@ var init_v4 = __esm(() => {
|
|
|
42766
43336
|
init_classic();
|
|
42767
43337
|
});
|
|
42768
43338
|
|
|
42769
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
43339
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
|
|
42770
43340
|
function assertCompleteRequestPrompt(request) {
|
|
42771
43341
|
if (request.params.ref.type !== "ref/prompt") {
|
|
42772
43342
|
throw new TypeError(`Expected CompleteRequestPrompt, but got ${request.params.ref.type}`);
|
|
@@ -42785,7 +43355,7 @@ var init_types7 = __esm(() => {
|
|
|
42785
43355
|
ProgressTokenSchema = union([string2(), number2().int()]);
|
|
42786
43356
|
CursorSchema = string2();
|
|
42787
43357
|
TaskCreationParamsSchema = looseObject({
|
|
42788
|
-
ttl:
|
|
43358
|
+
ttl: number2().optional(),
|
|
42789
43359
|
pollInterval: number2().optional()
|
|
42790
43360
|
});
|
|
42791
43361
|
TaskMetadataSchema = object({
|
|
@@ -42933,7 +43503,8 @@ var init_types7 = __esm(() => {
|
|
|
42933
43503
|
roots: object({
|
|
42934
43504
|
listChanged: boolean2().optional()
|
|
42935
43505
|
}).optional(),
|
|
42936
|
-
tasks: ClientTasksCapabilitySchema.optional()
|
|
43506
|
+
tasks: ClientTasksCapabilitySchema.optional(),
|
|
43507
|
+
extensions: record(string2(), AssertObjectSchema).optional()
|
|
42937
43508
|
});
|
|
42938
43509
|
InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
42939
43510
|
protocolVersion: string2(),
|
|
@@ -42958,7 +43529,8 @@ var init_types7 = __esm(() => {
|
|
|
42958
43529
|
tools: object({
|
|
42959
43530
|
listChanged: boolean2().optional()
|
|
42960
43531
|
}).optional(),
|
|
42961
|
-
tasks: ServerTasksCapabilitySchema.optional()
|
|
43532
|
+
tasks: ServerTasksCapabilitySchema.optional(),
|
|
43533
|
+
extensions: record(string2(), AssertObjectSchema).optional()
|
|
42962
43534
|
});
|
|
42963
43535
|
InitializeResultSchema = ResultSchema.extend({
|
|
42964
43536
|
protocolVersion: string2(),
|
|
@@ -43073,6 +43645,7 @@ var init_types7 = __esm(() => {
|
|
|
43073
43645
|
uri: string2(),
|
|
43074
43646
|
description: optional(string2()),
|
|
43075
43647
|
mimeType: optional(string2()),
|
|
43648
|
+
size: optional(number2()),
|
|
43076
43649
|
annotations: AnnotationsSchema.optional(),
|
|
43077
43650
|
_meta: optional(looseObject({}))
|
|
43078
43651
|
});
|
|
@@ -43601,17 +44174,19 @@ var init_types7 = __esm(() => {
|
|
|
43601
44174
|
};
|
|
43602
44175
|
});
|
|
43603
44176
|
|
|
43604
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
44177
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.js
|
|
43605
44178
|
class WebStandardStreamableHTTPServerTransport {
|
|
43606
44179
|
constructor(options = {}) {
|
|
43607
44180
|
this._started = false;
|
|
43608
44181
|
this._hasHandledRequest = false;
|
|
43609
44182
|
this._streamMapping = new Map;
|
|
43610
44183
|
this._requestToStreamMapping = new Map;
|
|
44184
|
+
this._resumableStreams = new Set;
|
|
43611
44185
|
this._requestResponseMap = new Map;
|
|
43612
44186
|
this._initialized = false;
|
|
43613
44187
|
this._enableJsonResponse = false;
|
|
43614
44188
|
this._standaloneSseStreamId = "_GET_stream";
|
|
44189
|
+
this._closed = false;
|
|
43615
44190
|
this.sessionIdGenerator = options.sessionIdGenerator;
|
|
43616
44191
|
this._enableJsonResponse = options.enableJsonResponse ?? false;
|
|
43617
44192
|
this._eventStore = options.eventStore;
|
|
@@ -43621,6 +44196,22 @@ class WebStandardStreamableHTTPServerTransport {
|
|
|
43621
44196
|
this._allowedOrigins = options.allowedOrigins;
|
|
43622
44197
|
this._enableDnsRebindingProtection = options.enableDnsRebindingProtection ?? false;
|
|
43623
44198
|
this._retryInterval = options.retryInterval;
|
|
44199
|
+
this._keepAliveMs = options.keepAliveMs ?? DEFAULT_SSE_KEEP_ALIVE_MS;
|
|
44200
|
+
}
|
|
44201
|
+
startKeepAlive(controller, encoder) {
|
|
44202
|
+
if (this._closed)
|
|
44203
|
+
return;
|
|
44204
|
+
const timer = armSseKeepAlive(this._keepAliveMs, () => {
|
|
44205
|
+
try {
|
|
44206
|
+
controller.enqueue(encoder.encode(`: keepalive
|
|
44207
|
+
|
|
44208
|
+
`));
|
|
44209
|
+
} catch {
|
|
44210
|
+
if (timer !== undefined)
|
|
44211
|
+
clearInterval(timer);
|
|
44212
|
+
}
|
|
44213
|
+
});
|
|
44214
|
+
return timer;
|
|
43624
44215
|
}
|
|
43625
44216
|
async start() {
|
|
43626
44217
|
if (this._started) {
|
|
@@ -43668,6 +44259,9 @@ class WebStandardStreamableHTTPServerTransport {
|
|
|
43668
44259
|
return;
|
|
43669
44260
|
}
|
|
43670
44261
|
async handleRequest(req, options) {
|
|
44262
|
+
if (this._closed) {
|
|
44263
|
+
return this.createJsonErrorResponse(404, -32001, "Session not found");
|
|
44264
|
+
}
|
|
43671
44265
|
if (!this.sessionIdGenerator && this._hasHandledRequest) {
|
|
43672
44266
|
throw new Error("Stateless transport cannot be reused across requests. Create a new transport per request.");
|
|
43673
44267
|
}
|
|
@@ -43707,10 +44301,12 @@ data:
|
|
|
43707
44301
|
`;
|
|
43708
44302
|
}
|
|
43709
44303
|
controller.enqueue(encoder.encode(primingEvent));
|
|
44304
|
+
this._resumableStreams.add(streamId);
|
|
43710
44305
|
}
|
|
43711
44306
|
async handleGetRequest(req) {
|
|
43712
44307
|
const acceptHeader = req.headers.get("accept");
|
|
43713
44308
|
if (!acceptHeader?.includes("text/event-stream")) {
|
|
44309
|
+
this.onerror?.(new Error("Not Acceptable: Client must accept text/event-stream"));
|
|
43714
44310
|
return this.createJsonErrorResponse(406, -32000, "Not Acceptable: Client must accept text/event-stream");
|
|
43715
44311
|
}
|
|
43716
44312
|
const sessionError = this.validateSession(req);
|
|
@@ -43728,22 +44324,30 @@ data:
|
|
|
43728
44324
|
}
|
|
43729
44325
|
}
|
|
43730
44326
|
if (this._streamMapping.get(this._standaloneSseStreamId) !== undefined) {
|
|
44327
|
+
this.onerror?.(new Error("Conflict: Only one SSE stream is allowed per session"));
|
|
43731
44328
|
return this.createJsonErrorResponse(409, -32000, "Conflict: Only one SSE stream is allowed per session");
|
|
43732
44329
|
}
|
|
43733
44330
|
const encoder = new TextEncoder;
|
|
43734
44331
|
let streamController;
|
|
44332
|
+
let keepAliveTimer = undefined;
|
|
43735
44333
|
const readable = new ReadableStream({
|
|
43736
44334
|
start: (controller) => {
|
|
43737
44335
|
streamController = controller;
|
|
43738
44336
|
},
|
|
43739
44337
|
cancel: () => {
|
|
43740
|
-
|
|
44338
|
+
if (keepAliveTimer !== undefined) {
|
|
44339
|
+
clearInterval(keepAliveTimer);
|
|
44340
|
+
}
|
|
44341
|
+
if (this._streamMapping.get(this._standaloneSseStreamId)?.controller === streamController) {
|
|
44342
|
+
this._streamMapping.delete(this._standaloneSseStreamId);
|
|
44343
|
+
}
|
|
43741
44344
|
}
|
|
43742
44345
|
});
|
|
43743
44346
|
const headers = {
|
|
43744
44347
|
"Content-Type": "text/event-stream",
|
|
43745
44348
|
"Cache-Control": "no-cache, no-transform",
|
|
43746
|
-
Connection: "keep-alive"
|
|
44349
|
+
Connection: "keep-alive",
|
|
44350
|
+
"X-Accel-Buffering": "no"
|
|
43747
44351
|
};
|
|
43748
44352
|
if (this.sessionId !== undefined) {
|
|
43749
44353
|
headers["mcp-session-id"] = this.sessionId;
|
|
@@ -43752,16 +44356,21 @@ data:
|
|
|
43752
44356
|
controller: streamController,
|
|
43753
44357
|
encoder,
|
|
43754
44358
|
cleanup: () => {
|
|
44359
|
+
if (keepAliveTimer !== undefined) {
|
|
44360
|
+
clearInterval(keepAliveTimer);
|
|
44361
|
+
}
|
|
43755
44362
|
this._streamMapping.delete(this._standaloneSseStreamId);
|
|
43756
44363
|
try {
|
|
43757
44364
|
streamController.close();
|
|
43758
44365
|
} catch {}
|
|
43759
44366
|
}
|
|
43760
44367
|
});
|
|
44368
|
+
keepAliveTimer = this.startKeepAlive(streamController, encoder);
|
|
43761
44369
|
return new Response(readable, { headers });
|
|
43762
44370
|
}
|
|
43763
44371
|
async replayEvents(lastEventId) {
|
|
43764
44372
|
if (!this._eventStore) {
|
|
44373
|
+
this.onerror?.(new Error("Event store not configured"));
|
|
43765
44374
|
return this.createJsonErrorResponse(400, -32000, "Event store not configured");
|
|
43766
44375
|
}
|
|
43767
44376
|
try {
|
|
@@ -43769,29 +44378,44 @@ data:
|
|
|
43769
44378
|
if (this._eventStore.getStreamIdForEventId) {
|
|
43770
44379
|
streamId = await this._eventStore.getStreamIdForEventId(lastEventId);
|
|
43771
44380
|
if (!streamId) {
|
|
44381
|
+
this.onerror?.(new Error("Invalid event ID format"));
|
|
43772
44382
|
return this.createJsonErrorResponse(400, -32000, "Invalid event ID format");
|
|
43773
44383
|
}
|
|
43774
44384
|
if (this._streamMapping.get(streamId) !== undefined) {
|
|
44385
|
+
this.onerror?.(new Error("Conflict: Stream already has an active connection"));
|
|
43775
44386
|
return this.createJsonErrorResponse(409, -32000, "Conflict: Stream already has an active connection");
|
|
43776
44387
|
}
|
|
43777
44388
|
}
|
|
43778
44389
|
const headers = {
|
|
43779
44390
|
"Content-Type": "text/event-stream",
|
|
43780
44391
|
"Cache-Control": "no-cache, no-transform",
|
|
43781
|
-
Connection: "keep-alive"
|
|
44392
|
+
Connection: "keep-alive",
|
|
44393
|
+
"X-Accel-Buffering": "no"
|
|
43782
44394
|
};
|
|
43783
44395
|
if (this.sessionId !== undefined) {
|
|
43784
44396
|
headers["mcp-session-id"] = this.sessionId;
|
|
43785
44397
|
}
|
|
43786
44398
|
const encoder = new TextEncoder;
|
|
43787
44399
|
let streamController;
|
|
44400
|
+
let keepAliveTimer = undefined;
|
|
44401
|
+
let replayedStreamId = undefined;
|
|
44402
|
+
let cancelled = false;
|
|
43788
44403
|
const readable = new ReadableStream({
|
|
43789
44404
|
start: (controller) => {
|
|
43790
44405
|
streamController = controller;
|
|
43791
44406
|
},
|
|
43792
|
-
cancel: () => {
|
|
44407
|
+
cancel: () => {
|
|
44408
|
+
cancelled = true;
|
|
44409
|
+
if (keepAliveTimer !== undefined) {
|
|
44410
|
+
clearInterval(keepAliveTimer);
|
|
44411
|
+
}
|
|
44412
|
+
if (replayedStreamId !== undefined && this._streamMapping.get(replayedStreamId)?.controller === streamController) {
|
|
44413
|
+
this._streamMapping.delete(replayedStreamId);
|
|
44414
|
+
}
|
|
44415
|
+
}
|
|
43793
44416
|
});
|
|
43794
|
-
const
|
|
44417
|
+
const replayedEventIds = new Set;
|
|
44418
|
+
replayedStreamId = await this._eventStore.replayEventsAfter(lastEventId, {
|
|
43795
44419
|
send: async (eventId, message) => {
|
|
43796
44420
|
const success = this.writeSSEEvent(streamController, encoder, message, eventId);
|
|
43797
44421
|
if (!success) {
|
|
@@ -43799,19 +44423,34 @@ data:
|
|
|
43799
44423
|
try {
|
|
43800
44424
|
streamController.close();
|
|
43801
44425
|
} catch {}
|
|
44426
|
+
} else {
|
|
44427
|
+
replayedEventIds.add(eventId);
|
|
43802
44428
|
}
|
|
43803
44429
|
}
|
|
43804
44430
|
});
|
|
44431
|
+
if (this._closed || cancelled) {
|
|
44432
|
+
try {
|
|
44433
|
+
streamController.close();
|
|
44434
|
+
} catch {}
|
|
44435
|
+
return this.createJsonErrorResponse(404, -32001, "Session not found");
|
|
44436
|
+
}
|
|
44437
|
+
this._streamMapping.get(replayedStreamId)?.cleanup();
|
|
43805
44438
|
this._streamMapping.set(replayedStreamId, {
|
|
43806
44439
|
controller: streamController,
|
|
43807
44440
|
encoder,
|
|
44441
|
+
replayedEventIds,
|
|
43808
44442
|
cleanup: () => {
|
|
44443
|
+
if (keepAliveTimer !== undefined) {
|
|
44444
|
+
clearInterval(keepAliveTimer);
|
|
44445
|
+
}
|
|
43809
44446
|
this._streamMapping.delete(replayedStreamId);
|
|
43810
44447
|
try {
|
|
43811
44448
|
streamController.close();
|
|
43812
44449
|
} catch {}
|
|
43813
44450
|
}
|
|
43814
44451
|
});
|
|
44452
|
+
this._resumableStreams.add(replayedStreamId);
|
|
44453
|
+
keepAliveTimer = this.startKeepAlive(streamController, encoder);
|
|
43815
44454
|
return new Response(readable, { headers });
|
|
43816
44455
|
} catch (error3) {
|
|
43817
44456
|
this.onerror?.(error3);
|
|
@@ -43831,11 +44470,13 @@ data:
|
|
|
43831
44470
|
`;
|
|
43832
44471
|
controller.enqueue(encoder.encode(eventData));
|
|
43833
44472
|
return true;
|
|
43834
|
-
} catch {
|
|
44473
|
+
} catch (error3) {
|
|
44474
|
+
this.onerror?.(error3);
|
|
43835
44475
|
return false;
|
|
43836
44476
|
}
|
|
43837
44477
|
}
|
|
43838
44478
|
handleUnsupportedRequest() {
|
|
44479
|
+
this.onerror?.(new Error("Method not allowed."));
|
|
43839
44480
|
return new Response(JSON.stringify({
|
|
43840
44481
|
jsonrpc: "2.0",
|
|
43841
44482
|
error: {
|
|
@@ -43855,14 +44496,17 @@ data:
|
|
|
43855
44496
|
try {
|
|
43856
44497
|
const acceptHeader = req.headers.get("accept");
|
|
43857
44498
|
if (!acceptHeader?.includes("application/json") || !acceptHeader.includes("text/event-stream")) {
|
|
44499
|
+
this.onerror?.(new Error("Not Acceptable: Client must accept both application/json and text/event-stream"));
|
|
43858
44500
|
return this.createJsonErrorResponse(406, -32000, "Not Acceptable: Client must accept both application/json and text/event-stream");
|
|
43859
44501
|
}
|
|
43860
44502
|
const ct = req.headers.get("content-type");
|
|
43861
|
-
if (!ct
|
|
44503
|
+
if (!isJsonContentType(ct)) {
|
|
44504
|
+
this.onerror?.(new Error("Unsupported Media Type: Content-Type must be application/json"));
|
|
43862
44505
|
return this.createJsonErrorResponse(415, -32000, "Unsupported Media Type: Content-Type must be application/json");
|
|
43863
44506
|
}
|
|
43864
44507
|
const requestInfo = {
|
|
43865
|
-
headers: Object.fromEntries(req.headers.entries())
|
|
44508
|
+
headers: Object.fromEntries(req.headers.entries()),
|
|
44509
|
+
url: new URL(req.url)
|
|
43866
44510
|
};
|
|
43867
44511
|
let rawMessage;
|
|
43868
44512
|
if (options?.parsedBody !== undefined) {
|
|
@@ -43871,6 +44515,7 @@ data:
|
|
|
43871
44515
|
try {
|
|
43872
44516
|
rawMessage = await req.json();
|
|
43873
44517
|
} catch {
|
|
44518
|
+
this.onerror?.(new Error("Parse error: Invalid JSON"));
|
|
43874
44519
|
return this.createJsonErrorResponse(400, -32700, "Parse error: Invalid JSON");
|
|
43875
44520
|
}
|
|
43876
44521
|
}
|
|
@@ -43882,14 +44527,20 @@ data:
|
|
|
43882
44527
|
messages = [JSONRPCMessageSchema.parse(rawMessage)];
|
|
43883
44528
|
}
|
|
43884
44529
|
} catch {
|
|
44530
|
+
this.onerror?.(new Error("Parse error: Invalid JSON-RPC message"));
|
|
43885
44531
|
return this.createJsonErrorResponse(400, -32700, "Parse error: Invalid JSON-RPC message");
|
|
43886
44532
|
}
|
|
44533
|
+
if (this._closed) {
|
|
44534
|
+
return this.createJsonErrorResponse(404, -32001, "Session not found");
|
|
44535
|
+
}
|
|
43887
44536
|
const isInitializationRequest = messages.some(isInitializeRequest);
|
|
43888
44537
|
if (isInitializationRequest) {
|
|
43889
44538
|
if (this._initialized && this.sessionId !== undefined) {
|
|
44539
|
+
this.onerror?.(new Error("Invalid Request: Server already initialized"));
|
|
43890
44540
|
return this.createJsonErrorResponse(400, -32600, "Invalid Request: Server already initialized");
|
|
43891
44541
|
}
|
|
43892
44542
|
if (messages.length > 1) {
|
|
44543
|
+
this.onerror?.(new Error("Invalid Request: Only one initialization request is allowed"));
|
|
43893
44544
|
return this.createJsonErrorResponse(400, -32600, "Invalid Request: Only one initialization request is allowed");
|
|
43894
44545
|
}
|
|
43895
44546
|
this.sessionId = this.sessionIdGenerator?.();
|
|
@@ -43908,6 +44559,9 @@ data:
|
|
|
43908
44559
|
return protocolError;
|
|
43909
44560
|
}
|
|
43910
44561
|
}
|
|
44562
|
+
if (this._closed) {
|
|
44563
|
+
return this.createJsonErrorResponse(404, -32001, "Session not found");
|
|
44564
|
+
}
|
|
43911
44565
|
const hasRequests = messages.some(isJSONRPCRequest);
|
|
43912
44566
|
if (!hasRequests) {
|
|
43913
44567
|
for (const message of messages) {
|
|
@@ -43938,18 +44592,25 @@ data:
|
|
|
43938
44592
|
}
|
|
43939
44593
|
const encoder = new TextEncoder;
|
|
43940
44594
|
let streamController;
|
|
44595
|
+
let keepAliveTimer = undefined;
|
|
43941
44596
|
const readable = new ReadableStream({
|
|
43942
44597
|
start: (controller) => {
|
|
43943
44598
|
streamController = controller;
|
|
43944
44599
|
},
|
|
43945
44600
|
cancel: () => {
|
|
43946
|
-
|
|
44601
|
+
if (keepAliveTimer !== undefined) {
|
|
44602
|
+
clearInterval(keepAliveTimer);
|
|
44603
|
+
}
|
|
44604
|
+
if (this._streamMapping.get(streamId)?.controller === streamController) {
|
|
44605
|
+
this._streamMapping.delete(streamId);
|
|
44606
|
+
}
|
|
43947
44607
|
}
|
|
43948
44608
|
});
|
|
43949
44609
|
const headers = {
|
|
43950
44610
|
"Content-Type": "text/event-stream",
|
|
43951
|
-
"Cache-Control": "no-cache",
|
|
43952
|
-
Connection: "keep-alive"
|
|
44611
|
+
"Cache-Control": "no-cache, no-transform",
|
|
44612
|
+
Connection: "keep-alive",
|
|
44613
|
+
"X-Accel-Buffering": "no"
|
|
43953
44614
|
};
|
|
43954
44615
|
if (this.sessionId !== undefined) {
|
|
43955
44616
|
headers["mcp-session-id"] = this.sessionId;
|
|
@@ -43960,6 +44621,9 @@ data:
|
|
|
43960
44621
|
controller: streamController,
|
|
43961
44622
|
encoder,
|
|
43962
44623
|
cleanup: () => {
|
|
44624
|
+
if (keepAliveTimer !== undefined) {
|
|
44625
|
+
clearInterval(keepAliveTimer);
|
|
44626
|
+
}
|
|
43963
44627
|
this._streamMapping.delete(streamId);
|
|
43964
44628
|
try {
|
|
43965
44629
|
streamController.close();
|
|
@@ -43969,19 +44633,33 @@ data:
|
|
|
43969
44633
|
this._requestToStreamMapping.set(message.id, streamId);
|
|
43970
44634
|
}
|
|
43971
44635
|
}
|
|
43972
|
-
|
|
43973
|
-
|
|
43974
|
-
|
|
43975
|
-
|
|
43976
|
-
|
|
43977
|
-
|
|
43978
|
-
|
|
43979
|
-
|
|
43980
|
-
|
|
43981
|
-
|
|
43982
|
-
|
|
44636
|
+
try {
|
|
44637
|
+
await this.writePrimingEvent(streamController, encoder, streamId, clientProtocolVersion);
|
|
44638
|
+
for (const message of messages) {
|
|
44639
|
+
let closeSSEStream;
|
|
44640
|
+
let closeStandaloneSSEStream;
|
|
44641
|
+
if (isJSONRPCRequest(message) && this._eventStore && clientProtocolVersion >= "2025-11-25") {
|
|
44642
|
+
closeSSEStream = () => {
|
|
44643
|
+
this.closeSSEStream(message.id);
|
|
44644
|
+
};
|
|
44645
|
+
closeStandaloneSSEStream = () => {
|
|
44646
|
+
this.closeStandaloneSSEStream();
|
|
44647
|
+
};
|
|
44648
|
+
}
|
|
44649
|
+
this.onmessage?.(message, { authInfo: options?.authInfo, requestInfo, closeSSEStream, closeStandaloneSSEStream });
|
|
44650
|
+
}
|
|
44651
|
+
} catch (error3) {
|
|
44652
|
+
this._streamMapping.get(streamId)?.cleanup();
|
|
44653
|
+
this._resumableStreams.delete(streamId);
|
|
44654
|
+
for (const message of messages) {
|
|
44655
|
+
if (isJSONRPCRequest(message)) {
|
|
44656
|
+
this._requestToStreamMapping.delete(message.id);
|
|
44657
|
+
}
|
|
43983
44658
|
}
|
|
43984
|
-
|
|
44659
|
+
throw error3;
|
|
44660
|
+
}
|
|
44661
|
+
if (this._streamMapping.get(streamId)?.controller === streamController) {
|
|
44662
|
+
keepAliveTimer = this.startKeepAlive(streamController, encoder);
|
|
43985
44663
|
}
|
|
43986
44664
|
return new Response(readable, { status: 200, headers });
|
|
43987
44665
|
} catch (error3) {
|
|
@@ -43998,22 +44676,28 @@ data:
|
|
|
43998
44676
|
if (protocolError) {
|
|
43999
44677
|
return protocolError;
|
|
44000
44678
|
}
|
|
44001
|
-
|
|
44002
|
-
|
|
44003
|
-
|
|
44679
|
+
try {
|
|
44680
|
+
await Promise.resolve(this._onsessionclosed?.(this.sessionId));
|
|
44681
|
+
return new Response(null, { status: 200 });
|
|
44682
|
+
} finally {
|
|
44683
|
+
await this.close();
|
|
44684
|
+
}
|
|
44004
44685
|
}
|
|
44005
44686
|
validateSession(req) {
|
|
44006
44687
|
if (this.sessionIdGenerator === undefined) {
|
|
44007
44688
|
return;
|
|
44008
44689
|
}
|
|
44009
44690
|
if (!this._initialized) {
|
|
44691
|
+
this.onerror?.(new Error("Bad Request: Server not initialized"));
|
|
44010
44692
|
return this.createJsonErrorResponse(400, -32000, "Bad Request: Server not initialized");
|
|
44011
44693
|
}
|
|
44012
44694
|
const sessionId = req.headers.get("mcp-session-id");
|
|
44013
44695
|
if (!sessionId) {
|
|
44696
|
+
this.onerror?.(new Error("Bad Request: Mcp-Session-Id header is required"));
|
|
44014
44697
|
return this.createJsonErrorResponse(400, -32000, "Bad Request: Mcp-Session-Id header is required");
|
|
44015
44698
|
}
|
|
44016
44699
|
if (sessionId !== this.sessionId) {
|
|
44700
|
+
this.onerror?.(new Error("Session not found"));
|
|
44017
44701
|
return this.createJsonErrorResponse(404, -32001, "Session not found");
|
|
44018
44702
|
}
|
|
44019
44703
|
return;
|
|
@@ -44021,16 +44705,22 @@ data:
|
|
|
44021
44705
|
validateProtocolVersion(req) {
|
|
44022
44706
|
const protocolVersion = req.headers.get("mcp-protocol-version");
|
|
44023
44707
|
if (protocolVersion !== null && !SUPPORTED_PROTOCOL_VERSIONS.includes(protocolVersion)) {
|
|
44708
|
+
this.onerror?.(new Error(`Bad Request: Unsupported protocol version: ${protocolVersion}` + ` (supported versions: ${SUPPORTED_PROTOCOL_VERSIONS.join(", ")})`));
|
|
44024
44709
|
return this.createJsonErrorResponse(400, -32000, `Bad Request: Unsupported protocol version: ${protocolVersion} (supported versions: ${SUPPORTED_PROTOCOL_VERSIONS.join(", ")})`);
|
|
44025
44710
|
}
|
|
44026
44711
|
return;
|
|
44027
44712
|
}
|
|
44028
44713
|
async close() {
|
|
44714
|
+
if (this._closed) {
|
|
44715
|
+
return;
|
|
44716
|
+
}
|
|
44717
|
+
this._closed = true;
|
|
44029
44718
|
this._streamMapping.forEach(({ cleanup }) => {
|
|
44030
44719
|
cleanup();
|
|
44031
44720
|
});
|
|
44032
44721
|
this._streamMapping.clear();
|
|
44033
44722
|
this._requestResponseMap.clear();
|
|
44723
|
+
this._resumableStreams.clear();
|
|
44034
44724
|
this.onclose?.();
|
|
44035
44725
|
}
|
|
44036
44726
|
closeSSEStream(requestId) {
|
|
@@ -44065,7 +44755,7 @@ data:
|
|
|
44065
44755
|
if (standaloneSse === undefined) {
|
|
44066
44756
|
return;
|
|
44067
44757
|
}
|
|
44068
|
-
if (standaloneSse.controller && standaloneSse.encoder) {
|
|
44758
|
+
if (standaloneSse.controller && standaloneSse.encoder && (eventId === undefined || !standaloneSse.replayedEventIds?.has(eventId))) {
|
|
44069
44759
|
this.writeSSEEvent(standaloneSse.controller, standaloneSse.encoder, message, eventId);
|
|
44070
44760
|
}
|
|
44071
44761
|
return;
|
|
@@ -44074,13 +44764,19 @@ data:
|
|
|
44074
44764
|
if (!streamId) {
|
|
44075
44765
|
throw new Error(`No connection established for request ID: ${String(requestId)}`);
|
|
44076
44766
|
}
|
|
44077
|
-
|
|
44078
|
-
if (!this._enableJsonResponse
|
|
44767
|
+
let stream = this._streamMapping.get(streamId);
|
|
44768
|
+
if (!this._enableJsonResponse) {
|
|
44079
44769
|
let eventId;
|
|
44080
44770
|
if (this._eventStore) {
|
|
44081
44771
|
eventId = await this._eventStore.storeEvent(streamId, message);
|
|
44772
|
+
stream = this._streamMapping.get(streamId);
|
|
44773
|
+
}
|
|
44774
|
+
if (stream?.controller && stream?.encoder && (eventId === undefined || !stream.replayedEventIds?.has(eventId))) {
|
|
44775
|
+
const written = this.writeSSEEvent(stream.controller, stream.encoder, message, eventId);
|
|
44776
|
+
if (written && eventId !== undefined) {
|
|
44777
|
+
this._resumableStreams.add(streamId);
|
|
44778
|
+
}
|
|
44082
44779
|
}
|
|
44083
|
-
this.writeSSEEvent(stream.controller, stream.encoder, message, eventId);
|
|
44084
44780
|
}
|
|
44085
44781
|
if (isJSONRPCResultResponse(message) || isJSONRPCErrorResponse(message)) {
|
|
44086
44782
|
this._requestResponseMap.set(requestId, message);
|
|
@@ -44088,6 +44784,25 @@ data:
|
|
|
44088
44784
|
const allResponsesReady = relatedIds.every((id) => this._requestResponseMap.has(id));
|
|
44089
44785
|
if (allResponsesReady) {
|
|
44090
44786
|
if (!stream) {
|
|
44787
|
+
if (this._closed) {
|
|
44788
|
+
for (const id of relatedIds) {
|
|
44789
|
+
this._requestResponseMap.delete(id);
|
|
44790
|
+
this._requestToStreamMapping.delete(id);
|
|
44791
|
+
}
|
|
44792
|
+
return;
|
|
44793
|
+
}
|
|
44794
|
+
if (!this._enableJsonResponse && this._eventStore && this._resumableStreams.has(streamId)) {
|
|
44795
|
+
for (const id of relatedIds) {
|
|
44796
|
+
this._requestResponseMap.delete(id);
|
|
44797
|
+
this._requestToStreamMapping.delete(id);
|
|
44798
|
+
}
|
|
44799
|
+
this._resumableStreams.delete(streamId);
|
|
44800
|
+
return;
|
|
44801
|
+
}
|
|
44802
|
+
for (const id of relatedIds) {
|
|
44803
|
+
this._requestResponseMap.delete(id);
|
|
44804
|
+
this._requestToStreamMapping.delete(id);
|
|
44805
|
+
}
|
|
44091
44806
|
throw new Error(`No connection established for request ID: ${String(requestId)}`);
|
|
44092
44807
|
}
|
|
44093
44808
|
if (this._enableJsonResponse && stream.resolveJson) {
|
|
@@ -44110,11 +44825,14 @@ data:
|
|
|
44110
44825
|
this._requestResponseMap.delete(id);
|
|
44111
44826
|
this._requestToStreamMapping.delete(id);
|
|
44112
44827
|
}
|
|
44828
|
+
this._resumableStreams.delete(streamId);
|
|
44113
44829
|
}
|
|
44114
44830
|
}
|
|
44115
44831
|
}
|
|
44116
44832
|
}
|
|
44117
44833
|
var init_webStandardStreamableHttp = __esm(() => {
|
|
44834
|
+
init_mediaType();
|
|
44835
|
+
init_sseKeepAlive();
|
|
44118
44836
|
init_types7();
|
|
44119
44837
|
});
|
|
44120
44838
|
|
|
@@ -44208,7 +44926,7 @@ var init_v4_mini = __esm(() => {
|
|
|
44208
44926
|
init_mini();
|
|
44209
44927
|
});
|
|
44210
44928
|
|
|
44211
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
44929
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
|
|
44212
44930
|
function isZ4Schema(s) {
|
|
44213
44931
|
const schema2 = s;
|
|
44214
44932
|
return !!schema2._zod;
|
|
@@ -44292,17 +45010,34 @@ function normalizeObjectSchema(schema2) {
|
|
|
44292
45010
|
}
|
|
44293
45011
|
return;
|
|
44294
45012
|
}
|
|
45013
|
+
function getDotPath(path) {
|
|
45014
|
+
if (path.length === 0) {
|
|
45015
|
+
return "object root";
|
|
45016
|
+
}
|
|
45017
|
+
return path.reduce((acc, seg, index) => {
|
|
45018
|
+
if (index === 0) {
|
|
45019
|
+
return String(seg);
|
|
45020
|
+
}
|
|
45021
|
+
if (typeof seg === "number") {
|
|
45022
|
+
return `${acc}[${seg}]`;
|
|
45023
|
+
}
|
|
45024
|
+
return `${acc}.${seg}`;
|
|
45025
|
+
}, "");
|
|
45026
|
+
}
|
|
44295
45027
|
function getParseErrorMessage(error3) {
|
|
44296
45028
|
if (error3 && typeof error3 === "object") {
|
|
45029
|
+
if ("issues" in error3 && Array.isArray(error3.issues) && error3.issues.length > 0) {
|
|
45030
|
+
return error3.issues.map((i) => {
|
|
45031
|
+
if (!i.path?.length) {
|
|
45032
|
+
return i.message;
|
|
45033
|
+
}
|
|
45034
|
+
return `${i.message} at ${getDotPath(i.path)}`;
|
|
45035
|
+
}).join(`
|
|
45036
|
+
`);
|
|
45037
|
+
}
|
|
44297
45038
|
if ("message" in error3 && typeof error3.message === "string") {
|
|
44298
45039
|
return error3.message;
|
|
44299
45040
|
}
|
|
44300
|
-
if ("issues" in error3 && Array.isArray(error3.issues) && error3.issues.length > 0) {
|
|
44301
|
-
const firstIssue = error3.issues[0];
|
|
44302
|
-
if (firstIssue && typeof firstIssue === "object" && "message" in firstIssue) {
|
|
44303
|
-
return String(firstIssue.message);
|
|
44304
|
-
}
|
|
44305
|
-
}
|
|
44306
45041
|
try {
|
|
44307
45042
|
return JSON.stringify(error3);
|
|
44308
45043
|
} catch {
|
|
@@ -44356,12 +45091,12 @@ var init_zod_compat = __esm(() => {
|
|
|
44356
45091
|
init_v4_mini();
|
|
44357
45092
|
});
|
|
44358
45093
|
|
|
44359
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
45094
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
|
|
44360
45095
|
function isTerminal(status3) {
|
|
44361
45096
|
return status3 === "completed" || status3 === "failed" || status3 === "cancelled";
|
|
44362
45097
|
}
|
|
44363
45098
|
|
|
44364
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45099
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/Options.js
|
|
44365
45100
|
var ignoreOverride, defaultOptions, getDefaultOptions = (options) => typeof options === "string" ? {
|
|
44366
45101
|
...defaultOptions,
|
|
44367
45102
|
name: options
|
|
@@ -44397,7 +45132,7 @@ var init_Options = __esm(() => {
|
|
|
44397
45132
|
};
|
|
44398
45133
|
});
|
|
44399
45134
|
|
|
44400
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45135
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/Refs.js
|
|
44401
45136
|
var getRefs = (options) => {
|
|
44402
45137
|
const _options = getDefaultOptions(options);
|
|
44403
45138
|
const currentPath = _options.name !== undefined ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
|
|
@@ -44420,7 +45155,7 @@ var init_Refs = __esm(() => {
|
|
|
44420
45155
|
init_Options();
|
|
44421
45156
|
});
|
|
44422
45157
|
|
|
44423
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45158
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
|
|
44424
45159
|
function addErrorMessage(res, key2, errorMessage, refs) {
|
|
44425
45160
|
if (!refs?.errorMessages)
|
|
44426
45161
|
return;
|
|
@@ -44436,7 +45171,7 @@ function setResponseValueAndErrors(res, key2, value, errorMessage, refs) {
|
|
|
44436
45171
|
addErrorMessage(res, key2, errorMessage, refs);
|
|
44437
45172
|
}
|
|
44438
45173
|
|
|
44439
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45174
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
|
|
44440
45175
|
var getRelativePath = (pathA, pathB) => {
|
|
44441
45176
|
let i = 0;
|
|
44442
45177
|
for (;i < pathA.length && i < pathB.length; i++) {
|
|
@@ -44446,7 +45181,7 @@ var getRelativePath = (pathA, pathB) => {
|
|
|
44446
45181
|
return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
|
|
44447
45182
|
};
|
|
44448
45183
|
|
|
44449
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45184
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/any.js
|
|
44450
45185
|
function parseAnyDef(refs) {
|
|
44451
45186
|
if (refs.target !== "openAi") {
|
|
44452
45187
|
return {};
|
|
@@ -44463,7 +45198,7 @@ function parseAnyDef(refs) {
|
|
|
44463
45198
|
}
|
|
44464
45199
|
var init_any = () => {};
|
|
44465
45200
|
|
|
44466
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45201
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/array.js
|
|
44467
45202
|
function parseArrayDef(def, refs) {
|
|
44468
45203
|
const res = {
|
|
44469
45204
|
type: "array"
|
|
@@ -44491,7 +45226,7 @@ var init_array = __esm(() => {
|
|
|
44491
45226
|
init_parseDef();
|
|
44492
45227
|
});
|
|
44493
45228
|
|
|
44494
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45229
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
|
|
44495
45230
|
function parseBigintDef(def, refs) {
|
|
44496
45231
|
const res = {
|
|
44497
45232
|
type: "integer",
|
|
@@ -44538,14 +45273,14 @@ function parseBigintDef(def, refs) {
|
|
|
44538
45273
|
}
|
|
44539
45274
|
var init_bigint = () => {};
|
|
44540
45275
|
|
|
44541
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45276
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
|
|
44542
45277
|
function parseBooleanDef() {
|
|
44543
45278
|
return {
|
|
44544
45279
|
type: "boolean"
|
|
44545
45280
|
};
|
|
44546
45281
|
}
|
|
44547
45282
|
|
|
44548
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45283
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
|
|
44549
45284
|
function parseBrandedDef(_def, refs) {
|
|
44550
45285
|
return parseDef(_def.type._def, refs);
|
|
44551
45286
|
}
|
|
@@ -44553,7 +45288,7 @@ var init_branded = __esm(() => {
|
|
|
44553
45288
|
init_parseDef();
|
|
44554
45289
|
});
|
|
44555
45290
|
|
|
44556
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45291
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
|
|
44557
45292
|
var parseCatchDef = (def, refs) => {
|
|
44558
45293
|
return parseDef(def.innerType._def, refs);
|
|
44559
45294
|
};
|
|
@@ -44561,7 +45296,7 @@ var init_catch = __esm(() => {
|
|
|
44561
45296
|
init_parseDef();
|
|
44562
45297
|
});
|
|
44563
45298
|
|
|
44564
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45299
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/date.js
|
|
44565
45300
|
function parseDateDef(def, refs, overrideDateStrategy) {
|
|
44566
45301
|
const strategy = overrideDateStrategy ?? refs.dateStrategy;
|
|
44567
45302
|
if (Array.isArray(strategy)) {
|
|
@@ -44607,7 +45342,7 @@ var integerDateParser = (def, refs) => {
|
|
|
44607
45342
|
};
|
|
44608
45343
|
var init_date = () => {};
|
|
44609
45344
|
|
|
44610
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45345
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/default.js
|
|
44611
45346
|
function parseDefaultDef(_def, refs) {
|
|
44612
45347
|
return {
|
|
44613
45348
|
...parseDef(_def.innerType._def, refs),
|
|
@@ -44618,7 +45353,7 @@ var init_default = __esm(() => {
|
|
|
44618
45353
|
init_parseDef();
|
|
44619
45354
|
});
|
|
44620
45355
|
|
|
44621
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45356
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
|
|
44622
45357
|
function parseEffectsDef(_def, refs) {
|
|
44623
45358
|
return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) : parseAnyDef(refs);
|
|
44624
45359
|
}
|
|
@@ -44627,7 +45362,7 @@ var init_effects = __esm(() => {
|
|
|
44627
45362
|
init_any();
|
|
44628
45363
|
});
|
|
44629
45364
|
|
|
44630
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45365
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
|
|
44631
45366
|
function parseEnumDef(def) {
|
|
44632
45367
|
return {
|
|
44633
45368
|
type: "string",
|
|
@@ -44635,7 +45370,7 @@ function parseEnumDef(def) {
|
|
|
44635
45370
|
};
|
|
44636
45371
|
}
|
|
44637
45372
|
|
|
44638
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45373
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
|
|
44639
45374
|
function parseIntersectionDef(def, refs) {
|
|
44640
45375
|
const allOf = [
|
|
44641
45376
|
parseDef(def.left._def, {
|
|
@@ -44680,7 +45415,7 @@ var init_intersection = __esm(() => {
|
|
|
44680
45415
|
init_parseDef();
|
|
44681
45416
|
});
|
|
44682
45417
|
|
|
44683
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45418
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
|
|
44684
45419
|
function parseLiteralDef(def, refs) {
|
|
44685
45420
|
const parsedType2 = typeof def.value;
|
|
44686
45421
|
if (parsedType2 !== "bigint" && parsedType2 !== "number" && parsedType2 !== "boolean" && parsedType2 !== "string") {
|
|
@@ -44700,7 +45435,7 @@ function parseLiteralDef(def, refs) {
|
|
|
44700
45435
|
};
|
|
44701
45436
|
}
|
|
44702
45437
|
|
|
44703
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45438
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
|
|
44704
45439
|
function parseStringDef(def, refs) {
|
|
44705
45440
|
const res = {
|
|
44706
45441
|
type: "string"
|
|
@@ -44999,7 +45734,7 @@ var init_string = __esm(() => {
|
|
|
44999
45734
|
ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
45000
45735
|
});
|
|
45001
45736
|
|
|
45002
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45737
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
|
|
45003
45738
|
function parseRecordDef(def, refs) {
|
|
45004
45739
|
if (refs.target === "openAi") {
|
|
45005
45740
|
console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
|
|
@@ -45058,7 +45793,7 @@ var init_record = __esm(() => {
|
|
|
45058
45793
|
init_any();
|
|
45059
45794
|
});
|
|
45060
45795
|
|
|
45061
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45796
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/map.js
|
|
45062
45797
|
function parseMapDef(def, refs) {
|
|
45063
45798
|
if (refs.mapStrategy === "record") {
|
|
45064
45799
|
return parseRecordDef(def, refs);
|
|
@@ -45088,7 +45823,7 @@ var init_map = __esm(() => {
|
|
|
45088
45823
|
init_any();
|
|
45089
45824
|
});
|
|
45090
45825
|
|
|
45091
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45826
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
|
|
45092
45827
|
function parseNativeEnumDef(def) {
|
|
45093
45828
|
const object3 = def.values;
|
|
45094
45829
|
const actualKeys = Object.keys(def.values).filter((key2) => {
|
|
@@ -45102,7 +45837,7 @@ function parseNativeEnumDef(def) {
|
|
|
45102
45837
|
};
|
|
45103
45838
|
}
|
|
45104
45839
|
|
|
45105
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45840
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/never.js
|
|
45106
45841
|
function parseNeverDef(refs) {
|
|
45107
45842
|
return refs.target === "openAi" ? undefined : {
|
|
45108
45843
|
not: parseAnyDef({
|
|
@@ -45115,7 +45850,7 @@ var init_never = __esm(() => {
|
|
|
45115
45850
|
init_any();
|
|
45116
45851
|
});
|
|
45117
45852
|
|
|
45118
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45853
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/null.js
|
|
45119
45854
|
function parseNullDef(refs) {
|
|
45120
45855
|
return refs.target === "openApi3" ? {
|
|
45121
45856
|
enum: ["null"],
|
|
@@ -45125,7 +45860,7 @@ function parseNullDef(refs) {
|
|
|
45125
45860
|
};
|
|
45126
45861
|
}
|
|
45127
45862
|
|
|
45128
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45863
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/union.js
|
|
45129
45864
|
function parseUnionDef(def, refs) {
|
|
45130
45865
|
if (refs.target === "openApi3")
|
|
45131
45866
|
return asAnyOf(def, refs);
|
|
@@ -45196,7 +45931,7 @@ var init_union = __esm(() => {
|
|
|
45196
45931
|
};
|
|
45197
45932
|
});
|
|
45198
45933
|
|
|
45199
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45934
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
|
|
45200
45935
|
function parseNullableDef(def, refs) {
|
|
45201
45936
|
if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
|
|
45202
45937
|
if (refs.target === "openApi3") {
|
|
@@ -45232,7 +45967,7 @@ var init_nullable = __esm(() => {
|
|
|
45232
45967
|
init_union();
|
|
45233
45968
|
});
|
|
45234
45969
|
|
|
45235
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45970
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/number.js
|
|
45236
45971
|
function parseNumberDef(def, refs) {
|
|
45237
45972
|
const res = {
|
|
45238
45973
|
type: "number"
|
|
@@ -45282,7 +46017,7 @@ function parseNumberDef(def, refs) {
|
|
|
45282
46017
|
}
|
|
45283
46018
|
var init_number = () => {};
|
|
45284
46019
|
|
|
45285
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
46020
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/object.js
|
|
45286
46021
|
function parseObjectDef(def, refs) {
|
|
45287
46022
|
const forceOptionalIntoNullable = refs.target === "openAi";
|
|
45288
46023
|
const result = {
|
|
@@ -45355,7 +46090,7 @@ var init_object = __esm(() => {
|
|
|
45355
46090
|
init_parseDef();
|
|
45356
46091
|
});
|
|
45357
46092
|
|
|
45358
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
46093
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
|
|
45359
46094
|
var parseOptionalDef = (def, refs) => {
|
|
45360
46095
|
if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
|
|
45361
46096
|
return parseDef(def.innerType._def, refs);
|
|
@@ -45378,7 +46113,7 @@ var init_optional = __esm(() => {
|
|
|
45378
46113
|
init_any();
|
|
45379
46114
|
});
|
|
45380
46115
|
|
|
45381
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
46116
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
|
|
45382
46117
|
var parsePipelineDef = (def, refs) => {
|
|
45383
46118
|
if (refs.pipeStrategy === "input") {
|
|
45384
46119
|
return parseDef(def.in._def, refs);
|
|
@@ -45401,7 +46136,7 @@ var init_pipeline = __esm(() => {
|
|
|
45401
46136
|
init_parseDef();
|
|
45402
46137
|
});
|
|
45403
46138
|
|
|
45404
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
46139
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
|
|
45405
46140
|
function parsePromiseDef(def, refs) {
|
|
45406
46141
|
return parseDef(def.type._def, refs);
|
|
45407
46142
|
}
|
|
@@ -45409,7 +46144,7 @@ var init_promise = __esm(() => {
|
|
|
45409
46144
|
init_parseDef();
|
|
45410
46145
|
});
|
|
45411
46146
|
|
|
45412
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
46147
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/set.js
|
|
45413
46148
|
function parseSetDef(def, refs) {
|
|
45414
46149
|
const items = parseDef(def.valueType._def, {
|
|
45415
46150
|
...refs,
|
|
@@ -45432,7 +46167,7 @@ var init_set = __esm(() => {
|
|
|
45432
46167
|
init_parseDef();
|
|
45433
46168
|
});
|
|
45434
46169
|
|
|
45435
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
46170
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
|
|
45436
46171
|
function parseTupleDef(def, refs) {
|
|
45437
46172
|
if (def.rest) {
|
|
45438
46173
|
return {
|
|
@@ -45463,7 +46198,7 @@ var init_tuple = __esm(() => {
|
|
|
45463
46198
|
init_parseDef();
|
|
45464
46199
|
});
|
|
45465
46200
|
|
|
45466
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
46201
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
|
|
45467
46202
|
function parseUndefinedDef(refs) {
|
|
45468
46203
|
return {
|
|
45469
46204
|
not: parseAnyDef(refs)
|
|
@@ -45473,7 +46208,7 @@ var init_undefined = __esm(() => {
|
|
|
45473
46208
|
init_any();
|
|
45474
46209
|
});
|
|
45475
46210
|
|
|
45476
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
46211
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
|
|
45477
46212
|
function parseUnknownDef(refs) {
|
|
45478
46213
|
return parseAnyDef(refs);
|
|
45479
46214
|
}
|
|
@@ -45481,7 +46216,7 @@ var init_unknown = __esm(() => {
|
|
|
45481
46216
|
init_any();
|
|
45482
46217
|
});
|
|
45483
46218
|
|
|
45484
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
46219
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
|
|
45485
46220
|
var parseReadonlyDef = (def, refs) => {
|
|
45486
46221
|
return parseDef(def.innerType._def, refs);
|
|
45487
46222
|
};
|
|
@@ -45489,7 +46224,7 @@ var init_readonly = __esm(() => {
|
|
|
45489
46224
|
init_parseDef();
|
|
45490
46225
|
});
|
|
45491
46226
|
|
|
45492
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
46227
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/selectParser.js
|
|
45493
46228
|
var selectParser = (def, typeName, refs) => {
|
|
45494
46229
|
switch (typeName) {
|
|
45495
46230
|
case ZodFirstPartyTypeKind.ZodString:
|
|
@@ -45595,7 +46330,7 @@ var init_selectParser = __esm(() => {
|
|
|
45595
46330
|
init_readonly();
|
|
45596
46331
|
});
|
|
45597
46332
|
|
|
45598
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
46333
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parseDef.js
|
|
45599
46334
|
function parseDef(def, refs, forceResolution = false) {
|
|
45600
46335
|
const seenItem = refs.seen.get(def);
|
|
45601
46336
|
if (refs.override) {
|
|
@@ -45655,10 +46390,10 @@ var init_parseDef = __esm(() => {
|
|
|
45655
46390
|
init_any();
|
|
45656
46391
|
});
|
|
45657
46392
|
|
|
45658
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
46393
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parseTypes.js
|
|
45659
46394
|
var init_parseTypes = () => {};
|
|
45660
46395
|
|
|
45661
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
46396
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
|
|
45662
46397
|
var zodToJsonSchema = (schema2, options) => {
|
|
45663
46398
|
const refs = getRefs(options);
|
|
45664
46399
|
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name2, schema3]) => ({
|
|
@@ -45724,7 +46459,7 @@ var init_zodToJsonSchema = __esm(() => {
|
|
|
45724
46459
|
init_any();
|
|
45725
46460
|
});
|
|
45726
46461
|
|
|
45727
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
46462
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/index.js
|
|
45728
46463
|
var init_esm = __esm(() => {
|
|
45729
46464
|
init_zodToJsonSchema();
|
|
45730
46465
|
init_Options();
|
|
@@ -45760,7 +46495,7 @@ var init_esm = __esm(() => {
|
|
|
45760
46495
|
init_zodToJsonSchema();
|
|
45761
46496
|
});
|
|
45762
46497
|
|
|
45763
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
46498
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
|
|
45764
46499
|
function mapMiniTarget(t) {
|
|
45765
46500
|
if (!t)
|
|
45766
46501
|
return "draft-7";
|
|
@@ -45807,7 +46542,7 @@ var init_zod_json_schema_compat = __esm(() => {
|
|
|
45807
46542
|
init_esm();
|
|
45808
46543
|
});
|
|
45809
46544
|
|
|
45810
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
46545
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
|
|
45811
46546
|
class Protocol {
|
|
45812
46547
|
constructor(_options) {
|
|
45813
46548
|
this._options = _options;
|
|
@@ -46009,6 +46744,10 @@ class Protocol {
|
|
|
46009
46744
|
this._progressHandlers.clear();
|
|
46010
46745
|
this._taskProgressTokens.clear();
|
|
46011
46746
|
this._pendingDebouncedNotifications.clear();
|
|
46747
|
+
for (const info of this._timeoutInfo.values()) {
|
|
46748
|
+
clearTimeout(info.timeoutId);
|
|
46749
|
+
}
|
|
46750
|
+
this._timeoutInfo.clear();
|
|
46012
46751
|
for (const controller of this._requestHandlerAbortControllers.values()) {
|
|
46013
46752
|
controller.abort();
|
|
46014
46753
|
}
|
|
@@ -46139,7 +46878,9 @@ class Protocol {
|
|
|
46139
46878
|
await capturedTransport?.send(errorResponse);
|
|
46140
46879
|
}
|
|
46141
46880
|
}).catch((error3) => this._onerror(new Error(`Failed to send response: ${error3}`))).finally(() => {
|
|
46142
|
-
this._requestHandlerAbortControllers.
|
|
46881
|
+
if (this._requestHandlerAbortControllers.get(request.id) === abortController) {
|
|
46882
|
+
this._requestHandlerAbortControllers.delete(request.id);
|
|
46883
|
+
}
|
|
46143
46884
|
});
|
|
46144
46885
|
}
|
|
46145
46886
|
_onprogress(notification) {
|
|
@@ -53205,7 +53946,7 @@ var require_dist = __commonJS((exports, module) => {
|
|
|
53205
53946
|
exports.default = formatsPlugin;
|
|
53206
53947
|
});
|
|
53207
53948
|
|
|
53208
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
53949
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
|
|
53209
53950
|
function createDefaultAjvInstance() {
|
|
53210
53951
|
const ajv = new import_ajv.default({
|
|
53211
53952
|
strict: false,
|
|
@@ -53248,7 +53989,7 @@ var init_ajv_provider = __esm(() => {
|
|
|
53248
53989
|
import_ajv_formats = __toESM(require_dist(), 1);
|
|
53249
53990
|
});
|
|
53250
53991
|
|
|
53251
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
53992
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
|
|
53252
53993
|
class ExperimentalServerTasks {
|
|
53253
53994
|
constructor(_server) {
|
|
53254
53995
|
this._server = _server;
|
|
@@ -53256,6 +53997,62 @@ class ExperimentalServerTasks {
|
|
|
53256
53997
|
requestStream(request, resultSchema, options) {
|
|
53257
53998
|
return this._server.requestStream(request, resultSchema, options);
|
|
53258
53999
|
}
|
|
54000
|
+
createMessageStream(params, options) {
|
|
54001
|
+
const clientCapabilities = this._server.getClientCapabilities();
|
|
54002
|
+
if ((params.tools || params.toolChoice) && !clientCapabilities?.sampling?.tools) {
|
|
54003
|
+
throw new Error("Client does not support sampling tools capability.");
|
|
54004
|
+
}
|
|
54005
|
+
if (params.messages.length > 0) {
|
|
54006
|
+
const lastMessage = params.messages[params.messages.length - 1];
|
|
54007
|
+
const lastContent = Array.isArray(lastMessage.content) ? lastMessage.content : [lastMessage.content];
|
|
54008
|
+
const hasToolResults = lastContent.some((c) => c.type === "tool_result");
|
|
54009
|
+
const previousMessage = params.messages.length > 1 ? params.messages[params.messages.length - 2] : undefined;
|
|
54010
|
+
const previousContent = previousMessage ? Array.isArray(previousMessage.content) ? previousMessage.content : [previousMessage.content] : [];
|
|
54011
|
+
const hasPreviousToolUse = previousContent.some((c) => c.type === "tool_use");
|
|
54012
|
+
if (hasToolResults) {
|
|
54013
|
+
if (lastContent.some((c) => c.type !== "tool_result")) {
|
|
54014
|
+
throw new Error("The last message must contain only tool_result content if any is present");
|
|
54015
|
+
}
|
|
54016
|
+
if (!hasPreviousToolUse) {
|
|
54017
|
+
throw new Error("tool_result blocks are not matching any tool_use from the previous message");
|
|
54018
|
+
}
|
|
54019
|
+
}
|
|
54020
|
+
if (hasPreviousToolUse) {
|
|
54021
|
+
const toolUseIds = new Set(previousContent.filter((c) => c.type === "tool_use").map((c) => c.id));
|
|
54022
|
+
const toolResultIds = new Set(lastContent.filter((c) => c.type === "tool_result").map((c) => c.toolUseId));
|
|
54023
|
+
if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every((id) => toolResultIds.has(id))) {
|
|
54024
|
+
throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match");
|
|
54025
|
+
}
|
|
54026
|
+
}
|
|
54027
|
+
}
|
|
54028
|
+
return this.requestStream({
|
|
54029
|
+
method: "sampling/createMessage",
|
|
54030
|
+
params
|
|
54031
|
+
}, CreateMessageResultSchema, options);
|
|
54032
|
+
}
|
|
54033
|
+
elicitInputStream(params, options) {
|
|
54034
|
+
const clientCapabilities = this._server.getClientCapabilities();
|
|
54035
|
+
const mode = params.mode ?? "form";
|
|
54036
|
+
switch (mode) {
|
|
54037
|
+
case "url": {
|
|
54038
|
+
if (!clientCapabilities?.elicitation?.url) {
|
|
54039
|
+
throw new Error("Client does not support url elicitation.");
|
|
54040
|
+
}
|
|
54041
|
+
break;
|
|
54042
|
+
}
|
|
54043
|
+
case "form": {
|
|
54044
|
+
if (!clientCapabilities?.elicitation?.form) {
|
|
54045
|
+
throw new Error("Client does not support form elicitation.");
|
|
54046
|
+
}
|
|
54047
|
+
break;
|
|
54048
|
+
}
|
|
54049
|
+
}
|
|
54050
|
+
const normalizedParams = mode === "form" && params.mode === undefined ? { ...params, mode: "form" } : params;
|
|
54051
|
+
return this.requestStream({
|
|
54052
|
+
method: "elicitation/create",
|
|
54053
|
+
params: normalizedParams
|
|
54054
|
+
}, ElicitResultSchema, options);
|
|
54055
|
+
}
|
|
53259
54056
|
async getTask(taskId, options) {
|
|
53260
54057
|
return this._server.getTask({ taskId }, options);
|
|
53261
54058
|
}
|
|
@@ -53269,8 +54066,11 @@ class ExperimentalServerTasks {
|
|
|
53269
54066
|
return this._server.cancelTask({ taskId }, options);
|
|
53270
54067
|
}
|
|
53271
54068
|
}
|
|
54069
|
+
var init_server = __esm(() => {
|
|
54070
|
+
init_types7();
|
|
54071
|
+
});
|
|
53272
54072
|
|
|
53273
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
54073
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
|
|
53274
54074
|
function assertToolsCallTaskCapability(requests, method, entityName) {
|
|
53275
54075
|
if (!requests) {
|
|
53276
54076
|
throw new Error(`${entityName} does not support task creation (required for ${method})`);
|
|
@@ -53305,13 +54105,14 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
|
|
|
53305
54105
|
}
|
|
53306
54106
|
}
|
|
53307
54107
|
|
|
53308
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
54108
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
|
|
53309
54109
|
var Server;
|
|
53310
|
-
var
|
|
54110
|
+
var init_server2 = __esm(() => {
|
|
53311
54111
|
init_protocol();
|
|
53312
54112
|
init_types7();
|
|
53313
54113
|
init_ajv_provider();
|
|
53314
54114
|
init_zod_compat();
|
|
54115
|
+
init_server();
|
|
53315
54116
|
Server = class Server extends Protocol {
|
|
53316
54117
|
constructor(_serverInfo, options) {
|
|
53317
54118
|
super(options);
|
|
@@ -53359,16 +54160,7 @@ var init_server = __esm(() => {
|
|
|
53359
54160
|
if (!methodSchema) {
|
|
53360
54161
|
throw new Error("Schema is missing a method literal");
|
|
53361
54162
|
}
|
|
53362
|
-
|
|
53363
|
-
if (isZ4Schema(methodSchema)) {
|
|
53364
|
-
const v4Schema = methodSchema;
|
|
53365
|
-
const v4Def = v4Schema._zod?.def;
|
|
53366
|
-
methodValue = v4Def?.value ?? v4Schema.value;
|
|
53367
|
-
} else {
|
|
53368
|
-
const v3Schema = methodSchema;
|
|
53369
|
-
const legacyDef = v3Schema._def;
|
|
53370
|
-
methodValue = legacyDef?.value ?? v3Schema.value;
|
|
53371
|
-
}
|
|
54163
|
+
const methodValue = getLiteralValue(methodSchema);
|
|
53372
54164
|
if (typeof methodValue !== "string") {
|
|
53373
54165
|
throw new Error("Schema method literal must be a string");
|
|
53374
54166
|
}
|
|
@@ -53645,7 +54437,7 @@ var init_server = __esm(() => {
|
|
|
53645
54437
|
};
|
|
53646
54438
|
});
|
|
53647
54439
|
|
|
53648
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
54440
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
|
|
53649
54441
|
function isCompletable(schema2) {
|
|
53650
54442
|
return !!schema2 && typeof schema2 === "object" && COMPLETABLE_SYMBOL in schema2;
|
|
53651
54443
|
}
|
|
@@ -53660,7 +54452,7 @@ var init_completable = __esm(() => {
|
|
|
53660
54452
|
McpZodTypeKind2["Completable"] = "McpCompletable";
|
|
53661
54453
|
})(McpZodTypeKind || (McpZodTypeKind = {}));
|
|
53662
54454
|
});
|
|
53663
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
54455
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
|
|
53664
54456
|
function validateToolName(name) {
|
|
53665
54457
|
const warnings = [];
|
|
53666
54458
|
if (name.length === 0) {
|
|
@@ -53721,7 +54513,7 @@ var init_toolNameValidation = __esm(() => {
|
|
|
53721
54513
|
TOOL_NAME_REGEX = /^[A-Za-z0-9._-]{1,128}$/;
|
|
53722
54514
|
});
|
|
53723
54515
|
|
|
53724
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
54516
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
|
|
53725
54517
|
class ExperimentalMcpServerTasks {
|
|
53726
54518
|
constructor(_mcpServer) {
|
|
53727
54519
|
this._mcpServer = _mcpServer;
|
|
@@ -53736,7 +54528,7 @@ class ExperimentalMcpServerTasks {
|
|
|
53736
54528
|
}
|
|
53737
54529
|
}
|
|
53738
54530
|
|
|
53739
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
54531
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
|
|
53740
54532
|
class McpServer {
|
|
53741
54533
|
constructor(serverInfo, options) {
|
|
53742
54534
|
this._registeredResources = {};
|
|
@@ -54320,6 +55112,9 @@ class McpServer {
|
|
|
54320
55112
|
annotations = rest.shift();
|
|
54321
55113
|
}
|
|
54322
55114
|
} else if (typeof firstArg === "object" && firstArg !== null) {
|
|
55115
|
+
if (Object.values(firstArg).some((v) => typeof v === "object" && v !== null)) {
|
|
55116
|
+
throw new Error(`Tool ${name} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);
|
|
55117
|
+
}
|
|
54323
55118
|
annotations = rest.shift();
|
|
54324
55119
|
}
|
|
54325
55120
|
}
|
|
@@ -54408,6 +55203,9 @@ function getZodSchemaObject(schema2) {
|
|
|
54408
55203
|
if (isZodRawShapeCompat(schema2)) {
|
|
54409
55204
|
return objectFromShape(schema2);
|
|
54410
55205
|
}
|
|
55206
|
+
if (!isZodSchemaInstance(schema2)) {
|
|
55207
|
+
throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");
|
|
55208
|
+
}
|
|
54411
55209
|
return schema2;
|
|
54412
55210
|
}
|
|
54413
55211
|
function promptArgumentsFromSchema(schema2) {
|
|
@@ -54447,7 +55245,7 @@ function createCompletionResult(suggestions) {
|
|
|
54447
55245
|
}
|
|
54448
55246
|
var EMPTY_OBJECT_JSON_SCHEMA, EMPTY_COMPLETION_RESULT;
|
|
54449
55247
|
var init_mcp = __esm(() => {
|
|
54450
|
-
|
|
55248
|
+
init_server2();
|
|
54451
55249
|
init_zod_compat();
|
|
54452
55250
|
init_zod_json_schema_compat();
|
|
54453
55251
|
init_types7();
|
|
@@ -54466,9 +55264,17 @@ var init_mcp = __esm(() => {
|
|
|
54466
55264
|
};
|
|
54467
55265
|
});
|
|
54468
55266
|
|
|
54469
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
55267
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
|
|
54470
55268
|
class ReadBuffer {
|
|
55269
|
+
constructor(options) {
|
|
55270
|
+
this._maxBufferSize = options?.maxBufferSize ?? STDIO_DEFAULT_MAX_BUFFER_SIZE;
|
|
55271
|
+
}
|
|
54471
55272
|
append(chunk) {
|
|
55273
|
+
const newSize = (this._buffer?.length ?? 0) + chunk.length;
|
|
55274
|
+
if (newSize > this._maxBufferSize) {
|
|
55275
|
+
this.clear();
|
|
55276
|
+
throw new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);
|
|
55277
|
+
}
|
|
54472
55278
|
this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk;
|
|
54473
55279
|
}
|
|
54474
55280
|
readMessage() {
|
|
@@ -54495,26 +55301,33 @@ function serializeMessage(message) {
|
|
|
54495
55301
|
return JSON.stringify(message) + `
|
|
54496
55302
|
`;
|
|
54497
55303
|
}
|
|
55304
|
+
var STDIO_DEFAULT_MAX_BUFFER_SIZE;
|
|
54498
55305
|
var init_stdio = __esm(() => {
|
|
54499
55306
|
init_types7();
|
|
55307
|
+
STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024;
|
|
54500
55308
|
});
|
|
54501
55309
|
|
|
54502
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
55310
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
54503
55311
|
import process2 from "process";
|
|
54504
55312
|
|
|
54505
55313
|
class StdioServerTransport {
|
|
54506
|
-
constructor(_stdin = process2.stdin, _stdout = process2.stdout) {
|
|
55314
|
+
constructor(_stdin = process2.stdin, _stdout = process2.stdout, options) {
|
|
54507
55315
|
this._stdin = _stdin;
|
|
54508
55316
|
this._stdout = _stdout;
|
|
54509
|
-
this._readBuffer = new ReadBuffer;
|
|
54510
55317
|
this._started = false;
|
|
54511
55318
|
this._ondata = (chunk) => {
|
|
54512
|
-
|
|
54513
|
-
|
|
55319
|
+
try {
|
|
55320
|
+
this._readBuffer.append(chunk);
|
|
55321
|
+
this.processReadBuffer();
|
|
55322
|
+
} catch (error3) {
|
|
55323
|
+
this.onerror?.(error3);
|
|
55324
|
+
this.close().catch(() => {});
|
|
55325
|
+
}
|
|
54514
55326
|
};
|
|
54515
55327
|
this._onerror = (error3) => {
|
|
54516
55328
|
this.onerror?.(error3);
|
|
54517
55329
|
};
|
|
55330
|
+
this._readBuffer = new ReadBuffer({ maxBufferSize: options?.maxBufferSize });
|
|
54518
55331
|
}
|
|
54519
55332
|
async start() {
|
|
54520
55333
|
if (this._started) {
|
|
@@ -55795,7 +56608,7 @@ var init_assignee_context = __esm(() => {
|
|
|
55795
56608
|
init_assignee_validation();
|
|
55796
56609
|
});
|
|
55797
56610
|
|
|
55798
|
-
// node_modules/.bun/@hasna+contracts@0.
|
|
56611
|
+
// node_modules/.bun/@hasna+contracts@0.14.0+619f74e7b30eeaf4/node_modules/@hasna/contracts/dist/client/storage.js
|
|
55799
56612
|
import { isIP } from "net";
|
|
55800
56613
|
import { readFileSync as readFileSync5, statSync as statSync4 } from "fs";
|
|
55801
56614
|
import { join as join10 } from "path";
|
|
@@ -58460,8 +59273,8 @@ function registerTaskCrudTools(server, ctx) {
|
|
|
58460
59273
|
tags: exports_external.array(exports_external.string()).optional().describe("Filter by tags (AND logic)"),
|
|
58461
59274
|
created_after: exports_external.string().optional().describe("ISO date \u2014 tasks created after this date"),
|
|
58462
59275
|
created_before: exports_external.string().optional().describe("ISO date \u2014 tasks created before this date"),
|
|
58463
|
-
limit: exports_external.number().optional().describe("Max results (default: 50, max 500)"),
|
|
58464
|
-
offset: exports_external.number().optional().describe("Pagination offset"),
|
|
59276
|
+
limit: exports_external.number().int().min(1).optional().describe("Max results (default: 50, max 500)"),
|
|
59277
|
+
offset: exports_external.number().int().min(0).optional().describe("Pagination offset"),
|
|
58465
59278
|
metadata: exports_external.record(exports_external.unknown()).optional().describe("Exact top-level metadata filters")
|
|
58466
59279
|
}, async (params) => {
|
|
58467
59280
|
try {
|
|
@@ -61811,6 +62624,48 @@ var init_task_relationships = __esm(() => {
|
|
|
61811
62624
|
];
|
|
61812
62625
|
});
|
|
61813
62626
|
|
|
62627
|
+
// src/lib/dedupe-projection.ts
|
|
62628
|
+
function projectTasksForDedupe(tasks) {
|
|
62629
|
+
return tasks.map((task2) => {
|
|
62630
|
+
const metadata = {};
|
|
62631
|
+
for (const key2 of DEDUPE_SOURCE_KEY_ALLOWLIST) {
|
|
62632
|
+
if (key2 in task2.metadata) {
|
|
62633
|
+
metadata[key2] = redactValue(task2.metadata[key2]);
|
|
62634
|
+
}
|
|
62635
|
+
}
|
|
62636
|
+
return {
|
|
62637
|
+
id: task2.id,
|
|
62638
|
+
short_id: task2.short_id,
|
|
62639
|
+
title: redactEvidenceText(task2.title),
|
|
62640
|
+
description: task2.description === null || task2.description === undefined ? null : redactEvidenceText(task2.description),
|
|
62641
|
+
status: task2.status,
|
|
62642
|
+
created_at: task2.created_at,
|
|
62643
|
+
updated_at: task2.updated_at,
|
|
62644
|
+
project_id: task2.project_id,
|
|
62645
|
+
task_list_id: task2.task_list_id,
|
|
62646
|
+
assigned_to: task2.assigned_to,
|
|
62647
|
+
priority: task2.priority,
|
|
62648
|
+
metadata
|
|
62649
|
+
};
|
|
62650
|
+
});
|
|
62651
|
+
}
|
|
62652
|
+
var DEDUPE_SOURCE_KEY_ALLOWLIST;
|
|
62653
|
+
var init_dedupe_projection = __esm(() => {
|
|
62654
|
+
init_redaction();
|
|
62655
|
+
DEDUPE_SOURCE_KEY_ALLOWLIST = [
|
|
62656
|
+
"github_url",
|
|
62657
|
+
"github_issue_url",
|
|
62658
|
+
"github_pr_url",
|
|
62659
|
+
"source_url",
|
|
62660
|
+
"url",
|
|
62661
|
+
"external_url",
|
|
62662
|
+
"issue_url",
|
|
62663
|
+
"github_owner",
|
|
62664
|
+
"github_repo",
|
|
62665
|
+
"github_number"
|
|
62666
|
+
];
|
|
62667
|
+
});
|
|
62668
|
+
|
|
61814
62669
|
// src/lib/task-dedupe.ts
|
|
61815
62670
|
function asObject(value) {
|
|
61816
62671
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
@@ -61975,10 +62830,10 @@ function olderFirst(left, right) {
|
|
|
61975
62830
|
function findDuplicateTasks(options = {}, db) {
|
|
61976
62831
|
const d = db || getDatabase();
|
|
61977
62832
|
const threshold = options.threshold ?? DEFAULT_THRESHOLD;
|
|
61978
|
-
const fingerprints = listTasks2({
|
|
62833
|
+
const fingerprints = projectTasksForDedupe(listTasks2({
|
|
61979
62834
|
include_archived: Boolean(options.include_archived),
|
|
61980
62835
|
limit: options.limit ?? 1000
|
|
61981
|
-
}, d).map(fingerprint);
|
|
62836
|
+
}, d)).map(fingerprint);
|
|
61982
62837
|
const candidates = [];
|
|
61983
62838
|
for (let i = 0;i < fingerprints.length; i++) {
|
|
61984
62839
|
for (let j = i + 1;j < fingerprints.length; j++) {
|
|
@@ -62213,6 +63068,7 @@ var init_task_dedupe = __esm(() => {
|
|
|
62213
63068
|
init_database();
|
|
62214
63069
|
init_task_relationships();
|
|
62215
63070
|
init_tasks();
|
|
63071
|
+
init_dedupe_projection();
|
|
62216
63072
|
STOP_WORDS = new Set([
|
|
62217
63073
|
"a",
|
|
62218
63074
|
"an",
|
|
@@ -85410,7 +86266,7 @@ var require_v4_mini = __commonJS((exports) => {
|
|
|
85410
86266
|
__exportStar(require_mini(), exports);
|
|
85411
86267
|
});
|
|
85412
86268
|
|
|
85413
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
86269
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-compat.js
|
|
85414
86270
|
var require_zod_compat = __commonJS((exports) => {
|
|
85415
86271
|
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
85416
86272
|
if (k2 === undefined)
|
|
@@ -85540,17 +86396,34 @@ var require_zod_compat = __commonJS((exports) => {
|
|
|
85540
86396
|
}
|
|
85541
86397
|
return;
|
|
85542
86398
|
}
|
|
86399
|
+
function getDotPath2(path) {
|
|
86400
|
+
if (path.length === 0) {
|
|
86401
|
+
return "object root";
|
|
86402
|
+
}
|
|
86403
|
+
return path.reduce((acc, seg, index) => {
|
|
86404
|
+
if (index === 0) {
|
|
86405
|
+
return String(seg);
|
|
86406
|
+
}
|
|
86407
|
+
if (typeof seg === "number") {
|
|
86408
|
+
return `${acc}[${seg}]`;
|
|
86409
|
+
}
|
|
86410
|
+
return `${acc}.${seg}`;
|
|
86411
|
+
}, "");
|
|
86412
|
+
}
|
|
85543
86413
|
function getParseErrorMessage2(error3) {
|
|
85544
86414
|
if (error3 && typeof error3 === "object") {
|
|
86415
|
+
if ("issues" in error3 && Array.isArray(error3.issues) && error3.issues.length > 0) {
|
|
86416
|
+
return error3.issues.map((i) => {
|
|
86417
|
+
if (!i.path?.length) {
|
|
86418
|
+
return i.message;
|
|
86419
|
+
}
|
|
86420
|
+
return `${i.message} at ${getDotPath2(i.path)}`;
|
|
86421
|
+
}).join(`
|
|
86422
|
+
`);
|
|
86423
|
+
}
|
|
85545
86424
|
if ("message" in error3 && typeof error3.message === "string") {
|
|
85546
86425
|
return error3.message;
|
|
85547
86426
|
}
|
|
85548
|
-
if ("issues" in error3 && Array.isArray(error3.issues) && error3.issues.length > 0) {
|
|
85549
|
-
const firstIssue = error3.issues[0];
|
|
85550
|
-
if (firstIssue && typeof firstIssue === "object" && "message" in firstIssue) {
|
|
85551
|
-
return String(firstIssue.message);
|
|
85552
|
-
}
|
|
85553
|
-
}
|
|
85554
86427
|
try {
|
|
85555
86428
|
return JSON.stringify(error3);
|
|
85556
86429
|
} catch {
|
|
@@ -87257,7 +88130,7 @@ var require_v4 = __commonJS((exports) => {
|
|
|
87257
88130
|
exports.default = index_js_1.default;
|
|
87258
88131
|
});
|
|
87259
88132
|
|
|
87260
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
88133
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/cjs/types.js
|
|
87261
88134
|
var require_types3 = __commonJS((exports) => {
|
|
87262
88135
|
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
87263
88136
|
if (k2 === undefined)
|
|
@@ -87308,7 +88181,7 @@ var require_types3 = __commonJS((exports) => {
|
|
|
87308
88181
|
exports.ProgressTokenSchema = z.union([z.string(), z.number().int()]);
|
|
87309
88182
|
exports.CursorSchema = z.string();
|
|
87310
88183
|
exports.TaskCreationParamsSchema = z.looseObject({
|
|
87311
|
-
ttl: z.
|
|
88184
|
+
ttl: z.number().optional(),
|
|
87312
88185
|
pollInterval: z.number().optional()
|
|
87313
88186
|
});
|
|
87314
88187
|
exports.TaskMetadataSchema = z.object({
|
|
@@ -87470,7 +88343,8 @@ var require_types3 = __commonJS((exports) => {
|
|
|
87470
88343
|
roots: z.object({
|
|
87471
88344
|
listChanged: z.boolean().optional()
|
|
87472
88345
|
}).optional(),
|
|
87473
|
-
tasks: exports.ClientTasksCapabilitySchema.optional()
|
|
88346
|
+
tasks: exports.ClientTasksCapabilitySchema.optional(),
|
|
88347
|
+
extensions: z.record(z.string(), AssertObjectSchema2).optional()
|
|
87474
88348
|
});
|
|
87475
88349
|
exports.InitializeRequestParamsSchema = BaseRequestParamsSchema2.extend({
|
|
87476
88350
|
protocolVersion: z.string(),
|
|
@@ -87497,7 +88371,8 @@ var require_types3 = __commonJS((exports) => {
|
|
|
87497
88371
|
tools: z.object({
|
|
87498
88372
|
listChanged: z.boolean().optional()
|
|
87499
88373
|
}).optional(),
|
|
87500
|
-
tasks: exports.ServerTasksCapabilitySchema.optional()
|
|
88374
|
+
tasks: exports.ServerTasksCapabilitySchema.optional(),
|
|
88375
|
+
extensions: z.record(z.string(), AssertObjectSchema2).optional()
|
|
87501
88376
|
});
|
|
87502
88377
|
exports.InitializeResultSchema = exports.ResultSchema.extend({
|
|
87503
88378
|
protocolVersion: z.string(),
|
|
@@ -87614,6 +88489,7 @@ var require_types3 = __commonJS((exports) => {
|
|
|
87614
88489
|
uri: z.string(),
|
|
87615
88490
|
description: z.optional(z.string()),
|
|
87616
88491
|
mimeType: z.optional(z.string()),
|
|
88492
|
+
size: z.optional(z.number()),
|
|
87617
88493
|
annotations: exports.AnnotationsSchema.optional(),
|
|
87618
88494
|
_meta: z.optional(z.looseObject({}))
|
|
87619
88495
|
});
|
|
@@ -88157,7 +89033,7 @@ var require_types3 = __commonJS((exports) => {
|
|
|
88157
89033
|
exports.UrlElicitationRequiredError = UrlElicitationRequiredError2;
|
|
88158
89034
|
});
|
|
88159
89035
|
|
|
88160
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
89036
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/interfaces.js
|
|
88161
89037
|
var require_interfaces = __commonJS((exports) => {
|
|
88162
89038
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88163
89039
|
exports.isTerminal = isTerminal2;
|
|
@@ -88166,7 +89042,7 @@ var require_interfaces = __commonJS((exports) => {
|
|
|
88166
89042
|
}
|
|
88167
89043
|
});
|
|
88168
89044
|
|
|
88169
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89045
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/Options.js
|
|
88170
89046
|
var require_Options = __commonJS((exports) => {
|
|
88171
89047
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88172
89048
|
exports.getDefaultOptions = exports.defaultOptions = exports.jsonDescription = exports.ignoreOverride = undefined;
|
|
@@ -88217,7 +89093,7 @@ var require_Options = __commonJS((exports) => {
|
|
|
88217
89093
|
exports.getDefaultOptions = getDefaultOptions2;
|
|
88218
89094
|
});
|
|
88219
89095
|
|
|
88220
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89096
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/Refs.js
|
|
88221
89097
|
var require_Refs = __commonJS((exports) => {
|
|
88222
89098
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88223
89099
|
exports.getRefs = undefined;
|
|
@@ -88243,7 +89119,7 @@ var require_Refs = __commonJS((exports) => {
|
|
|
88243
89119
|
exports.getRefs = getRefs2;
|
|
88244
89120
|
});
|
|
88245
89121
|
|
|
88246
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89122
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/errorMessages.js
|
|
88247
89123
|
var require_errorMessages = __commonJS((exports) => {
|
|
88248
89124
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88249
89125
|
exports.setResponseValueAndErrors = exports.addErrorMessage = undefined;
|
|
@@ -88265,7 +89141,7 @@ var require_errorMessages = __commonJS((exports) => {
|
|
|
88265
89141
|
exports.setResponseValueAndErrors = setResponseValueAndErrors2;
|
|
88266
89142
|
});
|
|
88267
89143
|
|
|
88268
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89144
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/getRelativePath.js
|
|
88269
89145
|
var require_getRelativePath = __commonJS((exports) => {
|
|
88270
89146
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88271
89147
|
exports.getRelativePath = undefined;
|
|
@@ -88280,7 +89156,7 @@ var require_getRelativePath = __commonJS((exports) => {
|
|
|
88280
89156
|
exports.getRelativePath = getRelativePath3;
|
|
88281
89157
|
});
|
|
88282
89158
|
|
|
88283
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89159
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/any.js
|
|
88284
89160
|
var require_any = __commonJS((exports) => {
|
|
88285
89161
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88286
89162
|
exports.parseAnyDef = undefined;
|
|
@@ -88302,7 +89178,7 @@ var require_any = __commonJS((exports) => {
|
|
|
88302
89178
|
exports.parseAnyDef = parseAnyDef2;
|
|
88303
89179
|
});
|
|
88304
89180
|
|
|
88305
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89181
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/array.js
|
|
88306
89182
|
var require_array = __commonJS((exports) => {
|
|
88307
89183
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88308
89184
|
exports.parseArrayDef = undefined;
|
|
@@ -88334,7 +89210,7 @@ var require_array = __commonJS((exports) => {
|
|
|
88334
89210
|
exports.parseArrayDef = parseArrayDef2;
|
|
88335
89211
|
});
|
|
88336
89212
|
|
|
88337
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89213
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/bigint.js
|
|
88338
89214
|
var require_bigint = __commonJS((exports) => {
|
|
88339
89215
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88340
89216
|
exports.parseBigintDef = undefined;
|
|
@@ -88386,7 +89262,7 @@ var require_bigint = __commonJS((exports) => {
|
|
|
88386
89262
|
exports.parseBigintDef = parseBigintDef2;
|
|
88387
89263
|
});
|
|
88388
89264
|
|
|
88389
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89265
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/boolean.js
|
|
88390
89266
|
var require_boolean = __commonJS((exports) => {
|
|
88391
89267
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88392
89268
|
exports.parseBooleanDef = undefined;
|
|
@@ -88398,7 +89274,7 @@ var require_boolean = __commonJS((exports) => {
|
|
|
88398
89274
|
exports.parseBooleanDef = parseBooleanDef2;
|
|
88399
89275
|
});
|
|
88400
89276
|
|
|
88401
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89277
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/branded.js
|
|
88402
89278
|
var require_branded = __commonJS((exports) => {
|
|
88403
89279
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88404
89280
|
exports.parseBrandedDef = undefined;
|
|
@@ -88409,7 +89285,7 @@ var require_branded = __commonJS((exports) => {
|
|
|
88409
89285
|
exports.parseBrandedDef = parseBrandedDef2;
|
|
88410
89286
|
});
|
|
88411
89287
|
|
|
88412
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89288
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/catch.js
|
|
88413
89289
|
var require_catch = __commonJS((exports) => {
|
|
88414
89290
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88415
89291
|
exports.parseCatchDef = undefined;
|
|
@@ -88420,7 +89296,7 @@ var require_catch = __commonJS((exports) => {
|
|
|
88420
89296
|
exports.parseCatchDef = parseCatchDef2;
|
|
88421
89297
|
});
|
|
88422
89298
|
|
|
88423
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89299
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/date.js
|
|
88424
89300
|
var require_date = __commonJS((exports) => {
|
|
88425
89301
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88426
89302
|
exports.parseDateDef = undefined;
|
|
@@ -88471,7 +89347,7 @@ var require_date = __commonJS((exports) => {
|
|
|
88471
89347
|
};
|
|
88472
89348
|
});
|
|
88473
89349
|
|
|
88474
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89350
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/default.js
|
|
88475
89351
|
var require_default = __commonJS((exports) => {
|
|
88476
89352
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88477
89353
|
exports.parseDefaultDef = undefined;
|
|
@@ -88485,7 +89361,7 @@ var require_default = __commonJS((exports) => {
|
|
|
88485
89361
|
exports.parseDefaultDef = parseDefaultDef2;
|
|
88486
89362
|
});
|
|
88487
89363
|
|
|
88488
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89364
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/effects.js
|
|
88489
89365
|
var require_effects = __commonJS((exports) => {
|
|
88490
89366
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88491
89367
|
exports.parseEffectsDef = undefined;
|
|
@@ -88497,7 +89373,7 @@ var require_effects = __commonJS((exports) => {
|
|
|
88497
89373
|
exports.parseEffectsDef = parseEffectsDef2;
|
|
88498
89374
|
});
|
|
88499
89375
|
|
|
88500
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89376
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/enum.js
|
|
88501
89377
|
var require_enum2 = __commonJS((exports) => {
|
|
88502
89378
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88503
89379
|
exports.parseEnumDef = undefined;
|
|
@@ -88510,7 +89386,7 @@ var require_enum2 = __commonJS((exports) => {
|
|
|
88510
89386
|
exports.parseEnumDef = parseEnumDef2;
|
|
88511
89387
|
});
|
|
88512
89388
|
|
|
88513
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89389
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/intersection.js
|
|
88514
89390
|
var require_intersection = __commonJS((exports) => {
|
|
88515
89391
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88516
89392
|
exports.parseIntersectionDef = undefined;
|
|
@@ -88558,7 +89434,7 @@ var require_intersection = __commonJS((exports) => {
|
|
|
88558
89434
|
exports.parseIntersectionDef = parseIntersectionDef2;
|
|
88559
89435
|
});
|
|
88560
89436
|
|
|
88561
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89437
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/literal.js
|
|
88562
89438
|
var require_literal = __commonJS((exports) => {
|
|
88563
89439
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88564
89440
|
exports.parseLiteralDef = undefined;
|
|
@@ -88583,7 +89459,7 @@ var require_literal = __commonJS((exports) => {
|
|
|
88583
89459
|
exports.parseLiteralDef = parseLiteralDef2;
|
|
88584
89460
|
});
|
|
88585
89461
|
|
|
88586
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89462
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/string.js
|
|
88587
89463
|
var require_string = __commonJS((exports) => {
|
|
88588
89464
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88589
89465
|
exports.parseStringDef = exports.zodPatterns = undefined;
|
|
@@ -88886,7 +89762,7 @@ var require_string = __commonJS((exports) => {
|
|
|
88886
89762
|
}
|
|
88887
89763
|
});
|
|
88888
89764
|
|
|
88889
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89765
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/record.js
|
|
88890
89766
|
var require_record = __commonJS((exports) => {
|
|
88891
89767
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88892
89768
|
exports.parseRecordDef = undefined;
|
|
@@ -88948,7 +89824,7 @@ var require_record = __commonJS((exports) => {
|
|
|
88948
89824
|
exports.parseRecordDef = parseRecordDef2;
|
|
88949
89825
|
});
|
|
88950
89826
|
|
|
88951
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89827
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/map.js
|
|
88952
89828
|
var require_map = __commonJS((exports) => {
|
|
88953
89829
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88954
89830
|
exports.parseMapDef = undefined;
|
|
@@ -88981,7 +89857,7 @@ var require_map = __commonJS((exports) => {
|
|
|
88981
89857
|
exports.parseMapDef = parseMapDef2;
|
|
88982
89858
|
});
|
|
88983
89859
|
|
|
88984
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89860
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/nativeEnum.js
|
|
88985
89861
|
var require_nativeEnum = __commonJS((exports) => {
|
|
88986
89862
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88987
89863
|
exports.parseNativeEnumDef = undefined;
|
|
@@ -89000,7 +89876,7 @@ var require_nativeEnum = __commonJS((exports) => {
|
|
|
89000
89876
|
exports.parseNativeEnumDef = parseNativeEnumDef2;
|
|
89001
89877
|
});
|
|
89002
89878
|
|
|
89003
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89879
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/never.js
|
|
89004
89880
|
var require_never = __commonJS((exports) => {
|
|
89005
89881
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89006
89882
|
exports.parseNeverDef = undefined;
|
|
@@ -89016,7 +89892,7 @@ var require_never = __commonJS((exports) => {
|
|
|
89016
89892
|
exports.parseNeverDef = parseNeverDef2;
|
|
89017
89893
|
});
|
|
89018
89894
|
|
|
89019
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89895
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/null.js
|
|
89020
89896
|
var require_null = __commonJS((exports) => {
|
|
89021
89897
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89022
89898
|
exports.parseNullDef = undefined;
|
|
@@ -89031,7 +89907,7 @@ var require_null = __commonJS((exports) => {
|
|
|
89031
89907
|
exports.parseNullDef = parseNullDef2;
|
|
89032
89908
|
});
|
|
89033
89909
|
|
|
89034
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89910
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/union.js
|
|
89035
89911
|
var require_union = __commonJS((exports) => {
|
|
89036
89912
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89037
89913
|
exports.parseUnionDef = exports.primitiveMappings = undefined;
|
|
@@ -89105,7 +89981,7 @@ var require_union = __commonJS((exports) => {
|
|
|
89105
89981
|
};
|
|
89106
89982
|
});
|
|
89107
89983
|
|
|
89108
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89984
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/nullable.js
|
|
89109
89985
|
var require_nullable = __commonJS((exports) => {
|
|
89110
89986
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89111
89987
|
exports.parseNullableDef = undefined;
|
|
@@ -89144,7 +90020,7 @@ var require_nullable = __commonJS((exports) => {
|
|
|
89144
90020
|
exports.parseNullableDef = parseNullableDef2;
|
|
89145
90021
|
});
|
|
89146
90022
|
|
|
89147
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
90023
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/number.js
|
|
89148
90024
|
var require_number = __commonJS((exports) => {
|
|
89149
90025
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89150
90026
|
exports.parseNumberDef = undefined;
|
|
@@ -89199,7 +90075,7 @@ var require_number = __commonJS((exports) => {
|
|
|
89199
90075
|
exports.parseNumberDef = parseNumberDef2;
|
|
89200
90076
|
});
|
|
89201
90077
|
|
|
89202
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
90078
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/object.js
|
|
89203
90079
|
var require_object = __commonJS((exports) => {
|
|
89204
90080
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89205
90081
|
exports.parseObjectDef = undefined;
|
|
@@ -89275,7 +90151,7 @@ var require_object = __commonJS((exports) => {
|
|
|
89275
90151
|
}
|
|
89276
90152
|
});
|
|
89277
90153
|
|
|
89278
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
90154
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/optional.js
|
|
89279
90155
|
var require_optional = __commonJS((exports) => {
|
|
89280
90156
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89281
90157
|
exports.parseOptionalDef = undefined;
|
|
@@ -89301,7 +90177,7 @@ var require_optional = __commonJS((exports) => {
|
|
|
89301
90177
|
exports.parseOptionalDef = parseOptionalDef2;
|
|
89302
90178
|
});
|
|
89303
90179
|
|
|
89304
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
90180
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/pipeline.js
|
|
89305
90181
|
var require_pipeline = __commonJS((exports) => {
|
|
89306
90182
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89307
90183
|
exports.parsePipelineDef = undefined;
|
|
@@ -89327,7 +90203,7 @@ var require_pipeline = __commonJS((exports) => {
|
|
|
89327
90203
|
exports.parsePipelineDef = parsePipelineDef2;
|
|
89328
90204
|
});
|
|
89329
90205
|
|
|
89330
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
90206
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/promise.js
|
|
89331
90207
|
var require_promise = __commonJS((exports) => {
|
|
89332
90208
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89333
90209
|
exports.parsePromiseDef = undefined;
|
|
@@ -89338,7 +90214,7 @@ var require_promise = __commonJS((exports) => {
|
|
|
89338
90214
|
exports.parsePromiseDef = parsePromiseDef2;
|
|
89339
90215
|
});
|
|
89340
90216
|
|
|
89341
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
90217
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/set.js
|
|
89342
90218
|
var require_set = __commonJS((exports) => {
|
|
89343
90219
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89344
90220
|
exports.parseSetDef = undefined;
|
|
@@ -89365,7 +90241,7 @@ var require_set = __commonJS((exports) => {
|
|
|
89365
90241
|
exports.parseSetDef = parseSetDef2;
|
|
89366
90242
|
});
|
|
89367
90243
|
|
|
89368
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
90244
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/tuple.js
|
|
89369
90245
|
var require_tuple = __commonJS((exports) => {
|
|
89370
90246
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89371
90247
|
exports.parseTupleDef = undefined;
|
|
@@ -89399,7 +90275,7 @@ var require_tuple = __commonJS((exports) => {
|
|
|
89399
90275
|
exports.parseTupleDef = parseTupleDef2;
|
|
89400
90276
|
});
|
|
89401
90277
|
|
|
89402
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
90278
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/undefined.js
|
|
89403
90279
|
var require_undefined = __commonJS((exports) => {
|
|
89404
90280
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89405
90281
|
exports.parseUndefinedDef = undefined;
|
|
@@ -89412,7 +90288,7 @@ var require_undefined = __commonJS((exports) => {
|
|
|
89412
90288
|
exports.parseUndefinedDef = parseUndefinedDef2;
|
|
89413
90289
|
});
|
|
89414
90290
|
|
|
89415
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
90291
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/unknown.js
|
|
89416
90292
|
var require_unknown = __commonJS((exports) => {
|
|
89417
90293
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89418
90294
|
exports.parseUnknownDef = undefined;
|
|
@@ -89423,7 +90299,7 @@ var require_unknown = __commonJS((exports) => {
|
|
|
89423
90299
|
exports.parseUnknownDef = parseUnknownDef2;
|
|
89424
90300
|
});
|
|
89425
90301
|
|
|
89426
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
90302
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/readonly.js
|
|
89427
90303
|
var require_readonly = __commonJS((exports) => {
|
|
89428
90304
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89429
90305
|
exports.parseReadonlyDef = undefined;
|
|
@@ -89434,7 +90310,7 @@ var require_readonly = __commonJS((exports) => {
|
|
|
89434
90310
|
exports.parseReadonlyDef = parseReadonlyDef2;
|
|
89435
90311
|
});
|
|
89436
90312
|
|
|
89437
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
90313
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/selectParser.js
|
|
89438
90314
|
var require_selectParser = __commonJS((exports) => {
|
|
89439
90315
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89440
90316
|
exports.selectParser = undefined;
|
|
@@ -89548,7 +90424,7 @@ var require_selectParser = __commonJS((exports) => {
|
|
|
89548
90424
|
exports.selectParser = selectParser3;
|
|
89549
90425
|
});
|
|
89550
90426
|
|
|
89551
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
90427
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parseDef.js
|
|
89552
90428
|
var require_parseDef = __commonJS((exports) => {
|
|
89553
90429
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89554
90430
|
exports.parseDef = undefined;
|
|
@@ -89613,12 +90489,12 @@ var require_parseDef = __commonJS((exports) => {
|
|
|
89613
90489
|
};
|
|
89614
90490
|
});
|
|
89615
90491
|
|
|
89616
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
90492
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parseTypes.js
|
|
89617
90493
|
var require_parseTypes = __commonJS((exports) => {
|
|
89618
90494
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89619
90495
|
});
|
|
89620
90496
|
|
|
89621
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
90497
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/zodToJsonSchema.js
|
|
89622
90498
|
var require_zodToJsonSchema = __commonJS((exports) => {
|
|
89623
90499
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89624
90500
|
exports.zodToJsonSchema = undefined;
|
|
@@ -89687,7 +90563,7 @@ var require_zodToJsonSchema = __commonJS((exports) => {
|
|
|
89687
90563
|
exports.zodToJsonSchema = zodToJsonSchema3;
|
|
89688
90564
|
});
|
|
89689
90565
|
|
|
89690
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
90566
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/index.js
|
|
89691
90567
|
var require_cjs = __commonJS((exports) => {
|
|
89692
90568
|
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
89693
90569
|
if (k2 === undefined)
|
|
@@ -89752,7 +90628,7 @@ var require_cjs = __commonJS((exports) => {
|
|
|
89752
90628
|
exports.default = zodToJsonSchema_js_1.zodToJsonSchema;
|
|
89753
90629
|
});
|
|
89754
90630
|
|
|
89755
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
90631
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-json-schema-compat.js
|
|
89756
90632
|
var require_zod_json_schema_compat = __commonJS((exports) => {
|
|
89757
90633
|
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
89758
90634
|
if (k2 === undefined)
|
|
@@ -89835,7 +90711,7 @@ var require_zod_json_schema_compat = __commonJS((exports) => {
|
|
|
89835
90711
|
}
|
|
89836
90712
|
});
|
|
89837
90713
|
|
|
89838
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
90714
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/protocol.js
|
|
89839
90715
|
var require_protocol = __commonJS((exports) => {
|
|
89840
90716
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89841
90717
|
exports.Protocol = exports.DEFAULT_REQUEST_TIMEOUT_MSEC = undefined;
|
|
@@ -90047,6 +90923,10 @@ var require_protocol = __commonJS((exports) => {
|
|
|
90047
90923
|
this._progressHandlers.clear();
|
|
90048
90924
|
this._taskProgressTokens.clear();
|
|
90049
90925
|
this._pendingDebouncedNotifications.clear();
|
|
90926
|
+
for (const info of this._timeoutInfo.values()) {
|
|
90927
|
+
clearTimeout(info.timeoutId);
|
|
90928
|
+
}
|
|
90929
|
+
this._timeoutInfo.clear();
|
|
90050
90930
|
for (const controller of this._requestHandlerAbortControllers.values()) {
|
|
90051
90931
|
controller.abort();
|
|
90052
90932
|
}
|
|
@@ -90177,7 +91057,9 @@ var require_protocol = __commonJS((exports) => {
|
|
|
90177
91057
|
await capturedTransport?.send(errorResponse);
|
|
90178
91058
|
}
|
|
90179
91059
|
}).catch((error3) => this._onerror(new Error(`Failed to send response: ${error3}`))).finally(() => {
|
|
90180
|
-
this._requestHandlerAbortControllers.
|
|
91060
|
+
if (this._requestHandlerAbortControllers.get(request.id) === abortController) {
|
|
91061
|
+
this._requestHandlerAbortControllers.delete(request.id);
|
|
91062
|
+
}
|
|
90181
91063
|
});
|
|
90182
91064
|
}
|
|
90183
91065
|
_onprogress(notification) {
|
|
@@ -90680,7 +91562,7 @@ var require_protocol = __commonJS((exports) => {
|
|
|
90680
91562
|
}
|
|
90681
91563
|
});
|
|
90682
91564
|
|
|
90683
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
91565
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/cjs/validation/ajv-provider.js
|
|
90684
91566
|
var require_ajv_provider = __commonJS((exports) => {
|
|
90685
91567
|
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
90686
91568
|
return mod && mod.__esModule ? mod : { default: mod };
|
|
@@ -90728,10 +91610,11 @@ var require_ajv_provider = __commonJS((exports) => {
|
|
|
90728
91610
|
exports.AjvJsonSchemaValidator = AjvJsonSchemaValidator2;
|
|
90729
91611
|
});
|
|
90730
91612
|
|
|
90731
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
91613
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/server.js
|
|
90732
91614
|
var require_server = __commonJS((exports) => {
|
|
90733
91615
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
90734
91616
|
exports.ExperimentalServerTasks = undefined;
|
|
91617
|
+
var types_js_1 = require_types3();
|
|
90735
91618
|
|
|
90736
91619
|
class ExperimentalServerTasks2 {
|
|
90737
91620
|
constructor(_server) {
|
|
@@ -90740,6 +91623,62 @@ var require_server = __commonJS((exports) => {
|
|
|
90740
91623
|
requestStream(request, resultSchema, options) {
|
|
90741
91624
|
return this._server.requestStream(request, resultSchema, options);
|
|
90742
91625
|
}
|
|
91626
|
+
createMessageStream(params, options) {
|
|
91627
|
+
const clientCapabilities = this._server.getClientCapabilities();
|
|
91628
|
+
if ((params.tools || params.toolChoice) && !clientCapabilities?.sampling?.tools) {
|
|
91629
|
+
throw new Error("Client does not support sampling tools capability.");
|
|
91630
|
+
}
|
|
91631
|
+
if (params.messages.length > 0) {
|
|
91632
|
+
const lastMessage = params.messages[params.messages.length - 1];
|
|
91633
|
+
const lastContent = Array.isArray(lastMessage.content) ? lastMessage.content : [lastMessage.content];
|
|
91634
|
+
const hasToolResults = lastContent.some((c) => c.type === "tool_result");
|
|
91635
|
+
const previousMessage = params.messages.length > 1 ? params.messages[params.messages.length - 2] : undefined;
|
|
91636
|
+
const previousContent = previousMessage ? Array.isArray(previousMessage.content) ? previousMessage.content : [previousMessage.content] : [];
|
|
91637
|
+
const hasPreviousToolUse = previousContent.some((c) => c.type === "tool_use");
|
|
91638
|
+
if (hasToolResults) {
|
|
91639
|
+
if (lastContent.some((c) => c.type !== "tool_result")) {
|
|
91640
|
+
throw new Error("The last message must contain only tool_result content if any is present");
|
|
91641
|
+
}
|
|
91642
|
+
if (!hasPreviousToolUse) {
|
|
91643
|
+
throw new Error("tool_result blocks are not matching any tool_use from the previous message");
|
|
91644
|
+
}
|
|
91645
|
+
}
|
|
91646
|
+
if (hasPreviousToolUse) {
|
|
91647
|
+
const toolUseIds = new Set(previousContent.filter((c) => c.type === "tool_use").map((c) => c.id));
|
|
91648
|
+
const toolResultIds = new Set(lastContent.filter((c) => c.type === "tool_result").map((c) => c.toolUseId));
|
|
91649
|
+
if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every((id) => toolResultIds.has(id))) {
|
|
91650
|
+
throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match");
|
|
91651
|
+
}
|
|
91652
|
+
}
|
|
91653
|
+
}
|
|
91654
|
+
return this.requestStream({
|
|
91655
|
+
method: "sampling/createMessage",
|
|
91656
|
+
params
|
|
91657
|
+
}, types_js_1.CreateMessageResultSchema, options);
|
|
91658
|
+
}
|
|
91659
|
+
elicitInputStream(params, options) {
|
|
91660
|
+
const clientCapabilities = this._server.getClientCapabilities();
|
|
91661
|
+
const mode = params.mode ?? "form";
|
|
91662
|
+
switch (mode) {
|
|
91663
|
+
case "url": {
|
|
91664
|
+
if (!clientCapabilities?.elicitation?.url) {
|
|
91665
|
+
throw new Error("Client does not support url elicitation.");
|
|
91666
|
+
}
|
|
91667
|
+
break;
|
|
91668
|
+
}
|
|
91669
|
+
case "form": {
|
|
91670
|
+
if (!clientCapabilities?.elicitation?.form) {
|
|
91671
|
+
throw new Error("Client does not support form elicitation.");
|
|
91672
|
+
}
|
|
91673
|
+
break;
|
|
91674
|
+
}
|
|
91675
|
+
}
|
|
91676
|
+
const normalizedParams = mode === "form" && params.mode === undefined ? { ...params, mode: "form" } : params;
|
|
91677
|
+
return this.requestStream({
|
|
91678
|
+
method: "elicitation/create",
|
|
91679
|
+
params: normalizedParams
|
|
91680
|
+
}, types_js_1.ElicitResultSchema, options);
|
|
91681
|
+
}
|
|
90743
91682
|
async getTask(taskId, options) {
|
|
90744
91683
|
return this._server.getTask({ taskId }, options);
|
|
90745
91684
|
}
|
|
@@ -90756,7 +91695,7 @@ var require_server = __commonJS((exports) => {
|
|
|
90756
91695
|
exports.ExperimentalServerTasks = ExperimentalServerTasks2;
|
|
90757
91696
|
});
|
|
90758
91697
|
|
|
90759
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
91698
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/helpers.js
|
|
90760
91699
|
var require_helpers = __commonJS((exports) => {
|
|
90761
91700
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
90762
91701
|
exports.assertToolsCallTaskCapability = assertToolsCallTaskCapability2;
|
|
@@ -90796,7 +91735,7 @@ var require_helpers = __commonJS((exports) => {
|
|
|
90796
91735
|
}
|
|
90797
91736
|
});
|
|
90798
91737
|
|
|
90799
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
91738
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/index.js
|
|
90800
91739
|
var require_server2 = __commonJS((exports) => {
|
|
90801
91740
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
90802
91741
|
exports.Server = undefined;
|
|
@@ -90854,16 +91793,7 @@ var require_server2 = __commonJS((exports) => {
|
|
|
90854
91793
|
if (!methodSchema) {
|
|
90855
91794
|
throw new Error("Schema is missing a method literal");
|
|
90856
91795
|
}
|
|
90857
|
-
|
|
90858
|
-
if ((0, zod_compat_js_1.isZ4Schema)(methodSchema)) {
|
|
90859
|
-
const v4Schema = methodSchema;
|
|
90860
|
-
const v4Def = v4Schema._zod?.def;
|
|
90861
|
-
methodValue = v4Def?.value ?? v4Schema.value;
|
|
90862
|
-
} else {
|
|
90863
|
-
const v3Schema = methodSchema;
|
|
90864
|
-
const legacyDef = v3Schema._def;
|
|
90865
|
-
methodValue = legacyDef?.value ?? v3Schema.value;
|
|
90866
|
-
}
|
|
91796
|
+
const methodValue = (0, zod_compat_js_1.getLiteralValue)(methodSchema);
|
|
90867
91797
|
if (typeof methodValue !== "string") {
|
|
90868
91798
|
throw new Error("Schema method literal must be a string");
|
|
90869
91799
|
}
|
|
@@ -91141,7 +92071,7 @@ var require_server2 = __commonJS((exports) => {
|
|
|
91141
92071
|
exports.Server = Server2;
|
|
91142
92072
|
});
|
|
91143
92073
|
|
|
91144
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
92074
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/completable.js
|
|
91145
92075
|
var require_completable = __commonJS((exports) => {
|
|
91146
92076
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
91147
92077
|
exports.McpZodTypeKind = exports.COMPLETABLE_SYMBOL = undefined;
|
|
@@ -91175,7 +92105,7 @@ var require_completable = __commonJS((exports) => {
|
|
|
91175
92105
|
})(McpZodTypeKind2 || (exports.McpZodTypeKind = McpZodTypeKind2 = {}));
|
|
91176
92106
|
});
|
|
91177
92107
|
|
|
91178
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
92108
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/uriTemplate.js
|
|
91179
92109
|
var require_uriTemplate = __commonJS((exports) => {
|
|
91180
92110
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
91181
92111
|
exports.UriTemplate = undefined;
|
|
@@ -91398,7 +92328,7 @@ var require_uriTemplate = __commonJS((exports) => {
|
|
|
91398
92328
|
exports.UriTemplate = UriTemplate2;
|
|
91399
92329
|
});
|
|
91400
92330
|
|
|
91401
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
92331
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/toolNameValidation.js
|
|
91402
92332
|
var require_toolNameValidation = __commonJS((exports) => {
|
|
91403
92333
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
91404
92334
|
exports.validateToolName = validateToolName2;
|
|
@@ -91462,7 +92392,7 @@ var require_toolNameValidation = __commonJS((exports) => {
|
|
|
91462
92392
|
}
|
|
91463
92393
|
});
|
|
91464
92394
|
|
|
91465
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
92395
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/mcp-server.js
|
|
91466
92396
|
var require_mcp_server = __commonJS((exports) => {
|
|
91467
92397
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
91468
92398
|
exports.ExperimentalMcpServerTasks = undefined;
|
|
@@ -91530,7 +92460,7 @@ var require_zod = __commonJS((exports) => {
|
|
|
91530
92460
|
exports.default = z;
|
|
91531
92461
|
});
|
|
91532
92462
|
|
|
91533
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
92463
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/mcp.js
|
|
91534
92464
|
var require_mcp = __commonJS((exports) => {
|
|
91535
92465
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
91536
92466
|
exports.ResourceTemplate = exports.McpServer = undefined;
|
|
@@ -92127,6 +93057,9 @@ var require_mcp = __commonJS((exports) => {
|
|
|
92127
93057
|
annotations = rest.shift();
|
|
92128
93058
|
}
|
|
92129
93059
|
} else if (typeof firstArg === "object" && firstArg !== null) {
|
|
93060
|
+
if (Object.values(firstArg).some((v) => typeof v === "object" && v !== null)) {
|
|
93061
|
+
throw new Error(`Tool ${name} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);
|
|
93062
|
+
}
|
|
92130
93063
|
annotations = rest.shift();
|
|
92131
93064
|
}
|
|
92132
93065
|
}
|
|
@@ -92237,6 +93170,9 @@ var require_mcp = __commonJS((exports) => {
|
|
|
92237
93170
|
if (isZodRawShapeCompat2(schema2)) {
|
|
92238
93171
|
return (0, zod_compat_js_1.objectFromShape)(schema2);
|
|
92239
93172
|
}
|
|
93173
|
+
if (!isZodSchemaInstance2(schema2)) {
|
|
93174
|
+
throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");
|
|
93175
|
+
}
|
|
92240
93176
|
return schema2;
|
|
92241
93177
|
}
|
|
92242
93178
|
function promptArgumentsFromSchema2(schema2) {
|
|
@@ -105197,10 +106133,10 @@ function serveStaticFile(filePath) {
|
|
|
105197
106133
|
if (!existsSync16(filePath))
|
|
105198
106134
|
return null;
|
|
105199
106135
|
const ext = extname(filePath);
|
|
105200
|
-
const
|
|
106136
|
+
const contentType2 = MIME_TYPES[ext] || "application/octet-stream";
|
|
105201
106137
|
return new Response(Bun.file(filePath), {
|
|
105202
106138
|
headers: {
|
|
105203
|
-
"Content-Type":
|
|
106139
|
+
"Content-Type": contentType2,
|
|
105204
106140
|
...SECURITY_HEADERS
|
|
105205
106141
|
}
|
|
105206
106142
|
});
|