@artil-ai/server 0.1.2 → 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/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.1.2";
22329
+ var version2 = "0.2.0";
22330
22330
 
22331
22331
  // src/app/cli.ts
22332
22332
  import { parseArgs } from "util";
@@ -24091,11 +24091,28 @@ function createAddressCommands({ agents, addresses, out }) {
24091
24091
  ]);
24092
24092
  }
24093
24093
 
24094
+ // src/platform/artil-cli.ts
24095
+ var {$ } = globalThis.Bun;
24096
+ function loginCommand(baseUrl) {
24097
+ return `artil auth login --base-url ${baseUrl}`;
24098
+ }
24099
+ function findArtilCli() {
24100
+ return {
24101
+ installed: Bun.which("artil") !== null,
24102
+ async install() {
24103
+ const installed = await $`bun install --global artil-ai`.nothrow().quiet();
24104
+ if (installed.exitCode !== 0) {
24105
+ throw new Error(installed.stderr.toString().trim() || `bun install exited with ${installed.exitCode}`);
24106
+ }
24107
+ }
24108
+ };
24109
+ }
24110
+
24094
24111
  // src/domains/agents/commands.ts
24095
24112
  function signInGuide({ baseUrl, names }) {
24096
24113
  return [
24097
24114
  `Sign ${names.length === 1 ? "the agent" : "each agent"} in from its client:`,
24098
- ...names.map((name) => ` ARTIL_BASE_URL=${baseUrl} artil auth login --account ${shellQuoted(name)}`),
24115
+ ...names.map((name) => ` ${loginCommand(baseUrl)} --account ${shellQuoted(name)}`),
24099
24116
  `MCP clients connect to ${baseUrl}/mcp and sign in on the page it opens.`,
24100
24117
  "On a computer without a browser, make a token with: artil-server account token <name>"
24101
24118
  ].join(`
@@ -24142,7 +24159,7 @@ function createAgentCommands({
24142
24159
  const token = tokens.issue({ agentId: agent.id, name: "artil-server account token" });
24143
24160
  out([
24144
24161
  `A token for ${agent.name}. Keep it secret; it signs in as the agent until you revoke it.`,
24145
- ` ARTIL_BASE_URL=${await baseUrl()} artil auth login --token ${token}`
24162
+ ` ${loginCommand(await baseUrl())} --token ${token}`
24146
24163
  ].join(`
24147
24164
  `));
24148
24165
  }
@@ -29929,13 +29946,65 @@ function migrate(db, config2) {
29929
29946
  db.dialect.migrate(migrations, db.session, config2);
29930
29947
  }
29931
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
+
29932
30000
  // src/platform/db/connection.ts
29933
- function openDatabase({ path, migrationsFolder }) {
30001
+ function openDatabase({ path, migrationsFolder, secret }) {
29934
30002
  const sqlite = new Sqlite(path, { create: true, strict: true });
29935
30003
  sqlite.run("pragma journal_mode = wal");
29936
30004
  sqlite.run("pragma busy_timeout = 5000");
29937
30005
  sqlite.run("pragma foreign_keys = on");
29938
30006
  const db = drizzle({ client: sqlite });
30007
+ initEncryption(secret);
29939
30008
  migrate(db, { migrationsFolder });
29940
30009
  return {
29941
30010
  db,
@@ -29955,19 +30024,26 @@ function createS3Store({
29955
30024
  }) {
29956
30025
  const client = new S3Client({ endpoint, bucket, region, accessKeyId, secretAccessKey });
29957
30026
  return {
29958
- put: async ({ key, bytes, type }) => {
29959
- await client.write(key, bytes, { type });
30027
+ put: async ({ key: key2, bytes, type }) => {
30028
+ await client.write(key2, bytes, { type });
29960
30029
  },
29961
- read: async (key) => new Uint8Array(await client.file(key).arrayBuffer()),
29962
- remove: (key) => client.delete(key)
30030
+ read: async (key2) => new Uint8Array(await client.file(key2).arrayBuffer()),
30031
+ remove: (key2) => client.delete(key2)
29963
30032
  };
29964
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
+ }
29965
30041
  async function checkStore(store) {
29966
- const key = `checks/${crypto.randomUUID()}`;
30042
+ const key2 = `checks/${crypto.randomUUID()}`;
29967
30043
  const bytes = new TextEncoder().encode("artil-server");
29968
- await store.put({ key, bytes, type: "text/plain" });
29969
- const read = await store.read(key);
29970
- await store.remove(key);
30044
+ await store.put({ key: key2, bytes, type: "text/plain" });
30045
+ const read = await store.read(key2);
30046
+ await store.remove(key2);
29971
30047
  if (new TextDecoder().decode(read) !== "artil-server") {
29972
30048
  throw new Error("The bucket gave back other bytes than it was given");
29973
30049
  }
@@ -30015,7 +30091,7 @@ var addresses = sqliteTable("addresses", {
30015
30091
  agentId: text2("agent_id").notNull().references(() => agents.id, { onDelete: "cascade" }),
30016
30092
  channel: text2("channel").notNull(),
30017
30093
  value: text2("value").notNull(),
30018
- credentials: text2("credentials"),
30094
+ credentials: encryptedText("addresses", "credentials"),
30019
30095
  createdAt: createdAt()
30020
30096
  }, (table) => [
30021
30097
  uniqueIndex("addresses_channel_value_idx").on(table.channel, table.value).where(sql`${table.credentials} is not null`),
@@ -30035,9 +30111,9 @@ var messages = sqliteTable("messages", {
30035
30111
  direction: text2("direction", { enum: ["inbound", "outbound"] }).notNull(),
30036
30112
  externalId: text2("external_id"),
30037
30113
  counterpart: text2("counterpart").notNull(),
30038
- counterpartName: text2("counterpart_name"),
30114
+ counterpartName: encryptedText("messages", "counterpart_name"),
30039
30115
  to: text2("to", { mode: "json" }).$type().notNull(),
30040
- text: text2("text").notNull(),
30116
+ text: encryptedText("messages", "text").notNull(),
30041
30117
  status: text2("status", {
30042
30118
  enum: ["received", "refused", "sending", "sent", "failed"]
30043
30119
  }).notNull(),
@@ -30053,7 +30129,7 @@ var files = sqliteTable("files", {
30053
30129
  id: id(),
30054
30130
  agentId: text2("agent_id").notNull().references(() => agents.id, { onDelete: "cascade" }),
30055
30131
  messageId: text2("message_id").notNull(),
30056
- name: text2("name").notNull(),
30132
+ name: encryptedText("files", "name").notNull(),
30057
30133
  type: text2("type").notNull(),
30058
30134
  size: integer2("size").notNull(),
30059
30135
  key: text2("key"),
@@ -30066,7 +30142,7 @@ var events = sqliteTable("events", {
30066
30142
  type: text2("type", { enum: ["message.received"] }).notNull(),
30067
30143
  channel: text2("channel").notNull(),
30068
30144
  messageId: text2("message_id").notNull(),
30069
- text: text2("text"),
30145
+ text: encryptedText("events", "text"),
30070
30146
  sender: text2("sender", { mode: "json" }).$type(),
30071
30147
  thread: text2("thread"),
30072
30148
  toThread: text2("to_thread"),
@@ -30585,13 +30661,13 @@ function createFilesService({ filesRepository, store, log: log2 }) {
30585
30661
  if (!store || file3.key === null || file3.expiresAt && file3.expiresAt <= new Date) {
30586
30662
  return;
30587
30663
  }
30588
- return store.read(file3.key);
30664
+ return decryptContent(await store.read(file3.key));
30589
30665
  }
30590
- async function putInStore(options) {
30666
+ async function putInStore({ bytes, ...object3 }) {
30591
30667
  if (!store)
30592
30668
  return false;
30593
30669
  try {
30594
- await store.put(options);
30670
+ await store.put({ ...object3, bytes: encryptContent(bytes) });
30595
30671
  return true;
30596
30672
  } catch (cause) {
30597
30673
  log2(`Could not put a file in the bucket: ${messageOf(cause, String(cause))}`);
@@ -30634,8 +30710,8 @@ function createFilesService({ filesRepository, store, log: log2 }) {
30634
30710
  describeByMessages: (messageIds) => new Map(filesRepository.listByMessages(messageIds).entries().map(([messageId, records]) => [messageId, records.map(toMessageAttachment)])),
30635
30711
  save: ({ agentId, messageId, uploads, expiresAt }) => Promise.all(uploads.map(async ({ name, type, size, content }) => {
30636
30712
  const id2 = crypto.randomUUID();
30637
- const key = `${agentId}/${id2}`;
30638
- 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 });
30639
30715
  return filesRepository.add({
30640
30716
  id: id2,
30641
30717
  agentId,
@@ -30643,7 +30719,7 @@ function createFilesService({ filesRepository, store, log: log2 }) {
30643
30719
  name,
30644
30720
  type,
30645
30721
  size,
30646
- key: stored ? key : null,
30722
+ key: stored ? key2 : null,
30647
30723
  expiresAt
30648
30724
  });
30649
30725
  })),
@@ -30952,9 +31028,9 @@ function createSignInsRepository(db) {
30952
31028
  }
30953
31029
 
30954
31030
  // src/platform/crypto.ts
30955
- import { createHash as createHash2, randomBytes as randomBytes2 } from "crypto";
31031
+ import { createHash as createHash2, randomBytes as randomBytes3 } from "crypto";
30956
31032
  function randomSecret() {
30957
- return randomBytes2(32).toString("base64url");
31033
+ return randomBytes3(32).toString("base64url");
30958
31034
  }
30959
31035
  function hashSecret(secret) {
30960
31036
  return createHash2("sha256").update(secret).digest("hex");
@@ -31229,7 +31305,7 @@ async function openCommandContext({
31229
31305
  tailscale,
31230
31306
  out
31231
31307
  }) {
31232
- const database = openDatabase({ path: paths.database, migrationsFolder });
31308
+ const database = openDatabase({ path: paths.database, migrationsFolder, secret: config2.secret });
31233
31309
  const channels = createChannels({
31234
31310
  definitions: await loadChannels({
31235
31311
  specifiers: config2.channels,
@@ -31399,49 +31475,49 @@ async function parseFormData(request, options) {
31399
31475
  function convertFormDataToBodyData(formData, options) {
31400
31476
  const form = Object.create(null);
31401
31477
  const nestingState = { count: 0 };
31402
- formData.forEach((value, key) => {
31403
- if (!(options.all || key.endsWith("[]")))
31404
- form[key] = value;
31478
+ formData.forEach((value, key2) => {
31479
+ if (!(options.all || key2.endsWith("[]")))
31480
+ form[key2] = value;
31405
31481
  else
31406
- handleParsingAllValues(form, key, value);
31482
+ handleParsingAllValues(form, key2, value);
31407
31483
  });
31408
31484
  if (options.dot)
31409
- Object.entries(form).forEach(([key, value]) => {
31410
- if (key.includes(".")) {
31411
- handleParsingNestedValues(form, key, value, nestingState);
31412
- delete form[key];
31485
+ Object.entries(form).forEach(([key2, value]) => {
31486
+ if (key2.includes(".")) {
31487
+ handleParsingNestedValues(form, key2, value, nestingState);
31488
+ delete form[key2];
31413
31489
  }
31414
31490
  });
31415
31491
  return form;
31416
31492
  }
31417
- var handleParsingAllValues = (form, key, value) => {
31418
- if (form[key] !== undefined) {
31419
- if (Array.isArray(form[key]))
31420
- form[key].push(value);
31493
+ var handleParsingAllValues = (form, key2, value) => {
31494
+ if (form[key2] !== undefined) {
31495
+ if (Array.isArray(form[key2]))
31496
+ form[key2].push(value);
31421
31497
  else
31422
- form[key] = [form[key], value];
31423
- } else if (!key.endsWith("[]"))
31424
- form[key] = value;
31498
+ form[key2] = [form[key2], value];
31499
+ } else if (!key2.endsWith("[]"))
31500
+ form[key2] = value;
31425
31501
  else
31426
- form[key] = [value];
31502
+ form[key2] = [value];
31427
31503
  };
31428
- var handleParsingNestedValues = (form, key, value, state) => {
31429
- if (/(?:^|\.)__proto__\./.test(key))
31504
+ var handleParsingNestedValues = (form, key2, value, state) => {
31505
+ if (/(?:^|\.)__proto__\./.test(key2))
31430
31506
  return;
31431
31507
  let nestedForm = form;
31432
- const keys = key.split(".", 34);
31508
+ const keys = key2.split(".", 34);
31433
31509
  if (keys.length > 33)
31434
31510
  throwNestingLimitExceeded();
31435
- keys.forEach((key2, index2) => {
31511
+ keys.forEach((key3, index2) => {
31436
31512
  if (index2 === keys.length - 1)
31437
- nestedForm[key2] = value;
31513
+ nestedForm[key3] = value;
31438
31514
  else {
31439
- if (!nestedForm[key2] || typeof nestedForm[key2] !== "object" || Array.isArray(nestedForm[key2]) || nestedForm[key2] instanceof File) {
31515
+ if (!nestedForm[key3] || typeof nestedForm[key3] !== "object" || Array.isArray(nestedForm[key3]) || nestedForm[key3] instanceof File) {
31440
31516
  if (state.count++ >= MAX_NESTED_OBJECTS)
31441
31517
  throwNestingLimitExceeded();
31442
- nestedForm[key2] = Object.create(null);
31518
+ nestedForm[key3] = Object.create(null);
31443
31519
  }
31444
- nestedForm = nestedForm[key2];
31520
+ nestedForm = nestedForm[key3];
31445
31521
  }
31446
31522
  });
31447
31523
  };
@@ -31462,48 +31538,48 @@ var HonoRequest = class {
31462
31538
  this.path = path;
31463
31539
  this.#matchResult = matchResult;
31464
31540
  }
31465
- param(key) {
31466
- return key ? this.#getDecodedParam(key) : this.#getAllDecodedParams();
31541
+ param(key2) {
31542
+ return key2 ? this.#getDecodedParam(key2) : this.#getAllDecodedParams();
31467
31543
  }
31468
- #getDecodedParam(key) {
31469
- const paramKey2 = this.#matchResult[0][this.routeIndex]?.[1][key];
31544
+ #getDecodedParam(key2) {
31545
+ const paramKey2 = this.#matchResult[0][this.routeIndex]?.[1][key2];
31470
31546
  const param = this.#getParamValue(paramKey2);
31471
31547
  return param && tryDecodeURIComponent(param);
31472
31548
  }
31473
31549
  #getAllDecodedParams() {
31474
31550
  const decoded = {};
31475
31551
  const keys = Object.keys(this.#matchResult[0][this.routeIndex]?.[1] ?? {});
31476
- for (const key of keys) {
31477
- const value = this.#getParamValue(this.#matchResult[0][this.routeIndex][1][key]);
31552
+ for (const key2 of keys) {
31553
+ const value = this.#getParamValue(this.#matchResult[0][this.routeIndex][1][key2]);
31478
31554
  if (value !== undefined)
31479
- decoded[key] = tryDecodeURIComponent(value);
31555
+ decoded[key2] = tryDecodeURIComponent(value);
31480
31556
  }
31481
31557
  return decoded;
31482
31558
  }
31483
31559
  #getParamValue(paramKey2) {
31484
31560
  return this.#matchResult[1] ? this.#matchResult[1][paramKey2] : paramKey2;
31485
31561
  }
31486
- query(key) {
31487
- return getQueryParam(this.url, key);
31562
+ query(key2) {
31563
+ return getQueryParam(this.url, key2);
31488
31564
  }
31489
- queries(key) {
31490
- return getQueryParams(this.url, key);
31565
+ queries(key2) {
31566
+ return getQueryParams(this.url, key2);
31491
31567
  }
31492
31568
  header(name) {
31493
31569
  if (name)
31494
31570
  return this.raw.headers.get(name) ?? undefined;
31495
31571
  const headerData = Object.create(null);
31496
- this.raw.headers.forEach((value, key) => {
31497
- headerData[key] = value;
31572
+ this.raw.headers.forEach((value, key2) => {
31573
+ headerData[key2] = value;
31498
31574
  });
31499
31575
  return headerData;
31500
31576
  }
31501
31577
  async parseBody(options) {
31502
31578
  return parseBody(this, options);
31503
31579
  }
31504
- #cachedBody = (key) => {
31580
+ #cachedBody = (key2) => {
31505
31581
  const { bodyCache, raw } = this;
31506
- const cachedBody = bodyCache[key];
31582
+ const cachedBody = bodyCache[key2];
31507
31583
  if (cachedBody)
31508
31584
  return cachedBody;
31509
31585
  for (const anyCachedKey in bodyCache)
@@ -31511,9 +31587,9 @@ var HonoRequest = class {
31511
31587
  if (anyCachedKey === "json")
31512
31588
  body = JSON.stringify(body);
31513
31589
  const contentType = anyCachedKey === "formData" ? undefined : raw.headers.get("content-type");
31514
- return new Response(body, { headers: contentType ? { "Content-Type": contentType } : undefined })[key]();
31590
+ return new Response(body, { headers: contentType ? { "Content-Type": contentType } : undefined })[key2]();
31515
31591
  });
31516
- return bodyCache[key] = raw[key]();
31592
+ return bodyCache[key2] = raw[key2]();
31517
31593
  };
31518
31594
  json() {
31519
31595
  return this.#cachedBody("text").then((text3) => JSON.parse(text3));
@@ -31762,12 +31838,12 @@ var Context = class {
31762
31838
  status = (status) => {
31763
31839
  this.#status = status;
31764
31840
  };
31765
- set = (key, value) => {
31841
+ set = (key2, value) => {
31766
31842
  this.#var ??= /* @__PURE__ */ new Map;
31767
- this.#var.set(key, value);
31843
+ this.#var.set(key2, value);
31768
31844
  };
31769
- get = (key) => {
31770
- return this.#var ? this.#var.get(key) : undefined;
31845
+ get = (key2) => {
31846
+ return this.#var ? this.#var.get(key2) : undefined;
31771
31847
  };
31772
31848
  get var() {
31773
31849
  if (!this.#var)
@@ -31778,11 +31854,11 @@ var Context = class {
31778
31854
  let responseHeaders = this.#res ? new Headers(this.#res.headers) : this.#preparedHeaders;
31779
31855
  if (typeof arg === "object" && arg.headers) {
31780
31856
  responseHeaders ??= new Headers;
31781
- for (const [key, value] of new Headers(arg.headers))
31782
- if (key === "set-cookie")
31783
- responseHeaders.append(key, value);
31857
+ for (const [key2, value] of new Headers(arg.headers))
31858
+ if (key2 === "set-cookie")
31859
+ responseHeaders.append(key2, value);
31784
31860
  else
31785
- responseHeaders.set(key, value);
31861
+ responseHeaders.set(key2, value);
31786
31862
  }
31787
31863
  if (headers) {
31788
31864
  if (!responseHeaders) {
@@ -32360,8 +32436,8 @@ var RegExpRouter = class {
32360
32436
  const own2 = createNullObject();
32361
32437
  const entries = handlers.map(([h2, p2], i2) => {
32362
32438
  (own2[p2] ??= []).push(i2);
32363
- return [h2, trie.paths[p2][1].reduceRight((map3, [key, varIndex]) => {
32364
- map3[key] = paramReplacementMap[varIndex];
32439
+ return [h2, trie.paths[p2][1].reduceRight((map3, [key2, varIndex]) => {
32440
+ map3[key2] = paramReplacementMap[varIndex];
32365
32441
  return map3;
32366
32442
  }, createNullObject())];
32367
32443
  });
@@ -32458,8 +32534,8 @@ var Node3 = class Node4 {
32458
32534
  const nextP = parts[++i2];
32459
32535
  const pattern = getPattern(p2, nextP) || (nextP === undefined && p2 && p2.indexOf("*") === p2.length - 1 ? p2 : null);
32460
32536
  const isParam = Array.isArray(pattern);
32461
- const key = isParam ? pattern[0] : pattern || p2;
32462
- const child = curNode.#children[key] ||= new Node4;
32537
+ const key2 = isParam ? pattern[0] : pattern || p2;
32538
+ const child = curNode.#children[key2] ||= new Node4;
32463
32539
  if (pattern && !child.#pattern) {
32464
32540
  child.#pattern = pattern;
32465
32541
  curNode.#patterns.push(child);
@@ -32482,8 +32558,8 @@ var Node3 = class Node4 {
32482
32558
  handlerSet.params = createNullObject();
32483
32559
  handlerSets.push(handlerSet);
32484
32560
  for (let i3 = 0, len2 = handlerSet.possibleKeys.length;i3 < len2; i3++) {
32485
- const key = handlerSet.possibleKeys[i3];
32486
- handlerSet.params[key] = params?.[key] && !i3 ? params[key] : nodeParams[key] ?? params?.[key];
32561
+ const key2 = handlerSet.possibleKeys[i3];
32562
+ handlerSet.params[key2] = params?.[key2] && !i3 ? params[key2] : nodeParams[key2] ?? params?.[key2];
32487
32563
  }
32488
32564
  }
32489
32565
  }
@@ -32715,8 +32791,8 @@ var secureHeaders = (customOptions) => {
32715
32791
  };
32716
32792
  };
32717
32793
  function getFilteredHeaders(options) {
32718
- return Object.entries(HEADERS_MAP).filter(([key]) => options[key]).map(([key, defaultValue]) => {
32719
- const overrideValue = options[key];
32794
+ return Object.entries(HEADERS_MAP).filter(([key2]) => options[key2]).map(([key2, defaultValue]) => {
32795
+ const overrideValue = options[key2];
32720
32796
  return typeof overrideValue === "string" ? [defaultValue[0], overrideValue] : defaultValue;
32721
32797
  });
32722
32798
  }
@@ -33039,10 +33115,10 @@ var SSEStreamingApi = class extends StreamingApi {
33039
33115
  return `data: ${line}`;
33040
33116
  }).join(`
33041
33117
  `);
33042
- for (const key of ["event", "id"]) {
33043
- const value = message[key];
33118
+ for (const key2 of ["event", "id"]) {
33119
+ const value = message[key2];
33044
33120
  if (value && /[\r\n]/.test(value))
33045
- throw new Error(`${key} must not contain "\\r" or "\\n"`);
33121
+ throw new Error(`${key2} must not contain "\\r" or "\\n"`);
33046
33122
  }
33047
33123
  const sseData = [
33048
33124
  message.event && `event: ${message.event}`,
@@ -33580,8 +33656,8 @@ var cors = (options2) => {
33580
33656
  return () => "";
33581
33657
  })(opts.allowMethods);
33582
33658
  return async function cors2(c3, next) {
33583
- function set3(key, value) {
33584
- c3.res.headers.set(key, value);
33659
+ function set3(key2, value) {
33660
+ c3.res.headers.set(key2, value);
33585
33661
  }
33586
33662
  const allowOrigin = await findAllowOrigin(c3.req.header("origin") || "", c3);
33587
33663
  if (allowOrigin)
@@ -34092,8 +34168,8 @@ var insertIntoHead = (tagName, tag, props, precedence) => ({ buffer, context })
34092
34168
  for (const [, tagProps] of tags6) {
34093
34169
  if (tagName === "link" && !(tagProps.rel === "stylesheet" && tagProps["data-precedence"] !== undefined))
34094
34170
  continue;
34095
- for (const key of deDupeKeys)
34096
- if ((tagProps?.[key] ?? null) === props?.[key]) {
34171
+ for (const key2 of deDupeKeys)
34172
+ if ((tagProps?.[key2] ?? null) === props?.[key2]) {
34097
34173
  duped = true;
34098
34174
  break LOOP;
34099
34175
  }
@@ -34214,7 +34290,7 @@ var normalizeElementKeyMap = /* @__PURE__ */ new Map([
34214
34290
  ["noModule", "nomodule"],
34215
34291
  ["formAction", "formaction"]
34216
34292
  ]);
34217
- var normalizeIntrinsicElementKey = (key) => normalizeElementKeyMap.get(key) || key;
34293
+ var normalizeIntrinsicElementKey = (key2) => normalizeElementKeyMap.get(key2) || key2;
34218
34294
  var invalidAttributeNameCharRe = /[\s"'<>/=`\\\x00-\x1f\x7f-\x9f]/;
34219
34295
  var validAttributeNameCache = /* @__PURE__ */ new Set;
34220
34296
  var validAttributeNameCacheMax = 1024;
@@ -34320,30 +34396,30 @@ var hasUnsafeStyleValue = (value) => {
34320
34396
  };
34321
34397
  var styleObjectForEach = (style2, fn) => {
34322
34398
  for (const [k, v] of Object.entries(style2)) {
34323
- const key = k[0] === "-" || !/[A-Z]/.test(k) ? k : k.replace(/[A-Z]/g, (m2) => `-${m2.toLowerCase()}`);
34324
- if (!isValidStylePropertyName(key))
34399
+ const key2 = k[0] === "-" || !/[A-Z]/.test(k) ? k : k.replace(/[A-Z]/g, (m2) => `-${m2.toLowerCase()}`);
34400
+ if (!isValidStylePropertyName(key2))
34325
34401
  continue;
34326
34402
  if (v == null) {
34327
- fn(key, null);
34403
+ fn(key2, null);
34328
34404
  continue;
34329
34405
  }
34330
34406
  let value;
34331
34407
  if (typeof v === "number")
34332
- value = !key.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}`;
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}`;
34333
34409
  else if (typeof v === "string") {
34334
34410
  if (hasUnsafeStyleValue(v))
34335
34411
  continue;
34336
34412
  value = v;
34337
34413
  } else
34338
34414
  continue;
34339
- fn(key, value);
34415
+ fn(key2, value);
34340
34416
  }
34341
34417
  };
34342
34418
 
34343
34419
  // ../../node_modules/.bun/hono@4.13.16/node_modules/hono/dist/jsx/base.js
34344
34420
  var nameSpaceContext = undefined;
34345
34421
  var getNameSpaceContext = () => nameSpaceContext;
34346
- var toSVGAttributeName = (key) => /[A-Z]/.test(key) && key.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)/) ? key.replace(/([A-Z])/g, "-$1").toLowerCase() : key;
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;
34347
34423
  var emptyTags = [
34348
34424
  "area",
34349
34425
  "base",
@@ -34467,12 +34543,12 @@ var JSXNode = class {
34467
34543
  const props = this.props;
34468
34544
  let { children } = this;
34469
34545
  buffer[0] += `<${tag}`;
34470
- const normalizeKey = tag === "svg" || nameSpaceContext && useContext(nameSpaceContext) === "svg" ? (key) => toSVGAttributeName(normalizeIntrinsicElementKey(key)) : (key) => normalizeIntrinsicElementKey(key);
34471
- for (let [key, v] of Object.entries(props)) {
34472
- key = normalizeKey(key);
34473
- if (!isValidAttributeName(key))
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))
34474
34550
  continue;
34475
- if (key === "children") {} else if (key === "style" && typeof v === "object") {
34551
+ if (key2 === "children") {} else if (key2 === "style" && typeof v === "object") {
34476
34552
  let styleStr = "";
34477
34553
  styleObjectForEach(v, (property, value) => {
34478
34554
  if (value != null)
@@ -34482,26 +34558,26 @@ var JSXNode = class {
34482
34558
  escapeToBuffer(styleStr, buffer);
34483
34559
  buffer[0] += '"';
34484
34560
  } else if (typeof v === "string") {
34485
- buffer[0] += ` ${key}="`;
34561
+ buffer[0] += ` ${key2}="`;
34486
34562
  escapeToBuffer(v, buffer);
34487
34563
  buffer[0] += '"';
34488
34564
  } else if (v === null || v === undefined) {} else if (typeof v === "number" || v.isEscaped)
34489
- buffer[0] += ` ${key}="${v}"`;
34490
- else if (typeof v === "boolean" && booleanAttributes.includes(key)) {
34565
+ buffer[0] += ` ${key2}="${v}"`;
34566
+ else if (typeof v === "boolean" && booleanAttributes.includes(key2)) {
34491
34567
  if (v)
34492
- buffer[0] += ` ${key}=""`;
34493
- } else if (key === "dangerouslySetInnerHTML") {
34568
+ buffer[0] += ` ${key2}=""`;
34569
+ } else if (key2 === "dangerouslySetInnerHTML") {
34494
34570
  if (children.length > 0)
34495
34571
  throw new Error("Can only set one of `children` or `props.dangerouslySetInnerHTML`.");
34496
34572
  children = [raw(v.__html)];
34497
34573
  } else if (v instanceof Promise) {
34498
- buffer[0] += ` ${key}="`;
34574
+ buffer[0] += ` ${key2}="`;
34499
34575
  buffer.unshift('"', v);
34500
34576
  } else if (typeof v === "function") {
34501
- if (!key.startsWith("on") && key !== "ref")
34502
- throw new Error(`Invalid prop '${key}' of type 'function' supplied to '${tag}'.`);
34577
+ if (!key2.startsWith("on") && key2 !== "ref")
34578
+ throw new Error(`Invalid prop '${key2}' of type 'function' supplied to '${tag}'.`);
34503
34579
  } else {
34504
- buffer[0] += ` ${key}="`;
34580
+ buffer[0] += ` ${key2}="`;
34505
34581
  escapeToBuffer(v.toString(), buffer);
34506
34582
  buffer[0] += '"';
34507
34583
  }
@@ -34567,7 +34643,7 @@ var jsxFn = (tag, props, children) => {
34567
34643
  };
34568
34644
 
34569
34645
  // ../../node_modules/.bun/hono@4.13.16/node_modules/hono/dist/jsx/jsx-dev-runtime.js
34570
- function jsxDEV(tag, props, key) {
34646
+ function jsxDEV(tag, props, key2) {
34571
34647
  let node2;
34572
34648
  if (!props || !("children" in props))
34573
34649
  node2 = jsxFn(tag, props, []);
@@ -34575,7 +34651,7 @@ function jsxDEV(tag, props, key) {
34575
34651
  const children = props.children;
34576
34652
  node2 = Array.isArray(children) ? jsxFn(tag, props, children) : jsxFn(tag, props, [children]);
34577
34653
  }
34578
- node2.key = key;
34654
+ node2.key = key2;
34579
34655
  return node2;
34580
34656
  }
34581
34657
 
@@ -34902,12 +34978,12 @@ var __exportAll2 = (all, symbols) => {
34902
34978
  };
34903
34979
  var __copyProps = (to, from, except2, desc2) => {
34904
34980
  if (from && typeof from === "object" || typeof from === "function") {
34905
- for (var keys = __getOwnPropNames2(from), i2 = 0, n3 = keys.length, key;i2 < n3; i2++) {
34906
- key = keys[i2];
34907
- if (!__hasOwnProp2.call(to, key) && key !== except2) {
34908
- __defProp3(to, key, {
34909
- get: ((k) => from[k]).bind(null, key),
34910
- enumerable: !(desc2 = __getOwnPropDesc(from, key)) || desc2.enumerable
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
34911
34987
  });
34912
34988
  }
34913
34989
  }
@@ -36110,7 +36186,7 @@ var TOOL_RESULT_FOREIGN_FAMILY_KEYS = [
36110
36186
  "requestState"
36111
36187
  ];
36112
36188
  function normalizeContentlessToolResult(value) {
36113
- if (value === null || typeof value !== "object" || Array.isArray(value) || value.content !== undefined || TOOL_RESULT_FOREIGN_FAMILY_KEYS.some((key) => (key in value)))
36189
+ if (value === null || typeof value !== "object" || Array.isArray(value) || value.content !== undefined || TOOL_RESULT_FOREIGN_FAMILY_KEYS.some((key2) => (key2 in value)))
36114
36190
  return value;
36115
36191
  return {
36116
36192
  ...value,
@@ -36983,11 +37059,11 @@ function build$1() {
36983
37059
  CallToolResultWireSchema: unknown2().superRefine((value, ctx) => {
36984
37060
  if (typeof value !== "object" || value === null || Array.isArray(value) || value.content !== undefined)
36985
37061
  return;
36986
- for (const key of TOOL_RESULT_FOREIGN_FAMILY_KEYS)
36987
- if (key in value) {
37062
+ for (const key2 of TOOL_RESULT_FOREIGN_FAMILY_KEYS)
37063
+ if (key2 in value) {
36988
37064
  ctx.addIssue({
36989
37065
  code: "custom",
36990
- message: `content is required when the body carries '${key}' \u2014 another result family cannot default into an empty tools/call success`
37066
+ message: `content is required when the body carries '${key2}' \u2014 another result family cannot default into an empty tools/call success`
36991
37067
  });
36992
37068
  return;
36993
37069
  }
@@ -38550,21 +38626,21 @@ var rev2026Codec = {
38550
38626
  },
38551
38627
  validateEnvelopeMeta(meta5) {
38552
38628
  const issues = [];
38553
- for (const key of REQUIRED_ENVELOPE_KEYS)
38554
- if (!(key in meta5))
38629
+ for (const key2 of REQUIRED_ENVELOPE_KEYS)
38630
+ if (!(key2 in meta5))
38555
38631
  issues.push({
38556
- key,
38632
+ key: key2,
38557
38633
  problem: "missing"
38558
38634
  });
38559
38635
  const parsed = buildSchemas2026().RequestMetaEnvelopeSchema.safeParse(meta5);
38560
38636
  if (!parsed.success)
38561
38637
  for (const issue2 of parsed.error.issues) {
38562
38638
  const path = issue2.path.map(String);
38563
- const key = path.length > 0 ? path.join(".") : "_meta";
38564
- if (path.length === 1 && issues.some((existing) => existing.key === key && existing.problem === "missing"))
38639
+ const key2 = path.length > 0 ? path.join(".") : "_meta";
38640
+ if (path.length === 1 && issues.some((existing) => existing.key === key2 && existing.problem === "missing"))
38565
38641
  continue;
38566
38642
  issues.push({
38567
- key,
38643
+ key: key2,
38568
38644
  problem: issue2.message
38569
38645
  });
38570
38646
  }
@@ -38936,8 +39012,8 @@ function scanXMcpHeaderDeclarations(inputSchema) {
38936
39012
  }
38937
39013
  const properties = schema.properties;
38938
39014
  if (properties !== null && typeof properties === "object")
38939
- for (const [key, child] of Object.entries(properties)) {
38940
- const fault$1 = visit2(child, [...path, key], reachable);
39015
+ for (const [key2, child] of Object.entries(properties)) {
39016
+ const fault$1 = visit2(child, [...path, key2], reachable);
38941
39017
  if (fault$1 !== undefined)
38942
39018
  return fault$1;
38943
39019
  }
@@ -39035,10 +39111,10 @@ function decodeMcpParamValue(value) {
39035
39111
  }
39036
39112
  function valueAtPath(root, path) {
39037
39113
  let node2 = root;
39038
- for (const key of path) {
39114
+ for (const key2 of path) {
39039
39115
  if (node2 === null || typeof node2 !== "object")
39040
39116
  return;
39041
- node2 = node2[key];
39117
+ node2 = node2[key2];
39042
39118
  }
39043
39119
  return node2;
39044
39120
  }
@@ -39475,12 +39551,12 @@ function isProvablyObjectShapedRoot(schema, root = schema) {
39475
39551
  const ref = typeof schema.$ref === "string" && LOCAL_DEFINITION_REF.exec(schema.$ref);
39476
39552
  if (ref && root[ref[1]]?.[ref[2]]?.type === "object")
39477
39553
  return true;
39478
- for (const key of [
39554
+ for (const key2 of [
39479
39555
  "oneOf",
39480
39556
  "anyOf",
39481
39557
  "allOf"
39482
39558
  ]) {
39483
- const members2 = schema[key];
39559
+ const members2 = schema[key2];
39484
39560
  if (Array.isArray(members2) && members2.length > 0)
39485
39561
  return members2.every((m2) => m2 !== null && typeof m2 === "object" && (m2.type === "object" || isProvablyObjectShapedRoot(m2, "$id" in m2 ? {} : root)));
39486
39562
  }
@@ -39579,8 +39655,8 @@ var ANNOTATION_ONLY_JSON_SCHEMA_KEYWORDS = new Set([
39579
39655
  "title",
39580
39656
  "writeOnly"
39581
39657
  ]);
39582
- function isAnnotationOnlyJsonSchemaKeyword(key) {
39583
- return ANNOTATION_ONLY_JSON_SCHEMA_KEYWORDS.has(key) || key.startsWith("x-");
39658
+ function isAnnotationOnlyJsonSchemaKeyword(key2) {
39659
+ return ANNOTATION_ONLY_JSON_SCHEMA_KEYWORDS.has(key2) || key2.startsWith("x-");
39584
39660
  }
39585
39661
  var ROOT_KEYS = new Set(["$schema", ...Object.keys(ElicitRequestFormParamsSchema.shape.requestedSchema.shape)]);
39586
39662
  var PROPERTY_KEYS_BY_TYPE = {
@@ -39603,28 +39679,28 @@ function walkProperty(node2, path, vendor, unsupported) {
39603
39679
  if (allowedKeys === undefined)
39604
39680
  return node2;
39605
39681
  const pruned = {};
39606
- for (const [key, value] of Object.entries(node2))
39607
- if (allowedKeys.has(key) || isAnnotationOnlyJsonSchemaKeyword(key))
39608
- pruned[key] = value;
39609
- else if (key === "pattern" && node2.type === "string" && typeof node2.format === "string") {
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") {
39610
39686
  if (!SUPPORTED_STRING_FORMATS.has(node2.format))
39611
- pruned[key] = value;
39687
+ pruned[key2] = value;
39612
39688
  else if (typeof value !== "string" || !isLibraryFormatPattern(node2.format, value, vendor))
39613
- unsupported.push(`${path}.${key}`);
39689
+ unsupported.push(`${path}.${key2}`);
39614
39690
  } else
39615
- unsupported.push(`${path}.${key}`);
39691
+ unsupported.push(`${path}.${key2}`);
39616
39692
  return pruned;
39617
39693
  }
39618
39694
  function walkRequestedSchema(converted, vendor) {
39619
39695
  const pruned = {};
39620
39696
  const unsupported = [];
39621
- for (const [key, value] of Object.entries(converted))
39622
- if (key === "properties" && isJsonObject(value))
39623
- pruned[key] = Object.fromEntries(Object.entries(value).map(([name, node2]) => [name, walkProperty(node2, `properties.${name}`, vendor, unsupported)]));
39624
- else if (ROOT_KEYS.has(key))
39625
- pruned[key] = value;
39626
- else if (!isAnnotationOnlyJsonSchemaKeyword(key))
39627
- unsupported.push(key);
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);
39628
39704
  if (unsupported.length > 0)
39629
39705
  throw new ProtocolError(ProtocolErrorCode.InvalidParams, `Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${unsupported.join(", ")}`);
39630
39706
  return pruned;
@@ -39640,11 +39716,11 @@ function findDroppedConstraintPaths(original, parsed, path = "") {
39640
39716
  return original.flatMap((item, index2) => findDroppedConstraintPaths(item, parsed[index2], `${path}[${index2}]`));
39641
39717
  if (!isJsonObject(original) || !isJsonObject(parsed))
39642
39718
  return [];
39643
- return Object.entries(original).flatMap(([key, value]) => {
39644
- const childPath = path ? `${path}.${key}` : key;
39645
- if (!Object.prototype.hasOwnProperty.call(parsed, key))
39646
- return isAnnotationOnlyJsonSchemaKeyword(key) ? [] : [childPath];
39647
- return findDroppedConstraintPaths(value, parsed[key], childPath);
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);
39648
39724
  });
39649
39725
  }
39650
39726
  function normalizeElicitInputParams(input4) {
@@ -39662,7 +39738,7 @@ function normalizeElicitInputParams(input4) {
39662
39738
  const droppedConstraints = findDroppedConstraintPaths(pruned, parsed.data);
39663
39739
  if (droppedConstraints.length > 0)
39664
39740
  throw new ProtocolError(ProtocolErrorCode.InvalidParams, `Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${droppedConstraints.join(", ")}`);
39665
- const danglingRequired = (parsed.data.required ?? []).filter((key) => !Object.prototype.hasOwnProperty.call(parsed.data.properties, key));
39741
+ const danglingRequired = (parsed.data.required ?? []).filter((key2) => !Object.prototype.hasOwnProperty.call(parsed.data.properties, key2));
39666
39742
  if (danglingRequired.length > 0)
39667
39743
  throw new ProtocolError(ProtocolErrorCode.InvalidParams, `Elicitation requestedSchema lists required properties that are not defined in properties: ${danglingRequired.join(", ")}`);
39668
39744
  return {
@@ -39924,15 +40000,15 @@ var authSchemas = {
39924
40000
  };
39925
40001
  var _specTypeSchemas = {};
39926
40002
  var _isSpecType = {};
39927
- function register2(key, schema) {
39928
- const name = key.slice(0, -6);
40003
+ function register2(key2, schema) {
40004
+ const name = key2.slice(0, -6);
39929
40005
  _specTypeSchemas[name] = schema;
39930
40006
  _isSpecType[name] = (v) => schema.safeParse(v).success;
39931
40007
  }
39932
- for (const key of SPEC_SCHEMA_KEYS)
39933
- register2(key, schemas_exports[key]);
39934
- for (const [key, schema] of Object.entries(authSchemas))
39935
- register2(key, schema);
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);
39936
40012
  var specTypeSchemas = Object.freeze(_specTypeSchemas);
39937
40013
  var isSpecType = Object.freeze(_isSpecType);
39938
40014
  function bootstrapOutboundCodec(method) {
@@ -39962,8 +40038,8 @@ function liftWireOnlyMaterial(message, kind) {
39962
40038
  lifted: {}
39963
40039
  };
39964
40040
  const meta5 = params._meta;
39965
- const envelopeKeys = isPlainObject$1(meta5) ? RESERVED_ENVELOPE_META_KEYS.filter((key) => (key in meta5)) : [];
39966
- const retryKeys = kind === "request" ? RETRY_PARAMS_KEYS.filter((key) => (key in params)) : [];
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)) : [];
39967
40043
  if (envelopeKeys.length === 0 && retryKeys.length === 0)
39968
40044
  return {
39969
40045
  message,
@@ -39974,9 +40050,9 @@ function liftWireOnlyMaterial(message, kind) {
39974
40050
  if (envelopeKeys.length > 0 && isPlainObject$1(meta5)) {
39975
40051
  const envelope = {};
39976
40052
  const nextMeta = { ...meta5 };
39977
- for (const key of envelopeKeys) {
39978
- envelope[key] = meta5[key];
39979
- delete nextMeta[key];
40053
+ for (const key2 of envelopeKeys) {
40054
+ envelope[key2] = meta5[key2];
40055
+ delete nextMeta[key2];
39980
40056
  }
39981
40057
  lifted.envelope = envelope;
39982
40058
  if (Object.keys(nextMeta).length > 0)
@@ -39984,12 +40060,12 @@ function liftWireOnlyMaterial(message, kind) {
39984
40060
  else
39985
40061
  delete nextParams._meta;
39986
40062
  }
39987
- for (const key of retryKeys) {
39988
- if (key === "inputResponses")
39989
- lifted.inputResponses = nextParams[key];
39990
- if (key === "requestState")
39991
- lifted.requestState = nextParams[key];
39992
- delete nextParams[key];
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];
39993
40069
  }
39994
40070
  return {
39995
40071
  message: {
@@ -40640,8 +40716,8 @@ function isPlainObject$1(value) {
40640
40716
  }
40641
40717
  function mergeCapabilities(base, additional) {
40642
40718
  const result = { ...base };
40643
- for (const key in additional) {
40644
- const k = key;
40719
+ for (const key2 in additional) {
40720
+ const k = key2;
40645
40721
  const addValue = additional[k];
40646
40722
  if (addValue === undefined)
40647
40723
  continue;
@@ -40664,12 +40740,12 @@ function partitionInputResponses(inputResponses) {
40664
40740
  accepted,
40665
40741
  droppedKeys
40666
40742
  };
40667
- for (const [key, entry] of Object.entries(inputResponses)) {
40743
+ for (const [key2, entry] of Object.entries(inputResponses)) {
40668
40744
  if (!isPlainObject2(entry) || "method" in entry || "result" in entry) {
40669
- droppedKeys.push(key);
40745
+ droppedKeys.push(key2);
40670
40746
  continue;
40671
40747
  }
40672
- accepted[key] = entry;
40748
+ accepted[key2] = entry;
40673
40749
  }
40674
40750
  return {
40675
40751
  accepted,
@@ -40706,7 +40782,7 @@ var require_content_type = /* @__PURE__ */ __commonJSMin((exports) => {
40706
40782
  throw new TypeError("invalid media type");
40707
40783
  var obj = new ContentType(type.toLowerCase());
40708
40784
  if (index2 !== -1) {
40709
- var key;
40785
+ var key2;
40710
40786
  var match2;
40711
40787
  var value;
40712
40788
  PARAM_REGEXP.lastIndex = index2;
@@ -40714,14 +40790,14 @@ var require_content_type = /* @__PURE__ */ __commonJSMin((exports) => {
40714
40790
  if (match2.index !== index2)
40715
40791
  throw new TypeError("invalid parameter format");
40716
40792
  index2 += match2[0].length;
40717
- key = match2[1].toLowerCase();
40793
+ key2 = match2[1].toLowerCase();
40718
40794
  value = match2[2];
40719
40795
  if (value.charCodeAt(0) === 34) {
40720
40796
  value = value.slice(1, -1);
40721
40797
  if (value.indexOf("\\") !== -1)
40722
40798
  value = value.replace(QESC_REGEXP, "$1");
40723
40799
  }
40724
- obj.parameters[key] = value;
40800
+ obj.parameters[key2] = value;
40725
40801
  }
40726
40802
  if (index2 !== header.length)
40727
40803
  throw new TypeError("invalid parameter format");
@@ -40972,14 +41048,14 @@ var require_code$1 = /* @__PURE__ */ __commonJSMin((exports) => {
40972
41048
  return JSON.stringify(x).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
40973
41049
  }
40974
41050
  exports.safeStringify = safeStringify;
40975
- function getProperty(key) {
40976
- return typeof key == "string" && exports.IDENTIFIER.test(key) ? new _Code(`.${key}`) : _2`[${key}]`;
41051
+ function getProperty(key2) {
41052
+ return typeof key2 == "string" && exports.IDENTIFIER.test(key2) ? new _Code(`.${key2}`) : _2`[${key2}]`;
40977
41053
  }
40978
41054
  exports.getProperty = getProperty;
40979
- function getEsmExportName(key) {
40980
- if (typeof key == "string" && exports.IDENTIFIER.test(key))
40981
- return new _Code(`${key}`);
40982
- throw new Error(`CodeGen: invalid export name: ${key}, use explicit $id name mapping`);
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`);
40983
41059
  }
40984
41060
  exports.getEsmExportName = getEsmExportName;
40985
41061
  function regexpCode(rx) {
@@ -41625,11 +41701,11 @@ var require_codegen = /* @__PURE__ */ __commonJSMin((exports) => {
41625
41701
  }
41626
41702
  object(...keyValues) {
41627
41703
  const code = ["{"];
41628
- for (const [key, value] of keyValues) {
41704
+ for (const [key2, value] of keyValues) {
41629
41705
  if (code.length > 1)
41630
41706
  code.push(",");
41631
- code.push(key);
41632
- if (key !== value || this.opts.es5) {
41707
+ code.push(key2);
41708
+ if (key2 !== value || this.opts.es5) {
41633
41709
  code.push(":");
41634
41710
  (0, code_1.addCodeArg)(code, value);
41635
41711
  }
@@ -41876,16 +41952,16 @@ var require_util = /* @__PURE__ */ __commonJSMin((exports) => {
41876
41952
  if (typeof schema === "boolean")
41877
41953
  return;
41878
41954
  const rules = self.RULES.keywords;
41879
- for (const key in schema)
41880
- if (!rules[key])
41881
- checkStrictMode(it, `unknown keyword: "${key}"`);
41955
+ for (const key2 in schema)
41956
+ if (!rules[key2])
41957
+ checkStrictMode(it, `unknown keyword: "${key2}"`);
41882
41958
  }
41883
41959
  exports.checkUnknownRules = checkUnknownRules;
41884
41960
  function schemaHasRules(schema, rules) {
41885
41961
  if (typeof schema == "boolean")
41886
41962
  return !schema;
41887
- for (const key in schema)
41888
- if (rules[key])
41963
+ for (const key2 in schema)
41964
+ if (rules[key2])
41889
41965
  return true;
41890
41966
  return false;
41891
41967
  }
@@ -41893,8 +41969,8 @@ var require_util = /* @__PURE__ */ __commonJSMin((exports) => {
41893
41969
  function schemaHasRulesButRef(schema, RULES) {
41894
41970
  if (typeof schema == "boolean")
41895
41971
  return !schema;
41896
- for (const key in schema)
41897
- if (key !== "$ref" && RULES.all[key])
41972
+ for (const key2 in schema)
41973
+ if (key2 !== "$ref" && RULES.all[key2])
41898
41974
  return true;
41899
41975
  return false;
41900
41976
  }
@@ -42440,8 +42516,8 @@ var require_defaults = /* @__PURE__ */ __commonJSMin((exports) => {
42440
42516
  function assignDefaults(it, ty) {
42441
42517
  const { properties, items } = it.schema;
42442
42518
  if (ty === "object" && properties)
42443
- for (const key in properties)
42444
- assignDefault(it, key, properties[key].default);
42519
+ for (const key2 in properties)
42520
+ assignDefault(it, key2, properties[key2].default);
42445
42521
  else if (ty === "array" && Array.isArray(items))
42446
42522
  items.forEach((sch, i2) => assignDefault(it, i2, sch.default));
42447
42523
  }
@@ -42802,8 +42878,8 @@ var require_fast_deep_equal = /* @__PURE__ */ __commonJSMin((exports, module) =>
42802
42878
  if (!Object.prototype.hasOwnProperty.call(b2, keys[i2]))
42803
42879
  return false;
42804
42880
  for (i2 = length;i2-- !== 0; ) {
42805
- var key = keys[i2];
42806
- if (!equal(a2[key], b2[key]))
42881
+ var key2 = keys[i2];
42882
+ if (!equal(a2[key2], b2[key2]))
42807
42883
  return false;
42808
42884
  }
42809
42885
  return true;
@@ -42869,18 +42945,18 @@ var require_json_schema_traverse = /* @__PURE__ */ __commonJSMin((exports, modul
42869
42945
  function _traverse(opts, pre, post, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
42870
42946
  if (schema && typeof schema == "object" && !Array.isArray(schema)) {
42871
42947
  pre(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
42872
- for (var key in schema) {
42873
- var sch = schema[key];
42948
+ for (var key2 in schema) {
42949
+ var sch = schema[key2];
42874
42950
  if (Array.isArray(sch)) {
42875
- if (key in traverse.arrayKeywords)
42951
+ if (key2 in traverse.arrayKeywords)
42876
42952
  for (var i2 = 0;i2 < sch.length; i2++)
42877
- _traverse(opts, pre, post, sch[i2], jsonPtr + "/" + key + "/" + i2, rootSchema, jsonPtr, key, schema, i2);
42878
- } else if (key in traverse.propsKeywords) {
42953
+ _traverse(opts, pre, post, sch[i2], jsonPtr + "/" + key2 + "/" + i2, rootSchema, jsonPtr, key2, schema, i2);
42954
+ } else if (key2 in traverse.propsKeywords) {
42879
42955
  if (sch && typeof sch == "object")
42880
42956
  for (var prop in sch)
42881
- _traverse(opts, pre, post, sch[prop], jsonPtr + "/" + key + "/" + escapeJsonPtr(prop), rootSchema, jsonPtr, key, schema, prop);
42882
- } else if (key in traverse.keywords || opts.allKeys && !(key in traverse.skipKeywords))
42883
- _traverse(opts, pre, post, sch, jsonPtr + "/" + key, rootSchema, jsonPtr, key, schema);
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);
42884
42960
  }
42885
42961
  post(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
42886
42962
  }
@@ -42931,10 +43007,10 @@ var require_resolve = /* @__PURE__ */ __commonJSMin((exports) => {
42931
43007
  "$dynamicAnchor"
42932
43008
  ]);
42933
43009
  function hasRef(schema) {
42934
- for (const key in schema) {
42935
- if (REF_KEYWORDS.has(key))
43010
+ for (const key2 in schema) {
43011
+ if (REF_KEYWORDS.has(key2))
42936
43012
  return true;
42937
- const sch = schema[key];
43013
+ const sch = schema[key2];
42938
43014
  if (Array.isArray(sch) && sch.some(hasRef))
42939
43015
  return true;
42940
43016
  if (typeof sch == "object" && hasRef(sch))
@@ -42944,14 +43020,14 @@ var require_resolve = /* @__PURE__ */ __commonJSMin((exports) => {
42944
43020
  }
42945
43021
  function countKeys(schema) {
42946
43022
  let count2 = 0;
42947
- for (const key in schema) {
42948
- if (key === "$ref")
43023
+ for (const key2 in schema) {
43024
+ if (key2 === "$ref")
42949
43025
  return Infinity;
42950
43026
  count2++;
42951
- if (SIMPLE_INLINED.has(key))
43027
+ if (SIMPLE_INLINED.has(key2))
42952
43028
  continue;
42953
- if (typeof schema[key] == "object")
42954
- (0, util_1.eachItem)(schema[key], (sch) => count2 += countKeys(sch));
43029
+ if (typeof schema[key2] == "object")
43030
+ (0, util_1.eachItem)(schema[key2], (sch) => count2 += countKeys(sch));
42955
43031
  if (count2 === Infinity)
42956
43032
  return Infinity;
42957
43033
  }
@@ -43128,8 +43204,8 @@ var require_validate = /* @__PURE__ */ __commonJSMin((exports) => {
43128
43204
  function schemaCxtHasRules({ schema, self }) {
43129
43205
  if (typeof schema == "boolean")
43130
43206
  return !schema;
43131
- for (const key in schema)
43132
- if (self.RULES.all[key])
43207
+ for (const key2 in schema)
43208
+ if (self.RULES.all[key2])
43133
43209
  return true;
43134
43210
  return false;
43135
43211
  }
@@ -45089,7 +45165,7 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin((exports) => {
45089
45165
  }
45090
45166
  }
45091
45167
  }
45092
- addSchema(schema, key, _meta, _validateSchema = this.opts.validateSchema) {
45168
+ addSchema(schema, key2, _meta, _validateSchema = this.opts.validateSchema) {
45093
45169
  if (Array.isArray(schema)) {
45094
45170
  for (const sch of schema)
45095
45171
  this.addSchema(sch, undefined, _meta, _validateSchema);
@@ -45102,13 +45178,13 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin((exports) => {
45102
45178
  if (id2 !== undefined && typeof id2 != "string")
45103
45179
  throw new Error(`schema ${schemaId} must be string`);
45104
45180
  }
45105
- key = (0, resolve_1.normalizeId)(key || id2);
45106
- this._checkUnique(key);
45107
- this.schemas[key] = this._addSchema(schema, _meta, key, _validateSchema, true);
45181
+ key2 = (0, resolve_1.normalizeId)(key2 || id2);
45182
+ this._checkUnique(key2);
45183
+ this.schemas[key2] = this._addSchema(schema, _meta, key2, _validateSchema, true);
45108
45184
  return this;
45109
45185
  }
45110
- addMetaSchema(schema, key, _validateSchema = this.opts.validateSchema) {
45111
- this.addSchema(schema, key, true, _validateSchema);
45186
+ addMetaSchema(schema, key2, _validateSchema = this.opts.validateSchema) {
45187
+ this.addSchema(schema, key2, true, _validateSchema);
45112
45188
  return this;
45113
45189
  }
45114
45190
  validateSchema(schema, throwOrLogError) {
@@ -45254,14 +45330,14 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin((exports) => {
45254
45330
  let keywords = metaSchema;
45255
45331
  for (const seg of segments)
45256
45332
  keywords = keywords[seg];
45257
- for (const key in rules) {
45258
- const rule = rules[key];
45333
+ for (const key2 in rules) {
45334
+ const rule = rules[key2];
45259
45335
  if (typeof rule != "object")
45260
45336
  continue;
45261
45337
  const { $data } = rule.definition;
45262
- const schema = keywords[key];
45338
+ const schema = keywords[key2];
45263
45339
  if ($data && schema)
45264
- keywords[key] = schemaOrData(schema);
45340
+ keywords[key2] = schemaOrData(schema);
45265
45341
  }
45266
45342
  }
45267
45343
  return metaSchema;
@@ -45337,10 +45413,10 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin((exports) => {
45337
45413
  Ajv.MissingRefError = ref_error_1.default;
45338
45414
  exports.default = Ajv;
45339
45415
  function checkOptions(checkOpts, options2, msg, log2 = "error") {
45340
- for (const key in checkOpts) {
45341
- const opt = key;
45416
+ for (const key2 in checkOpts) {
45417
+ const opt = key2;
45342
45418
  if (opt in options2)
45343
- this.logger[log2](`${msg}: option ${key}. ${checkOpts[opt]}`);
45419
+ this.logger[log2](`${msg}: option ${key2}. ${checkOpts[opt]}`);
45344
45420
  }
45345
45421
  }
45346
45422
  function getSchEnv(keyRef) {
@@ -45354,8 +45430,8 @@ var require_core$3 = /* @__PURE__ */ __commonJSMin((exports) => {
45354
45430
  if (Array.isArray(optsSchemas))
45355
45431
  this.addSchema(optsSchemas);
45356
45432
  else
45357
- for (const key in optsSchemas)
45358
- this.addSchema(optsSchemas[key], key);
45433
+ for (const key2 in optsSchemas)
45434
+ this.addSchema(optsSchemas[key2], key2);
45359
45435
  }
45360
45436
  function addInitialFormats() {
45361
45437
  for (const name in this.opts.formats) {
@@ -46302,11 +46378,11 @@ var require_dependencies = /* @__PURE__ */ __commonJSMin((exports) => {
46302
46378
  function splitDependencies({ schema }) {
46303
46379
  const propertyDeps = {};
46304
46380
  const schemaDeps = {};
46305
- for (const key in schema) {
46306
- if (key === "__proto__")
46381
+ for (const key2 in schema) {
46382
+ if (key2 === "__proto__")
46307
46383
  continue;
46308
- const deps = Array.isArray(schema[key]) ? propertyDeps : schemaDeps;
46309
- deps[key] = schema[key];
46384
+ const deps = Array.isArray(schema[key2]) ? propertyDeps : schemaDeps;
46385
+ deps[key2] = schema[key2];
46310
46386
  }
46311
46387
  return [propertyDeps, schemaDeps];
46312
46388
  }
@@ -46374,13 +46450,13 @@ var require_propertyNames = /* @__PURE__ */ __commonJSMin((exports) => {
46374
46450
  if ((0, util_1.alwaysValidSchema)(it, schema))
46375
46451
  return;
46376
46452
  const valid = gen.name("valid");
46377
- gen.forIn("key", data, (key) => {
46378
- cxt.setParams({ propertyName: key });
46453
+ gen.forIn("key", data, (key2) => {
46454
+ cxt.setParams({ propertyName: key2 });
46379
46455
  cxt.subschema({
46380
46456
  keyword: "propertyNames",
46381
- data: key,
46457
+ data: key2,
46382
46458
  dataTypes: ["string"],
46383
- propertyName: key,
46459
+ propertyName: key2,
46384
46460
  compositeRule: true
46385
46461
  }, valid);
46386
46462
  gen.if((0, codegen_1.not)(valid), () => {
@@ -46423,36 +46499,36 @@ var require_additionalProperties = /* @__PURE__ */ __commonJSMin((exports) => {
46423
46499
  checkAdditionalProperties();
46424
46500
  cxt.ok((0, codegen_1._)`${errsCount} === ${names_1.default.errors}`);
46425
46501
  function checkAdditionalProperties() {
46426
- gen.forIn("key", data, (key) => {
46502
+ gen.forIn("key", data, (key2) => {
46427
46503
  if (!props.length && !patProps.length)
46428
- additionalPropertyCode(key);
46504
+ additionalPropertyCode(key2);
46429
46505
  else
46430
- gen.if(isAdditional(key), () => additionalPropertyCode(key));
46506
+ gen.if(isAdditional(key2), () => additionalPropertyCode(key2));
46431
46507
  });
46432
46508
  }
46433
- function isAdditional(key) {
46509
+ function isAdditional(key2) {
46434
46510
  let definedProp;
46435
46511
  if (props.length > 8) {
46436
46512
  const propsSchema = (0, util_1.schemaRefOrVal)(it, parentSchema.properties, "properties");
46437
- definedProp = (0, code_1.isOwnProperty)(gen, propsSchema, key);
46513
+ definedProp = (0, code_1.isOwnProperty)(gen, propsSchema, key2);
46438
46514
  } else if (props.length)
46439
- definedProp = (0, codegen_1.or)(...props.map((p2) => (0, codegen_1._)`${key} === ${p2}`));
46515
+ definedProp = (0, codegen_1.or)(...props.map((p2) => (0, codegen_1._)`${key2} === ${p2}`));
46440
46516
  else
46441
46517
  definedProp = codegen_1.nil;
46442
46518
  if (patProps.length)
46443
- definedProp = (0, codegen_1.or)(definedProp, ...patProps.map((p2) => (0, codegen_1._)`${(0, code_1.usePattern)(cxt, p2)}.test(${key})`));
46519
+ definedProp = (0, codegen_1.or)(definedProp, ...patProps.map((p2) => (0, codegen_1._)`${(0, code_1.usePattern)(cxt, p2)}.test(${key2})`));
46444
46520
  return (0, codegen_1.not)(definedProp);
46445
46521
  }
46446
- function deleteAdditional(key) {
46447
- gen.code((0, codegen_1._)`delete ${data}[${key}]`);
46522
+ function deleteAdditional(key2) {
46523
+ gen.code((0, codegen_1._)`delete ${data}[${key2}]`);
46448
46524
  }
46449
- function additionalPropertyCode(key) {
46525
+ function additionalPropertyCode(key2) {
46450
46526
  if (opts.removeAdditional === "all" || opts.removeAdditional && schema === false) {
46451
- deleteAdditional(key);
46527
+ deleteAdditional(key2);
46452
46528
  return;
46453
46529
  }
46454
46530
  if (schema === false) {
46455
- cxt.setParams({ additionalProperty: key });
46531
+ cxt.setParams({ additionalProperty: key2 });
46456
46532
  cxt.error();
46457
46533
  if (!allErrors)
46458
46534
  gen.break();
@@ -46461,22 +46537,22 @@ var require_additionalProperties = /* @__PURE__ */ __commonJSMin((exports) => {
46461
46537
  if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) {
46462
46538
  const valid = gen.name("valid");
46463
46539
  if (opts.removeAdditional === "failing") {
46464
- applyAdditionalSchema(key, valid, false);
46540
+ applyAdditionalSchema(key2, valid, false);
46465
46541
  gen.if((0, codegen_1.not)(valid), () => {
46466
46542
  cxt.reset();
46467
- deleteAdditional(key);
46543
+ deleteAdditional(key2);
46468
46544
  });
46469
46545
  } else {
46470
- applyAdditionalSchema(key, valid);
46546
+ applyAdditionalSchema(key2, valid);
46471
46547
  if (!allErrors)
46472
46548
  gen.if((0, codegen_1.not)(valid), () => gen.break());
46473
46549
  }
46474
46550
  }
46475
46551
  }
46476
- function applyAdditionalSchema(key, valid, errors3) {
46552
+ function applyAdditionalSchema(key2, valid, errors3) {
46477
46553
  const subschema = {
46478
46554
  keyword: "additionalProperties",
46479
- dataProp: key,
46555
+ dataProp: key2,
46480
46556
  dataPropType: util_1.Type.Str
46481
46557
  };
46482
46558
  if (errors3 === false)
@@ -46583,18 +46659,18 @@ var require_patternProperties = /* @__PURE__ */ __commonJSMin((exports) => {
46583
46659
  (0, util_1.checkStrictMode)(it, `property ${prop} matches pattern ${pat} (use allowMatchingProperties)`);
46584
46660
  }
46585
46661
  function validateProperties(pat) {
46586
- gen.forIn("key", data, (key) => {
46587
- gen.if((0, codegen_1._)`${(0, code_1.usePattern)(cxt, pat)}.test(${key})`, () => {
46662
+ gen.forIn("key", data, (key2) => {
46663
+ gen.if((0, codegen_1._)`${(0, code_1.usePattern)(cxt, pat)}.test(${key2})`, () => {
46588
46664
  const alwaysValid = alwaysValidPatterns.includes(pat);
46589
46665
  if (!alwaysValid)
46590
46666
  cxt.subschema({
46591
46667
  keyword: "patternProperties",
46592
46668
  schemaProp: pat,
46593
- dataProp: key,
46669
+ dataProp: key2,
46594
46670
  dataPropType: util_2.Type.Str
46595
46671
  }, valid);
46596
46672
  if (it.opts.unevaluated && props !== true)
46597
- gen.assign((0, codegen_1._)`${props}[${key}]`, true);
46673
+ gen.assign((0, codegen_1._)`${props}[${key2}]`, true);
46598
46674
  else if (!alwaysValid && !it.allErrors)
46599
46675
  gen.if((0, codegen_1.not)(valid), () => gen.break());
46600
46676
  });
@@ -47494,14 +47570,14 @@ var require_unevaluatedProperties = /* @__PURE__ */ __commonJSMin((exports) => {
47494
47570
  throw new Error("ajv implementation error");
47495
47571
  const { allErrors, props } = it;
47496
47572
  if (props instanceof codegen_1.Name)
47497
- gen.if((0, codegen_1._)`${props} !== true`, () => gen.forIn("key", data, (key) => gen.if(unevaluatedDynamic(props, key), () => unevaluatedPropCode(key))));
47573
+ gen.if((0, codegen_1._)`${props} !== true`, () => gen.forIn("key", data, (key2) => gen.if(unevaluatedDynamic(props, key2), () => unevaluatedPropCode(key2))));
47498
47574
  else if (props !== true)
47499
- gen.forIn("key", data, (key) => props === undefined ? unevaluatedPropCode(key) : gen.if(unevaluatedStatic(props, key), () => unevaluatedPropCode(key)));
47575
+ gen.forIn("key", data, (key2) => props === undefined ? unevaluatedPropCode(key2) : gen.if(unevaluatedStatic(props, key2), () => unevaluatedPropCode(key2)));
47500
47576
  it.props = true;
47501
47577
  cxt.ok((0, codegen_1._)`${errsCount} === ${names_1.default.errors}`);
47502
- function unevaluatedPropCode(key) {
47578
+ function unevaluatedPropCode(key2) {
47503
47579
  if (schema === false) {
47504
- cxt.setParams({ unevaluatedProperty: key });
47580
+ cxt.setParams({ unevaluatedProperty: key2 });
47505
47581
  cxt.error();
47506
47582
  if (!allErrors)
47507
47583
  gen.break();
@@ -47511,21 +47587,21 @@ var require_unevaluatedProperties = /* @__PURE__ */ __commonJSMin((exports) => {
47511
47587
  const valid = gen.name("valid");
47512
47588
  cxt.subschema({
47513
47589
  keyword: "unevaluatedProperties",
47514
- dataProp: key,
47590
+ dataProp: key2,
47515
47591
  dataPropType: util_1.Type.Str
47516
47592
  }, valid);
47517
47593
  if (!allErrors)
47518
47594
  gen.if((0, codegen_1.not)(valid), () => gen.break());
47519
47595
  }
47520
47596
  }
47521
- function unevaluatedDynamic(evaluatedProps, key) {
47522
- return (0, codegen_1._)`!${evaluatedProps} || !${evaluatedProps}[${key}]`;
47597
+ function unevaluatedDynamic(evaluatedProps, key2) {
47598
+ return (0, codegen_1._)`!${evaluatedProps} || !${evaluatedProps}[${key2}]`;
47523
47599
  }
47524
- function unevaluatedStatic(evaluatedProps, key) {
47600
+ function unevaluatedStatic(evaluatedProps, key2) {
47525
47601
  const ps = [];
47526
47602
  for (const p2 in evaluatedProps)
47527
47603
  if (evaluatedProps[p2] === true)
47528
- ps.push((0, codegen_1._)`${key} !== ${p2}`);
47604
+ ps.push((0, codegen_1._)`${key2} !== ${p2}`);
47529
47605
  return (0, codegen_1.and)(...ps);
47530
47606
  }
47531
47607
  }
@@ -49146,13 +49222,13 @@ function resolveLegacyShimOptions(options2) {
49146
49222
  legacyShim: options2?.legacyShim ?? true
49147
49223
  };
49148
49224
  }
49149
- function coerceEmbeddedInputRequest(method, key, entry) {
49225
+ function coerceEmbeddedInputRequest(method, key2, entry) {
49150
49226
  if (entry === null || typeof entry !== "object" || typeof entry.method !== "string")
49151
- throw new ProtocolError(ProtocolErrorCode.InternalError, `Handler for ${method} returned an invalid input request '${key}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list 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`);
49152
49228
  const embedded = entry;
49153
49229
  const required3 = requiredClientCapabilitiesForInputRequest(embedded);
49154
49230
  if (required3 === undefined)
49155
- throw new ProtocolError(ProtocolErrorCode.InternalError, `Handler for ${method} returned an input request '${key}' of kind '${embedded.method}', which is not an embedded request the 2026-07-28 revision defines`);
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`);
49156
49232
  return {
49157
49233
  embedded,
49158
49234
  required: required3
@@ -49202,13 +49278,13 @@ var LegacyInputRequiredShim = class {
49202
49278
  if (hasInputRequests) {
49203
49279
  const declared = this._host.resolvedClientCapabilities(ctx);
49204
49280
  const coerced = [];
49205
- for (const [key, entry] of Object.entries(inputRequests)) {
49206
- const { embedded, required: required3 } = coerceEmbeddedInputRequest(method, key, entry);
49281
+ for (const [key2, entry] of Object.entries(inputRequests)) {
49282
+ const { embedded, required: required3 } = coerceEmbeddedInputRequest(method, key2, entry);
49207
49283
  if (embedded.method !== "roots/list" && embedded.params === undefined)
49208
- throw new ProtocolError(ProtocolErrorCode.InternalError, `Handler for ${method} returned an input request '${key}' of kind '${embedded.method}' without params`);
49284
+ throw new ProtocolError(ProtocolErrorCode.InternalError, `Handler for ${method} returned an input request '${key2}' of kind '${embedded.method}' without params`);
49209
49285
  if (missingClientCapabilities(required3, declared) !== undefined)
49210
- return legacyShimFailure(method, `Cannot request input '${key}' (${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)" : ""}`);
49211
- coerced.push([key, embedded]);
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]);
49212
49288
  }
49213
49289
  const roundAbort = linkedRoundAbort(outerSignal);
49214
49290
  try {
@@ -49219,9 +49295,9 @@ var LegacyInputRequiredShim = class {
49219
49295
  onprogress: () => {},
49220
49296
  signal: roundAbort.signal
49221
49297
  };
49222
- const fulfilled = await Promise.all(coerced.map(async ([key, embedded]) => {
49298
+ const fulfilled = await Promise.all(coerced.map(async ([key2, embedded]) => {
49223
49299
  try {
49224
- return [key, await this._dispatchLeg(embedded, legOptions)];
49300
+ return [key2, await this._dispatchLeg(embedded, legOptions)];
49225
49301
  } catch (error62) {
49226
49302
  roundAbort.abort(error62);
49227
49303
  throw error62;
@@ -49502,11 +49578,11 @@ var Server = class extends Protocol {
49502
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)`);
49503
49579
  if (hasInputRequests) {
49504
49580
  const declared = this._inputRequestCapabilityView(ctx);
49505
- for (const [key, entry] of Object.entries(inputRequests)) {
49506
- const { embedded, required: required3 } = coerceEmbeddedInputRequest(method, key, entry);
49581
+ for (const [key2, entry] of Object.entries(inputRequests)) {
49582
+ const { embedded, required: required3 } = coerceEmbeddedInputRequest(method, key2, entry);
49507
49583
  const missing = missingClientCapabilities(required3, declared);
49508
49584
  if (missing !== undefined)
49509
- throw new MissingRequiredClientCapabilityError({ requiredCapabilities: missing }, `Cannot request input '${key}' (${embedded.method}): the request's client capabilities do not declare the required capability`);
49585
+ throw new MissingRequiredClientCapabilityError({ requiredCapabilities: missing }, `Cannot request input '${key2}' (${embedded.method}): the request's client capabilities do not declare the required capability`);
49510
49586
  }
49511
49587
  }
49512
49588
  return result;
@@ -49791,12 +49867,12 @@ function toolInputElementCount(value, max) {
49791
49867
  stack.push(child);
49792
49868
  }
49793
49869
  else
49794
- for (const key in node2) {
49795
- if (!Object.prototype.hasOwnProperty.call(node2, key))
49870
+ for (const key2 in node2) {
49871
+ if (!Object.prototype.hasOwnProperty.call(node2, key2))
49796
49872
  continue;
49797
49873
  if (++count2 > max)
49798
49874
  return count2;
49799
- const child = node2[key];
49875
+ const child = node2[key2];
49800
49876
  if (child !== null && typeof child === "object")
49801
49877
  stack.push(child);
49802
49878
  }
@@ -52007,7 +52083,7 @@ function createApp({ services, hosts, password: password2, workspace, log: log2
52007
52083
  }).get("/accounts/*", (c3) => c3.text(`This server has no web app. Manage its agents with artil-server; see artil-server --help.
52008
52084
  `)).get("/", (c3) => c3.text(`Artil Server is running. Sign an agent in with:
52009
52085
 
52010
- ARTIL_BASE_URL=${hosts.requestOrigin(c3.req.raw)} artil auth login
52086
+ ${loginCommand(hosts.requestOrigin(c3.req.raw))}
52011
52087
  `)).all("*", (c3) => notFound(c3.req.method, c3.req.path));
52012
52088
  }
52013
52089
 
@@ -52026,7 +52102,7 @@ async function startServer({
52026
52102
  store = config2.s3 ? createS3Store(config2.s3) : undefined,
52027
52103
  fetch: fetch2
52028
52104
  }) {
52029
- const database = openDatabase({ path: databasePath, migrationsFolder });
52105
+ const database = openDatabase({ path: databasePath, migrationsFolder, secret: config2.secret });
52030
52106
  let handleRequest = startingResponse;
52031
52107
  const server = Bun.serve({
52032
52108
  hostname: "127.0.0.1",
@@ -52395,7 +52471,7 @@ async function serve({ paths, config: config2, environment }) {
52395
52471
  log: out
52396
52472
  });
52397
52473
  out(`Artil Server is at ${server.baseUrl}${config2.public ? " (public, through Tailscale Funnel)" : ""}.`);
52398
- out(`Sign an agent in with: ARTIL_BASE_URL=${server.baseUrl} artil auth login`);
52474
+ out(`Sign an agent in with: ${loginCommand(server.baseUrl)}`);
52399
52475
  out(`MCP clients connect to ${server.baseUrl}/mcp`);
52400
52476
  const { promise: promise3, resolve } = Promise.withResolvers();
52401
52477
  process.once("SIGINT", resolve);
@@ -52498,20 +52574,6 @@ async function runCli(environment) {
52498
52574
  }
52499
52575
  }
52500
52576
 
52501
- // src/platform/artil-cli.ts
52502
- var {$ } = globalThis.Bun;
52503
- function findArtilCli() {
52504
- return {
52505
- installed: Bun.which("artil") !== null,
52506
- async install() {
52507
- const installed = await $`bun install --global artil-ai`.nothrow().quiet();
52508
- if (installed.exitCode !== 0) {
52509
- throw new Error(installed.stderr.toString().trim() || `bun install exited with ${installed.exitCode}`);
52510
- }
52511
- }
52512
- };
52513
- }
52514
-
52515
52577
  // src/platform/tailscale.ts
52516
52578
  import { existsSync } from "fs";
52517
52579
  var statusSchema = exports_external2.object({
@@ -52610,5 +52672,5 @@ try {
52610
52672
  process.exitCode = 1;
52611
52673
  }
52612
52674
 
52613
- //# debugId=E162EED6D52D865664756E2164756E21
52675
+ //# debugId=0F36EC3652814C0464756E2164756E21
52614
52676
  //# sourceMappingURL=main.js.map