@react-grab/ami 0.0.76 → 0.0.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.js CHANGED
@@ -786,8 +786,8 @@ function $constructor(name16, initializer3, params) {
786
786
  initializer3(inst, def);
787
787
  const proto = _.prototype;
788
788
  const keys = Object.keys(proto);
789
- for (let i = 0; i < keys.length; i++) {
790
- const k2 = keys[i];
789
+ for (let i2 = 0; i2 < keys.length; i2++) {
790
+ const k2 = keys[i2];
791
791
  if (!(k2 in inst)) {
792
792
  inst[k2] = proto[k2].bind(inst);
793
793
  }
@@ -916,8 +916,8 @@ function assertNever(_x) {
916
916
  function assert(_) {
917
917
  }
918
918
  function getEnumValues(entries) {
919
- const numericValues = Object.values(entries).filter((v) => typeof v === "number");
920
- const values = Object.entries(entries).filter(([k2, _]) => numericValues.indexOf(+k2) === -1).map(([_, v]) => v);
919
+ const numericValues = Object.values(entries).filter((v2) => typeof v2 === "number");
920
+ const values = Object.entries(entries).filter(([k2, _]) => numericValues.indexOf(+k2) === -1).map(([_, v2]) => v2);
921
921
  return values;
922
922
  }
923
923
  function joinValues(array2, separator = "|") {
@@ -976,9 +976,9 @@ function defineLazy(object3, key, getter) {
976
976
  }
977
977
  return value;
978
978
  },
979
- set(v) {
979
+ set(v2) {
980
980
  Object.defineProperty(object3, key, {
981
- value: v
981
+ value: v2
982
982
  // configurable: true,
983
983
  });
984
984
  },
@@ -1017,8 +1017,8 @@ function promiseAllObject(promisesObj) {
1017
1017
  const promises = keys.map((key) => promisesObj[key]);
1018
1018
  return Promise.all(promises).then((results) => {
1019
1019
  const resolvedObj = {};
1020
- for (let i = 0; i < keys.length; i++) {
1021
- resolvedObj[keys[i]] = results[i];
1020
+ for (let i2 = 0; i2 < keys.length; i2++) {
1021
+ resolvedObj[keys[i2]] = results[i2];
1022
1022
  }
1023
1023
  return resolvedObj;
1024
1024
  });
@@ -1026,7 +1026,7 @@ function promiseAllObject(promisesObj) {
1026
1026
  function randomString(length = 10) {
1027
1027
  const chars = "abcdefghijklmnopqrstuvwxyz";
1028
1028
  let str = "";
1029
- for (let i = 0; i < length; i++) {
1029
+ for (let i2 = 0; i2 < length; i2++) {
1030
1030
  str += chars[Math.floor(Math.random() * chars.length)];
1031
1031
  }
1032
1032
  return str;
@@ -1366,11 +1366,11 @@ function required(Class2, schema, mask) {
1366
1366
  });
1367
1367
  return clone(schema, def);
1368
1368
  }
1369
- function aborted(x, startIndex = 0) {
1370
- if (x.aborted === true)
1369
+ function aborted(x2, startIndex = 0) {
1370
+ if (x2.aborted === true)
1371
1371
  return true;
1372
- for (let i = startIndex; i < x.issues.length; i++) {
1373
- if (x.issues[i]?.continue !== true) {
1372
+ for (let i2 = startIndex; i2 < x2.issues.length; i2++) {
1373
+ if (x2.issues[i2]?.continue !== true) {
1374
1374
  return true;
1375
1375
  }
1376
1376
  }
@@ -1436,15 +1436,15 @@ function cleanEnum(obj) {
1436
1436
  function base64ToUint8Array(base643) {
1437
1437
  const binaryString = atob(base643);
1438
1438
  const bytes = new Uint8Array(binaryString.length);
1439
- for (let i = 0; i < binaryString.length; i++) {
1440
- bytes[i] = binaryString.charCodeAt(i);
1439
+ for (let i2 = 0; i2 < binaryString.length; i2++) {
1440
+ bytes[i2] = binaryString.charCodeAt(i2);
1441
1441
  }
1442
1442
  return bytes;
1443
1443
  }
1444
1444
  function uint8ArrayToBase64(bytes) {
1445
1445
  let binaryString = "";
1446
- for (let i = 0; i < bytes.length; i++) {
1447
- binaryString += String.fromCharCode(bytes[i]);
1446
+ for (let i2 = 0; i2 < bytes.length; i2++) {
1447
+ binaryString += String.fromCharCode(bytes[i2]);
1448
1448
  }
1449
1449
  return btoa(binaryString);
1450
1450
  }
@@ -1462,8 +1462,8 @@ function hexToUint8Array(hex3) {
1462
1462
  throw new Error("Invalid hex string length");
1463
1463
  }
1464
1464
  const bytes = new Uint8Array(cleanHex.length / 2);
1465
- for (let i = 0; i < cleanHex.length; i += 2) {
1466
- bytes[i / 2] = Number.parseInt(cleanHex.slice(i, i + 2), 16);
1465
+ for (let i2 = 0; i2 < cleanHex.length; i2 += 2) {
1466
+ bytes[i2 / 2] = Number.parseInt(cleanHex.slice(i2, i2 + 2), 16);
1467
1467
  }
1468
1468
  return bytes;
1469
1469
  }
@@ -1521,10 +1521,10 @@ function formatError(error46, mapper = (issue2) => issue2.message) {
1521
1521
  fieldErrors._errors.push(mapper(issue2));
1522
1522
  } else {
1523
1523
  let curr = fieldErrors;
1524
- let i = 0;
1525
- while (i < issue2.path.length) {
1526
- const el = issue2.path[i];
1527
- const terminal = i === issue2.path.length - 1;
1524
+ let i2 = 0;
1525
+ while (i2 < issue2.path.length) {
1526
+ const el = issue2.path[i2];
1527
+ const terminal = i2 === issue2.path.length - 1;
1528
1528
  if (!terminal) {
1529
1529
  curr[el] = curr[el] || { _errors: [] };
1530
1530
  } else {
@@ -1532,7 +1532,7 @@ function formatError(error46, mapper = (issue2) => issue2.message) {
1532
1532
  curr[el]._errors.push(mapper(issue2));
1533
1533
  }
1534
1534
  curr = curr[el];
1535
- i++;
1535
+ i2++;
1536
1536
  }
1537
1537
  }
1538
1538
  }
@@ -1558,10 +1558,10 @@ function treeifyError(error46, mapper = (issue2) => issue2.message) {
1558
1558
  continue;
1559
1559
  }
1560
1560
  let curr = result;
1561
- let i = 0;
1562
- while (i < fullpath.length) {
1563
- const el = fullpath[i];
1564
- const terminal = i === fullpath.length - 1;
1561
+ let i2 = 0;
1562
+ while (i2 < fullpath.length) {
1563
+ const el = fullpath[i2];
1564
+ const terminal = i2 === fullpath.length - 1;
1565
1565
  if (typeof el === "string") {
1566
1566
  curr.properties ?? (curr.properties = {});
1567
1567
  (_a17 = curr.properties)[el] ?? (_a17[el] = { errors: [] });
@@ -1574,7 +1574,7 @@ function treeifyError(error46, mapper = (issue2) => issue2.message) {
1574
1574
  if (terminal) {
1575
1575
  curr.errors.push(mapper(issue2));
1576
1576
  }
1577
- i++;
1577
+ i2++;
1578
1578
  }
1579
1579
  }
1580
1580
  }
@@ -2418,9 +2418,9 @@ var Doc = class {
2418
2418
  return;
2419
2419
  }
2420
2420
  const content = arg;
2421
- const lines = content.split("\n").filter((x) => x);
2422
- const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
2423
- const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
2421
+ const lines = content.split("\n").filter((x2) => x2);
2422
+ const minIndent = Math.min(...lines.map((x2) => x2.length - x2.trimStart().length));
2423
+ const dedented = lines.map((x2) => x2.slice(minIndent)).map((x2) => " ".repeat(this.indent * 2) + x2);
2424
2424
  for (const line of dedented) {
2425
2425
  this.content.push(line);
2426
2426
  }
@@ -2429,7 +2429,7 @@ var Doc = class {
2429
2429
  const F = Function;
2430
2430
  const args = this?.args;
2431
2431
  const content = this?.content ?? [``];
2432
- const lines = [...content.map((x) => ` ${x}`)];
2432
+ const lines = [...content.map((x2) => ` ${x2}`)];
2433
2433
  return new F(...args, lines.join("\n"));
2434
2434
  }
2435
2435
  };
@@ -2591,10 +2591,10 @@ var $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
2591
2591
  v7: 7,
2592
2592
  v8: 8
2593
2593
  };
2594
- const v = versionMap[def.version];
2595
- if (v === void 0)
2594
+ const v2 = versionMap[def.version];
2595
+ if (v2 === void 0)
2596
2596
  throw new Error(`Invalid UUID version: "${def.version}"`);
2597
- def.pattern ?? (def.pattern = uuid(v));
2597
+ def.pattern ?? (def.pattern = uuid(v2));
2598
2598
  } else
2599
2599
  def.pattern ?? (def.pattern = uuid());
2600
2600
  $ZodStringFormat.init(inst, def);
@@ -3065,16 +3065,16 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
3065
3065
  }
3066
3066
  payload.value = Array(input.length);
3067
3067
  const proms = [];
3068
- for (let i = 0; i < input.length; i++) {
3069
- const item = input[i];
3068
+ for (let i2 = 0; i2 < input.length; i2++) {
3069
+ const item = input[i2];
3070
3070
  const result = def.element._zod.run({
3071
3071
  value: item,
3072
3072
  issues: []
3073
3073
  }, ctx);
3074
3074
  if (result instanceof Promise) {
3075
- proms.push(result.then((result2) => handleArrayResult(result2, payload, i)));
3075
+ proms.push(result.then((result2) => handleArrayResult(result2, payload, i2)));
3076
3076
  } else {
3077
- handleArrayResult(result, payload, i);
3077
+ handleArrayResult(result, payload, i2);
3078
3078
  }
3079
3079
  }
3080
3080
  if (proms.length) {
@@ -3167,8 +3167,8 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
3167
3167
  const field = shape[key]._zod;
3168
3168
  if (field.values) {
3169
3169
  propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
3170
- for (const v of field.values)
3171
- propValues[key].add(v);
3170
+ for (const v2 of field.values)
3171
+ propValues[key].add(v2);
3172
3172
  }
3173
3173
  }
3174
3174
  return propValues;
@@ -3357,10 +3357,10 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
3357
3357
  const pv = option._zod.propValues;
3358
3358
  if (!pv || Object.keys(pv).length === 0)
3359
3359
  throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
3360
- for (const [k2, v] of Object.entries(pv)) {
3360
+ for (const [k2, v2] of Object.entries(pv)) {
3361
3361
  if (!propValues[k2])
3362
3362
  propValues[k2] = /* @__PURE__ */ new Set();
3363
- for (const val of v) {
3363
+ for (const val of v2) {
3364
3364
  propValues[k2].add(val);
3365
3365
  }
3366
3366
  }
@@ -3374,11 +3374,11 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
3374
3374
  const values = o._zod.propValues?.[def.discriminator];
3375
3375
  if (!values || values.size === 0)
3376
3376
  throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
3377
- for (const v of values) {
3378
- if (map2.has(v)) {
3379
- throw new Error(`Duplicate discriminator value "${String(v)}"`);
3377
+ for (const v2 of values) {
3378
+ if (map2.has(v2)) {
3379
+ throw new Error(`Duplicate discriminator value "${String(v2)}"`);
3380
3380
  }
3381
- map2.set(v, o);
3381
+ map2.set(v2, o);
3382
3382
  }
3383
3383
  }
3384
3384
  return map2;
@@ -3519,35 +3519,35 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
3519
3519
  return payload;
3520
3520
  }
3521
3521
  }
3522
- let i = -1;
3522
+ let i2 = -1;
3523
3523
  for (const item of items) {
3524
- i++;
3525
- if (i >= input.length) {
3526
- if (i >= optStart)
3524
+ i2++;
3525
+ if (i2 >= input.length) {
3526
+ if (i2 >= optStart)
3527
3527
  continue;
3528
3528
  }
3529
3529
  const result = item._zod.run({
3530
- value: input[i],
3530
+ value: input[i2],
3531
3531
  issues: []
3532
3532
  }, ctx);
3533
3533
  if (result instanceof Promise) {
3534
- proms.push(result.then((result2) => handleTupleResult(result2, payload, i)));
3534
+ proms.push(result.then((result2) => handleTupleResult(result2, payload, i2)));
3535
3535
  } else {
3536
- handleTupleResult(result, payload, i);
3536
+ handleTupleResult(result, payload, i2);
3537
3537
  }
3538
3538
  }
3539
3539
  if (def.rest) {
3540
3540
  const rest = input.slice(items.length);
3541
3541
  for (const el of rest) {
3542
- i++;
3542
+ i2++;
3543
3543
  const result = def.rest._zod.run({
3544
3544
  value: el,
3545
3545
  issues: []
3546
3546
  }, ctx);
3547
3547
  if (result instanceof Promise) {
3548
- proms.push(result.then((result2) => handleTupleResult(result2, payload, i)));
3548
+ proms.push(result.then((result2) => handleTupleResult(result2, payload, i2)));
3549
3549
  } else {
3550
- handleTupleResult(result, payload, i);
3550
+ handleTupleResult(result, payload, i2);
3551
3551
  }
3552
3552
  }
3553
3553
  }
@@ -3918,8 +3918,8 @@ var $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
3918
3918
  var $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
3919
3919
  $ZodType.init(inst, def);
3920
3920
  defineLazy(inst._zod, "values", () => {
3921
- const v = def.innerType._zod.values;
3922
- return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
3921
+ const v2 = def.innerType._zod.values;
3922
+ return v2 ? new Set([...v2].filter((x2) => x2 !== void 0)) : void 0;
3923
3923
  });
3924
3924
  inst._zod.parse = (payload, ctx) => {
3925
3925
  const result = def.innerType._zod.run(payload, ctx);
@@ -6348,7 +6348,7 @@ var error16 = () => {
6348
6348
  if (issue2.values.length === 1) {
6349
6349
  return `\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${stringifyPrimitive(issue2.values[0])}`;
6350
6350
  }
6351
- const stringified = issue2.values.map((v) => stringifyPrimitive(v));
6351
+ const stringified = issue2.values.map((v2) => stringifyPrimitive(v2));
6352
6352
  if (issue2.values.length === 2) {
6353
6353
  return `\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${stringified[0]} \u05D0\u05D5 ${stringified[1]}`;
6354
6354
  }
@@ -10769,7 +10769,7 @@ function _set(Class2, valueType, params) {
10769
10769
  });
10770
10770
  }
10771
10771
  function _enum(Class2, values, params) {
10772
- const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
10772
+ const entries = Array.isArray(values) ? Object.fromEntries(values.map((v2) => [v2, v2])) : values;
10773
10773
  return new Class2({
10774
10774
  type: "enum",
10775
10775
  entries,
@@ -10952,8 +10952,8 @@ function _stringbool(Classes, _params) {
10952
10952
  let truthyArray = params.truthy ?? ["true", "1", "yes", "on", "y", "enabled"];
10953
10953
  let falsyArray = params.falsy ?? ["false", "0", "no", "off", "n", "disabled"];
10954
10954
  if (params.case !== "sensitive") {
10955
- truthyArray = truthyArray.map((v) => typeof v === "string" ? v.toLowerCase() : v);
10956
- falsyArray = falsyArray.map((v) => typeof v === "string" ? v.toLowerCase() : v);
10955
+ truthyArray = truthyArray.map((v2) => typeof v2 === "string" ? v2.toLowerCase() : v2);
10956
+ falsyArray = falsyArray.map((v2) => typeof v2 === "string" ? v2.toLowerCase() : v2);
10957
10957
  }
10958
10958
  const truthySet = new Set(truthyArray);
10959
10959
  const falsySet = new Set(falsyArray);
@@ -11218,11 +11218,11 @@ var JSONSchemaGenerator = class {
11218
11218
  }
11219
11219
  const allKeys = new Set(Object.keys(shape));
11220
11220
  const requiredKeys = new Set([...allKeys].filter((key) => {
11221
- const v = def.shape[key]._zod;
11221
+ const v2 = def.shape[key]._zod;
11222
11222
  if (this.io === "input") {
11223
- return v.optin === void 0;
11223
+ return v2.optin === void 0;
11224
11224
  } else {
11225
- return v.optout === void 0;
11225
+ return v2.optout === void 0;
11226
11226
  }
11227
11227
  }));
11228
11228
  if (requiredKeys.size > 0) {
@@ -11244,9 +11244,9 @@ var JSONSchemaGenerator = class {
11244
11244
  case "union": {
11245
11245
  const json2 = _json;
11246
11246
  const isDiscriminated = def.discriminator !== void 0;
11247
- const options = def.options.map((x, i) => this.process(x, {
11247
+ const options = def.options.map((x2, i2) => this.process(x2, {
11248
11248
  ...params,
11249
- path: [...params.path, isDiscriminated ? "oneOf" : "anyOf", i]
11249
+ path: [...params.path, isDiscriminated ? "oneOf" : "anyOf", i2]
11250
11250
  }));
11251
11251
  if (isDiscriminated) {
11252
11252
  json2.oneOf = options;
@@ -11278,9 +11278,9 @@ var JSONSchemaGenerator = class {
11278
11278
  json2.type = "array";
11279
11279
  const prefixPath = this.target === "draft-2020-12" ? "prefixItems" : "items";
11280
11280
  const restPath = this.target === "draft-2020-12" ? "items" : this.target === "openapi-3.0" ? "items" : "additionalItems";
11281
- const prefixItems = def.items.map((x, i) => this.process(x, {
11281
+ const prefixItems = def.items.map((x2, i2) => this.process(x2, {
11282
11282
  ...params,
11283
- path: [...params.path, prefixPath, i]
11283
+ path: [...params.path, prefixPath, i2]
11284
11284
  }));
11285
11285
  const rest = def.rest ? this.process(def.rest, {
11286
11286
  ...params,
@@ -11345,9 +11345,9 @@ var JSONSchemaGenerator = class {
11345
11345
  case "enum": {
11346
11346
  const json2 = _json;
11347
11347
  const values = getEnumValues(def.entries);
11348
- if (values.every((v) => typeof v === "number"))
11348
+ if (values.every((v2) => typeof v2 === "number"))
11349
11349
  json2.type = "number";
11350
- if (values.every((v) => typeof v === "string"))
11350
+ if (values.every((v2) => typeof v2 === "string"))
11351
11351
  json2.type = "string";
11352
11352
  json2.enum = values;
11353
11353
  break;
@@ -11379,13 +11379,13 @@ var JSONSchemaGenerator = class {
11379
11379
  json2.const = val;
11380
11380
  }
11381
11381
  } else {
11382
- if (vals.every((v) => typeof v === "number"))
11382
+ if (vals.every((v2) => typeof v2 === "number"))
11383
11383
  json2.type = "number";
11384
- if (vals.every((v) => typeof v === "string"))
11384
+ if (vals.every((v2) => typeof v2 === "string"))
11385
11385
  json2.type = "string";
11386
- if (vals.every((v) => typeof v === "boolean"))
11386
+ if (vals.every((v2) => typeof v2 === "boolean"))
11387
11387
  json2.type = "string";
11388
- if (vals.every((v) => v === null))
11388
+ if (vals.every((v2) => v2 === null))
11389
11389
  json2.type = "null";
11390
11390
  json2.enum = vals;
11391
11391
  }
@@ -12548,7 +12548,7 @@ var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
12548
12548
  };
12549
12549
  });
12550
12550
  function _enum2(values, params) {
12551
- const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
12551
+ const entries = Array.isArray(values) ? Object.fromEntries(values.map((v2) => [v2, v2])) : values;
12552
12552
  return new ZodEnum({
12553
12553
  type: "enum",
12554
12554
  entries,
@@ -13064,10 +13064,10 @@ var ZodError2 = class _ZodError extends Error {
13064
13064
  fieldErrors._errors.push(mapper(issue2));
13065
13065
  } else {
13066
13066
  let curr = fieldErrors;
13067
- let i = 0;
13068
- while (i < issue2.path.length) {
13069
- const el = issue2.path[i];
13070
- const terminal = i === issue2.path.length - 1;
13067
+ let i2 = 0;
13068
+ while (i2 < issue2.path.length) {
13069
+ const el = issue2.path[i2];
13070
+ const terminal = i2 === issue2.path.length - 1;
13071
13071
  if (!terminal) {
13072
13072
  curr[el] = curr[el] || { _errors: [] };
13073
13073
  } else {
@@ -13075,7 +13075,7 @@ var ZodError2 = class _ZodError extends Error {
13075
13075
  curr[el]._errors.push(mapper(issue2));
13076
13076
  }
13077
13077
  curr = curr[el];
13078
- i++;
13078
+ i2++;
13079
13079
  }
13080
13080
  }
13081
13081
  }
@@ -13176,8 +13176,8 @@ var createIdGenerator = ({
13176
13176
  const generator = () => {
13177
13177
  const alphabetLength = alphabet.length;
13178
13178
  const chars = new Array(size);
13179
- for (let i = 0; i < size; i++) {
13180
- chars[i] = alphabet[Math.random() * alphabetLength | 0];
13179
+ for (let i2 = 0; i2 < size; i2++) {
13180
+ chars[i2] = alphabet[Math.random() * alphabetLength | 0];
13181
13181
  }
13182
13182
  return chars.join("");
13183
13183
  };
@@ -13393,11 +13393,11 @@ async function resolve(value) {
13393
13393
  return Promise.resolve(value);
13394
13394
  }
13395
13395
  var getRelativePath = (pathA, pathB) => {
13396
- let i = 0;
13397
- for (; i < pathA.length && i < pathB.length; i++) {
13398
- if (pathA[i] !== pathB[i]) break;
13396
+ let i2 = 0;
13397
+ for (; i2 < pathA.length && i2 < pathB.length; i2++) {
13398
+ if (pathA[i2] !== pathB[i2]) break;
13399
13399
  }
13400
- return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
13400
+ return [(pathA.length - i2).toString(), ...pathB.slice(i2)].join("/");
13401
13401
  };
13402
13402
  var ignoreOverride = Symbol(
13403
13403
  "Let zodToJsonSchema decide on which parser to use"
@@ -13498,7 +13498,7 @@ function parseDateDef(def, refs, overrideDateStrategy) {
13498
13498
  const strategy = overrideDateStrategy != null ? overrideDateStrategy : refs.dateStrategy;
13499
13499
  if (Array.isArray(strategy)) {
13500
13500
  return {
13501
- anyOf: strategy.map((item, i) => parseDateDef(def, refs, item))
13501
+ anyOf: strategy.map((item, i2) => parseDateDef(def, refs, item))
13502
13502
  };
13503
13503
  }
13504
13504
  switch (strategy) {
@@ -13563,7 +13563,7 @@ function parseIntersectionDef(def, refs) {
13563
13563
  ...refs,
13564
13564
  currentPath: [...refs.currentPath, "allOf", "1"]
13565
13565
  })
13566
- ].filter((x) => !!x);
13566
+ ].filter((x2) => !!x2);
13567
13567
  const mergedAllOf = [];
13568
13568
  allOf.forEach((schema) => {
13569
13569
  if (isJsonSchema7AllOfType(schema)) {
@@ -13788,17 +13788,17 @@ var ALPHA_NUMERIC = new Set(
13788
13788
  );
13789
13789
  function escapeNonAlphaNumeric(source) {
13790
13790
  let result = "";
13791
- for (let i = 0; i < source.length; i++) {
13792
- if (!ALPHA_NUMERIC.has(source[i])) {
13791
+ for (let i2 = 0; i2 < source.length; i2++) {
13792
+ if (!ALPHA_NUMERIC.has(source[i2])) {
13793
13793
  result += "\\";
13794
13794
  }
13795
- result += source[i];
13795
+ result += source[i2];
13796
13796
  }
13797
13797
  return result;
13798
13798
  }
13799
13799
  function addFormat(schema, value, message, refs) {
13800
13800
  var _a17;
13801
- if (schema.format || ((_a17 = schema.anyOf) == null ? void 0 : _a17.some((x) => x.format))) {
13801
+ if (schema.format || ((_a17 = schema.anyOf) == null ? void 0 : _a17.some((x2) => x2.format))) {
13802
13802
  if (!schema.anyOf) {
13803
13803
  schema.anyOf = [];
13804
13804
  }
@@ -13818,7 +13818,7 @@ function addFormat(schema, value, message, refs) {
13818
13818
  }
13819
13819
  function addPattern(schema, regex, message, refs) {
13820
13820
  var _a17;
13821
- if (schema.pattern || ((_a17 = schema.allOf) == null ? void 0 : _a17.some((x) => x.pattern))) {
13821
+ if (schema.pattern || ((_a17 = schema.allOf) == null ? void 0 : _a17.some((x2) => x2.pattern))) {
13822
13822
  if (!schema.allOf) {
13823
13823
  schema.allOf = [];
13824
13824
  }
@@ -13854,55 +13854,55 @@ function stringifyRegExpWithFlags(regex, refs) {
13854
13854
  let isEscaped = false;
13855
13855
  let inCharGroup = false;
13856
13856
  let inCharRange = false;
13857
- for (let i = 0; i < source.length; i++) {
13857
+ for (let i2 = 0; i2 < source.length; i2++) {
13858
13858
  if (isEscaped) {
13859
- pattern += source[i];
13859
+ pattern += source[i2];
13860
13860
  isEscaped = false;
13861
13861
  continue;
13862
13862
  }
13863
13863
  if (flags.i) {
13864
13864
  if (inCharGroup) {
13865
- if (source[i].match(/[a-z]/)) {
13865
+ if (source[i2].match(/[a-z]/)) {
13866
13866
  if (inCharRange) {
13867
- pattern += source[i];
13868
- pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();
13867
+ pattern += source[i2];
13868
+ pattern += `${source[i2 - 2]}-${source[i2]}`.toUpperCase();
13869
13869
  inCharRange = false;
13870
- } else if (source[i + 1] === "-" && ((_a17 = source[i + 2]) == null ? void 0 : _a17.match(/[a-z]/))) {
13871
- pattern += source[i];
13870
+ } else if (source[i2 + 1] === "-" && ((_a17 = source[i2 + 2]) == null ? void 0 : _a17.match(/[a-z]/))) {
13871
+ pattern += source[i2];
13872
13872
  inCharRange = true;
13873
13873
  } else {
13874
- pattern += `${source[i]}${source[i].toUpperCase()}`;
13874
+ pattern += `${source[i2]}${source[i2].toUpperCase()}`;
13875
13875
  }
13876
13876
  continue;
13877
13877
  }
13878
- } else if (source[i].match(/[a-z]/)) {
13879
- pattern += `[${source[i]}${source[i].toUpperCase()}]`;
13878
+ } else if (source[i2].match(/[a-z]/)) {
13879
+ pattern += `[${source[i2]}${source[i2].toUpperCase()}]`;
13880
13880
  continue;
13881
13881
  }
13882
13882
  }
13883
13883
  if (flags.m) {
13884
- if (source[i] === "^") {
13884
+ if (source[i2] === "^") {
13885
13885
  pattern += `(^|(?<=[\r
13886
13886
  ]))`;
13887
13887
  continue;
13888
- } else if (source[i] === "$") {
13888
+ } else if (source[i2] === "$") {
13889
13889
  pattern += `($|(?=[\r
13890
13890
  ]))`;
13891
13891
  continue;
13892
13892
  }
13893
13893
  }
13894
- if (flags.s && source[i] === ".") {
13895
- pattern += inCharGroup ? `${source[i]}\r
13896
- ` : `[${source[i]}\r
13894
+ if (flags.s && source[i2] === ".") {
13895
+ pattern += inCharGroup ? `${source[i2]}\r
13896
+ ` : `[${source[i2]}\r
13897
13897
  ]`;
13898
13898
  continue;
13899
13899
  }
13900
- pattern += source[i];
13901
- if (source[i] === "\\") {
13900
+ pattern += source[i2];
13901
+ if (source[i2] === "\\") {
13902
13902
  isEscaped = true;
13903
- } else if (inCharGroup && source[i] === "]") {
13903
+ } else if (inCharGroup && source[i2] === "]") {
13904
13904
  inCharGroup = false;
13905
- } else if (!inCharGroup && source[i] === "[") {
13905
+ } else if (!inCharGroup && source[i2] === "[") {
13906
13906
  inCharGroup = true;
13907
13907
  }
13908
13908
  }
@@ -14007,19 +14007,19 @@ var primitiveMappings = {
14007
14007
  function parseUnionDef(def, refs) {
14008
14008
  const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
14009
14009
  if (options.every(
14010
- (x) => x._def.typeName in primitiveMappings && (!x._def.checks || !x._def.checks.length)
14010
+ (x2) => x2._def.typeName in primitiveMappings && (!x2._def.checks || !x2._def.checks.length)
14011
14011
  )) {
14012
- const types = options.reduce((types2, x) => {
14013
- const type = primitiveMappings[x._def.typeName];
14012
+ const types = options.reduce((types2, x2) => {
14013
+ const type = primitiveMappings[x2._def.typeName];
14014
14014
  return type && !types2.includes(type) ? [...types2, type] : types2;
14015
14015
  }, []);
14016
14016
  return {
14017
14017
  type: types.length > 1 ? types : types[0]
14018
14018
  };
14019
- } else if (options.every((x) => x._def.typeName === "ZodLiteral" && !x.description)) {
14019
+ } else if (options.every((x2) => x2._def.typeName === "ZodLiteral" && !x2.description)) {
14020
14020
  const types = options.reduce(
14021
- (acc, x) => {
14022
- const type = typeof x._def.value;
14021
+ (acc, x2) => {
14022
+ const type = typeof x2._def.value;
14023
14023
  switch (type) {
14024
14024
  case "string":
14025
14025
  case "number":
@@ -14028,7 +14028,7 @@ function parseUnionDef(def, refs) {
14028
14028
  case "bigint":
14029
14029
  return [...acc, "integer"];
14030
14030
  case "object":
14031
- if (x._def.value === null) return [...acc, "null"];
14031
+ if (x2._def.value === null) return [...acc, "null"];
14032
14032
  case "symbol":
14033
14033
  case "undefined":
14034
14034
  case "function":
@@ -14039,24 +14039,24 @@ function parseUnionDef(def, refs) {
14039
14039
  []
14040
14040
  );
14041
14041
  if (types.length === options.length) {
14042
- const uniqueTypes = types.filter((x, i, a2) => a2.indexOf(x) === i);
14042
+ const uniqueTypes = types.filter((x2, i2, a2) => a2.indexOf(x2) === i2);
14043
14043
  return {
14044
14044
  type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
14045
14045
  enum: options.reduce(
14046
- (acc, x) => {
14047
- return acc.includes(x._def.value) ? acc : [...acc, x._def.value];
14046
+ (acc, x2) => {
14047
+ return acc.includes(x2._def.value) ? acc : [...acc, x2._def.value];
14048
14048
  },
14049
14049
  []
14050
14050
  )
14051
14051
  };
14052
14052
  }
14053
- } else if (options.every((x) => x._def.typeName === "ZodEnum")) {
14053
+ } else if (options.every((x2) => x2._def.typeName === "ZodEnum")) {
14054
14054
  return {
14055
14055
  type: "string",
14056
14056
  enum: options.reduce(
14057
- (acc, x) => [
14057
+ (acc, x2) => [
14058
14058
  ...acc,
14059
- ...x._def.values.filter((x2) => !acc.includes(x2))
14059
+ ...x2._def.values.filter((x22) => !acc.includes(x22))
14060
14060
  ],
14061
14061
  []
14062
14062
  )
@@ -14066,12 +14066,12 @@ function parseUnionDef(def, refs) {
14066
14066
  }
14067
14067
  var asAnyOf = (def, refs) => {
14068
14068
  const anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map(
14069
- (x, i) => parseDef(x._def, {
14069
+ (x2, i2) => parseDef(x2._def, {
14070
14070
  ...refs,
14071
- currentPath: [...refs.currentPath, "anyOf", `${i}`]
14071
+ currentPath: [...refs.currentPath, "anyOf", `${i2}`]
14072
14072
  })
14073
14073
  ).filter(
14074
- (x) => !!x && (!refs.strictUnions || typeof x === "object" && Object.keys(x).length > 0)
14074
+ (x2) => !!x2 && (!refs.strictUnions || typeof x2 === "object" && Object.keys(x2).length > 0)
14075
14075
  );
14076
14076
  return anyOf.length ? { anyOf } : void 0;
14077
14077
  };
@@ -14207,7 +14207,7 @@ var parsePipelineDef = (def, refs) => {
14207
14207
  currentPath: [...refs.currentPath, "allOf", a2 ? "1" : "0"]
14208
14208
  });
14209
14209
  return {
14210
- allOf: [a2, b2].filter((x) => x !== void 0)
14210
+ allOf: [a2, b2].filter((x2) => x2 !== void 0)
14211
14211
  };
14212
14212
  };
14213
14213
  function parsePromiseDef(def, refs) {
@@ -14237,12 +14237,12 @@ function parseTupleDef(def, refs) {
14237
14237
  type: "array",
14238
14238
  minItems: def.items.length,
14239
14239
  items: def.items.map(
14240
- (x, i) => parseDef(x._def, {
14240
+ (x2, i2) => parseDef(x2._def, {
14241
14241
  ...refs,
14242
- currentPath: [...refs.currentPath, "items", `${i}`]
14242
+ currentPath: [...refs.currentPath, "items", `${i2}`]
14243
14243
  })
14244
14244
  ).reduce(
14245
- (acc, x) => x === void 0 ? acc : [...acc, x],
14245
+ (acc, x2) => x2 === void 0 ? acc : [...acc, x2],
14246
14246
  []
14247
14247
  ),
14248
14248
  additionalItems: parseDef(def.rest._def, {
@@ -14256,12 +14256,12 @@ function parseTupleDef(def, refs) {
14256
14256
  minItems: def.items.length,
14257
14257
  maxItems: def.items.length,
14258
14258
  items: def.items.map(
14259
- (x, i) => parseDef(x._def, {
14259
+ (x2, i2) => parseDef(x2._def, {
14260
14260
  ...refs,
14261
- currentPath: [...refs.currentPath, "items", `${i}`]
14261
+ currentPath: [...refs.currentPath, "items", `${i2}`]
14262
14262
  })
14263
14263
  ).reduce(
14264
- (acc, x) => x === void 0 ? acc : [...acc, x],
14264
+ (acc, x2) => x2 === void 0 ? acc : [...acc, x2],
14265
14265
  []
14266
14266
  )
14267
14267
  };
@@ -14557,7 +14557,7 @@ function asSchema(schema) {
14557
14557
  }) : isSchema(schema) ? schema : typeof schema === "function" ? schema() : zodSchema(schema);
14558
14558
  }
14559
14559
 
14560
- // ../../node_modules/.pnpm/ai@5.0.106_zod@4.1.13/node_modules/ai/dist/index.mjs
14560
+ // ../../node_modules/.pnpm/ai@5.0.108_zod@4.1.13/node_modules/ai/dist/index.mjs
14561
14561
  var __defProp2 = Object.defineProperty;
14562
14562
  var __export2 = (target, all) => {
14563
14563
  for (var name16 in all)
@@ -14588,7 +14588,7 @@ var NoObjectGeneratedError = class extends AISDKError {
14588
14588
  }
14589
14589
  };
14590
14590
  _a62 = symbol62;
14591
- var VERSION = "5.0.106" ;
14591
+ var VERSION = "5.0.108" ;
14592
14592
  var dataContentSchema = external_exports.union([
14593
14593
  external_exports.string(),
14594
14594
  external_exports.instanceof(Uint8Array),
@@ -14935,11 +14935,11 @@ function fixJson(input) {
14935
14935
  const stack = ["ROOT"];
14936
14936
  let lastValidIndex = -1;
14937
14937
  let literalStart = null;
14938
- function processValueStart(char, i, swapState) {
14938
+ function processValueStart(char, i2, swapState) {
14939
14939
  {
14940
14940
  switch (char) {
14941
14941
  case '"': {
14942
- lastValidIndex = i;
14942
+ lastValidIndex = i2;
14943
14943
  stack.pop();
14944
14944
  stack.push(swapState);
14945
14945
  stack.push("INSIDE_STRING");
@@ -14948,8 +14948,8 @@ function fixJson(input) {
14948
14948
  case "f":
14949
14949
  case "t":
14950
14950
  case "n": {
14951
- lastValidIndex = i;
14952
- literalStart = i;
14951
+ lastValidIndex = i2;
14952
+ literalStart = i2;
14953
14953
  stack.pop();
14954
14954
  stack.push(swapState);
14955
14955
  stack.push("INSIDE_LITERAL");
@@ -14971,21 +14971,21 @@ function fixJson(input) {
14971
14971
  case "7":
14972
14972
  case "8":
14973
14973
  case "9": {
14974
- lastValidIndex = i;
14974
+ lastValidIndex = i2;
14975
14975
  stack.pop();
14976
14976
  stack.push(swapState);
14977
14977
  stack.push("INSIDE_NUMBER");
14978
14978
  break;
14979
14979
  }
14980
14980
  case "{": {
14981
- lastValidIndex = i;
14981
+ lastValidIndex = i2;
14982
14982
  stack.pop();
14983
14983
  stack.push(swapState);
14984
14984
  stack.push("INSIDE_OBJECT_START");
14985
14985
  break;
14986
14986
  }
14987
14987
  case "[": {
14988
- lastValidIndex = i;
14988
+ lastValidIndex = i2;
14989
14989
  stack.pop();
14990
14990
  stack.push(swapState);
14991
14991
  stack.push("INSIDE_ARRAY_START");
@@ -14994,7 +14994,7 @@ function fixJson(input) {
14994
14994
  }
14995
14995
  }
14996
14996
  }
14997
- function processAfterObjectValue(char, i) {
14997
+ function processAfterObjectValue(char, i2) {
14998
14998
  switch (char) {
14999
14999
  case ",": {
15000
15000
  stack.pop();
@@ -15002,13 +15002,13 @@ function fixJson(input) {
15002
15002
  break;
15003
15003
  }
15004
15004
  case "}": {
15005
- lastValidIndex = i;
15005
+ lastValidIndex = i2;
15006
15006
  stack.pop();
15007
15007
  break;
15008
15008
  }
15009
15009
  }
15010
15010
  }
15011
- function processAfterArrayValue(char, i) {
15011
+ function processAfterArrayValue(char, i2) {
15012
15012
  switch (char) {
15013
15013
  case ",": {
15014
15014
  stack.pop();
@@ -15016,18 +15016,18 @@ function fixJson(input) {
15016
15016
  break;
15017
15017
  }
15018
15018
  case "]": {
15019
- lastValidIndex = i;
15019
+ lastValidIndex = i2;
15020
15020
  stack.pop();
15021
15021
  break;
15022
15022
  }
15023
15023
  }
15024
15024
  }
15025
- for (let i = 0; i < input.length; i++) {
15026
- const char = input[i];
15025
+ for (let i2 = 0; i2 < input.length; i2++) {
15026
+ const char = input[i2];
15027
15027
  const currentState = stack[stack.length - 1];
15028
15028
  switch (currentState) {
15029
15029
  case "ROOT":
15030
- processValueStart(char, i, "FINISH");
15030
+ processValueStart(char, i2, "FINISH");
15031
15031
  break;
15032
15032
  case "INSIDE_OBJECT_START": {
15033
15033
  switch (char) {
@@ -15037,7 +15037,7 @@ function fixJson(input) {
15037
15037
  break;
15038
15038
  }
15039
15039
  case "}": {
15040
- lastValidIndex = i;
15040
+ lastValidIndex = i2;
15041
15041
  stack.pop();
15042
15042
  break;
15043
15043
  }
@@ -15075,18 +15075,18 @@ function fixJson(input) {
15075
15075
  break;
15076
15076
  }
15077
15077
  case "INSIDE_OBJECT_BEFORE_VALUE": {
15078
- processValueStart(char, i, "INSIDE_OBJECT_AFTER_VALUE");
15078
+ processValueStart(char, i2, "INSIDE_OBJECT_AFTER_VALUE");
15079
15079
  break;
15080
15080
  }
15081
15081
  case "INSIDE_OBJECT_AFTER_VALUE": {
15082
- processAfterObjectValue(char, i);
15082
+ processAfterObjectValue(char, i2);
15083
15083
  break;
15084
15084
  }
15085
15085
  case "INSIDE_STRING": {
15086
15086
  switch (char) {
15087
15087
  case '"': {
15088
15088
  stack.pop();
15089
- lastValidIndex = i;
15089
+ lastValidIndex = i2;
15090
15090
  break;
15091
15091
  }
15092
15092
  case "\\": {
@@ -15094,7 +15094,7 @@ function fixJson(input) {
15094
15094
  break;
15095
15095
  }
15096
15096
  default: {
15097
- lastValidIndex = i;
15097
+ lastValidIndex = i2;
15098
15098
  }
15099
15099
  }
15100
15100
  break;
@@ -15102,13 +15102,13 @@ function fixJson(input) {
15102
15102
  case "INSIDE_ARRAY_START": {
15103
15103
  switch (char) {
15104
15104
  case "]": {
15105
- lastValidIndex = i;
15105
+ lastValidIndex = i2;
15106
15106
  stack.pop();
15107
15107
  break;
15108
15108
  }
15109
15109
  default: {
15110
- lastValidIndex = i;
15111
- processValueStart(char, i, "INSIDE_ARRAY_AFTER_VALUE");
15110
+ lastValidIndex = i2;
15111
+ processValueStart(char, i2, "INSIDE_ARRAY_AFTER_VALUE");
15112
15112
  break;
15113
15113
  }
15114
15114
  }
@@ -15122,24 +15122,24 @@ function fixJson(input) {
15122
15122
  break;
15123
15123
  }
15124
15124
  case "]": {
15125
- lastValidIndex = i;
15125
+ lastValidIndex = i2;
15126
15126
  stack.pop();
15127
15127
  break;
15128
15128
  }
15129
15129
  default: {
15130
- lastValidIndex = i;
15130
+ lastValidIndex = i2;
15131
15131
  break;
15132
15132
  }
15133
15133
  }
15134
15134
  break;
15135
15135
  }
15136
15136
  case "INSIDE_ARRAY_AFTER_COMMA": {
15137
- processValueStart(char, i, "INSIDE_ARRAY_AFTER_VALUE");
15137
+ processValueStart(char, i2, "INSIDE_ARRAY_AFTER_VALUE");
15138
15138
  break;
15139
15139
  }
15140
15140
  case "INSIDE_STRING_ESCAPE": {
15141
15141
  stack.pop();
15142
- lastValidIndex = i;
15142
+ lastValidIndex = i2;
15143
15143
  break;
15144
15144
  }
15145
15145
  case "INSIDE_NUMBER": {
@@ -15154,7 +15154,7 @@ function fixJson(input) {
15154
15154
  case "7":
15155
15155
  case "8":
15156
15156
  case "9": {
15157
- lastValidIndex = i;
15157
+ lastValidIndex = i2;
15158
15158
  break;
15159
15159
  }
15160
15160
  case "e":
@@ -15166,24 +15166,24 @@ function fixJson(input) {
15166
15166
  case ",": {
15167
15167
  stack.pop();
15168
15168
  if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {
15169
- processAfterArrayValue(char, i);
15169
+ processAfterArrayValue(char, i2);
15170
15170
  }
15171
15171
  if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {
15172
- processAfterObjectValue(char, i);
15172
+ processAfterObjectValue(char, i2);
15173
15173
  }
15174
15174
  break;
15175
15175
  }
15176
15176
  case "}": {
15177
15177
  stack.pop();
15178
15178
  if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {
15179
- processAfterObjectValue(char, i);
15179
+ processAfterObjectValue(char, i2);
15180
15180
  }
15181
15181
  break;
15182
15182
  }
15183
15183
  case "]": {
15184
15184
  stack.pop();
15185
15185
  if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {
15186
- processAfterArrayValue(char, i);
15186
+ processAfterArrayValue(char, i2);
15187
15187
  }
15188
15188
  break;
15189
15189
  }
@@ -15195,24 +15195,24 @@ function fixJson(input) {
15195
15195
  break;
15196
15196
  }
15197
15197
  case "INSIDE_LITERAL": {
15198
- const partialLiteral = input.substring(literalStart, i + 1);
15198
+ const partialLiteral = input.substring(literalStart, i2 + 1);
15199
15199
  if (!"false".startsWith(partialLiteral) && !"true".startsWith(partialLiteral) && !"null".startsWith(partialLiteral)) {
15200
15200
  stack.pop();
15201
15201
  if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {
15202
- processAfterObjectValue(char, i);
15202
+ processAfterObjectValue(char, i2);
15203
15203
  } else if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {
15204
- processAfterArrayValue(char, i);
15204
+ processAfterArrayValue(char, i2);
15205
15205
  }
15206
15206
  } else {
15207
- lastValidIndex = i;
15207
+ lastValidIndex = i2;
15208
15208
  }
15209
15209
  break;
15210
15210
  }
15211
15211
  }
15212
15212
  }
15213
15213
  let result = input.slice(0, lastValidIndex + 1);
15214
- for (let i = stack.length - 1; i >= 0; i--) {
15215
- const state = stack[i];
15214
+ for (let i2 = stack.length - 1; i2 >= 0; i2--) {
15215
+ const state = stack[i2];
15216
15216
  switch (state) {
15217
15217
  case "INSIDE_STRING": {
15218
15218
  result += '"';
@@ -16065,61 +16065,82 @@ function readUIMessageStream({
16065
16065
  return createAsyncIterableStream(outputStream);
16066
16066
  }
16067
16067
 
16068
- // ../../node_modules/.pnpm/ami-sdk@0.0.1/node_modules/ami-sdk/dist/index.js
16069
- var n = "https://app.ami.dev";
16070
- var a = "https://bridge.ami.dev";
16071
- var s = `${n}/api/v1/trpc`;
16072
- var l = async (t) => {
16068
+ // ../../node_modules/.pnpm/nanoid@5.1.6/node_modules/nanoid/url-alphabet/index.js
16069
+ var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
16070
+
16071
+ // ../../node_modules/.pnpm/nanoid@5.1.6/node_modules/nanoid/index.browser.js
16072
+ var nanoid3 = (size = 21) => {
16073
+ let id = "";
16074
+ let bytes = crypto.getRandomValues(new Uint8Array(size |= 0));
16075
+ while (size--) {
16076
+ id += urlAlphabet[bytes[size] & 63];
16077
+ }
16078
+ return id;
16079
+ };
16080
+
16081
+ // ../../node_modules/.pnpm/ami-sdk@0.0.2/node_modules/ami-sdk/dist/index.js
16082
+ var a = "https://app.ami.dev";
16083
+ var s = "https://bridge.ami.dev";
16084
+ var i = `${a}/api/v1/trpc`;
16085
+ var l = async (e) => {
16073
16086
  let r = "completed";
16074
- const o = new AbortController(), a2 = t.getMessages(), s2 = await fetch(t.url, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${t.token}` }, body: JSON.stringify({ id: d(), chatId: t.chatId, projectId: t.projectId, agentUrl: n, cwd: t.context.environment.cwd, messages: a2, context: t.context }) }).then((e) => e.body ?? null);
16075
- if (!s2) throw new Error(`Agent response stream was not received from ${t.url}. Possible causes: network error, server did not return a response body, or agent endpoint misconfiguration.`);
16076
- const i = new g().parseStream(s2), c = new Array(), l2 = t.messages.at(-1), p2 = readUIMessageStream({ message: l2, stream: i.pipeThrough(new TransformStream({ transform(e, t2) {
16077
- c.push(e), t2.enqueue(e), "data-lifecycle" === e.type && (r = e.data.status);
16087
+ const o = new AbortController(), n = e.chatId ?? await g({ token: e.token, projectId: e.projectId }), s2 = e.getMessages(), i2 = await fetch(e.url, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${e.token}` }, body: JSON.stringify({ id: p(), chatId: n, projectId: e.projectId, agentUrl: a, cwd: e.context.environment.cwd, messages: s2, context: e.context }) }).then((t) => t.body ?? null);
16088
+ if (!i2) throw new Error(`Agent response stream was not received from ${e.url}. Possible causes: network error, server did not return a response body, or agent endpoint misconfiguration.`);
16089
+ const c = new w().parseStream(i2), d = new Array(), l2 = e.messages.at(-1), u2 = readUIMessageStream({ message: l2, stream: c.pipeThrough(new TransformStream({ transform(t, e2) {
16090
+ d.push(t), e2.enqueue(t), "data-lifecycle" === t.type && (r = t.data.status);
16078
16091
  } })), terminateOnError: true });
16079
- for await (const e of p2) {
16092
+ for await (const t of u2) {
16080
16093
  if (o.signal.aborted) break;
16081
- await t.upsertMessage(e);
16094
+ await e.upsertMessage(t);
16082
16095
  }
16083
- return r;
16096
+ return { status: r, chatId: n };
16084
16097
  };
16085
- var d = () => crypto.randomUUID();
16086
- var p = (e) => ({ id: e.id, role: e.role, parts: [{ type: "text", text: e.content }], createdAt: /* @__PURE__ */ new Date() });
16087
- var u = (e) => {
16088
- const t = (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", { weekday: "long", year: "numeric", month: "long", day: "numeric" });
16089
- return { cwd: e, homeDir: "", workingDirectory: e, isGitRepo: false, platform: "undefined" != typeof navigator ? navigator.platform : "unknown", osVersion: "", today: t, isCodeServerAvailable: false, rules: { agents: null, claude: null, gemini: null, cursor: null } };
16098
+ var p = () => nanoid3();
16099
+ var u = (t) => ({ id: t.id, role: t.role, parts: [{ type: "text", text: t.content }], createdAt: /* @__PURE__ */ new Date() });
16100
+ var h = (t) => {
16101
+ const e = (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", { weekday: "long", year: "numeric", month: "long", day: "numeric" });
16102
+ return { cwd: t, homeDir: "", workingDirectory: t, isGitRepo: false, platform: "undefined" != typeof navigator ? navigator.platform : "unknown", osVersion: "", today: e, isCodeServerAvailable: false, rules: { agents: null, claude: null, gemini: null, cursor: null } };
16103
+ };
16104
+ var g = async (t) => {
16105
+ const e = await fetch(`${i}/chats.create`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${t.token}` }, body: JSON.stringify({ projectId: t.projectId, hasBackgroundAgent: t.hasBackgroundAgent ?? false }) });
16106
+ if (!e.ok) {
16107
+ const t2 = await e.text();
16108
+ throw new Error(`Failed to create chat: ${e.status} ${e.statusText}${t2 ? ` - ${t2}` : ""}`);
16109
+ }
16110
+ return (await e.json()).result.data;
16090
16111
  };
16091
- var g = class extends DefaultChatTransport {
16092
- parseStream(e) {
16093
- return this.processResponseStream(e);
16112
+ var w = class extends DefaultChatTransport {
16113
+ parseStream(t) {
16114
+ return this.processResponseStream(t);
16094
16115
  }
16095
16116
  };
16096
- var m = (e) => external_exports.object({ result: external_exports.object({ data: e }) });
16097
- var h = m(external_exports.object({ token: external_exports.string() }));
16098
- var w = m(external_exports.object({ verified: external_exports.boolean(), expired: external_exports.boolean(), token: external_exports.string().optional(), bridge_token: external_exports.string().optional() }));
16099
- var f = external_exports.object({ id: external_exports.string(), authorId: external_exports.string(), color: external_exports.string().nullable(), gitRepo: external_exports.string().nullable(), title: external_exports.string().nullable(), archivedAt: external_exports.string().nullable(), createdAt: external_exports.string(), updatedAt: external_exports.string() });
16100
- m(external_exports.object({ hasMore: external_exports.boolean(), nextCursor: external_exports.number().optional(), projects: external_exports.array(f) }));
16101
- m(f);
16102
- var b = (e) => new Promise((t) => setTimeout(t, e));
16103
- var $ = async () => {
16104
- const e = await fetch(`${s}/user.token.registerDaemonToken`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({}) });
16105
- if (!e.ok) throw new Error(`Failed to create exchange token: ${e.status}`);
16106
- const t = await e.json();
16107
- return h.parse(t).result.data.token;
16117
+ var m = (t) => external_exports.object({ result: external_exports.object({ data: t }) });
16118
+ var f = m(external_exports.object({ token: external_exports.string() }));
16119
+ var y = m(external_exports.object({ verified: external_exports.boolean(), expired: external_exports.boolean(), token: external_exports.string().optional(), bridge_token: external_exports.string().optional() }));
16120
+ var k = external_exports.object({ id: external_exports.string(), authorId: external_exports.string(), color: external_exports.string().nullable(), gitRepo: external_exports.string().nullable(), title: external_exports.string().nullable(), archivedAt: external_exports.string().nullable(), createdAt: external_exports.string(), updatedAt: external_exports.string() });
16121
+ m(external_exports.object({ hasMore: external_exports.boolean(), nextCursor: external_exports.number().optional(), projects: external_exports.array(k) }));
16122
+ m(k);
16123
+ var b = (t) => new Promise((e) => setTimeout(e, t));
16124
+ var S = async () => {
16125
+ const t = await fetch(`${i}/user.token.registerDaemonToken`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({}) });
16126
+ if (!t.ok) throw new Error(`Failed to create exchange token: ${t.status}`);
16127
+ const e = await t.json();
16128
+ return f.parse(e).result.data.token;
16108
16129
  };
16109
- var j = async (e) => {
16110
- const t = new URLSearchParams({ input: JSON.stringify({ token: e }) }), r = await fetch(`${s}/user.token.checkIfVerified?${t}`, { method: "GET", headers: { "Content-Type": "application/json" } });
16130
+ var T = async (t) => {
16131
+ const e = new URLSearchParams({ input: JSON.stringify({ token: t }) }), r = await fetch(`${i}/user.token.checkIfVerified?${e}`, { method: "GET", headers: { "Content-Type": "application/json" } });
16111
16132
  if (!r.ok) throw new Error(`Failed to check verification: ${r.status}`);
16112
16133
  const o = await r.json();
16113
- return w.parse(o).result.data;
16134
+ return y.parse(o).result.data;
16114
16135
  };
16115
- var S = (e) => `${n}/daemon/auth?token=${e}`;
16116
- var T = async (e, t, r = 60) => {
16136
+ var x = (t) => `${a}/daemon/auth?token=${t}`;
16137
+ var v = async (t, e, r = 60) => {
16117
16138
  for (let o = 0; o < r; o++) {
16118
16139
  await b(1e3);
16119
16140
  try {
16120
- const r2 = await j(e);
16121
- if (r2.expired) return t("expired"), { success: false };
16122
- if (r2.verified) return t("success"), { success: true, token: r2.token, bridgeToken: r2.bridge_token };
16141
+ const r2 = await T(t);
16142
+ if (r2.expired) return e("expired"), { success: false };
16143
+ if (r2.verified) return e("success"), { success: true, token: r2.token, bridgeToken: r2.bridge_token };
16123
16144
  } catch {
16124
16145
  }
16125
16146
  }
@@ -16144,10 +16165,10 @@ var saveCachedToken = (token) => {
16144
16165
  }
16145
16166
  };
16146
16167
  var authenticate = async () => {
16147
- const exchangeToken = await $();
16148
- const authUrl = S(exchangeToken);
16168
+ const exchangeToken = await S();
16169
+ const authUrl = x(exchangeToken);
16149
16170
  window.open(authUrl, "_blank");
16150
- const result = await T(exchangeToken, () => {
16171
+ const result = await v(exchangeToken, () => {
16151
16172
  });
16152
16173
  if (!result.success || !result.token) {
16153
16174
  throw new Error("Authentication failed");
@@ -16189,14 +16210,14 @@ var runAgent = async (context, token, projectId, onStatus) => {
16189
16210
 
16190
16211
  ${context.content}`;
16191
16212
  const messages = [
16192
- p({
16193
- id: d(),
16213
+ u({
16214
+ id: p(),
16194
16215
  role: "user",
16195
16216
  content: fullPrompt
16196
16217
  })
16197
16218
  ];
16198
- const chatId = d();
16199
- const environment = u(window.location.href);
16219
+ const chatId = p();
16220
+ const environment = h(window.location.href);
16200
16221
  const upsertMessage = async (message) => {
16201
16222
  const existingIndex = messages.findIndex((m2) => m2.id === message.id);
16202
16223
  if (existingIndex >= 0) {
@@ -16211,21 +16232,28 @@ ${context.content}`;
16211
16232
  }
16212
16233
  }
16213
16234
  };
16214
- const status = await l({
16235
+ const { status } = await l({
16215
16236
  messages: sanitizeMessages(messages),
16216
16237
  context: {
16217
16238
  environment,
16218
16239
  systemContext: [],
16219
16240
  attachments: []
16220
16241
  },
16221
- url: `${a}/api/v1/agent-proxy`,
16242
+ url: `${s}/api/v1/agent-proxy`,
16222
16243
  chatId,
16223
16244
  projectId,
16224
16245
  token,
16225
16246
  upsertMessage,
16226
16247
  getMessages: () => sanitizeMessages(messages)
16227
16248
  });
16228
- return status === "completed" ? "Completed successfully" : `Task finished (${status})`;
16249
+ switch (status) {
16250
+ case "error":
16251
+ throw new Error("Failed to complete task");
16252
+ case "aborted":
16253
+ throw new Error("User aborted task");
16254
+ default:
16255
+ return "Completed successfully";
16256
+ }
16229
16257
  };
16230
16258
  var CONNECTION_CHECK_TTL_MS = 5e3;
16231
16259
  var createAmiAgentProvider = (projectId = DEFAULT_PROJECT_ID) => {
@@ -16255,6 +16283,7 @@ var createAmiAgentProvider = (projectId = DEFAULT_PROJECT_ID) => {
16255
16283
  };
16256
16284
  const agentPromise = runAgent(context, token, projectId, onStatus);
16257
16285
  let done = false;
16286
+ let caughtError = null;
16258
16287
  agentPromise.then((finalStatus) => {
16259
16288
  if (aborted2) return;
16260
16289
  statusQueue.push(finalStatus);
@@ -16265,8 +16294,7 @@ var createAmiAgentProvider = (projectId = DEFAULT_PROJECT_ID) => {
16265
16294
  }
16266
16295
  }).catch((error46) => {
16267
16296
  if (aborted2) return;
16268
- const errorMessage = error46 instanceof Error ? error46.message : "Unknown error";
16269
- statusQueue.push(`Error: ${errorMessage}`);
16297
+ caughtError = error46 instanceof Error ? error46 : new Error("Unknown error");
16270
16298
  done = true;
16271
16299
  if (resolveWait) {
16272
16300
  resolveWait();
@@ -16292,6 +16320,9 @@ var createAmiAgentProvider = (projectId = DEFAULT_PROJECT_ID) => {
16292
16320
  if (aborted2) {
16293
16321
  throw new DOMException("Aborted", "AbortError");
16294
16322
  }
16323
+ if (caughtError) {
16324
+ throw caughtError;
16325
+ }
16295
16326
  } finally {
16296
16327
  signal.removeEventListener("abort", handleAbort);
16297
16328
  }
@@ -16328,8 +16359,14 @@ var createAmiAgentProvider = (projectId = DEFAULT_PROJECT_ID) => {
16328
16359
  resolveWait = null;
16329
16360
  }
16330
16361
  };
16331
- const agentPromise = runAgent(context, token, DEFAULT_PROJECT_ID, onStatus);
16362
+ const agentPromise = runAgent(
16363
+ context,
16364
+ token,
16365
+ DEFAULT_PROJECT_ID,
16366
+ onStatus
16367
+ );
16332
16368
  let done = false;
16369
+ let caughtError = null;
16333
16370
  agentPromise.then((finalStatus) => {
16334
16371
  if (aborted2) return;
16335
16372
  statusQueue.push(finalStatus);
@@ -16340,8 +16377,7 @@ var createAmiAgentProvider = (projectId = DEFAULT_PROJECT_ID) => {
16340
16377
  }
16341
16378
  }).catch((error46) => {
16342
16379
  if (aborted2) return;
16343
- const errorMessage = error46 instanceof Error ? error46.message : "Unknown error";
16344
- statusQueue.push(`Error: ${errorMessage}`);
16380
+ caughtError = error46 instanceof Error ? error46 : new Error("Unknown error");
16345
16381
  done = true;
16346
16382
  if (resolveWait) {
16347
16383
  resolveWait();
@@ -16367,6 +16403,9 @@ var createAmiAgentProvider = (projectId = DEFAULT_PROJECT_ID) => {
16367
16403
  if (aborted2) {
16368
16404
  throw new DOMException("Aborted", "AbortError");
16369
16405
  }
16406
+ if (caughtError) {
16407
+ throw caughtError;
16408
+ }
16370
16409
  } finally {
16371
16410
  signal.removeEventListener("abort", handleAbort);
16372
16411
  }
@@ -16378,7 +16417,7 @@ var createAmiAgentProvider = (projectId = DEFAULT_PROJECT_ID) => {
16378
16417
  return connectionCache.result;
16379
16418
  }
16380
16419
  try {
16381
- const response = await fetch(a, { method: "HEAD" });
16420
+ const response = await fetch(s, { method: "HEAD" });
16382
16421
  const result = response.ok;
16383
16422
  connectionCache = { result, timestamp: now };
16384
16423
  return result;