@hasna/todos 0.15.46 → 0.15.47
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/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 +386 -85
- package/dist/contracts.js +341 -78
- package/dist/db/webhooks.d.ts.map +1 -1
- package/dist/index.js +385 -84
- package/dist/mcp/index.js +386 -85
- package/dist/mcp.js +4 -3
- package/dist/project-registration.js +385 -84
- package/dist/registry.js +341 -78
- package/dist/release-provenance.json +5 -5
- package/dist/server/index.js +1041 -271
- package/dist/storage.js +381 -81
- package/package.json +4 -3
- 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.47",
|
|
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",
|
|
@@ -195,11 +195,12 @@ var init_package = __esm(() => {
|
|
|
195
195
|
commander: "^13.1.0",
|
|
196
196
|
ink: "^5.2.0",
|
|
197
197
|
react: "^18.3.1",
|
|
198
|
-
zod: "
|
|
198
|
+
zod: "3.25.76"
|
|
199
199
|
},
|
|
200
200
|
overrides: {
|
|
201
201
|
ajv: "8.20.0",
|
|
202
|
-
"fast-uri": "3.1.2"
|
|
202
|
+
"fast-uri": "3.1.2",
|
|
203
|
+
zod: "3.25.76"
|
|
203
204
|
},
|
|
204
205
|
devDependencies: {
|
|
205
206
|
"@types/bun": "^1.2.4",
|
|
@@ -2954,9 +2955,11 @@ class PostgresJsonRecordStore {
|
|
|
2954
2955
|
async ensureSchema() {
|
|
2955
2956
|
if (!this.schemaReady) {
|
|
2956
2957
|
this.schemaReady = (async () => {
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2958
|
+
await retryOnTransientPostgresError(async () => {
|
|
2959
|
+
for (const sql of postgresTodosSyncSchemaSql(this.tableName, this.cursorTableName)) {
|
|
2960
|
+
await this.options.client.query(sql);
|
|
2961
|
+
}
|
|
2962
|
+
});
|
|
2960
2963
|
})().catch((error) => {
|
|
2961
2964
|
this.schemaReady = null;
|
|
2962
2965
|
throw error;
|
|
@@ -3370,13 +3373,14 @@ class PostgresJsonRecordStore {
|
|
|
3370
3373
|
throw new Error(divergentAuditHistoryReplayError(value.id));
|
|
3371
3374
|
}
|
|
3372
3375
|
async withTaskParentIntegrityTransaction(fn) {
|
|
3373
|
-
|
|
3376
|
+
const transaction = this.options.client.transaction;
|
|
3377
|
+
if (typeof transaction !== "function") {
|
|
3374
3378
|
throw new Error("TASK_PARENT_ATOMICITY_UNAVAILABLE: PostgreSQL parent writes and task deletion require transaction(callback)");
|
|
3375
3379
|
}
|
|
3376
|
-
return
|
|
3380
|
+
return retryOnTransientPostgresError(() => transaction(async (client) => {
|
|
3377
3381
|
await client.query("/* todos:task-parent-integrity-lock */ SELECT pg_advisory_xact_lock(hashtextextended($1 || ':task-parent-integrity', 0))", [this.service]);
|
|
3378
3382
|
return fn(client);
|
|
3379
|
-
});
|
|
3383
|
+
}));
|
|
3380
3384
|
}
|
|
3381
3385
|
async upsertTaskWithPlanMembershipGuard(value, guardedPlanIds, explicitProject, context = {}, parentGuard, queryClient) {
|
|
3382
3386
|
const planIds = [...new Set(guardedPlanIds.filter(Boolean))].sort();
|
|
@@ -5259,6 +5263,35 @@ function compareClock(left, right) {
|
|
|
5259
5263
|
function numberValue2(value) {
|
|
5260
5264
|
return typeof value === "number" && Number.isSafeInteger(value) ? value : null;
|
|
5261
5265
|
}
|
|
5266
|
+
function isTransientPostgresError(error) {
|
|
5267
|
+
if (typeof error !== "object" || error === null)
|
|
5268
|
+
return false;
|
|
5269
|
+
const candidate = error;
|
|
5270
|
+
const states = [candidate.code, candidate.errno, candidate.sqlState, candidate.sqlstate];
|
|
5271
|
+
if (typeof candidate.cause === "object" && candidate.cause !== null) {
|
|
5272
|
+
const cause = candidate.cause;
|
|
5273
|
+
states.push(cause.code, cause.errno, cause.sqlState, cause.sqlstate);
|
|
5274
|
+
}
|
|
5275
|
+
if (states.some((state) => typeof state === "string" && TRANSIENT_POSTGRES_SQLSTATES.has(state))) {
|
|
5276
|
+
return true;
|
|
5277
|
+
}
|
|
5278
|
+
const message = typeof candidate.message === "string" ? candidate.message : candidate.cause?.message;
|
|
5279
|
+
return typeof message === "string" && TRANSIENT_POSTGRES_MESSAGE_MARKERS.some((marker) => message.includes(marker));
|
|
5280
|
+
}
|
|
5281
|
+
async function retryOnTransientPostgresError(fn, attempts = 2, delayMs = 150) {
|
|
5282
|
+
let lastError;
|
|
5283
|
+
for (let attempt = 1;attempt <= attempts; attempt += 1) {
|
|
5284
|
+
try {
|
|
5285
|
+
return await fn();
|
|
5286
|
+
} catch (error) {
|
|
5287
|
+
lastError = error;
|
|
5288
|
+
if (!isTransientPostgresError(error) || attempt === attempts)
|
|
5289
|
+
throw error;
|
|
5290
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs * attempt));
|
|
5291
|
+
}
|
|
5292
|
+
}
|
|
5293
|
+
throw lastError;
|
|
5294
|
+
}
|
|
5262
5295
|
function isPostgresUniqueViolation(error) {
|
|
5263
5296
|
if (typeof error !== "object" || error === null)
|
|
5264
5297
|
return false;
|
|
@@ -5278,7 +5311,7 @@ function postgresConstraintName(error) {
|
|
|
5278
5311
|
const constraint = candidate.constraint ?? candidate.constraint_name ?? cause?.constraint ?? cause?.constraint_name;
|
|
5279
5312
|
return typeof constraint === "string" ? constraint : "";
|
|
5280
5313
|
}
|
|
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;
|
|
5314
|
+
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
5315
|
var init_postgres_adapter = __esm(() => {
|
|
5283
5316
|
init_types();
|
|
5284
5317
|
init_creator_identity();
|
|
@@ -5292,6 +5325,12 @@ var init_postgres_adapter = __esm(() => {
|
|
|
5292
5325
|
init_audit_history_import();
|
|
5293
5326
|
init_canonical();
|
|
5294
5327
|
TASK_ORDER_BY = `ORDER BY ${TASK_ORDER_TIEBREAK}`;
|
|
5328
|
+
TRANSIENT_POSTGRES_SQLSTATES = new Set(["55P03", "40P01", "40001"]);
|
|
5329
|
+
TRANSIENT_POSTGRES_MESSAGE_MARKERS = [
|
|
5330
|
+
"canceling statement due to lock timeout",
|
|
5331
|
+
"deadlock detected",
|
|
5332
|
+
"could not serialize access"
|
|
5333
|
+
];
|
|
5295
5334
|
});
|
|
5296
5335
|
|
|
5297
5336
|
// src/pr-groups/types.ts
|
|
@@ -13245,8 +13284,9 @@ var init_event_hooks = __esm(() => {
|
|
|
13245
13284
|
VALID_TARGETS = new Set(["stdout", "file", "socket", "script"]);
|
|
13246
13285
|
});
|
|
13247
13286
|
|
|
13248
|
-
// node_modules/.bun/@hasna+events@0.1.
|
|
13287
|
+
// node_modules/.bun/@hasna+events@0.1.16/node_modules/@hasna/events/dist/index.js
|
|
13249
13288
|
import { chmod, mkdir, readFile, rename, writeFile } from "fs/promises";
|
|
13289
|
+
import { Buffer as Buffer2 } from "buffer";
|
|
13250
13290
|
import { existsSync as existsSync6 } from "fs";
|
|
13251
13291
|
import { homedir as homedir2 } from "os";
|
|
13252
13292
|
import { join as join5 } from "path";
|
|
@@ -13355,11 +13395,13 @@ function getEventsDataDir(override) {
|
|
|
13355
13395
|
|
|
13356
13396
|
class JsonEventsStore {
|
|
13357
13397
|
dataDir;
|
|
13398
|
+
runtime;
|
|
13358
13399
|
channelsPath;
|
|
13359
13400
|
eventsPath;
|
|
13360
13401
|
deliveriesPath;
|
|
13361
13402
|
constructor(dataDir = getEventsDataDir()) {
|
|
13362
13403
|
this.dataDir = dataDir;
|
|
13404
|
+
this.runtime = localJsonRuntime(dataDir);
|
|
13363
13405
|
this.channelsPath = join5(dataDir, "channels.json");
|
|
13364
13406
|
this.eventsPath = join5(dataDir, "events.json");
|
|
13365
13407
|
this.deliveriesPath = join5(dataDir, "deliveries.json");
|
|
@@ -13407,13 +13449,58 @@ class JsonEventsStore {
|
|
|
13407
13449
|
await this.writeJson(this.eventsPath, events);
|
|
13408
13450
|
return event;
|
|
13409
13451
|
}
|
|
13410
|
-
async
|
|
13452
|
+
async appendEventOnce(event, options = {}) {
|
|
13411
13453
|
await this.init();
|
|
13412
|
-
|
|
13454
|
+
const events = await this.readJson(this.eventsPath, []);
|
|
13455
|
+
const dedupe = options.dedupe !== false;
|
|
13456
|
+
if (dedupe) {
|
|
13457
|
+
const existing = findEventByIdentity(events, { id: event.id, dedupeKey: event.dedupeKey });
|
|
13458
|
+
if (existing) {
|
|
13459
|
+
return {
|
|
13460
|
+
event: existing,
|
|
13461
|
+
stored: false,
|
|
13462
|
+
deduped: true,
|
|
13463
|
+
identity: { id: existing.id, dedupeKey: existing.dedupeKey }
|
|
13464
|
+
};
|
|
13465
|
+
}
|
|
13466
|
+
}
|
|
13467
|
+
events.push(event);
|
|
13468
|
+
await this.writeJson(this.eventsPath, events);
|
|
13469
|
+
return {
|
|
13470
|
+
event,
|
|
13471
|
+
stored: true,
|
|
13472
|
+
deduped: false,
|
|
13473
|
+
identity: { id: event.id, dedupeKey: event.dedupeKey }
|
|
13474
|
+
};
|
|
13475
|
+
}
|
|
13476
|
+
async listEvents(options = {}) {
|
|
13477
|
+
await this.init();
|
|
13478
|
+
const events = await this.readJson(this.eventsPath, []);
|
|
13479
|
+
return queryEvents(events, options);
|
|
13480
|
+
}
|
|
13481
|
+
async listEventsPage(options = {}) {
|
|
13482
|
+
await this.init();
|
|
13483
|
+
const events = await this.readJson(this.eventsPath, []);
|
|
13484
|
+
const queried = queryEvents(events, {
|
|
13485
|
+
eventId: options.eventId,
|
|
13486
|
+
source: options.source,
|
|
13487
|
+
type: options.type
|
|
13488
|
+
});
|
|
13489
|
+
const offset = decodeLocalJsonEventCursor(options.cursor, options);
|
|
13490
|
+
const limit = normalizeEventPageLimit(options.limit);
|
|
13491
|
+
const pageEvents = queried.slice(offset, offset + limit);
|
|
13492
|
+
const nextOffset = offset + pageEvents.length;
|
|
13493
|
+
const hasMore = nextOffset < queried.length;
|
|
13494
|
+
return {
|
|
13495
|
+
events: pageEvents,
|
|
13496
|
+
cursor: options.cursor,
|
|
13497
|
+
nextCursor: hasMore ? encodeLocalJsonEventCursor(nextOffset, options) : undefined,
|
|
13498
|
+
hasMore
|
|
13499
|
+
};
|
|
13413
13500
|
}
|
|
13414
13501
|
async findEventByIdentity(identity) {
|
|
13415
13502
|
const events = await this.listEvents();
|
|
13416
|
-
return events
|
|
13503
|
+
return findEventByIdentity(events, identity);
|
|
13417
13504
|
}
|
|
13418
13505
|
async appendDelivery(result) {
|
|
13419
13506
|
await this.init();
|
|
@@ -13464,6 +13551,83 @@ class JsonEventsStore {
|
|
|
13464
13551
|
});
|
|
13465
13552
|
}
|
|
13466
13553
|
}
|
|
13554
|
+
function localJsonRuntime(dataDir = getEventsDataDir()) {
|
|
13555
|
+
return {
|
|
13556
|
+
mode: "local-files",
|
|
13557
|
+
name: "json-events-store",
|
|
13558
|
+
remote: false,
|
|
13559
|
+
localFiles: true,
|
|
13560
|
+
localSqlite: false,
|
|
13561
|
+
postgres: false,
|
|
13562
|
+
s3: false,
|
|
13563
|
+
aws: false,
|
|
13564
|
+
durable: true,
|
|
13565
|
+
idempotency: "best-effort-local",
|
|
13566
|
+
replayCursors: true,
|
|
13567
|
+
description: `Local JSON files in ${dataDir}; no SQLite, Postgres, S3, or AWS runtime is configured by this store.`
|
|
13568
|
+
};
|
|
13569
|
+
}
|
|
13570
|
+
function encodeLocalJsonEventCursor(offset, options = {}) {
|
|
13571
|
+
if (!Number.isInteger(offset) || offset < 0)
|
|
13572
|
+
throw new Error(`Invalid event cursor offset: ${offset}`);
|
|
13573
|
+
const payload = {
|
|
13574
|
+
offset,
|
|
13575
|
+
eventId: options.eventId,
|
|
13576
|
+
source: options.source,
|
|
13577
|
+
type: options.type
|
|
13578
|
+
};
|
|
13579
|
+
return `${LOCAL_JSON_EVENT_CURSOR_PREFIX}${Buffer2.from(JSON.stringify(payload), "utf-8").toString("base64url")}`;
|
|
13580
|
+
}
|
|
13581
|
+
function decodeLocalJsonEventCursor(cursor, options = {}) {
|
|
13582
|
+
if (!cursor)
|
|
13583
|
+
return 0;
|
|
13584
|
+
if (!cursor.startsWith(LOCAL_JSON_EVENT_CURSOR_PREFIX))
|
|
13585
|
+
throw new Error(`Invalid local JSON event cursor: ${cursor}`);
|
|
13586
|
+
const rawPayload = cursor.slice(LOCAL_JSON_EVENT_CURSOR_PREFIX.length);
|
|
13587
|
+
let payload;
|
|
13588
|
+
try {
|
|
13589
|
+
payload = JSON.parse(Buffer2.from(rawPayload, "base64url").toString("utf-8"));
|
|
13590
|
+
} catch {
|
|
13591
|
+
throw new Error(`Invalid local JSON event cursor: ${cursor}`);
|
|
13592
|
+
}
|
|
13593
|
+
const offset = payload.offset;
|
|
13594
|
+
if (!Number.isInteger(offset) || offset < 0)
|
|
13595
|
+
throw new Error(`Invalid local JSON event cursor: ${cursor}`);
|
|
13596
|
+
assertCursorFilter("eventId", payload.eventId, options.eventId);
|
|
13597
|
+
assertCursorFilter("source", payload.source, options.source);
|
|
13598
|
+
assertCursorFilter("type", payload.type, options.type);
|
|
13599
|
+
return offset;
|
|
13600
|
+
}
|
|
13601
|
+
function normalizeEventPageLimit(limit) {
|
|
13602
|
+
if (limit === undefined)
|
|
13603
|
+
return DEFAULT_EVENT_PAGE_LIMIT;
|
|
13604
|
+
if (!Number.isInteger(limit) || limit < 1)
|
|
13605
|
+
throw new Error(`Event page limit must be a positive integer, got ${limit}`);
|
|
13606
|
+
return Math.min(limit, MAX_EVENT_PAGE_LIMIT);
|
|
13607
|
+
}
|
|
13608
|
+
function queryEvents(events, options) {
|
|
13609
|
+
let rows = events;
|
|
13610
|
+
if (options.eventId)
|
|
13611
|
+
rows = rows.filter((event) => event.id === options.eventId);
|
|
13612
|
+
if (options.source)
|
|
13613
|
+
rows = rows.filter((event) => event.source === options.source);
|
|
13614
|
+
if (options.type)
|
|
13615
|
+
rows = rows.filter((event) => event.type === options.type);
|
|
13616
|
+
if (options.cursor) {
|
|
13617
|
+
const offset = decodeLocalJsonEventCursor(options.cursor, options);
|
|
13618
|
+
rows = rows.slice(offset);
|
|
13619
|
+
}
|
|
13620
|
+
if (options.limit !== undefined)
|
|
13621
|
+
rows = rows.slice(0, normalizeEventPageLimit(options.limit));
|
|
13622
|
+
return rows;
|
|
13623
|
+
}
|
|
13624
|
+
function assertCursorFilter(name, cursorValue, optionValue) {
|
|
13625
|
+
if (cursorValue !== optionValue)
|
|
13626
|
+
throw new Error(`Local JSON event cursor ${name} filter mismatch`);
|
|
13627
|
+
}
|
|
13628
|
+
function findEventByIdentity(events, identity) {
|
|
13629
|
+
return events.find((event) => identity.id !== undefined && event.id === identity.id || identity.dedupeKey !== undefined && event.dedupeKey === identity.dedupeKey);
|
|
13630
|
+
}
|
|
13467
13631
|
function buildSignatureBase(timestamp2, body) {
|
|
13468
13632
|
return `${timestamp2}.${body}`;
|
|
13469
13633
|
}
|
|
@@ -13477,21 +13641,27 @@ function now2() {
|
|
|
13477
13641
|
function truncate(value, max = 4096) {
|
|
13478
13642
|
return value.length > max ? `${value.slice(0, max)}...` : value;
|
|
13479
13643
|
}
|
|
13480
|
-
function buildWebhookRequest(event, channel) {
|
|
13644
|
+
function buildWebhookRequest(event, channel, options = {}) {
|
|
13481
13645
|
if (!channel.webhook)
|
|
13482
13646
|
throw new Error(`Channel ${channel.id} has no webhook config`);
|
|
13647
|
+
for (const name of Object.keys(channel.webhook.headers ?? {})) {
|
|
13648
|
+
if (/^x-hasna-/i.test(name)) {
|
|
13649
|
+
throw new Error(`Webhook header ${name} is reserved for signed delivery metadata`);
|
|
13650
|
+
}
|
|
13651
|
+
}
|
|
13483
13652
|
const body = JSON.stringify(event);
|
|
13484
|
-
const timestamp2 =
|
|
13653
|
+
const timestamp2 = options.timestamp ?? new Date().toISOString();
|
|
13485
13654
|
const headers = {
|
|
13486
13655
|
"Content-Type": "application/json",
|
|
13487
13656
|
"User-Agent": "@hasna/events",
|
|
13488
13657
|
"X-Hasna-Event-Id": event.id,
|
|
13489
13658
|
"X-Hasna-Event-Type": event.type,
|
|
13490
|
-
|
|
13491
|
-
|
|
13659
|
+
...channel.webhook.headers,
|
|
13660
|
+
"X-Hasna-Timestamp": timestamp2
|
|
13492
13661
|
};
|
|
13493
|
-
|
|
13494
|
-
|
|
13662
|
+
const secret = options.secret ?? channel.webhook.secret;
|
|
13663
|
+
if (secret) {
|
|
13664
|
+
headers["X-Hasna-Signature"] = signPayload(secret, timestamp2, body);
|
|
13495
13665
|
}
|
|
13496
13666
|
return { body, headers };
|
|
13497
13667
|
}
|
|
@@ -13499,7 +13669,21 @@ async function dispatchWebhook(event, channel, options = {}) {
|
|
|
13499
13669
|
if (!channel.webhook)
|
|
13500
13670
|
throw new Error(`Channel ${channel.id} has no webhook config`);
|
|
13501
13671
|
const startedAt = now2();
|
|
13502
|
-
|
|
13672
|
+
let secret = channel.webhook.secret;
|
|
13673
|
+
if (channel.webhook.secretRef) {
|
|
13674
|
+
if (!options.secretResolver) {
|
|
13675
|
+
return failedAttempt(startedAt, "Webhook secret reference has no runtime resolver");
|
|
13676
|
+
}
|
|
13677
|
+
try {
|
|
13678
|
+
secret = await options.secretResolver(channel.webhook.secretRef);
|
|
13679
|
+
} catch {
|
|
13680
|
+
return failedAttempt(startedAt, "Webhook secret reference could not be resolved");
|
|
13681
|
+
}
|
|
13682
|
+
if (!secret)
|
|
13683
|
+
return failedAttempt(startedAt, "Webhook secret reference could not be resolved");
|
|
13684
|
+
}
|
|
13685
|
+
const timestamp2 = (options.now?.() ?? new Date).toISOString();
|
|
13686
|
+
const { body, headers } = buildWebhookRequest(event, channel, { secret, timestamp: timestamp2 });
|
|
13503
13687
|
const controller = new AbortController;
|
|
13504
13688
|
const timeout = setTimeout(() => controller.abort(), channel.webhook.timeoutMs ?? 15000);
|
|
13505
13689
|
try {
|
|
@@ -13531,6 +13715,15 @@ async function dispatchWebhook(event, channel, options = {}) {
|
|
|
13531
13715
|
clearTimeout(timeout);
|
|
13532
13716
|
}
|
|
13533
13717
|
}
|
|
13718
|
+
function failedAttempt(startedAt, error) {
|
|
13719
|
+
return {
|
|
13720
|
+
attempt: 1,
|
|
13721
|
+
status: "failed",
|
|
13722
|
+
startedAt,
|
|
13723
|
+
completedAt: now2(),
|
|
13724
|
+
error
|
|
13725
|
+
};
|
|
13726
|
+
}
|
|
13534
13727
|
async function dispatchCommand(event, channel) {
|
|
13535
13728
|
if (!channel.command)
|
|
13536
13729
|
throw new Error(`Channel ${channel.id} has no command config`);
|
|
@@ -13619,6 +13812,76 @@ function createDeliveryResult(event, channel, attempts) {
|
|
|
13619
13812
|
completedAt: attempts.at(-1)?.completedAt ?? now2()
|
|
13620
13813
|
};
|
|
13621
13814
|
}
|
|
13815
|
+
|
|
13816
|
+
class EventTypeCatalog {
|
|
13817
|
+
definitions = new Map;
|
|
13818
|
+
register(definition) {
|
|
13819
|
+
this.definitions.set(definition.type, definition);
|
|
13820
|
+
return this;
|
|
13821
|
+
}
|
|
13822
|
+
unregister(type) {
|
|
13823
|
+
return this.definitions.delete(type);
|
|
13824
|
+
}
|
|
13825
|
+
has(type) {
|
|
13826
|
+
return this.definitions.has(type);
|
|
13827
|
+
}
|
|
13828
|
+
get(type) {
|
|
13829
|
+
return this.definitions.get(type);
|
|
13830
|
+
}
|
|
13831
|
+
list() {
|
|
13832
|
+
return [...this.definitions.values()];
|
|
13833
|
+
}
|
|
13834
|
+
validateEvent(event) {
|
|
13835
|
+
const definition = this.definitions.get(event.type);
|
|
13836
|
+
if (!definition)
|
|
13837
|
+
return { ok: true };
|
|
13838
|
+
return definition.validate(event.data, event);
|
|
13839
|
+
}
|
|
13840
|
+
assertEventValid(event) {
|
|
13841
|
+
const result = this.validateEvent(event);
|
|
13842
|
+
if (!result.ok) {
|
|
13843
|
+
throw new EventValidationError(event.type, result.issues);
|
|
13844
|
+
}
|
|
13845
|
+
}
|
|
13846
|
+
}
|
|
13847
|
+
function redactPaths(event, paths, replacement = "[REDACTED]") {
|
|
13848
|
+
if (paths.length === 0)
|
|
13849
|
+
return event;
|
|
13850
|
+
const copy = structuredClone(event);
|
|
13851
|
+
for (const path of paths) {
|
|
13852
|
+
setPath(copy, path, replacement);
|
|
13853
|
+
}
|
|
13854
|
+
return copy;
|
|
13855
|
+
}
|
|
13856
|
+
function redactSensitiveKeys(event, replacement = "[REDACTED]") {
|
|
13857
|
+
return redactValue2(event, replacement);
|
|
13858
|
+
}
|
|
13859
|
+
function shouldRedactKey(key) {
|
|
13860
|
+
return /secret|token|password|api[_-]?key|authorization/i.test(key);
|
|
13861
|
+
}
|
|
13862
|
+
function redactValue2(value, replacement) {
|
|
13863
|
+
if (Array.isArray(value))
|
|
13864
|
+
return value.map((item) => redactValue2(item, replacement));
|
|
13865
|
+
if (!value || typeof value !== "object")
|
|
13866
|
+
return value;
|
|
13867
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => [
|
|
13868
|
+
key,
|
|
13869
|
+
shouldRedactKey(key) ? replacement : redactValue2(item, replacement)
|
|
13870
|
+
]));
|
|
13871
|
+
}
|
|
13872
|
+
function setPath(input, path, replacement) {
|
|
13873
|
+
const parts = path.split(".");
|
|
13874
|
+
let cursor = input;
|
|
13875
|
+
for (const part of parts.slice(0, -1)) {
|
|
13876
|
+
const next = cursor[part];
|
|
13877
|
+
if (!next || typeof next !== "object")
|
|
13878
|
+
return;
|
|
13879
|
+
cursor = next;
|
|
13880
|
+
}
|
|
13881
|
+
const last = parts.at(-1);
|
|
13882
|
+
if (last && last in cursor)
|
|
13883
|
+
cursor[last] = replacement;
|
|
13884
|
+
}
|
|
13622
13885
|
function createEvent(input) {
|
|
13623
13886
|
return {
|
|
13624
13887
|
id: input.id ?? randomUUID22(),
|
|
@@ -13639,10 +13902,18 @@ class EventsClient {
|
|
|
13639
13902
|
store;
|
|
13640
13903
|
redactors;
|
|
13641
13904
|
transportOptions;
|
|
13905
|
+
catalog;
|
|
13906
|
+
validateCatalogTypes;
|
|
13642
13907
|
constructor(options = {}) {
|
|
13643
13908
|
this.store = options.store ?? new JsonEventsStore(options.dataDir);
|
|
13644
13909
|
this.redactors = options.redactors ?? [];
|
|
13645
|
-
this.transportOptions = {
|
|
13910
|
+
this.transportOptions = {
|
|
13911
|
+
fetchImpl: options.fetchImpl,
|
|
13912
|
+
secretResolver: options.secretResolver,
|
|
13913
|
+
now: options.now
|
|
13914
|
+
};
|
|
13915
|
+
this.catalog = options.catalog ?? defaultEventTypeCatalog;
|
|
13916
|
+
this.validateCatalogTypes = options.validateCatalogTypes ?? false;
|
|
13646
13917
|
}
|
|
13647
13918
|
async addChannel(input) {
|
|
13648
13919
|
const timestamp2 = new Date().toISOString();
|
|
@@ -13660,18 +13931,40 @@ class EventsClient {
|
|
|
13660
13931
|
}
|
|
13661
13932
|
async emit(input, options = {}) {
|
|
13662
13933
|
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
|
-
|
|
13934
|
+
if (options.validate ?? this.validateCatalogTypes) {
|
|
13935
|
+
this.catalog.assertEventValid(event);
|
|
13936
|
+
}
|
|
13937
|
+
const append = await this.appendEvent(event, { dedupe: options.dedupe !== false });
|
|
13938
|
+
if (append.deduped) {
|
|
13939
|
+
return { event: append.event, deliveries: [], deduped: true };
|
|
13940
|
+
}
|
|
13941
|
+
const deliveries = options.deliver === false ? [] : await this.deliver(append.event);
|
|
13942
|
+
return { event: append.event, deliveries, deduped: false };
|
|
13943
|
+
}
|
|
13944
|
+
async listEvents(options = {}) {
|
|
13945
|
+
if (Object.keys(options).length === 0)
|
|
13946
|
+
return this.store.listEvents();
|
|
13947
|
+
return queryClientEvents(await this.store.listEvents(), options);
|
|
13948
|
+
}
|
|
13949
|
+
async listEventsPage(options = {}) {
|
|
13950
|
+
if (this.store.listEventsPage)
|
|
13951
|
+
return this.store.listEventsPage(options);
|
|
13952
|
+
const events = queryClientEvents(await this.store.listEvents(), {
|
|
13953
|
+
eventId: options.eventId,
|
|
13954
|
+
source: options.source,
|
|
13955
|
+
type: options.type
|
|
13956
|
+
});
|
|
13957
|
+
const offset = decodeLocalJsonEventCursor(options.cursor, options);
|
|
13958
|
+
const limit = normalizeEventPageLimit(options.limit);
|
|
13959
|
+
const pageEvents = events.slice(offset, offset + limit);
|
|
13960
|
+
const nextOffset = offset + pageEvents.length;
|
|
13961
|
+
const hasMore = nextOffset < events.length;
|
|
13962
|
+
return {
|
|
13963
|
+
events: pageEvents,
|
|
13964
|
+
cursor: options.cursor,
|
|
13965
|
+
nextCursor: hasMore ? encodeLocalJsonEventCursor(nextOffset, options) : undefined,
|
|
13966
|
+
hasMore
|
|
13967
|
+
};
|
|
13675
13968
|
}
|
|
13676
13969
|
async listDeliveries() {
|
|
13677
13970
|
return this.store.listDeliveries();
|
|
@@ -13739,22 +14032,37 @@ class EventsClient {
|
|
|
13739
14032
|
return result;
|
|
13740
14033
|
}
|
|
13741
14034
|
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
|
-
});
|
|
14035
|
+
const page = options.cursor || options.limit !== undefined ? await this.listEventsPage(options) : { events: await this.listEvents(options), hasMore: false };
|
|
13751
14036
|
if (options.dryRun)
|
|
13752
|
-
return { events, deliveries: [] };
|
|
14037
|
+
return { events: page.events, deliveries: [], cursor: page.cursor, nextCursor: page.nextCursor, hasMore: page.hasMore };
|
|
13753
14038
|
const deliveries = [];
|
|
13754
|
-
for (const event of events) {
|
|
14039
|
+
for (const event of page.events) {
|
|
13755
14040
|
deliveries.push(...await this.deliver(event));
|
|
13756
14041
|
}
|
|
13757
|
-
return { events, deliveries };
|
|
14042
|
+
return { events: page.events, deliveries, cursor: page.cursor, nextCursor: page.nextCursor, hasMore: page.hasMore };
|
|
14043
|
+
}
|
|
14044
|
+
async appendEvent(event, options) {
|
|
14045
|
+
if (this.store.appendEventOnce) {
|
|
14046
|
+
return this.store.appendEventOnce(event, { dedupe: options.dedupe });
|
|
14047
|
+
}
|
|
14048
|
+
if (options.dedupe) {
|
|
14049
|
+
const existing = await this.store.findEventByIdentity({ id: event.id, dedupeKey: event.dedupeKey });
|
|
14050
|
+
if (existing) {
|
|
14051
|
+
return {
|
|
14052
|
+
event: existing,
|
|
14053
|
+
stored: false,
|
|
14054
|
+
deduped: true,
|
|
14055
|
+
identity: { id: existing.id, dedupeKey: existing.dedupeKey }
|
|
14056
|
+
};
|
|
14057
|
+
}
|
|
14058
|
+
}
|
|
14059
|
+
const stored = await this.store.appendEvent(event);
|
|
14060
|
+
return {
|
|
14061
|
+
event: stored,
|
|
14062
|
+
stored: true,
|
|
14063
|
+
deduped: false,
|
|
14064
|
+
identity: { id: stored.id, dedupeKey: stored.dedupeKey }
|
|
14065
|
+
};
|
|
13758
14066
|
}
|
|
13759
14067
|
async applyRedaction(event, channel) {
|
|
13760
14068
|
let next = redactPaths(event, channel.redact?.paths ?? [], channel.redact?.replacement ?? "[REDACTED]");
|
|
@@ -13781,43 +14089,19 @@ class EventsClient {
|
|
|
13781
14089
|
return createDeliveryResult(event, channel, attempts);
|
|
13782
14090
|
}
|
|
13783
14091
|
}
|
|
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;
|
|
14092
|
+
function queryClientEvents(events, options) {
|
|
14093
|
+
let rows = events;
|
|
14094
|
+
if (options.eventId)
|
|
14095
|
+
rows = rows.filter((event) => event.id === options.eventId);
|
|
14096
|
+
if (options.source)
|
|
14097
|
+
rows = rows.filter((event) => event.source === options.source);
|
|
14098
|
+
if (options.type)
|
|
14099
|
+
rows = rows.filter((event) => event.type === options.type);
|
|
14100
|
+
if (options.cursor)
|
|
14101
|
+
rows = rows.slice(decodeLocalJsonEventCursor(options.cursor, options));
|
|
14102
|
+
if (options.limit !== undefined)
|
|
14103
|
+
rows = rows.slice(0, normalizeEventPageLimit(options.limit));
|
|
14104
|
+
return rows;
|
|
13821
14105
|
}
|
|
13822
14106
|
function normalizeTime(value) {
|
|
13823
14107
|
if (!value)
|
|
@@ -13831,9 +14115,22 @@ function normalizeRetryPolicy(policy) {
|
|
|
13831
14115
|
multiplier: Math.max(1, policy?.multiplier ?? 2)
|
|
13832
14116
|
};
|
|
13833
14117
|
}
|
|
13834
|
-
var HASNA_EVENTS_DIR_ENV = "HASNA_EVENTS_DIR", HASNA_EVENTS_HOME_ENV = "HASNA_EVENTS_HOME", DEFAULT_SIGNATURE_TOLERANCE_MS;
|
|
14118
|
+
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
14119
|
var init_dist = __esm(() => {
|
|
13836
14120
|
DEFAULT_SIGNATURE_TOLERANCE_MS = 5 * 60 * 1000;
|
|
14121
|
+
EventValidationError = class EventValidationError extends Error {
|
|
14122
|
+
eventType;
|
|
14123
|
+
issues;
|
|
14124
|
+
constructor(eventType, issues) {
|
|
14125
|
+
const detail = issues.map((issue) => `${issue.path || "<root>"}: ${issue.message}`).join("; ");
|
|
14126
|
+
super(`Event validation failed for type "${eventType}": ${detail}`);
|
|
14127
|
+
this.name = "EventValidationError";
|
|
14128
|
+
this.eventType = eventType;
|
|
14129
|
+
this.issues = issues;
|
|
14130
|
+
}
|
|
14131
|
+
};
|
|
14132
|
+
defaultEventTypeCatalog = new EventTypeCatalog;
|
|
14133
|
+
APP_EVENT_V1_MAX_DATA_BYTES = 32 * 1024;
|
|
13837
14134
|
});
|
|
13838
14135
|
|
|
13839
14136
|
// src/db/task-lists.ts
|
|
@@ -14672,8 +14969,12 @@ async function deliverWebhook(wh, event, body, attempt, db) {
|
|
|
14672
14969
|
const sig = await crypto.subtle.sign("HMAC", key, encoder.encode(body));
|
|
14673
14970
|
headers["X-Webhook-Signature"] = Array.from(new Uint8Array(sig)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
14674
14971
|
}
|
|
14675
|
-
const resp = await fetch(wh.url, { method: "POST", headers, body });
|
|
14972
|
+
const resp = await fetch(wh.url, { method: "POST", headers, body, redirect: "manual" });
|
|
14676
14973
|
const respText = await resp.text().catch(() => "");
|
|
14974
|
+
if (resp.status >= 300 && resp.status < 400) {
|
|
14975
|
+
logDelivery(db, wh.id, event, body, resp.status, "Blocked: webhook URL returned a 3xx redirect; redirects are never followed (SSRF prevention)", attempt);
|
|
14976
|
+
return;
|
|
14977
|
+
}
|
|
14677
14978
|
logDelivery(db, wh.id, event, body, resp.status, respText.slice(0, 1000), attempt);
|
|
14678
14979
|
if (resp.status >= 400 && attempt < MAX_RETRY_ATTEMPTS) {
|
|
14679
14980
|
const delay = RETRY_BASE_DELAY_MS * Math.pow(2, attempt - 1);
|
|
@@ -38180,6 +38481,152 @@ var init_v1 = __esm(() => {
|
|
|
38180
38481
|
RFC3339_DATE_TIME = /^(\d{4})-(\d{2})-(\d{2})[Tt]\d{2}:\d{2}:\d{2}(\.\d+)?([Zz]|[+-]\d{2}:\d{2})$/;
|
|
38181
38482
|
});
|
|
38182
38483
|
|
|
38484
|
+
// node_modules/.bun/content-type@1.0.5/node_modules/content-type/index.js
|
|
38485
|
+
var require_content_type = __commonJS((exports) => {
|
|
38486
|
+
/*!
|
|
38487
|
+
* content-type
|
|
38488
|
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
38489
|
+
* MIT Licensed
|
|
38490
|
+
*/
|
|
38491
|
+
var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;
|
|
38492
|
+
var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/;
|
|
38493
|
+
var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
38494
|
+
var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g;
|
|
38495
|
+
var QUOTE_REGEXP = /([\\"])/g;
|
|
38496
|
+
var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
38497
|
+
exports.format = format;
|
|
38498
|
+
exports.parse = parse;
|
|
38499
|
+
function format(obj) {
|
|
38500
|
+
if (!obj || typeof obj !== "object") {
|
|
38501
|
+
throw new TypeError("argument obj is required");
|
|
38502
|
+
}
|
|
38503
|
+
var parameters = obj.parameters;
|
|
38504
|
+
var type = obj.type;
|
|
38505
|
+
if (!type || !TYPE_REGEXP.test(type)) {
|
|
38506
|
+
throw new TypeError("invalid type");
|
|
38507
|
+
}
|
|
38508
|
+
var string = type;
|
|
38509
|
+
if (parameters && typeof parameters === "object") {
|
|
38510
|
+
var param;
|
|
38511
|
+
var params = Object.keys(parameters).sort();
|
|
38512
|
+
for (var i = 0;i < params.length; i++) {
|
|
38513
|
+
param = params[i];
|
|
38514
|
+
if (!TOKEN_REGEXP.test(param)) {
|
|
38515
|
+
throw new TypeError("invalid parameter name");
|
|
38516
|
+
}
|
|
38517
|
+
string += "; " + param + "=" + qstring(parameters[param]);
|
|
38518
|
+
}
|
|
38519
|
+
}
|
|
38520
|
+
return string;
|
|
38521
|
+
}
|
|
38522
|
+
function parse(string) {
|
|
38523
|
+
if (!string) {
|
|
38524
|
+
throw new TypeError("argument string is required");
|
|
38525
|
+
}
|
|
38526
|
+
var header = typeof string === "object" ? getcontenttype(string) : string;
|
|
38527
|
+
if (typeof header !== "string") {
|
|
38528
|
+
throw new TypeError("argument string is required to be a string");
|
|
38529
|
+
}
|
|
38530
|
+
var index = header.indexOf(";");
|
|
38531
|
+
var type = index !== -1 ? header.slice(0, index).trim() : header.trim();
|
|
38532
|
+
if (!TYPE_REGEXP.test(type)) {
|
|
38533
|
+
throw new TypeError("invalid media type");
|
|
38534
|
+
}
|
|
38535
|
+
var obj = new ContentType(type.toLowerCase());
|
|
38536
|
+
if (index !== -1) {
|
|
38537
|
+
var key2;
|
|
38538
|
+
var match;
|
|
38539
|
+
var value;
|
|
38540
|
+
PARAM_REGEXP.lastIndex = index;
|
|
38541
|
+
while (match = PARAM_REGEXP.exec(header)) {
|
|
38542
|
+
if (match.index !== index) {
|
|
38543
|
+
throw new TypeError("invalid parameter format");
|
|
38544
|
+
}
|
|
38545
|
+
index += match[0].length;
|
|
38546
|
+
key2 = match[1].toLowerCase();
|
|
38547
|
+
value = match[2];
|
|
38548
|
+
if (value.charCodeAt(0) === 34) {
|
|
38549
|
+
value = value.slice(1, -1);
|
|
38550
|
+
if (value.indexOf("\\") !== -1) {
|
|
38551
|
+
value = value.replace(QESC_REGEXP, "$1");
|
|
38552
|
+
}
|
|
38553
|
+
}
|
|
38554
|
+
obj.parameters[key2] = value;
|
|
38555
|
+
}
|
|
38556
|
+
if (index !== header.length) {
|
|
38557
|
+
throw new TypeError("invalid parameter format");
|
|
38558
|
+
}
|
|
38559
|
+
}
|
|
38560
|
+
return obj;
|
|
38561
|
+
}
|
|
38562
|
+
function getcontenttype(obj) {
|
|
38563
|
+
var header;
|
|
38564
|
+
if (typeof obj.getHeader === "function") {
|
|
38565
|
+
header = obj.getHeader("content-type");
|
|
38566
|
+
} else if (typeof obj.headers === "object") {
|
|
38567
|
+
header = obj.headers && obj.headers["content-type"];
|
|
38568
|
+
}
|
|
38569
|
+
if (typeof header !== "string") {
|
|
38570
|
+
throw new TypeError("content-type header is missing from object");
|
|
38571
|
+
}
|
|
38572
|
+
return header;
|
|
38573
|
+
}
|
|
38574
|
+
function qstring(val) {
|
|
38575
|
+
var str = String(val);
|
|
38576
|
+
if (TOKEN_REGEXP.test(str)) {
|
|
38577
|
+
return str;
|
|
38578
|
+
}
|
|
38579
|
+
if (str.length > 0 && !TEXT_REGEXP.test(str)) {
|
|
38580
|
+
throw new TypeError("invalid parameter value");
|
|
38581
|
+
}
|
|
38582
|
+
return '"' + str.replace(QUOTE_REGEXP, "\\$1") + '"';
|
|
38583
|
+
}
|
|
38584
|
+
function ContentType(type) {
|
|
38585
|
+
this.parameters = Object.create(null);
|
|
38586
|
+
this.type = type;
|
|
38587
|
+
}
|
|
38588
|
+
});
|
|
38589
|
+
|
|
38590
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js
|
|
38591
|
+
function mediaTypeEssence(header) {
|
|
38592
|
+
if (!header) {
|
|
38593
|
+
return;
|
|
38594
|
+
}
|
|
38595
|
+
try {
|
|
38596
|
+
return import_content_type.default.parse(header).type;
|
|
38597
|
+
} catch {
|
|
38598
|
+
const essence = (header.split(";", 1)[0] ?? "").trim().toLowerCase();
|
|
38599
|
+
if (essence === "" || header.slice(essence.length).includes(",")) {
|
|
38600
|
+
return;
|
|
38601
|
+
}
|
|
38602
|
+
return essence;
|
|
38603
|
+
}
|
|
38604
|
+
}
|
|
38605
|
+
function isJsonContentType(header) {
|
|
38606
|
+
if (header === "application/json") {
|
|
38607
|
+
return true;
|
|
38608
|
+
}
|
|
38609
|
+
return mediaTypeEssence(header) === "application/json";
|
|
38610
|
+
}
|
|
38611
|
+
var import_content_type;
|
|
38612
|
+
var init_mediaType = __esm(() => {
|
|
38613
|
+
import_content_type = __toESM(require_content_type(), 1);
|
|
38614
|
+
});
|
|
38615
|
+
|
|
38616
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.js
|
|
38617
|
+
function armSseKeepAlive(intervalMs, onTick) {
|
|
38618
|
+
if (!Number.isFinite(intervalMs) || intervalMs < 1) {
|
|
38619
|
+
return;
|
|
38620
|
+
}
|
|
38621
|
+
const timer = setInterval(onTick, Math.min(intervalMs, MAX_TIMER_DELAY_MS));
|
|
38622
|
+
timer.unref?.();
|
|
38623
|
+
return timer;
|
|
38624
|
+
}
|
|
38625
|
+
var DEFAULT_SSE_KEEP_ALIVE_MS = 15000, MAX_TIMER_DELAY_MS;
|
|
38626
|
+
var init_sseKeepAlive = __esm(() => {
|
|
38627
|
+
MAX_TIMER_DELAY_MS = 2 ** 31 - 1;
|
|
38628
|
+
});
|
|
38629
|
+
|
|
38183
38630
|
// node_modules/.bun/zod@3.25.76/node_modules/zod/v4/core/core.js
|
|
38184
38631
|
function $constructor(name, initializer, params) {
|
|
38185
38632
|
function init(inst, def) {
|
|
@@ -42766,7 +43213,7 @@ var init_v4 = __esm(() => {
|
|
|
42766
43213
|
init_classic();
|
|
42767
43214
|
});
|
|
42768
43215
|
|
|
42769
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
43216
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
|
|
42770
43217
|
function assertCompleteRequestPrompt(request) {
|
|
42771
43218
|
if (request.params.ref.type !== "ref/prompt") {
|
|
42772
43219
|
throw new TypeError(`Expected CompleteRequestPrompt, but got ${request.params.ref.type}`);
|
|
@@ -42785,7 +43232,7 @@ var init_types7 = __esm(() => {
|
|
|
42785
43232
|
ProgressTokenSchema = union([string2(), number2().int()]);
|
|
42786
43233
|
CursorSchema = string2();
|
|
42787
43234
|
TaskCreationParamsSchema = looseObject({
|
|
42788
|
-
ttl:
|
|
43235
|
+
ttl: number2().optional(),
|
|
42789
43236
|
pollInterval: number2().optional()
|
|
42790
43237
|
});
|
|
42791
43238
|
TaskMetadataSchema = object({
|
|
@@ -42933,7 +43380,8 @@ var init_types7 = __esm(() => {
|
|
|
42933
43380
|
roots: object({
|
|
42934
43381
|
listChanged: boolean2().optional()
|
|
42935
43382
|
}).optional(),
|
|
42936
|
-
tasks: ClientTasksCapabilitySchema.optional()
|
|
43383
|
+
tasks: ClientTasksCapabilitySchema.optional(),
|
|
43384
|
+
extensions: record(string2(), AssertObjectSchema).optional()
|
|
42937
43385
|
});
|
|
42938
43386
|
InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
42939
43387
|
protocolVersion: string2(),
|
|
@@ -42958,7 +43406,8 @@ var init_types7 = __esm(() => {
|
|
|
42958
43406
|
tools: object({
|
|
42959
43407
|
listChanged: boolean2().optional()
|
|
42960
43408
|
}).optional(),
|
|
42961
|
-
tasks: ServerTasksCapabilitySchema.optional()
|
|
43409
|
+
tasks: ServerTasksCapabilitySchema.optional(),
|
|
43410
|
+
extensions: record(string2(), AssertObjectSchema).optional()
|
|
42962
43411
|
});
|
|
42963
43412
|
InitializeResultSchema = ResultSchema.extend({
|
|
42964
43413
|
protocolVersion: string2(),
|
|
@@ -43073,6 +43522,7 @@ var init_types7 = __esm(() => {
|
|
|
43073
43522
|
uri: string2(),
|
|
43074
43523
|
description: optional(string2()),
|
|
43075
43524
|
mimeType: optional(string2()),
|
|
43525
|
+
size: optional(number2()),
|
|
43076
43526
|
annotations: AnnotationsSchema.optional(),
|
|
43077
43527
|
_meta: optional(looseObject({}))
|
|
43078
43528
|
});
|
|
@@ -43601,17 +44051,19 @@ var init_types7 = __esm(() => {
|
|
|
43601
44051
|
};
|
|
43602
44052
|
});
|
|
43603
44053
|
|
|
43604
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
44054
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.js
|
|
43605
44055
|
class WebStandardStreamableHTTPServerTransport {
|
|
43606
44056
|
constructor(options = {}) {
|
|
43607
44057
|
this._started = false;
|
|
43608
44058
|
this._hasHandledRequest = false;
|
|
43609
44059
|
this._streamMapping = new Map;
|
|
43610
44060
|
this._requestToStreamMapping = new Map;
|
|
44061
|
+
this._resumableStreams = new Set;
|
|
43611
44062
|
this._requestResponseMap = new Map;
|
|
43612
44063
|
this._initialized = false;
|
|
43613
44064
|
this._enableJsonResponse = false;
|
|
43614
44065
|
this._standaloneSseStreamId = "_GET_stream";
|
|
44066
|
+
this._closed = false;
|
|
43615
44067
|
this.sessionIdGenerator = options.sessionIdGenerator;
|
|
43616
44068
|
this._enableJsonResponse = options.enableJsonResponse ?? false;
|
|
43617
44069
|
this._eventStore = options.eventStore;
|
|
@@ -43621,6 +44073,22 @@ class WebStandardStreamableHTTPServerTransport {
|
|
|
43621
44073
|
this._allowedOrigins = options.allowedOrigins;
|
|
43622
44074
|
this._enableDnsRebindingProtection = options.enableDnsRebindingProtection ?? false;
|
|
43623
44075
|
this._retryInterval = options.retryInterval;
|
|
44076
|
+
this._keepAliveMs = options.keepAliveMs ?? DEFAULT_SSE_KEEP_ALIVE_MS;
|
|
44077
|
+
}
|
|
44078
|
+
startKeepAlive(controller, encoder) {
|
|
44079
|
+
if (this._closed)
|
|
44080
|
+
return;
|
|
44081
|
+
const timer = armSseKeepAlive(this._keepAliveMs, () => {
|
|
44082
|
+
try {
|
|
44083
|
+
controller.enqueue(encoder.encode(`: keepalive
|
|
44084
|
+
|
|
44085
|
+
`));
|
|
44086
|
+
} catch {
|
|
44087
|
+
if (timer !== undefined)
|
|
44088
|
+
clearInterval(timer);
|
|
44089
|
+
}
|
|
44090
|
+
});
|
|
44091
|
+
return timer;
|
|
43624
44092
|
}
|
|
43625
44093
|
async start() {
|
|
43626
44094
|
if (this._started) {
|
|
@@ -43668,6 +44136,9 @@ class WebStandardStreamableHTTPServerTransport {
|
|
|
43668
44136
|
return;
|
|
43669
44137
|
}
|
|
43670
44138
|
async handleRequest(req, options) {
|
|
44139
|
+
if (this._closed) {
|
|
44140
|
+
return this.createJsonErrorResponse(404, -32001, "Session not found");
|
|
44141
|
+
}
|
|
43671
44142
|
if (!this.sessionIdGenerator && this._hasHandledRequest) {
|
|
43672
44143
|
throw new Error("Stateless transport cannot be reused across requests. Create a new transport per request.");
|
|
43673
44144
|
}
|
|
@@ -43707,10 +44178,12 @@ data:
|
|
|
43707
44178
|
`;
|
|
43708
44179
|
}
|
|
43709
44180
|
controller.enqueue(encoder.encode(primingEvent));
|
|
44181
|
+
this._resumableStreams.add(streamId);
|
|
43710
44182
|
}
|
|
43711
44183
|
async handleGetRequest(req) {
|
|
43712
44184
|
const acceptHeader = req.headers.get("accept");
|
|
43713
44185
|
if (!acceptHeader?.includes("text/event-stream")) {
|
|
44186
|
+
this.onerror?.(new Error("Not Acceptable: Client must accept text/event-stream"));
|
|
43714
44187
|
return this.createJsonErrorResponse(406, -32000, "Not Acceptable: Client must accept text/event-stream");
|
|
43715
44188
|
}
|
|
43716
44189
|
const sessionError = this.validateSession(req);
|
|
@@ -43728,22 +44201,30 @@ data:
|
|
|
43728
44201
|
}
|
|
43729
44202
|
}
|
|
43730
44203
|
if (this._streamMapping.get(this._standaloneSseStreamId) !== undefined) {
|
|
44204
|
+
this.onerror?.(new Error("Conflict: Only one SSE stream is allowed per session"));
|
|
43731
44205
|
return this.createJsonErrorResponse(409, -32000, "Conflict: Only one SSE stream is allowed per session");
|
|
43732
44206
|
}
|
|
43733
44207
|
const encoder = new TextEncoder;
|
|
43734
44208
|
let streamController;
|
|
44209
|
+
let keepAliveTimer = undefined;
|
|
43735
44210
|
const readable = new ReadableStream({
|
|
43736
44211
|
start: (controller) => {
|
|
43737
44212
|
streamController = controller;
|
|
43738
44213
|
},
|
|
43739
44214
|
cancel: () => {
|
|
43740
|
-
|
|
44215
|
+
if (keepAliveTimer !== undefined) {
|
|
44216
|
+
clearInterval(keepAliveTimer);
|
|
44217
|
+
}
|
|
44218
|
+
if (this._streamMapping.get(this._standaloneSseStreamId)?.controller === streamController) {
|
|
44219
|
+
this._streamMapping.delete(this._standaloneSseStreamId);
|
|
44220
|
+
}
|
|
43741
44221
|
}
|
|
43742
44222
|
});
|
|
43743
44223
|
const headers = {
|
|
43744
44224
|
"Content-Type": "text/event-stream",
|
|
43745
44225
|
"Cache-Control": "no-cache, no-transform",
|
|
43746
|
-
Connection: "keep-alive"
|
|
44226
|
+
Connection: "keep-alive",
|
|
44227
|
+
"X-Accel-Buffering": "no"
|
|
43747
44228
|
};
|
|
43748
44229
|
if (this.sessionId !== undefined) {
|
|
43749
44230
|
headers["mcp-session-id"] = this.sessionId;
|
|
@@ -43752,16 +44233,21 @@ data:
|
|
|
43752
44233
|
controller: streamController,
|
|
43753
44234
|
encoder,
|
|
43754
44235
|
cleanup: () => {
|
|
44236
|
+
if (keepAliveTimer !== undefined) {
|
|
44237
|
+
clearInterval(keepAliveTimer);
|
|
44238
|
+
}
|
|
43755
44239
|
this._streamMapping.delete(this._standaloneSseStreamId);
|
|
43756
44240
|
try {
|
|
43757
44241
|
streamController.close();
|
|
43758
44242
|
} catch {}
|
|
43759
44243
|
}
|
|
43760
44244
|
});
|
|
44245
|
+
keepAliveTimer = this.startKeepAlive(streamController, encoder);
|
|
43761
44246
|
return new Response(readable, { headers });
|
|
43762
44247
|
}
|
|
43763
44248
|
async replayEvents(lastEventId) {
|
|
43764
44249
|
if (!this._eventStore) {
|
|
44250
|
+
this.onerror?.(new Error("Event store not configured"));
|
|
43765
44251
|
return this.createJsonErrorResponse(400, -32000, "Event store not configured");
|
|
43766
44252
|
}
|
|
43767
44253
|
try {
|
|
@@ -43769,29 +44255,44 @@ data:
|
|
|
43769
44255
|
if (this._eventStore.getStreamIdForEventId) {
|
|
43770
44256
|
streamId = await this._eventStore.getStreamIdForEventId(lastEventId);
|
|
43771
44257
|
if (!streamId) {
|
|
44258
|
+
this.onerror?.(new Error("Invalid event ID format"));
|
|
43772
44259
|
return this.createJsonErrorResponse(400, -32000, "Invalid event ID format");
|
|
43773
44260
|
}
|
|
43774
44261
|
if (this._streamMapping.get(streamId) !== undefined) {
|
|
44262
|
+
this.onerror?.(new Error("Conflict: Stream already has an active connection"));
|
|
43775
44263
|
return this.createJsonErrorResponse(409, -32000, "Conflict: Stream already has an active connection");
|
|
43776
44264
|
}
|
|
43777
44265
|
}
|
|
43778
44266
|
const headers = {
|
|
43779
44267
|
"Content-Type": "text/event-stream",
|
|
43780
44268
|
"Cache-Control": "no-cache, no-transform",
|
|
43781
|
-
Connection: "keep-alive"
|
|
44269
|
+
Connection: "keep-alive",
|
|
44270
|
+
"X-Accel-Buffering": "no"
|
|
43782
44271
|
};
|
|
43783
44272
|
if (this.sessionId !== undefined) {
|
|
43784
44273
|
headers["mcp-session-id"] = this.sessionId;
|
|
43785
44274
|
}
|
|
43786
44275
|
const encoder = new TextEncoder;
|
|
43787
44276
|
let streamController;
|
|
44277
|
+
let keepAliveTimer = undefined;
|
|
44278
|
+
let replayedStreamId = undefined;
|
|
44279
|
+
let cancelled = false;
|
|
43788
44280
|
const readable = new ReadableStream({
|
|
43789
44281
|
start: (controller) => {
|
|
43790
44282
|
streamController = controller;
|
|
43791
44283
|
},
|
|
43792
|
-
cancel: () => {
|
|
44284
|
+
cancel: () => {
|
|
44285
|
+
cancelled = true;
|
|
44286
|
+
if (keepAliveTimer !== undefined) {
|
|
44287
|
+
clearInterval(keepAliveTimer);
|
|
44288
|
+
}
|
|
44289
|
+
if (replayedStreamId !== undefined && this._streamMapping.get(replayedStreamId)?.controller === streamController) {
|
|
44290
|
+
this._streamMapping.delete(replayedStreamId);
|
|
44291
|
+
}
|
|
44292
|
+
}
|
|
43793
44293
|
});
|
|
43794
|
-
const
|
|
44294
|
+
const replayedEventIds = new Set;
|
|
44295
|
+
replayedStreamId = await this._eventStore.replayEventsAfter(lastEventId, {
|
|
43795
44296
|
send: async (eventId, message) => {
|
|
43796
44297
|
const success = this.writeSSEEvent(streamController, encoder, message, eventId);
|
|
43797
44298
|
if (!success) {
|
|
@@ -43799,19 +44300,34 @@ data:
|
|
|
43799
44300
|
try {
|
|
43800
44301
|
streamController.close();
|
|
43801
44302
|
} catch {}
|
|
44303
|
+
} else {
|
|
44304
|
+
replayedEventIds.add(eventId);
|
|
43802
44305
|
}
|
|
43803
44306
|
}
|
|
43804
44307
|
});
|
|
44308
|
+
if (this._closed || cancelled) {
|
|
44309
|
+
try {
|
|
44310
|
+
streamController.close();
|
|
44311
|
+
} catch {}
|
|
44312
|
+
return this.createJsonErrorResponse(404, -32001, "Session not found");
|
|
44313
|
+
}
|
|
44314
|
+
this._streamMapping.get(replayedStreamId)?.cleanup();
|
|
43805
44315
|
this._streamMapping.set(replayedStreamId, {
|
|
43806
44316
|
controller: streamController,
|
|
43807
44317
|
encoder,
|
|
44318
|
+
replayedEventIds,
|
|
43808
44319
|
cleanup: () => {
|
|
44320
|
+
if (keepAliveTimer !== undefined) {
|
|
44321
|
+
clearInterval(keepAliveTimer);
|
|
44322
|
+
}
|
|
43809
44323
|
this._streamMapping.delete(replayedStreamId);
|
|
43810
44324
|
try {
|
|
43811
44325
|
streamController.close();
|
|
43812
44326
|
} catch {}
|
|
43813
44327
|
}
|
|
43814
44328
|
});
|
|
44329
|
+
this._resumableStreams.add(replayedStreamId);
|
|
44330
|
+
keepAliveTimer = this.startKeepAlive(streamController, encoder);
|
|
43815
44331
|
return new Response(readable, { headers });
|
|
43816
44332
|
} catch (error3) {
|
|
43817
44333
|
this.onerror?.(error3);
|
|
@@ -43831,11 +44347,13 @@ data:
|
|
|
43831
44347
|
`;
|
|
43832
44348
|
controller.enqueue(encoder.encode(eventData));
|
|
43833
44349
|
return true;
|
|
43834
|
-
} catch {
|
|
44350
|
+
} catch (error3) {
|
|
44351
|
+
this.onerror?.(error3);
|
|
43835
44352
|
return false;
|
|
43836
44353
|
}
|
|
43837
44354
|
}
|
|
43838
44355
|
handleUnsupportedRequest() {
|
|
44356
|
+
this.onerror?.(new Error("Method not allowed."));
|
|
43839
44357
|
return new Response(JSON.stringify({
|
|
43840
44358
|
jsonrpc: "2.0",
|
|
43841
44359
|
error: {
|
|
@@ -43855,14 +44373,17 @@ data:
|
|
|
43855
44373
|
try {
|
|
43856
44374
|
const acceptHeader = req.headers.get("accept");
|
|
43857
44375
|
if (!acceptHeader?.includes("application/json") || !acceptHeader.includes("text/event-stream")) {
|
|
44376
|
+
this.onerror?.(new Error("Not Acceptable: Client must accept both application/json and text/event-stream"));
|
|
43858
44377
|
return this.createJsonErrorResponse(406, -32000, "Not Acceptable: Client must accept both application/json and text/event-stream");
|
|
43859
44378
|
}
|
|
43860
44379
|
const ct = req.headers.get("content-type");
|
|
43861
|
-
if (!ct
|
|
44380
|
+
if (!isJsonContentType(ct)) {
|
|
44381
|
+
this.onerror?.(new Error("Unsupported Media Type: Content-Type must be application/json"));
|
|
43862
44382
|
return this.createJsonErrorResponse(415, -32000, "Unsupported Media Type: Content-Type must be application/json");
|
|
43863
44383
|
}
|
|
43864
44384
|
const requestInfo = {
|
|
43865
|
-
headers: Object.fromEntries(req.headers.entries())
|
|
44385
|
+
headers: Object.fromEntries(req.headers.entries()),
|
|
44386
|
+
url: new URL(req.url)
|
|
43866
44387
|
};
|
|
43867
44388
|
let rawMessage;
|
|
43868
44389
|
if (options?.parsedBody !== undefined) {
|
|
@@ -43871,6 +44392,7 @@ data:
|
|
|
43871
44392
|
try {
|
|
43872
44393
|
rawMessage = await req.json();
|
|
43873
44394
|
} catch {
|
|
44395
|
+
this.onerror?.(new Error("Parse error: Invalid JSON"));
|
|
43874
44396
|
return this.createJsonErrorResponse(400, -32700, "Parse error: Invalid JSON");
|
|
43875
44397
|
}
|
|
43876
44398
|
}
|
|
@@ -43882,14 +44404,20 @@ data:
|
|
|
43882
44404
|
messages = [JSONRPCMessageSchema.parse(rawMessage)];
|
|
43883
44405
|
}
|
|
43884
44406
|
} catch {
|
|
44407
|
+
this.onerror?.(new Error("Parse error: Invalid JSON-RPC message"));
|
|
43885
44408
|
return this.createJsonErrorResponse(400, -32700, "Parse error: Invalid JSON-RPC message");
|
|
43886
44409
|
}
|
|
44410
|
+
if (this._closed) {
|
|
44411
|
+
return this.createJsonErrorResponse(404, -32001, "Session not found");
|
|
44412
|
+
}
|
|
43887
44413
|
const isInitializationRequest = messages.some(isInitializeRequest);
|
|
43888
44414
|
if (isInitializationRequest) {
|
|
43889
44415
|
if (this._initialized && this.sessionId !== undefined) {
|
|
44416
|
+
this.onerror?.(new Error("Invalid Request: Server already initialized"));
|
|
43890
44417
|
return this.createJsonErrorResponse(400, -32600, "Invalid Request: Server already initialized");
|
|
43891
44418
|
}
|
|
43892
44419
|
if (messages.length > 1) {
|
|
44420
|
+
this.onerror?.(new Error("Invalid Request: Only one initialization request is allowed"));
|
|
43893
44421
|
return this.createJsonErrorResponse(400, -32600, "Invalid Request: Only one initialization request is allowed");
|
|
43894
44422
|
}
|
|
43895
44423
|
this.sessionId = this.sessionIdGenerator?.();
|
|
@@ -43908,6 +44436,9 @@ data:
|
|
|
43908
44436
|
return protocolError;
|
|
43909
44437
|
}
|
|
43910
44438
|
}
|
|
44439
|
+
if (this._closed) {
|
|
44440
|
+
return this.createJsonErrorResponse(404, -32001, "Session not found");
|
|
44441
|
+
}
|
|
43911
44442
|
const hasRequests = messages.some(isJSONRPCRequest);
|
|
43912
44443
|
if (!hasRequests) {
|
|
43913
44444
|
for (const message of messages) {
|
|
@@ -43938,18 +44469,25 @@ data:
|
|
|
43938
44469
|
}
|
|
43939
44470
|
const encoder = new TextEncoder;
|
|
43940
44471
|
let streamController;
|
|
44472
|
+
let keepAliveTimer = undefined;
|
|
43941
44473
|
const readable = new ReadableStream({
|
|
43942
44474
|
start: (controller) => {
|
|
43943
44475
|
streamController = controller;
|
|
43944
44476
|
},
|
|
43945
44477
|
cancel: () => {
|
|
43946
|
-
|
|
44478
|
+
if (keepAliveTimer !== undefined) {
|
|
44479
|
+
clearInterval(keepAliveTimer);
|
|
44480
|
+
}
|
|
44481
|
+
if (this._streamMapping.get(streamId)?.controller === streamController) {
|
|
44482
|
+
this._streamMapping.delete(streamId);
|
|
44483
|
+
}
|
|
43947
44484
|
}
|
|
43948
44485
|
});
|
|
43949
44486
|
const headers = {
|
|
43950
44487
|
"Content-Type": "text/event-stream",
|
|
43951
|
-
"Cache-Control": "no-cache",
|
|
43952
|
-
Connection: "keep-alive"
|
|
44488
|
+
"Cache-Control": "no-cache, no-transform",
|
|
44489
|
+
Connection: "keep-alive",
|
|
44490
|
+
"X-Accel-Buffering": "no"
|
|
43953
44491
|
};
|
|
43954
44492
|
if (this.sessionId !== undefined) {
|
|
43955
44493
|
headers["mcp-session-id"] = this.sessionId;
|
|
@@ -43960,6 +44498,9 @@ data:
|
|
|
43960
44498
|
controller: streamController,
|
|
43961
44499
|
encoder,
|
|
43962
44500
|
cleanup: () => {
|
|
44501
|
+
if (keepAliveTimer !== undefined) {
|
|
44502
|
+
clearInterval(keepAliveTimer);
|
|
44503
|
+
}
|
|
43963
44504
|
this._streamMapping.delete(streamId);
|
|
43964
44505
|
try {
|
|
43965
44506
|
streamController.close();
|
|
@@ -43969,19 +44510,33 @@ data:
|
|
|
43969
44510
|
this._requestToStreamMapping.set(message.id, streamId);
|
|
43970
44511
|
}
|
|
43971
44512
|
}
|
|
43972
|
-
|
|
43973
|
-
|
|
43974
|
-
|
|
43975
|
-
|
|
43976
|
-
|
|
43977
|
-
|
|
43978
|
-
|
|
43979
|
-
|
|
43980
|
-
|
|
43981
|
-
|
|
43982
|
-
|
|
44513
|
+
try {
|
|
44514
|
+
await this.writePrimingEvent(streamController, encoder, streamId, clientProtocolVersion);
|
|
44515
|
+
for (const message of messages) {
|
|
44516
|
+
let closeSSEStream;
|
|
44517
|
+
let closeStandaloneSSEStream;
|
|
44518
|
+
if (isJSONRPCRequest(message) && this._eventStore && clientProtocolVersion >= "2025-11-25") {
|
|
44519
|
+
closeSSEStream = () => {
|
|
44520
|
+
this.closeSSEStream(message.id);
|
|
44521
|
+
};
|
|
44522
|
+
closeStandaloneSSEStream = () => {
|
|
44523
|
+
this.closeStandaloneSSEStream();
|
|
44524
|
+
};
|
|
44525
|
+
}
|
|
44526
|
+
this.onmessage?.(message, { authInfo: options?.authInfo, requestInfo, closeSSEStream, closeStandaloneSSEStream });
|
|
44527
|
+
}
|
|
44528
|
+
} catch (error3) {
|
|
44529
|
+
this._streamMapping.get(streamId)?.cleanup();
|
|
44530
|
+
this._resumableStreams.delete(streamId);
|
|
44531
|
+
for (const message of messages) {
|
|
44532
|
+
if (isJSONRPCRequest(message)) {
|
|
44533
|
+
this._requestToStreamMapping.delete(message.id);
|
|
44534
|
+
}
|
|
43983
44535
|
}
|
|
43984
|
-
|
|
44536
|
+
throw error3;
|
|
44537
|
+
}
|
|
44538
|
+
if (this._streamMapping.get(streamId)?.controller === streamController) {
|
|
44539
|
+
keepAliveTimer = this.startKeepAlive(streamController, encoder);
|
|
43985
44540
|
}
|
|
43986
44541
|
return new Response(readable, { status: 200, headers });
|
|
43987
44542
|
} catch (error3) {
|
|
@@ -43998,22 +44553,28 @@ data:
|
|
|
43998
44553
|
if (protocolError) {
|
|
43999
44554
|
return protocolError;
|
|
44000
44555
|
}
|
|
44001
|
-
|
|
44002
|
-
|
|
44003
|
-
|
|
44556
|
+
try {
|
|
44557
|
+
await Promise.resolve(this._onsessionclosed?.(this.sessionId));
|
|
44558
|
+
return new Response(null, { status: 200 });
|
|
44559
|
+
} finally {
|
|
44560
|
+
await this.close();
|
|
44561
|
+
}
|
|
44004
44562
|
}
|
|
44005
44563
|
validateSession(req) {
|
|
44006
44564
|
if (this.sessionIdGenerator === undefined) {
|
|
44007
44565
|
return;
|
|
44008
44566
|
}
|
|
44009
44567
|
if (!this._initialized) {
|
|
44568
|
+
this.onerror?.(new Error("Bad Request: Server not initialized"));
|
|
44010
44569
|
return this.createJsonErrorResponse(400, -32000, "Bad Request: Server not initialized");
|
|
44011
44570
|
}
|
|
44012
44571
|
const sessionId = req.headers.get("mcp-session-id");
|
|
44013
44572
|
if (!sessionId) {
|
|
44573
|
+
this.onerror?.(new Error("Bad Request: Mcp-Session-Id header is required"));
|
|
44014
44574
|
return this.createJsonErrorResponse(400, -32000, "Bad Request: Mcp-Session-Id header is required");
|
|
44015
44575
|
}
|
|
44016
44576
|
if (sessionId !== this.sessionId) {
|
|
44577
|
+
this.onerror?.(new Error("Session not found"));
|
|
44017
44578
|
return this.createJsonErrorResponse(404, -32001, "Session not found");
|
|
44018
44579
|
}
|
|
44019
44580
|
return;
|
|
@@ -44021,16 +44582,22 @@ data:
|
|
|
44021
44582
|
validateProtocolVersion(req) {
|
|
44022
44583
|
const protocolVersion = req.headers.get("mcp-protocol-version");
|
|
44023
44584
|
if (protocolVersion !== null && !SUPPORTED_PROTOCOL_VERSIONS.includes(protocolVersion)) {
|
|
44585
|
+
this.onerror?.(new Error(`Bad Request: Unsupported protocol version: ${protocolVersion}` + ` (supported versions: ${SUPPORTED_PROTOCOL_VERSIONS.join(", ")})`));
|
|
44024
44586
|
return this.createJsonErrorResponse(400, -32000, `Bad Request: Unsupported protocol version: ${protocolVersion} (supported versions: ${SUPPORTED_PROTOCOL_VERSIONS.join(", ")})`);
|
|
44025
44587
|
}
|
|
44026
44588
|
return;
|
|
44027
44589
|
}
|
|
44028
44590
|
async close() {
|
|
44591
|
+
if (this._closed) {
|
|
44592
|
+
return;
|
|
44593
|
+
}
|
|
44594
|
+
this._closed = true;
|
|
44029
44595
|
this._streamMapping.forEach(({ cleanup }) => {
|
|
44030
44596
|
cleanup();
|
|
44031
44597
|
});
|
|
44032
44598
|
this._streamMapping.clear();
|
|
44033
44599
|
this._requestResponseMap.clear();
|
|
44600
|
+
this._resumableStreams.clear();
|
|
44034
44601
|
this.onclose?.();
|
|
44035
44602
|
}
|
|
44036
44603
|
closeSSEStream(requestId) {
|
|
@@ -44065,7 +44632,7 @@ data:
|
|
|
44065
44632
|
if (standaloneSse === undefined) {
|
|
44066
44633
|
return;
|
|
44067
44634
|
}
|
|
44068
|
-
if (standaloneSse.controller && standaloneSse.encoder) {
|
|
44635
|
+
if (standaloneSse.controller && standaloneSse.encoder && (eventId === undefined || !standaloneSse.replayedEventIds?.has(eventId))) {
|
|
44069
44636
|
this.writeSSEEvent(standaloneSse.controller, standaloneSse.encoder, message, eventId);
|
|
44070
44637
|
}
|
|
44071
44638
|
return;
|
|
@@ -44074,13 +44641,19 @@ data:
|
|
|
44074
44641
|
if (!streamId) {
|
|
44075
44642
|
throw new Error(`No connection established for request ID: ${String(requestId)}`);
|
|
44076
44643
|
}
|
|
44077
|
-
|
|
44078
|
-
if (!this._enableJsonResponse
|
|
44644
|
+
let stream = this._streamMapping.get(streamId);
|
|
44645
|
+
if (!this._enableJsonResponse) {
|
|
44079
44646
|
let eventId;
|
|
44080
44647
|
if (this._eventStore) {
|
|
44081
44648
|
eventId = await this._eventStore.storeEvent(streamId, message);
|
|
44649
|
+
stream = this._streamMapping.get(streamId);
|
|
44650
|
+
}
|
|
44651
|
+
if (stream?.controller && stream?.encoder && (eventId === undefined || !stream.replayedEventIds?.has(eventId))) {
|
|
44652
|
+
const written = this.writeSSEEvent(stream.controller, stream.encoder, message, eventId);
|
|
44653
|
+
if (written && eventId !== undefined) {
|
|
44654
|
+
this._resumableStreams.add(streamId);
|
|
44655
|
+
}
|
|
44082
44656
|
}
|
|
44083
|
-
this.writeSSEEvent(stream.controller, stream.encoder, message, eventId);
|
|
44084
44657
|
}
|
|
44085
44658
|
if (isJSONRPCResultResponse(message) || isJSONRPCErrorResponse(message)) {
|
|
44086
44659
|
this._requestResponseMap.set(requestId, message);
|
|
@@ -44088,6 +44661,25 @@ data:
|
|
|
44088
44661
|
const allResponsesReady = relatedIds.every((id) => this._requestResponseMap.has(id));
|
|
44089
44662
|
if (allResponsesReady) {
|
|
44090
44663
|
if (!stream) {
|
|
44664
|
+
if (this._closed) {
|
|
44665
|
+
for (const id of relatedIds) {
|
|
44666
|
+
this._requestResponseMap.delete(id);
|
|
44667
|
+
this._requestToStreamMapping.delete(id);
|
|
44668
|
+
}
|
|
44669
|
+
return;
|
|
44670
|
+
}
|
|
44671
|
+
if (!this._enableJsonResponse && this._eventStore && this._resumableStreams.has(streamId)) {
|
|
44672
|
+
for (const id of relatedIds) {
|
|
44673
|
+
this._requestResponseMap.delete(id);
|
|
44674
|
+
this._requestToStreamMapping.delete(id);
|
|
44675
|
+
}
|
|
44676
|
+
this._resumableStreams.delete(streamId);
|
|
44677
|
+
return;
|
|
44678
|
+
}
|
|
44679
|
+
for (const id of relatedIds) {
|
|
44680
|
+
this._requestResponseMap.delete(id);
|
|
44681
|
+
this._requestToStreamMapping.delete(id);
|
|
44682
|
+
}
|
|
44091
44683
|
throw new Error(`No connection established for request ID: ${String(requestId)}`);
|
|
44092
44684
|
}
|
|
44093
44685
|
if (this._enableJsonResponse && stream.resolveJson) {
|
|
@@ -44110,11 +44702,14 @@ data:
|
|
|
44110
44702
|
this._requestResponseMap.delete(id);
|
|
44111
44703
|
this._requestToStreamMapping.delete(id);
|
|
44112
44704
|
}
|
|
44705
|
+
this._resumableStreams.delete(streamId);
|
|
44113
44706
|
}
|
|
44114
44707
|
}
|
|
44115
44708
|
}
|
|
44116
44709
|
}
|
|
44117
44710
|
var init_webStandardStreamableHttp = __esm(() => {
|
|
44711
|
+
init_mediaType();
|
|
44712
|
+
init_sseKeepAlive();
|
|
44118
44713
|
init_types7();
|
|
44119
44714
|
});
|
|
44120
44715
|
|
|
@@ -44208,7 +44803,7 @@ var init_v4_mini = __esm(() => {
|
|
|
44208
44803
|
init_mini();
|
|
44209
44804
|
});
|
|
44210
44805
|
|
|
44211
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
44806
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
|
|
44212
44807
|
function isZ4Schema(s) {
|
|
44213
44808
|
const schema2 = s;
|
|
44214
44809
|
return !!schema2._zod;
|
|
@@ -44292,17 +44887,34 @@ function normalizeObjectSchema(schema2) {
|
|
|
44292
44887
|
}
|
|
44293
44888
|
return;
|
|
44294
44889
|
}
|
|
44890
|
+
function getDotPath(path) {
|
|
44891
|
+
if (path.length === 0) {
|
|
44892
|
+
return "object root";
|
|
44893
|
+
}
|
|
44894
|
+
return path.reduce((acc, seg, index) => {
|
|
44895
|
+
if (index === 0) {
|
|
44896
|
+
return String(seg);
|
|
44897
|
+
}
|
|
44898
|
+
if (typeof seg === "number") {
|
|
44899
|
+
return `${acc}[${seg}]`;
|
|
44900
|
+
}
|
|
44901
|
+
return `${acc}.${seg}`;
|
|
44902
|
+
}, "");
|
|
44903
|
+
}
|
|
44295
44904
|
function getParseErrorMessage(error3) {
|
|
44296
44905
|
if (error3 && typeof error3 === "object") {
|
|
44906
|
+
if ("issues" in error3 && Array.isArray(error3.issues) && error3.issues.length > 0) {
|
|
44907
|
+
return error3.issues.map((i) => {
|
|
44908
|
+
if (!i.path?.length) {
|
|
44909
|
+
return i.message;
|
|
44910
|
+
}
|
|
44911
|
+
return `${i.message} at ${getDotPath(i.path)}`;
|
|
44912
|
+
}).join(`
|
|
44913
|
+
`);
|
|
44914
|
+
}
|
|
44297
44915
|
if ("message" in error3 && typeof error3.message === "string") {
|
|
44298
44916
|
return error3.message;
|
|
44299
44917
|
}
|
|
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
44918
|
try {
|
|
44307
44919
|
return JSON.stringify(error3);
|
|
44308
44920
|
} catch {
|
|
@@ -44356,12 +44968,12 @@ var init_zod_compat = __esm(() => {
|
|
|
44356
44968
|
init_v4_mini();
|
|
44357
44969
|
});
|
|
44358
44970
|
|
|
44359
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
44971
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
|
|
44360
44972
|
function isTerminal(status3) {
|
|
44361
44973
|
return status3 === "completed" || status3 === "failed" || status3 === "cancelled";
|
|
44362
44974
|
}
|
|
44363
44975
|
|
|
44364
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
44976
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/Options.js
|
|
44365
44977
|
var ignoreOverride, defaultOptions, getDefaultOptions = (options) => typeof options === "string" ? {
|
|
44366
44978
|
...defaultOptions,
|
|
44367
44979
|
name: options
|
|
@@ -44397,7 +45009,7 @@ var init_Options = __esm(() => {
|
|
|
44397
45009
|
};
|
|
44398
45010
|
});
|
|
44399
45011
|
|
|
44400
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45012
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/Refs.js
|
|
44401
45013
|
var getRefs = (options) => {
|
|
44402
45014
|
const _options = getDefaultOptions(options);
|
|
44403
45015
|
const currentPath = _options.name !== undefined ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
|
|
@@ -44420,7 +45032,7 @@ var init_Refs = __esm(() => {
|
|
|
44420
45032
|
init_Options();
|
|
44421
45033
|
});
|
|
44422
45034
|
|
|
44423
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45035
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
|
|
44424
45036
|
function addErrorMessage(res, key2, errorMessage, refs) {
|
|
44425
45037
|
if (!refs?.errorMessages)
|
|
44426
45038
|
return;
|
|
@@ -44436,7 +45048,7 @@ function setResponseValueAndErrors(res, key2, value, errorMessage, refs) {
|
|
|
44436
45048
|
addErrorMessage(res, key2, errorMessage, refs);
|
|
44437
45049
|
}
|
|
44438
45050
|
|
|
44439
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45051
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
|
|
44440
45052
|
var getRelativePath = (pathA, pathB) => {
|
|
44441
45053
|
let i = 0;
|
|
44442
45054
|
for (;i < pathA.length && i < pathB.length; i++) {
|
|
@@ -44446,7 +45058,7 @@ var getRelativePath = (pathA, pathB) => {
|
|
|
44446
45058
|
return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
|
|
44447
45059
|
};
|
|
44448
45060
|
|
|
44449
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45061
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/any.js
|
|
44450
45062
|
function parseAnyDef(refs) {
|
|
44451
45063
|
if (refs.target !== "openAi") {
|
|
44452
45064
|
return {};
|
|
@@ -44463,7 +45075,7 @@ function parseAnyDef(refs) {
|
|
|
44463
45075
|
}
|
|
44464
45076
|
var init_any = () => {};
|
|
44465
45077
|
|
|
44466
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45078
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/array.js
|
|
44467
45079
|
function parseArrayDef(def, refs) {
|
|
44468
45080
|
const res = {
|
|
44469
45081
|
type: "array"
|
|
@@ -44491,7 +45103,7 @@ var init_array = __esm(() => {
|
|
|
44491
45103
|
init_parseDef();
|
|
44492
45104
|
});
|
|
44493
45105
|
|
|
44494
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45106
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
|
|
44495
45107
|
function parseBigintDef(def, refs) {
|
|
44496
45108
|
const res = {
|
|
44497
45109
|
type: "integer",
|
|
@@ -44538,14 +45150,14 @@ function parseBigintDef(def, refs) {
|
|
|
44538
45150
|
}
|
|
44539
45151
|
var init_bigint = () => {};
|
|
44540
45152
|
|
|
44541
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45153
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
|
|
44542
45154
|
function parseBooleanDef() {
|
|
44543
45155
|
return {
|
|
44544
45156
|
type: "boolean"
|
|
44545
45157
|
};
|
|
44546
45158
|
}
|
|
44547
45159
|
|
|
44548
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45160
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
|
|
44549
45161
|
function parseBrandedDef(_def, refs) {
|
|
44550
45162
|
return parseDef(_def.type._def, refs);
|
|
44551
45163
|
}
|
|
@@ -44553,7 +45165,7 @@ var init_branded = __esm(() => {
|
|
|
44553
45165
|
init_parseDef();
|
|
44554
45166
|
});
|
|
44555
45167
|
|
|
44556
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45168
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
|
|
44557
45169
|
var parseCatchDef = (def, refs) => {
|
|
44558
45170
|
return parseDef(def.innerType._def, refs);
|
|
44559
45171
|
};
|
|
@@ -44561,7 +45173,7 @@ var init_catch = __esm(() => {
|
|
|
44561
45173
|
init_parseDef();
|
|
44562
45174
|
});
|
|
44563
45175
|
|
|
44564
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45176
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/date.js
|
|
44565
45177
|
function parseDateDef(def, refs, overrideDateStrategy) {
|
|
44566
45178
|
const strategy = overrideDateStrategy ?? refs.dateStrategy;
|
|
44567
45179
|
if (Array.isArray(strategy)) {
|
|
@@ -44607,7 +45219,7 @@ var integerDateParser = (def, refs) => {
|
|
|
44607
45219
|
};
|
|
44608
45220
|
var init_date = () => {};
|
|
44609
45221
|
|
|
44610
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45222
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/default.js
|
|
44611
45223
|
function parseDefaultDef(_def, refs) {
|
|
44612
45224
|
return {
|
|
44613
45225
|
...parseDef(_def.innerType._def, refs),
|
|
@@ -44618,7 +45230,7 @@ var init_default = __esm(() => {
|
|
|
44618
45230
|
init_parseDef();
|
|
44619
45231
|
});
|
|
44620
45232
|
|
|
44621
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45233
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
|
|
44622
45234
|
function parseEffectsDef(_def, refs) {
|
|
44623
45235
|
return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) : parseAnyDef(refs);
|
|
44624
45236
|
}
|
|
@@ -44627,7 +45239,7 @@ var init_effects = __esm(() => {
|
|
|
44627
45239
|
init_any();
|
|
44628
45240
|
});
|
|
44629
45241
|
|
|
44630
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45242
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
|
|
44631
45243
|
function parseEnumDef(def) {
|
|
44632
45244
|
return {
|
|
44633
45245
|
type: "string",
|
|
@@ -44635,7 +45247,7 @@ function parseEnumDef(def) {
|
|
|
44635
45247
|
};
|
|
44636
45248
|
}
|
|
44637
45249
|
|
|
44638
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45250
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
|
|
44639
45251
|
function parseIntersectionDef(def, refs) {
|
|
44640
45252
|
const allOf = [
|
|
44641
45253
|
parseDef(def.left._def, {
|
|
@@ -44680,7 +45292,7 @@ var init_intersection = __esm(() => {
|
|
|
44680
45292
|
init_parseDef();
|
|
44681
45293
|
});
|
|
44682
45294
|
|
|
44683
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45295
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
|
|
44684
45296
|
function parseLiteralDef(def, refs) {
|
|
44685
45297
|
const parsedType2 = typeof def.value;
|
|
44686
45298
|
if (parsedType2 !== "bigint" && parsedType2 !== "number" && parsedType2 !== "boolean" && parsedType2 !== "string") {
|
|
@@ -44700,7 +45312,7 @@ function parseLiteralDef(def, refs) {
|
|
|
44700
45312
|
};
|
|
44701
45313
|
}
|
|
44702
45314
|
|
|
44703
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45315
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
|
|
44704
45316
|
function parseStringDef(def, refs) {
|
|
44705
45317
|
const res = {
|
|
44706
45318
|
type: "string"
|
|
@@ -44999,7 +45611,7 @@ var init_string = __esm(() => {
|
|
|
44999
45611
|
ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
45000
45612
|
});
|
|
45001
45613
|
|
|
45002
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45614
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
|
|
45003
45615
|
function parseRecordDef(def, refs) {
|
|
45004
45616
|
if (refs.target === "openAi") {
|
|
45005
45617
|
console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
|
|
@@ -45058,7 +45670,7 @@ var init_record = __esm(() => {
|
|
|
45058
45670
|
init_any();
|
|
45059
45671
|
});
|
|
45060
45672
|
|
|
45061
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45673
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/map.js
|
|
45062
45674
|
function parseMapDef(def, refs) {
|
|
45063
45675
|
if (refs.mapStrategy === "record") {
|
|
45064
45676
|
return parseRecordDef(def, refs);
|
|
@@ -45088,7 +45700,7 @@ var init_map = __esm(() => {
|
|
|
45088
45700
|
init_any();
|
|
45089
45701
|
});
|
|
45090
45702
|
|
|
45091
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45703
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
|
|
45092
45704
|
function parseNativeEnumDef(def) {
|
|
45093
45705
|
const object3 = def.values;
|
|
45094
45706
|
const actualKeys = Object.keys(def.values).filter((key2) => {
|
|
@@ -45102,7 +45714,7 @@ function parseNativeEnumDef(def) {
|
|
|
45102
45714
|
};
|
|
45103
45715
|
}
|
|
45104
45716
|
|
|
45105
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45717
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/never.js
|
|
45106
45718
|
function parseNeverDef(refs) {
|
|
45107
45719
|
return refs.target === "openAi" ? undefined : {
|
|
45108
45720
|
not: parseAnyDef({
|
|
@@ -45115,7 +45727,7 @@ var init_never = __esm(() => {
|
|
|
45115
45727
|
init_any();
|
|
45116
45728
|
});
|
|
45117
45729
|
|
|
45118
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45730
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/null.js
|
|
45119
45731
|
function parseNullDef(refs) {
|
|
45120
45732
|
return refs.target === "openApi3" ? {
|
|
45121
45733
|
enum: ["null"],
|
|
@@ -45125,7 +45737,7 @@ function parseNullDef(refs) {
|
|
|
45125
45737
|
};
|
|
45126
45738
|
}
|
|
45127
45739
|
|
|
45128
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45740
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/union.js
|
|
45129
45741
|
function parseUnionDef(def, refs) {
|
|
45130
45742
|
if (refs.target === "openApi3")
|
|
45131
45743
|
return asAnyOf(def, refs);
|
|
@@ -45196,7 +45808,7 @@ var init_union = __esm(() => {
|
|
|
45196
45808
|
};
|
|
45197
45809
|
});
|
|
45198
45810
|
|
|
45199
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45811
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
|
|
45200
45812
|
function parseNullableDef(def, refs) {
|
|
45201
45813
|
if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
|
|
45202
45814
|
if (refs.target === "openApi3") {
|
|
@@ -45232,7 +45844,7 @@ var init_nullable = __esm(() => {
|
|
|
45232
45844
|
init_union();
|
|
45233
45845
|
});
|
|
45234
45846
|
|
|
45235
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45847
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/number.js
|
|
45236
45848
|
function parseNumberDef(def, refs) {
|
|
45237
45849
|
const res = {
|
|
45238
45850
|
type: "number"
|
|
@@ -45282,7 +45894,7 @@ function parseNumberDef(def, refs) {
|
|
|
45282
45894
|
}
|
|
45283
45895
|
var init_number = () => {};
|
|
45284
45896
|
|
|
45285
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45897
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/object.js
|
|
45286
45898
|
function parseObjectDef(def, refs) {
|
|
45287
45899
|
const forceOptionalIntoNullable = refs.target === "openAi";
|
|
45288
45900
|
const result = {
|
|
@@ -45355,7 +45967,7 @@ var init_object = __esm(() => {
|
|
|
45355
45967
|
init_parseDef();
|
|
45356
45968
|
});
|
|
45357
45969
|
|
|
45358
|
-
// 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/optional.js
|
|
45359
45971
|
var parseOptionalDef = (def, refs) => {
|
|
45360
45972
|
if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
|
|
45361
45973
|
return parseDef(def.innerType._def, refs);
|
|
@@ -45378,7 +45990,7 @@ var init_optional = __esm(() => {
|
|
|
45378
45990
|
init_any();
|
|
45379
45991
|
});
|
|
45380
45992
|
|
|
45381
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
45993
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
|
|
45382
45994
|
var parsePipelineDef = (def, refs) => {
|
|
45383
45995
|
if (refs.pipeStrategy === "input") {
|
|
45384
45996
|
return parseDef(def.in._def, refs);
|
|
@@ -45401,7 +46013,7 @@ var init_pipeline = __esm(() => {
|
|
|
45401
46013
|
init_parseDef();
|
|
45402
46014
|
});
|
|
45403
46015
|
|
|
45404
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
46016
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
|
|
45405
46017
|
function parsePromiseDef(def, refs) {
|
|
45406
46018
|
return parseDef(def.type._def, refs);
|
|
45407
46019
|
}
|
|
@@ -45409,7 +46021,7 @@ var init_promise = __esm(() => {
|
|
|
45409
46021
|
init_parseDef();
|
|
45410
46022
|
});
|
|
45411
46023
|
|
|
45412
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
46024
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/set.js
|
|
45413
46025
|
function parseSetDef(def, refs) {
|
|
45414
46026
|
const items = parseDef(def.valueType._def, {
|
|
45415
46027
|
...refs,
|
|
@@ -45432,7 +46044,7 @@ var init_set = __esm(() => {
|
|
|
45432
46044
|
init_parseDef();
|
|
45433
46045
|
});
|
|
45434
46046
|
|
|
45435
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
46047
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
|
|
45436
46048
|
function parseTupleDef(def, refs) {
|
|
45437
46049
|
if (def.rest) {
|
|
45438
46050
|
return {
|
|
@@ -45463,7 +46075,7 @@ var init_tuple = __esm(() => {
|
|
|
45463
46075
|
init_parseDef();
|
|
45464
46076
|
});
|
|
45465
46077
|
|
|
45466
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
46078
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
|
|
45467
46079
|
function parseUndefinedDef(refs) {
|
|
45468
46080
|
return {
|
|
45469
46081
|
not: parseAnyDef(refs)
|
|
@@ -45473,7 +46085,7 @@ var init_undefined = __esm(() => {
|
|
|
45473
46085
|
init_any();
|
|
45474
46086
|
});
|
|
45475
46087
|
|
|
45476
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
46088
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
|
|
45477
46089
|
function parseUnknownDef(refs) {
|
|
45478
46090
|
return parseAnyDef(refs);
|
|
45479
46091
|
}
|
|
@@ -45481,7 +46093,7 @@ var init_unknown = __esm(() => {
|
|
|
45481
46093
|
init_any();
|
|
45482
46094
|
});
|
|
45483
46095
|
|
|
45484
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
46096
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
|
|
45485
46097
|
var parseReadonlyDef = (def, refs) => {
|
|
45486
46098
|
return parseDef(def.innerType._def, refs);
|
|
45487
46099
|
};
|
|
@@ -45489,7 +46101,7 @@ var init_readonly = __esm(() => {
|
|
|
45489
46101
|
init_parseDef();
|
|
45490
46102
|
});
|
|
45491
46103
|
|
|
45492
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
46104
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/selectParser.js
|
|
45493
46105
|
var selectParser = (def, typeName, refs) => {
|
|
45494
46106
|
switch (typeName) {
|
|
45495
46107
|
case ZodFirstPartyTypeKind.ZodString:
|
|
@@ -45595,7 +46207,7 @@ var init_selectParser = __esm(() => {
|
|
|
45595
46207
|
init_readonly();
|
|
45596
46208
|
});
|
|
45597
46209
|
|
|
45598
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
46210
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parseDef.js
|
|
45599
46211
|
function parseDef(def, refs, forceResolution = false) {
|
|
45600
46212
|
const seenItem = refs.seen.get(def);
|
|
45601
46213
|
if (refs.override) {
|
|
@@ -45655,10 +46267,10 @@ var init_parseDef = __esm(() => {
|
|
|
45655
46267
|
init_any();
|
|
45656
46268
|
});
|
|
45657
46269
|
|
|
45658
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
46270
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/parseTypes.js
|
|
45659
46271
|
var init_parseTypes = () => {};
|
|
45660
46272
|
|
|
45661
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
46273
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
|
|
45662
46274
|
var zodToJsonSchema = (schema2, options) => {
|
|
45663
46275
|
const refs = getRefs(options);
|
|
45664
46276
|
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name2, schema3]) => ({
|
|
@@ -45724,7 +46336,7 @@ var init_zodToJsonSchema = __esm(() => {
|
|
|
45724
46336
|
init_any();
|
|
45725
46337
|
});
|
|
45726
46338
|
|
|
45727
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
46339
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/esm/index.js
|
|
45728
46340
|
var init_esm = __esm(() => {
|
|
45729
46341
|
init_zodToJsonSchema();
|
|
45730
46342
|
init_Options();
|
|
@@ -45760,7 +46372,7 @@ var init_esm = __esm(() => {
|
|
|
45760
46372
|
init_zodToJsonSchema();
|
|
45761
46373
|
});
|
|
45762
46374
|
|
|
45763
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
46375
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
|
|
45764
46376
|
function mapMiniTarget(t) {
|
|
45765
46377
|
if (!t)
|
|
45766
46378
|
return "draft-7";
|
|
@@ -45807,7 +46419,7 @@ var init_zod_json_schema_compat = __esm(() => {
|
|
|
45807
46419
|
init_esm();
|
|
45808
46420
|
});
|
|
45809
46421
|
|
|
45810
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
46422
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
|
|
45811
46423
|
class Protocol {
|
|
45812
46424
|
constructor(_options) {
|
|
45813
46425
|
this._options = _options;
|
|
@@ -46009,6 +46621,10 @@ class Protocol {
|
|
|
46009
46621
|
this._progressHandlers.clear();
|
|
46010
46622
|
this._taskProgressTokens.clear();
|
|
46011
46623
|
this._pendingDebouncedNotifications.clear();
|
|
46624
|
+
for (const info of this._timeoutInfo.values()) {
|
|
46625
|
+
clearTimeout(info.timeoutId);
|
|
46626
|
+
}
|
|
46627
|
+
this._timeoutInfo.clear();
|
|
46012
46628
|
for (const controller of this._requestHandlerAbortControllers.values()) {
|
|
46013
46629
|
controller.abort();
|
|
46014
46630
|
}
|
|
@@ -46139,7 +46755,9 @@ class Protocol {
|
|
|
46139
46755
|
await capturedTransport?.send(errorResponse);
|
|
46140
46756
|
}
|
|
46141
46757
|
}).catch((error3) => this._onerror(new Error(`Failed to send response: ${error3}`))).finally(() => {
|
|
46142
|
-
this._requestHandlerAbortControllers.
|
|
46758
|
+
if (this._requestHandlerAbortControllers.get(request.id) === abortController) {
|
|
46759
|
+
this._requestHandlerAbortControllers.delete(request.id);
|
|
46760
|
+
}
|
|
46143
46761
|
});
|
|
46144
46762
|
}
|
|
46145
46763
|
_onprogress(notification) {
|
|
@@ -53205,7 +53823,7 @@ var require_dist = __commonJS((exports, module) => {
|
|
|
53205
53823
|
exports.default = formatsPlugin;
|
|
53206
53824
|
});
|
|
53207
53825
|
|
|
53208
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
53826
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
|
|
53209
53827
|
function createDefaultAjvInstance() {
|
|
53210
53828
|
const ajv = new import_ajv.default({
|
|
53211
53829
|
strict: false,
|
|
@@ -53248,7 +53866,7 @@ var init_ajv_provider = __esm(() => {
|
|
|
53248
53866
|
import_ajv_formats = __toESM(require_dist(), 1);
|
|
53249
53867
|
});
|
|
53250
53868
|
|
|
53251
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
53869
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
|
|
53252
53870
|
class ExperimentalServerTasks {
|
|
53253
53871
|
constructor(_server) {
|
|
53254
53872
|
this._server = _server;
|
|
@@ -53256,6 +53874,62 @@ class ExperimentalServerTasks {
|
|
|
53256
53874
|
requestStream(request, resultSchema, options) {
|
|
53257
53875
|
return this._server.requestStream(request, resultSchema, options);
|
|
53258
53876
|
}
|
|
53877
|
+
createMessageStream(params, options) {
|
|
53878
|
+
const clientCapabilities = this._server.getClientCapabilities();
|
|
53879
|
+
if ((params.tools || params.toolChoice) && !clientCapabilities?.sampling?.tools) {
|
|
53880
|
+
throw new Error("Client does not support sampling tools capability.");
|
|
53881
|
+
}
|
|
53882
|
+
if (params.messages.length > 0) {
|
|
53883
|
+
const lastMessage = params.messages[params.messages.length - 1];
|
|
53884
|
+
const lastContent = Array.isArray(lastMessage.content) ? lastMessage.content : [lastMessage.content];
|
|
53885
|
+
const hasToolResults = lastContent.some((c) => c.type === "tool_result");
|
|
53886
|
+
const previousMessage = params.messages.length > 1 ? params.messages[params.messages.length - 2] : undefined;
|
|
53887
|
+
const previousContent = previousMessage ? Array.isArray(previousMessage.content) ? previousMessage.content : [previousMessage.content] : [];
|
|
53888
|
+
const hasPreviousToolUse = previousContent.some((c) => c.type === "tool_use");
|
|
53889
|
+
if (hasToolResults) {
|
|
53890
|
+
if (lastContent.some((c) => c.type !== "tool_result")) {
|
|
53891
|
+
throw new Error("The last message must contain only tool_result content if any is present");
|
|
53892
|
+
}
|
|
53893
|
+
if (!hasPreviousToolUse) {
|
|
53894
|
+
throw new Error("tool_result blocks are not matching any tool_use from the previous message");
|
|
53895
|
+
}
|
|
53896
|
+
}
|
|
53897
|
+
if (hasPreviousToolUse) {
|
|
53898
|
+
const toolUseIds = new Set(previousContent.filter((c) => c.type === "tool_use").map((c) => c.id));
|
|
53899
|
+
const toolResultIds = new Set(lastContent.filter((c) => c.type === "tool_result").map((c) => c.toolUseId));
|
|
53900
|
+
if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every((id) => toolResultIds.has(id))) {
|
|
53901
|
+
throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match");
|
|
53902
|
+
}
|
|
53903
|
+
}
|
|
53904
|
+
}
|
|
53905
|
+
return this.requestStream({
|
|
53906
|
+
method: "sampling/createMessage",
|
|
53907
|
+
params
|
|
53908
|
+
}, CreateMessageResultSchema, options);
|
|
53909
|
+
}
|
|
53910
|
+
elicitInputStream(params, options) {
|
|
53911
|
+
const clientCapabilities = this._server.getClientCapabilities();
|
|
53912
|
+
const mode = params.mode ?? "form";
|
|
53913
|
+
switch (mode) {
|
|
53914
|
+
case "url": {
|
|
53915
|
+
if (!clientCapabilities?.elicitation?.url) {
|
|
53916
|
+
throw new Error("Client does not support url elicitation.");
|
|
53917
|
+
}
|
|
53918
|
+
break;
|
|
53919
|
+
}
|
|
53920
|
+
case "form": {
|
|
53921
|
+
if (!clientCapabilities?.elicitation?.form) {
|
|
53922
|
+
throw new Error("Client does not support form elicitation.");
|
|
53923
|
+
}
|
|
53924
|
+
break;
|
|
53925
|
+
}
|
|
53926
|
+
}
|
|
53927
|
+
const normalizedParams = mode === "form" && params.mode === undefined ? { ...params, mode: "form" } : params;
|
|
53928
|
+
return this.requestStream({
|
|
53929
|
+
method: "elicitation/create",
|
|
53930
|
+
params: normalizedParams
|
|
53931
|
+
}, ElicitResultSchema, options);
|
|
53932
|
+
}
|
|
53259
53933
|
async getTask(taskId, options) {
|
|
53260
53934
|
return this._server.getTask({ taskId }, options);
|
|
53261
53935
|
}
|
|
@@ -53269,8 +53943,11 @@ class ExperimentalServerTasks {
|
|
|
53269
53943
|
return this._server.cancelTask({ taskId }, options);
|
|
53270
53944
|
}
|
|
53271
53945
|
}
|
|
53946
|
+
var init_server = __esm(() => {
|
|
53947
|
+
init_types7();
|
|
53948
|
+
});
|
|
53272
53949
|
|
|
53273
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
53950
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
|
|
53274
53951
|
function assertToolsCallTaskCapability(requests, method, entityName) {
|
|
53275
53952
|
if (!requests) {
|
|
53276
53953
|
throw new Error(`${entityName} does not support task creation (required for ${method})`);
|
|
@@ -53305,13 +53982,14 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
|
|
|
53305
53982
|
}
|
|
53306
53983
|
}
|
|
53307
53984
|
|
|
53308
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
53985
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
|
|
53309
53986
|
var Server;
|
|
53310
|
-
var
|
|
53987
|
+
var init_server2 = __esm(() => {
|
|
53311
53988
|
init_protocol();
|
|
53312
53989
|
init_types7();
|
|
53313
53990
|
init_ajv_provider();
|
|
53314
53991
|
init_zod_compat();
|
|
53992
|
+
init_server();
|
|
53315
53993
|
Server = class Server extends Protocol {
|
|
53316
53994
|
constructor(_serverInfo, options) {
|
|
53317
53995
|
super(options);
|
|
@@ -53359,16 +54037,7 @@ var init_server = __esm(() => {
|
|
|
53359
54037
|
if (!methodSchema) {
|
|
53360
54038
|
throw new Error("Schema is missing a method literal");
|
|
53361
54039
|
}
|
|
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
|
-
}
|
|
54040
|
+
const methodValue = getLiteralValue(methodSchema);
|
|
53372
54041
|
if (typeof methodValue !== "string") {
|
|
53373
54042
|
throw new Error("Schema method literal must be a string");
|
|
53374
54043
|
}
|
|
@@ -53645,7 +54314,7 @@ var init_server = __esm(() => {
|
|
|
53645
54314
|
};
|
|
53646
54315
|
});
|
|
53647
54316
|
|
|
53648
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
54317
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
|
|
53649
54318
|
function isCompletable(schema2) {
|
|
53650
54319
|
return !!schema2 && typeof schema2 === "object" && COMPLETABLE_SYMBOL in schema2;
|
|
53651
54320
|
}
|
|
@@ -53660,7 +54329,7 @@ var init_completable = __esm(() => {
|
|
|
53660
54329
|
McpZodTypeKind2["Completable"] = "McpCompletable";
|
|
53661
54330
|
})(McpZodTypeKind || (McpZodTypeKind = {}));
|
|
53662
54331
|
});
|
|
53663
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
54332
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
|
|
53664
54333
|
function validateToolName(name) {
|
|
53665
54334
|
const warnings = [];
|
|
53666
54335
|
if (name.length === 0) {
|
|
@@ -53721,7 +54390,7 @@ var init_toolNameValidation = __esm(() => {
|
|
|
53721
54390
|
TOOL_NAME_REGEX = /^[A-Za-z0-9._-]{1,128}$/;
|
|
53722
54391
|
});
|
|
53723
54392
|
|
|
53724
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
54393
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
|
|
53725
54394
|
class ExperimentalMcpServerTasks {
|
|
53726
54395
|
constructor(_mcpServer) {
|
|
53727
54396
|
this._mcpServer = _mcpServer;
|
|
@@ -53736,7 +54405,7 @@ class ExperimentalMcpServerTasks {
|
|
|
53736
54405
|
}
|
|
53737
54406
|
}
|
|
53738
54407
|
|
|
53739
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
54408
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
|
|
53740
54409
|
class McpServer {
|
|
53741
54410
|
constructor(serverInfo, options) {
|
|
53742
54411
|
this._registeredResources = {};
|
|
@@ -54320,6 +54989,9 @@ class McpServer {
|
|
|
54320
54989
|
annotations = rest.shift();
|
|
54321
54990
|
}
|
|
54322
54991
|
} else if (typeof firstArg === "object" && firstArg !== null) {
|
|
54992
|
+
if (Object.values(firstArg).some((v) => typeof v === "object" && v !== null)) {
|
|
54993
|
+
throw new Error(`Tool ${name} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);
|
|
54994
|
+
}
|
|
54323
54995
|
annotations = rest.shift();
|
|
54324
54996
|
}
|
|
54325
54997
|
}
|
|
@@ -54408,6 +55080,9 @@ function getZodSchemaObject(schema2) {
|
|
|
54408
55080
|
if (isZodRawShapeCompat(schema2)) {
|
|
54409
55081
|
return objectFromShape(schema2);
|
|
54410
55082
|
}
|
|
55083
|
+
if (!isZodSchemaInstance(schema2)) {
|
|
55084
|
+
throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");
|
|
55085
|
+
}
|
|
54411
55086
|
return schema2;
|
|
54412
55087
|
}
|
|
54413
55088
|
function promptArgumentsFromSchema(schema2) {
|
|
@@ -54447,7 +55122,7 @@ function createCompletionResult(suggestions) {
|
|
|
54447
55122
|
}
|
|
54448
55123
|
var EMPTY_OBJECT_JSON_SCHEMA, EMPTY_COMPLETION_RESULT;
|
|
54449
55124
|
var init_mcp = __esm(() => {
|
|
54450
|
-
|
|
55125
|
+
init_server2();
|
|
54451
55126
|
init_zod_compat();
|
|
54452
55127
|
init_zod_json_schema_compat();
|
|
54453
55128
|
init_types7();
|
|
@@ -54466,9 +55141,17 @@ var init_mcp = __esm(() => {
|
|
|
54466
55141
|
};
|
|
54467
55142
|
});
|
|
54468
55143
|
|
|
54469
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
55144
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
|
|
54470
55145
|
class ReadBuffer {
|
|
55146
|
+
constructor(options) {
|
|
55147
|
+
this._maxBufferSize = options?.maxBufferSize ?? STDIO_DEFAULT_MAX_BUFFER_SIZE;
|
|
55148
|
+
}
|
|
54471
55149
|
append(chunk) {
|
|
55150
|
+
const newSize = (this._buffer?.length ?? 0) + chunk.length;
|
|
55151
|
+
if (newSize > this._maxBufferSize) {
|
|
55152
|
+
this.clear();
|
|
55153
|
+
throw new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);
|
|
55154
|
+
}
|
|
54472
55155
|
this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk;
|
|
54473
55156
|
}
|
|
54474
55157
|
readMessage() {
|
|
@@ -54495,26 +55178,33 @@ function serializeMessage(message) {
|
|
|
54495
55178
|
return JSON.stringify(message) + `
|
|
54496
55179
|
`;
|
|
54497
55180
|
}
|
|
55181
|
+
var STDIO_DEFAULT_MAX_BUFFER_SIZE;
|
|
54498
55182
|
var init_stdio = __esm(() => {
|
|
54499
55183
|
init_types7();
|
|
55184
|
+
STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024;
|
|
54500
55185
|
});
|
|
54501
55186
|
|
|
54502
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
55187
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
54503
55188
|
import process2 from "process";
|
|
54504
55189
|
|
|
54505
55190
|
class StdioServerTransport {
|
|
54506
|
-
constructor(_stdin = process2.stdin, _stdout = process2.stdout) {
|
|
55191
|
+
constructor(_stdin = process2.stdin, _stdout = process2.stdout, options) {
|
|
54507
55192
|
this._stdin = _stdin;
|
|
54508
55193
|
this._stdout = _stdout;
|
|
54509
|
-
this._readBuffer = new ReadBuffer;
|
|
54510
55194
|
this._started = false;
|
|
54511
55195
|
this._ondata = (chunk) => {
|
|
54512
|
-
|
|
54513
|
-
|
|
55196
|
+
try {
|
|
55197
|
+
this._readBuffer.append(chunk);
|
|
55198
|
+
this.processReadBuffer();
|
|
55199
|
+
} catch (error3) {
|
|
55200
|
+
this.onerror?.(error3);
|
|
55201
|
+
this.close().catch(() => {});
|
|
55202
|
+
}
|
|
54514
55203
|
};
|
|
54515
55204
|
this._onerror = (error3) => {
|
|
54516
55205
|
this.onerror?.(error3);
|
|
54517
55206
|
};
|
|
55207
|
+
this._readBuffer = new ReadBuffer({ maxBufferSize: options?.maxBufferSize });
|
|
54518
55208
|
}
|
|
54519
55209
|
async start() {
|
|
54520
55210
|
if (this._started) {
|
|
@@ -85410,7 +86100,7 @@ var require_v4_mini = __commonJS((exports) => {
|
|
|
85410
86100
|
__exportStar(require_mini(), exports);
|
|
85411
86101
|
});
|
|
85412
86102
|
|
|
85413
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
86103
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-compat.js
|
|
85414
86104
|
var require_zod_compat = __commonJS((exports) => {
|
|
85415
86105
|
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
85416
86106
|
if (k2 === undefined)
|
|
@@ -85540,17 +86230,34 @@ var require_zod_compat = __commonJS((exports) => {
|
|
|
85540
86230
|
}
|
|
85541
86231
|
return;
|
|
85542
86232
|
}
|
|
86233
|
+
function getDotPath2(path) {
|
|
86234
|
+
if (path.length === 0) {
|
|
86235
|
+
return "object root";
|
|
86236
|
+
}
|
|
86237
|
+
return path.reduce((acc, seg, index) => {
|
|
86238
|
+
if (index === 0) {
|
|
86239
|
+
return String(seg);
|
|
86240
|
+
}
|
|
86241
|
+
if (typeof seg === "number") {
|
|
86242
|
+
return `${acc}[${seg}]`;
|
|
86243
|
+
}
|
|
86244
|
+
return `${acc}.${seg}`;
|
|
86245
|
+
}, "");
|
|
86246
|
+
}
|
|
85543
86247
|
function getParseErrorMessage2(error3) {
|
|
85544
86248
|
if (error3 && typeof error3 === "object") {
|
|
86249
|
+
if ("issues" in error3 && Array.isArray(error3.issues) && error3.issues.length > 0) {
|
|
86250
|
+
return error3.issues.map((i) => {
|
|
86251
|
+
if (!i.path?.length) {
|
|
86252
|
+
return i.message;
|
|
86253
|
+
}
|
|
86254
|
+
return `${i.message} at ${getDotPath2(i.path)}`;
|
|
86255
|
+
}).join(`
|
|
86256
|
+
`);
|
|
86257
|
+
}
|
|
85545
86258
|
if ("message" in error3 && typeof error3.message === "string") {
|
|
85546
86259
|
return error3.message;
|
|
85547
86260
|
}
|
|
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
86261
|
try {
|
|
85555
86262
|
return JSON.stringify(error3);
|
|
85556
86263
|
} catch {
|
|
@@ -87257,7 +87964,7 @@ var require_v4 = __commonJS((exports) => {
|
|
|
87257
87964
|
exports.default = index_js_1.default;
|
|
87258
87965
|
});
|
|
87259
87966
|
|
|
87260
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
87967
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/cjs/types.js
|
|
87261
87968
|
var require_types3 = __commonJS((exports) => {
|
|
87262
87969
|
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
87263
87970
|
if (k2 === undefined)
|
|
@@ -87308,7 +88015,7 @@ var require_types3 = __commonJS((exports) => {
|
|
|
87308
88015
|
exports.ProgressTokenSchema = z.union([z.string(), z.number().int()]);
|
|
87309
88016
|
exports.CursorSchema = z.string();
|
|
87310
88017
|
exports.TaskCreationParamsSchema = z.looseObject({
|
|
87311
|
-
ttl: z.
|
|
88018
|
+
ttl: z.number().optional(),
|
|
87312
88019
|
pollInterval: z.number().optional()
|
|
87313
88020
|
});
|
|
87314
88021
|
exports.TaskMetadataSchema = z.object({
|
|
@@ -87470,7 +88177,8 @@ var require_types3 = __commonJS((exports) => {
|
|
|
87470
88177
|
roots: z.object({
|
|
87471
88178
|
listChanged: z.boolean().optional()
|
|
87472
88179
|
}).optional(),
|
|
87473
|
-
tasks: exports.ClientTasksCapabilitySchema.optional()
|
|
88180
|
+
tasks: exports.ClientTasksCapabilitySchema.optional(),
|
|
88181
|
+
extensions: z.record(z.string(), AssertObjectSchema2).optional()
|
|
87474
88182
|
});
|
|
87475
88183
|
exports.InitializeRequestParamsSchema = BaseRequestParamsSchema2.extend({
|
|
87476
88184
|
protocolVersion: z.string(),
|
|
@@ -87497,7 +88205,8 @@ var require_types3 = __commonJS((exports) => {
|
|
|
87497
88205
|
tools: z.object({
|
|
87498
88206
|
listChanged: z.boolean().optional()
|
|
87499
88207
|
}).optional(),
|
|
87500
|
-
tasks: exports.ServerTasksCapabilitySchema.optional()
|
|
88208
|
+
tasks: exports.ServerTasksCapabilitySchema.optional(),
|
|
88209
|
+
extensions: z.record(z.string(), AssertObjectSchema2).optional()
|
|
87501
88210
|
});
|
|
87502
88211
|
exports.InitializeResultSchema = exports.ResultSchema.extend({
|
|
87503
88212
|
protocolVersion: z.string(),
|
|
@@ -87614,6 +88323,7 @@ var require_types3 = __commonJS((exports) => {
|
|
|
87614
88323
|
uri: z.string(),
|
|
87615
88324
|
description: z.optional(z.string()),
|
|
87616
88325
|
mimeType: z.optional(z.string()),
|
|
88326
|
+
size: z.optional(z.number()),
|
|
87617
88327
|
annotations: exports.AnnotationsSchema.optional(),
|
|
87618
88328
|
_meta: z.optional(z.looseObject({}))
|
|
87619
88329
|
});
|
|
@@ -88157,7 +88867,7 @@ var require_types3 = __commonJS((exports) => {
|
|
|
88157
88867
|
exports.UrlElicitationRequiredError = UrlElicitationRequiredError2;
|
|
88158
88868
|
});
|
|
88159
88869
|
|
|
88160
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
88870
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/interfaces.js
|
|
88161
88871
|
var require_interfaces = __commonJS((exports) => {
|
|
88162
88872
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88163
88873
|
exports.isTerminal = isTerminal2;
|
|
@@ -88166,7 +88876,7 @@ var require_interfaces = __commonJS((exports) => {
|
|
|
88166
88876
|
}
|
|
88167
88877
|
});
|
|
88168
88878
|
|
|
88169
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
88879
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/Options.js
|
|
88170
88880
|
var require_Options = __commonJS((exports) => {
|
|
88171
88881
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88172
88882
|
exports.getDefaultOptions = exports.defaultOptions = exports.jsonDescription = exports.ignoreOverride = undefined;
|
|
@@ -88217,7 +88927,7 @@ var require_Options = __commonJS((exports) => {
|
|
|
88217
88927
|
exports.getDefaultOptions = getDefaultOptions2;
|
|
88218
88928
|
});
|
|
88219
88929
|
|
|
88220
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
88930
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/Refs.js
|
|
88221
88931
|
var require_Refs = __commonJS((exports) => {
|
|
88222
88932
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88223
88933
|
exports.getRefs = undefined;
|
|
@@ -88243,7 +88953,7 @@ var require_Refs = __commonJS((exports) => {
|
|
|
88243
88953
|
exports.getRefs = getRefs2;
|
|
88244
88954
|
});
|
|
88245
88955
|
|
|
88246
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
88956
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/errorMessages.js
|
|
88247
88957
|
var require_errorMessages = __commonJS((exports) => {
|
|
88248
88958
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88249
88959
|
exports.setResponseValueAndErrors = exports.addErrorMessage = undefined;
|
|
@@ -88265,7 +88975,7 @@ var require_errorMessages = __commonJS((exports) => {
|
|
|
88265
88975
|
exports.setResponseValueAndErrors = setResponseValueAndErrors2;
|
|
88266
88976
|
});
|
|
88267
88977
|
|
|
88268
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
88978
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/getRelativePath.js
|
|
88269
88979
|
var require_getRelativePath = __commonJS((exports) => {
|
|
88270
88980
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88271
88981
|
exports.getRelativePath = undefined;
|
|
@@ -88280,7 +88990,7 @@ var require_getRelativePath = __commonJS((exports) => {
|
|
|
88280
88990
|
exports.getRelativePath = getRelativePath3;
|
|
88281
88991
|
});
|
|
88282
88992
|
|
|
88283
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
88993
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/any.js
|
|
88284
88994
|
var require_any = __commonJS((exports) => {
|
|
88285
88995
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88286
88996
|
exports.parseAnyDef = undefined;
|
|
@@ -88302,7 +89012,7 @@ var require_any = __commonJS((exports) => {
|
|
|
88302
89012
|
exports.parseAnyDef = parseAnyDef2;
|
|
88303
89013
|
});
|
|
88304
89014
|
|
|
88305
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89015
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/array.js
|
|
88306
89016
|
var require_array = __commonJS((exports) => {
|
|
88307
89017
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88308
89018
|
exports.parseArrayDef = undefined;
|
|
@@ -88334,7 +89044,7 @@ var require_array = __commonJS((exports) => {
|
|
|
88334
89044
|
exports.parseArrayDef = parseArrayDef2;
|
|
88335
89045
|
});
|
|
88336
89046
|
|
|
88337
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89047
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/bigint.js
|
|
88338
89048
|
var require_bigint = __commonJS((exports) => {
|
|
88339
89049
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88340
89050
|
exports.parseBigintDef = undefined;
|
|
@@ -88386,7 +89096,7 @@ var require_bigint = __commonJS((exports) => {
|
|
|
88386
89096
|
exports.parseBigintDef = parseBigintDef2;
|
|
88387
89097
|
});
|
|
88388
89098
|
|
|
88389
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89099
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/boolean.js
|
|
88390
89100
|
var require_boolean = __commonJS((exports) => {
|
|
88391
89101
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88392
89102
|
exports.parseBooleanDef = undefined;
|
|
@@ -88398,7 +89108,7 @@ var require_boolean = __commonJS((exports) => {
|
|
|
88398
89108
|
exports.parseBooleanDef = parseBooleanDef2;
|
|
88399
89109
|
});
|
|
88400
89110
|
|
|
88401
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89111
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/branded.js
|
|
88402
89112
|
var require_branded = __commonJS((exports) => {
|
|
88403
89113
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88404
89114
|
exports.parseBrandedDef = undefined;
|
|
@@ -88409,7 +89119,7 @@ var require_branded = __commonJS((exports) => {
|
|
|
88409
89119
|
exports.parseBrandedDef = parseBrandedDef2;
|
|
88410
89120
|
});
|
|
88411
89121
|
|
|
88412
|
-
// 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/parsers/catch.js
|
|
88413
89123
|
var require_catch = __commonJS((exports) => {
|
|
88414
89124
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88415
89125
|
exports.parseCatchDef = undefined;
|
|
@@ -88420,7 +89130,7 @@ var require_catch = __commonJS((exports) => {
|
|
|
88420
89130
|
exports.parseCatchDef = parseCatchDef2;
|
|
88421
89131
|
});
|
|
88422
89132
|
|
|
88423
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89133
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/date.js
|
|
88424
89134
|
var require_date = __commonJS((exports) => {
|
|
88425
89135
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88426
89136
|
exports.parseDateDef = undefined;
|
|
@@ -88471,7 +89181,7 @@ var require_date = __commonJS((exports) => {
|
|
|
88471
89181
|
};
|
|
88472
89182
|
});
|
|
88473
89183
|
|
|
88474
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89184
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/default.js
|
|
88475
89185
|
var require_default = __commonJS((exports) => {
|
|
88476
89186
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88477
89187
|
exports.parseDefaultDef = undefined;
|
|
@@ -88485,7 +89195,7 @@ var require_default = __commonJS((exports) => {
|
|
|
88485
89195
|
exports.parseDefaultDef = parseDefaultDef2;
|
|
88486
89196
|
});
|
|
88487
89197
|
|
|
88488
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89198
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/effects.js
|
|
88489
89199
|
var require_effects = __commonJS((exports) => {
|
|
88490
89200
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88491
89201
|
exports.parseEffectsDef = undefined;
|
|
@@ -88497,7 +89207,7 @@ var require_effects = __commonJS((exports) => {
|
|
|
88497
89207
|
exports.parseEffectsDef = parseEffectsDef2;
|
|
88498
89208
|
});
|
|
88499
89209
|
|
|
88500
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89210
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/enum.js
|
|
88501
89211
|
var require_enum2 = __commonJS((exports) => {
|
|
88502
89212
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88503
89213
|
exports.parseEnumDef = undefined;
|
|
@@ -88510,7 +89220,7 @@ var require_enum2 = __commonJS((exports) => {
|
|
|
88510
89220
|
exports.parseEnumDef = parseEnumDef2;
|
|
88511
89221
|
});
|
|
88512
89222
|
|
|
88513
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89223
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/intersection.js
|
|
88514
89224
|
var require_intersection = __commonJS((exports) => {
|
|
88515
89225
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88516
89226
|
exports.parseIntersectionDef = undefined;
|
|
@@ -88558,7 +89268,7 @@ var require_intersection = __commonJS((exports) => {
|
|
|
88558
89268
|
exports.parseIntersectionDef = parseIntersectionDef2;
|
|
88559
89269
|
});
|
|
88560
89270
|
|
|
88561
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89271
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/literal.js
|
|
88562
89272
|
var require_literal = __commonJS((exports) => {
|
|
88563
89273
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88564
89274
|
exports.parseLiteralDef = undefined;
|
|
@@ -88583,7 +89293,7 @@ var require_literal = __commonJS((exports) => {
|
|
|
88583
89293
|
exports.parseLiteralDef = parseLiteralDef2;
|
|
88584
89294
|
});
|
|
88585
89295
|
|
|
88586
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89296
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/string.js
|
|
88587
89297
|
var require_string = __commonJS((exports) => {
|
|
88588
89298
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88589
89299
|
exports.parseStringDef = exports.zodPatterns = undefined;
|
|
@@ -88886,7 +89596,7 @@ var require_string = __commonJS((exports) => {
|
|
|
88886
89596
|
}
|
|
88887
89597
|
});
|
|
88888
89598
|
|
|
88889
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89599
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/record.js
|
|
88890
89600
|
var require_record = __commonJS((exports) => {
|
|
88891
89601
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88892
89602
|
exports.parseRecordDef = undefined;
|
|
@@ -88948,7 +89658,7 @@ var require_record = __commonJS((exports) => {
|
|
|
88948
89658
|
exports.parseRecordDef = parseRecordDef2;
|
|
88949
89659
|
});
|
|
88950
89660
|
|
|
88951
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89661
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/map.js
|
|
88952
89662
|
var require_map = __commonJS((exports) => {
|
|
88953
89663
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88954
89664
|
exports.parseMapDef = undefined;
|
|
@@ -88981,7 +89691,7 @@ var require_map = __commonJS((exports) => {
|
|
|
88981
89691
|
exports.parseMapDef = parseMapDef2;
|
|
88982
89692
|
});
|
|
88983
89693
|
|
|
88984
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89694
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/nativeEnum.js
|
|
88985
89695
|
var require_nativeEnum = __commonJS((exports) => {
|
|
88986
89696
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88987
89697
|
exports.parseNativeEnumDef = undefined;
|
|
@@ -89000,7 +89710,7 @@ var require_nativeEnum = __commonJS((exports) => {
|
|
|
89000
89710
|
exports.parseNativeEnumDef = parseNativeEnumDef2;
|
|
89001
89711
|
});
|
|
89002
89712
|
|
|
89003
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89713
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/never.js
|
|
89004
89714
|
var require_never = __commonJS((exports) => {
|
|
89005
89715
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89006
89716
|
exports.parseNeverDef = undefined;
|
|
@@ -89016,7 +89726,7 @@ var require_never = __commonJS((exports) => {
|
|
|
89016
89726
|
exports.parseNeverDef = parseNeverDef2;
|
|
89017
89727
|
});
|
|
89018
89728
|
|
|
89019
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89729
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/null.js
|
|
89020
89730
|
var require_null = __commonJS((exports) => {
|
|
89021
89731
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89022
89732
|
exports.parseNullDef = undefined;
|
|
@@ -89031,7 +89741,7 @@ var require_null = __commonJS((exports) => {
|
|
|
89031
89741
|
exports.parseNullDef = parseNullDef2;
|
|
89032
89742
|
});
|
|
89033
89743
|
|
|
89034
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89744
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/union.js
|
|
89035
89745
|
var require_union = __commonJS((exports) => {
|
|
89036
89746
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89037
89747
|
exports.parseUnionDef = exports.primitiveMappings = undefined;
|
|
@@ -89105,7 +89815,7 @@ var require_union = __commonJS((exports) => {
|
|
|
89105
89815
|
};
|
|
89106
89816
|
});
|
|
89107
89817
|
|
|
89108
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89818
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/nullable.js
|
|
89109
89819
|
var require_nullable = __commonJS((exports) => {
|
|
89110
89820
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89111
89821
|
exports.parseNullableDef = undefined;
|
|
@@ -89144,7 +89854,7 @@ var require_nullable = __commonJS((exports) => {
|
|
|
89144
89854
|
exports.parseNullableDef = parseNullableDef2;
|
|
89145
89855
|
});
|
|
89146
89856
|
|
|
89147
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89857
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/number.js
|
|
89148
89858
|
var require_number = __commonJS((exports) => {
|
|
89149
89859
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89150
89860
|
exports.parseNumberDef = undefined;
|
|
@@ -89199,7 +89909,7 @@ var require_number = __commonJS((exports) => {
|
|
|
89199
89909
|
exports.parseNumberDef = parseNumberDef2;
|
|
89200
89910
|
});
|
|
89201
89911
|
|
|
89202
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89912
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/object.js
|
|
89203
89913
|
var require_object = __commonJS((exports) => {
|
|
89204
89914
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89205
89915
|
exports.parseObjectDef = undefined;
|
|
@@ -89275,7 +89985,7 @@ var require_object = __commonJS((exports) => {
|
|
|
89275
89985
|
}
|
|
89276
89986
|
});
|
|
89277
89987
|
|
|
89278
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
89988
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/optional.js
|
|
89279
89989
|
var require_optional = __commonJS((exports) => {
|
|
89280
89990
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89281
89991
|
exports.parseOptionalDef = undefined;
|
|
@@ -89301,7 +90011,7 @@ var require_optional = __commonJS((exports) => {
|
|
|
89301
90011
|
exports.parseOptionalDef = parseOptionalDef2;
|
|
89302
90012
|
});
|
|
89303
90013
|
|
|
89304
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
90014
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/pipeline.js
|
|
89305
90015
|
var require_pipeline = __commonJS((exports) => {
|
|
89306
90016
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89307
90017
|
exports.parsePipelineDef = undefined;
|
|
@@ -89327,7 +90037,7 @@ var require_pipeline = __commonJS((exports) => {
|
|
|
89327
90037
|
exports.parsePipelineDef = parsePipelineDef2;
|
|
89328
90038
|
});
|
|
89329
90039
|
|
|
89330
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
90040
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/promise.js
|
|
89331
90041
|
var require_promise = __commonJS((exports) => {
|
|
89332
90042
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89333
90043
|
exports.parsePromiseDef = undefined;
|
|
@@ -89338,7 +90048,7 @@ var require_promise = __commonJS((exports) => {
|
|
|
89338
90048
|
exports.parsePromiseDef = parsePromiseDef2;
|
|
89339
90049
|
});
|
|
89340
90050
|
|
|
89341
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
90051
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/set.js
|
|
89342
90052
|
var require_set = __commonJS((exports) => {
|
|
89343
90053
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89344
90054
|
exports.parseSetDef = undefined;
|
|
@@ -89365,7 +90075,7 @@ var require_set = __commonJS((exports) => {
|
|
|
89365
90075
|
exports.parseSetDef = parseSetDef2;
|
|
89366
90076
|
});
|
|
89367
90077
|
|
|
89368
|
-
// 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/tuple.js
|
|
89369
90079
|
var require_tuple = __commonJS((exports) => {
|
|
89370
90080
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89371
90081
|
exports.parseTupleDef = undefined;
|
|
@@ -89399,7 +90109,7 @@ var require_tuple = __commonJS((exports) => {
|
|
|
89399
90109
|
exports.parseTupleDef = parseTupleDef2;
|
|
89400
90110
|
});
|
|
89401
90111
|
|
|
89402
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
90112
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/undefined.js
|
|
89403
90113
|
var require_undefined = __commonJS((exports) => {
|
|
89404
90114
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89405
90115
|
exports.parseUndefinedDef = undefined;
|
|
@@ -89412,7 +90122,7 @@ var require_undefined = __commonJS((exports) => {
|
|
|
89412
90122
|
exports.parseUndefinedDef = parseUndefinedDef2;
|
|
89413
90123
|
});
|
|
89414
90124
|
|
|
89415
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
90125
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/unknown.js
|
|
89416
90126
|
var require_unknown = __commonJS((exports) => {
|
|
89417
90127
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89418
90128
|
exports.parseUnknownDef = undefined;
|
|
@@ -89423,7 +90133,7 @@ var require_unknown = __commonJS((exports) => {
|
|
|
89423
90133
|
exports.parseUnknownDef = parseUnknownDef2;
|
|
89424
90134
|
});
|
|
89425
90135
|
|
|
89426
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
90136
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parsers/readonly.js
|
|
89427
90137
|
var require_readonly = __commonJS((exports) => {
|
|
89428
90138
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89429
90139
|
exports.parseReadonlyDef = undefined;
|
|
@@ -89434,7 +90144,7 @@ var require_readonly = __commonJS((exports) => {
|
|
|
89434
90144
|
exports.parseReadonlyDef = parseReadonlyDef2;
|
|
89435
90145
|
});
|
|
89436
90146
|
|
|
89437
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
90147
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/selectParser.js
|
|
89438
90148
|
var require_selectParser = __commonJS((exports) => {
|
|
89439
90149
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89440
90150
|
exports.selectParser = undefined;
|
|
@@ -89548,7 +90258,7 @@ var require_selectParser = __commonJS((exports) => {
|
|
|
89548
90258
|
exports.selectParser = selectParser3;
|
|
89549
90259
|
});
|
|
89550
90260
|
|
|
89551
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
90261
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parseDef.js
|
|
89552
90262
|
var require_parseDef = __commonJS((exports) => {
|
|
89553
90263
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89554
90264
|
exports.parseDef = undefined;
|
|
@@ -89613,12 +90323,12 @@ var require_parseDef = __commonJS((exports) => {
|
|
|
89613
90323
|
};
|
|
89614
90324
|
});
|
|
89615
90325
|
|
|
89616
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
90326
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/parseTypes.js
|
|
89617
90327
|
var require_parseTypes = __commonJS((exports) => {
|
|
89618
90328
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89619
90329
|
});
|
|
89620
90330
|
|
|
89621
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
90331
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/zodToJsonSchema.js
|
|
89622
90332
|
var require_zodToJsonSchema = __commonJS((exports) => {
|
|
89623
90333
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89624
90334
|
exports.zodToJsonSchema = undefined;
|
|
@@ -89687,7 +90397,7 @@ var require_zodToJsonSchema = __commonJS((exports) => {
|
|
|
89687
90397
|
exports.zodToJsonSchema = zodToJsonSchema3;
|
|
89688
90398
|
});
|
|
89689
90399
|
|
|
89690
|
-
// node_modules/.bun/zod-to-json-schema@3.25.
|
|
90400
|
+
// node_modules/.bun/zod-to-json-schema@3.25.2+27912429049419a2/node_modules/zod-to-json-schema/dist/cjs/index.js
|
|
89691
90401
|
var require_cjs = __commonJS((exports) => {
|
|
89692
90402
|
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
89693
90403
|
if (k2 === undefined)
|
|
@@ -89752,7 +90462,7 @@ var require_cjs = __commonJS((exports) => {
|
|
|
89752
90462
|
exports.default = zodToJsonSchema_js_1.zodToJsonSchema;
|
|
89753
90463
|
});
|
|
89754
90464
|
|
|
89755
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
90465
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-json-schema-compat.js
|
|
89756
90466
|
var require_zod_json_schema_compat = __commonJS((exports) => {
|
|
89757
90467
|
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
89758
90468
|
if (k2 === undefined)
|
|
@@ -89835,7 +90545,7 @@ var require_zod_json_schema_compat = __commonJS((exports) => {
|
|
|
89835
90545
|
}
|
|
89836
90546
|
});
|
|
89837
90547
|
|
|
89838
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
90548
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/protocol.js
|
|
89839
90549
|
var require_protocol = __commonJS((exports) => {
|
|
89840
90550
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89841
90551
|
exports.Protocol = exports.DEFAULT_REQUEST_TIMEOUT_MSEC = undefined;
|
|
@@ -90047,6 +90757,10 @@ var require_protocol = __commonJS((exports) => {
|
|
|
90047
90757
|
this._progressHandlers.clear();
|
|
90048
90758
|
this._taskProgressTokens.clear();
|
|
90049
90759
|
this._pendingDebouncedNotifications.clear();
|
|
90760
|
+
for (const info of this._timeoutInfo.values()) {
|
|
90761
|
+
clearTimeout(info.timeoutId);
|
|
90762
|
+
}
|
|
90763
|
+
this._timeoutInfo.clear();
|
|
90050
90764
|
for (const controller of this._requestHandlerAbortControllers.values()) {
|
|
90051
90765
|
controller.abort();
|
|
90052
90766
|
}
|
|
@@ -90177,7 +90891,9 @@ var require_protocol = __commonJS((exports) => {
|
|
|
90177
90891
|
await capturedTransport?.send(errorResponse);
|
|
90178
90892
|
}
|
|
90179
90893
|
}).catch((error3) => this._onerror(new Error(`Failed to send response: ${error3}`))).finally(() => {
|
|
90180
|
-
this._requestHandlerAbortControllers.
|
|
90894
|
+
if (this._requestHandlerAbortControllers.get(request.id) === abortController) {
|
|
90895
|
+
this._requestHandlerAbortControllers.delete(request.id);
|
|
90896
|
+
}
|
|
90181
90897
|
});
|
|
90182
90898
|
}
|
|
90183
90899
|
_onprogress(notification) {
|
|
@@ -90680,7 +91396,7 @@ var require_protocol = __commonJS((exports) => {
|
|
|
90680
91396
|
}
|
|
90681
91397
|
});
|
|
90682
91398
|
|
|
90683
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
91399
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/cjs/validation/ajv-provider.js
|
|
90684
91400
|
var require_ajv_provider = __commonJS((exports) => {
|
|
90685
91401
|
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
90686
91402
|
return mod && mod.__esModule ? mod : { default: mod };
|
|
@@ -90728,10 +91444,11 @@ var require_ajv_provider = __commonJS((exports) => {
|
|
|
90728
91444
|
exports.AjvJsonSchemaValidator = AjvJsonSchemaValidator2;
|
|
90729
91445
|
});
|
|
90730
91446
|
|
|
90731
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
91447
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/server.js
|
|
90732
91448
|
var require_server = __commonJS((exports) => {
|
|
90733
91449
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
90734
91450
|
exports.ExperimentalServerTasks = undefined;
|
|
91451
|
+
var types_js_1 = require_types3();
|
|
90735
91452
|
|
|
90736
91453
|
class ExperimentalServerTasks2 {
|
|
90737
91454
|
constructor(_server) {
|
|
@@ -90740,6 +91457,62 @@ var require_server = __commonJS((exports) => {
|
|
|
90740
91457
|
requestStream(request, resultSchema, options) {
|
|
90741
91458
|
return this._server.requestStream(request, resultSchema, options);
|
|
90742
91459
|
}
|
|
91460
|
+
createMessageStream(params, options) {
|
|
91461
|
+
const clientCapabilities = this._server.getClientCapabilities();
|
|
91462
|
+
if ((params.tools || params.toolChoice) && !clientCapabilities?.sampling?.tools) {
|
|
91463
|
+
throw new Error("Client does not support sampling tools capability.");
|
|
91464
|
+
}
|
|
91465
|
+
if (params.messages.length > 0) {
|
|
91466
|
+
const lastMessage = params.messages[params.messages.length - 1];
|
|
91467
|
+
const lastContent = Array.isArray(lastMessage.content) ? lastMessage.content : [lastMessage.content];
|
|
91468
|
+
const hasToolResults = lastContent.some((c) => c.type === "tool_result");
|
|
91469
|
+
const previousMessage = params.messages.length > 1 ? params.messages[params.messages.length - 2] : undefined;
|
|
91470
|
+
const previousContent = previousMessage ? Array.isArray(previousMessage.content) ? previousMessage.content : [previousMessage.content] : [];
|
|
91471
|
+
const hasPreviousToolUse = previousContent.some((c) => c.type === "tool_use");
|
|
91472
|
+
if (hasToolResults) {
|
|
91473
|
+
if (lastContent.some((c) => c.type !== "tool_result")) {
|
|
91474
|
+
throw new Error("The last message must contain only tool_result content if any is present");
|
|
91475
|
+
}
|
|
91476
|
+
if (!hasPreviousToolUse) {
|
|
91477
|
+
throw new Error("tool_result blocks are not matching any tool_use from the previous message");
|
|
91478
|
+
}
|
|
91479
|
+
}
|
|
91480
|
+
if (hasPreviousToolUse) {
|
|
91481
|
+
const toolUseIds = new Set(previousContent.filter((c) => c.type === "tool_use").map((c) => c.id));
|
|
91482
|
+
const toolResultIds = new Set(lastContent.filter((c) => c.type === "tool_result").map((c) => c.toolUseId));
|
|
91483
|
+
if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every((id) => toolResultIds.has(id))) {
|
|
91484
|
+
throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match");
|
|
91485
|
+
}
|
|
91486
|
+
}
|
|
91487
|
+
}
|
|
91488
|
+
return this.requestStream({
|
|
91489
|
+
method: "sampling/createMessage",
|
|
91490
|
+
params
|
|
91491
|
+
}, types_js_1.CreateMessageResultSchema, options);
|
|
91492
|
+
}
|
|
91493
|
+
elicitInputStream(params, options) {
|
|
91494
|
+
const clientCapabilities = this._server.getClientCapabilities();
|
|
91495
|
+
const mode = params.mode ?? "form";
|
|
91496
|
+
switch (mode) {
|
|
91497
|
+
case "url": {
|
|
91498
|
+
if (!clientCapabilities?.elicitation?.url) {
|
|
91499
|
+
throw new Error("Client does not support url elicitation.");
|
|
91500
|
+
}
|
|
91501
|
+
break;
|
|
91502
|
+
}
|
|
91503
|
+
case "form": {
|
|
91504
|
+
if (!clientCapabilities?.elicitation?.form) {
|
|
91505
|
+
throw new Error("Client does not support form elicitation.");
|
|
91506
|
+
}
|
|
91507
|
+
break;
|
|
91508
|
+
}
|
|
91509
|
+
}
|
|
91510
|
+
const normalizedParams = mode === "form" && params.mode === undefined ? { ...params, mode: "form" } : params;
|
|
91511
|
+
return this.requestStream({
|
|
91512
|
+
method: "elicitation/create",
|
|
91513
|
+
params: normalizedParams
|
|
91514
|
+
}, types_js_1.ElicitResultSchema, options);
|
|
91515
|
+
}
|
|
90743
91516
|
async getTask(taskId, options) {
|
|
90744
91517
|
return this._server.getTask({ taskId }, options);
|
|
90745
91518
|
}
|
|
@@ -90756,7 +91529,7 @@ var require_server = __commonJS((exports) => {
|
|
|
90756
91529
|
exports.ExperimentalServerTasks = ExperimentalServerTasks2;
|
|
90757
91530
|
});
|
|
90758
91531
|
|
|
90759
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
91532
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/helpers.js
|
|
90760
91533
|
var require_helpers = __commonJS((exports) => {
|
|
90761
91534
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
90762
91535
|
exports.assertToolsCallTaskCapability = assertToolsCallTaskCapability2;
|
|
@@ -90796,7 +91569,7 @@ var require_helpers = __commonJS((exports) => {
|
|
|
90796
91569
|
}
|
|
90797
91570
|
});
|
|
90798
91571
|
|
|
90799
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
91572
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/index.js
|
|
90800
91573
|
var require_server2 = __commonJS((exports) => {
|
|
90801
91574
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
90802
91575
|
exports.Server = undefined;
|
|
@@ -90854,16 +91627,7 @@ var require_server2 = __commonJS((exports) => {
|
|
|
90854
91627
|
if (!methodSchema) {
|
|
90855
91628
|
throw new Error("Schema is missing a method literal");
|
|
90856
91629
|
}
|
|
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
|
-
}
|
|
91630
|
+
const methodValue = (0, zod_compat_js_1.getLiteralValue)(methodSchema);
|
|
90867
91631
|
if (typeof methodValue !== "string") {
|
|
90868
91632
|
throw new Error("Schema method literal must be a string");
|
|
90869
91633
|
}
|
|
@@ -91141,7 +91905,7 @@ var require_server2 = __commonJS((exports) => {
|
|
|
91141
91905
|
exports.Server = Server2;
|
|
91142
91906
|
});
|
|
91143
91907
|
|
|
91144
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
91908
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/completable.js
|
|
91145
91909
|
var require_completable = __commonJS((exports) => {
|
|
91146
91910
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
91147
91911
|
exports.McpZodTypeKind = exports.COMPLETABLE_SYMBOL = undefined;
|
|
@@ -91175,7 +91939,7 @@ var require_completable = __commonJS((exports) => {
|
|
|
91175
91939
|
})(McpZodTypeKind2 || (exports.McpZodTypeKind = McpZodTypeKind2 = {}));
|
|
91176
91940
|
});
|
|
91177
91941
|
|
|
91178
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
91942
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/uriTemplate.js
|
|
91179
91943
|
var require_uriTemplate = __commonJS((exports) => {
|
|
91180
91944
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
91181
91945
|
exports.UriTemplate = undefined;
|
|
@@ -91398,7 +92162,7 @@ var require_uriTemplate = __commonJS((exports) => {
|
|
|
91398
92162
|
exports.UriTemplate = UriTemplate2;
|
|
91399
92163
|
});
|
|
91400
92164
|
|
|
91401
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
92165
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/toolNameValidation.js
|
|
91402
92166
|
var require_toolNameValidation = __commonJS((exports) => {
|
|
91403
92167
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
91404
92168
|
exports.validateToolName = validateToolName2;
|
|
@@ -91462,7 +92226,7 @@ var require_toolNameValidation = __commonJS((exports) => {
|
|
|
91462
92226
|
}
|
|
91463
92227
|
});
|
|
91464
92228
|
|
|
91465
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
92229
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/mcp-server.js
|
|
91466
92230
|
var require_mcp_server = __commonJS((exports) => {
|
|
91467
92231
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
91468
92232
|
exports.ExperimentalMcpServerTasks = undefined;
|
|
@@ -91530,7 +92294,7 @@ var require_zod = __commonJS((exports) => {
|
|
|
91530
92294
|
exports.default = z;
|
|
91531
92295
|
});
|
|
91532
92296
|
|
|
91533
|
-
// node_modules/.bun/@modelcontextprotocol+sdk@1.
|
|
92297
|
+
// node_modules/.bun/@modelcontextprotocol+sdk@1.30.0/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/mcp.js
|
|
91534
92298
|
var require_mcp = __commonJS((exports) => {
|
|
91535
92299
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
91536
92300
|
exports.ResourceTemplate = exports.McpServer = undefined;
|
|
@@ -92127,6 +92891,9 @@ var require_mcp = __commonJS((exports) => {
|
|
|
92127
92891
|
annotations = rest.shift();
|
|
92128
92892
|
}
|
|
92129
92893
|
} else if (typeof firstArg === "object" && firstArg !== null) {
|
|
92894
|
+
if (Object.values(firstArg).some((v) => typeof v === "object" && v !== null)) {
|
|
92895
|
+
throw new Error(`Tool ${name} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);
|
|
92896
|
+
}
|
|
92130
92897
|
annotations = rest.shift();
|
|
92131
92898
|
}
|
|
92132
92899
|
}
|
|
@@ -92237,6 +93004,9 @@ var require_mcp = __commonJS((exports) => {
|
|
|
92237
93004
|
if (isZodRawShapeCompat2(schema2)) {
|
|
92238
93005
|
return (0, zod_compat_js_1.objectFromShape)(schema2);
|
|
92239
93006
|
}
|
|
93007
|
+
if (!isZodSchemaInstance2(schema2)) {
|
|
93008
|
+
throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");
|
|
93009
|
+
}
|
|
92240
93010
|
return schema2;
|
|
92241
93011
|
}
|
|
92242
93012
|
function promptArgumentsFromSchema2(schema2) {
|
|
@@ -105197,10 +105967,10 @@ function serveStaticFile(filePath) {
|
|
|
105197
105967
|
if (!existsSync16(filePath))
|
|
105198
105968
|
return null;
|
|
105199
105969
|
const ext = extname(filePath);
|
|
105200
|
-
const
|
|
105970
|
+
const contentType2 = MIME_TYPES[ext] || "application/octet-stream";
|
|
105201
105971
|
return new Response(Bun.file(filePath), {
|
|
105202
105972
|
headers: {
|
|
105203
|
-
"Content-Type":
|
|
105973
|
+
"Content-Type": contentType2,
|
|
105204
105974
|
...SECURITY_HEADERS
|
|
105205
105975
|
}
|
|
105206
105976
|
});
|