@artil-ai/server 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/bin/main.js +348 -289
- package/bin/main.js.map +11 -10
- package/package.json +1 -1
package/bin/main.js
CHANGED
|
@@ -22326,7 +22326,7 @@ var channel = {
|
|
|
22326
22326
|
create: ({ webhookUrl, secret, fetch: fetch2 }) => new TelegramChannel(createBotApi({ webhook: webhookUrl ? { url: webhookUrl, secret } : undefined, fetch: fetch2 }))
|
|
22327
22327
|
};
|
|
22328
22328
|
// package.json
|
|
22329
|
-
var version2 = "0.
|
|
22329
|
+
var version2 = "0.2.0";
|
|
22330
22330
|
|
|
22331
22331
|
// src/app/cli.ts
|
|
22332
22332
|
import { parseArgs } from "util";
|
|
@@ -29946,13 +29946,65 @@ function migrate(db, config2) {
|
|
|
29946
29946
|
db.dialect.migrate(migrations, db.session, config2);
|
|
29947
29947
|
}
|
|
29948
29948
|
|
|
29949
|
+
// src/platform/db/encryption.ts
|
|
29950
|
+
import { createCipheriv, createDecipheriv, hkdfSync, randomBytes as randomBytes2 } from "crypto";
|
|
29951
|
+
var algorithm = "aes-256-gcm";
|
|
29952
|
+
var keyLength = 32;
|
|
29953
|
+
var nonceLength = 12;
|
|
29954
|
+
var tagLength = 16;
|
|
29955
|
+
var key;
|
|
29956
|
+
function initEncryption(secret) {
|
|
29957
|
+
key = Buffer.from(hkdfSync("sha256", secret, "", "encryption", keyLength));
|
|
29958
|
+
}
|
|
29959
|
+
function encryptedText(table, column) {
|
|
29960
|
+
const label = `${table}.${column}`;
|
|
29961
|
+
return customType({
|
|
29962
|
+
dataType: () => "text",
|
|
29963
|
+
toDriver: (plaintext) => encryptText(plaintext, label),
|
|
29964
|
+
fromDriver: (stored) => decryptBytes(Buffer.from(stored, "base64url"), label).toString("utf8")
|
|
29965
|
+
})(column);
|
|
29966
|
+
}
|
|
29967
|
+
function encryptText(plaintext, label) {
|
|
29968
|
+
return encryptBytes(Buffer.from(plaintext, "utf8"), label).toString("base64url");
|
|
29969
|
+
}
|
|
29970
|
+
function encryptBytes(bytes, label) {
|
|
29971
|
+
const nonce = randomBytes2(nonceLength);
|
|
29972
|
+
const cipher = createCipheriv(algorithm, activeKey(label), nonce);
|
|
29973
|
+
cipher.setAAD(Buffer.from(label));
|
|
29974
|
+
const ciphertext = Buffer.concat([cipher.update(bytes), cipher.final()]);
|
|
29975
|
+
return Buffer.concat([nonce, ciphertext, cipher.getAuthTag()]);
|
|
29976
|
+
}
|
|
29977
|
+
function decryptBytes(sealed, label) {
|
|
29978
|
+
const payload = Buffer.from(sealed);
|
|
29979
|
+
const decryptionKey = activeKey(label);
|
|
29980
|
+
try {
|
|
29981
|
+
const decipher = createDecipheriv(algorithm, decryptionKey, payload.subarray(0, nonceLength), {
|
|
29982
|
+
authTagLength: tagLength
|
|
29983
|
+
});
|
|
29984
|
+
decipher.setAAD(Buffer.from(label));
|
|
29985
|
+
decipher.setAuthTag(payload.subarray(-tagLength));
|
|
29986
|
+
return Buffer.concat([
|
|
29987
|
+
decipher.update(payload.subarray(nonceLength, -tagLength)),
|
|
29988
|
+
decipher.final()
|
|
29989
|
+
]);
|
|
29990
|
+
} catch {
|
|
29991
|
+
throw new Error(`${label} does not decrypt with this server's secret`);
|
|
29992
|
+
}
|
|
29993
|
+
}
|
|
29994
|
+
function activeKey(label) {
|
|
29995
|
+
if (!key)
|
|
29996
|
+
throw new Error(`Open the database before reading or writing ${label}`);
|
|
29997
|
+
return key;
|
|
29998
|
+
}
|
|
29999
|
+
|
|
29949
30000
|
// src/platform/db/connection.ts
|
|
29950
|
-
function openDatabase({ path, migrationsFolder }) {
|
|
30001
|
+
function openDatabase({ path, migrationsFolder, secret }) {
|
|
29951
30002
|
const sqlite = new Sqlite(path, { create: true, strict: true });
|
|
29952
30003
|
sqlite.run("pragma journal_mode = wal");
|
|
29953
30004
|
sqlite.run("pragma busy_timeout = 5000");
|
|
29954
30005
|
sqlite.run("pragma foreign_keys = on");
|
|
29955
30006
|
const db = drizzle({ client: sqlite });
|
|
30007
|
+
initEncryption(secret);
|
|
29956
30008
|
migrate(db, { migrationsFolder });
|
|
29957
30009
|
return {
|
|
29958
30010
|
db,
|
|
@@ -29972,19 +30024,26 @@ function createS3Store({
|
|
|
29972
30024
|
}) {
|
|
29973
30025
|
const client = new S3Client({ endpoint, bucket, region, accessKeyId, secretAccessKey });
|
|
29974
30026
|
return {
|
|
29975
|
-
put: async ({ key, bytes, type }) => {
|
|
29976
|
-
await client.write(
|
|
30027
|
+
put: async ({ key: key2, bytes, type }) => {
|
|
30028
|
+
await client.write(key2, bytes, { type });
|
|
29977
30029
|
},
|
|
29978
|
-
read: async (
|
|
29979
|
-
remove: (
|
|
30030
|
+
read: async (key2) => new Uint8Array(await client.file(key2).arrayBuffer()),
|
|
30031
|
+
remove: (key2) => client.delete(key2)
|
|
29980
30032
|
};
|
|
29981
30033
|
}
|
|
30034
|
+
var contentLabel = "files.content";
|
|
30035
|
+
function encryptContent(bytes) {
|
|
30036
|
+
return encryptBytes(bytes, contentLabel);
|
|
30037
|
+
}
|
|
30038
|
+
function decryptContent(sealed) {
|
|
30039
|
+
return decryptBytes(sealed, contentLabel);
|
|
30040
|
+
}
|
|
29982
30041
|
async function checkStore(store) {
|
|
29983
|
-
const
|
|
30042
|
+
const key2 = `checks/${crypto.randomUUID()}`;
|
|
29984
30043
|
const bytes = new TextEncoder().encode("artil-server");
|
|
29985
|
-
await store.put({ key, bytes, type: "text/plain" });
|
|
29986
|
-
const read = await store.read(
|
|
29987
|
-
await store.remove(
|
|
30044
|
+
await store.put({ key: key2, bytes, type: "text/plain" });
|
|
30045
|
+
const read = await store.read(key2);
|
|
30046
|
+
await store.remove(key2);
|
|
29988
30047
|
if (new TextDecoder().decode(read) !== "artil-server") {
|
|
29989
30048
|
throw new Error("The bucket gave back other bytes than it was given");
|
|
29990
30049
|
}
|
|
@@ -30032,7 +30091,7 @@ var addresses = sqliteTable("addresses", {
|
|
|
30032
30091
|
agentId: text2("agent_id").notNull().references(() => agents.id, { onDelete: "cascade" }),
|
|
30033
30092
|
channel: text2("channel").notNull(),
|
|
30034
30093
|
value: text2("value").notNull(),
|
|
30035
|
-
credentials:
|
|
30094
|
+
credentials: encryptedText("addresses", "credentials"),
|
|
30036
30095
|
createdAt: createdAt()
|
|
30037
30096
|
}, (table) => [
|
|
30038
30097
|
uniqueIndex("addresses_channel_value_idx").on(table.channel, table.value).where(sql`${table.credentials} is not null`),
|
|
@@ -30052,9 +30111,9 @@ var messages = sqliteTable("messages", {
|
|
|
30052
30111
|
direction: text2("direction", { enum: ["inbound", "outbound"] }).notNull(),
|
|
30053
30112
|
externalId: text2("external_id"),
|
|
30054
30113
|
counterpart: text2("counterpart").notNull(),
|
|
30055
|
-
counterpartName:
|
|
30114
|
+
counterpartName: encryptedText("messages", "counterpart_name"),
|
|
30056
30115
|
to: text2("to", { mode: "json" }).$type().notNull(),
|
|
30057
|
-
text:
|
|
30116
|
+
text: encryptedText("messages", "text").notNull(),
|
|
30058
30117
|
status: text2("status", {
|
|
30059
30118
|
enum: ["received", "refused", "sending", "sent", "failed"]
|
|
30060
30119
|
}).notNull(),
|
|
@@ -30070,7 +30129,7 @@ var files = sqliteTable("files", {
|
|
|
30070
30129
|
id: id(),
|
|
30071
30130
|
agentId: text2("agent_id").notNull().references(() => agents.id, { onDelete: "cascade" }),
|
|
30072
30131
|
messageId: text2("message_id").notNull(),
|
|
30073
|
-
name:
|
|
30132
|
+
name: encryptedText("files", "name").notNull(),
|
|
30074
30133
|
type: text2("type").notNull(),
|
|
30075
30134
|
size: integer2("size").notNull(),
|
|
30076
30135
|
key: text2("key"),
|
|
@@ -30083,7 +30142,7 @@ var events = sqliteTable("events", {
|
|
|
30083
30142
|
type: text2("type", { enum: ["message.received"] }).notNull(),
|
|
30084
30143
|
channel: text2("channel").notNull(),
|
|
30085
30144
|
messageId: text2("message_id").notNull(),
|
|
30086
|
-
text:
|
|
30145
|
+
text: encryptedText("events", "text"),
|
|
30087
30146
|
sender: text2("sender", { mode: "json" }).$type(),
|
|
30088
30147
|
thread: text2("thread"),
|
|
30089
30148
|
toThread: text2("to_thread"),
|
|
@@ -30602,13 +30661,13 @@ function createFilesService({ filesRepository, store, log: log2 }) {
|
|
|
30602
30661
|
if (!store || file3.key === null || file3.expiresAt && file3.expiresAt <= new Date) {
|
|
30603
30662
|
return;
|
|
30604
30663
|
}
|
|
30605
|
-
return store.read(file3.key);
|
|
30664
|
+
return decryptContent(await store.read(file3.key));
|
|
30606
30665
|
}
|
|
30607
|
-
async function putInStore(
|
|
30666
|
+
async function putInStore({ bytes, ...object3 }) {
|
|
30608
30667
|
if (!store)
|
|
30609
30668
|
return false;
|
|
30610
30669
|
try {
|
|
30611
|
-
await store.put(
|
|
30670
|
+
await store.put({ ...object3, bytes: encryptContent(bytes) });
|
|
30612
30671
|
return true;
|
|
30613
30672
|
} catch (cause) {
|
|
30614
30673
|
log2(`Could not put a file in the bucket: ${messageOf(cause, String(cause))}`);
|
|
@@ -30651,8 +30710,8 @@ function createFilesService({ filesRepository, store, log: log2 }) {
|
|
|
30651
30710
|
describeByMessages: (messageIds) => new Map(filesRepository.listByMessages(messageIds).entries().map(([messageId, records]) => [messageId, records.map(toMessageAttachment)])),
|
|
30652
30711
|
save: ({ agentId, messageId, uploads, expiresAt }) => Promise.all(uploads.map(async ({ name, type, size, content }) => {
|
|
30653
30712
|
const id2 = crypto.randomUUID();
|
|
30654
|
-
const
|
|
30655
|
-
const stored = content !== null && await putInStore({ key, bytes: content, type });
|
|
30713
|
+
const key2 = `${agentId}/${id2}`;
|
|
30714
|
+
const stored = content !== null && await putInStore({ key: key2, bytes: content, type });
|
|
30656
30715
|
return filesRepository.add({
|
|
30657
30716
|
id: id2,
|
|
30658
30717
|
agentId,
|
|
@@ -30660,7 +30719,7 @@ function createFilesService({ filesRepository, store, log: log2 }) {
|
|
|
30660
30719
|
name,
|
|
30661
30720
|
type,
|
|
30662
30721
|
size,
|
|
30663
|
-
key: stored ?
|
|
30722
|
+
key: stored ? key2 : null,
|
|
30664
30723
|
expiresAt
|
|
30665
30724
|
});
|
|
30666
30725
|
})),
|
|
@@ -30969,9 +31028,9 @@ function createSignInsRepository(db) {
|
|
|
30969
31028
|
}
|
|
30970
31029
|
|
|
30971
31030
|
// src/platform/crypto.ts
|
|
30972
|
-
import { createHash as createHash2, randomBytes as
|
|
31031
|
+
import { createHash as createHash2, randomBytes as randomBytes3 } from "crypto";
|
|
30973
31032
|
function randomSecret() {
|
|
30974
|
-
return
|
|
31033
|
+
return randomBytes3(32).toString("base64url");
|
|
30975
31034
|
}
|
|
30976
31035
|
function hashSecret(secret) {
|
|
30977
31036
|
return createHash2("sha256").update(secret).digest("hex");
|
|
@@ -31246,7 +31305,7 @@ async function openCommandContext({
|
|
|
31246
31305
|
tailscale,
|
|
31247
31306
|
out
|
|
31248
31307
|
}) {
|
|
31249
|
-
const database = openDatabase({ path: paths.database, migrationsFolder });
|
|
31308
|
+
const database = openDatabase({ path: paths.database, migrationsFolder, secret: config2.secret });
|
|
31250
31309
|
const channels = createChannels({
|
|
31251
31310
|
definitions: await loadChannels({
|
|
31252
31311
|
specifiers: config2.channels,
|
|
@@ -31416,49 +31475,49 @@ async function parseFormData(request, options) {
|
|
|
31416
31475
|
function convertFormDataToBodyData(formData, options) {
|
|
31417
31476
|
const form = Object.create(null);
|
|
31418
31477
|
const nestingState = { count: 0 };
|
|
31419
|
-
formData.forEach((value,
|
|
31420
|
-
if (!(options.all ||
|
|
31421
|
-
form[
|
|
31478
|
+
formData.forEach((value, key2) => {
|
|
31479
|
+
if (!(options.all || key2.endsWith("[]")))
|
|
31480
|
+
form[key2] = value;
|
|
31422
31481
|
else
|
|
31423
|
-
handleParsingAllValues(form,
|
|
31482
|
+
handleParsingAllValues(form, key2, value);
|
|
31424
31483
|
});
|
|
31425
31484
|
if (options.dot)
|
|
31426
|
-
Object.entries(form).forEach(([
|
|
31427
|
-
if (
|
|
31428
|
-
handleParsingNestedValues(form,
|
|
31429
|
-
delete form[
|
|
31485
|
+
Object.entries(form).forEach(([key2, value]) => {
|
|
31486
|
+
if (key2.includes(".")) {
|
|
31487
|
+
handleParsingNestedValues(form, key2, value, nestingState);
|
|
31488
|
+
delete form[key2];
|
|
31430
31489
|
}
|
|
31431
31490
|
});
|
|
31432
31491
|
return form;
|
|
31433
31492
|
}
|
|
31434
|
-
var handleParsingAllValues = (form,
|
|
31435
|
-
if (form[
|
|
31436
|
-
if (Array.isArray(form[
|
|
31437
|
-
form[
|
|
31493
|
+
var handleParsingAllValues = (form, key2, value) => {
|
|
31494
|
+
if (form[key2] !== undefined) {
|
|
31495
|
+
if (Array.isArray(form[key2]))
|
|
31496
|
+
form[key2].push(value);
|
|
31438
31497
|
else
|
|
31439
|
-
form[
|
|
31440
|
-
} else if (!
|
|
31441
|
-
form[
|
|
31498
|
+
form[key2] = [form[key2], value];
|
|
31499
|
+
} else if (!key2.endsWith("[]"))
|
|
31500
|
+
form[key2] = value;
|
|
31442
31501
|
else
|
|
31443
|
-
form[
|
|
31502
|
+
form[key2] = [value];
|
|
31444
31503
|
};
|
|
31445
|
-
var handleParsingNestedValues = (form,
|
|
31446
|
-
if (/(?:^|\.)__proto__\./.test(
|
|
31504
|
+
var handleParsingNestedValues = (form, key2, value, state) => {
|
|
31505
|
+
if (/(?:^|\.)__proto__\./.test(key2))
|
|
31447
31506
|
return;
|
|
31448
31507
|
let nestedForm = form;
|
|
31449
|
-
const keys =
|
|
31508
|
+
const keys = key2.split(".", 34);
|
|
31450
31509
|
if (keys.length > 33)
|
|
31451
31510
|
throwNestingLimitExceeded();
|
|
31452
|
-
keys.forEach((
|
|
31511
|
+
keys.forEach((key3, index2) => {
|
|
31453
31512
|
if (index2 === keys.length - 1)
|
|
31454
|
-
nestedForm[
|
|
31513
|
+
nestedForm[key3] = value;
|
|
31455
31514
|
else {
|
|
31456
|
-
if (!nestedForm[
|
|
31515
|
+
if (!nestedForm[key3] || typeof nestedForm[key3] !== "object" || Array.isArray(nestedForm[key3]) || nestedForm[key3] instanceof File) {
|
|
31457
31516
|
if (state.count++ >= MAX_NESTED_OBJECTS)
|
|
31458
31517
|
throwNestingLimitExceeded();
|
|
31459
|
-
nestedForm[
|
|
31518
|
+
nestedForm[key3] = Object.create(null);
|
|
31460
31519
|
}
|
|
31461
|
-
nestedForm = nestedForm[
|
|
31520
|
+
nestedForm = nestedForm[key3];
|
|
31462
31521
|
}
|
|
31463
31522
|
});
|
|
31464
31523
|
};
|
|
@@ -31479,48 +31538,48 @@ var HonoRequest = class {
|
|
|
31479
31538
|
this.path = path;
|
|
31480
31539
|
this.#matchResult = matchResult;
|
|
31481
31540
|
}
|
|
31482
|
-
param(
|
|
31483
|
-
return
|
|
31541
|
+
param(key2) {
|
|
31542
|
+
return key2 ? this.#getDecodedParam(key2) : this.#getAllDecodedParams();
|
|
31484
31543
|
}
|
|
31485
|
-
#getDecodedParam(
|
|
31486
|
-
const paramKey2 = this.#matchResult[0][this.routeIndex]?.[1][
|
|
31544
|
+
#getDecodedParam(key2) {
|
|
31545
|
+
const paramKey2 = this.#matchResult[0][this.routeIndex]?.[1][key2];
|
|
31487
31546
|
const param = this.#getParamValue(paramKey2);
|
|
31488
31547
|
return param && tryDecodeURIComponent(param);
|
|
31489
31548
|
}
|
|
31490
31549
|
#getAllDecodedParams() {
|
|
31491
31550
|
const decoded = {};
|
|
31492
31551
|
const keys = Object.keys(this.#matchResult[0][this.routeIndex]?.[1] ?? {});
|
|
31493
|
-
for (const
|
|
31494
|
-
const value = this.#getParamValue(this.#matchResult[0][this.routeIndex][1][
|
|
31552
|
+
for (const key2 of keys) {
|
|
31553
|
+
const value = this.#getParamValue(this.#matchResult[0][this.routeIndex][1][key2]);
|
|
31495
31554
|
if (value !== undefined)
|
|
31496
|
-
decoded[
|
|
31555
|
+
decoded[key2] = tryDecodeURIComponent(value);
|
|
31497
31556
|
}
|
|
31498
31557
|
return decoded;
|
|
31499
31558
|
}
|
|
31500
31559
|
#getParamValue(paramKey2) {
|
|
31501
31560
|
return this.#matchResult[1] ? this.#matchResult[1][paramKey2] : paramKey2;
|
|
31502
31561
|
}
|
|
31503
|
-
query(
|
|
31504
|
-
return getQueryParam(this.url,
|
|
31562
|
+
query(key2) {
|
|
31563
|
+
return getQueryParam(this.url, key2);
|
|
31505
31564
|
}
|
|
31506
|
-
queries(
|
|
31507
|
-
return getQueryParams(this.url,
|
|
31565
|
+
queries(key2) {
|
|
31566
|
+
return getQueryParams(this.url, key2);
|
|
31508
31567
|
}
|
|
31509
31568
|
header(name) {
|
|
31510
31569
|
if (name)
|
|
31511
31570
|
return this.raw.headers.get(name) ?? undefined;
|
|
31512
31571
|
const headerData = Object.create(null);
|
|
31513
|
-
this.raw.headers.forEach((value,
|
|
31514
|
-
headerData[
|
|
31572
|
+
this.raw.headers.forEach((value, key2) => {
|
|
31573
|
+
headerData[key2] = value;
|
|
31515
31574
|
});
|
|
31516
31575
|
return headerData;
|
|
31517
31576
|
}
|
|
31518
31577
|
async parseBody(options) {
|
|
31519
31578
|
return parseBody(this, options);
|
|
31520
31579
|
}
|
|
31521
|
-
#cachedBody = (
|
|
31580
|
+
#cachedBody = (key2) => {
|
|
31522
31581
|
const { bodyCache, raw } = this;
|
|
31523
|
-
const cachedBody = bodyCache[
|
|
31582
|
+
const cachedBody = bodyCache[key2];
|
|
31524
31583
|
if (cachedBody)
|
|
31525
31584
|
return cachedBody;
|
|
31526
31585
|
for (const anyCachedKey in bodyCache)
|
|
@@ -31528,9 +31587,9 @@ var HonoRequest = class {
|
|
|
31528
31587
|
if (anyCachedKey === "json")
|
|
31529
31588
|
body = JSON.stringify(body);
|
|
31530
31589
|
const contentType = anyCachedKey === "formData" ? undefined : raw.headers.get("content-type");
|
|
31531
|
-
return new Response(body, { headers: contentType ? { "Content-Type": contentType } : undefined })[
|
|
31590
|
+
return new Response(body, { headers: contentType ? { "Content-Type": contentType } : undefined })[key2]();
|
|
31532
31591
|
});
|
|
31533
|
-
return bodyCache[
|
|
31592
|
+
return bodyCache[key2] = raw[key2]();
|
|
31534
31593
|
};
|
|
31535
31594
|
json() {
|
|
31536
31595
|
return this.#cachedBody("text").then((text3) => JSON.parse(text3));
|
|
@@ -31779,12 +31838,12 @@ var Context = class {
|
|
|
31779
31838
|
status = (status) => {
|
|
31780
31839
|
this.#status = status;
|
|
31781
31840
|
};
|
|
31782
|
-
set = (
|
|
31841
|
+
set = (key2, value) => {
|
|
31783
31842
|
this.#var ??= /* @__PURE__ */ new Map;
|
|
31784
|
-
this.#var.set(
|
|
31843
|
+
this.#var.set(key2, value);
|
|
31785
31844
|
};
|
|
31786
|
-
get = (
|
|
31787
|
-
return this.#var ? this.#var.get(
|
|
31845
|
+
get = (key2) => {
|
|
31846
|
+
return this.#var ? this.#var.get(key2) : undefined;
|
|
31788
31847
|
};
|
|
31789
31848
|
get var() {
|
|
31790
31849
|
if (!this.#var)
|
|
@@ -31795,11 +31854,11 @@ var Context = class {
|
|
|
31795
31854
|
let responseHeaders = this.#res ? new Headers(this.#res.headers) : this.#preparedHeaders;
|
|
31796
31855
|
if (typeof arg === "object" && arg.headers) {
|
|
31797
31856
|
responseHeaders ??= new Headers;
|
|
31798
|
-
for (const [
|
|
31799
|
-
if (
|
|
31800
|
-
responseHeaders.append(
|
|
31857
|
+
for (const [key2, value] of new Headers(arg.headers))
|
|
31858
|
+
if (key2 === "set-cookie")
|
|
31859
|
+
responseHeaders.append(key2, value);
|
|
31801
31860
|
else
|
|
31802
|
-
responseHeaders.set(
|
|
31861
|
+
responseHeaders.set(key2, value);
|
|
31803
31862
|
}
|
|
31804
31863
|
if (headers) {
|
|
31805
31864
|
if (!responseHeaders) {
|
|
@@ -32377,8 +32436,8 @@ var RegExpRouter = class {
|
|
|
32377
32436
|
const own2 = createNullObject();
|
|
32378
32437
|
const entries = handlers.map(([h2, p2], i2) => {
|
|
32379
32438
|
(own2[p2] ??= []).push(i2);
|
|
32380
|
-
return [h2, trie.paths[p2][1].reduceRight((map3, [
|
|
32381
|
-
map3[
|
|
32439
|
+
return [h2, trie.paths[p2][1].reduceRight((map3, [key2, varIndex]) => {
|
|
32440
|
+
map3[key2] = paramReplacementMap[varIndex];
|
|
32382
32441
|
return map3;
|
|
32383
32442
|
}, createNullObject())];
|
|
32384
32443
|
});
|
|
@@ -32475,8 +32534,8 @@ var Node3 = class Node4 {
|
|
|
32475
32534
|
const nextP = parts[++i2];
|
|
32476
32535
|
const pattern = getPattern(p2, nextP) || (nextP === undefined && p2 && p2.indexOf("*") === p2.length - 1 ? p2 : null);
|
|
32477
32536
|
const isParam = Array.isArray(pattern);
|
|
32478
|
-
const
|
|
32479
|
-
const child = curNode.#children[
|
|
32537
|
+
const key2 = isParam ? pattern[0] : pattern || p2;
|
|
32538
|
+
const child = curNode.#children[key2] ||= new Node4;
|
|
32480
32539
|
if (pattern && !child.#pattern) {
|
|
32481
32540
|
child.#pattern = pattern;
|
|
32482
32541
|
curNode.#patterns.push(child);
|
|
@@ -32499,8 +32558,8 @@ var Node3 = class Node4 {
|
|
|
32499
32558
|
handlerSet.params = createNullObject();
|
|
32500
32559
|
handlerSets.push(handlerSet);
|
|
32501
32560
|
for (let i3 = 0, len2 = handlerSet.possibleKeys.length;i3 < len2; i3++) {
|
|
32502
|
-
const
|
|
32503
|
-
handlerSet.params[
|
|
32561
|
+
const key2 = handlerSet.possibleKeys[i3];
|
|
32562
|
+
handlerSet.params[key2] = params?.[key2] && !i3 ? params[key2] : nodeParams[key2] ?? params?.[key2];
|
|
32504
32563
|
}
|
|
32505
32564
|
}
|
|
32506
32565
|
}
|
|
@@ -32732,8 +32791,8 @@ var secureHeaders = (customOptions) => {
|
|
|
32732
32791
|
};
|
|
32733
32792
|
};
|
|
32734
32793
|
function getFilteredHeaders(options) {
|
|
32735
|
-
return Object.entries(HEADERS_MAP).filter(([
|
|
32736
|
-
const overrideValue = options[
|
|
32794
|
+
return Object.entries(HEADERS_MAP).filter(([key2]) => options[key2]).map(([key2, defaultValue]) => {
|
|
32795
|
+
const overrideValue = options[key2];
|
|
32737
32796
|
return typeof overrideValue === "string" ? [defaultValue[0], overrideValue] : defaultValue;
|
|
32738
32797
|
});
|
|
32739
32798
|
}
|
|
@@ -33056,10 +33115,10 @@ var SSEStreamingApi = class extends StreamingApi {
|
|
|
33056
33115
|
return `data: ${line}`;
|
|
33057
33116
|
}).join(`
|
|
33058
33117
|
`);
|
|
33059
|
-
for (const
|
|
33060
|
-
const value = message[
|
|
33118
|
+
for (const key2 of ["event", "id"]) {
|
|
33119
|
+
const value = message[key2];
|
|
33061
33120
|
if (value && /[\r\n]/.test(value))
|
|
33062
|
-
throw new Error(`${
|
|
33121
|
+
throw new Error(`${key2} must not contain "\\r" or "\\n"`);
|
|
33063
33122
|
}
|
|
33064
33123
|
const sseData = [
|
|
33065
33124
|
message.event && `event: ${message.event}`,
|
|
@@ -33597,8 +33656,8 @@ var cors = (options2) => {
|
|
|
33597
33656
|
return () => "";
|
|
33598
33657
|
})(opts.allowMethods);
|
|
33599
33658
|
return async function cors2(c3, next) {
|
|
33600
|
-
function set3(
|
|
33601
|
-
c3.res.headers.set(
|
|
33659
|
+
function set3(key2, value) {
|
|
33660
|
+
c3.res.headers.set(key2, value);
|
|
33602
33661
|
}
|
|
33603
33662
|
const allowOrigin = await findAllowOrigin(c3.req.header("origin") || "", c3);
|
|
33604
33663
|
if (allowOrigin)
|
|
@@ -34109,8 +34168,8 @@ var insertIntoHead = (tagName, tag, props, precedence) => ({ buffer, context })
|
|
|
34109
34168
|
for (const [, tagProps] of tags6) {
|
|
34110
34169
|
if (tagName === "link" && !(tagProps.rel === "stylesheet" && tagProps["data-precedence"] !== undefined))
|
|
34111
34170
|
continue;
|
|
34112
|
-
for (const
|
|
34113
|
-
if ((tagProps?.[
|
|
34171
|
+
for (const key2 of deDupeKeys)
|
|
34172
|
+
if ((tagProps?.[key2] ?? null) === props?.[key2]) {
|
|
34114
34173
|
duped = true;
|
|
34115
34174
|
break LOOP;
|
|
34116
34175
|
}
|
|
@@ -34231,7 +34290,7 @@ var normalizeElementKeyMap = /* @__PURE__ */ new Map([
|
|
|
34231
34290
|
["noModule", "nomodule"],
|
|
34232
34291
|
["formAction", "formaction"]
|
|
34233
34292
|
]);
|
|
34234
|
-
var normalizeIntrinsicElementKey = (
|
|
34293
|
+
var normalizeIntrinsicElementKey = (key2) => normalizeElementKeyMap.get(key2) || key2;
|
|
34235
34294
|
var invalidAttributeNameCharRe = /[\s"'<>/=`\\\x00-\x1f\x7f-\x9f]/;
|
|
34236
34295
|
var validAttributeNameCache = /* @__PURE__ */ new Set;
|
|
34237
34296
|
var validAttributeNameCacheMax = 1024;
|
|
@@ -34337,30 +34396,30 @@ var hasUnsafeStyleValue = (value) => {
|
|
|
34337
34396
|
};
|
|
34338
34397
|
var styleObjectForEach = (style2, fn) => {
|
|
34339
34398
|
for (const [k, v] of Object.entries(style2)) {
|
|
34340
|
-
const
|
|
34341
|
-
if (!isValidStylePropertyName(
|
|
34399
|
+
const key2 = k[0] === "-" || !/[A-Z]/.test(k) ? k : k.replace(/[A-Z]/g, (m2) => `-${m2.toLowerCase()}`);
|
|
34400
|
+
if (!isValidStylePropertyName(key2))
|
|
34342
34401
|
continue;
|
|
34343
34402
|
if (v == null) {
|
|
34344
|
-
fn(
|
|
34403
|
+
fn(key2, null);
|
|
34345
34404
|
continue;
|
|
34346
34405
|
}
|
|
34347
34406
|
let value;
|
|
34348
34407
|
if (typeof v === "number")
|
|
34349
|
-
value = !
|
|
34408
|
+
value = !key2.match(/^(?:a|border-im|column(?:-c|s)|flex(?:$|-[^b])|grid-(?!.*gap)(?:ar|[^a])|font-w|li|or|sca|st|ta|wido|z)|ty$/) ? `${v}px` : `${v}`;
|
|
34350
34409
|
else if (typeof v === "string") {
|
|
34351
34410
|
if (hasUnsafeStyleValue(v))
|
|
34352
34411
|
continue;
|
|
34353
34412
|
value = v;
|
|
34354
34413
|
} else
|
|
34355
34414
|
continue;
|
|
34356
|
-
fn(
|
|
34415
|
+
fn(key2, value);
|
|
34357
34416
|
}
|
|
34358
34417
|
};
|
|
34359
34418
|
|
|
34360
34419
|
// ../../node_modules/.bun/hono@4.13.16/node_modules/hono/dist/jsx/base.js
|
|
34361
34420
|
var nameSpaceContext = undefined;
|
|
34362
34421
|
var getNameSpaceContext = () => nameSpaceContext;
|
|
34363
|
-
var toSVGAttributeName = (
|
|
34422
|
+
var toSVGAttributeName = (key2) => /[A-Z]/.test(key2) && key2.match(/^(?:al|basel|clip(?:Path|Rule)$|co|do|fill|fl|fo|gl|let|lig|i|marker[EMS]|o|pai|pointe|sh|st[or]|text[^L]|tr|u|ve|w)/) ? key2.replace(/([A-Z])/g, "-$1").toLowerCase() : key2;
|
|
34364
34423
|
var emptyTags = [
|
|
34365
34424
|
"area",
|
|
34366
34425
|
"base",
|
|
@@ -34484,12 +34543,12 @@ var JSXNode = class {
|
|
|
34484
34543
|
const props = this.props;
|
|
34485
34544
|
let { children } = this;
|
|
34486
34545
|
buffer[0] += `<${tag}`;
|
|
34487
|
-
const normalizeKey = tag === "svg" || nameSpaceContext && useContext(nameSpaceContext) === "svg" ? (
|
|
34488
|
-
for (let [
|
|
34489
|
-
|
|
34490
|
-
if (!isValidAttributeName(
|
|
34546
|
+
const normalizeKey = tag === "svg" || nameSpaceContext && useContext(nameSpaceContext) === "svg" ? (key2) => toSVGAttributeName(normalizeIntrinsicElementKey(key2)) : (key2) => normalizeIntrinsicElementKey(key2);
|
|
34547
|
+
for (let [key2, v] of Object.entries(props)) {
|
|
34548
|
+
key2 = normalizeKey(key2);
|
|
34549
|
+
if (!isValidAttributeName(key2))
|
|
34491
34550
|
continue;
|
|
34492
|
-
if (
|
|
34551
|
+
if (key2 === "children") {} else if (key2 === "style" && typeof v === "object") {
|
|
34493
34552
|
let styleStr = "";
|
|
34494
34553
|
styleObjectForEach(v, (property, value) => {
|
|
34495
34554
|
if (value != null)
|
|
@@ -34499,26 +34558,26 @@ var JSXNode = class {
|
|
|
34499
34558
|
escapeToBuffer(styleStr, buffer);
|
|
34500
34559
|
buffer[0] += '"';
|
|
34501
34560
|
} else if (typeof v === "string") {
|
|
34502
|
-
buffer[0] += ` ${
|
|
34561
|
+
buffer[0] += ` ${key2}="`;
|
|
34503
34562
|
escapeToBuffer(v, buffer);
|
|
34504
34563
|
buffer[0] += '"';
|
|
34505
34564
|
} else if (v === null || v === undefined) {} else if (typeof v === "number" || v.isEscaped)
|
|
34506
|
-
buffer[0] += ` ${
|
|
34507
|
-
else if (typeof v === "boolean" && booleanAttributes.includes(
|
|
34565
|
+
buffer[0] += ` ${key2}="${v}"`;
|
|
34566
|
+
else if (typeof v === "boolean" && booleanAttributes.includes(key2)) {
|
|
34508
34567
|
if (v)
|
|
34509
|
-
buffer[0] += ` ${
|
|
34510
|
-
} else if (
|
|
34568
|
+
buffer[0] += ` ${key2}=""`;
|
|
34569
|
+
} else if (key2 === "dangerouslySetInnerHTML") {
|
|
34511
34570
|
if (children.length > 0)
|
|
34512
34571
|
throw new Error("Can only set one of `children` or `props.dangerouslySetInnerHTML`.");
|
|
34513
34572
|
children = [raw(v.__html)];
|
|
34514
34573
|
} else if (v instanceof Promise) {
|
|
34515
|
-
buffer[0] += ` ${
|
|
34574
|
+
buffer[0] += ` ${key2}="`;
|
|
34516
34575
|
buffer.unshift('"', v);
|
|
34517
34576
|
} else if (typeof v === "function") {
|
|
34518
|
-
if (!
|
|
34519
|
-
throw new Error(`Invalid prop '${
|
|
34577
|
+
if (!key2.startsWith("on") && key2 !== "ref")
|
|
34578
|
+
throw new Error(`Invalid prop '${key2}' of type 'function' supplied to '${tag}'.`);
|
|
34520
34579
|
} else {
|
|
34521
|
-
buffer[0] += ` ${
|
|
34580
|
+
buffer[0] += ` ${key2}="`;
|
|
34522
34581
|
escapeToBuffer(v.toString(), buffer);
|
|
34523
34582
|
buffer[0] += '"';
|
|
34524
34583
|
}
|
|
@@ -34584,7 +34643,7 @@ var jsxFn = (tag, props, children) => {
|
|
|
34584
34643
|
};
|
|
34585
34644
|
|
|
34586
34645
|
// ../../node_modules/.bun/hono@4.13.16/node_modules/hono/dist/jsx/jsx-dev-runtime.js
|
|
34587
|
-
function jsxDEV(tag, props,
|
|
34646
|
+
function jsxDEV(tag, props, key2) {
|
|
34588
34647
|
let node2;
|
|
34589
34648
|
if (!props || !("children" in props))
|
|
34590
34649
|
node2 = jsxFn(tag, props, []);
|
|
@@ -34592,7 +34651,7 @@ function jsxDEV(tag, props, key) {
|
|
|
34592
34651
|
const children = props.children;
|
|
34593
34652
|
node2 = Array.isArray(children) ? jsxFn(tag, props, children) : jsxFn(tag, props, [children]);
|
|
34594
34653
|
}
|
|
34595
|
-
node2.key =
|
|
34654
|
+
node2.key = key2;
|
|
34596
34655
|
return node2;
|
|
34597
34656
|
}
|
|
34598
34657
|
|
|
@@ -34919,12 +34978,12 @@ var __exportAll2 = (all, symbols) => {
|
|
|
34919
34978
|
};
|
|
34920
34979
|
var __copyProps = (to, from, except2, desc2) => {
|
|
34921
34980
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
34922
|
-
for (var keys = __getOwnPropNames2(from), i2 = 0, n3 = keys.length,
|
|
34923
|
-
|
|
34924
|
-
if (!__hasOwnProp2.call(to,
|
|
34925
|
-
__defProp3(to,
|
|
34926
|
-
get: ((k) => from[k]).bind(null,
|
|
34927
|
-
enumerable: !(desc2 = __getOwnPropDesc(from,
|
|
34981
|
+
for (var keys = __getOwnPropNames2(from), i2 = 0, n3 = keys.length, key2;i2 < n3; i2++) {
|
|
34982
|
+
key2 = keys[i2];
|
|
34983
|
+
if (!__hasOwnProp2.call(to, key2) && key2 !== except2) {
|
|
34984
|
+
__defProp3(to, key2, {
|
|
34985
|
+
get: ((k) => from[k]).bind(null, key2),
|
|
34986
|
+
enumerable: !(desc2 = __getOwnPropDesc(from, key2)) || desc2.enumerable
|
|
34928
34987
|
});
|
|
34929
34988
|
}
|
|
34930
34989
|
}
|
|
@@ -36127,7 +36186,7 @@ var TOOL_RESULT_FOREIGN_FAMILY_KEYS = [
|
|
|
36127
36186
|
"requestState"
|
|
36128
36187
|
];
|
|
36129
36188
|
function normalizeContentlessToolResult(value) {
|
|
36130
|
-
if (value === null || typeof value !== "object" || Array.isArray(value) || value.content !== undefined || TOOL_RESULT_FOREIGN_FAMILY_KEYS.some((
|
|
36189
|
+
if (value === null || typeof value !== "object" || Array.isArray(value) || value.content !== undefined || TOOL_RESULT_FOREIGN_FAMILY_KEYS.some((key2) => (key2 in value)))
|
|
36131
36190
|
return value;
|
|
36132
36191
|
return {
|
|
36133
36192
|
...value,
|
|
@@ -37000,11 +37059,11 @@ function build$1() {
|
|
|
37000
37059
|
CallToolResultWireSchema: unknown2().superRefine((value, ctx) => {
|
|
37001
37060
|
if (typeof value !== "object" || value === null || Array.isArray(value) || value.content !== undefined)
|
|
37002
37061
|
return;
|
|
37003
|
-
for (const
|
|
37004
|
-
if (
|
|
37062
|
+
for (const key2 of TOOL_RESULT_FOREIGN_FAMILY_KEYS)
|
|
37063
|
+
if (key2 in value) {
|
|
37005
37064
|
ctx.addIssue({
|
|
37006
37065
|
code: "custom",
|
|
37007
|
-
message: `content is required when the body carries '${
|
|
37066
|
+
message: `content is required when the body carries '${key2}' \u2014 another result family cannot default into an empty tools/call success`
|
|
37008
37067
|
});
|
|
37009
37068
|
return;
|
|
37010
37069
|
}
|
|
@@ -38567,21 +38626,21 @@ var rev2026Codec = {
|
|
|
38567
38626
|
},
|
|
38568
38627
|
validateEnvelopeMeta(meta5) {
|
|
38569
38628
|
const issues = [];
|
|
38570
|
-
for (const
|
|
38571
|
-
if (!(
|
|
38629
|
+
for (const key2 of REQUIRED_ENVELOPE_KEYS)
|
|
38630
|
+
if (!(key2 in meta5))
|
|
38572
38631
|
issues.push({
|
|
38573
|
-
key,
|
|
38632
|
+
key: key2,
|
|
38574
38633
|
problem: "missing"
|
|
38575
38634
|
});
|
|
38576
38635
|
const parsed = buildSchemas2026().RequestMetaEnvelopeSchema.safeParse(meta5);
|
|
38577
38636
|
if (!parsed.success)
|
|
38578
38637
|
for (const issue2 of parsed.error.issues) {
|
|
38579
38638
|
const path = issue2.path.map(String);
|
|
38580
|
-
const
|
|
38581
|
-
if (path.length === 1 && issues.some((existing) => existing.key ===
|
|
38639
|
+
const key2 = path.length > 0 ? path.join(".") : "_meta";
|
|
38640
|
+
if (path.length === 1 && issues.some((existing) => existing.key === key2 && existing.problem === "missing"))
|
|
38582
38641
|
continue;
|
|
38583
38642
|
issues.push({
|
|
38584
|
-
key,
|
|
38643
|
+
key: key2,
|
|
38585
38644
|
problem: issue2.message
|
|
38586
38645
|
});
|
|
38587
38646
|
}
|
|
@@ -38953,8 +39012,8 @@ function scanXMcpHeaderDeclarations(inputSchema) {
|
|
|
38953
39012
|
}
|
|
38954
39013
|
const properties = schema.properties;
|
|
38955
39014
|
if (properties !== null && typeof properties === "object")
|
|
38956
|
-
for (const [
|
|
38957
|
-
const fault$1 = visit2(child, [...path,
|
|
39015
|
+
for (const [key2, child] of Object.entries(properties)) {
|
|
39016
|
+
const fault$1 = visit2(child, [...path, key2], reachable);
|
|
38958
39017
|
if (fault$1 !== undefined)
|
|
38959
39018
|
return fault$1;
|
|
38960
39019
|
}
|
|
@@ -39052,10 +39111,10 @@ function decodeMcpParamValue(value) {
|
|
|
39052
39111
|
}
|
|
39053
39112
|
function valueAtPath(root, path) {
|
|
39054
39113
|
let node2 = root;
|
|
39055
|
-
for (const
|
|
39114
|
+
for (const key2 of path) {
|
|
39056
39115
|
if (node2 === null || typeof node2 !== "object")
|
|
39057
39116
|
return;
|
|
39058
|
-
node2 = node2[
|
|
39117
|
+
node2 = node2[key2];
|
|
39059
39118
|
}
|
|
39060
39119
|
return node2;
|
|
39061
39120
|
}
|
|
@@ -39492,12 +39551,12 @@ function isProvablyObjectShapedRoot(schema, root = schema) {
|
|
|
39492
39551
|
const ref = typeof schema.$ref === "string" && LOCAL_DEFINITION_REF.exec(schema.$ref);
|
|
39493
39552
|
if (ref && root[ref[1]]?.[ref[2]]?.type === "object")
|
|
39494
39553
|
return true;
|
|
39495
|
-
for (const
|
|
39554
|
+
for (const key2 of [
|
|
39496
39555
|
"oneOf",
|
|
39497
39556
|
"anyOf",
|
|
39498
39557
|
"allOf"
|
|
39499
39558
|
]) {
|
|
39500
|
-
const members2 = schema[
|
|
39559
|
+
const members2 = schema[key2];
|
|
39501
39560
|
if (Array.isArray(members2) && members2.length > 0)
|
|
39502
39561
|
return members2.every((m2) => m2 !== null && typeof m2 === "object" && (m2.type === "object" || isProvablyObjectShapedRoot(m2, "$id" in m2 ? {} : root)));
|
|
39503
39562
|
}
|
|
@@ -39596,8 +39655,8 @@ var ANNOTATION_ONLY_JSON_SCHEMA_KEYWORDS = new Set([
|
|
|
39596
39655
|
"title",
|
|
39597
39656
|
"writeOnly"
|
|
39598
39657
|
]);
|
|
39599
|
-
function isAnnotationOnlyJsonSchemaKeyword(
|
|
39600
|
-
return ANNOTATION_ONLY_JSON_SCHEMA_KEYWORDS.has(
|
|
39658
|
+
function isAnnotationOnlyJsonSchemaKeyword(key2) {
|
|
39659
|
+
return ANNOTATION_ONLY_JSON_SCHEMA_KEYWORDS.has(key2) || key2.startsWith("x-");
|
|
39601
39660
|
}
|
|
39602
39661
|
var ROOT_KEYS = new Set(["$schema", ...Object.keys(ElicitRequestFormParamsSchema.shape.requestedSchema.shape)]);
|
|
39603
39662
|
var PROPERTY_KEYS_BY_TYPE = {
|
|
@@ -39620,28 +39679,28 @@ function walkProperty(node2, path, vendor, unsupported) {
|
|
|
39620
39679
|
if (allowedKeys === undefined)
|
|
39621
39680
|
return node2;
|
|
39622
39681
|
const pruned = {};
|
|
39623
|
-
for (const [
|
|
39624
|
-
if (allowedKeys.has(
|
|
39625
|
-
pruned[
|
|
39626
|
-
else if (
|
|
39682
|
+
for (const [key2, value] of Object.entries(node2))
|
|
39683
|
+
if (allowedKeys.has(key2) || isAnnotationOnlyJsonSchemaKeyword(key2))
|
|
39684
|
+
pruned[key2] = value;
|
|
39685
|
+
else if (key2 === "pattern" && node2.type === "string" && typeof node2.format === "string") {
|
|
39627
39686
|
if (!SUPPORTED_STRING_FORMATS.has(node2.format))
|
|
39628
|
-
pruned[
|
|
39687
|
+
pruned[key2] = value;
|
|
39629
39688
|
else if (typeof value !== "string" || !isLibraryFormatPattern(node2.format, value, vendor))
|
|
39630
|
-
unsupported.push(`${path}.${
|
|
39689
|
+
unsupported.push(`${path}.${key2}`);
|
|
39631
39690
|
} else
|
|
39632
|
-
unsupported.push(`${path}.${
|
|
39691
|
+
unsupported.push(`${path}.${key2}`);
|
|
39633
39692
|
return pruned;
|
|
39634
39693
|
}
|
|
39635
39694
|
function walkRequestedSchema(converted, vendor) {
|
|
39636
39695
|
const pruned = {};
|
|
39637
39696
|
const unsupported = [];
|
|
39638
|
-
for (const [
|
|
39639
|
-
if (
|
|
39640
|
-
pruned[
|
|
39641
|
-
else if (ROOT_KEYS.has(
|
|
39642
|
-
pruned[
|
|
39643
|
-
else if (!isAnnotationOnlyJsonSchemaKeyword(
|
|
39644
|
-
unsupported.push(
|
|
39697
|
+
for (const [key2, value] of Object.entries(converted))
|
|
39698
|
+
if (key2 === "properties" && isJsonObject(value))
|
|
39699
|
+
pruned[key2] = Object.fromEntries(Object.entries(value).map(([name, node2]) => [name, walkProperty(node2, `properties.${name}`, vendor, unsupported)]));
|
|
39700
|
+
else if (ROOT_KEYS.has(key2))
|
|
39701
|
+
pruned[key2] = value;
|
|
39702
|
+
else if (!isAnnotationOnlyJsonSchemaKeyword(key2))
|
|
39703
|
+
unsupported.push(key2);
|
|
39645
39704
|
if (unsupported.length > 0)
|
|
39646
39705
|
throw new ProtocolError(ProtocolErrorCode.InvalidParams, `Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${unsupported.join(", ")}`);
|
|
39647
39706
|
return pruned;
|
|
@@ -39657,11 +39716,11 @@ function findDroppedConstraintPaths(original, parsed, path = "") {
|
|
|
39657
39716
|
return original.flatMap((item, index2) => findDroppedConstraintPaths(item, parsed[index2], `${path}[${index2}]`));
|
|
39658
39717
|
if (!isJsonObject(original) || !isJsonObject(parsed))
|
|
39659
39718
|
return [];
|
|
39660
|
-
return Object.entries(original).flatMap(([
|
|
39661
|
-
const childPath = path ? `${path}.${
|
|
39662
|
-
if (!Object.prototype.hasOwnProperty.call(parsed,
|
|
39663
|
-
return isAnnotationOnlyJsonSchemaKeyword(
|
|
39664
|
-
return findDroppedConstraintPaths(value, parsed[
|
|
39719
|
+
return Object.entries(original).flatMap(([key2, value]) => {
|
|
39720
|
+
const childPath = path ? `${path}.${key2}` : key2;
|
|
39721
|
+
if (!Object.prototype.hasOwnProperty.call(parsed, key2))
|
|
39722
|
+
return isAnnotationOnlyJsonSchemaKeyword(key2) ? [] : [childPath];
|
|
39723
|
+
return findDroppedConstraintPaths(value, parsed[key2], childPath);
|
|
39665
39724
|
});
|
|
39666
39725
|
}
|
|
39667
39726
|
function normalizeElicitInputParams(input4) {
|
|
@@ -39679,7 +39738,7 @@ function normalizeElicitInputParams(input4) {
|
|
|
39679
39738
|
const droppedConstraints = findDroppedConstraintPaths(pruned, parsed.data);
|
|
39680
39739
|
if (droppedConstraints.length > 0)
|
|
39681
39740
|
throw new ProtocolError(ProtocolErrorCode.InvalidParams, `Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${droppedConstraints.join(", ")}`);
|
|
39682
|
-
const danglingRequired = (parsed.data.required ?? []).filter((
|
|
39741
|
+
const danglingRequired = (parsed.data.required ?? []).filter((key2) => !Object.prototype.hasOwnProperty.call(parsed.data.properties, key2));
|
|
39683
39742
|
if (danglingRequired.length > 0)
|
|
39684
39743
|
throw new ProtocolError(ProtocolErrorCode.InvalidParams, `Elicitation requestedSchema lists required properties that are not defined in properties: ${danglingRequired.join(", ")}`);
|
|
39685
39744
|
return {
|
|
@@ -39941,15 +40000,15 @@ var authSchemas = {
|
|
|
39941
40000
|
};
|
|
39942
40001
|
var _specTypeSchemas = {};
|
|
39943
40002
|
var _isSpecType = {};
|
|
39944
|
-
function register2(
|
|
39945
|
-
const name =
|
|
40003
|
+
function register2(key2, schema) {
|
|
40004
|
+
const name = key2.slice(0, -6);
|
|
39946
40005
|
_specTypeSchemas[name] = schema;
|
|
39947
40006
|
_isSpecType[name] = (v) => schema.safeParse(v).success;
|
|
39948
40007
|
}
|
|
39949
|
-
for (const
|
|
39950
|
-
register2(
|
|
39951
|
-
for (const [
|
|
39952
|
-
register2(
|
|
40008
|
+
for (const key2 of SPEC_SCHEMA_KEYS)
|
|
40009
|
+
register2(key2, schemas_exports[key2]);
|
|
40010
|
+
for (const [key2, schema] of Object.entries(authSchemas))
|
|
40011
|
+
register2(key2, schema);
|
|
39953
40012
|
var specTypeSchemas = Object.freeze(_specTypeSchemas);
|
|
39954
40013
|
var isSpecType = Object.freeze(_isSpecType);
|
|
39955
40014
|
function bootstrapOutboundCodec(method) {
|
|
@@ -39979,8 +40038,8 @@ function liftWireOnlyMaterial(message, kind) {
|
|
|
39979
40038
|
lifted: {}
|
|
39980
40039
|
};
|
|
39981
40040
|
const meta5 = params._meta;
|
|
39982
|
-
const envelopeKeys = isPlainObject$1(meta5) ? RESERVED_ENVELOPE_META_KEYS.filter((
|
|
39983
|
-
const retryKeys = kind === "request" ? RETRY_PARAMS_KEYS.filter((
|
|
40041
|
+
const envelopeKeys = isPlainObject$1(meta5) ? RESERVED_ENVELOPE_META_KEYS.filter((key2) => (key2 in meta5)) : [];
|
|
40042
|
+
const retryKeys = kind === "request" ? RETRY_PARAMS_KEYS.filter((key2) => (key2 in params)) : [];
|
|
39984
40043
|
if (envelopeKeys.length === 0 && retryKeys.length === 0)
|
|
39985
40044
|
return {
|
|
39986
40045
|
message,
|
|
@@ -39991,9 +40050,9 @@ function liftWireOnlyMaterial(message, kind) {
|
|
|
39991
40050
|
if (envelopeKeys.length > 0 && isPlainObject$1(meta5)) {
|
|
39992
40051
|
const envelope = {};
|
|
39993
40052
|
const nextMeta = { ...meta5 };
|
|
39994
|
-
for (const
|
|
39995
|
-
envelope[
|
|
39996
|
-
delete nextMeta[
|
|
40053
|
+
for (const key2 of envelopeKeys) {
|
|
40054
|
+
envelope[key2] = meta5[key2];
|
|
40055
|
+
delete nextMeta[key2];
|
|
39997
40056
|
}
|
|
39998
40057
|
lifted.envelope = envelope;
|
|
39999
40058
|
if (Object.keys(nextMeta).length > 0)
|
|
@@ -40001,12 +40060,12 @@ function liftWireOnlyMaterial(message, kind) {
|
|
|
40001
40060
|
else
|
|
40002
40061
|
delete nextParams._meta;
|
|
40003
40062
|
}
|
|
40004
|
-
for (const
|
|
40005
|
-
if (
|
|
40006
|
-
lifted.inputResponses = nextParams[
|
|
40007
|
-
if (
|
|
40008
|
-
lifted.requestState = nextParams[
|
|
40009
|
-
delete nextParams[
|
|
40063
|
+
for (const key2 of retryKeys) {
|
|
40064
|
+
if (key2 === "inputResponses")
|
|
40065
|
+
lifted.inputResponses = nextParams[key2];
|
|
40066
|
+
if (key2 === "requestState")
|
|
40067
|
+
lifted.requestState = nextParams[key2];
|
|
40068
|
+
delete nextParams[key2];
|
|
40010
40069
|
}
|
|
40011
40070
|
return {
|
|
40012
40071
|
message: {
|
|
@@ -40657,8 +40716,8 @@ function isPlainObject$1(value) {
|
|
|
40657
40716
|
}
|
|
40658
40717
|
function mergeCapabilities(base, additional) {
|
|
40659
40718
|
const result = { ...base };
|
|
40660
|
-
for (const
|
|
40661
|
-
const k =
|
|
40719
|
+
for (const key2 in additional) {
|
|
40720
|
+
const k = key2;
|
|
40662
40721
|
const addValue = additional[k];
|
|
40663
40722
|
if (addValue === undefined)
|
|
40664
40723
|
continue;
|
|
@@ -40681,12 +40740,12 @@ function partitionInputResponses(inputResponses) {
|
|
|
40681
40740
|
accepted,
|
|
40682
40741
|
droppedKeys
|
|
40683
40742
|
};
|
|
40684
|
-
for (const [
|
|
40743
|
+
for (const [key2, entry] of Object.entries(inputResponses)) {
|
|
40685
40744
|
if (!isPlainObject2(entry) || "method" in entry || "result" in entry) {
|
|
40686
|
-
droppedKeys.push(
|
|
40745
|
+
droppedKeys.push(key2);
|
|
40687
40746
|
continue;
|
|
40688
40747
|
}
|
|
40689
|
-
accepted[
|
|
40748
|
+
accepted[key2] = entry;
|
|
40690
40749
|
}
|
|
40691
40750
|
return {
|
|
40692
40751
|
accepted,
|
|
@@ -40723,7 +40782,7 @@ var require_content_type = /* @__PURE__ */ __commonJSMin((exports) => {
|
|
|
40723
40782
|
throw new TypeError("invalid media type");
|
|
40724
40783
|
var obj = new ContentType(type.toLowerCase());
|
|
40725
40784
|
if (index2 !== -1) {
|
|
40726
|
-
var
|
|
40785
|
+
var key2;
|
|
40727
40786
|
var match2;
|
|
40728
40787
|
var value;
|
|
40729
40788
|
PARAM_REGEXP.lastIndex = index2;
|
|
@@ -40731,14 +40790,14 @@ var require_content_type = /* @__PURE__ */ __commonJSMin((exports) => {
|
|
|
40731
40790
|
if (match2.index !== index2)
|
|
40732
40791
|
throw new TypeError("invalid parameter format");
|
|
40733
40792
|
index2 += match2[0].length;
|
|
40734
|
-
|
|
40793
|
+
key2 = match2[1].toLowerCase();
|
|
40735
40794
|
value = match2[2];
|
|
40736
40795
|
if (value.charCodeAt(0) === 34) {
|
|
40737
40796
|
value = value.slice(1, -1);
|
|
40738
40797
|
if (value.indexOf("\\") !== -1)
|
|
40739
40798
|
value = value.replace(QESC_REGEXP, "$1");
|
|
40740
40799
|
}
|
|
40741
|
-
obj.parameters[
|
|
40800
|
+
obj.parameters[key2] = value;
|
|
40742
40801
|
}
|
|
40743
40802
|
if (index2 !== header.length)
|
|
40744
40803
|
throw new TypeError("invalid parameter format");
|
|
@@ -40989,14 +41048,14 @@ var require_code$1 = /* @__PURE__ */ __commonJSMin((exports) => {
|
|
|
40989
41048
|
return JSON.stringify(x).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
40990
41049
|
}
|
|
40991
41050
|
exports.safeStringify = safeStringify;
|
|
40992
|
-
function getProperty(
|
|
40993
|
-
return typeof
|
|
41051
|
+
function getProperty(key2) {
|
|
41052
|
+
return typeof key2 == "string" && exports.IDENTIFIER.test(key2) ? new _Code(`.${key2}`) : _2`[${key2}]`;
|
|
40994
41053
|
}
|
|
40995
41054
|
exports.getProperty = getProperty;
|
|
40996
|
-
function getEsmExportName(
|
|
40997
|
-
if (typeof
|
|
40998
|
-
return new _Code(`${
|
|
40999
|
-
throw new Error(`CodeGen: invalid export name: ${
|
|
41055
|
+
function getEsmExportName(key2) {
|
|
41056
|
+
if (typeof key2 == "string" && exports.IDENTIFIER.test(key2))
|
|
41057
|
+
return new _Code(`${key2}`);
|
|
41058
|
+
throw new Error(`CodeGen: invalid export name: ${key2}, use explicit $id name mapping`);
|
|
41000
41059
|
}
|
|
41001
41060
|
exports.getEsmExportName = getEsmExportName;
|
|
41002
41061
|
function regexpCode(rx) {
|
|
@@ -41642,11 +41701,11 @@ var require_codegen = /* @__PURE__ */ __commonJSMin((exports) => {
|
|
|
41642
41701
|
}
|
|
41643
41702
|
object(...keyValues) {
|
|
41644
41703
|
const code = ["{"];
|
|
41645
|
-
for (const [
|
|
41704
|
+
for (const [key2, value] of keyValues) {
|
|
41646
41705
|
if (code.length > 1)
|
|
41647
41706
|
code.push(",");
|
|
41648
|
-
code.push(
|
|
41649
|
-
if (
|
|
41707
|
+
code.push(key2);
|
|
41708
|
+
if (key2 !== value || this.opts.es5) {
|
|
41650
41709
|
code.push(":");
|
|
41651
41710
|
(0, code_1.addCodeArg)(code, value);
|
|
41652
41711
|
}
|
|
@@ -41893,16 +41952,16 @@ var require_util = /* @__PURE__ */ __commonJSMin((exports) => {
|
|
|
41893
41952
|
if (typeof schema === "boolean")
|
|
41894
41953
|
return;
|
|
41895
41954
|
const rules = self.RULES.keywords;
|
|
41896
|
-
for (const
|
|
41897
|
-
if (!rules[
|
|
41898
|
-
checkStrictMode(it, `unknown keyword: "${
|
|
41955
|
+
for (const key2 in schema)
|
|
41956
|
+
if (!rules[key2])
|
|
41957
|
+
checkStrictMode(it, `unknown keyword: "${key2}"`);
|
|
41899
41958
|
}
|
|
41900
41959
|
exports.checkUnknownRules = checkUnknownRules;
|
|
41901
41960
|
function schemaHasRules(schema, rules) {
|
|
41902
41961
|
if (typeof schema == "boolean")
|
|
41903
41962
|
return !schema;
|
|
41904
|
-
for (const
|
|
41905
|
-
if (rules[
|
|
41963
|
+
for (const key2 in schema)
|
|
41964
|
+
if (rules[key2])
|
|
41906
41965
|
return true;
|
|
41907
41966
|
return false;
|
|
41908
41967
|
}
|
|
@@ -41910,8 +41969,8 @@ var require_util = /* @__PURE__ */ __commonJSMin((exports) => {
|
|
|
41910
41969
|
function schemaHasRulesButRef(schema, RULES) {
|
|
41911
41970
|
if (typeof schema == "boolean")
|
|
41912
41971
|
return !schema;
|
|
41913
|
-
for (const
|
|
41914
|
-
if (
|
|
41972
|
+
for (const key2 in schema)
|
|
41973
|
+
if (key2 !== "$ref" && RULES.all[key2])
|
|
41915
41974
|
return true;
|
|
41916
41975
|
return false;
|
|
41917
41976
|
}
|
|
@@ -42457,8 +42516,8 @@ var require_defaults = /* @__PURE__ */ __commonJSMin((exports) => {
|
|
|
42457
42516
|
function assignDefaults(it, ty) {
|
|
42458
42517
|
const { properties, items } = it.schema;
|
|
42459
42518
|
if (ty === "object" && properties)
|
|
42460
|
-
for (const
|
|
42461
|
-
assignDefault(it,
|
|
42519
|
+
for (const key2 in properties)
|
|
42520
|
+
assignDefault(it, key2, properties[key2].default);
|
|
42462
42521
|
else if (ty === "array" && Array.isArray(items))
|
|
42463
42522
|
items.forEach((sch, i2) => assignDefault(it, i2, sch.default));
|
|
42464
42523
|
}
|
|
@@ -42819,8 +42878,8 @@ var require_fast_deep_equal = /* @__PURE__ */ __commonJSMin((exports, module) =>
|
|
|
42819
42878
|
if (!Object.prototype.hasOwnProperty.call(b2, keys[i2]))
|
|
42820
42879
|
return false;
|
|
42821
42880
|
for (i2 = length;i2-- !== 0; ) {
|
|
42822
|
-
var
|
|
42823
|
-
if (!equal(a2[
|
|
42881
|
+
var key2 = keys[i2];
|
|
42882
|
+
if (!equal(a2[key2], b2[key2]))
|
|
42824
42883
|
return false;
|
|
42825
42884
|
}
|
|
42826
42885
|
return true;
|
|
@@ -42886,18 +42945,18 @@ var require_json_schema_traverse = /* @__PURE__ */ __commonJSMin((exports, modul
|
|
|
42886
42945
|
function _traverse(opts, pre, post, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
|
|
42887
42946
|
if (schema && typeof schema == "object" && !Array.isArray(schema)) {
|
|
42888
42947
|
pre(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
42889
|
-
for (var
|
|
42890
|
-
var sch = schema[
|
|
42948
|
+
for (var key2 in schema) {
|
|
42949
|
+
var sch = schema[key2];
|
|
42891
42950
|
if (Array.isArray(sch)) {
|
|
42892
|
-
if (
|
|
42951
|
+
if (key2 in traverse.arrayKeywords)
|
|
42893
42952
|
for (var i2 = 0;i2 < sch.length; i2++)
|
|
42894
|
-
_traverse(opts, pre, post, sch[i2], jsonPtr + "/" +
|
|
42895
|
-
} else if (
|
|
42953
|
+
_traverse(opts, pre, post, sch[i2], jsonPtr + "/" + key2 + "/" + i2, rootSchema, jsonPtr, key2, schema, i2);
|
|
42954
|
+
} else if (key2 in traverse.propsKeywords) {
|
|
42896
42955
|
if (sch && typeof sch == "object")
|
|
42897
42956
|
for (var prop in sch)
|
|
42898
|
-
_traverse(opts, pre, post, sch[prop], jsonPtr + "/" +
|
|
42899
|
-
} else if (
|
|
42900
|
-
_traverse(opts, pre, post, sch, jsonPtr + "/" +
|
|
42957
|
+
_traverse(opts, pre, post, sch[prop], jsonPtr + "/" + key2 + "/" + escapeJsonPtr(prop), rootSchema, jsonPtr, key2, schema, prop);
|
|
42958
|
+
} else if (key2 in traverse.keywords || opts.allKeys && !(key2 in traverse.skipKeywords))
|
|
42959
|
+
_traverse(opts, pre, post, sch, jsonPtr + "/" + key2, rootSchema, jsonPtr, key2, schema);
|
|
42901
42960
|
}
|
|
42902
42961
|
post(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
42903
42962
|
}
|
|
@@ -42948,10 +43007,10 @@ var require_resolve = /* @__PURE__ */ __commonJSMin((exports) => {
|
|
|
42948
43007
|
"$dynamicAnchor"
|
|
42949
43008
|
]);
|
|
42950
43009
|
function hasRef(schema) {
|
|
42951
|
-
for (const
|
|
42952
|
-
if (REF_KEYWORDS.has(
|
|
43010
|
+
for (const key2 in schema) {
|
|
43011
|
+
if (REF_KEYWORDS.has(key2))
|
|
42953
43012
|
return true;
|
|
42954
|
-
const sch = schema[
|
|
43013
|
+
const sch = schema[key2];
|
|
42955
43014
|
if (Array.isArray(sch) && sch.some(hasRef))
|
|
42956
43015
|
return true;
|
|
42957
43016
|
if (typeof sch == "object" && hasRef(sch))
|
|
@@ -42961,14 +43020,14 @@ var require_resolve = /* @__PURE__ */ __commonJSMin((exports) => {
|
|
|
42961
43020
|
}
|
|
42962
43021
|
function countKeys(schema) {
|
|
42963
43022
|
let count2 = 0;
|
|
42964
|
-
for (const
|
|
42965
|
-
if (
|
|
43023
|
+
for (const key2 in schema) {
|
|
43024
|
+
if (key2 === "$ref")
|
|
42966
43025
|
return Infinity;
|
|
42967
43026
|
count2++;
|
|
42968
|
-
if (SIMPLE_INLINED.has(
|
|
43027
|
+
if (SIMPLE_INLINED.has(key2))
|
|
42969
43028
|
continue;
|
|
42970
|
-
if (typeof schema[
|
|
42971
|
-
(0, util_1.eachItem)(schema[
|
|
43029
|
+
if (typeof schema[key2] == "object")
|
|
43030
|
+
(0, util_1.eachItem)(schema[key2], (sch) => count2 += countKeys(sch));
|
|
42972
43031
|
if (count2 === Infinity)
|
|
42973
43032
|
return Infinity;
|
|
42974
43033
|
}
|
|
@@ -43145,8 +43204,8 @@ var require_validate = /* @__PURE__ */ __commonJSMin((exports) => {
|
|
|
43145
43204
|
function schemaCxtHasRules({ schema, self }) {
|
|
43146
43205
|
if (typeof schema == "boolean")
|
|
43147
43206
|
return !schema;
|
|
43148
|
-
for (const
|
|
43149
|
-
if (self.RULES.all[
|
|
43207
|
+
for (const key2 in schema)
|
|
43208
|
+
if (self.RULES.all[key2])
|
|
43150
43209
|
return true;
|
|
43151
43210
|
return false;
|
|
43152
43211
|
}
|
|
@@ -45106,7 +45165,7 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin((exports) => {
|
|
|
45106
45165
|
}
|
|
45107
45166
|
}
|
|
45108
45167
|
}
|
|
45109
|
-
addSchema(schema,
|
|
45168
|
+
addSchema(schema, key2, _meta, _validateSchema = this.opts.validateSchema) {
|
|
45110
45169
|
if (Array.isArray(schema)) {
|
|
45111
45170
|
for (const sch of schema)
|
|
45112
45171
|
this.addSchema(sch, undefined, _meta, _validateSchema);
|
|
@@ -45119,13 +45178,13 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin((exports) => {
|
|
|
45119
45178
|
if (id2 !== undefined && typeof id2 != "string")
|
|
45120
45179
|
throw new Error(`schema ${schemaId} must be string`);
|
|
45121
45180
|
}
|
|
45122
|
-
|
|
45123
|
-
this._checkUnique(
|
|
45124
|
-
this.schemas[
|
|
45181
|
+
key2 = (0, resolve_1.normalizeId)(key2 || id2);
|
|
45182
|
+
this._checkUnique(key2);
|
|
45183
|
+
this.schemas[key2] = this._addSchema(schema, _meta, key2, _validateSchema, true);
|
|
45125
45184
|
return this;
|
|
45126
45185
|
}
|
|
45127
|
-
addMetaSchema(schema,
|
|
45128
|
-
this.addSchema(schema,
|
|
45186
|
+
addMetaSchema(schema, key2, _validateSchema = this.opts.validateSchema) {
|
|
45187
|
+
this.addSchema(schema, key2, true, _validateSchema);
|
|
45129
45188
|
return this;
|
|
45130
45189
|
}
|
|
45131
45190
|
validateSchema(schema, throwOrLogError) {
|
|
@@ -45271,14 +45330,14 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin((exports) => {
|
|
|
45271
45330
|
let keywords = metaSchema;
|
|
45272
45331
|
for (const seg of segments)
|
|
45273
45332
|
keywords = keywords[seg];
|
|
45274
|
-
for (const
|
|
45275
|
-
const rule = rules[
|
|
45333
|
+
for (const key2 in rules) {
|
|
45334
|
+
const rule = rules[key2];
|
|
45276
45335
|
if (typeof rule != "object")
|
|
45277
45336
|
continue;
|
|
45278
45337
|
const { $data } = rule.definition;
|
|
45279
|
-
const schema = keywords[
|
|
45338
|
+
const schema = keywords[key2];
|
|
45280
45339
|
if ($data && schema)
|
|
45281
|
-
keywords[
|
|
45340
|
+
keywords[key2] = schemaOrData(schema);
|
|
45282
45341
|
}
|
|
45283
45342
|
}
|
|
45284
45343
|
return metaSchema;
|
|
@@ -45354,10 +45413,10 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin((exports) => {
|
|
|
45354
45413
|
Ajv.MissingRefError = ref_error_1.default;
|
|
45355
45414
|
exports.default = Ajv;
|
|
45356
45415
|
function checkOptions(checkOpts, options2, msg, log2 = "error") {
|
|
45357
|
-
for (const
|
|
45358
|
-
const opt =
|
|
45416
|
+
for (const key2 in checkOpts) {
|
|
45417
|
+
const opt = key2;
|
|
45359
45418
|
if (opt in options2)
|
|
45360
|
-
this.logger[log2](`${msg}: option ${
|
|
45419
|
+
this.logger[log2](`${msg}: option ${key2}. ${checkOpts[opt]}`);
|
|
45361
45420
|
}
|
|
45362
45421
|
}
|
|
45363
45422
|
function getSchEnv(keyRef) {
|
|
@@ -45371,8 +45430,8 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin((exports) => {
|
|
|
45371
45430
|
if (Array.isArray(optsSchemas))
|
|
45372
45431
|
this.addSchema(optsSchemas);
|
|
45373
45432
|
else
|
|
45374
|
-
for (const
|
|
45375
|
-
this.addSchema(optsSchemas[
|
|
45433
|
+
for (const key2 in optsSchemas)
|
|
45434
|
+
this.addSchema(optsSchemas[key2], key2);
|
|
45376
45435
|
}
|
|
45377
45436
|
function addInitialFormats() {
|
|
45378
45437
|
for (const name in this.opts.formats) {
|
|
@@ -46319,11 +46378,11 @@ var require_dependencies = /* @__PURE__ */ __commonJSMin((exports) => {
|
|
|
46319
46378
|
function splitDependencies({ schema }) {
|
|
46320
46379
|
const propertyDeps = {};
|
|
46321
46380
|
const schemaDeps = {};
|
|
46322
|
-
for (const
|
|
46323
|
-
if (
|
|
46381
|
+
for (const key2 in schema) {
|
|
46382
|
+
if (key2 === "__proto__")
|
|
46324
46383
|
continue;
|
|
46325
|
-
const deps = Array.isArray(schema[
|
|
46326
|
-
deps[
|
|
46384
|
+
const deps = Array.isArray(schema[key2]) ? propertyDeps : schemaDeps;
|
|
46385
|
+
deps[key2] = schema[key2];
|
|
46327
46386
|
}
|
|
46328
46387
|
return [propertyDeps, schemaDeps];
|
|
46329
46388
|
}
|
|
@@ -46391,13 +46450,13 @@ var require_propertyNames = /* @__PURE__ */ __commonJSMin((exports) => {
|
|
|
46391
46450
|
if ((0, util_1.alwaysValidSchema)(it, schema))
|
|
46392
46451
|
return;
|
|
46393
46452
|
const valid = gen.name("valid");
|
|
46394
|
-
gen.forIn("key", data, (
|
|
46395
|
-
cxt.setParams({ propertyName:
|
|
46453
|
+
gen.forIn("key", data, (key2) => {
|
|
46454
|
+
cxt.setParams({ propertyName: key2 });
|
|
46396
46455
|
cxt.subschema({
|
|
46397
46456
|
keyword: "propertyNames",
|
|
46398
|
-
data:
|
|
46457
|
+
data: key2,
|
|
46399
46458
|
dataTypes: ["string"],
|
|
46400
|
-
propertyName:
|
|
46459
|
+
propertyName: key2,
|
|
46401
46460
|
compositeRule: true
|
|
46402
46461
|
}, valid);
|
|
46403
46462
|
gen.if((0, codegen_1.not)(valid), () => {
|
|
@@ -46440,36 +46499,36 @@ var require_additionalProperties = /* @__PURE__ */ __commonJSMin((exports) => {
|
|
|
46440
46499
|
checkAdditionalProperties();
|
|
46441
46500
|
cxt.ok((0, codegen_1._)`${errsCount} === ${names_1.default.errors}`);
|
|
46442
46501
|
function checkAdditionalProperties() {
|
|
46443
|
-
gen.forIn("key", data, (
|
|
46502
|
+
gen.forIn("key", data, (key2) => {
|
|
46444
46503
|
if (!props.length && !patProps.length)
|
|
46445
|
-
additionalPropertyCode(
|
|
46504
|
+
additionalPropertyCode(key2);
|
|
46446
46505
|
else
|
|
46447
|
-
gen.if(isAdditional(
|
|
46506
|
+
gen.if(isAdditional(key2), () => additionalPropertyCode(key2));
|
|
46448
46507
|
});
|
|
46449
46508
|
}
|
|
46450
|
-
function isAdditional(
|
|
46509
|
+
function isAdditional(key2) {
|
|
46451
46510
|
let definedProp;
|
|
46452
46511
|
if (props.length > 8) {
|
|
46453
46512
|
const propsSchema = (0, util_1.schemaRefOrVal)(it, parentSchema.properties, "properties");
|
|
46454
|
-
definedProp = (0, code_1.isOwnProperty)(gen, propsSchema,
|
|
46513
|
+
definedProp = (0, code_1.isOwnProperty)(gen, propsSchema, key2);
|
|
46455
46514
|
} else if (props.length)
|
|
46456
|
-
definedProp = (0, codegen_1.or)(...props.map((p2) => (0, codegen_1._)`${
|
|
46515
|
+
definedProp = (0, codegen_1.or)(...props.map((p2) => (0, codegen_1._)`${key2} === ${p2}`));
|
|
46457
46516
|
else
|
|
46458
46517
|
definedProp = codegen_1.nil;
|
|
46459
46518
|
if (patProps.length)
|
|
46460
|
-
definedProp = (0, codegen_1.or)(definedProp, ...patProps.map((p2) => (0, codegen_1._)`${(0, code_1.usePattern)(cxt, p2)}.test(${
|
|
46519
|
+
definedProp = (0, codegen_1.or)(definedProp, ...patProps.map((p2) => (0, codegen_1._)`${(0, code_1.usePattern)(cxt, p2)}.test(${key2})`));
|
|
46461
46520
|
return (0, codegen_1.not)(definedProp);
|
|
46462
46521
|
}
|
|
46463
|
-
function deleteAdditional(
|
|
46464
|
-
gen.code((0, codegen_1._)`delete ${data}[${
|
|
46522
|
+
function deleteAdditional(key2) {
|
|
46523
|
+
gen.code((0, codegen_1._)`delete ${data}[${key2}]`);
|
|
46465
46524
|
}
|
|
46466
|
-
function additionalPropertyCode(
|
|
46525
|
+
function additionalPropertyCode(key2) {
|
|
46467
46526
|
if (opts.removeAdditional === "all" || opts.removeAdditional && schema === false) {
|
|
46468
|
-
deleteAdditional(
|
|
46527
|
+
deleteAdditional(key2);
|
|
46469
46528
|
return;
|
|
46470
46529
|
}
|
|
46471
46530
|
if (schema === false) {
|
|
46472
|
-
cxt.setParams({ additionalProperty:
|
|
46531
|
+
cxt.setParams({ additionalProperty: key2 });
|
|
46473
46532
|
cxt.error();
|
|
46474
46533
|
if (!allErrors)
|
|
46475
46534
|
gen.break();
|
|
@@ -46478,22 +46537,22 @@ var require_additionalProperties = /* @__PURE__ */ __commonJSMin((exports) => {
|
|
|
46478
46537
|
if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) {
|
|
46479
46538
|
const valid = gen.name("valid");
|
|
46480
46539
|
if (opts.removeAdditional === "failing") {
|
|
46481
|
-
applyAdditionalSchema(
|
|
46540
|
+
applyAdditionalSchema(key2, valid, false);
|
|
46482
46541
|
gen.if((0, codegen_1.not)(valid), () => {
|
|
46483
46542
|
cxt.reset();
|
|
46484
|
-
deleteAdditional(
|
|
46543
|
+
deleteAdditional(key2);
|
|
46485
46544
|
});
|
|
46486
46545
|
} else {
|
|
46487
|
-
applyAdditionalSchema(
|
|
46546
|
+
applyAdditionalSchema(key2, valid);
|
|
46488
46547
|
if (!allErrors)
|
|
46489
46548
|
gen.if((0, codegen_1.not)(valid), () => gen.break());
|
|
46490
46549
|
}
|
|
46491
46550
|
}
|
|
46492
46551
|
}
|
|
46493
|
-
function applyAdditionalSchema(
|
|
46552
|
+
function applyAdditionalSchema(key2, valid, errors3) {
|
|
46494
46553
|
const subschema = {
|
|
46495
46554
|
keyword: "additionalProperties",
|
|
46496
|
-
dataProp:
|
|
46555
|
+
dataProp: key2,
|
|
46497
46556
|
dataPropType: util_1.Type.Str
|
|
46498
46557
|
};
|
|
46499
46558
|
if (errors3 === false)
|
|
@@ -46600,18 +46659,18 @@ var require_patternProperties = /* @__PURE__ */ __commonJSMin((exports) => {
|
|
|
46600
46659
|
(0, util_1.checkStrictMode)(it, `property ${prop} matches pattern ${pat} (use allowMatchingProperties)`);
|
|
46601
46660
|
}
|
|
46602
46661
|
function validateProperties(pat) {
|
|
46603
|
-
gen.forIn("key", data, (
|
|
46604
|
-
gen.if((0, codegen_1._)`${(0, code_1.usePattern)(cxt, pat)}.test(${
|
|
46662
|
+
gen.forIn("key", data, (key2) => {
|
|
46663
|
+
gen.if((0, codegen_1._)`${(0, code_1.usePattern)(cxt, pat)}.test(${key2})`, () => {
|
|
46605
46664
|
const alwaysValid = alwaysValidPatterns.includes(pat);
|
|
46606
46665
|
if (!alwaysValid)
|
|
46607
46666
|
cxt.subschema({
|
|
46608
46667
|
keyword: "patternProperties",
|
|
46609
46668
|
schemaProp: pat,
|
|
46610
|
-
dataProp:
|
|
46669
|
+
dataProp: key2,
|
|
46611
46670
|
dataPropType: util_2.Type.Str
|
|
46612
46671
|
}, valid);
|
|
46613
46672
|
if (it.opts.unevaluated && props !== true)
|
|
46614
|
-
gen.assign((0, codegen_1._)`${props}[${
|
|
46673
|
+
gen.assign((0, codegen_1._)`${props}[${key2}]`, true);
|
|
46615
46674
|
else if (!alwaysValid && !it.allErrors)
|
|
46616
46675
|
gen.if((0, codegen_1.not)(valid), () => gen.break());
|
|
46617
46676
|
});
|
|
@@ -47511,14 +47570,14 @@ var require_unevaluatedProperties = /* @__PURE__ */ __commonJSMin((exports) => {
|
|
|
47511
47570
|
throw new Error("ajv implementation error");
|
|
47512
47571
|
const { allErrors, props } = it;
|
|
47513
47572
|
if (props instanceof codegen_1.Name)
|
|
47514
|
-
gen.if((0, codegen_1._)`${props} !== true`, () => gen.forIn("key", data, (
|
|
47573
|
+
gen.if((0, codegen_1._)`${props} !== true`, () => gen.forIn("key", data, (key2) => gen.if(unevaluatedDynamic(props, key2), () => unevaluatedPropCode(key2))));
|
|
47515
47574
|
else if (props !== true)
|
|
47516
|
-
gen.forIn("key", data, (
|
|
47575
|
+
gen.forIn("key", data, (key2) => props === undefined ? unevaluatedPropCode(key2) : gen.if(unevaluatedStatic(props, key2), () => unevaluatedPropCode(key2)));
|
|
47517
47576
|
it.props = true;
|
|
47518
47577
|
cxt.ok((0, codegen_1._)`${errsCount} === ${names_1.default.errors}`);
|
|
47519
|
-
function unevaluatedPropCode(
|
|
47578
|
+
function unevaluatedPropCode(key2) {
|
|
47520
47579
|
if (schema === false) {
|
|
47521
|
-
cxt.setParams({ unevaluatedProperty:
|
|
47580
|
+
cxt.setParams({ unevaluatedProperty: key2 });
|
|
47522
47581
|
cxt.error();
|
|
47523
47582
|
if (!allErrors)
|
|
47524
47583
|
gen.break();
|
|
@@ -47528,21 +47587,21 @@ var require_unevaluatedProperties = /* @__PURE__ */ __commonJSMin((exports) => {
|
|
|
47528
47587
|
const valid = gen.name("valid");
|
|
47529
47588
|
cxt.subschema({
|
|
47530
47589
|
keyword: "unevaluatedProperties",
|
|
47531
|
-
dataProp:
|
|
47590
|
+
dataProp: key2,
|
|
47532
47591
|
dataPropType: util_1.Type.Str
|
|
47533
47592
|
}, valid);
|
|
47534
47593
|
if (!allErrors)
|
|
47535
47594
|
gen.if((0, codegen_1.not)(valid), () => gen.break());
|
|
47536
47595
|
}
|
|
47537
47596
|
}
|
|
47538
|
-
function unevaluatedDynamic(evaluatedProps,
|
|
47539
|
-
return (0, codegen_1._)`!${evaluatedProps} || !${evaluatedProps}[${
|
|
47597
|
+
function unevaluatedDynamic(evaluatedProps, key2) {
|
|
47598
|
+
return (0, codegen_1._)`!${evaluatedProps} || !${evaluatedProps}[${key2}]`;
|
|
47540
47599
|
}
|
|
47541
|
-
function unevaluatedStatic(evaluatedProps,
|
|
47600
|
+
function unevaluatedStatic(evaluatedProps, key2) {
|
|
47542
47601
|
const ps = [];
|
|
47543
47602
|
for (const p2 in evaluatedProps)
|
|
47544
47603
|
if (evaluatedProps[p2] === true)
|
|
47545
|
-
ps.push((0, codegen_1._)`${
|
|
47604
|
+
ps.push((0, codegen_1._)`${key2} !== ${p2}`);
|
|
47546
47605
|
return (0, codegen_1.and)(...ps);
|
|
47547
47606
|
}
|
|
47548
47607
|
}
|
|
@@ -49163,13 +49222,13 @@ function resolveLegacyShimOptions(options2) {
|
|
|
49163
49222
|
legacyShim: options2?.legacyShim ?? true
|
|
49164
49223
|
};
|
|
49165
49224
|
}
|
|
49166
|
-
function coerceEmbeddedInputRequest(method,
|
|
49225
|
+
function coerceEmbeddedInputRequest(method, key2, entry) {
|
|
49167
49226
|
if (entry === null || typeof entry !== "object" || typeof entry.method !== "string")
|
|
49168
|
-
throw new ProtocolError(ProtocolErrorCode.InternalError, `Handler for ${method} returned an invalid input request '${
|
|
49227
|
+
throw new ProtocolError(ProtocolErrorCode.InternalError, `Handler for ${method} returned an invalid input request '${key2}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);
|
|
49169
49228
|
const embedded = entry;
|
|
49170
49229
|
const required3 = requiredClientCapabilitiesForInputRequest(embedded);
|
|
49171
49230
|
if (required3 === undefined)
|
|
49172
|
-
throw new ProtocolError(ProtocolErrorCode.InternalError, `Handler for ${method} returned an input request '${
|
|
49231
|
+
throw new ProtocolError(ProtocolErrorCode.InternalError, `Handler for ${method} returned an input request '${key2}' of kind '${embedded.method}', which is not an embedded request the 2026-07-28 revision defines`);
|
|
49173
49232
|
return {
|
|
49174
49233
|
embedded,
|
|
49175
49234
|
required: required3
|
|
@@ -49219,13 +49278,13 @@ var LegacyInputRequiredShim = class {
|
|
|
49219
49278
|
if (hasInputRequests) {
|
|
49220
49279
|
const declared = this._host.resolvedClientCapabilities(ctx);
|
|
49221
49280
|
const coerced = [];
|
|
49222
|
-
for (const [
|
|
49223
|
-
const { embedded, required: required3 } = coerceEmbeddedInputRequest(method,
|
|
49281
|
+
for (const [key2, entry] of Object.entries(inputRequests)) {
|
|
49282
|
+
const { embedded, required: required3 } = coerceEmbeddedInputRequest(method, key2, entry);
|
|
49224
49283
|
if (embedded.method !== "roots/list" && embedded.params === undefined)
|
|
49225
|
-
throw new ProtocolError(ProtocolErrorCode.InternalError, `Handler for ${method} returned an input request '${
|
|
49284
|
+
throw new ProtocolError(ProtocolErrorCode.InternalError, `Handler for ${method} returned an input request '${key2}' of kind '${embedded.method}' without params`);
|
|
49226
49285
|
if (missingClientCapabilities(required3, declared) !== undefined)
|
|
49227
|
-
return legacyShimFailure(method, `Cannot request input '${
|
|
49228
|
-
coerced.push([
|
|
49286
|
+
return legacyShimFailure(method, `Cannot request input '${key2}' (${embedded.method}): the client on this 2025-era connection did not declare the required capability${declared === undefined ? " (no client capabilities are available on this connection \u2014 per-request legacy serving cannot receive server-to-client requests)" : ""}`);
|
|
49287
|
+
coerced.push([key2, embedded]);
|
|
49229
49288
|
}
|
|
49230
49289
|
const roundAbort = linkedRoundAbort(outerSignal);
|
|
49231
49290
|
try {
|
|
@@ -49236,9 +49295,9 @@ var LegacyInputRequiredShim = class {
|
|
|
49236
49295
|
onprogress: () => {},
|
|
49237
49296
|
signal: roundAbort.signal
|
|
49238
49297
|
};
|
|
49239
|
-
const fulfilled = await Promise.all(coerced.map(async ([
|
|
49298
|
+
const fulfilled = await Promise.all(coerced.map(async ([key2, embedded]) => {
|
|
49240
49299
|
try {
|
|
49241
|
-
return [
|
|
49300
|
+
return [key2, await this._dispatchLeg(embedded, legOptions)];
|
|
49242
49301
|
} catch (error62) {
|
|
49243
49302
|
roundAbort.abort(error62);
|
|
49244
49303
|
throw error62;
|
|
@@ -49519,11 +49578,11 @@ var Server = class extends Protocol {
|
|
|
49519
49578
|
throw new ProtocolError(ProtocolErrorCode.InternalError, `Handler for ${method} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);
|
|
49520
49579
|
if (hasInputRequests) {
|
|
49521
49580
|
const declared = this._inputRequestCapabilityView(ctx);
|
|
49522
|
-
for (const [
|
|
49523
|
-
const { embedded, required: required3 } = coerceEmbeddedInputRequest(method,
|
|
49581
|
+
for (const [key2, entry] of Object.entries(inputRequests)) {
|
|
49582
|
+
const { embedded, required: required3 } = coerceEmbeddedInputRequest(method, key2, entry);
|
|
49524
49583
|
const missing = missingClientCapabilities(required3, declared);
|
|
49525
49584
|
if (missing !== undefined)
|
|
49526
|
-
throw new MissingRequiredClientCapabilityError({ requiredCapabilities: missing }, `Cannot request input '${
|
|
49585
|
+
throw new MissingRequiredClientCapabilityError({ requiredCapabilities: missing }, `Cannot request input '${key2}' (${embedded.method}): the request's client capabilities do not declare the required capability`);
|
|
49527
49586
|
}
|
|
49528
49587
|
}
|
|
49529
49588
|
return result;
|
|
@@ -49808,12 +49867,12 @@ function toolInputElementCount(value, max) {
|
|
|
49808
49867
|
stack.push(child);
|
|
49809
49868
|
}
|
|
49810
49869
|
else
|
|
49811
|
-
for (const
|
|
49812
|
-
if (!Object.prototype.hasOwnProperty.call(node2,
|
|
49870
|
+
for (const key2 in node2) {
|
|
49871
|
+
if (!Object.prototype.hasOwnProperty.call(node2, key2))
|
|
49813
49872
|
continue;
|
|
49814
49873
|
if (++count2 > max)
|
|
49815
49874
|
return count2;
|
|
49816
|
-
const child = node2[
|
|
49875
|
+
const child = node2[key2];
|
|
49817
49876
|
if (child !== null && typeof child === "object")
|
|
49818
49877
|
stack.push(child);
|
|
49819
49878
|
}
|
|
@@ -52043,7 +52102,7 @@ async function startServer({
|
|
|
52043
52102
|
store = config2.s3 ? createS3Store(config2.s3) : undefined,
|
|
52044
52103
|
fetch: fetch2
|
|
52045
52104
|
}) {
|
|
52046
|
-
const database = openDatabase({ path: databasePath, migrationsFolder });
|
|
52105
|
+
const database = openDatabase({ path: databasePath, migrationsFolder, secret: config2.secret });
|
|
52047
52106
|
let handleRequest = startingResponse;
|
|
52048
52107
|
const server = Bun.serve({
|
|
52049
52108
|
hostname: "127.0.0.1",
|
|
@@ -52613,5 +52672,5 @@ try {
|
|
|
52613
52672
|
process.exitCode = 1;
|
|
52614
52673
|
}
|
|
52615
52674
|
|
|
52616
|
-
//# debugId=
|
|
52675
|
+
//# debugId=0F36EC3652814C0464756E2164756E21
|
|
52617
52676
|
//# sourceMappingURL=main.js.map
|