@domino-sdk/relay 1.56.0 → 1.60.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.
Files changed (65) hide show
  1. package/CHANGELOG.md +100 -0
  2. package/dist/{accounts-DRPENuZe.d.ts → accounts-DoabriBX.d.ts} +21 -7
  3. package/dist/{attempt-captures-CxxO7DeD.d.ts → attempt-captures-W2dgzGqE.d.ts} +1 -1
  4. package/dist/authoring.d.ts +323 -39
  5. package/dist/authoring.js +312 -18
  6. package/dist/{automatic-outcomes-DxW_v5Wc.d.ts → automatic-outcomes-Cmou89IS.d.ts} +1 -1
  7. package/dist/avatar.d.ts +1 -2
  8. package/dist/browser.d.ts +19 -11
  9. package/dist/browser.js +12 -10
  10. package/dist/{capability-error-DSd8EMQC.d.ts → capability-error-DufwG3G0.d.ts} +21 -7
  11. package/dist/{chunk-OTITLABX.js → chunk-2FHNY52R.js} +8 -2
  12. package/dist/{chunk-QNQNKIAA.js → chunk-422J3QRW.js} +12 -2
  13. package/dist/{chunk-INSWI2VZ.js → chunk-4OFH4BNX.js} +1 -1
  14. package/dist/{chunk-KBVH4XZC.js → chunk-6ZG7WNYX.js} +1 -1
  15. package/dist/{chunk-BHHUSBSD.js → chunk-GBSDAD3N.js} +1627 -887
  16. package/dist/{chunk-W5U2WXG3.js → chunk-KUPVQXUJ.js} +2 -2
  17. package/dist/{chunk-G6XVBYH7.js → chunk-KWFY7L7X.js} +4 -4
  18. package/dist/{chunk-BJYMTCWG.js → chunk-MJEJQH5A.js} +18 -6
  19. package/dist/{chunk-ULQU7KC4.js → chunk-N3LJ6GFK.js} +1 -5
  20. package/dist/{chunk-ABJ4G47X.js → chunk-N7YOS4ZU.js} +1 -1
  21. package/dist/{chunk-MNU6UPXY.js → chunk-OTEUP2SG.js} +1 -1
  22. package/dist/{chunk-NK6EER33.js → chunk-VVRQQRMQ.js} +12 -12
  23. package/dist/{chunk-H2MD6E7Z.js → chunk-VWMIA2TT.js} +8 -2
  24. package/dist/{chunk-RBPMT53S.js → chunk-XQKUJL7H.js} +25 -5
  25. package/dist/{chunk-CXKXPB7K.js → chunk-Y2IGFLD2.js} +36 -11
  26. package/dist/{chunk-VSHV7FEA.js → chunk-YNW2ZUUP.js} +56 -153
  27. package/dist/{chunk-CK7HO32Z.js → chunk-YOAPPIWN.js} +2 -2
  28. package/dist/{client-bX3oTpRu.d.ts → client-Cw1pB5sv.d.ts} +121 -117
  29. package/dist/{deployments-D3lxfQMB.d.ts → deployments-DI-W7fBq.d.ts} +1105 -182
  30. package/dist/{groups-DPE004_V.d.ts → groups-9Jm3peq3.d.ts} +14 -7
  31. package/dist/index.d.ts +10 -11
  32. package/dist/index.js +9 -9
  33. package/dist/{integrations-CcD5NPEA.d.ts → integrations-CmIkP1Gi.d.ts} +48 -32
  34. package/dist/internal.d.ts +10 -10
  35. package/dist/internal.js +8 -8
  36. package/dist/{offers-CtzMeB7O.d.ts → offers-CqXfMIxq.d.ts} +7 -2
  37. package/dist/{pages-BlLqB8ZQ.d.ts → pages-Bti7g5mX.d.ts} +184 -10
  38. package/dist/{participant-activity-iciCEs_8.d.ts → participant-activity-DHL8QYks.d.ts} +4 -0
  39. package/dist/portal-proxy.js +3 -3
  40. package/dist/react/index.d.ts +74 -74
  41. package/dist/react/index.js +10 -10
  42. package/dist/runtime/authoring.js +1 -1
  43. package/dist/runtime/chunks/ADUMK6CR.js +1 -0
  44. package/dist/runtime/chunks/EWU4OKSY.js +62 -0
  45. package/dist/runtime/manifest.json +5 -5
  46. package/dist/runtime/schema.js +1 -1
  47. package/dist/runtime/zod.js +1 -1
  48. package/dist/{schema-C4m9RhCR.d.ts → schema-CwbRkmlr.d.ts} +324 -35
  49. package/dist/schema.d.ts +854 -437
  50. package/dist/schema.js +103 -25
  51. package/dist/server/index.d.ts +10 -10
  52. package/dist/server/index.js +711 -81
  53. package/dist/{submission-input-wTiYGdgA.d.ts → submission-input-D9EGH_yb.d.ts} +2 -2
  54. package/dist/{telegram-browser-Bh3i0HiH.d.ts → telegram-browser-CTJh4Ro_.d.ts} +4 -4
  55. package/dist/testing.d.ts +89 -9
  56. package/dist/testing.js +218 -13
  57. package/dist/{transport-CnKA-_RL.d.ts → transport-B8Ss5lcz.d.ts} +9189 -2009
  58. package/dist/wallet-DZWL7lJH.d.ts +972 -0
  59. package/dist/{x-1czZFVUW.d.ts → x-KFJD2x8y.d.ts} +3 -3
  60. package/package.json +2 -2
  61. package/dist/profiles-BoOK03cR.d.ts +0 -299
  62. package/dist/runtime/chunks/IDOMZWRY.js +0 -40
  63. package/dist/runtime/chunks/NDB42VFF.js +0 -1
  64. package/dist/util.d-w9f9t3ua.d.ts +0 -5
  65. package/dist/wallet-Ac7OFpOr.d.ts +0 -228
@@ -508,7 +508,9 @@ var discordResourceSourceSchema = z6.union([
508
508
  z6.strictObject({
509
509
  provider: z6.literal("discord"),
510
510
  resource: z6.literal("channel"),
511
- types: z6.array(z6.enum(["text", "announcement"])).min(1)
511
+ types: z6.array(z6.enum(["text", "announcement"])).min(1),
512
+ /** List channels Domino's bot cannot post in as unavailable, for an announcement's channel. */
513
+ postable: z6.literal(true).optional()
512
514
  }),
513
515
  z6.strictObject({
514
516
  provider: z6.literal("discord"),
@@ -692,6 +694,26 @@ var annotations = /* @__PURE__ */ new Set([
692
694
  "readOnly",
693
695
  "writeOnly"
694
696
  ]);
697
+ function singleTypes(schema) {
698
+ if (Array.isArray(schema)) {
699
+ return schema.map(singleTypes);
700
+ }
701
+ if (typeof schema !== "object" || schema === null) {
702
+ return schema;
703
+ }
704
+ const node2 = Object.fromEntries(
705
+ Object.entries(schema).map(([key, value]) => [key, singleTypes(value)])
706
+ );
707
+ if (!Array.isArray(node2.type)) {
708
+ return node2;
709
+ }
710
+ const { type, ...rest } = node2;
711
+ return {
712
+ anyOf: type.map(
713
+ (each) => each === "null" ? { type: each } : { ...rest, type: each }
714
+ )
715
+ };
716
+ }
695
717
  function subset(schema, path) {
696
718
  if (typeof schema !== "object" || schema === null || Array.isArray(schema)) {
697
719
  return schema;
@@ -725,9 +747,9 @@ function subset(schema, path) {
725
747
  return kept;
726
748
  }
727
749
  function trackerDataSchema(schema) {
728
- let json4;
750
+ let json5;
729
751
  try {
730
- json4 = z7.toJSONSchema(schema, {
752
+ json5 = z7.toJSONSchema(schema, {
731
753
  target: "draft-2020-12",
732
754
  io: "input",
733
755
  unrepresentable: "throw",
@@ -754,7 +776,9 @@ function trackerDataSchema(schema) {
754
776
  message.startsWith("Tracker data schemas") ? message : `Tracker data schemas describe JSON: ${message}. Use z.unknown() for any JSON value.`
755
777
  );
756
778
  }
757
- const parsed = trackerDataSchemaSchema.safeParse(subset(json4, "data"));
779
+ const parsed = trackerDataSchemaSchema.safeParse(
780
+ subset(singleTypes(json5), "data")
781
+ );
758
782
  if (!parsed.success) {
759
783
  throw new Error(
760
784
  parsed.error.issues.map((issue) => issue.message).join("; ")
@@ -901,26 +925,26 @@ function matches(schema, value, at, budget) {
901
925
  }
902
926
  }
903
927
  if (typeof value === "object" && value !== null && !Array.isArray(value)) {
904
- const object20 = value;
928
+ const object21 = value;
905
929
  const properties = schema.properties ?? {};
906
930
  const required = schema.required ?? [];
907
931
  charge(budget, required.length);
908
932
  for (const key of required) {
909
- if (!Object.hasOwn(object20, key)) {
933
+ if (!Object.hasOwn(object21, key)) {
910
934
  return issue(() => `missing required key "${clip(key, maxKeyText)}"`);
911
935
  }
912
936
  }
913
937
  const literals = literalsOf(schema);
914
938
  charge(budget, literals.length);
915
939
  for (const [key, property] of literals) {
916
- if (Object.hasOwn(object20, key) && object20[key] !== property.const) {
940
+ if (Object.hasOwn(object21, key) && object21[key] !== property.const) {
917
941
  return {
918
942
  at: { parent: at, key },
919
943
  reason: () => `expected ${JSON.stringify(property.const)}`
920
944
  };
921
945
  }
922
946
  }
923
- const keys = Object.keys(object20);
947
+ const keys = Object.keys(object21);
924
948
  charge(budget, keys.length);
925
949
  const names = schema.propertyNames?.enum;
926
950
  const allowed = names && setOf(schema.propertyNames, names);
@@ -941,7 +965,7 @@ function matches(schema, value, at, budget) {
941
965
  if (property && property !== true) {
942
966
  const found = matches(
943
967
  property,
944
- object20[key],
968
+ object21[key],
945
969
  { parent: at, key },
946
970
  budget
947
971
  );
@@ -1072,7 +1096,7 @@ function schemaCheckedReader(reader) {
1072
1096
  }
1073
1097
  const issues = trackerDataIssues(
1074
1098
  schema,
1075
- page.items.map((record10) => record10.data)
1099
+ page.items.map((record11) => record11.data)
1076
1100
  );
1077
1101
  const items = page.items.filter((_, index) => !issues[index]);
1078
1102
  return { ...page, items, excluded: page.items.length - items.length };
@@ -1094,22 +1118,42 @@ function whereSchemaIssue(schema, where) {
1094
1118
  return null;
1095
1119
  }
1096
1120
 
1121
+ // src/tracker-namespaces.ts
1122
+ var telegramReactionsNamespace = "telegram-reactions";
1123
+ var telegramMessagesNamespace = "telegram-messages";
1124
+ var youtubeShortsNamespace = "youtube-shorts";
1125
+ var tiktokVideosNamespace = "tiktok-videos";
1126
+ var walletBalancesNamespace = "wallet-balances";
1127
+
1097
1128
  // src/trackers.ts
1129
+ import * as z10 from "zod";
1130
+
1131
+ // src/lifecycle-reason.ts
1098
1132
  import * as z8 from "zod";
1099
- var timestamp = z8.number().int().safe().nonnegative().max(864e13);
1100
- var count = z8.number().int().safe().nonnegative();
1101
- var externalId = z8.string().min(1).max(256);
1133
+ var lifecycleReasonSchema = z8.string().trim().min(1).max(500);
1134
+
1135
+ // src/offset-date-time.ts
1136
+ import * as z9 from "zod";
1137
+ var offsetDateTime = /^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$/;
1138
+ function offsetDateTimeSchema() {
1139
+ return z9.iso.datetime({ offset: true, pattern: offsetDateTime });
1140
+ }
1141
+
1142
+ // src/trackers.ts
1143
+ var timestamp = z10.number().int().safe().nonnegative().max(864e13);
1144
+ var count = z10.number().int().safe().nonnegative();
1145
+ var externalId = z10.string().min(1).max(256);
1102
1146
  var metric = count.nullable().default(null);
1103
- var xTweetSchema = z8.looseObject({
1147
+ var xTweetSchema = z10.looseObject({
1104
1148
  id: externalId,
1105
1149
  userId: externalId,
1106
- content: z8.string(),
1107
- createdAt: z8.iso.datetime({ offset: true }),
1108
- author: z8.looseObject({
1150
+ content: z10.string(),
1151
+ createdAt: offsetDateTimeSchema(),
1152
+ author: z10.looseObject({
1109
1153
  id: externalId,
1110
- username: z8.string(),
1111
- name: z8.string(),
1112
- verified: z8.boolean().nullable().default(null)
1154
+ username: z10.string(),
1155
+ name: z10.string(),
1156
+ verified: z10.boolean().nullable().default(null)
1113
1157
  }),
1114
1158
  likeCount: metric,
1115
1159
  replyCount: metric,
@@ -1117,84 +1161,84 @@ var xTweetSchema = z8.looseObject({
1117
1161
  quoteCount: metric,
1118
1162
  viewCount: metric,
1119
1163
  bookmarkCount: metric,
1120
- isReply: z8.boolean(),
1121
- isRetweet: z8.boolean(),
1122
- isQuoteTweet: z8.boolean()
1123
- });
1124
- var xContentBodySchema = z8.strictObject({
1125
- version: z8.literal(1),
1126
- id: z8.string().min(1),
1127
- authorId: z8.string().min(1),
1164
+ isReply: z10.boolean(),
1165
+ isRetweet: z10.boolean(),
1166
+ isQuoteTweet: z10.boolean()
1167
+ });
1168
+ var xContentBodySchema = z10.strictObject({
1169
+ version: z10.literal(1),
1170
+ id: z10.string().min(1),
1171
+ authorId: z10.string().min(1),
1128
1172
  publishedAt: timestamp,
1129
- text: z8.string(),
1130
- isReply: z8.boolean(),
1131
- isRetweet: z8.boolean(),
1132
- isQuoteTweet: z8.boolean(),
1133
- media: z8.array(z8.strictObject({ type: z8.string(), url: z8.string() })).nullable(),
1134
- mentionedAuthorIds: z8.array(z8.string().min(1)).nullable(),
1135
- videoLengthSeconds: z8.number().nonnegative().nullable(),
1136
- references: z8.strictObject({
1137
- replyId: z8.string().nullable(),
1138
- replyAuthorId: z8.string().nullable(),
1139
- quoteId: z8.string().nullable(),
1140
- quoteAuthorId: z8.string().nullable(),
1141
- repostId: z8.string().nullable(),
1142
- repostAuthorId: z8.string().nullable()
1173
+ text: z10.string(),
1174
+ isReply: z10.boolean(),
1175
+ isRetweet: z10.boolean(),
1176
+ isQuoteTweet: z10.boolean(),
1177
+ media: z10.array(z10.strictObject({ type: z10.string(), url: z10.string() })).nullable(),
1178
+ mentionedAuthorIds: z10.array(z10.string().min(1)).nullable(),
1179
+ videoLengthSeconds: z10.number().nonnegative().nullable(),
1180
+ references: z10.strictObject({
1181
+ replyId: z10.string().nullable(),
1182
+ replyAuthorId: z10.string().nullable(),
1183
+ quoteId: z10.string().nullable(),
1184
+ quoteAuthorId: z10.string().nullable(),
1185
+ repostId: z10.string().nullable(),
1186
+ repostAuthorId: z10.string().nullable()
1143
1187
  })
1144
1188
  });
1145
- var trackerContentQuerySchema = z8.strictObject({
1189
+ var trackerContentQuerySchema = z10.strictObject({
1146
1190
  id: externalId,
1147
- observation: z8.string().regex(/^observation_[a-f0-9]{64}$/)
1191
+ observation: z10.string().regex(/^observation_[a-f0-9]{64}$/)
1148
1192
  });
1149
1193
  var trackerContentReadSchema = trackerContentQuerySchema.extend({
1150
1194
  member: identifier
1151
1195
  });
1152
1196
  var attributionContext = { member: identifier, capturedAt: timestamp };
1153
- var trackerEvidenceSchema = z8.strictObject({
1197
+ var trackerEvidenceSchema = z10.strictObject({
1154
1198
  contentRevision: identifier,
1155
1199
  observation: identifier
1156
1200
  });
1157
- var trackerContentSchema = z8.strictObject({
1201
+ var trackerContentSchema = z10.strictObject({
1158
1202
  tracker: identifier,
1159
- source: z8.literal("x"),
1203
+ source: z10.literal("x"),
1160
1204
  evidence: trackerEvidenceSchema,
1161
1205
  content: xContentBodySchema,
1162
1206
  observedAt: timestamp,
1163
- removed: z8.boolean(),
1164
- attribution: z8.discriminatedUnion("kind", [
1165
- z8.strictObject({
1207
+ removed: z10.boolean(),
1208
+ attribution: z10.discriminatedUnion("kind", [
1209
+ z10.strictObject({
1166
1210
  ...attributionContext,
1167
- kind: z8.literal("linked"),
1168
- account: z8.strictObject({
1169
- provider: z8.literal("x"),
1170
- issuer: z8.string().min(1),
1211
+ kind: z10.literal("linked"),
1212
+ account: z10.strictObject({
1213
+ provider: z10.literal("x"),
1214
+ issuer: z10.string().min(1),
1171
1215
  subject: externalId,
1172
1216
  revision: count,
1173
1217
  linkedAt: timestamp.nullable()
1174
1218
  })
1175
1219
  }),
1176
- z8.strictObject({ ...attributionContext, kind: z8.literal("unlinked") }),
1177
- z8.strictObject({
1220
+ z10.strictObject({ ...attributionContext, kind: z10.literal("unlinked") }),
1221
+ z10.strictObject({
1178
1222
  ...attributionContext,
1179
- kind: z8.literal("different-author")
1223
+ kind: z10.literal("different-author")
1180
1224
  })
1181
1225
  ])
1182
1226
  });
1183
1227
  var knownIdentityKinds = ["wallet", "x", "discord", "member"];
1184
- var appIdentityKindSchema = z8.templateLiteral([
1228
+ var appIdentityKindSchema = z10.templateLiteral([
1185
1229
  "app:",
1186
- z8.string().regex(
1230
+ z10.string().regex(
1187
1231
  /^[a-z0-9][a-z0-9_-]{0,39}$/,
1188
1232
  "Name an app identity kind like app:telegram: lowercase letters, digits, _ or -, at most 40"
1189
1233
  )
1190
1234
  ]);
1191
- var identityKindSchema = z8.union([
1192
- z8.enum(knownIdentityKinds),
1235
+ var identityKindSchema = z10.union([
1236
+ z10.enum(knownIdentityKinds),
1193
1237
  appIdentityKindSchema
1194
1238
  ]);
1195
1239
  var isAppIdentityKind = (kind) => kind.startsWith("app:");
1196
- var openIdentityKindSchema = z8.string().min(1).max(64);
1197
- var memberIdentitySchema = z8.object({
1240
+ var openIdentityKindSchema = z10.string().min(1).max(64);
1241
+ var memberIdentitySchema = z10.object({
1198
1242
  kind: openIdentityKindSchema,
1199
1243
  /** The stable user ID for `x` and `discord`; the subject your app signed the member in with for `app:<name>`. */
1200
1244
  subject: externalId,
@@ -1206,13 +1250,13 @@ var memberIdentitySchema = z8.object({
1206
1250
  /** The latest link time, refreshed on app identity relink; null when the link time is unknown. */
1207
1251
  linkedAt: timestamp.nullable()
1208
1252
  });
1209
- var accountRoleSchema = z8.string().regex(
1253
+ var accountRoleSchema = z10.string().regex(
1210
1254
  /^[a-zA-Z][a-zA-Z0-9_]{0,39}$/,
1211
1255
  "Name roles like author or recipient: a letter, then letters, digits or underscores"
1212
1256
  );
1213
1257
  var xAccountRoles = ["author", "inReplyTo"];
1214
1258
  var distinct = (values2) => new Set(values2).size === values2.length;
1215
- var contentMetricNameSchema = z8.string().regex(
1259
+ var contentMetricNameSchema = z10.string().regex(
1216
1260
  /^[a-z][a-zA-Z0-9]{0,39}$/,
1217
1261
  "Name metrics like likes or watchTime: a lowercase letter, then letters or digits"
1218
1262
  );
@@ -1224,24 +1268,31 @@ var xContentMetrics = [
1224
1268
  "views",
1225
1269
  "bookmarks"
1226
1270
  ];
1227
- var customContentSchema = z8.strictObject({
1228
- metrics: z8.array(contentMetricNameSchema).max(10).refine(distinct, "List each metric once")
1271
+ var customContentSchema = z10.strictObject({
1272
+ metrics: z10.array(contentMetricNameSchema).max(10).refine(distinct, "List each metric once")
1273
+ });
1274
+ var walletBalanceSourceSchema = z10.strictObject({
1275
+ chain: z10.string().regex(
1276
+ /^(?:solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp|eip155:[1-9][0-9]{0,15}|cosmos:[-_a-zA-Z0-9]{1,32})$/,
1277
+ 'Use "solana", an EVM chain such as "eip155:8453" or a Cosmos network such as "cosmos:cosmoshub-4"'
1278
+ ),
1279
+ token: z10.string().min(1).max(128).nullable()
1229
1280
  });
1230
- var xSearchSourceSchema = z8.object({
1231
- kind: z8.literal("x-search"),
1232
- query: z8.string().trim().min(1).max(2e3)
1281
+ var xSearchSourceSchema = z10.object({
1282
+ kind: z10.literal("x-search"),
1283
+ query: z10.string().trim().min(1).max(2e3)
1233
1284
  }).strict();
1234
- var customSourceSchema = z8.object({
1235
- kind: z8.literal("custom"),
1285
+ var customSourceSchema = z10.object({
1286
+ kind: z10.literal("custom"),
1236
1287
  namespace: identifier,
1237
1288
  /**
1238
1289
  * The identity kinds a record's author and named accounts can be, attributed to members
1239
1290
  * through verified links: `wallet`, `x`, `discord`, `member`, or your app's own `app:<name>`.
1240
1291
  * Omitted when authors are opaque IDs, which no quest can pay.
1241
1292
  */
1242
- identities: z8.array(identityKindSchema).min(1).max(8).refine(distinct, "List each identity kind once").optional(),
1293
+ identities: z10.array(identityKindSchema).min(1).max(8).refine(distinct, "List each identity kind once").optional(),
1243
1294
  /** Roles of the named accounts records can carry besides their author, such as `recipient`. */
1244
- accounts: z8.array(accountRoleSchema).min(1).max(10).refine(distinct, "List each account role once").refine(
1295
+ accounts: z10.array(accountRoleSchema).min(1).max(10).refine(distinct, "List each account role once").refine(
1245
1296
  (roles) => !roles.includes("author"),
1246
1297
  "author is every record's own role; name other accounts"
1247
1298
  ).optional(),
@@ -1256,15 +1307,23 @@ var customSourceSchema = z8.object({
1256
1307
  * use the tracker with `content()`. `customSource(namespace, { content })` sets it with the
1257
1308
  * matching `data` schema.
1258
1309
  */
1259
- content: customContentSchema.optional()
1310
+ content: customContentSchema.optional(),
1311
+ /**
1312
+ * The chain and token Relay samples, on `wallet.balances()`'s reserved namespace only.
1313
+ * `wallet.balances()` sets it.
1314
+ */
1315
+ balance: walletBalanceSourceSchema.optional()
1260
1316
  }).strict().refine(
1317
+ (source) => source.balance === void 0 || source.namespace === walletBalancesNamespace,
1318
+ "Only wallet.balances() samples a balance"
1319
+ ).refine(
1261
1320
  (source) => !source.content || source.data?.properties?.body?.type === "object" && (source.data.required ?? []).includes("body"),
1262
1321
  "A content source's data schema has a required object body"
1263
1322
  ).refine(
1264
1323
  (source) => !source.accounts || source.identities,
1265
1324
  "Named accounts need identities"
1266
1325
  );
1267
- var trackerSourceSchema = z8.discriminatedUnion("kind", [
1326
+ var trackerSourceSchema = z10.discriminatedUnion("kind", [
1268
1327
  xSearchSourceSchema,
1269
1328
  customSourceSchema,
1270
1329
  discordMessagesSourceSchema,
@@ -1301,59 +1360,59 @@ function sourceContent(source) {
1301
1360
  return void 0;
1302
1361
  }
1303
1362
  }
1304
- var windowSchema = z8.object({ start: timestamp, end: timestamp.optional() }).strict().refine(
1363
+ var windowSchema = z10.object({ start: timestamp, end: timestamp.optional() }).strict().refine(
1305
1364
  (w) => w.end === void 0 || w.end > w.start,
1306
1365
  "End must follow start"
1307
1366
  );
1308
- var trackerDefinitionSchema = z8.object({
1367
+ var trackerDefinitionSchema = z10.object({
1309
1368
  key: identifier,
1310
- title: z8.string().trim().min(1).max(120),
1369
+ title: z10.string().trim().min(1).max(120),
1311
1370
  source: trackerSourceSchema,
1312
1371
  window: windowSchema,
1313
- refreshSeconds: z8.number().int().min(300).max(86400).default(21600),
1314
- maxPages: z8.number().int().min(1).max(1e3).default(60)
1372
+ refreshSeconds: z10.number().int().min(300).max(86400).default(21600),
1373
+ maxPages: z10.number().int().min(1).max(1e3).default(60)
1315
1374
  }).strict();
1316
- var trackerArtifactSchema = z8.union([
1375
+ var trackerArtifactSchema = z10.union([
1317
1376
  trackerDefinitionSchema,
1318
- z8.object({ code: z8.string().min(1).max(2e6) }).strict()
1377
+ z10.object({ code: z10.string().min(1).max(2e6) }).strict()
1319
1378
  ]);
1320
- var knownTrackerSourceResponseSchema = z8.discriminatedUnion("kind", [
1321
- z8.object(xSearchSourceSchema.shape),
1322
- z8.object({
1379
+ var knownTrackerSourceResponseSchema = z10.discriminatedUnion("kind", [
1380
+ z10.object(xSearchSourceSchema.shape),
1381
+ z10.object({
1323
1382
  ...customSourceSchema.shape,
1324
- identities: z8.array(openIdentityKindSchema).optional()
1383
+ identities: z10.array(openIdentityKindSchema).optional()
1325
1384
  }),
1326
- z8.object(discordMessagesSourceSchema.shape),
1327
- z8.object(discordReactionsSourceSchema.shape)
1385
+ z10.object(discordMessagesSourceSchema.shape),
1386
+ z10.object(discordReactionsSourceSchema.shape)
1328
1387
  ]);
1329
- var trackerSourceResponseSchema = z8.union([
1388
+ var trackerSourceResponseSchema = z10.union([
1330
1389
  knownTrackerSourceResponseSchema,
1331
- z8.object({
1332
- kind: z8.string().min(1).refine(
1390
+ z10.object({
1391
+ kind: z10.string().min(1).refine(
1333
1392
  (kind) => !trackerSourceKinds.some((known) => known === kind),
1334
1393
  "Known source kinds must match their schema"
1335
1394
  )
1336
- }).catchall(z8.json())
1395
+ }).catchall(z10.json())
1337
1396
  ]);
1338
1397
  function isKnownTrackerSource(source) {
1339
1398
  return knownTrackerSourceResponseSchema.safeParse(source).success;
1340
1399
  }
1341
- var trackerDefinitionResponseSchema = z8.object({
1400
+ var trackerDefinitionResponseSchema = z10.object({
1342
1401
  ...trackerDefinitionSchema.shape,
1343
1402
  source: trackerSourceResponseSchema,
1344
- window: z8.object(windowSchema.shape)
1403
+ window: z10.object(windowSchema.shape)
1345
1404
  });
1346
- var publishedTrackerSchema = z8.object({
1405
+ var publishedTrackerSchema = z10.object({
1347
1406
  id: identifier,
1348
1407
  version: identifier,
1349
1408
  definition: trackerDefinitionResponseSchema,
1350
1409
  publishedAt: timestamp,
1351
- actor: z8.string().nullable()
1410
+ actor: z10.string().nullable()
1352
1411
  });
1353
- var trackerStatusSchema = z8.object({
1354
- archivedAt: z8.number().int().nonnegative().nullable().optional(),
1412
+ var trackerStatusSchema = z10.object({
1413
+ archivedAt: z10.number().int().nonnegative().nullable().optional(),
1355
1414
  published: publishedTrackerSchema,
1356
- paused: z8.boolean(),
1415
+ paused: z10.boolean(),
1357
1416
  /**
1358
1417
  * Why a paused tracker is paused, null when it isn't: `operator` (paused by hand),
1359
1418
  * `x-budget-exhausted` (the project's monthly X budget, or in test the organization's, is spent;
@@ -1361,29 +1420,79 @@ var trackerStatusSchema = z8.object({
1361
1420
  * `test-window-ended` (a test X tracker collects for 14 days; resume it for another 14). Treat an
1362
1421
  * unknown reason, which a newer Relay can add, as paused. Older servers leave it out.
1363
1422
  */
1364
- pauseReason: z8.string().nullable().optional(),
1423
+ pauseReason: z10.string().nullable().optional(),
1365
1424
  /** When a tracker paused on its X budget resumes on its own: the start of the next UTC month. */
1366
1425
  resumesAt: timestamp.nullable().optional(),
1367
1426
  /**
1368
1427
  * The interval a scheduled tracker actually runs at: `refreshSeconds`, but no shorter than the
1369
1428
  * project's plan allows (6 hours, shorter on Enterprise). Older servers leave it out.
1370
1429
  */
1371
- effectiveRefreshSeconds: z8.number().int().positive().optional(),
1372
- state: z8.enum(["idle", "syncing", "error", "complete"]),
1430
+ effectiveRefreshSeconds: z10.number().int().positive().optional(),
1431
+ state: z10.enum(["idle", "syncing", "error", "complete"]),
1373
1432
  lastStartedAt: timestamp.nullable(),
1374
1433
  lastCompletedAt: timestamp.nullable(),
1375
1434
  nextSyncAt: timestamp.nullable(),
1376
- coverage: z8.enum(["unknown", "partial", "complete"]),
1377
- error: z8.string().nullable(),
1435
+ coverage: z10.enum(["unknown", "partial", "complete"]),
1436
+ error: z10.string().nullable(),
1378
1437
  records: count,
1379
1438
  /**
1380
1439
  * Who owns the definition: `code` for a tracker a deployment publishes from `defineTracker`,
1381
- * `data` for an X search tracker created with `management.trackers.create` or in Console, which
1382
- * only `management.trackers.update` changes. Older servers leave it out.
1440
+ * `data` for a tracker created with `management.trackers.create` or in Console, which only
1441
+ * `management.trackers.update` changes. Older servers leave it out.
1383
1442
  */
1384
- origin: z8.enum(["code", "data"]).optional()
1443
+ origin: z10.enum(["code", "data"]).optional()
1385
1444
  });
1386
- var trackerPropertiesSchema = z8.object({
1445
+ var managedTrackerSourceSchema = z10.discriminatedUnion("kind", [
1446
+ xSearchSourceSchema,
1447
+ discordMessagesSourceSchema,
1448
+ discordReactionsSourceSchema,
1449
+ z10.strictObject({ kind: z10.literal("telegram-messages") }),
1450
+ z10.strictObject({ kind: z10.literal("telegram-reactions") }),
1451
+ z10.strictObject({ kind: z10.literal("youtube-shorts") }),
1452
+ z10.strictObject({ kind: z10.literal("tiktok-videos") }),
1453
+ /** `wallet.balances({ chain, token })`, with the chain's CAIP-2 ID and a null `token` for a native coin. */
1454
+ z10.strictObject({
1455
+ kind: z10.literal("wallet-balances"),
1456
+ ...walletBalanceSourceSchema.shape
1457
+ })
1458
+ ]);
1459
+ var managedTrackerSourceKinds = [
1460
+ "x-search",
1461
+ "discord-messages",
1462
+ "discord-reactions",
1463
+ "telegram-messages",
1464
+ "telegram-reactions",
1465
+ "youtube-shorts",
1466
+ "tiktok-videos",
1467
+ "wallet-balances"
1468
+ ];
1469
+ var namespacedSourceKinds = {
1470
+ [telegramMessagesNamespace]: "telegram-messages",
1471
+ [telegramReactionsNamespace]: "telegram-reactions",
1472
+ [youtubeShortsNamespace]: "youtube-shorts",
1473
+ [tiktokVideosNamespace]: "tiktok-videos"
1474
+ };
1475
+ function managedTrackerSource(source) {
1476
+ if (!isKnownTrackerSource(source)) {
1477
+ return void 0;
1478
+ }
1479
+ switch (source.kind) {
1480
+ case "x-search":
1481
+ return { kind: "x-search", query: source.query };
1482
+ case "discord-messages":
1483
+ return { kind: "discord-messages", text: source.text ?? false };
1484
+ case "discord-reactions":
1485
+ return { kind: "discord-reactions" };
1486
+ case "custom":
1487
+ if (source.namespace === walletBalancesNamespace) {
1488
+ return source.balance ? { kind: "wallet-balances", ...source.balance } : void 0;
1489
+ }
1490
+ return Object.hasOwn(namespacedSourceKinds, source.namespace) ? {
1491
+ kind: namespacedSourceKinds[source.namespace]
1492
+ } : void 0;
1493
+ }
1494
+ }
1495
+ var trackerPropertiesSchema = z10.object({
1387
1496
  title: trackerDefinitionSchema.shape.title,
1388
1497
  /** The X search query. A new query collects from now on; it never searches the past. */
1389
1498
  query: xSearchSourceSchema.shape.query,
@@ -1398,73 +1507,87 @@ var trackerCreateSchema = trackerPropertiesSchema.extend({
1398
1507
  maxPages: trackerDefinitionSchema.shape.maxPages,
1399
1508
  actionId: identifier
1400
1509
  }).strict();
1401
- var trackerUpdateSchema = trackerPropertiesSchema.partial().extend({ actionId: identifier }).strict().refine(
1510
+ var managedTrackerCreateSchema = trackerCreateSchema.extend({
1511
+ query: xSearchSourceSchema.shape.query.optional(),
1512
+ source: managedTrackerSourceSchema.optional()
1513
+ }).refine(
1514
+ (input) => input.query === void 0 !== (input.source === void 0),
1515
+ "Name the source with source, or an X search with query, not both"
1516
+ );
1517
+ var trackerUpdateSchema = trackerPropertiesSchema.partial().extend({
1518
+ source: managedTrackerSourceSchema.optional(),
1519
+ actionId: identifier
1520
+ }).strict().refine(
1402
1521
  ({ actionId: _, ...changes }) => Object.values(changes).some((value) => value !== void 0),
1403
1522
  "Change at least one field"
1523
+ ).refine(
1524
+ (input) => input.query === void 0 || input.source === void 0,
1525
+ "Change the query with source or query, not both"
1404
1526
  );
1405
- var trackerControlSchema = z8.object({
1527
+ var trackerControlSchema = z10.object({
1406
1528
  actionId: identifier,
1407
- action: z8.enum(["pause", "resume", "refresh"])
1529
+ action: z10.enum(["pause", "resume", "refresh"]),
1530
+ reason: lifecycleReasonSchema.optional()
1408
1531
  }).strict();
1409
- var trackerAccountSchema = z8.strictObject({
1532
+ var trackerAccountSchema = z10.strictObject({
1410
1533
  kind: identityKindSchema.optional(),
1411
1534
  id: externalId
1412
1535
  });
1413
- var trackerRecordInputSchema = z8.object({
1536
+ var trackerRecordInputSchema = z10.object({
1414
1537
  id: externalId,
1415
1538
  occurredAt: timestamp,
1416
1539
  observedAt: timestamp,
1417
- author: z8.object({
1540
+ author: z10.object({
1418
1541
  id: externalId,
1419
- verified: z8.boolean().nullable().default(null),
1542
+ verified: z10.boolean().nullable().default(null),
1420
1543
  /** The author's identity kind; needed when the source names more than one. */
1421
1544
  kind: identityKindSchema.optional()
1422
1545
  }).strict().nullable().default(null),
1423
1546
  /** Named accounts besides the author, by the roles the custom source declares. */
1424
- accounts: z8.record(accountRoleSchema, trackerAccountSchema).refine(
1547
+ accounts: z10.record(accountRoleSchema, trackerAccountSchema).refine(
1425
1548
  (accounts) => Object.keys(accounts).length <= 10,
1426
1549
  "At most 10 accounts"
1427
1550
  ).optional(),
1428
- data: z8.record(z8.string(), z8.json()),
1429
- removed: z8.boolean().default(false)
1551
+ data: z10.record(z10.string(), z10.json()),
1552
+ removed: z10.boolean().default(false)
1430
1553
  }).strict().refine(
1431
1554
  (v) => new TextEncoder().encode(JSON.stringify(v.data)).byteLength <= 131072,
1432
1555
  "Record exceeds 128 KB"
1433
1556
  );
1434
- var trackerRecordAccountSchema = z8.object({
1557
+ var trackerRecordAccountSchema = z10.object({
1435
1558
  kind: openIdentityKindSchema.optional(),
1436
- id: z8.string()
1559
+ id: z10.string()
1437
1560
  });
1438
- var trackerRecordSchema = z8.object({
1439
- id: z8.string(),
1561
+ var trackerRecordSchema = z10.object({
1562
+ id: z10.string(),
1440
1563
  occurredAt: timestamp,
1441
1564
  observedAt: timestamp,
1442
- author: z8.object({
1443
- id: z8.string(),
1444
- verified: z8.boolean().nullable().default(null),
1565
+ author: z10.object({
1566
+ id: z10.string(),
1567
+ verified: z10.boolean().nullable().default(null),
1445
1568
  kind: openIdentityKindSchema.optional()
1446
1569
  }).nullable().default(null),
1447
- accounts: z8.record(z8.string(), trackerRecordAccountSchema).optional(),
1448
- data: z8.record(z8.string(), z8.json()),
1449
- removed: z8.boolean().default(false),
1450
- source: z8.string(),
1570
+ accounts: z10.record(z10.string(), trackerRecordAccountSchema).optional(),
1571
+ data: z10.record(z10.string(), z10.json()),
1572
+ removed: z10.boolean().default(false),
1573
+ source: z10.string(),
1451
1574
  firstSeenAt: timestamp,
1452
1575
  /**
1453
1576
  * True on a record an operator sent for a test member (`management.testMembers.record`), in
1454
1577
  * test only. Absent on every other record.
1455
1578
  */
1456
- synthetic: z8.literal(true).optional(),
1579
+ synthetic: z10.literal(true).optional(),
1457
1580
  /** Present only when includeEvidence is true; custom sources have no X evidence. */
1458
1581
  evidence: trackerEvidenceSchema.nullable().optional()
1459
1582
  });
1460
- var trackerIngestSchema = z8.object({
1583
+ var trackerIngestSchema = z10.object({
1461
1584
  actionId: identifier,
1462
- records: z8.array(trackerRecordInputSchema).min(1).max(100)
1585
+ records: z10.array(trackerRecordInputSchema).min(1).max(100)
1463
1586
  }).strict();
1464
- var trackerIngestResultSchema = z8.object({
1587
+ var trackerIngestResultSchema = z10.object({
1465
1588
  stored: count,
1466
1589
  /** Tracker-trigger decisions this ingest caused. Absent from servers without tracker triggers. */
1467
- admissions: z8.object({
1590
+ admissions: z10.object({
1468
1591
  admitted: count,
1469
1592
  skipped: count,
1470
1593
  /**
@@ -1485,11 +1608,11 @@ var trackerOutcomeFields = {
1485
1608
  /** The release admitted, or the one active when the observation was skipped. */
1486
1609
  release: identifier,
1487
1610
  /** The account attribution resolved or failed to resolve, such as a CAIP-10 wallet ID. */
1488
- account: z8.string().nullable(),
1611
+ account: z10.string().nullable(),
1489
1612
  createdAt: timestamp,
1490
1613
  updatedAt: timestamp,
1491
1614
  /** Null for automatic decisions; the staff actor after a retry. */
1492
- actor: z8.string().nullable()
1615
+ actor: z10.string().nullable()
1493
1616
  };
1494
1617
  var trackerSkipCodes = [
1495
1618
  /** The quest is paused or no longer active. Catch-up after a pause is an operator decision. */
@@ -1544,26 +1667,26 @@ var trackerSkipCodes = [
1544
1667
  /** A prerequisite quest was not complete when the record occurred. */
1545
1668
  "prerequisites-incomplete"
1546
1669
  ];
1547
- var trackerOutcomeSchema = z8.discriminatedUnion("state", [
1548
- z8.object({
1670
+ var trackerOutcomeSchema = z10.discriminatedUnion("state", [
1671
+ z10.object({
1549
1672
  ...trackerOutcomeFields,
1550
- state: z8.literal("admitted"),
1551
- code: z8.null(),
1552
- reason: z8.null(),
1673
+ state: z10.literal("admitted"),
1674
+ code: z10.null(),
1675
+ reason: z10.null(),
1553
1676
  /** The attributed member. */
1554
1677
  member: identifier,
1555
1678
  /** The admitted attempt. Its evaluation, decision and rewards live on the attempt. */
1556
1679
  attempt: identifier
1557
1680
  }),
1558
- z8.object({
1681
+ z10.object({
1559
1682
  ...trackerOutcomeFields,
1560
- state: z8.literal("skipped"),
1683
+ state: z10.literal("skipped"),
1561
1684
  /** Why the observation was skipped, as one of `trackerSkipCodes`. */
1562
- code: z8.string().min(1),
1685
+ code: z10.string().min(1),
1563
1686
  /** Why the observation was skipped, for people. */
1564
- reason: z8.string(),
1687
+ reason: z10.string(),
1565
1688
  /** Which window refused admission when `code` is `outside-window`. */
1566
- window: z8.enum(["tracker", "quest"]).optional(),
1689
+ window: z10.enum(["tracker", "quest"]).optional(),
1567
1690
  /** The attributed member, when attribution got that far. */
1568
1691
  member: identifier.nullable(),
1569
1692
  attempt: identifier.nullable()
@@ -1574,67 +1697,67 @@ var trackerOutcomeFilters = {
1574
1697
  quest: identifier.optional(),
1575
1698
  record: externalId.optional(),
1576
1699
  member: identifier.optional(),
1577
- state: z8.enum(["admitted", "skipped"]).optional(),
1700
+ state: z10.enum(["admitted", "skipped"]).optional(),
1578
1701
  /** Only skips with this code, such as `unlinked-account`. */
1579
- code: z8.string().min(1).max(100).optional(),
1580
- limit: z8.coerce.number().int().min(1).max(100).default(25)
1702
+ code: z10.string().min(1).max(100).optional(),
1703
+ limit: z10.coerce.number().int().min(1).max(100).default(25)
1581
1704
  };
1582
- var trackerTriggerOutcomeQuerySchema = z8.strictObject({
1705
+ var trackerTriggerOutcomeQuerySchema = z10.strictObject({
1583
1706
  ...trackerOutcomeFilters,
1584
1707
  cursor: pageCursorSchema.optional()
1585
1708
  });
1586
- var trackerTriggerOutcomePageSchema = z8.object({
1587
- items: z8.array(trackerOutcomeSchema).max(100),
1709
+ var trackerTriggerOutcomePageSchema = z10.object({
1710
+ items: z10.array(trackerOutcomeSchema).max(100),
1588
1711
  nextCursor: pageCursorSchema.nullable()
1589
1712
  });
1590
- var trackerOutcomeQuerySchema = z8.strictObject({
1713
+ var trackerOutcomeQuerySchema = z10.strictObject({
1591
1714
  ...trackerOutcomeFilters,
1592
1715
  /** Opaque cursor from `next`: older outcomes. */
1593
- before: z8.string().max(512).optional()
1716
+ before: z10.string().max(512).optional()
1594
1717
  });
1595
- var trackerOutcomePageSchema = z8.strictObject({
1718
+ var trackerOutcomePageSchema = z10.strictObject({
1596
1719
  /** Newest first. */
1597
- items: z8.array(trackerOutcomeSchema).max(100),
1598
- next: z8.string().nullable()
1720
+ items: z10.array(trackerOutcomeSchema).max(100),
1721
+ next: z10.string().nullable()
1599
1722
  });
1600
- var trackerOutcomeRetrySchema = z8.strictObject({
1723
+ var trackerOutcomeRetrySchema = z10.strictObject({
1601
1724
  actionId: identifier,
1602
1725
  /** Quest key or ID. */
1603
1726
  quest: identifier,
1604
1727
  record: externalId,
1605
1728
  observedAt: timestamp
1606
1729
  });
1607
- var booleanQuery = z8.union([
1608
- z8.boolean(),
1609
- z8.enum(["true", "false"]).transform((v) => v === "true")
1730
+ var booleanQuery = z10.union([
1731
+ z10.boolean(),
1732
+ z10.enum(["true", "false"]).transform((v) => v === "true")
1610
1733
  ]);
1611
- var trackerQuerySchema = z8.object({
1734
+ var trackerQuerySchema = z10.object({
1612
1735
  author: externalId.optional(),
1613
1736
  member: identifier.optional(),
1614
1737
  verified: booleanQuery.optional(),
1615
- since: z8.coerce.number().int().safe().nonnegative().optional(),
1616
- until: z8.coerce.number().int().safe().nonnegative().optional(),
1738
+ since: z10.coerce.number().int().safe().nonnegative().optional(),
1739
+ until: z10.coerce.number().int().safe().nonnegative().optional(),
1617
1740
  removed: booleanQuery.default(false),
1618
- minLikes: z8.coerce.number().int().safe().nonnegative().optional(),
1619
- minViews: z8.coerce.number().int().safe().nonnegative().optional(),
1620
- limit: z8.coerce.number().int().min(1).max(100).default(25),
1621
- cursor: z8.string().max(2048).optional(),
1741
+ minLikes: z10.coerce.number().int().safe().nonnegative().optional(),
1742
+ minViews: z10.coerce.number().int().safe().nonnegative().optional(),
1743
+ limit: z10.coerce.number().int().min(1).max(100).default(25),
1744
+ cursor: z10.string().max(2048).optional(),
1622
1745
  includeEvidence: booleanQuery.optional()
1623
1746
  }).strict().refine(
1624
1747
  (q) => q.since === void 0 || q.until === void 0 || q.until > q.since,
1625
1748
  "Until must follow since"
1626
1749
  );
1627
- var trackerPageSchema = z8.object({
1750
+ var trackerPageSchema = z10.object({
1628
1751
  tracker: identifier,
1629
- items: z8.array(trackerRecordSchema),
1630
- nextCursor: z8.string().nullable(),
1752
+ items: z10.array(trackerRecordSchema),
1753
+ nextCursor: z10.string().nullable(),
1631
1754
  total: count,
1632
1755
  status: trackerStatusSchema
1633
1756
  });
1634
- var trackerSummarySchema = z8.object({
1757
+ var trackerSummarySchema = z10.object({
1635
1758
  records: count,
1636
1759
  authors: count,
1637
- metrics: z8.object({
1760
+ metrics: z10.object({
1638
1761
  likes: count,
1639
1762
  replies: count,
1640
1763
  reposts: count,
@@ -1650,26 +1773,26 @@ var trackerPreviewLimits = {
1650
1773
  posts: 100,
1651
1774
  days: 30
1652
1775
  };
1653
- var trackerPreviewInputSchema = z8.object({
1776
+ var trackerPreviewInputSchema = z10.object({
1654
1777
  query: xSearchSourceSchema.shape.query,
1655
1778
  /** Start of the searched window. The window ends when the sample is fetched. */
1656
1779
  since: timestamp
1657
1780
  }).strict();
1658
- var trackerPreviewSchema = z8.object({
1659
- query: z8.string(),
1781
+ var trackerPreviewSchema = z10.object({
1782
+ query: z10.string(),
1660
1783
  since: timestamp,
1661
1784
  fetchedAt: timestamp,
1662
1785
  pages: count,
1663
1786
  /** Every match in the sample, newest first, verified or not. */
1664
- posts: z8.array(xTweetSchema).max(trackerPreviewLimits.posts),
1787
+ posts: z10.array(xTweetSchema).max(trackerPreviewLimits.posts),
1665
1788
  /** X had more matches than the sample holds. */
1666
- more: z8.boolean()
1789
+ more: z10.boolean()
1667
1790
  });
1668
1791
 
1669
1792
  // src/content.ts
1670
- import * as z9 from "zod";
1671
- var contentQualificationDecisionSchema = z9.strictObject({
1672
- kind: z9.enum([
1793
+ import * as z11 from "zod";
1794
+ var contentQualificationDecisionSchema = z11.strictObject({
1795
+ kind: z11.enum([
1673
1796
  "accept",
1674
1797
  "reject",
1675
1798
  "review",
@@ -1677,26 +1800,26 @@ var contentQualificationDecisionSchema = z9.strictObject({
1677
1800
  "progress",
1678
1801
  "superseded"
1679
1802
  ]),
1680
- reason: z9.string().nullable()
1803
+ reason: z11.string().nullable()
1681
1804
  });
1682
- var contentQualificationQuerySchema = z9.strictObject({
1805
+ var contentQualificationQuerySchema = z11.strictObject({
1683
1806
  quest: identifier,
1684
1807
  member: identifier.optional(),
1685
1808
  /** A content item's record ID in the quest's tracker. */
1686
- content: z9.string().min(1).max(256).optional(),
1809
+ content: z11.string().min(1).max(256).optional(),
1687
1810
  cursor: pageCursorSchema.optional()
1688
1811
  });
1689
- var contentQualificationSchema = z9.strictObject({
1812
+ var contentQualificationSchema = z11.strictObject({
1690
1813
  quest: identifier,
1691
1814
  /** The content item's record ID in the quest's tracker. */
1692
- content: z9.string(),
1815
+ content: z11.string(),
1693
1816
  member: identifier,
1694
1817
  release: identifier,
1695
1818
  attempt: identifier,
1696
1819
  revision: identifier,
1697
1820
  observation: identifier,
1698
- current: z9.boolean(),
1699
- state: z9.enum([
1821
+ current: z11.boolean(),
1822
+ state: z11.enum([
1700
1823
  "pending",
1701
1824
  "qualified",
1702
1825
  "unqualified",
@@ -1707,117 +1830,117 @@ var contentQualificationSchema = z9.strictObject({
1707
1830
  "blocked",
1708
1831
  "unavailable"
1709
1832
  ]),
1710
- reason: z9.string().nullable(),
1711
- reward: z9.strictObject({
1833
+ reason: z11.string().nullable(),
1834
+ reward: z11.strictObject({
1712
1835
  attempt: identifier.nullable(),
1713
1836
  completion: identifier.nullable(),
1714
- state: z9.enum(["unresolved", "awarded", "excluded"])
1837
+ state: z11.enum(["unresolved", "awarded", "excluded"])
1715
1838
  })
1716
1839
  });
1717
- var contentQualificationPageSchema = z9.strictObject({
1718
- items: z9.array(contentQualificationSchema),
1840
+ var contentQualificationPageSchema = z11.strictObject({
1841
+ items: z11.array(contentQualificationSchema),
1719
1842
  nextCursor: pageCursorSchema.nullable()
1720
1843
  });
1721
1844
  var contentMetricSchema = contentMetricNameSchema;
1722
- var contentMetricsSchema = z9.record(
1845
+ var contentMetricsSchema = z11.record(
1723
1846
  contentMetricSchema,
1724
- z9.number().int().safe().nonnegative()
1847
+ z11.number().int().safe().nonnegative()
1725
1848
  );
1726
- var contentPerformancePolicySchema = z9.strictObject({
1727
- metrics: z9.array(contentMetricSchema).min(1).max(10).refine(
1849
+ var contentPerformancePolicySchema = z11.strictObject({
1850
+ metrics: z11.array(contentMetricSchema).min(1).max(10).refine(
1728
1851
  (values2) => new Set(values2).size === values2.length,
1729
1852
  "Metrics must be unique"
1730
1853
  ),
1731
- maxAgeMs: z9.number().int().positive().max(864e5).default(36e5)
1854
+ maxAgeMs: z11.number().int().positive().max(864e5).default(36e5)
1732
1855
  });
1733
1856
 
1734
1857
  // src/counters.ts
1735
- import * as z10 from "zod";
1858
+ import * as z12 from "zod";
1736
1859
  var day = 864e5;
1737
- var counterGoalSchema = z10.object({
1738
- kind: z10.literal("count"),
1739
- count: z10.number().int().min(1).max(1e4)
1860
+ var counterGoalSchema = z12.object({
1861
+ kind: z12.literal("count"),
1862
+ count: z12.number().int().min(1).max(1e4)
1740
1863
  }).strict();
1741
- var counterWindowSchema = z10.discriminatedUnion("kind", [
1742
- z10.object({ kind: z10.literal("lifetime") }).strict(),
1743
- z10.object({
1744
- kind: z10.literal("calendar"),
1745
- period: z10.enum(["day", "week", "month"]),
1746
- latenessMs: z10.number().int().min(0).max(90 * day).default(7 * day)
1864
+ var counterWindowSchema = z12.discriminatedUnion("kind", [
1865
+ z12.object({ kind: z12.literal("lifetime") }).strict(),
1866
+ z12.object({
1867
+ kind: z12.literal("calendar"),
1868
+ period: z12.enum(["day", "week", "month"]),
1869
+ latenessMs: z12.number().int().min(0).max(90 * day).default(7 * day)
1747
1870
  }).strict(),
1748
- z10.object({
1749
- kind: z10.literal("rolling"),
1750
- durationMs: z10.number().int().min(1).max(365 * day)
1871
+ z12.object({
1872
+ kind: z12.literal("rolling"),
1873
+ durationMs: z12.number().int().min(1).max(365 * day)
1751
1874
  }).strict()
1752
1875
  ]);
1753
- var counterPolicySchema = z10.object({
1754
- kind: z10.literal("progress"),
1876
+ var counterPolicySchema = z12.object({
1877
+ kind: z12.literal("progress"),
1755
1878
  goal: counterGoalSchema,
1756
1879
  window: counterWindowSchema,
1757
- repeat: z10.enum(["once", "repeat"]).default("once")
1880
+ repeat: z12.enum(["once", "repeat"]).default("once")
1758
1881
  }).strict();
1759
- var achievementBase = z10.object({
1882
+ var achievementBase = z12.object({
1760
1883
  id: identifier,
1761
- ordinal: z10.number().int().positive(),
1762
- achievedAt: z10.number().int(),
1763
- window: z10.string()
1884
+ ordinal: z12.number().int().positive(),
1885
+ achievedAt: z12.number().int(),
1886
+ window: z12.string()
1764
1887
  });
1765
- var counterAchievementSchema = z10.discriminatedUnion("status", [
1888
+ var counterAchievementSchema = z12.discriminatedUnion("status", [
1766
1889
  achievementBase.extend({
1767
- status: z10.literal("revoked"),
1890
+ status: z12.literal("revoked"),
1768
1891
  completion: identifier,
1769
- revokedAt: z10.number().int()
1892
+ revokedAt: z12.number().int()
1770
1893
  }),
1771
1894
  achievementBase.extend({
1772
- status: z10.literal("awarded"),
1895
+ status: z12.literal("awarded"),
1773
1896
  completion: identifier
1774
1897
  }),
1775
1898
  achievementBase.extend({
1776
- status: z10.literal("budget-exhausted"),
1899
+ status: z12.literal("budget-exhausted"),
1777
1900
  budget: identifier
1778
1901
  })
1779
1902
  ]);
1780
- var counterProgressSchema = z10.object({
1781
- goal: z10.number().int().positive(),
1782
- current: z10.number().int().nonnegative(),
1783
- window: z10.object({
1784
- key: z10.string(),
1785
- start: z10.number().int().nullable(),
1786
- end: z10.number().int().nullable()
1903
+ var counterProgressSchema = z12.object({
1904
+ goal: z12.number().int().positive(),
1905
+ current: z12.number().int().nonnegative(),
1906
+ window: z12.object({
1907
+ key: z12.string(),
1908
+ start: z12.number().int().nullable(),
1909
+ end: z12.number().int().nullable()
1787
1910
  }),
1788
- repeat: z10.enum(["once", "repeat"]),
1789
- settled: z10.number().int().nonnegative(),
1911
+ repeat: z12.enum(["once", "repeat"]),
1912
+ settled: z12.number().int().nonnegative(),
1790
1913
  latest: counterAchievementSchema.nullable()
1791
1914
  });
1792
- var counterContributionSchema = z10.object({
1915
+ var counterContributionSchema = z12.object({
1793
1916
  id: identifier,
1794
- distinct: z10.string(),
1917
+ distinct: z12.string(),
1795
1918
  attempt: identifier,
1796
- occurredAt: z10.number().int(),
1797
- recordedAt: z10.number().int(),
1798
- window: z10.string(),
1799
- status: z10.enum(["counted", "late", "future", "excluded"]),
1919
+ occurredAt: z12.number().int(),
1920
+ recordedAt: z12.number().int(),
1921
+ window: z12.string(),
1922
+ status: z12.enum(["counted", "late", "future", "excluded"]),
1800
1923
  achievement: counterAchievementSchema.nullable(),
1801
- reason: z10.string().nullable()
1924
+ reason: z12.string().nullable()
1802
1925
  });
1803
- var counterHistorySchema = z10.object({
1804
- items: z10.array(counterContributionSchema),
1805
- nextCursor: z10.string().nullable()
1926
+ var counterHistorySchema = z12.object({
1927
+ items: z12.array(counterContributionSchema),
1928
+ nextCursor: z12.string().nullable()
1806
1929
  });
1807
- var counterModerationSchema = z10.object({
1808
- actionId: z10.uuid(),
1809
- excluded: z10.boolean(),
1810
- reason: z10.string().trim().min(1).max(2e3)
1930
+ var counterModerationSchema = z12.object({
1931
+ actionId: z12.uuid(),
1932
+ excluded: z12.boolean(),
1933
+ reason: z12.string().trim().min(1).max(2e3)
1811
1934
  }).strict();
1812
- var counterHistoryQuerySchema = z10.object({
1813
- cursor: z10.string().max(2e3).optional(),
1814
- limit: z10.coerce.number().int().min(1).max(100).optional()
1935
+ var counterHistoryQuerySchema = z12.object({
1936
+ cursor: z12.string().max(2e3).optional(),
1937
+ limit: z12.coerce.number().int().min(1).max(100).optional()
1815
1938
  }).strict();
1816
- var counterModerationResultSchema = z10.object({ excluded: z10.boolean() });
1939
+ var counterModerationResultSchema = z12.object({ excluded: z12.boolean() });
1817
1940
 
1818
1941
  // src/calendar.ts
1819
- import * as z11 from "zod";
1820
- var timestamp2 = z11.number().int().safe();
1942
+ import * as z13 from "zod";
1943
+ var timestamp2 = z13.number().int().safe();
1821
1944
  var fixedOffset = /^(?:[+-]|(?:Etc\/)?GMT[+-]\d|(?:EST|MST|HST)$)/i;
1822
1945
  function canonicalTimeZone(zone) {
1823
1946
  let resolved;
@@ -1833,18 +1956,18 @@ function canonicalTimeZone(zone) {
1833
1956
  }
1834
1957
  return fixedOffset.test(zone) || fixedOffset.test(resolved) ? null : resolved;
1835
1958
  }
1836
- var timeZoneSchema = z11.string().min(1).max(100).transform((zone, ctx) => {
1959
+ var timeZoneSchema = z13.string().min(1).max(100).transform((zone, ctx) => {
1837
1960
  const canonical = canonicalTimeZone(zone);
1838
1961
  if (canonical === null) {
1839
1962
  ctx.addIssue({
1840
1963
  code: "custom",
1841
1964
  message: fixedOffset.test(zone) ? "Use a named IANA timezone, such as Europe/Budapest or UTC. Fixed offsets have no daylight-saving rules." : "Use an IANA timezone name, such as Europe/Budapest or UTC"
1842
1965
  });
1843
- return z11.NEVER;
1966
+ return z13.NEVER;
1844
1967
  }
1845
1968
  return canonical;
1846
1969
  });
1847
- var timeZoneNameSchema = z11.string().min(1).max(100);
1970
+ var timeZoneNameSchema = z13.string().min(1).max(100);
1848
1971
  var movedTimeZone = (what) => `${what} no longer take a timeZone: they follow the project calendar. Set calendar.timeZone in relay.json or in Console settings.`;
1849
1972
  var record5 = (value) => typeof value === "object" && value !== null;
1850
1973
  function refuseStreakTimeZone(value, ctx) {
@@ -1868,78 +1991,78 @@ function refuseWindowTimeZone(value, ctx) {
1868
1991
  }
1869
1992
  return value;
1870
1993
  }
1871
- var calendarPeriodSchema = z11.enum(["lifetime", "day", "week", "month"]);
1872
- var projectCalendarSchema = z11.object({
1994
+ var calendarPeriodSchema = z13.enum(["lifetime", "day", "week", "month"]);
1995
+ var projectCalendarSchema = z13.object({
1873
1996
  /** The timezone of the current calendar day. */
1874
1997
  timeZone: timeZoneNameSchema,
1875
1998
  /** The current calendar date, such as `2026-10-01`. */
1876
- today: z11.string(),
1999
+ today: z13.string(),
1877
2000
  /** When the current calendar day ends, in epoch milliseconds. */
1878
2001
  nextBoundary: timestamp2,
1879
2002
  /** A change that takes effect at the next day boundary, or null. */
1880
- pending: z11.object({ timeZone: timeZoneNameSchema, effectiveAt: timestamp2 }).nullable(),
2003
+ pending: z13.object({ timeZone: timeZoneNameSchema, effectiveAt: timestamp2 }).nullable(),
1881
2004
  /** The `calendar.timeZone` the last deployment that declared one set, or null. */
1882
2005
  declared: timeZoneNameSchema.nullable(),
1883
2006
  /**
1884
2007
  * A stored timezone the calendar no longer accepts, such as a fixed offset a streak named before
1885
2008
  * v1. The calendar reads it as UTC until an operator chooses a timezone. Null otherwise.
1886
2009
  */
1887
- unsupported: z11.string().nullable().default(null)
2010
+ unsupported: z13.string().nullable().default(null)
1888
2011
  });
1889
- var projectCalendarInputSchema = z11.object({
2012
+ var projectCalendarInputSchema = z13.object({
1890
2013
  actionId: identifier,
1891
2014
  timeZone: timeZoneSchema,
1892
- reason: z11.string().trim().min(1).max(500)
2015
+ reason: z13.string().trim().min(1).max(500)
1893
2016
  }).strict();
1894
- var projectCalendarDeclarationSchema = z11.object({ timeZone: timeZoneSchema }).strict();
2017
+ var projectCalendarDeclarationSchema = z13.object({ timeZone: timeZoneSchema }).strict();
1895
2018
 
1896
2019
  // src/streaks.ts
1897
- import * as z12 from "zod";
1898
- var streakPolicySchema = z12.object({
1899
- kind: z12.literal("streak"),
1900
- days: z12.number().int().min(1).max(3650)
2020
+ import * as z14 from "zod";
2021
+ var streakPolicySchema = z14.object({
2022
+ kind: z14.literal("streak"),
2023
+ days: z14.number().int().min(1).max(3650)
1901
2024
  });
1902
- var streakProgressSchema = z12.object({
1903
- goal: z12.number().int().positive(),
1904
- current: z12.number().int().nonnegative(),
1905
- best: z12.number().int().nonnegative(),
1906
- today: z12.string(),
1907
- todayQualified: z12.boolean(),
2025
+ var streakProgressSchema = z14.object({
2026
+ goal: z14.number().int().positive(),
2027
+ current: z14.number().int().nonnegative(),
2028
+ best: z14.number().int().nonnegative(),
2029
+ today: z14.string(),
2030
+ todayQualified: z14.boolean(),
1908
2031
  timeZone: timeZoneNameSchema,
1909
- nextBoundary: z12.number().int(),
1910
- pendingTimeZone: z12.object({
2032
+ nextBoundary: z14.number().int(),
2033
+ pendingTimeZone: z14.object({
1911
2034
  timeZone: timeZoneNameSchema,
1912
- effectiveAt: z12.number().int()
2035
+ effectiveAt: z14.number().int()
1913
2036
  }).nullable(),
1914
- days: z12.array(
1915
- z12.object({
1916
- day: z12.number().int(),
1917
- date: z12.string(),
2037
+ days: z14.array(
2038
+ z14.object({
2039
+ day: z14.number().int(),
2040
+ date: z14.string(),
1918
2041
  // The zone the day was recorded in, as stored: days from before v1 can name a fixed offset.
1919
- timeZone: z12.string(),
1920
- occurredAt: z12.number().int()
2042
+ timeZone: z14.string(),
2043
+ occurredAt: z14.number().int()
1921
2044
  })
1922
2045
  ),
1923
- milestone: z12.discriminatedUnion("status", [
1924
- z12.object({ status: z12.literal("pending") }),
1925
- z12.object({
1926
- status: z12.literal("awarded"),
1927
- completion: z12.string(),
1928
- achievedAt: z12.number().int()
2046
+ milestone: z14.discriminatedUnion("status", [
2047
+ z14.object({ status: z14.literal("pending") }),
2048
+ z14.object({
2049
+ status: z14.literal("awarded"),
2050
+ completion: z14.string(),
2051
+ achievedAt: z14.number().int()
1929
2052
  }),
1930
- z12.object({
1931
- status: z12.literal("budget-exhausted"),
1932
- budget: z12.string(),
1933
- achievedAt: z12.number().int()
2053
+ z14.object({
2054
+ status: z14.literal("budget-exhausted"),
2055
+ budget: z14.string(),
2056
+ achievedAt: z14.number().int()
1934
2057
  })
1935
2058
  ])
1936
2059
  });
1937
2060
 
1938
2061
  // src/tracker-triggers.ts
1939
- import * as z13 from "zod";
1940
- var timestamp3 = z13.number().int().safe().nonnegative().max(864e13);
1941
- var count2 = z13.number().int().safe().nonnegative();
1942
- var trackerTriggerModeSchema = z13.enum([
2062
+ import * as z15 from "zod";
2063
+ var timestamp3 = z15.number().int().safe().nonnegative().max(864e13);
2064
+ var count2 = z15.number().int().safe().nonnegative();
2065
+ var trackerTriggerModeSchema = z15.enum([
1943
2066
  "new-record",
1944
2067
  "new-observation",
1945
2068
  "data-changed"
@@ -1947,20 +2070,20 @@ var trackerTriggerModeSchema = z13.enum([
1947
2070
  function defaultTriggerMode(source) {
1948
2071
  return source === "custom" ? "new-observation" : "new-record";
1949
2072
  }
1950
- var trackerBoundSchema = z13.union([
1951
- z13.number().finite(),
1952
- z13.strictObject({ setting: z13.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/) })
2073
+ var trackerBoundSchema = z15.union([
2074
+ z15.number().finite(),
2075
+ z15.strictObject({ setting: z15.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/) })
1953
2076
  ]);
1954
- var dataPath = z13.string().max(200).regex(
2077
+ var dataPath = z15.string().max(200).regex(
1955
2078
  /^[^.\s]+(\.[^.\s]+)*$/,
1956
2079
  "Use dot-separated keys, such as metrics.likes"
1957
2080
  );
1958
- var trackerConditionSchema = z13.union([
1959
- z13.strictObject({
2081
+ var trackerConditionSchema = z15.union([
2082
+ z15.strictObject({
1960
2083
  path: dataPath,
1961
- equals: z13.union([z13.string().max(1e3), z13.number().finite(), z13.boolean()])
2084
+ equals: z15.union([z15.string().max(1e3), z15.number().finite(), z15.boolean()])
1962
2085
  }),
1963
- z13.strictObject({
2086
+ z15.strictObject({
1964
2087
  path: dataPath,
1965
2088
  gt: trackerBoundSchema.optional(),
1966
2089
  gte: trackerBoundSchema.optional(),
@@ -1973,9 +2096,9 @@ var trackerConditionSchema = z13.union([
1973
2096
  "Compare with equals, gt, gte, lt or lte"
1974
2097
  )
1975
2098
  ]);
1976
- var trackerWhereSchema = z13.union([
2099
+ var trackerWhereSchema = z15.union([
1977
2100
  trackerConditionSchema,
1978
- z13.array(trackerConditionSchema).min(1).max(10)
2101
+ z15.array(trackerConditionSchema).min(1).max(10)
1979
2102
  ]);
1980
2103
  function whereConditions(where) {
1981
2104
  return where === void 0 ? [] : Array.isArray(where) ? where : [where];
@@ -1987,17 +2110,17 @@ function whereSettings(where) {
1987
2110
  )
1988
2111
  );
1989
2112
  }
1990
- var triggerEnrollmentSchema = z13.enum(["none", "required"]);
1991
- var triggerSinceSchema = z13.enum(["activation", "window", "enrollment"]);
1992
- var triggerHistoricalSchema = z13.enum(["staff", "claim", "automatic"]);
1993
- var trackerTriggerPolicySchema = z13.strictObject({
2113
+ var triggerEnrollmentSchema = z15.enum(["none", "required"]);
2114
+ var triggerSinceSchema = z15.enum(["activation", "window", "enrollment"]);
2115
+ var triggerHistoricalSchema = z15.enum(["staff", "claim", "automatic"]);
2116
+ var trackerTriggerPolicySchema = z15.strictObject({
1994
2117
  /** The tracker's authoring key; publication binds it to the tracker's stable ID. */
1995
2118
  tracker: identifier,
1996
2119
  /**
1997
2120
  * The tracker's source kind, one of `trackerSourceKinds` today. An open string, so readers of
1998
2121
  * releases keep parsing them when a later Relay adds a managed source.
1999
2122
  */
2000
- source: z13.string().min(1).max(100),
2123
+ source: z15.string().min(1).max(100),
2001
2124
  /** Which observations fire. */
2002
2125
  on: trackerTriggerModeSchema,
2003
2126
  where: trackerWhereSchema.optional(),
@@ -2018,7 +2141,7 @@ var trackerTriggerPolicySchema = z13.strictObject({
2018
2141
  * that re-evaluates edits and runs `performance`, firing on each new record and paying its
2019
2142
  * author.
2020
2143
  */
2021
- content: z13.literal(true).optional()
2144
+ content: z15.literal(true).optional()
2022
2145
  }).refine(
2023
2146
  (policy) => policy.since !== "enrollment" || policy.enrollment === "required",
2024
2147
  'since: "enrollment" needs enrollment: "required"'
@@ -2037,72 +2160,72 @@ function beneficiaryRole(policy) {
2037
2160
  return policy.beneficiary;
2038
2161
  }
2039
2162
  var xLink = {
2040
- issuer: z13.string().min(1),
2163
+ issuer: z15.string().min(1),
2041
2164
  /** The account's stable user ID. */
2042
- subject: z13.string().min(1).max(256),
2165
+ subject: z15.string().min(1).max(256),
2043
2166
  /** The member's account selection revision. */
2044
2167
  revision: count2,
2045
2168
  /** When the member linked the account; null when unknown. */
2046
2169
  linkedAt: timestamp3.nullable()
2047
2170
  };
2048
- var trackerAttributionSchema = z13.object({
2171
+ var trackerAttributionSchema = z15.object({
2049
2172
  member: identifier,
2050
2173
  capturedAt: timestamp3,
2051
- account: z13.union([
2052
- z13.object({
2053
- provider: z13.literal("wallet"),
2174
+ account: z15.union([
2175
+ z15.object({
2176
+ provider: z15.literal("wallet"),
2054
2177
  /** Canonical CAIP-10 account ID, as the record names it. */
2055
- id: z13.string().min(5).max(256),
2178
+ id: z15.string().min(5).max(256),
2056
2179
  /** The wallet link's revision. */
2057
2180
  revision: count2,
2058
2181
  /** When the member verified the wallet. */
2059
2182
  linkedAt: timestamp3.nullable()
2060
2183
  }),
2061
- z13.object({ provider: z13.literal("x"), ...xLink }),
2062
- z13.object({ provider: z13.literal("discord"), ...xLink }),
2063
- z13.object({
2064
- provider: z13.literal("member"),
2184
+ z15.object({ provider: z15.literal("x"), ...xLink }),
2185
+ z15.object({ provider: z15.literal("discord"), ...xLink }),
2186
+ z15.object({
2187
+ provider: z15.literal("member"),
2065
2188
  /** The member ID the record names. */
2066
2189
  id: identifier
2067
2190
  }),
2068
- z13.object({
2191
+ z15.object({
2069
2192
  /** Your app's identity kind, such as `app:telegram`. */
2070
2193
  provider: appIdentityKindSchema,
2071
2194
  /** The subject your app signed the member in with, as the record names it. */
2072
- subject: z13.string().min(1).max(256),
2195
+ subject: z15.string().min(1).max(256),
2073
2196
  /** The identity's revision in the project. */
2074
2197
  revision: count2,
2075
2198
  /** When the identity was linked to the member. */
2076
2199
  linkedAt: timestamp3.nullable()
2077
2200
  }),
2078
2201
  /** A kind a later Relay adds. */
2079
- z13.object({ provider: z13.string().min(1) })
2202
+ z15.object({ provider: z15.string().min(1) })
2080
2203
  ])
2081
2204
  });
2082
- var trackerTriggerRecordSchema = z13.object({
2083
- id: z13.string().min(1).max(256),
2084
- source: z13.string(),
2205
+ var trackerTriggerRecordSchema = z15.object({
2206
+ id: z15.string().min(1).max(256),
2207
+ source: z15.string(),
2085
2208
  occurredAt: timestamp3,
2086
2209
  observedAt: timestamp3,
2087
2210
  firstSeenAt: timestamp3,
2088
- author: z13.object({
2089
- id: z13.string().min(1).max(256),
2090
- verified: z13.boolean().nullable(),
2211
+ author: z15.object({
2212
+ id: z15.string().min(1).max(256),
2213
+ verified: z15.boolean().nullable(),
2091
2214
  kind: openIdentityKindSchema.optional()
2092
2215
  }).nullable(),
2093
- accounts: z13.record(accountRoleSchema, trackerRecordAccountSchema).optional(),
2094
- data: z13.record(z13.string(), z13.json()),
2095
- removed: z13.boolean()
2216
+ accounts: z15.record(accountRoleSchema, trackerRecordAccountSchema).optional(),
2217
+ data: z15.record(z15.string(), z15.json()),
2218
+ removed: z15.boolean()
2096
2219
  });
2097
- var trackerContentStageSchema = z13.object({
2220
+ var trackerContentStageSchema = z15.object({
2098
2221
  /** The body's revision: the hash of its canonical JSON. Edits make a new one. */
2099
2222
  revision: identifier,
2100
2223
  /** The captured observation that carried this body. */
2101
2224
  observation: identifier,
2102
2225
  /** The body: an X post's normalized body, or a custom record's `data.body`. */
2103
- body: z13.record(z13.string(), z13.json())
2226
+ body: z15.record(z15.string(), z15.json())
2104
2227
  });
2105
- var trackerTriggerContextSchema = z13.object({
2228
+ var trackerTriggerContextSchema = z15.object({
2106
2229
  /** The tracker's stable ID. */
2107
2230
  tracker: identifier,
2108
2231
  /** The tracker's authoring key. */
@@ -2124,7 +2247,7 @@ var trackerTriggerContextSchema = z13.object({
2124
2247
  });
2125
2248
 
2126
2249
  // src/reject-codes.ts
2127
- import * as z14 from "zod";
2250
+ import * as z16 from "zod";
2128
2251
  var reservedAttemptCodes = Object.freeze([
2129
2252
  "budget-exhausted",
2130
2253
  "defer-expired",
@@ -2150,7 +2273,7 @@ function rejectCodeIssue(code) {
2150
2273
  }
2151
2274
  return null;
2152
2275
  }
2153
- var rejectCodeSchema = z14.string().superRefine((code, context) => {
2276
+ var rejectCodeSchema = z16.string().superRefine((code, context) => {
2154
2277
  const issue = rejectCodeIssue(code);
2155
2278
  if (issue) {
2156
2279
  context.addIssue({ code: "custom", message: issue });
@@ -2158,7 +2281,7 @@ var rejectCodeSchema = z14.string().superRefine((code, context) => {
2158
2281
  });
2159
2282
 
2160
2283
  // src/sdk-runtime.ts
2161
- import * as z15 from "zod";
2284
+ import * as z17 from "zod";
2162
2285
  var questScaleLimits = {
2163
2286
  quests: 1e3,
2164
2287
  questTypes: 200,
@@ -2169,22 +2292,22 @@ var sdkRuntimeLimits = {
2169
2292
  /** Characters of module source, summed over all modules. */
2170
2293
  size: 2e6
2171
2294
  };
2172
- var sha256 = z15.string().regex(/^[0-9a-f]{64}$/);
2173
- var sdkRuntimeModulePathSchema = z15.string().max(200).regex(/^[a-z0-9_][a-z0-9_.-]*(\/[a-z0-9_][a-z0-9_.-]*)*\.js$/i).refine(
2295
+ var sha256 = z17.string().regex(/^[0-9a-f]{64}$/);
2296
+ var sdkRuntimeModulePathSchema = z17.string().max(200).regex(/^[a-z0-9_][a-z0-9_.-]*(\/[a-z0-9_][a-z0-9_.-]*)*\.js$/i).refine(
2174
2297
  (path) => !path.split("/").some((part) => part === "." || part === ".."),
2175
2298
  "Runtime module paths cannot contain . or .. segments"
2176
2299
  );
2177
- var sdkRuntimeReferenceSchema = z15.object({
2300
+ var sdkRuntimeReferenceSchema = z17.object({
2178
2301
  digest: sha256,
2179
2302
  /** The SDK version that built the runtime, for display. The digest is what pins it. */
2180
- sdkVersion: z15.string().min(1).max(64)
2303
+ sdkVersion: z17.string().min(1).max(64)
2181
2304
  }).strict();
2182
- var sdkRuntimeModulesSchema = z15.record(sdkRuntimeModulePathSchema, z15.string().min(1)).refine((modules) => {
2305
+ var sdkRuntimeModulesSchema = z17.record(sdkRuntimeModulePathSchema, z17.string().min(1)).refine((modules) => {
2183
2306
  const entries = Object.values(modules);
2184
2307
  return entries.length > 0 && entries.length <= sdkRuntimeLimits.modules && entries.reduce((sum, source) => sum + source.length, 0) <= sdkRuntimeLimits.size;
2185
2308
  }, `A runtime has 1 to ${sdkRuntimeLimits.modules} modules and at most ${sdkRuntimeLimits.size} characters of source`);
2186
2309
  var sdkRuntimeSchema = sdkRuntimeReferenceSchema.extend({
2187
- zodVersion: z15.string().min(1).max(64),
2310
+ zodVersion: z17.string().min(1).max(64),
2188
2311
  modules: sdkRuntimeModulesSchema
2189
2312
  }).strict();
2190
2313
  async function sdkRuntimeDigest(modules) {
@@ -2199,66 +2322,260 @@ async function sdkRuntimeDigest(modules) {
2199
2322
  }
2200
2323
 
2201
2324
  // src/completion.ts
2202
- import * as z16 from "zod";
2203
- var name = z16.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,199}$/);
2204
- var completionPolicySchema = z16.discriminatedUnion("kind", [
2325
+ import * as z18 from "zod";
2326
+ var name = z18.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,199}$/);
2327
+ var completionPolicySchema = z18.discriminatedUnion("kind", [
2205
2328
  streakPolicySchema,
2206
2329
  counterPolicySchema,
2207
- z16.object({ kind: z16.literal("once") }).strict(),
2208
- z16.object({ kind: z16.literal("keyed") }).strict()
2330
+ z18.object({ kind: z18.literal("once") }).strict(),
2331
+ z18.object({ kind: z18.literal("keyed") }).strict()
2209
2332
  ]);
2210
- var completionKeySchema = z16.string().min(1).max(500);
2211
- var budgetSchema = z16.object({
2333
+ var completionKeySchema = z18.string().min(1).max(500);
2334
+ var budgetSchema = z18.object({
2212
2335
  id: name,
2213
- scope: z16.enum(["member", "project"]),
2336
+ scope: z18.enum(["member", "project"]),
2214
2337
  /**
2215
2338
  * The project calendar period of the attempt's eligibility time that one bucket covers:
2216
2339
  * `"day"`, `"week"` (ISO, starting on Monday) or `"month"` in the project timezone.
2217
2340
  * `"lifetime"` never resets.
2218
2341
  */
2219
2342
  period: calendarPeriodSchema,
2220
- limit: z16.number().int().positive().max(Number.MAX_SAFE_INTEGER),
2221
- cost: z16.union([
2222
- z16.number().int().positive().max(Number.MAX_SAFE_INTEGER),
2223
- z16.object({ balance: name }).strict()
2343
+ limit: z18.number().int().positive().max(Number.MAX_SAFE_INTEGER),
2344
+ cost: z18.union([
2345
+ z18.number().int().positive().max(Number.MAX_SAFE_INTEGER),
2346
+ z18.object({ balance: name }).strict()
2224
2347
  ])
2225
2348
  }).strict();
2226
- var memberCompletionSchema = z16.object({
2227
- quest: z16.string().min(1).max(200),
2349
+ var authorBudgetSchema = budgetSchema.extend({ scope: z18.literal("author") }).strict();
2350
+ var memberCompletionSchema = z18.object({
2351
+ quest: z18.string().min(1).max(200),
2228
2352
  key: completionKeySchema,
2229
- completedAt: z16.number().int().nonnegative().safe().nullable()
2353
+ completedAt: z18.number().int().nonnegative().safe().nullable()
2230
2354
  });
2231
2355
  var maxMemberCompletions = 100;
2232
2356
 
2233
2357
  // src/integrations.ts
2234
- import * as z17 from "zod";
2235
- var evaluatorIntegrationProviderSchema = z17.enum(["discord", "x"]);
2236
- var integrationProviderSchema = z17.enum(["discord"]);
2237
- var discordServerSchema = z17.object({
2238
- id: z17.string().regex(/^[0-9]{1,20}$/),
2239
- name: z17.string().min(1),
2240
- icon: z17.string().nullable()
2241
- });
2242
- var projectIntegrationSchema = z17.object({
2358
+ import * as z19 from "zod";
2359
+ var evaluatorIntegrationProviderSchema = z19.enum(["discord", "x"]);
2360
+ var integrationProviderSchema = z19.enum(["discord"]);
2361
+ var discordServerSchema = z19.object({
2362
+ id: z19.string().regex(/^[0-9]{1,20}$/),
2363
+ name: z19.string().min(1),
2364
+ icon: z19.string().nullable()
2365
+ });
2366
+ var projectIntegrationSchema = z19.object({
2243
2367
  provider: integrationProviderSchema,
2244
- configured: z17.boolean(),
2245
- status: z17.enum(["disconnected", "ready", "attention"]),
2246
- revision: z17.number().int().nonnegative(),
2368
+ configured: z19.boolean(),
2369
+ status: z19.enum(["disconnected", "ready", "attention"]),
2370
+ revision: z19.number().int().nonnegative(),
2247
2371
  server: discordServerSchema.nullable(),
2248
- issue: z17.string().nullable(),
2249
- connectedAt: z17.number().default(0)
2372
+ issue: z19.string().nullable(),
2373
+ connectedAt: z19.number().default(0)
2374
+ });
2375
+
2376
+ // src/announcement-template.ts
2377
+ var announcementPlaceholders = [
2378
+ "beneficiary",
2379
+ "author",
2380
+ "quest",
2381
+ "points",
2382
+ "rewards"
2383
+ ];
2384
+ var placeholderNames = new Set(announcementPlaceholders);
2385
+ function parseAnnouncementTemplate(text) {
2386
+ const segments = [];
2387
+ let literal18 = "";
2388
+ let index = 0;
2389
+ while (index < text.length) {
2390
+ const char = text[index];
2391
+ if (char === "{" && text[index + 1] === "{") {
2392
+ literal18 += "{";
2393
+ index += 2;
2394
+ continue;
2395
+ }
2396
+ if (char === "}" && text[index + 1] === "}") {
2397
+ literal18 += "}";
2398
+ index += 2;
2399
+ continue;
2400
+ }
2401
+ if (char === "}") {
2402
+ return { error: "Write }} for a literal } in an announcement" };
2403
+ }
2404
+ if (char !== "{") {
2405
+ literal18 += char;
2406
+ index += 1;
2407
+ continue;
2408
+ }
2409
+ const end = text.indexOf("}", index);
2410
+ const name2 = end === -1 ? "" : text.slice(index + 1, end);
2411
+ if (!placeholderNames.has(name2)) {
2412
+ return {
2413
+ error: `Unknown announcement placeholder {${name2}}: use ${announcementPlaceholders.map((known) => `{${known}}`).join(", ")}, or {{ for a literal {`
2414
+ };
2415
+ }
2416
+ if (literal18) {
2417
+ segments.push({ kind: "text", text: literal18 });
2418
+ literal18 = "";
2419
+ }
2420
+ segments.push({
2421
+ kind: "placeholder",
2422
+ name: name2
2423
+ });
2424
+ index = end + 1;
2425
+ }
2426
+ if (literal18) {
2427
+ segments.push({ kind: "text", text: literal18 });
2428
+ }
2429
+ return { segments };
2430
+ }
2431
+
2432
+ // src/telegram.ts
2433
+ import * as z20 from "zod";
2434
+ var telegramSignInMethodsSchema = z20.object({
2435
+ /** Telegram Login, the OpenID Connect sign-in Domino configures for the platform. */
2436
+ login: z20.boolean(),
2437
+ /** Mini App sign-in, which the project enables in Console with its bot's ID. */
2438
+ miniApp: z20.boolean()
2439
+ });
2440
+ var telegramAccountConnectionSchema = accountConnectionSchema.extend({
2441
+ provider: z20.literal("telegram")
2442
+ });
2443
+ var telegramInitDataSchema = z20.string().min(1, "Pass the Mini App's Telegram.WebApp.initData").max(8192);
2444
+ var telegramMiniAppSignInSchema = z20.object({
2445
+ initData: telegramInitDataSchema,
2446
+ mode: z20.enum(["sign-in", "connect"])
2447
+ }).strict();
2448
+ var telegramChatIdSchema = z20.string().regex(
2449
+ /^-?[1-9][0-9]{0,19}$/,
2450
+ "Use the chat's numeric ID, such as -1001234567890"
2451
+ );
2452
+ var telegramChatSchema = z20.object({
2453
+ /** The numeric chat ID, as a string. */
2454
+ id: telegramChatIdSchema,
2455
+ /** `group`, `supergroup` or `channel`; a later Telegram may add others. */
2456
+ type: z20.string(),
2457
+ title: z20.string(),
2458
+ /** The public @username, without the @, or null for a private chat. */
2459
+ username: z20.string().nullable(),
2460
+ status: z20.string(),
2461
+ issue: z20.string().nullable(),
2462
+ /**
2463
+ * Whether Domino's bot may post in the chat, as announcements do: as an administrator of a
2464
+ * group, or with the right to post in a channel. Absent from older Relay versions.
2465
+ */
2466
+ canPost: z20.boolean().optional(),
2467
+ connectedAt: z20.number()
2468
+ });
2469
+ var telegramChatsSchema = z20.object({
2470
+ configured: z20.boolean(),
2471
+ /** Domino's bot, the one operators add to their chats. */
2472
+ bot: z20.object({ username: z20.string() }).nullable(),
2473
+ chats: z20.array(telegramChatSchema)
2474
+ });
2475
+ var telegramChatConnectionSchema = z20.object({
2476
+ url: z20.string(),
2477
+ expiresAt: z20.number()
2478
+ });
2479
+ var telegramMemberInputSchema = z20.object({
2480
+ chat: z20.string().regex(
2481
+ /^(-?[1-9][0-9]{0,19}|@[A-Za-z][A-Za-z0-9_]{3,31})$/,
2482
+ "Name a chat the project connected, by its numeric ID or @username"
2483
+ )
2484
+ }).strict();
2485
+ var telegramChatMemberSchema = z20.object({
2486
+ /** The numeric Telegram user ID. */
2487
+ userId: z20.string(),
2488
+ username: z20.string().nullable(),
2489
+ status: z20.custom(
2490
+ (value) => typeof value === "string"
2491
+ ),
2492
+ /** Whether they are in the chat now: a creator, administrator, member, or restricted member. */
2493
+ isMember: z20.boolean(),
2494
+ /** Whether they are its creator or an administrator. */
2495
+ isAdmin: z20.boolean(),
2496
+ /** When a paid subscription or a restriction ends, epoch milliseconds; null when it does not. */
2497
+ untilDate: z20.number().nullable()
2498
+ });
2499
+ var telegramReactionDataSchema = z20.object({
2500
+ /** The chat's numeric ID, as a string. */
2501
+ chatId: z20.string(),
2502
+ /** `group` or `supergroup`: channel reactions are anonymous and never recorded. */
2503
+ chatType: z20.string(),
2504
+ messageId: z20.number(),
2505
+ /** `emoji`, `custom_emoji` or `paid`. */
2506
+ reactionType: z20.string(),
2507
+ /** The emoji, such as "❤", for an `emoji` reaction; null otherwise. */
2508
+ emoji: z20.string().nullable(),
2509
+ /** The custom emoji's ID for a `custom_emoji` reaction; null otherwise. */
2510
+ customEmojiId: z20.string().nullable(),
2511
+ /**
2512
+ * `creator` or `administrator` for one of the chat's administrators, read at most ten minutes
2513
+ * before Relay recorded the reaction; `member` for anyone else.
2514
+ */
2515
+ reactorStatus: z20.string(),
2516
+ /** Whether the reactor was the chat's creator or an administrator then. */
2517
+ reactorIsAdmin: z20.boolean()
2518
+ });
2519
+ var telegramMessageDataSchema = z20.object({
2520
+ /** The chat's numeric ID, as a string. */
2521
+ chatId: z20.string(),
2522
+ /** `group` or `supergroup`: channel posts are authored by the channel and never recorded. */
2523
+ chatType: z20.string(),
2524
+ messageId: z20.number(),
2525
+ /** The ID of the message it replies to in the same chat; null when it is not a reply. */
2526
+ replyToMessageId: z20.number().nullable(),
2527
+ /**
2528
+ * The message thread it belongs to: the forum topic in a supergroup with topics, or the reply
2529
+ * thread otherwise. Null when Telegram names none.
2530
+ */
2531
+ threadId: z20.number().nullable()
2532
+ });
2533
+
2534
+ // src/announcements.ts
2535
+ import * as z21 from "zod";
2536
+ var announcementTextSchema = z21.string().trim().min(1).max(1e3).superRefine((text, context) => {
2537
+ const parsed = parseAnnouncementTemplate(text);
2538
+ if ("error" in parsed) {
2539
+ context.addIssue({ code: "custom", message: parsed.error });
2540
+ }
2250
2541
  });
2542
+ var announcementFields = {
2543
+ action: z21.literal("post-message"),
2544
+ text: announcementTextSchema,
2545
+ /**
2546
+ * Post as a reply to the message that triggered the completion: the message itself, or the
2547
+ * message a reaction was added to. Only when that message is in the same chat or channel; the
2548
+ * post is a plain message otherwise.
2549
+ */
2550
+ replyToTriggeringMessage: z21.boolean().optional()
2551
+ };
2552
+ var telegramAnnouncementSchema = z21.strictObject({
2553
+ provider: z21.literal("telegram"),
2554
+ /** The chat's numeric ID, as `settings.telegramChat()` holds it. */
2555
+ chat: telegramChatIdSchema,
2556
+ ...announcementFields
2557
+ });
2558
+ var discordAnnouncementSchema = z21.strictObject({
2559
+ provider: z21.literal("discord"),
2560
+ /** The channel's ID, as a `discord.channels()` resource setting holds it. */
2561
+ channel: z21.string().regex(/^[0-9]{1,20}$/),
2562
+ ...announcementFields
2563
+ });
2564
+ var announcementSchema = z21.discriminatedUnion("provider", [
2565
+ telegramAnnouncementSchema,
2566
+ discordAnnouncementSchema
2567
+ ]);
2251
2568
 
2252
2569
  // src/wallet.ts
2253
- import * as z18 from "zod";
2254
- var solanaAddressSchema = z18.string().min(32).max(44).regex(/^[1-9A-HJ-NP-Za-km-z]+$/);
2255
- var walletChainSchema = z18.enum(["solana", "eip155", "cosmos"]);
2570
+ import * as z22 from "zod";
2571
+ var solanaAddressSchema = z22.string().min(32).max(44).regex(/^[1-9A-HJ-NP-Za-km-z]+$/);
2572
+ var walletChainSchema = z22.enum(["solana", "eip155", "cosmos"]);
2256
2573
  var cosmosNetworkPattern = /^cosmos:[-_a-zA-Z0-9]{1,32}$/;
2257
- var cosmosNetworkSchema = z18.custom(
2574
+ var cosmosNetworkSchema = z22.custom(
2258
2575
  (value) => typeof value === "string" && cosmosNetworkPattern.test(value),
2259
2576
  "Use a Cosmos network: cosmos:<chain ID>"
2260
2577
  );
2261
- var cosmosDenomSchema = z18.string().regex(
2578
+ var cosmosDenomSchema = z22.string().regex(
2262
2579
  /^[a-zA-Z][a-zA-Z0-9/:._-]{2,127}$/,
2263
2580
  "Use a Cosmos bank denomination such as uatom or uosmo"
2264
2581
  );
@@ -2284,51 +2601,51 @@ function cosmosChain(chain) {
2284
2601
  return { ...value, network };
2285
2602
  }
2286
2603
  var solanaMainnet = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
2287
- var evmAddressSchema = z18.string().regex(/^0x[0-9a-fA-F]{40}$/);
2288
- var cosmosAddressSchema = z18.string().min(8).max(90).regex(
2604
+ var evmAddressSchema = z22.string().regex(/^0x[0-9a-fA-F]{40}$/);
2605
+ var cosmosAddressSchema = z22.string().min(8).max(90).regex(
2289
2606
  /^(?:[a-z][a-z0-9]{0,82}1[02-9ac-hj-np-z]{38,}|[A-Z][A-Z0-9]{0,82}1[02-9AC-HJ-NP-Z]{38,})$/
2290
2607
  );
2291
- var walletAddressInputSchema = z18.discriminatedUnion("chain", [
2292
- z18.object({ chain: z18.literal("solana"), address: solanaAddressSchema }).strict(),
2293
- z18.object({
2294
- chain: z18.literal("eip155"),
2608
+ var walletAddressInputSchema = z22.discriminatedUnion("chain", [
2609
+ z22.object({ chain: z22.literal("solana"), address: solanaAddressSchema }).strict(),
2610
+ z22.object({
2611
+ chain: z22.literal("eip155"),
2295
2612
  address: evmAddressSchema,
2296
2613
  /** Shown in the sign-in message's Chain ID line only: links are chain-agnostic. Defaults to 1. */
2297
- chainId: z18.number().int().positive().safe().optional()
2614
+ chainId: z22.number().int().positive().safe().optional()
2298
2615
  }).strict(),
2299
- z18.object({
2300
- chain: z18.literal("cosmos"),
2616
+ z22.object({
2617
+ chain: z22.literal("cosmos"),
2301
2618
  network: cosmosNetworkSchema,
2302
2619
  address: cosmosAddressSchema
2303
2620
  }).strict()
2304
2621
  ]);
2305
- var walletMessageChallengeSchema = z18.object({
2306
- id: z18.string().min(1).max(200),
2307
- purpose: z18.enum(["link", "sign-in"]),
2622
+ var walletMessageChallengeSchema = z22.object({
2623
+ id: z22.string().min(1).max(200),
2624
+ purpose: z22.enum(["link", "sign-in"]),
2308
2625
  chain: walletChainSchema,
2309
2626
  network: cosmosNetworkSchema.nullable(),
2310
2627
  /** Canonical (base58, EIP-55 or lowercase bech32). The signer must sign with this address. */
2311
- address: z18.string(),
2312
- message: z18.string().max(4096),
2313
- expiresAt: z18.number().int()
2628
+ address: z22.string(),
2629
+ message: z22.string().max(4096),
2630
+ expiresAt: z22.number().int()
2314
2631
  });
2315
- var walletSignatureSchema = z18.object({
2316
- challenge: z18.string().min(1).max(200),
2632
+ var walletSignatureSchema = z22.object({
2633
+ challenge: z22.string().min(1).max(200),
2317
2634
  /** solana: base58, 64 bytes · eip155: 0x and 130 hex digits (65 bytes) · cosmos: base64, 64 bytes (r‖s) */
2318
- signature: z18.string().min(1).max(256),
2635
+ signature: z22.string().min(1).max(256),
2319
2636
  /** cosmos only: the base64 33-byte compressed secp256k1 key from signArbitrary's pub_key.value */
2320
- publicKey: z18.string().max(128).optional()
2637
+ publicKey: z22.string().max(128).optional()
2321
2638
  }).strict();
2322
- var linkedWalletSchema = z18.object({
2639
+ var linkedWalletSchema = z22.object({
2323
2640
  chain: walletChainSchema,
2324
2641
  network: cosmosNetworkSchema.nullable(),
2325
- address: z18.string(),
2326
- verifiedAt: z18.number().int().nonnegative(),
2327
- revision: z18.number().int().positive(),
2642
+ address: z22.string(),
2643
+ verifiedAt: z22.number().int().nonnegative(),
2644
+ revision: z22.number().int().positive(),
2328
2645
  /** True when this wallet can sign in: it was first used through wallet sign-in. Linking never enables sign-in. */
2329
- signIn: z18.boolean()
2646
+ signIn: z22.boolean()
2330
2647
  });
2331
- var walletUnlinkInputSchema = z18.object({ chain: walletChainSchema, address: z18.string().min(1).max(100) }).strict();
2648
+ var walletUnlinkInputSchema = z22.object({ chain: walletChainSchema, address: z22.string().min(1).max(100) }).strict();
2332
2649
  async function walletAddressInput(signer) {
2333
2650
  const address = await signer.address();
2334
2651
  switch (signer.chain) {
@@ -2352,8 +2669,8 @@ async function walletAddressInput(signer) {
2352
2669
  }
2353
2670
  var WALLETS_PER_CHAIN = 5;
2354
2671
  var walletSignInFamilies = ["solana", "eip155", "cosmos"];
2355
- var walletSignInNetworkSchema = z18.enum(walletSignInFamilies);
2356
- var walletSignInNetworksSchema = z18.array(walletSignInNetworkSchema).max(walletSignInFamilies.length).refine((values2) => new Set(values2).size === values2.length, {
2672
+ var walletSignInNetworkSchema = z22.enum(walletSignInFamilies);
2673
+ var walletSignInNetworksSchema = z22.array(walletSignInNetworkSchema).max(walletSignInFamilies.length).refine((values2) => new Set(values2).size === values2.length, {
2357
2674
  message: "Duplicate wallet family"
2358
2675
  }).transform(
2359
2676
  (values2) => walletSignInFamilies.filter((family) => values2.includes(family))
@@ -2378,41 +2695,361 @@ function caip10(wallet, network) {
2378
2695
  function isEvmChainId(value) {
2379
2696
  return /^eip155:[1-9][0-9]{0,15}$/.test(value);
2380
2697
  }
2381
- var evmChainIdSchema = z18.custom(
2698
+ var evmChainIdSchema = z22.custom(
2382
2699
  (value) => typeof value === "string" && isEvmChainId(value),
2383
2700
  'Use an EVM chain ID such as "eip155:8453"'
2384
2701
  );
2385
- var units = z18.string().regex(/^(0|[1-9][0-9]*)$/);
2702
+ var units = z22.string().regex(/^(0|[1-9][0-9]*)$/);
2386
2703
  var walletBalanceSchema = responseShape(
2387
- z18.object({
2704
+ z22.object({
2388
2705
  /** Canonical CAIP-2 ID for Solana, EVM or a supported Cosmos SDK chain. */
2389
- chain: z18.string(),
2706
+ chain: z22.string(),
2390
2707
  /** The canonical mint, EIP-55 contract or Cosmos bank denom; null for a native coin. */
2391
- token: z18.string().nullable(),
2708
+ token: z22.string().nullable(),
2392
2709
  /** Null when token metadata does not report decimals. */
2393
- decimals: z18.number().int().min(0).max(255).nullable(),
2710
+ decimals: z22.number().int().min(0).max(255).nullable(),
2394
2711
  /** The sum over `wallets`. */
2395
2712
  total: units,
2396
- wallets: z18.array(
2397
- z18.object({ address: z18.string(), amount: units }).strict()
2713
+ wallets: z22.array(
2714
+ z22.object({ address: z22.string(), amount: units }).strict()
2398
2715
  ),
2399
2716
  /** Solana: lowest slot. EVM: approximate latest block. Cosmos: the fixed queried block. */
2400
- at: z18.object({ kind: z18.enum(["slot", "block"]), number: units }).strict(),
2401
- observedAt: z18.number().int().nonnegative()
2717
+ at: z22.object({ kind: z22.enum(["slot", "block"]), number: units }).strict(),
2718
+ observedAt: z22.number().int().nonnegative()
2719
+ }).strict()
2720
+ );
2721
+ var walletBalanceSampleSchema = z22.object({
2722
+ /** The balance in base units, as a decimal integer string. */
2723
+ amount: z22.string(),
2724
+ /** The token's decimals; null when token metadata does not report them. */
2725
+ decimals: z22.number().int().min(0).max(255).nullable(),
2726
+ /**
2727
+ * Where the run read: the EVM block number or Cosmos height every wallet of the run was read at,
2728
+ * or on Solana the slot this wallet's answer reflects (at or after the run's pinned slot), as
2729
+ * a decimal integer string.
2730
+ */
2731
+ block: z22.string()
2732
+ });
2733
+ var nftCollectionPattern = /^(eip155:[1-9][0-9]{0,15})\/(erc721|erc1155):(0x[0-9a-fA-F]{40})(?:\/(0|[1-9][0-9]{0,77}))?$/;
2734
+ var solanaNftCollectionPrefix = `${solanaMainnet}/nft:`;
2735
+ var maxTokenId = 2n ** 256n - 1n;
2736
+ function parseNftCollection(value) {
2737
+ if (value.startsWith(solanaNftCollectionPrefix)) {
2738
+ const mint = value.slice(solanaNftCollectionPrefix.length);
2739
+ return solanaAddressSchema.safeParse(mint).success ? { chain: solanaMainnet, standard: "metaplex", mint } : null;
2740
+ }
2741
+ const match = nftCollectionPattern.exec(value);
2742
+ if (!match) {
2743
+ return null;
2744
+ }
2745
+ const [, chain, standard, contract, tokenId] = match;
2746
+ if (standard === "erc1155" !== (tokenId !== void 0) || tokenId !== void 0 && BigInt(tokenId) > maxTokenId) {
2747
+ return null;
2748
+ }
2749
+ return {
2750
+ chain,
2751
+ standard,
2752
+ contract,
2753
+ tokenId: tokenId ?? null
2754
+ };
2755
+ }
2756
+ function isNftCollection(value) {
2757
+ return parseNftCollection(value) !== null;
2758
+ }
2759
+ var walletNftsSchema = responseShape(
2760
+ z22.object({
2761
+ /** The collection read, in canonical form: an EVM contract EIP-55 checksummed. */
2762
+ collection: z22.string(),
2763
+ /** The collection's chain, canonical CAIP-2. */
2764
+ chain: z22.string(),
2765
+ standard: z22.enum(["erc721", "erc1155", "metaplex"]),
2766
+ /** How many the wallets hold together: the sum over `wallets`. */
2767
+ total: units,
2768
+ wallets: z22.array(
2769
+ z22.object({ address: z22.string(), count: units }).strict()
2770
+ ),
2771
+ /** Solana: the lowest slot of the reads. EVM: the approximate latest block. */
2772
+ at: z22.object({ kind: z22.enum(["slot", "block"]), number: units }).strict(),
2773
+ observedAt: z22.number().int().nonnegative()
2774
+ }).strict()
2775
+ );
2776
+ var integerType = /^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;
2777
+ var bytesType = /^bytes([1-9]|[12][0-9]|3[0-2])?$/;
2778
+ function elementaryType(type) {
2779
+ const integer = integerType.exec(type);
2780
+ if (integer) {
2781
+ return `${integer[1]}${integer[2] ?? "256"}`;
2782
+ }
2783
+ return type === "address" || type === "bool" || type === "string" || bytesType.test(type) ? type : null;
2784
+ }
2785
+ function parameterType(parameter) {
2786
+ const match = /^([a-z0-9]+)(?:\s+[A-Za-z_$][A-Za-z0-9_$]*)?$/.exec(
2787
+ parameter.trim()
2788
+ );
2789
+ return match ? elementaryType(match[1]) : null;
2790
+ }
2791
+ function parseContractFunction(signature) {
2792
+ const match = /^function\s+([A-Za-z_$][A-Za-z0-9_$]*)\s*\(([^()]*)\)\s+(?:external\s+)?(view|pure)\s+returns\s*\(([^()]*)\)$/.exec(
2793
+ signature.trim()
2794
+ );
2795
+ if (!match) {
2796
+ return null;
2797
+ }
2798
+ const [, name2, parameters, mutability, returned] = match;
2799
+ const inputs = parameters.trim() ? parameters.split(",").map(parameterType) : [];
2800
+ const output = returned.includes(",") ? null : parameterType(returned);
2801
+ if (inputs.length > 16 || inputs.some((type) => type === null) || !output || !(output === "bool" || output === "address" || integerType.test(output))) {
2802
+ return null;
2803
+ }
2804
+ return {
2805
+ name: name2,
2806
+ inputs,
2807
+ returns: output,
2808
+ mutability,
2809
+ signature: `function ${name2}(${inputs.join(",")}) ${mutability} returns (${output})`
2810
+ };
2811
+ }
2812
+ function parseContractCall(value) {
2813
+ const match = /^(eip155:[1-9][0-9]{0,15}):(0x[0-9a-fA-F]{40}) (function .+)$/.exec(value);
2814
+ const parsed = match && value.length <= 400 ? parseContractFunction(match[3]) : null;
2815
+ return parsed ? {
2816
+ chain: match[1],
2817
+ contract: match[2],
2818
+ function: parsed
2819
+ } : null;
2820
+ }
2821
+ function isContractCall(value) {
2822
+ return parseContractCall(value) !== null;
2823
+ }
2824
+ var signedUnits = z22.string().regex(/^(0|-?[1-9][0-9]*)$/);
2825
+ var walletCallSchema = responseShape(
2826
+ z22.object({
2827
+ /** The call read, canonical: the contract EIP-55 checksummed, the signature without names. */
2828
+ call: z22.string(),
2829
+ /** The contract's chain, canonical CAIP-2. */
2830
+ chain: z22.string(),
2831
+ /** The contract, EIP-55 checksummed. */
2832
+ contract: z22.string(),
2833
+ /** The return value's ABI type, such as `"uint256"` or `"bool"`. */
2834
+ returns: z22.string(),
2835
+ /** The sum of the wallets' values when the function returns an integer; null otherwise. */
2836
+ total: signedUnits.nullable(),
2837
+ wallets: z22.array(
2838
+ z22.object({
2839
+ address: z22.string(),
2840
+ /** An integer as a decimal string, a bool, or an EIP-55 address. */
2841
+ value: z22.union([z22.string(), z22.boolean()])
2842
+ }).strict()
2843
+ ),
2844
+ /** The block every call read. */
2845
+ at: z22.object({ kind: z22.enum(["block"]), number: units }).strict(),
2846
+ observedAt: z22.number().int().nonnegative()
2847
+ }).strict()
2848
+ );
2849
+ var walletDelegationsSchema = responseShape(
2850
+ z22.object({
2851
+ chain: z22.string(),
2852
+ /** The chain's staking denomination, such as `uatom`: every amount is in its base units. */
2853
+ denom: z22.string(),
2854
+ /** The validator the read counted, or null for every validator. */
2855
+ validator: z22.string().nullable(),
2856
+ /** The sum over `wallets`. */
2857
+ total: units,
2858
+ wallets: z22.array(
2859
+ z22.object({ address: z22.string(), amount: units }).strict()
2860
+ ),
2861
+ /** What the wallets delegate to each validator, summed over the wallets; none at zero. */
2862
+ validators: z22.array(
2863
+ z22.object({ validator: z22.string(), amount: units }).strict()
2864
+ ),
2865
+ /** The block every request read. */
2866
+ at: z22.object({ kind: z22.enum(["block"]), number: units }).strict(),
2867
+ observedAt: z22.number().int().nonnegative()
2868
+ }).strict()
2869
+ );
2870
+ var contractEventPattern = /^(eip155:[1-9][0-9]{0,15}):(0x[0-9a-fA-F]{40})\s+(?:event\s+)?([A-Za-z_$][A-Za-z0-9_$]*)\s*\(([^()]*)\)\s*;?$/;
2871
+ var eventArgumentPattern = /^([a-z0-9]+(?:\[[0-9]*\])*)(\s+indexed)?\s+([A-Za-z_$][A-Za-z0-9_$]*)$/;
2872
+ function eventArgumentType(type) {
2873
+ const match = /^([a-z]+)([0-9]*)((?:\[[0-9]*\])*)$/.exec(type);
2874
+ if (!match) {
2875
+ return null;
2876
+ }
2877
+ const [, base2, size2, arrays] = match;
2878
+ const bits = size2 === "" ? 256 : Number(size2);
2879
+ let canonical = null;
2880
+ if (size2.startsWith("0")) {
2881
+ return null;
2882
+ }
2883
+ if (base2 === "uint" || base2 === "int") {
2884
+ canonical = bits >= 8 && bits <= 256 && bits % 8 === 0 ? base2 + bits : null;
2885
+ } else if (base2 === "bytes") {
2886
+ canonical = size2 === "" || bits <= 32 ? base2 + size2 : null;
2887
+ } else if ((base2 === "address" || base2 === "bool" || base2 === "string") && size2 === "") {
2888
+ canonical = base2;
2889
+ }
2890
+ return canonical && /^(\[([1-9][0-9]*)?\])?$/.test(arrays) ? canonical + arrays : null;
2891
+ }
2892
+ function parseContractEvent(value) {
2893
+ const match = contractEventPattern.exec(value.trim());
2894
+ if (!match) {
2895
+ return null;
2896
+ }
2897
+ const [, chain, contract, name2, list] = match;
2898
+ const inputs = [];
2899
+ for (const part of list.trim() ? list.split(",") : []) {
2900
+ const argument = eventArgumentPattern.exec(part.trim());
2901
+ const type = argument && eventArgumentType(argument[1]);
2902
+ if (!argument || !type || argument[3] === "indexed" || inputs.some((input) => input.name === argument[3])) {
2903
+ return null;
2904
+ }
2905
+ inputs.push({ name: argument[3], type, indexed: !!argument[2] });
2906
+ }
2907
+ const indexed = inputs.filter((input) => input.indexed);
2908
+ if (indexed.length > 3 || !indexed.some((input) => input.type === "address")) {
2909
+ return null;
2910
+ }
2911
+ return {
2912
+ chain,
2913
+ contract,
2914
+ name: name2,
2915
+ inputs,
2916
+ signature: `${name2}(${inputs.map((input) => input.type).join(",")})`
2917
+ };
2918
+ }
2919
+ function isContractEvent(value) {
2920
+ return parseContractEvent(value) !== null;
2921
+ }
2922
+ var maxWalletEventLogs = 1e3;
2923
+ var maxWalletEventLookback = 30 * 24 * 60 * 60 * 1e3;
2924
+ var walletEventScalarSchema = z22.union([z22.string(), z22.boolean()]);
2925
+ var walletEventValueSchema = z22.union([
2926
+ walletEventScalarSchema,
2927
+ z22.array(walletEventScalarSchema)
2928
+ ]);
2929
+ var walletEventsSchema = responseShape(
2930
+ z22.object({
2931
+ /** The event read, in canonical form: the contract EIP-55 checksummed. */
2932
+ event: z22.string(),
2933
+ /** The event's chain, canonical CAIP-2. */
2934
+ chain: z22.string(),
2935
+ contract: z22.string(),
2936
+ /** The earliest block time read, in epoch milliseconds: `since`, or the activation. */
2937
+ since: z22.number().int().nonnegative(),
2938
+ /**
2939
+ * The newest block read: the chain's `finalized` block, or its `safe` block on a chain without
2940
+ * finality. Events in later blocks are not read yet.
2941
+ */
2942
+ at: z22.object({ kind: z22.enum(["block"]), number: units }).strict(),
2943
+ finality: z22.enum(["finalized", "safe"]),
2944
+ /** The matching events, oldest first. */
2945
+ logs: z22.array(
2946
+ z22.object({
2947
+ /** The member's linked wallet the `account` argument names. */
2948
+ wallet: z22.string(),
2949
+ block: units,
2950
+ /** The block's time, in epoch milliseconds. */
2951
+ timestamp: z22.number().int().nonnegative(),
2952
+ tx: z22.string(),
2953
+ logIndex: z22.number().int().nonnegative(),
2954
+ /** Every argument, by name. */
2955
+ args: z22.record(z22.string(), walletEventValueSchema)
2956
+ }).strict()
2957
+ ).max(maxWalletEventLogs),
2958
+ observedAt: z22.number().int().nonnegative()
2959
+ }).strict()
2960
+ );
2961
+ function isSolanaProgram(value) {
2962
+ return solanaAddressSchema.safeParse(value).success;
2963
+ }
2964
+ var anchorIdlSchema = z22.record(z22.string(), z22.json());
2965
+ var solanaProgramIdlSchema = z22.object({
2966
+ /** The program the setting held when the IDL was stored. */
2967
+ program: z22.string(),
2968
+ source: z22.string(),
2969
+ idl: anchorIdlSchema
2970
+ }).strict();
2971
+ var maxWalletTransactions = 1e3;
2972
+ var maxWalletTransactionLookback = 30 * 24 * 60 * 60 * 1e3;
2973
+ var walletTransactionsSchema = responseShape(
2974
+ z22.object({
2975
+ program: z22.string(),
2976
+ /** Solana mainnet's CAIP-2 ID. */
2977
+ chain: z22.string(),
2978
+ /** The mint whose associated token accounts were read, or null for the wallets themselves. */
2979
+ mint: z22.string().nullable(),
2980
+ /** The earliest block time read, in epoch milliseconds: `since`, or the activation. */
2981
+ since: z22.number().int().nonnegative(),
2982
+ /** The newest finalized slot read. Transactions in later slots are not read yet. */
2983
+ at: z22.object({ kind: z22.enum(["slot"]), number: units }).strict(),
2984
+ /**
2985
+ * False when a wallet had more than {@link maxWalletTransactions} transactions to read since
2986
+ * `since`: its newest ones are returned and older ones are not.
2987
+ */
2988
+ complete: z22.boolean(),
2989
+ /** The matching transactions, oldest first: one entry per linked wallet a transaction touched. */
2990
+ transactions: z22.array(
2991
+ z22.object({
2992
+ /** The member's linked wallet whose history holds the transaction. */
2993
+ wallet: z22.string(),
2994
+ signature: z22.string(),
2995
+ slot: units,
2996
+ /** The block's time, in epoch milliseconds. */
2997
+ timestamp: z22.number().int().nonnegative(),
2998
+ /**
2999
+ * Whether the wallet signed the transaction. False for one someone else signed that only
3000
+ * touched the wallet, such as a transfer into it. Check it before rewarding an action.
3001
+ * Results captured before Relay reported it read as false.
3002
+ */
3003
+ signer: z22.boolean().default(false),
3004
+ /**
3005
+ * Every program the transaction invoked, in call order: each top-level instruction's
3006
+ * program, then the programs it called.
3007
+ */
3008
+ programs: z22.array(z22.string()),
3009
+ /**
3010
+ * The wallet's balance changes: `"SOL"` from its lamports (rent included, the fee left out
3011
+ * when the wallet paid it), and
3012
+ * each mint from the token accounts it owns. Mints whose balance did not change are left out.
3013
+ */
3014
+ balanceChanges: z22.array(
3015
+ z22.object({ mint: z22.string(), delta: signedUnits }).strict()
3016
+ ),
3017
+ /**
3018
+ * The program's instructions in the transaction, top-level and inner, in call order,
3019
+ * decoded with the program's Anchor IDL. Instructions the IDL does not describe are left
3020
+ * out. Absent when the program's setting has no IDL.
3021
+ */
3022
+ instructions: z22.array(
3023
+ z22.object({
3024
+ /** The instruction's name, as the IDL spells it. */
3025
+ name: z22.string(),
3026
+ /**
3027
+ * Its arguments by name: integers up to 32 bits and floats as numbers, wider
3028
+ * integers as decimal strings, public keys in base58, `bytes` and arrays as arrays,
3029
+ * an absent option as null, and an enum as `{ Variant: fields }`.
3030
+ */
3031
+ args: z22.record(z22.string(), z22.json()),
3032
+ /** The accounts the IDL names, by name: each a base58 address. */
3033
+ accounts: z22.record(z22.string(), z22.string())
3034
+ }).strict()
3035
+ ).optional()
3036
+ }).strict()
3037
+ ),
3038
+ observedAt: z22.number().int().nonnegative()
2402
3039
  }).strict()
2403
3040
  );
2404
3041
 
2405
3042
  // src/submission-input.ts
2406
- import * as z19 from "zod";
2407
- var textOptionsSchema = z19.object({
2408
- required: z19.boolean().default(true),
2409
- minLength: z19.number().int().min(0).max(1e4).default(1),
2410
- maxLength: z19.number().int().min(1).max(1e4).default(1e4)
3043
+ import * as z23 from "zod";
3044
+ var textOptionsSchema = z23.object({
3045
+ required: z23.boolean().default(true),
3046
+ minLength: z23.number().int().min(0).max(1e4).default(1),
3047
+ maxLength: z23.number().int().min(1).max(1e4).default(1e4)
2411
3048
  }).strict().refine(
2412
3049
  (v) => v.minLength <= v.maxLength,
2413
3050
  "minLength must not exceed maxLength"
2414
3051
  );
2415
- var hostSchema = z19.string().min(1).max(253).refine((host) => {
3052
+ var hostSchema = z23.string().min(1).max(253).refine((host) => {
2416
3053
  if (!/^[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$/i.test(host) || host.includes("..")) {
2417
3054
  return false;
2418
3055
  }
@@ -2423,13 +3060,13 @@ var hostSchema = z19.string().min(1).max(253).refine((host) => {
2423
3060
  return false;
2424
3061
  }
2425
3062
  }, "Use a hostname without a scheme, path, port, or wildcard");
2426
- var urlOptionsSchema = z19.object({
2427
- required: z19.boolean().default(true),
2428
- allowedHosts: z19.array(hostSchema).min(1).max(100).optional()
3063
+ var urlOptionsSchema = z23.object({
3064
+ required: z23.boolean().default(true),
3065
+ allowedHosts: z23.array(hostSchema).min(1).max(100).optional()
2429
3066
  }).strict();
2430
- var textEvidenceSchema = z19.object({ kind: z19.literal("text"), value: z19.string().max(1e4) }).strict();
2431
- var urlEvidenceSchema = z19.object({ kind: z19.literal("url"), value: z19.string().max(2048) }).strict();
2432
- var valueEvidenceSchema = z19.discriminatedUnion("kind", [
3067
+ var textEvidenceSchema = z23.object({ kind: z23.literal("text"), value: z23.string().max(1e4) }).strict();
3068
+ var urlEvidenceSchema = z23.object({ kind: z23.literal("url"), value: z23.string().max(2048) }).strict();
3069
+ var valueEvidenceSchema = z23.discriminatedUnion("kind", [
2433
3070
  textEvidenceSchema,
2434
3071
  urlEvidenceSchema
2435
3072
  ]);
@@ -2492,22 +3129,22 @@ function xPostId(value) {
2492
3129
  }
2493
3130
 
2494
3131
  // src/quiz.ts
2495
- import * as z20 from "zod";
2496
- var quizId = z20.string().regex(/^[a-zA-Z0-9_-]+$/).max(100);
2497
- var quizChoiceSchema = z20.object({ id: quizId, label: z20.string().trim().min(1).max(500) }).strict();
2498
- var quizQuestionSchema = z20.object({
3132
+ import * as z24 from "zod";
3133
+ var quizId = z24.string().regex(/^[a-zA-Z0-9_-]+$/).max(100);
3134
+ var quizChoiceSchema = z24.object({ id: quizId, label: z24.string().trim().min(1).max(500) }).strict();
3135
+ var quizQuestionSchema = z24.object({
2499
3136
  id: quizId,
2500
- prompt: z20.string().trim().min(1).max(1e3),
2501
- choices: z20.array(quizChoiceSchema).min(2).max(8).refine(
3137
+ prompt: z24.string().trim().min(1).max(1e3),
3138
+ choices: z24.array(quizChoiceSchema).min(2).max(8).refine(
2502
3139
  (choices) => new Set(choices.map((choice) => choice.id)).size === choices.length,
2503
3140
  "Choice IDs must be unique"
2504
3141
  )
2505
3142
  }).strict();
2506
- var quizQuestionsSchema = z20.array(quizQuestionSchema).min(1).max(20).refine(
3143
+ var quizQuestionsSchema = z24.array(quizQuestionSchema).min(1).max(20).refine(
2507
3144
  (questions) => new Set(questions.map((question) => question.id)).size === questions.length,
2508
3145
  "Question IDs must be unique"
2509
3146
  );
2510
- var quizContentSchema = z20.array(
3147
+ var quizContentSchema = z24.array(
2511
3148
  quizQuestionSchema.extend({ correct: quizId }).refine(
2512
3149
  (question) => question.choices.some((choice) => choice.id === question.correct),
2513
3150
  "Choose a correct answer from the available choices"
@@ -2518,107 +3155,116 @@ var quizContentSchema = z20.array(
2518
3155
  );
2519
3156
 
2520
3157
  // src/resources.ts
2521
- import * as z21 from "zod";
2522
- var resourceSourceSchema = z21.union([
2523
- z21.strictObject({
2524
- provider: z21.literal("domino"),
2525
- resource: z21.literal("point-ledger")
3158
+ import * as z25 from "zod";
3159
+ var resourceSourceSchema = z25.union([
3160
+ z25.strictObject({
3161
+ provider: z25.literal("domino"),
3162
+ resource: z25.literal("point-ledger")
2526
3163
  }),
2527
3164
  discordResourceSourceSchema
2528
3165
  ]);
2529
- var resourceRequestSchema = z21.object({
3166
+ var resourceRequestSchema = z25.object({
2530
3167
  source: resourceSourceSchema,
2531
- query: z21.string().max(100).optional(),
2532
- cursor: z21.string().regex(/^\d{1,6}$/).optional(),
2533
- ids: z21.array(z21.string().min(1).max(100)).max(50).optional()
3168
+ query: z25.string().max(100).optional(),
3169
+ cursor: z25.string().regex(/^\d{1,6}$/).optional(),
3170
+ ids: z25.array(z25.string().min(1).max(100)).max(50).optional()
2534
3171
  }).strict();
2535
- var resourceOptionsSchema = z21.object({
2536
- revision: z21.number().int(),
2537
- options: z21.array(
2538
- z21.object({
2539
- id: z21.string(),
2540
- label: z21.string(),
2541
- description: z21.string().optional(),
2542
- group: z21.string().optional(),
2543
- disabledReason: z21.string().optional()
3172
+ var resourceOptionsSchema = z25.object({
3173
+ revision: z25.number().int(),
3174
+ options: z25.array(
3175
+ z25.object({
3176
+ id: z25.string(),
3177
+ label: z25.string(),
3178
+ description: z25.string().optional(),
3179
+ group: z25.string().optional(),
3180
+ disabledReason: z25.string().optional()
2544
3181
  })
2545
3182
  ),
2546
3183
  /** Pass back as `cursor` for the next page; null on the last one. */
2547
- nextCursor: z21.string().nullable().default(null),
3184
+ nextCursor: z25.string().nullable().default(null),
2548
3185
  /** @deprecated Use `nextCursor`. Removed in 2.0.0. */
2549
- cursor: z21.string().nullable()
3186
+ cursor: z25.string().nullable()
2550
3187
  });
2551
3188
 
2552
3189
  // src/settings.ts
2553
- import * as z23 from "zod";
3190
+ import * as z27 from "zod";
2554
3191
 
2555
3192
  // src/setting-values.ts
2556
- import * as z22 from "zod";
2557
- var settingInstant = z22.iso.datetime({ offset: true }).transform((value) => new Date(value).toISOString());
2558
- var settingResourceId = z22.union([
2559
- z22.literal(""),
2560
- z22.string().regex(/^\S{1,200}$/)
3193
+ import * as z26 from "zod";
3194
+ var settingInstant = offsetDateTimeSchema().transform(
3195
+ (value) => new Date(value).toISOString()
3196
+ );
3197
+ var settingResourceId = z26.union([
3198
+ z26.literal(""),
3199
+ z26.string().regex(/^\S{1,200}$/)
2561
3200
  ]);
2562
3201
 
2563
3202
  // src/settings.ts
2564
- var base = { label: z23.string().min(1), description: z23.string().optional() };
2565
- var settingFieldSchema = z23.discriminatedUnion("kind", [
2566
- z23.object({
3203
+ var base = { label: z27.string().min(1), description: z27.string().optional() };
3204
+ var settingFieldSchema = z27.discriminatedUnion("kind", [
3205
+ z27.object({
2567
3206
  ...base,
2568
- kind: z23.literal("point-ledger"),
2569
- default: identifier.or(z23.literal(""))
3207
+ kind: z27.literal("point-ledger"),
3208
+ default: identifier.or(z27.literal(""))
2570
3209
  }).strict(),
2571
- z23.object({ ...base, kind: z23.literal("datetime"), default: settingInstant }).strict(),
2572
- z23.object({
3210
+ z27.object({ ...base, kind: z27.literal("datetime"), default: settingInstant }).strict(),
3211
+ z27.object({
2573
3212
  ...base,
2574
- kind: z23.literal("resource"),
3213
+ kind: z27.literal("resource"),
2575
3214
  default: settingResourceId,
2576
3215
  source: resourceSourceSchema
2577
3216
  }).strict(),
2578
- z23.object({ ...base, kind: z23.literal("quiz"), default: quizContentSchema }).strict(),
2579
- z23.object({
3217
+ z27.object({ ...base, kind: z27.literal("quiz"), default: quizContentSchema }).strict(),
3218
+ z27.object({
2580
3219
  ...base,
2581
- kind: z23.literal("text"),
2582
- default: z23.string(),
2583
- minLength: z23.number().int().nonnegative(),
2584
- maxLength: z23.number().int().positive(),
2585
- multiline: z23.boolean(),
3220
+ kind: z27.literal("text"),
3221
+ default: z27.string(),
3222
+ minLength: z27.number().int().nonnegative(),
3223
+ maxLength: z27.number().int().positive(),
3224
+ multiline: z27.boolean(),
2586
3225
  /**
2587
3226
  * A list Console offers the value from, beside free text: `telegram-chat` lists the
2588
- * project's connected Telegram chats. Unknown pickers read as free text. Two pickers also
3227
+ * project's connected Telegram chats. Unknown pickers read as free text. Six pickers also
2589
3228
  * constrain the value, at publication and when an operator edits it: `amount`, a
2590
- * non-negative integer in a token's base units (`settings.amount()`), and `chain`, a chain
2591
- * `ctx.wallet.balance()` reads (`settings.chain()`).
3229
+ * non-negative integer in a token's base units (`settings.amount()`), `chain`, a chain
3230
+ * `ctx.wallet.balance()` reads (`settings.chain()`), `nft`, an NFT collection
3231
+ * `ctx.wallet.nfts()` reads (`settings.nft()`), whose contract or Solana collection mint
3232
+ * Relay also checks on its chain, `contract-call`, a contract function `ctx.wallet.call()`
3233
+ * reads (`settings.contractCall()`), whose chain Relay also checks, and `contract-event`, a
3234
+ * contract event `ctx.wallet.events()` reads (`settings.contractEvent()`), whose chain and
3235
+ * contract Relay also checks, and `solana-program`, a Solana program
3236
+ * `ctx.wallet.transactions()` reads (`settings.solanaProgram()`), which Relay also checks is
3237
+ * an executable program.
2592
3238
  */
2593
- picker: z23.string().optional(),
3239
+ picker: z27.string().optional(),
2594
3240
  /**
2595
3241
  * On an `amount` setting, the token's decimals: Console shows and edits the value in whole
2596
3242
  * tokens.
2597
3243
  */
2598
- decimals: z23.number().int().min(0).max(255).optional()
3244
+ decimals: z27.number().int().min(0).max(255).optional()
2599
3245
  }).strict(),
2600
- z23.object({
3246
+ z27.object({
2601
3247
  ...base,
2602
- kind: z23.literal("integer"),
2603
- default: z23.number().int(),
2604
- min: z23.number().int(),
2605
- max: z23.number().int()
3248
+ kind: z27.literal("integer"),
3249
+ default: z27.number().int(),
3250
+ min: z27.number().int(),
3251
+ max: z27.number().int()
2606
3252
  }).strict(),
2607
- z23.object({ ...base, kind: z23.literal("boolean"), default: z23.boolean() }).strict(),
2608
- z23.object({
3253
+ z27.object({ ...base, kind: z27.literal("boolean"), default: z27.boolean() }).strict(),
3254
+ z27.object({
2609
3255
  ...base,
2610
- kind: z23.literal("choice"),
2611
- default: z23.string(),
2612
- options: z23.array(z23.string().min(1)).min(1)
3256
+ kind: z27.literal("choice"),
3257
+ default: z27.string(),
3258
+ options: z27.array(z27.string().min(1)).min(1)
2613
3259
  }).strict()
2614
3260
  ]);
2615
- var settingsFieldsSchema = z23.record(
2616
- z23.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/),
3261
+ var settingsFieldsSchema = z27.record(
3262
+ z27.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/),
2617
3263
  settingFieldSchema
2618
3264
  );
2619
- var settingsValuesSchema = z23.record(
2620
- z23.string(),
2621
- z23.union([z23.string(), z23.number().finite(), z23.boolean(), quizContentSchema])
3265
+ var settingsValuesSchema = z27.record(
3266
+ z27.string(),
3267
+ z27.union([z27.string(), z27.number().finite(), z27.boolean(), quizContentSchema])
2622
3268
  );
2623
3269
  function isAmount(value) {
2624
3270
  return value.length <= 100 && /^(0|[1-9][0-9]*)$/.test(value);
@@ -2630,7 +3276,7 @@ function isBoundSetting(field) {
2630
3276
  return field?.kind === "integer" || field?.kind === "text" && field.picker === "amount";
2631
3277
  }
2632
3278
  function textSettingSchema(field) {
2633
- const text = z23.string().min(field.minLength).max(field.maxLength);
3279
+ const text = z27.string().min(field.minLength).max(field.maxLength);
2634
3280
  switch (field.picker) {
2635
3281
  case "amount":
2636
3282
  return text.refine(
@@ -2642,6 +3288,26 @@ function textSettingSchema(field) {
2642
3288
  isBalanceChain,
2643
3289
  'Use "solana" or an EVM chain ID such as "eip155:8453"'
2644
3290
  );
3291
+ case "nft":
3292
+ return text.refine(
3293
+ isNftCollection,
3294
+ 'Use an NFT collection such as "eip155:1/erc721:0x\u2026", "eip155:8453/erc1155:0x\u2026/1" for one ERC-1155 token ID, or "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/nft:<collection mint>"'
3295
+ );
3296
+ case "contract-call":
3297
+ return text.refine(
3298
+ isContractCall,
3299
+ `Use a contract call: the contract's CAIP-10 ID and a view or pure function returning one uint, int, bool or address, such as "eip155:8453:0x\u2026 function stakedOf(address) view returns (uint256)"`
3300
+ );
3301
+ case "contract-event":
3302
+ return text.refine(
3303
+ isContractEvent,
3304
+ 'Use a contract event such as "eip155:8453:0x\u2026 Transfer(address indexed from, address indexed to, uint256 value)": name every argument, and index at least one address argument'
3305
+ );
3306
+ case "solana-program":
3307
+ return text.refine(
3308
+ isSolanaProgram,
3309
+ 'Use a Solana program address in base58, such as "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"'
3310
+ );
2645
3311
  default:
2646
3312
  return text;
2647
3313
  }
@@ -2666,17 +3332,17 @@ function parseSettings(fields2, input) {
2666
3332
  shape[key] = textSettingSchema(field).default(field.default);
2667
3333
  break;
2668
3334
  case "integer":
2669
- shape[key] = z23.number().int().min(field.min).max(field.max).default(field.default);
3335
+ shape[key] = z27.number().int().min(field.min).max(field.max).default(field.default);
2670
3336
  break;
2671
3337
  case "boolean":
2672
- shape[key] = z23.boolean().default(field.default);
3338
+ shape[key] = z27.boolean().default(field.default);
2673
3339
  break;
2674
3340
  case "choice":
2675
- shape[key] = z23.enum(field.options).default(field.default);
3341
+ shape[key] = z27.enum(field.options).default(field.default);
2676
3342
  break;
2677
3343
  }
2678
3344
  }
2679
- return settingsValuesSchema.parse(z23.object(shape).strict().parse(input));
3345
+ return settingsValuesSchema.parse(z27.object(shape).strict().parse(input));
2680
3346
  }
2681
3347
  function missingResourceSettings(fields2, values2) {
2682
3348
  return Object.entries(fields2).filter(
@@ -2697,21 +3363,21 @@ function authoringKey(input) {
2697
3363
  }
2698
3364
 
2699
3365
  // src/campaigns.ts
2700
- import * as z24 from "zod";
2701
- var timestamp4 = z24.number().int().safe().nonnegative();
2702
- var availabilityWindowSchema = z24.object({ from: timestamp4, until: timestamp4 }).strict().refine((window) => window.until > window.from, {
3366
+ import * as z28 from "zod";
3367
+ var timestamp4 = z28.number().int().safe().nonnegative();
3368
+ var availabilityWindowSchema = z28.object({ from: timestamp4, until: timestamp4 }).strict().refine((window) => window.until > window.from, {
2703
3369
  message: "Window end must follow its start",
2704
3370
  path: ["until"]
2705
3371
  });
2706
- var campaignDefinitionSchema = z24.object({
3372
+ var campaignDefinitionSchema = z28.object({
2707
3373
  key: identifier,
2708
- title: z24.string().trim().min(1).max(120),
3374
+ title: z28.string().trim().min(1).max(120),
2709
3375
  window: availabilityWindowSchema.optional(),
2710
- enrollment: z24.enum(["none", "required"]).default("none")
3376
+ enrollment: z28.enum(["none", "required"]).default("none")
2711
3377
  }).strict();
2712
3378
  var campaignAuthoringSchema = campaignDefinitionSchema.omit({ key: true, title: true }).extend({
2713
3379
  ...authoringIdentityShape,
2714
- title: z24.string().trim().min(1).max(120).optional()
3380
+ title: z28.string().trim().min(1).max(120).optional()
2715
3381
  }).strict().transform((value) => {
2716
3382
  const normalized = value;
2717
3383
  return campaignDefinitionSchema.parse({
@@ -2725,42 +3391,42 @@ function defineCampaign(input) {
2725
3391
  var campaignViewSchema = campaignDefinitionSchema.extend({
2726
3392
  enrolledAt: timestamp4.nullable(),
2727
3393
  withdrawnAt: timestamp4.nullable().default(null),
2728
- withdrawalReason: z24.string().nullable().default(null)
3394
+ withdrawalReason: z28.string().nullable().default(null)
2729
3395
  });
2730
- var campaignEnrollmentInputSchema = z24.object({ actionId: identifier, campaign: identifier }).strict();
3396
+ var campaignEnrollmentInputSchema = z28.object({ actionId: identifier, campaign: identifier }).strict();
2731
3397
  var memberCampaignEnrollmentInputSchema = campaignEnrollmentInputSchema.extend({ member: identifier });
2732
3398
  var campaignWithdrawalInputSchema = campaignEnrollmentInputSchema;
2733
3399
  var memberCampaignWithdrawalInputSchema = campaignWithdrawalInputSchema.extend({
2734
3400
  member: identifier,
2735
- reason: z24.string().trim().min(1).max(500)
3401
+ reason: z28.string().trim().min(1).max(500)
2736
3402
  });
2737
- var campaignEnrollmentSchema = z24.object({
3403
+ var campaignEnrollmentSchema = z28.object({
2738
3404
  campaign: identifier,
2739
3405
  member: identifier,
2740
3406
  enrolledAt: timestamp4,
2741
3407
  withdrawnAt: timestamp4.nullable().default(null),
2742
- withdrawalReason: z24.string().nullable().default(null)
3408
+ withdrawalReason: z28.string().nullable().default(null)
2743
3409
  });
2744
3410
 
2745
3411
  // src/resource-handle.ts
2746
- import * as z25 from "zod";
3412
+ import * as z29 from "zod";
2747
3413
  function resourceHandle(_kind, definition) {
2748
3414
  return definition;
2749
3415
  }
2750
- var ledgerSettingSchema = identifier.or(z25.literal("")).brand();
3416
+ var ledgerSettingSchema = identifier.or(z29.literal("")).brand();
2751
3417
  function ledgerKey(ledger) {
2752
3418
  return typeof ledger === "string" ? ledger : ledger.key;
2753
3419
  }
2754
3420
 
2755
3421
  // src/groups.ts
2756
- import * as z26 from "zod";
2757
- var projectGroupSchema = z26.object({
3422
+ import * as z30 from "zod";
3423
+ var projectGroupSchema = z30.object({
2758
3424
  key: identifier,
2759
- title: z26.string().trim().min(1).max(120)
3425
+ title: z30.string().trim().min(1).max(120)
2760
3426
  }).strict();
2761
3427
  var projectGroupAuthoringSchema = projectGroupSchema.omit({ key: true, title: true }).extend({
2762
3428
  ...authoringIdentityShape,
2763
- title: z26.string().trim().min(1).max(120).optional()
3429
+ title: z30.string().trim().min(1).max(120).optional()
2764
3430
  }).strict().transform((value) => {
2765
3431
  return projectGroupSchema.parse({
2766
3432
  ...value,
@@ -2773,92 +3439,93 @@ function defineGroup(input) {
2773
3439
  function projectGroupKey(group) {
2774
3440
  return identifier.parse(group.key);
2775
3441
  }
2776
- var groupTitle = z26.string().trim().min(1).max(120);
2777
- var reason = z26.string().trim().min(1).max(1e3);
2778
- var timestamp5 = z26.number().int().nonnegative().max(864e13);
2779
- var createGroupSchema = z26.object({ actionId: identifier, key: identifier, title: groupTitle }).strict();
2780
- var updateGroupSchema = z26.object({ title: groupTitle }).strict();
2781
- var addGroupMemberSchema = z26.object({ actionId: identifier, member: identifier, reason }).strict();
2782
- var removeGroupMemberSchema = z26.object({ actionId: identifier, reason }).strict();
2783
- var groupPageQuerySchema = z26.strictObject({
3442
+ var groupTitle = z30.string().trim().min(1).max(120);
3443
+ var reason = z30.string().trim().min(1).max(1e3);
3444
+ var timestamp5 = z30.number().int().nonnegative().max(864e13);
3445
+ var createGroupSchema = z30.object({ actionId: identifier, key: identifier, title: groupTitle }).strict();
3446
+ var updateGroupSchema = z30.object({ title: groupTitle }).strict();
3447
+ var addGroupMemberSchema = z30.object({ actionId: identifier, member: identifier, reason }).strict();
3448
+ var removeGroupMemberSchema = z30.object({ actionId: identifier, reason }).strict();
3449
+ var groupArchiveInputSchema = z30.object({ reason: lifecycleReasonSchema.optional() }).strict();
3450
+ var groupPageQuerySchema = z30.strictObject({
2784
3451
  cursor: pageCursorSchema.optional(),
2785
3452
  /** Items per page, 1–100; the default is 50. */
2786
- limit: z26.number().int().min(1).max(100).optional()
3453
+ limit: z30.number().int().min(1).max(100).optional()
2787
3454
  });
2788
- var managedGroupSchema = z26.object({
3455
+ var managedGroupSchema = z30.object({
2789
3456
  key: identifier,
2790
- title: z26.string(),
2791
- members: z26.number().int().nonnegative(),
3457
+ title: z30.string(),
3458
+ members: z30.number().int().nonnegative(),
2792
3459
  createdAt: timestamp5,
2793
3460
  archivedAt: timestamp5.nullable()
2794
3461
  });
2795
- var groupPageSchema = z26.object({
2796
- items: z26.array(managedGroupSchema),
3462
+ var groupPageSchema = z30.object({
3463
+ items: z30.array(managedGroupSchema),
2797
3464
  nextCursor: pageCursorSchema.nullable()
2798
3465
  });
2799
- var groupMemberSchema = z26.object({
3466
+ var groupMemberSchema = z30.object({
2800
3467
  member: identifier,
2801
3468
  addedAt: timestamp5.nullable()
2802
3469
  });
2803
- var groupMemberPageSchema = z26.object({
2804
- items: z26.array(groupMemberSchema),
3470
+ var groupMemberPageSchema = z30.object({
3471
+ items: z30.array(groupMemberSchema),
2805
3472
  nextCursor: pageCursorSchema.nullable()
2806
3473
  });
2807
3474
 
2808
3475
  // src/prerequisites.ts
2809
- import * as z27 from "zod";
2810
- var amount = z27.number().int().safe().nonnegative();
3476
+ import * as z31 from "zod";
3477
+ var amount = z31.number().int().safe().nonnegative();
2811
3478
  var threshold = amount.positive();
2812
- var completionPrerequisiteSchema = z27.discriminatedUnion("scope", [
2813
- z27.object({
2814
- kind: z27.literal("completion"),
3479
+ var completionPrerequisiteSchema = z31.discriminatedUnion("scope", [
3480
+ z31.object({
3481
+ kind: z31.literal("completion"),
2815
3482
  quest: identifier,
2816
- scope: z27.literal("ever")
3483
+ scope: z31.literal("ever")
2817
3484
  }).strict(),
2818
- z27.object({
2819
- kind: z27.literal("completion"),
3485
+ z31.object({
3486
+ kind: z31.literal("completion"),
2820
3487
  quest: identifier,
2821
- scope: z27.literal("period"),
3488
+ scope: z31.literal("period"),
2822
3489
  period: calendarPeriodSchema.exclude(["lifetime"])
2823
3490
  }).strict()
2824
3491
  ]);
2825
- var balancePrerequisiteSchema = z27.object({
2826
- kind: z27.literal("balance"),
3492
+ var balancePrerequisiteSchema = z31.object({
3493
+ kind: z31.literal("balance"),
2827
3494
  balance: identifier,
2828
3495
  minimum: threshold
2829
3496
  }).strict();
2830
- var groupPrerequisiteSchema = z27.object({ kind: z27.literal("group"), group: identifier, title: z27.string() }).strict();
2831
- var prerequisiteSchema = z27.discriminatedUnion("kind", [
3497
+ var groupPrerequisiteSchema = z31.object({ kind: z31.literal("group"), group: identifier, title: z31.string() }).strict();
3498
+ var prerequisiteSchema = z31.discriminatedUnion("kind", [
2832
3499
  completionPrerequisiteSchema,
2833
3500
  balancePrerequisiteSchema,
2834
3501
  groupPrerequisiteSchema
2835
3502
  ]);
2836
- var missingPrerequisiteSchema = z27.union([
2837
- z27.object({
2838
- kind: z27.literal("completion"),
3503
+ var missingPrerequisiteSchema = z31.union([
3504
+ z31.object({
3505
+ kind: z31.literal("completion"),
2839
3506
  quest: identifier,
2840
- title: z27.string(),
2841
- scope: z27.literal("ever")
3507
+ title: z31.string(),
3508
+ scope: z31.literal("ever")
2842
3509
  }),
2843
- z27.object({
2844
- kind: z27.literal("completion"),
3510
+ z31.object({
3511
+ kind: z31.literal("completion"),
2845
3512
  quest: identifier,
2846
- title: z27.string(),
2847
- scope: z27.literal("period"),
3513
+ title: z31.string(),
3514
+ scope: z31.literal("period"),
2848
3515
  period: calendarPeriodSchema.exclude(["lifetime"]),
2849
- resetsAt: z27.number().int().safe()
3516
+ resetsAt: z31.number().int().safe()
2850
3517
  }),
2851
- z27.object({
2852
- kind: z27.literal("balance"),
3518
+ z31.object({
3519
+ kind: z31.literal("balance"),
2853
3520
  balance: identifier,
2854
- title: z27.string(),
3521
+ title: z31.string(),
2855
3522
  minimum: threshold,
2856
3523
  current: amount
2857
3524
  }),
2858
- z27.object({
2859
- kind: z27.literal("group"),
3525
+ z31.object({
3526
+ kind: z31.literal("group"),
2860
3527
  group: identifier,
2861
- title: z27.string()
3528
+ title: z31.string()
2862
3529
  })
2863
3530
  ]);
2864
3531
  function completed(quest, options = {}) {
@@ -2889,29 +3556,29 @@ function inGroup(group) {
2889
3556
  var maxPointsAmount = 2147483647;
2890
3557
 
2891
3558
  // src/schema.ts
2892
- import * as z28 from "zod";
2893
- var pointsRewardSchema = z28.object({
2894
- kind: z28.literal("points").default("points"),
3559
+ import * as z32 from "zod";
3560
+ var pointsRewardSchema = z32.object({
3561
+ kind: z32.literal("points").default("points"),
2895
3562
  balance: identifier,
2896
- amount: z28.number().int().min(0).max(maxPointsAmount)
3563
+ amount: z32.number().int().min(0).max(maxPointsAmount)
2897
3564
  }).strict();
2898
- var tieredRewardDefinitionSchema = z28.object({
3565
+ var tieredRewardDefinitionSchema = z32.object({
2899
3566
  /** An automatic achievement backed by the project badge catalog. */
2900
3567
  badge: identifier.optional(),
2901
3568
  /** Membership in the project group with this key, added when the reward is delivered. */
2902
3569
  group: identifier.optional(),
2903
3570
  id: identifier,
2904
- title: z28.string().min(1).max(120),
2905
- tiers: z28.array(
2906
- z28.object({ id: identifier, title: z28.string().min(1).max(120) }).strict()
3571
+ title: z32.string().min(1).max(120),
3572
+ tiers: z32.array(
3573
+ z32.object({ id: identifier, title: z32.string().min(1).max(120) }).strict()
2907
3574
  ).min(1).max(20).refine(
2908
3575
  (tiers) => new Set(tiers.map((t) => t.id)).size === tiers.length,
2909
3576
  "Tier IDs must be unique"
2910
3577
  ),
2911
- inventory: z28.object({ kind: z28.literal("untracked") }).strict(),
2912
- fulfillment: z28.discriminatedUnion("kind", [
2913
- z28.object({ kind: z28.literal("staff-handover") }).strict(),
2914
- z28.object({ kind: z28.literal("automatic") }).strict()
3578
+ inventory: z32.object({ kind: z32.literal("untracked") }).strict(),
3579
+ fulfillment: z32.discriminatedUnion("kind", [
3580
+ z32.object({ kind: z32.literal("staff-handover") }).strict(),
3581
+ z32.object({ kind: z32.literal("automatic") }).strict()
2915
3582
  ])
2916
3583
  }).strict().refine(
2917
3584
  (value) => value.badge === void 0 && value.group === void 0 || value.fulfillment.kind === "automatic" && value.tiers.length === 1 && value.tiers[0].id === "awarded",
@@ -2920,12 +3587,12 @@ var tieredRewardDefinitionSchema = z28.object({
2920
3587
  (value) => value.badge === void 0 || value.group === void 0,
2921
3588
  "A reward is either a badge or a group membership"
2922
3589
  );
2923
- var tieredRewardReferenceSchema = z28.object({
3590
+ var tieredRewardReferenceSchema = z32.object({
2924
3591
  id: identifier,
2925
3592
  key: identifier.nullable()
2926
3593
  });
2927
- var tierRewardSchema = z28.object({
2928
- kind: z28.literal("tier"),
3594
+ var tierRewardSchema = z32.object({
3595
+ kind: z32.literal("tier"),
2929
3596
  reward: tieredRewardDefinitionSchema,
2930
3597
  tier: identifier
2931
3598
  }).strict().refine(
@@ -2937,7 +3604,7 @@ var badgeRewardSchema = tierRewardSchema.transform(
2937
3604
  const badge = value.reward.badge;
2938
3605
  if (!badge || value.reward.fulfillment.kind !== "automatic" || value.reward.tiers.length !== 1 || value.tier !== "awarded") {
2939
3606
  context.addIssue({ code: "custom", message: "Invalid badge reward" });
2940
- return z28.NEVER;
3607
+ return z32.NEVER;
2941
3608
  }
2942
3609
  return { ...value, reward: { ...value.reward, badge } };
2943
3610
  }
@@ -2961,7 +3628,7 @@ var groupRewardSchema = tierRewardSchema.transform(
2961
3628
  const group = value.reward.group;
2962
3629
  if (!group || value.reward.fulfillment.kind !== "automatic" || value.reward.tiers.length !== 1 || value.tier !== "awarded") {
2963
3630
  context.addIssue({ code: "custom", message: "Invalid group reward" });
2964
- return z28.NEVER;
3631
+ return z32.NEVER;
2965
3632
  }
2966
3633
  return { ...value, reward: { ...value.reward, group } };
2967
3634
  }
@@ -2981,7 +3648,7 @@ function groupReward(key, title) {
2981
3648
  });
2982
3649
  }
2983
3650
  var integrationRewardSchema = discordRewardSchema;
2984
- var rewardSchema = z28.union([
3651
+ var rewardSchema = z32.union([
2985
3652
  pointsRewardSchema,
2986
3653
  tierRewardSchema,
2987
3654
  integrationRewardSchema
@@ -2998,39 +3665,39 @@ function rewardKey(reward) {
2998
3665
  }
2999
3666
  return reward.kind === "points" ? "points:" + reward.balance : "tier:" + reward.reward.id;
3000
3667
  }
3001
- var triggerSchema = z28.union([
3002
- z28.object({
3003
- kind: z28.literal("manual"),
3004
- input: z28.literal("text"),
3668
+ var triggerSchema = z32.union([
3669
+ z32.object({
3670
+ kind: z32.literal("manual"),
3671
+ input: z32.literal("text"),
3005
3672
  constraints: textOptionsSchema,
3006
- actor: z28.enum(["member", "staff"]).optional()
3673
+ actor: z32.enum(["member", "staff"]).optional()
3007
3674
  }).strict(),
3008
- z28.object({
3009
- kind: z28.literal("manual"),
3010
- input: z28.literal("url"),
3675
+ z32.object({
3676
+ kind: z32.literal("manual"),
3677
+ input: z32.literal("url"),
3011
3678
  constraints: urlOptionsSchema,
3012
- actor: z28.enum(["member", "staff"]).optional()
3679
+ actor: z32.enum(["member", "staff"]).optional()
3013
3680
  }).strict(),
3014
- z28.object({
3015
- kind: z28.literal("manual"),
3016
- input: z28.enum(["photo", "quiz", "none"]),
3017
- actor: z28.enum(["member", "staff"]).optional()
3681
+ z32.object({
3682
+ kind: z32.literal("manual"),
3683
+ input: z32.enum(["photo", "quiz", "none"]),
3684
+ actor: z32.enum(["member", "staff"]).optional()
3018
3685
  }).strict(),
3019
- z28.object({
3020
- kind: z28.literal("automatic"),
3686
+ z32.object({
3687
+ kind: z32.literal("automatic"),
3021
3688
  tracker: trackerTriggerPolicySchema.optional()
3022
3689
  }).strict()
3023
3690
  ]);
3024
- var triggerResponseSchema = z28.union(
3691
+ var triggerResponseSchema = z32.union(
3025
3692
  triggerSchema.options.map((option) => option.strip())
3026
3693
  );
3027
- var photoResultSchema = z28.object({
3028
- kind: z28.enum(["pass", "fail", "unclear"]),
3029
- reason: z28.string().min(1).max(2e3)
3694
+ var photoResultSchema = z32.object({
3695
+ kind: z32.enum(["pass", "fail", "unclear"]),
3696
+ reason: z32.string().min(1).max(2e3)
3030
3697
  }).strict();
3031
- var textReviewInputSchema = z28.object({
3032
- text: z28.string().min(1).max(16e3).refine((value) => value.trim().length > 0, "Text must not be blank"),
3033
- criteria: z28.string().trim().min(1).max(2e3)
3698
+ var textReviewInputSchema = z32.object({
3699
+ text: z32.string().min(1).max(16e3).refine((value) => value.trim().length > 0, "Text must not be blank"),
3700
+ criteria: z32.string().trim().min(1).max(2e3)
3034
3701
  }).strict();
3035
3702
  var textResultSchema = photoResultSchema;
3036
3703
  var deferPolicy = {
@@ -3044,31 +3711,31 @@ var retryCooldownPolicy = {
3044
3711
  minMs: 1e3,
3045
3712
  maxMs: 6048e5
3046
3713
  };
3047
- var retryCooldownMsSchema = z28.number().int().min(retryCooldownPolicy.minMs).max(retryCooldownPolicy.maxMs);
3048
- var evaluatorProgressSchema = z28.object({
3049
- current: z28.number().finite().nonnegative(),
3050
- target: z28.number().finite().positive(),
3051
- reason: z28.string().min(1).max(2e3)
3714
+ var retryCooldownMsSchema = z32.number().int().min(retryCooldownPolicy.minMs).max(retryCooldownPolicy.maxMs);
3715
+ var evaluatorProgressSchema = z32.object({
3716
+ current: z32.number().finite().nonnegative(),
3717
+ target: z32.number().finite().positive(),
3718
+ reason: z32.string().min(1).max(2e3)
3052
3719
  }).refine((value) => value.current <= value.target, {
3053
3720
  message: "Progress current must not exceed target"
3054
3721
  });
3055
- var decisionSchema = z28.discriminatedUnion("kind", [
3056
- z28.strictObject({
3057
- kind: z28.literal("defer"),
3058
- reason: z28.string().min(1).max(2e3),
3059
- retryAfterMs: z28.number().int().min(deferPolicy.minRetryAfterMs).max(deferPolicy.maxRetryAfterMs).optional(),
3722
+ var decisionSchema = z32.discriminatedUnion("kind", [
3723
+ z32.strictObject({
3724
+ kind: z32.literal("defer"),
3725
+ reason: z32.string().min(1).max(2e3),
3726
+ retryAfterMs: z32.number().int().min(deferPolicy.minRetryAfterMs).max(deferPolicy.maxRetryAfterMs).optional(),
3060
3727
  /** Absolute Unix milliseconds; the platform can only shorten its existing deadline. */
3061
- until: z28.number().int().safe().nonnegative().optional()
3728
+ until: z32.number().int().safe().nonnegative().optional()
3062
3729
  }),
3063
- evaluatorProgressSchema.safeExtend({ kind: z28.literal("progress") }).strict(),
3064
- z28.object({
3065
- kind: z28.literal("accept"),
3066
- rewards: z28.array(rewardSchema).max(10),
3730
+ evaluatorProgressSchema.safeExtend({ kind: z32.literal("progress") }).strict(),
3731
+ z32.object({
3732
+ kind: z32.literal("accept"),
3733
+ rewards: z32.array(rewardSchema).max(10),
3067
3734
  completionKey: completionKeySchema.optional()
3068
3735
  }).strict(),
3069
- z28.object({
3070
- kind: z28.literal("reject"),
3071
- reason: z28.string().min(1).max(2e3),
3736
+ z32.object({
3737
+ kind: z32.literal("reject"),
3738
+ reason: z32.string().min(1).max(2e3),
3072
3739
  /**
3073
3740
  * A stable key for the rejection's cause, such as `wrong-answers`, stored as the attempt's
3074
3741
  * `code`: lowercase letters, digits and hyphens, at most 64 characters, and none of the
@@ -3076,28 +3743,28 @@ var decisionSchema = z28.discriminatedUnion("kind", [
3076
3743
  */
3077
3744
  code: rejectCodeSchema.optional(),
3078
3745
  /** The evaluator asked for human review, but review is off for the quest, so this is a reject. */
3079
- requestedReview: z28.literal(true).optional()
3746
+ requestedReview: z32.literal(true).optional()
3080
3747
  }).strict(),
3081
- z28.object({
3082
- kind: z28.literal("review"),
3083
- reason: z28.string().min(1).max(2e3),
3084
- rewards: z28.array(rewardSchema).max(10).optional(),
3748
+ z32.object({
3749
+ kind: z32.literal("review"),
3750
+ reason: z32.string().min(1).max(2e3),
3751
+ rewards: z32.array(rewardSchema).max(10).optional(),
3085
3752
  completionKey: completionKeySchema.optional()
3086
3753
  }).strict()
3087
3754
  ]);
3088
- var reviewModeSchema = z28.enum(["workers-ai"]);
3089
- var storedReviewModeSchema = z28.enum([
3755
+ var reviewModeSchema = z32.enum(["workers-ai"]);
3756
+ var storedReviewModeSchema = z32.enum([
3090
3757
  "fixture-pass",
3091
3758
  "fixture-fail",
3092
3759
  "fixture-unclear",
3093
3760
  "fixture-error",
3094
3761
  "workers-ai"
3095
3762
  ]);
3096
- var rewardBundleSchema = z28.array(rewardSchema).max(10).refine(
3763
+ var rewardBundleSchema = z32.array(rewardSchema).max(10).refine(
3097
3764
  (rewards) => new Set(rewards.map(rewardKey)).size === rewards.length,
3098
3765
  "Use one entry per balance or shared reward"
3099
3766
  );
3100
- var mediaUrlSchema = z28.string().max(2e3).refine((value) => {
3767
+ var mediaUrlSchema = z32.string().max(2e3).refine((value) => {
3101
3768
  if (/^\/(?!\/)[^\\\s]*$/.test(value)) {
3102
3769
  return true;
3103
3770
  }
@@ -3107,67 +3774,71 @@ var mediaUrlSchema = z28.string().max(2e3).refine((value) => {
3107
3774
  return false;
3108
3775
  }
3109
3776
  }, "Use an HTTPS URL or a same-site path beginning with /");
3110
- var questStepActionSchema = z28.discriminatedUnion("kind", [
3111
- z28.object({
3112
- kind: z28.literal("link"),
3777
+ var questStepActionSchema = z32.discriminatedUnion("kind", [
3778
+ z32.object({
3779
+ kind: z32.literal("link"),
3113
3780
  url: mediaUrlSchema.refine(
3114
3781
  (value) => value.startsWith("https://"),
3115
3782
  "Use an HTTPS URL"
3116
3783
  ),
3117
- label: z28.string().trim().min(1).max(120)
3784
+ label: z32.string().trim().min(1).max(120)
3118
3785
  }).strict()
3119
3786
  ]);
3120
- var questStepSchema = z28.object({
3121
- title: z28.string().trim().min(1).max(120),
3122
- description: z28.string().max(4e3).optional(),
3787
+ var questStepSchema = z32.object({
3788
+ title: z32.string().trim().min(1).max(120),
3789
+ description: z32.string().max(4e3).optional(),
3123
3790
  action: questStepActionSchema.optional()
3124
3791
  }).strict();
3125
- var questPresentationRequirementSchema = z28.discriminatedUnion("kind", [
3126
- z28.object({ kind: z28.literal("account"), provider: authProviderSchema }).strict(),
3127
- z28.object({ kind: z28.literal("wallet"), chain: walletChainSchema.optional() }).strict()
3792
+ var questPresentationRequirementSchema = z32.discriminatedUnion("kind", [
3793
+ z32.object({ kind: z32.literal("account"), provider: authProviderSchema }).strict(),
3794
+ z32.object({ kind: z32.literal("wallet"), chain: walletChainSchema.optional() }).strict()
3128
3795
  ]);
3129
- var questPresentationContentSchema = z28.object({
3130
- steps: z28.array(questStepSchema).max(30).optional(),
3796
+ var questPresentationContentSchema = z32.object({
3797
+ steps: z32.array(questStepSchema).max(30).optional(),
3131
3798
  image: mediaUrlSchema.optional(),
3132
- imageAlt: z28.string().max(500).optional(),
3133
- requirements: z28.array(questPresentationRequirementSchema).max(10).optional()
3799
+ imageAlt: z32.string().max(500).optional(),
3800
+ requirements: z32.array(questPresentationRequirementSchema).max(10).optional()
3134
3801
  }).strict();
3135
3802
  var questPresentationSchema = questPresentationContentSchema.extend({
3136
3803
  quiz: quizQuestionsSchema.optional(),
3137
- instructions: z28.string().max(4e3).optional(),
3138
- video: z28.object({
3804
+ instructions: z32.string().max(4e3).optional(),
3805
+ video: z32.object({
3139
3806
  url: mediaUrlSchema,
3140
3807
  poster: mediaUrlSchema.optional(),
3141
- captions: z28.object({
3808
+ captions: z32.object({
3142
3809
  url: mediaUrlSchema,
3143
- language: z28.string().min(2).max(20),
3144
- label: z28.string().min(1).max(80)
3810
+ language: z32.string().min(2).max(20),
3811
+ label: z32.string().min(1).max(80)
3145
3812
  }).strict().optional()
3146
3813
  }).strict().optional()
3147
3814
  }).strict();
3148
- var questProfileSchema = z28.object({ visible: z28.boolean() }).strict();
3815
+ var questProfileSchema = z32.object({ visible: z32.boolean() }).strict();
3149
3816
  var evaluatorProtocol = 2;
3150
- var evaluatorProtocolSchema = z28.literal(evaluatorProtocol);
3151
- var questDescriptionSchema = z28.object({
3817
+ var evaluatorProtocolSchema = z32.literal(evaluatorProtocol);
3818
+ var questDescriptionSchema = z32.object({
3152
3819
  quest: identifier,
3153
3820
  evaluatorProtocol: evaluatorProtocolSchema,
3154
- title: z28.string().min(1).max(120),
3821
+ title: z32.string().min(1).max(120),
3155
3822
  presentation: questPresentationSchema.default({}),
3156
- integrations: z28.array(evaluatorIntegrationProviderSchema).max(10).default([]),
3823
+ integrations: z32.array(evaluatorIntegrationProviderSchema).max(10).default([]),
3157
3824
  fields: settingsFieldsSchema,
3158
3825
  values: settingsValuesSchema,
3159
3826
  rewards: rewardBundleSchema,
3160
- humanReview: z28.boolean(),
3827
+ /** Messages Relay posts in connected chats and channels when a completion pays. */
3828
+ announcements: z32.array(announcementSchema).max(3).optional(),
3829
+ humanReview: z32.boolean(),
3161
3830
  trigger: triggerSchema,
3162
3831
  performance: contentPerformancePolicySchema.optional(),
3163
- requires: z28.array(prerequisiteSchema).max(30).default([]),
3832
+ requires: z32.array(prerequisiteSchema).max(30).default([]),
3164
3833
  campaign: campaignDefinitionSchema.optional(),
3165
3834
  availability: availabilityWindowSchema.optional(),
3166
- completion: z28.preprocess(refuseStreakTimeZone, completionPolicySchema),
3167
- visibility: z28.enum(["visible", "hidden"]).default("visible"),
3835
+ completion: z32.preprocess(refuseStreakTimeZone, completionPolicySchema),
3836
+ visibility: z32.enum(["visible", "hidden"]).default("visible"),
3168
3837
  /** Whether completions show on participant profiles (`/v1/profiles/:id/completions`). */
3169
3838
  profile: questProfileSchema.default({ visible: false }),
3170
- budgets: z28.array(budgetSchema).max(20).default([]),
3839
+ budgets: z32.array(budgetSchema).max(20).default([]),
3840
+ /** Budgets counted per tracker record author; only on quests with a tracker trigger. */
3841
+ authorBudgets: z32.array(authorBudgetSchema).max(20).optional(),
3171
3842
  /**
3172
3843
  * Milliseconds a member waits after an attempt is rejected (by the evaluator or a reviewer)
3173
3844
  * before submitting this quest again. Only for quests members submit. Omitted: no cooldown.
@@ -3180,25 +3851,31 @@ var questDescriptionSchema = z28.object({
3180
3851
  */
3181
3852
  completionCooldownMs: retryCooldownMsSchema.optional()
3182
3853
  }).strict();
3183
- var artifactSchema = z28.object({ code: z28.string().min(1).max(1e6) }).strict();
3854
+ var artifactSchema = z32.object({ code: z32.string().min(1).max(1e6) }).strict();
3184
3855
  var releaseSchema = artifactSchema.extend({
3185
3856
  /** The SDK runtime the code imports. Absent, the code bundles its own SDK. */
3186
3857
  runtime: sdkRuntimeReferenceSchema.optional(),
3187
3858
  settings: settingsValuesSchema,
3188
3859
  provider: reviewModeSchema,
3189
3860
  expectedRelease: identifier.nullable().optional(),
3190
- settingRenames: z28.record(z28.string(), z28.string()).optional()
3861
+ settingRenames: z32.record(z32.string(), z32.string()).optional()
3191
3862
  }).strict();
3192
- var batchReleaseSchema = z28.object({
3193
- releases: z28.array(releaseSchema).min(1).max(questScaleLimits.quests)
3863
+ var batchReleaseSchema = z32.object({
3864
+ releases: z32.array(releaseSchema).min(1).max(questScaleLimits.quests)
3194
3865
  }).strict();
3195
- var questSettingsInputSchema = z28.object({
3866
+ var questSettingsInputSchema = z32.object({
3196
3867
  quest: identifier,
3197
3868
  expectedRelease: identifier,
3198
3869
  set: settingsValuesSchema,
3199
- reset: z28.array(z28.string()),
3870
+ reset: z32.array(z32.string()),
3200
3871
  /** Replace the editable presentation fields; null restores the code defaults. */
3201
- presentation: questPresentationContentSchema.nullable().optional()
3872
+ presentation: questPresentationContentSchema.nullable().optional(),
3873
+ /**
3874
+ * Anchor IDLs to paste, by `settings.solanaProgram()` setting key, for programs that publish
3875
+ * none on chain; null removes a pasted one. An IDL the program publishes on chain takes
3876
+ * precedence.
3877
+ */
3878
+ solanaIdls: z32.record(z32.string(), anchorIdlSchema.nullable()).optional()
3202
3879
  }).strict();
3203
3880
  var storedQuestDescriptionSchema = questDescriptionSchema.extend({
3204
3881
  completion: completionPolicySchema
@@ -3206,28 +3883,34 @@ var storedQuestDescriptionSchema = questDescriptionSchema.extend({
3206
3883
  var publishedReleaseSchema = responseShape(
3207
3884
  storedQuestDescriptionSchema.extend({
3208
3885
  key: identifier.optional(),
3209
- code: z28.string(),
3886
+ code: z32.string(),
3210
3887
  /** The SDK runtime `code` imports. Absent, the code bundles its own SDK. */
3211
3888
  runtime: sdkRuntimeReferenceSchema.optional(),
3212
3889
  provider: storedReviewModeSchema,
3213
3890
  id: identifier,
3214
- createdAt: z28.number(),
3215
- origin: z28.object({ typeVersion: identifier }).strict().optional(),
3216
- lifecycle: z28.enum(["active", "paused", "archived"]).default("active"),
3217
- configuration: z28.object({
3891
+ createdAt: z32.number(),
3892
+ origin: z32.object({ typeVersion: identifier }).strict().optional(),
3893
+ lifecycle: z32.enum(["active", "paused", "archived"]).default("active"),
3894
+ configuration: z32.object({
3218
3895
  defaults: settingsValuesSchema,
3219
3896
  overrides: settingsValuesSchema,
3220
- preserved: z28.array(z28.string()),
3897
+ preserved: z32.array(z32.string()),
3221
3898
  presentation: questPresentationContentSchema.optional(),
3222
3899
  presentationDefaults: questPresentationContentSchema.optional()
3223
- }).strict().optional()
3900
+ }).strict().optional(),
3901
+ /**
3902
+ * The Anchor IDLs `ctx.wallet.transactions()` decodes instructions with, by
3903
+ * `settings.solanaProgram()` setting key. Stored when the setting is saved; a setting without
3904
+ * an IDL has no entry.
3905
+ */
3906
+ solanaIdls: z32.record(z32.string(), solanaProgramIdlSchema).optional()
3224
3907
  })
3225
3908
  );
3226
- var templateSchema = z28.object({
3227
- code: z28.string(),
3909
+ var templateSchema = z32.object({
3910
+ code: z32.string(),
3228
3911
  definition: questDescriptionSchema
3229
3912
  });
3230
- var quizAnswersSchema = z28.record(identifier, identifier).refine(
3913
+ var quizAnswersSchema = z32.record(identifier, identifier).refine(
3231
3914
  (answers) => Object.keys(answers).length > 0 && Object.keys(answers).length <= 50,
3232
3915
  "Provide between 1 and 50 answers"
3233
3916
  ).transform(
@@ -3235,17 +3918,17 @@ var quizAnswersSchema = z28.record(identifier, identifier).refine(
3235
3918
  Object.entries(answers).sort(([a], [b]) => a.localeCompare(b))
3236
3919
  )
3237
3920
  );
3238
- var quizEvidenceSchema = z28.object({
3239
- kind: z28.literal("quiz"),
3921
+ var quizEvidenceSchema = z32.object({
3922
+ kind: z32.literal("quiz"),
3240
3923
  release: identifier.optional(),
3241
3924
  answers: quizAnswersSchema
3242
3925
  }).strict();
3243
- var submissionEvidenceSchema = z28.union([
3926
+ var submissionEvidenceSchema = z32.union([
3244
3927
  quizEvidenceSchema,
3245
3928
  textEvidenceSchema,
3246
3929
  urlEvidenceSchema
3247
3930
  ]);
3248
- var submitSchema = z28.object({
3931
+ var submitSchema = z32.object({
3249
3932
  actionId: identifier,
3250
3933
  quest: identifier,
3251
3934
  member: identifier,
@@ -3253,7 +3936,7 @@ var submitSchema = z28.object({
3253
3936
  input: submissionEvidenceSchema.optional(),
3254
3937
  release: identifier.optional(),
3255
3938
  /** @deprecated Relay refuses a submission that sets it to `true` and ignores `false`. Removed in 2.0.0. */
3256
- faultAfterReview: z28.boolean().optional()
3939
+ faultAfterReview: z32.boolean().optional()
3257
3940
  }).strict();
3258
3941
  var AttemptStatus = {
3259
3942
  Queued: "queued",
@@ -3265,8 +3948,8 @@ var AttemptStatus = {
3265
3948
  NeedsReview: "needs-review",
3266
3949
  Failed: "failed"
3267
3950
  };
3268
- var attemptStatusSchema = z28.string();
3269
- var attemptSchema = z28.object({
3951
+ var attemptStatusSchema = z32.string();
3952
+ var attemptSchema = z32.object({
3270
3953
  id: identifier,
3271
3954
  release: identifier,
3272
3955
  quest: identifier,
@@ -3274,29 +3957,29 @@ var attemptSchema = z28.object({
3274
3957
  evidence: identifier.nullable(),
3275
3958
  input: submissionEvidenceSchema.optional(),
3276
3959
  status: attemptStatusSchema,
3277
- reason: z28.string().nullable(),
3278
- retries: z28.number(),
3279
- generation: z28.number(),
3280
- completion: z28.string().nullable(),
3960
+ reason: z32.string().nullable(),
3961
+ retries: z32.number(),
3962
+ generation: z32.number(),
3963
+ completion: z32.string().nullable(),
3281
3964
  reviewRewards: rewardBundleSchema.nullable().default(null),
3282
3965
  /** Scheduled reruns advance this number; failure retries preserve it. */
3283
- evaluationRun: z28.number().int().nonnegative().default(0),
3284
- deferCount: z28.number().int().nonnegative().default(0),
3285
- deferUntil: z28.number().int().safe().nullable().default(null),
3286
- nextEvaluationAt: z28.number().int().safe().nullable().default(null),
3966
+ evaluationRun: z32.number().int().nonnegative().default(0),
3967
+ deferCount: z32.number().int().nonnegative().default(0),
3968
+ deferUntil: z32.number().int().safe().nullable().default(null),
3969
+ nextEvaluationAt: z32.number().int().safe().nullable().default(null),
3287
3970
  /**
3288
3971
  * Open code: consumers must tolerate new values. Relay writes its own codes, such as
3289
3972
  * `budget-exhausted`; an attempt the evaluator rejected with `decision.reject({ reason, code })`
3290
3973
  * carries the evaluator's code in management reads, and null in responses to members.
3291
3974
  */
3292
- code: z28.string().nullable().default(null),
3975
+ code: z32.string().nullable().default(null),
3293
3976
  progress: evaluatorProgressSchema.nullable().default(null),
3294
3977
  /**
3295
3978
  * The evaluator asked for human review of a quest with review off, so Domino rejected the attempt
3296
3979
  * with the evaluator's reason. Only set on a rejected attempt.
3297
3980
  */
3298
- requestedReview: z28.boolean().default(false),
3299
- createdAt: z28.number()
3981
+ requestedReview: z32.boolean().default(false),
3982
+ createdAt: z32.number()
3300
3983
  });
3301
3984
  var QuestSubmissionStatus = {
3302
3985
  Open: "open",
@@ -3304,9 +3987,9 @@ var QuestSubmissionStatus = {
3304
3987
  Discarded: "discarded",
3305
3988
  Expired: "expired"
3306
3989
  };
3307
- var questSubmissionStatusSchema = z28.string();
3990
+ var questSubmissionStatusSchema = z32.string();
3308
3991
  var questSubmissionSchema = responseShape(
3309
- z28.object({
3992
+ z32.object({
3310
3993
  id: identifier,
3311
3994
  quest: identifier,
3312
3995
  member: identifier,
@@ -3316,85 +3999,85 @@ var questSubmissionSchema = responseShape(
3316
3999
  /** An uploaded photo's evidence ID. */
3317
4000
  evidence: identifier.nullable(),
3318
4001
  /** Submitting was refused because the quest changed: review the draft before submitting again. */
3319
- reviewRequired: z28.boolean(),
4002
+ reviewRequired: z32.boolean(),
3320
4003
  status: questSubmissionStatusSchema,
3321
4004
  /** The attempt a `submitted` submission admitted. */
3322
4005
  attempt: identifier.nullable(),
3323
- createdAt: z28.number(),
3324
- updatedAt: z28.number(),
4006
+ createdAt: z32.number(),
4007
+ updatedAt: z32.number(),
3325
4008
  /** When an open submission expires unless it changes again. */
3326
- expiresAt: z28.number()
4009
+ expiresAt: z32.number()
3327
4010
  })
3328
4011
  );
3329
- var questSubmissionUpdateSchema = z28.object({
4012
+ var questSubmissionUpdateSchema = z32.object({
3330
4013
  release: identifier.nullable().optional(),
3331
4014
  input: submissionEvidenceSchema.nullable().optional(),
3332
4015
  evidence: identifier.nullable().optional()
3333
4016
  }).strict();
3334
4017
  var questSubmissionResultSchema = responseShape(
3335
- z28.object({
4018
+ z32.object({
3336
4019
  submission: questSubmissionSchema,
3337
4020
  attempt: attemptSchema,
3338
- replayed: z28.boolean()
4021
+ replayed: z32.boolean()
3339
4022
  })
3340
4023
  );
3341
- var eventSchema = z28.object({
3342
- id: z28.number(),
3343
- attempt: z28.string().nullable(),
3344
- kind: z28.string(),
3345
- detail: z28.string(),
3346
- actor: z28.string().nullable().default(null),
3347
- at: z28.number()
3348
- });
3349
- var pickupSelectionSchema = z28.object({
4024
+ var eventSchema = z32.object({
4025
+ id: z32.number(),
4026
+ attempt: z32.string().nullable(),
4027
+ kind: z32.string(),
4028
+ detail: z32.string(),
4029
+ actor: z32.string().nullable().default(null),
4030
+ at: z32.number()
4031
+ });
4032
+ var pickupSelectionSchema = z32.object({
3350
4033
  item: identifier,
3351
- revision: z28.number().int().nonnegative()
4034
+ revision: z32.number().int().nonnegative()
3352
4035
  }).strict();
3353
- var pickupAllocationSchema = z28.object({
4036
+ var pickupAllocationSchema = z32.object({
3354
4037
  item: identifier,
3355
- label: z28.string().min(1).max(80)
4038
+ label: z32.string().min(1).max(80)
3356
4039
  }).strict();
3357
- var pickupPolicySchema = z28.discriminatedUnion("kind", [
3358
- z28.object({ kind: z28.literal("untracked") }).strict(),
3359
- z28.object({
3360
- kind: z28.literal("at-pickup"),
3361
- tiers: z28.array(
3362
- z28.object({
4040
+ var pickupPolicySchema = z32.discriminatedUnion("kind", [
4041
+ z32.object({ kind: z32.literal("untracked") }).strict(),
4042
+ z32.object({
4043
+ kind: z32.literal("at-pickup"),
4044
+ tiers: z32.array(
4045
+ z32.object({
3363
4046
  tier: identifier,
3364
- variants: z28.array(pickupAllocationSchema).min(1).max(100)
4047
+ variants: z32.array(pickupAllocationSchema).min(1).max(100)
3365
4048
  }).strict()
3366
4049
  ).min(1).max(100)
3367
4050
  }).strict()
3368
4051
  ]);
3369
- var pickupCatalogSchema = z28.object({
4052
+ var pickupCatalogSchema = z32.object({
3370
4053
  reward: tieredRewardDefinitionSchema,
3371
- revision: z28.number().int().nonnegative(),
4054
+ revision: z32.number().int().nonnegative(),
3372
4055
  policy: pickupPolicySchema
3373
4056
  });
3374
- var pickupAvailabilitySchema = z28.discriminatedUnion("kind", [
3375
- z28.object({ kind: z28.literal("untracked") }).strict(),
3376
- z28.object({
3377
- kind: z28.literal("at-pickup"),
3378
- revision: z28.number().int().nonnegative(),
3379
- variants: z28.array(
4057
+ var pickupAvailabilitySchema = z32.discriminatedUnion("kind", [
4058
+ z32.object({ kind: z32.literal("untracked") }).strict(),
4059
+ z32.object({
4060
+ kind: z32.literal("at-pickup"),
4061
+ revision: z32.number().int().nonnegative(),
4062
+ variants: z32.array(
3380
4063
  pickupAllocationSchema.extend({
3381
- available: z28.number().int().nonnegative()
4064
+ available: z32.number().int().nonnegative()
3382
4065
  })
3383
4066
  )
3384
4067
  }).strict()
3385
4068
  ]);
3386
- var configurePickupSchema = z28.object({
4069
+ var configurePickupSchema = z32.object({
3387
4070
  reward: identifier,
3388
- revision: z28.number().int().nonnegative(),
4071
+ revision: z32.number().int().nonnegative(),
3389
4072
  actionId: identifier,
3390
- policy: z28.discriminatedUnion("kind", [
3391
- z28.object({ kind: z28.literal("untracked") }).strict(),
3392
- z28.object({
3393
- kind: z28.literal("at-pickup"),
3394
- tiers: z28.array(
3395
- z28.object({
4073
+ policy: z32.discriminatedUnion("kind", [
4074
+ z32.object({ kind: z32.literal("untracked") }).strict(),
4075
+ z32.object({
4076
+ kind: z32.literal("at-pickup"),
4077
+ tiers: z32.array(
4078
+ z32.object({
3396
4079
  tier: identifier,
3397
- variants: z28.array(
4080
+ variants: z32.array(
3398
4081
  pickupAllocationSchema.extend({
3399
4082
  item: identifier.optional()
3400
4083
  })
@@ -3404,10 +4087,10 @@ var configurePickupSchema = z28.object({
3404
4087
  }).strict()
3405
4088
  ])
3406
4089
  }).strict();
3407
- var entitlementRecoverySchema = z28.object({
4090
+ var entitlementRecoverySchema = z32.object({
3408
4091
  completion: identifier,
3409
- reason: z28.string(),
3410
- flaggedAt: z28.number(),
4092
+ reason: z32.string(),
4093
+ flaggedAt: z32.number(),
3411
4094
  /** Null means no accepted completion currently earns this reward. */
3412
4095
  remainingTier: identifier.nullable()
3413
4096
  });
@@ -3417,40 +4100,40 @@ var entitlementBase = {
3417
4100
  reward: tieredRewardDefinitionSchema,
3418
4101
  earnedTier: identifier,
3419
4102
  tier: identifier,
3420
- revision: z28.number().int().positive()
4103
+ revision: z32.number().int().positive()
3421
4104
  };
3422
- var entitlementStateSchema = z28.discriminatedUnion("status", [
3423
- z28.object({ ...entitlementBase, status: z28.literal("available") }).strict(),
3424
- z28.object({
4105
+ var entitlementStateSchema = z32.discriminatedUnion("status", [
4106
+ z32.object({ ...entitlementBase, status: z32.literal("available") }).strict(),
4107
+ z32.object({
3425
4108
  ...entitlementBase,
3426
- status: z28.literal("handing-over"),
4109
+ status: z32.literal("handing-over"),
3427
4110
  handover: identifier,
3428
- startedAt: z28.number(),
4111
+ startedAt: z32.number(),
3429
4112
  allocation: pickupAllocationSchema.optional()
3430
4113
  }).strict(),
3431
- z28.object({
4114
+ z32.object({
3432
4115
  ...entitlementBase,
3433
- status: z28.literal("collected"),
4116
+ status: z32.literal("collected"),
3434
4117
  handover: identifier,
3435
- startedAt: z28.number(),
4118
+ startedAt: z32.number(),
3436
4119
  allocation: pickupAllocationSchema.optional(),
3437
- collectedAt: z28.number(),
4120
+ collectedAt: z32.number(),
3438
4121
  recovery: entitlementRecoverySchema.optional()
3439
4122
  }).strict(),
3440
4123
  // An operator voided it: it can no longer be handed over. A quest grant of the same reward to
3441
4124
  // the member (the same grant key) makes it available again; a voided referral reward stays void.
3442
- z28.object({
4125
+ z32.object({
3443
4126
  ...entitlementBase,
3444
- status: z28.literal("void"),
3445
- voidedAt: z28.number()
4127
+ status: z32.literal("void"),
4128
+ voidedAt: z32.number()
3446
4129
  }).strict()
3447
4130
  ]);
3448
- var tieredRewardReadSchema = z28.object({
4131
+ var tieredRewardReadSchema = z32.object({
3449
4132
  id: identifier,
3450
- title: z28.string(),
3451
- tiers: z28.array(z28.object({ id: identifier, title: z28.string() }).loose()),
3452
- inventory: z28.object({ kind: z28.string() }).loose(),
3453
- fulfillment: z28.object({ kind: z28.string() }).loose()
4133
+ title: z32.string(),
4134
+ tiers: z32.array(z32.object({ id: identifier, title: z32.string() }).loose()),
4135
+ inventory: z32.object({ kind: z32.string() }).loose(),
4136
+ fulfillment: z32.object({ kind: z32.string() }).loose()
3454
4137
  }).loose();
3455
4138
  var entitlementReadBase = {
3456
4139
  id: identifier,
@@ -3458,63 +4141,63 @@ var entitlementReadBase = {
3458
4141
  reward: tieredRewardReadSchema,
3459
4142
  earnedTier: identifier,
3460
4143
  tier: identifier,
3461
- revision: z28.number().int()
4144
+ revision: z32.number().int()
3462
4145
  };
3463
- var allocationReadSchema = z28.object({ item: identifier, label: z28.string() }).loose();
3464
- var entitlementSchema = z28.union([
3465
- z28.discriminatedUnion("status", [
3466
- z28.object({ ...entitlementReadBase, status: z28.literal("available") }).loose(),
3467
- z28.object({
4146
+ var allocationReadSchema = z32.object({ item: identifier, label: z32.string() }).loose();
4147
+ var entitlementSchema = z32.union([
4148
+ z32.discriminatedUnion("status", [
4149
+ z32.object({ ...entitlementReadBase, status: z32.literal("available") }).loose(),
4150
+ z32.object({
3468
4151
  ...entitlementReadBase,
3469
- status: z28.literal("handing-over"),
4152
+ status: z32.literal("handing-over"),
3470
4153
  handover: identifier,
3471
- startedAt: z28.number(),
4154
+ startedAt: z32.number(),
3472
4155
  allocation: allocationReadSchema.optional()
3473
4156
  }).loose(),
3474
- z28.object({
4157
+ z32.object({
3475
4158
  ...entitlementReadBase,
3476
- status: z28.literal("collected"),
4159
+ status: z32.literal("collected"),
3477
4160
  handover: identifier,
3478
- startedAt: z28.number(),
4161
+ startedAt: z32.number(),
3479
4162
  allocation: allocationReadSchema.optional(),
3480
- collectedAt: z28.number(),
4163
+ collectedAt: z32.number(),
3481
4164
  recovery: entitlementRecoverySchema.optional()
3482
4165
  }).loose(),
3483
- z28.object({
4166
+ z32.object({
3484
4167
  ...entitlementReadBase,
3485
- status: z28.literal("void"),
3486
- voidedAt: z28.number()
4168
+ status: z32.literal("void"),
4169
+ voidedAt: z32.number()
3487
4170
  }).loose()
3488
4171
  ]),
3489
- z28.object({ ...entitlementReadBase, status: z28.string() }).loose().transform(({ status, ...entitlement }) => ({
4172
+ z32.object({ ...entitlementReadBase, status: z32.string() }).loose().transform(({ status, ...entitlement }) => ({
3490
4173
  ...entitlement,
3491
4174
  status: "unsupported",
3492
4175
  reportedStatus: status
3493
4176
  }))
3494
4177
  ]);
3495
- var beginHandoverSchema = z28.object({
4178
+ var beginHandoverSchema = z32.object({
3496
4179
  actionId: identifier,
3497
- revision: z28.number().int().positive(),
4180
+ revision: z32.number().int().positive(),
3498
4181
  selection: pickupSelectionSchema.optional()
3499
4182
  }).strict();
3500
- var confirmHandoverSchema = z28.object({ actionId: identifier, handover: identifier }).strict();
3501
- var entitlementCorrectionSchema = z28.object({
4183
+ var confirmHandoverSchema = z32.object({ actionId: identifier, handover: identifier }).strict();
4184
+ var entitlementCorrectionSchema = z32.object({
3502
4185
  actionId: identifier,
3503
- revision: z28.number().int().positive(),
3504
- reason: z28.string().trim().min(1).max(500)
4186
+ revision: z32.number().int().positive(),
4187
+ reason: z32.string().trim().min(1).max(500)
3505
4188
  }).strict();
3506
4189
  var CompletionSourceKind = {
3507
4190
  Quest: "quest",
3508
4191
  Leaderboard: "leaderboard"
3509
4192
  };
3510
- var completionSourceKindSchema = z28.string().min(1).max(64);
3511
- var completionSourceSchema = z28.object({
4193
+ var completionSourceKindSchema = z32.string().min(1).max(64);
4194
+ var completionSourceSchema = z32.object({
3512
4195
  kind: completionSourceKindSchema,
3513
4196
  id: identifier
3514
4197
  });
3515
- var completionRecordSchema = z28.object({
4198
+ var completionRecordSchema = z32.object({
3516
4199
  /** The occurrence the completion consumed. For a leaderboard prize, the settlement ID. */
3517
- key: z28.string().default("once"),
4200
+ key: z32.string().default("once"),
3518
4201
  id: identifier,
3519
4202
  /** The quest ID, or the board ID when `source.kind` is `leaderboard`. */
3520
4203
  quest: identifier,
@@ -3522,19 +4205,19 @@ var completionRecordSchema = z28.object({
3522
4205
  /** What paid the completion. `source.id` repeats `quest`. */
3523
4206
  source: completionSourceSchema.optional()
3524
4207
  });
3525
- var questAvailabilitySchema = z28.discriminatedUnion("kind", [
3526
- z28.object({
3527
- kind: z28.literal("available"),
3528
- input: z28.enum(["photo", "quiz", "none", "text", "url"])
4208
+ var questAvailabilitySchema = z32.discriminatedUnion("kind", [
4209
+ z32.object({
4210
+ kind: z32.literal("available"),
4211
+ input: z32.enum(["photo", "quiz", "none", "text", "url"])
3529
4212
  }).strict(),
3530
- z28.object({ kind: z28.literal("completed") }).strict(),
3531
- z28.object({
3532
- kind: z28.literal("locked"),
3533
- missing: z28.array(missingPrerequisiteSchema).min(1)
4213
+ z32.object({ kind: z32.literal("completed") }).strict(),
4214
+ z32.object({
4215
+ kind: z32.literal("locked"),
4216
+ missing: z32.array(missingPrerequisiteSchema).min(1)
3534
4217
  }).strict(),
3535
- z28.object({
3536
- kind: z28.literal("blocked"),
3537
- reason: z28.enum([
4218
+ z32.object({
4219
+ kind: z32.literal("blocked"),
4220
+ reason: z32.enum([
3538
4221
  "budget-exhausted",
3539
4222
  "connection-required",
3540
4223
  "wallet-required",
@@ -3543,56 +4226,56 @@ var questAvailabilitySchema = z28.discriminatedUnion("kind", [
3543
4226
  "enrollment-required"
3544
4227
  ]),
3545
4228
  /** Which window refused admission when `reason` is `outside-window`. */
3546
- window: z28.enum(["tracker", "quest"]).optional(),
3547
- resetsAt: z28.number().int().safe().optional()
4229
+ window: z32.enum(["tracker", "quest"]).optional(),
4230
+ resetsAt: z32.number().int().safe().optional()
3548
4231
  }).strict(),
3549
- z28.object({ kind: z28.literal("staff-required") }).strict(),
3550
- z28.object({ kind: z28.literal("automatic") }).strict(),
3551
- z28.object({ kind: z28.literal("checking"), attempt: identifier }).strict(),
3552
- z28.object({ kind: z28.literal("needs-review"), attempt: identifier }).strict(),
3553
- z28.object({ kind: z28.literal("retryable"), attempt: identifier }).strict()
4232
+ z32.object({ kind: z32.literal("staff-required") }).strict(),
4233
+ z32.object({ kind: z32.literal("automatic") }).strict(),
4234
+ z32.object({ kind: z32.literal("checking"), attempt: identifier }).strict(),
4235
+ z32.object({ kind: z32.literal("needs-review"), attempt: identifier }).strict(),
4236
+ z32.object({ kind: z32.literal("retryable"), attempt: identifier }).strict()
3554
4237
  ]);
3555
- var questAvailabilityResponseSchema = z28.union(
4238
+ var questAvailabilityResponseSchema = z32.union(
3556
4239
  questAvailabilitySchema.options.map((option) => option.strip())
3557
4240
  );
3558
- var questBudgetViewSchema = z28.object({
4241
+ var questBudgetViewSchema = z32.object({
3559
4242
  id: identifier,
3560
- scope: z28.enum(["member", "project"]),
3561
- period: z28.enum(["day", "week", "month", "lifetime"]),
3562
- remaining: z28.number().int().safe().nonnegative(),
3563
- resetsAt: z28.number().int().safe().nullable()
4243
+ scope: z32.enum(["member", "project"]),
4244
+ period: z32.enum(["day", "week", "month", "lifetime"]),
4245
+ remaining: z32.number().int().safe().nonnegative(),
4246
+ resetsAt: z32.number().int().safe().nullable()
3564
4247
  });
3565
4248
  var memberProgressSchema = responseShape(
3566
- z28.object({
4249
+ z32.object({
3567
4250
  member: identifier,
3568
- quests: z28.array(
3569
- z28.object({
4251
+ quests: z32.array(
4252
+ z32.object({
3570
4253
  quest: identifier,
3571
4254
  key: identifier.optional(),
3572
4255
  release: identifier.optional(),
3573
- title: z28.string(),
4256
+ title: z32.string(),
3574
4257
  presentation: questPresentationSchema.default({}),
3575
- connections: z28.array(authProviderSchema).default([]),
4258
+ connections: z32.array(authProviderSchema).default([]),
3576
4259
  trigger: triggerResponseSchema,
3577
4260
  availability: questAvailabilityResponseSchema,
3578
- completed: z28.boolean(),
4261
+ completed: z32.boolean(),
3579
4262
  completion: completionPolicySchema.default({ kind: "once" }),
3580
4263
  streak: streakProgressSchema.nullable().optional(),
3581
4264
  counter: counterProgressSchema.nullable().optional(),
3582
4265
  /** Latest attempt's committed evaluator progress, while it remains deferred/evaluating. */
3583
4266
  progress: evaluatorProgressSchema.nullable().default(null),
3584
- completionCount: z28.number().int().nonnegative().default(0),
3585
- visibility: z28.enum(["visible", "hidden"]).default("visible"),
3586
- missing: z28.array(missingPrerequisiteSchema),
4267
+ completionCount: z32.number().int().nonnegative().default(0),
4268
+ visibility: z32.enum(["visible", "hidden"]).default("visible"),
4269
+ missing: z32.array(missingPrerequisiteSchema),
3587
4270
  campaign: campaignViewSchema.nullable().default(null),
3588
4271
  window: availabilityWindowSchema.nullable().default(null),
3589
- budgets: z28.array(questBudgetViewSchema).default([]),
4272
+ budgets: z32.array(questBudgetViewSchema).default([]),
3590
4273
  /**
3591
4274
  * Unix milliseconds when the member may submit again, while the quest's retry cooldown
3592
4275
  * after their rejected attempt runs. Until then a new attempt is refused with
3593
4276
  * `retry-cooldown`. Absent when no cooldown is running.
3594
4277
  */
3595
- retryAt: z28.number().int().safe().optional(),
4278
+ retryAt: z32.number().int().safe().optional(),
3596
4279
  /**
3597
4280
  * Unix milliseconds when the member may next submit the quest, while it waits on something
3598
4281
  * that ends by itself: the retry cooldown after a rejection, the completion cooldown after
@@ -3601,106 +4284,110 @@ var memberProgressSchema = responseShape(
3601
4284
  * several apply; use it for countdowns. Absent when the member can submit now, or when
3602
4285
  * nothing will reopen the quest (a used-up lifetime budget, a closed window).
3603
4286
  */
3604
- nextAvailableAt: z28.number().int().safe().optional(),
4287
+ nextAvailableAt: z32.number().int().safe().optional(),
3605
4288
  attempt: attemptSchema.nullable()
3606
4289
  })
3607
4290
  ),
3608
- entitlements: z28.array(entitlementSchema)
4291
+ entitlements: z32.array(entitlementSchema)
3609
4292
  })
3610
4293
  );
3611
4294
  var snapshotSchema = responseShape(
3612
- z28.object({
3613
- releases: z28.array(publishedReleaseSchema),
3614
- completions: z28.array(completionRecordSchema),
3615
- entitlements: z28.array(entitlementSchema),
3616
- attempts: z28.array(attemptSchema),
3617
- balances: z28.array(
3618
- z28.object({
3619
- member: z28.string(),
3620
- balance: z28.string(),
3621
- earned: z28.number(),
3622
- held: z28.number(),
3623
- available: z28.number()
4295
+ z32.object({
4296
+ releases: z32.array(publishedReleaseSchema),
4297
+ completions: z32.array(completionRecordSchema),
4298
+ entitlements: z32.array(entitlementSchema),
4299
+ attempts: z32.array(attemptSchema),
4300
+ balances: z32.array(
4301
+ z32.object({
4302
+ member: z32.string(),
4303
+ balance: z32.string(),
4304
+ earned: z32.number(),
4305
+ held: z32.number(),
4306
+ available: z32.number()
3624
4307
  })
3625
4308
  ),
3626
- events: z28.array(eventSchema)
4309
+ events: z32.array(eventSchema)
3627
4310
  })
3628
4311
  );
3629
- var evidenceSchema = z28.object({
4312
+ var evidenceSchema = z32.object({
3630
4313
  id: identifier,
3631
4314
  member: identifier,
3632
- type: z28.enum(["image/jpeg", "image/png"]),
3633
- size: z28.number()
4315
+ type: z32.enum(["image/jpeg", "image/png"]),
4316
+ size: z32.number()
3634
4317
  });
3635
- var errorSchema = z28.object({
3636
- error: z28.string(),
3637
- code: z28.string().optional(),
4318
+ var errorSchema = z32.object({
4319
+ error: z32.string(),
4320
+ code: z32.string().optional(),
3638
4321
  /** Which window refused admission when `code` is `outside-window`. */
3639
- window: z28.enum(["tracker", "quest"]).optional(),
3640
- missing: z28.array(missingPrerequisiteSchema).optional(),
4322
+ window: z32.enum(["tracker", "quest"]).optional(),
4323
+ missing: z32.array(missingPrerequisiteSchema).optional(),
3641
4324
  /**
3642
4325
  * Unix milliseconds when the member may submit again, when `code` is `retry-cooldown` or
3643
4326
  * `completion-cooldown`.
3644
4327
  */
3645
- retryAt: z28.number().int().safe().optional()
4328
+ retryAt: z32.number().int().safe().optional()
3646
4329
  });
3647
- var staffDecisionSchema = z28.object({
4330
+ var staffDecisionSchema = z32.object({
4331
+ actionId: identifier,
4332
+ generation: z32.number().int().nonnegative(),
4333
+ decision: z32.enum(["accept", "reject"]),
4334
+ reason: z32.string().trim().min(1).max(2e3)
4335
+ }).strict();
4336
+ var acceptAnywaySchema = z32.object({
3648
4337
  actionId: identifier,
3649
- generation: z28.number().int().nonnegative(),
3650
- decision: z28.enum(["accept", "reject"]),
3651
- reason: z28.string().trim().min(1).max(2e3)
4338
+ reason: z32.string().trim().min(1).max(2e3)
3652
4339
  }).strict();
3653
- var stockSchema = z28.object({ item: identifier, quantity: z28.number().int().min(0).max(1e4) }).strict();
3654
- var reservationSchema = z28.object({
4340
+ var stockSchema = z32.object({ item: identifier, quantity: z32.number().int().min(0).max(1e4) }).strict();
4341
+ var reservationSchema = z32.object({
3655
4342
  actionId: identifier,
3656
4343
  member: identifier,
3657
4344
  item: identifier,
3658
4345
  balance: identifier,
3659
- price: z28.number().int().positive().max(1e4)
4346
+ price: z32.number().int().positive().max(1e4)
3660
4347
  }).strict();
3661
4348
  var pageOptions = {
3662
- limit: z28.number().int().min(1).max(100).default(25),
3663
- cursor: z28.string().min(1).max(4096).optional()
4349
+ limit: z32.number().int().min(1).max(100).default(25),
4350
+ cursor: z32.string().min(1).max(4096).optional()
3664
4351
  };
3665
- var reviewListSchema = z28.object({
4352
+ var reviewListSchema = z32.object({
3666
4353
  ...pageOptions,
3667
4354
  member: identifier.optional(),
3668
4355
  quest: identifier.optional()
3669
4356
  }).strict();
3670
- var memberListSchema = z28.object({
4357
+ var memberListSchema = z32.object({
3671
4358
  ...pageOptions,
3672
4359
  prefix: identifier.optional()
3673
4360
  }).strict();
3674
- var reviewItemSchema = z28.object({
4361
+ var reviewItemSchema = z32.object({
3675
4362
  attempt: attemptSchema,
3676
- title: z28.string(),
3677
- checks: z28.array(
3678
- z28.object({ criteria: z28.string(), result: photoResultSchema })
4363
+ title: z32.string(),
4364
+ checks: z32.array(
4365
+ z32.object({ criteria: z32.string(), result: photoResultSchema })
3679
4366
  )
3680
4367
  });
3681
- var reviewPageSchema = z28.object({
3682
- items: z28.array(reviewItemSchema).max(100),
3683
- nextCursor: z28.string().nullable()
4368
+ var reviewPageSchema = z32.object({
4369
+ items: z32.array(reviewItemSchema).max(100),
4370
+ nextCursor: z32.string().nullable()
3684
4371
  });
3685
- var memberPageSchema = z28.object({
3686
- items: z28.array(z28.object({ member: identifier })).max(100),
3687
- nextCursor: z28.string().nullable()
4372
+ var memberPageSchema = z32.object({
4373
+ items: z32.array(z32.object({ member: identifier })).max(100),
4374
+ nextCursor: z32.string().nullable()
3688
4375
  });
3689
- var createStockItemSchema = z28.object({ actionId: identifier, name: z28.string().trim().min(1).max(80) }).strict();
3690
- var stockItemSchema = z28.object({ id: identifier, name: z28.string() });
3691
- var contentPerformanceSnapshotSchema = z28.strictObject({
4376
+ var createStockItemSchema = z32.object({ actionId: identifier, name: z32.string().trim().min(1).max(80) }).strict();
4377
+ var stockItemSchema = z32.object({ id: identifier, name: z32.string() });
4378
+ var contentPerformanceSnapshotSchema = z32.strictObject({
3692
4379
  contentAttempt: identifier,
3693
4380
  observation: identifier,
3694
- observedAt: z28.number().int().safe().nonnegative(),
4381
+ observedAt: z32.number().int().safe().nonnegative(),
3695
4382
  metrics: contentMetricsSchema,
3696
4383
  rewards: rewardBundleSchema
3697
4384
  });
3698
4385
  var contentPerformanceQuerySchema = contentQualificationQuerySchema.extend({
3699
- content: z28.string().min(1).max(256)
4386
+ content: z32.string().min(1).max(256)
3700
4387
  });
3701
- var contentPerformancePageSchema = z28.strictObject({
3702
- current: z28.strictObject({
3703
- state: z28.enum([
4388
+ var contentPerformancePageSchema = z32.strictObject({
4389
+ current: z32.strictObject({
4390
+ state: z32.enum([
3704
4391
  "content-pending",
3705
4392
  "content-unqualified",
3706
4393
  "waiting",
@@ -3711,19 +4398,19 @@ var contentPerformancePageSchema = z28.strictObject({
3711
4398
  "failed",
3712
4399
  "superseded"
3713
4400
  ]),
3714
- reason: z28.string().nullable(),
4401
+ reason: z32.string().nullable(),
3715
4402
  contentAttempt: identifier,
3716
4403
  attempt: identifier.nullable(),
3717
4404
  reward: contentQualificationSchema.shape.reward
3718
4405
  }),
3719
- items: z28.array(
3720
- z28.strictObject({
4406
+ items: z32.array(
4407
+ z32.strictObject({
3721
4408
  attempt: identifier,
3722
4409
  contentAttempt: identifier,
3723
4410
  observation: identifier,
3724
- observedAt: z28.number(),
4411
+ observedAt: z32.number(),
3725
4412
  metrics: contentMetricsSchema,
3726
- state: z28.enum([
4413
+ state: z32.enum([
3727
4414
  "pending",
3728
4415
  "qualified",
3729
4416
  "unqualified",
@@ -3731,7 +4418,7 @@ var contentPerformancePageSchema = z28.strictObject({
3731
4418
  "failed",
3732
4419
  "superseded"
3733
4420
  ]),
3734
- reason: z28.string().nullable()
4421
+ reason: z32.string().nullable()
3735
4422
  })
3736
4423
  ),
3737
4424
  nextCursor: pageCursorSchema.nullable()
@@ -3762,6 +4449,8 @@ export {
3762
4449
  discordMemberInputSchema,
3763
4450
  discordMessageInputSchema,
3764
4451
  discordMemberSchema,
4452
+ lifecycleReasonSchema,
4453
+ offsetDateTimeSchema,
3765
4454
  discordMessageSchema,
3766
4455
  discordMessagesSourceSchema,
3767
4456
  discordReactionsSourceSchema,
@@ -3781,6 +4470,11 @@ export {
3781
4470
  trackerDataPathTypes,
3782
4471
  schemaCheckedReader,
3783
4472
  whereSchemaIssue,
4473
+ telegramReactionsNamespace,
4474
+ telegramMessagesNamespace,
4475
+ youtubeShortsNamespace,
4476
+ tiktokVideosNamespace,
4477
+ walletBalancesNamespace,
3784
4478
  xTweetSchema,
3785
4479
  xContentBodySchema,
3786
4480
  trackerContentQuerySchema,
@@ -3798,6 +4492,7 @@ export {
3798
4492
  contentMetricNameSchema,
3799
4493
  xContentMetrics,
3800
4494
  customContentSchema,
4495
+ walletBalanceSourceSchema,
3801
4496
  xSearchSourceSchema,
3802
4497
  customSourceSchema,
3803
4498
  trackerSourceSchema,
@@ -3811,8 +4506,12 @@ export {
3811
4506
  trackerDefinitionResponseSchema,
3812
4507
  publishedTrackerSchema,
3813
4508
  trackerStatusSchema,
4509
+ managedTrackerSourceSchema,
4510
+ managedTrackerSourceKinds,
4511
+ managedTrackerSource,
3814
4512
  trackerPropertiesSchema,
3815
4513
  trackerCreateSchema,
4514
+ managedTrackerCreateSchema,
3816
4515
  trackerUpdateSchema,
3817
4516
  trackerControlSchema,
3818
4517
  trackerAccountSchema,
@@ -3893,12 +4592,31 @@ export {
3893
4592
  completionPolicySchema,
3894
4593
  completionKeySchema,
3895
4594
  budgetSchema,
4595
+ authorBudgetSchema,
3896
4596
  memberCompletionSchema,
3897
4597
  maxMemberCompletions,
3898
4598
  evaluatorIntegrationProviderSchema,
3899
4599
  integrationProviderSchema,
3900
4600
  discordServerSchema,
3901
4601
  projectIntegrationSchema,
4602
+ announcementPlaceholders,
4603
+ parseAnnouncementTemplate,
4604
+ telegramSignInMethodsSchema,
4605
+ telegramAccountConnectionSchema,
4606
+ telegramInitDataSchema,
4607
+ telegramMiniAppSignInSchema,
4608
+ telegramChatIdSchema,
4609
+ telegramChatSchema,
4610
+ telegramChatsSchema,
4611
+ telegramChatConnectionSchema,
4612
+ telegramMemberInputSchema,
4613
+ telegramChatMemberSchema,
4614
+ telegramReactionDataSchema,
4615
+ telegramMessageDataSchema,
4616
+ announcementTextSchema,
4617
+ telegramAnnouncementSchema,
4618
+ discordAnnouncementSchema,
4619
+ announcementSchema,
3902
4620
  solanaAddressSchema,
3903
4621
  walletChainSchema,
3904
4622
  cosmosNetworkSchema,
@@ -3922,6 +4640,26 @@ export {
3922
4640
  isEvmChainId,
3923
4641
  evmChainIdSchema,
3924
4642
  walletBalanceSchema,
4643
+ walletBalanceSampleSchema,
4644
+ parseNftCollection,
4645
+ isNftCollection,
4646
+ walletNftsSchema,
4647
+ parseContractFunction,
4648
+ parseContractCall,
4649
+ isContractCall,
4650
+ walletCallSchema,
4651
+ walletDelegationsSchema,
4652
+ parseContractEvent,
4653
+ isContractEvent,
4654
+ maxWalletEventLogs,
4655
+ maxWalletEventLookback,
4656
+ walletEventsSchema,
4657
+ isSolanaProgram,
4658
+ anchorIdlSchema,
4659
+ solanaProgramIdlSchema,
4660
+ maxWalletTransactions,
4661
+ maxWalletTransactionLookback,
4662
+ walletTransactionsSchema,
3925
4663
  textOptionsSchema,
3926
4664
  urlOptionsSchema,
3927
4665
  textEvidenceSchema,
@@ -3969,6 +4707,7 @@ export {
3969
4707
  updateGroupSchema,
3970
4708
  addGroupMemberSchema,
3971
4709
  removeGroupMemberSchema,
4710
+ groupArchiveInputSchema,
3972
4711
  groupPageQuerySchema,
3973
4712
  managedGroupSchema,
3974
4713
  groupPageSchema,
@@ -4055,6 +4794,7 @@ export {
4055
4794
  evidenceSchema,
4056
4795
  errorSchema,
4057
4796
  staffDecisionSchema,
4797
+ acceptAnywaySchema,
4058
4798
  stockSchema,
4059
4799
  reservationSchema,
4060
4800
  reviewListSchema,