@domino-sdk/relay 1.0.0-next.13 → 1.0.0-next.15

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 (35) hide show
  1. package/README.md +1 -1
  2. package/dist/authoring.d.ts +58 -44
  3. package/dist/authoring.js +58 -45
  4. package/dist/browser.d.ts +111 -151
  5. package/dist/browser.js +6 -6
  6. package/dist/{catalog-C85V1NgW.d.ts → catalog-CVXUHxiO.d.ts} +12 -99
  7. package/dist/{chunk-M64XHC42.js → chunk-76F4LSFP.js} +2 -2
  8. package/dist/{chunk-II7DRZSL.js → chunk-CYD6QMHU.js} +1 -1
  9. package/dist/{chunk-KS33GOUL.js → chunk-EJWDAF7I.js} +4 -4
  10. package/dist/chunk-FJ6O44NE.js +51 -0
  11. package/dist/{chunk-WQ24ILGO.js → chunk-G3YSBMJH.js} +7 -3
  12. package/dist/{chunk-MNQI35OG.js → chunk-HWRBLM7E.js} +3 -3
  13. package/dist/{chunk-CRNQP7NV.js → chunk-J4OYDYJE.js} +693 -676
  14. package/dist/{chunk-OA2KMQVZ.js → chunk-J52HD4AA.js} +11 -1
  15. package/dist/{chunk-EZWNGI5B.js → chunk-RCBJBFLC.js} +4 -4
  16. package/dist/{chunk-FXYJ4OMX.js → chunk-WMTROSYF.js} +1 -1
  17. package/dist/{client-Bf9PNUIi.d.ts → client-dfXT6hhq.d.ts} +7 -47
  18. package/dist/{deployments-CNCP0JnD.d.ts → deployments-C9wkQ06n.d.ts} +109 -125
  19. package/dist/{images-BG4pdO4y.d.ts → images-CRxHUuG5.d.ts} +1 -1
  20. package/dist/index.d.ts +3 -3
  21. package/dist/index.js +5 -5
  22. package/dist/{integrations-EjQzIApL.d.ts → integrations-C1vB6Ry6.d.ts} +93 -1
  23. package/dist/internal.d.ts +13 -4
  24. package/dist/internal.js +10 -4
  25. package/dist/portal-proxy.js +2 -2
  26. package/dist/react/index.d.ts +441 -655
  27. package/dist/react/index.js +1190 -810
  28. package/dist/{schema-BF_TQsmT.d.ts → schema-C4F2K9cm.d.ts} +9 -74
  29. package/dist/schema.d.ts +6 -7
  30. package/dist/schema.js +18 -16
  31. package/dist/server/index.d.ts +125 -233
  32. package/dist/server/index.js +16 -22
  33. package/dist/{trackers-W7nRdRr7.d.ts → trackers-7lxSWp2g.d.ts} +56 -14
  34. package/package.json +4 -2
  35. package/dist/observations-CQ6IcNuQ.d.ts +0 -90
@@ -34,19 +34,63 @@ var pageQuerySchema = z3.strictObject({
34
34
  cursor: pageCursorSchema.optional()
35
35
  });
36
36
 
37
- // src/tracker-data.ts
37
+ // src/discord.ts
38
38
  import { z as z4 } from "zod";
39
+ var discordMessageSchema = z4.object({
40
+ guildId: z4.string(),
41
+ channelId: z4.string(),
42
+ messageId: z4.string(),
43
+ userId: z4.string(),
44
+ content: z4.string().nullable(),
45
+ replyTo: z4.string().nullable(),
46
+ publishedAt: z4.number()
47
+ }).strict();
48
+ var discordMessagesSourceSchema = z4.strictObject({
49
+ kind: z4.literal("discord-messages"),
50
+ /** Store each message's text in `data.text`. Off unless set. */
51
+ text: z4.boolean().optional()
52
+ });
53
+ var discordReactionsSourceSchema = z4.strictObject({
54
+ kind: z4.literal("discord-reactions")
55
+ });
56
+ var discordMessageDataSchema = z4.object({
57
+ guildId: z4.string(),
58
+ channelId: z4.string(),
59
+ messageId: z4.string(),
60
+ /** The ID of the message this one replies to, or null. */
61
+ replyTo: z4.string().nullable(),
62
+ /** When Discord says the message was posted, in epoch milliseconds. */
63
+ publishedAt: z4.number()
64
+ });
65
+ var discordMessageTextDataSchema = discordMessageDataSchema.extend({
66
+ text: z4.string().nullable()
67
+ });
68
+ var discordReactionDataSchema = z4.object({
69
+ guildId: z4.string(),
70
+ channelId: z4.string(),
71
+ /** The message reacted to. */
72
+ messageId: z4.string(),
73
+ /** A custom emoji's ID, or null for a Unicode emoji, whose `name` is the emoji itself. */
74
+ emoji: z4.object({ id: z4.string().nullable(), name: z4.string() }),
75
+ /** The role IDs the reactor held in the server when reacting. */
76
+ reactorRoles: z4.array(z4.string()),
77
+ /** When the reacted-to message was posted, in epoch milliseconds. */
78
+ messagePublishedAt: z4.number()
79
+ });
80
+
81
+ // src/tracker-data.ts
82
+ import { z as z5 } from "zod";
39
83
  var maxDepth = 16;
40
84
  var maxBytes = 32768;
41
85
  var trackerDataMaxBranches = 16;
42
86
  var trackerDataMaxEntries = 256;
43
- var scalar = z4.union([z4.string(), z4.number().finite(), z4.boolean(), z4.null()]);
44
- var size = z4.number().int().safe().nonnegative();
45
- var bound = z4.number().finite();
46
- var branches = () => z4.array(node).min(1).max(trackerDataMaxBranches);
47
- var node = z4.lazy(
48
- () => z4.strictObject({
49
- type: z4.enum([
87
+ var scalar = z5.union([z5.string(), z5.number().finite(), z5.boolean(), z5.null()]);
88
+ var size = z5.number().int().safe().nonnegative();
89
+ var bound = z5.number().finite();
90
+ var branches = () => z5.array(node).min(1).max(trackerDataMaxBranches);
91
+ var node = z5.lazy(
92
+ () => z5.strictObject({
93
+ type: z5.enum([
50
94
  "object",
51
95
  "array",
52
96
  "string",
@@ -55,15 +99,15 @@ var node = z4.lazy(
55
99
  "boolean",
56
100
  "null"
57
101
  ]).optional(),
58
- properties: z4.record(z4.string(), node).refine(
102
+ properties: z5.record(z5.string(), node).refine(
59
103
  (properties) => Object.keys(properties).length <= trackerDataMaxEntries,
60
104
  `An object schema lists at most ${trackerDataMaxEntries} properties`
61
105
  ).optional(),
62
- required: z4.array(z4.string()).max(trackerDataMaxEntries).optional(),
63
- additionalProperties: z4.union([z4.boolean(), node]).optional(),
64
- propertyNames: z4.strictObject({
65
- type: z4.literal("string"),
66
- enum: z4.array(z4.string()).max(trackerDataMaxEntries).optional()
106
+ required: z5.array(z5.string()).max(trackerDataMaxEntries).optional(),
107
+ additionalProperties: z5.union([z5.boolean(), node]).optional(),
108
+ propertyNames: z5.strictObject({
109
+ type: z5.literal("string"),
110
+ enum: z5.array(z5.string()).max(trackerDataMaxEntries).optional()
67
111
  }).optional(),
68
112
  items: node.optional(),
69
113
  minItems: size.optional(),
@@ -74,7 +118,7 @@ var node = z4.lazy(
74
118
  maximum: bound.optional(),
75
119
  exclusiveMinimum: bound.optional(),
76
120
  exclusiveMaximum: bound.optional(),
77
- enum: z4.array(scalar).min(1).max(trackerDataMaxEntries).optional(),
121
+ enum: z5.array(scalar).min(1).max(trackerDataMaxEntries).optional(),
78
122
  const: scalar.optional(),
79
123
  anyOf: branches().optional(),
80
124
  oneOf: branches().optional(),
@@ -136,7 +180,7 @@ function nestedUnionIssue(schema, path, insideUnion) {
136
180
  }
137
181
  return null;
138
182
  }
139
- var trackerDataSchemaSchema = z4.unknown().superRefine((value, ctx) => {
183
+ var trackerDataSchemaSchema = z5.unknown().superRefine((value, ctx) => {
140
184
  const issue = shapeIssue(value);
141
185
  if (issue) {
142
186
  ctx.addIssue({ code: "custom", message: issue, abort: true });
@@ -243,7 +287,7 @@ function subset(schema, path) {
243
287
  function trackerDataSchema(schema) {
244
288
  let json;
245
289
  try {
246
- json = z4.toJSONSchema(schema, {
290
+ json = z5.toJSONSchema(schema, {
247
291
  target: "draft-2020-12",
248
292
  io: "input",
249
293
  unrepresentable: "throw",
@@ -611,21 +655,21 @@ function whereSchemaIssue(schema, where) {
611
655
  }
612
656
 
613
657
  // src/trackers.ts
614
- import { z as z5 } from "zod";
615
- var timestamp = z5.number().int().safe().nonnegative().max(864e13);
616
- var count = z5.number().int().safe().nonnegative();
617
- var externalId = z5.string().min(1).max(256);
658
+ import { z as z6 } from "zod";
659
+ var timestamp = z6.number().int().safe().nonnegative().max(864e13);
660
+ var count = z6.number().int().safe().nonnegative();
661
+ var externalId = z6.string().min(1).max(256);
618
662
  var metric = count.nullable().default(null);
619
- var xTweetSchema = z5.looseObject({
663
+ var xTweetSchema = z6.looseObject({
620
664
  id: externalId,
621
665
  userId: externalId,
622
- content: z5.string(),
623
- createdAt: z5.iso.datetime({ offset: true }),
624
- author: z5.looseObject({
666
+ content: z6.string(),
667
+ createdAt: z6.iso.datetime({ offset: true }),
668
+ author: z6.looseObject({
625
669
  id: externalId,
626
- username: z5.string(),
627
- name: z5.string(),
628
- verified: z5.boolean().nullable().default(null)
670
+ username: z6.string(),
671
+ name: z6.string(),
672
+ verified: z6.boolean().nullable().default(null)
629
673
  }),
630
674
  likeCount: metric,
631
675
  replyCount: metric,
@@ -633,90 +677,90 @@ var xTweetSchema = z5.looseObject({
633
677
  quoteCount: metric,
634
678
  viewCount: metric,
635
679
  bookmarkCount: metric,
636
- isReply: z5.boolean(),
637
- isRetweet: z5.boolean(),
638
- isQuoteTweet: z5.boolean()
639
- });
640
- var xContentBodySchema = z5.strictObject({
641
- version: z5.literal(1),
642
- id: z5.string().min(1),
643
- authorId: z5.string().min(1),
680
+ isReply: z6.boolean(),
681
+ isRetweet: z6.boolean(),
682
+ isQuoteTweet: z6.boolean()
683
+ });
684
+ var xContentBodySchema = z6.strictObject({
685
+ version: z6.literal(1),
686
+ id: z6.string().min(1),
687
+ authorId: z6.string().min(1),
644
688
  publishedAt: timestamp,
645
- text: z5.string(),
646
- isReply: z5.boolean(),
647
- isRetweet: z5.boolean(),
648
- isQuoteTweet: z5.boolean(),
649
- media: z5.array(z5.strictObject({ type: z5.string(), url: z5.string() })).nullable(),
650
- mentionedAuthorIds: z5.array(z5.string().min(1)).nullable(),
651
- videoLengthSeconds: z5.number().nonnegative().nullable(),
652
- references: z5.strictObject({
653
- replyId: z5.string().nullable(),
654
- replyAuthorId: z5.string().nullable(),
655
- quoteId: z5.string().nullable(),
656
- quoteAuthorId: z5.string().nullable(),
657
- repostId: z5.string().nullable(),
658
- repostAuthorId: z5.string().nullable()
689
+ text: z6.string(),
690
+ isReply: z6.boolean(),
691
+ isRetweet: z6.boolean(),
692
+ isQuoteTweet: z6.boolean(),
693
+ media: z6.array(z6.strictObject({ type: z6.string(), url: z6.string() })).nullable(),
694
+ mentionedAuthorIds: z6.array(z6.string().min(1)).nullable(),
695
+ videoLengthSeconds: z6.number().nonnegative().nullable(),
696
+ references: z6.strictObject({
697
+ replyId: z6.string().nullable(),
698
+ replyAuthorId: z6.string().nullable(),
699
+ quoteId: z6.string().nullable(),
700
+ quoteAuthorId: z6.string().nullable(),
701
+ repostId: z6.string().nullable(),
702
+ repostAuthorId: z6.string().nullable()
659
703
  })
660
704
  });
661
- var trackerContentQuerySchema = z5.strictObject({
705
+ var trackerContentQuerySchema = z6.strictObject({
662
706
  id: externalId,
663
- observation: z5.string().regex(/^observation_[a-f0-9]{64}$/)
707
+ observation: z6.string().regex(/^observation_[a-f0-9]{64}$/)
664
708
  });
665
709
  var trackerContentReadSchema = trackerContentQuerySchema.extend({
666
710
  member: identifier
667
711
  });
668
712
  var attributionContext = { member: identifier, capturedAt: timestamp };
669
- var trackerEvidenceSchema = z5.strictObject({
713
+ var trackerEvidenceSchema = z6.strictObject({
670
714
  contentRevision: identifier,
671
715
  observation: identifier
672
716
  });
673
- var trackerContentSchema = z5.strictObject({
717
+ var trackerContentSchema = z6.strictObject({
674
718
  tracker: identifier,
675
- source: z5.literal("x"),
719
+ source: z6.literal("x"),
676
720
  evidence: trackerEvidenceSchema,
677
721
  content: xContentBodySchema,
678
722
  observedAt: timestamp,
679
- removed: z5.boolean(),
680
- attribution: z5.discriminatedUnion("kind", [
681
- z5.strictObject({
723
+ removed: z6.boolean(),
724
+ attribution: z6.discriminatedUnion("kind", [
725
+ z6.strictObject({
682
726
  ...attributionContext,
683
- kind: z5.literal("linked"),
684
- account: z5.strictObject({
685
- provider: z5.literal("x"),
686
- issuer: z5.string().min(1),
727
+ kind: z6.literal("linked"),
728
+ account: z6.strictObject({
729
+ provider: z6.literal("x"),
730
+ issuer: z6.string().min(1),
687
731
  subject: externalId,
688
732
  revision: count,
689
733
  linkedAt: timestamp.nullable()
690
734
  })
691
735
  }),
692
- z5.strictObject({ ...attributionContext, kind: z5.literal("unlinked") }),
693
- z5.strictObject({
736
+ z6.strictObject({ ...attributionContext, kind: z6.literal("unlinked") }),
737
+ z6.strictObject({
694
738
  ...attributionContext,
695
- kind: z5.literal("different-author")
739
+ kind: z6.literal("different-author")
696
740
  })
697
741
  ])
698
742
  });
699
- var identityKindSchema = z5.enum(["wallet", "x", "discord", "member"]);
700
- var accountRoleSchema = z5.string().regex(
743
+ var identityKindSchema = z6.enum(["wallet", "x", "discord", "member"]);
744
+ var accountRoleSchema = z6.string().regex(
701
745
  /^[a-zA-Z][a-zA-Z0-9_]{0,39}$/,
702
746
  "Name roles like author or recipient: a letter, then letters, digits or underscores"
703
747
  );
704
748
  var xAccountRoles = ["author", "inReplyTo"];
705
749
  var distinct = (values) => new Set(values).size === values.length;
706
- var xSearchSourceSchema = z5.object({
707
- kind: z5.literal("x-search"),
708
- query: z5.string().trim().min(1).max(2e3)
750
+ var xSearchSourceSchema = z6.object({
751
+ kind: z6.literal("x-search"),
752
+ query: z6.string().trim().min(1).max(2e3)
709
753
  }).strict();
710
- var customSourceSchema = z5.object({
711
- kind: z5.literal("custom"),
754
+ var customSourceSchema = z6.object({
755
+ kind: z6.literal("custom"),
712
756
  namespace: identifier,
713
757
  /**
714
758
  * The identity kinds a record's author and named accounts can be, attributed to members
715
759
  * through verified links. Omitted when authors are opaque IDs, which no quest can pay.
716
760
  */
717
- identities: z5.array(identityKindSchema).min(1).max(4).refine(distinct, "List each identity kind once").optional(),
761
+ identities: z6.array(identityKindSchema).min(1).max(4).refine(distinct, "List each identity kind once").optional(),
718
762
  /** Roles of the named accounts records can carry besides their author, such as `recipient`. */
719
- accounts: z5.array(accountRoleSchema).min(1).max(10).refine(distinct, "List each account role once").refine(
763
+ accounts: z6.array(accountRoleSchema).min(1).max(10).refine(distinct, "List each account role once").refine(
720
764
  (roles) => !roles.includes("author"),
721
765
  "author is every record's own role; name other accounts"
722
766
  ).optional(),
@@ -726,7 +770,7 @@ var customSourceSchema = z5.object({
726
770
  *
727
771
  * @deprecated Use `identities: ["wallet"]`.
728
772
  */
729
- authors: z5.literal("wallet").optional(),
773
+ authors: z6.literal("wallet").optional(),
730
774
  /**
731
775
  * The schema every record's `data` matches, which ingestion enforces. `customSource()`
732
776
  * requires it. Trackers published before typed data have none, and take no records until
@@ -740,93 +784,106 @@ var customSourceSchema = z5.object({
740
784
  (source) => !source.accounts || source.identities,
741
785
  "Named accounts need identities"
742
786
  );
743
- var trackerSourceSchema = z5.discriminatedUnion("kind", [
787
+ var trackerSourceSchema = z6.discriminatedUnion("kind", [
744
788
  xSearchSourceSchema,
745
- customSourceSchema
789
+ customSourceSchema,
790
+ discordMessagesSourceSchema,
791
+ discordReactionsSourceSchema
746
792
  ]);
793
+ var trackerSourceKinds = [
794
+ "x-search",
795
+ "custom",
796
+ "discord-messages",
797
+ "discord-reactions"
798
+ ];
747
799
  function sourceIdentities(source) {
748
- if (source.kind === "x-search") {
749
- return ["x"];
800
+ switch (source.kind) {
801
+ case "x-search":
802
+ return ["x"];
803
+ case "discord-messages":
804
+ case "discord-reactions":
805
+ return ["discord"];
806
+ case "custom":
807
+ return source.identities ?? (source.authors === "wallet" ? ["wallet"] : void 0);
750
808
  }
751
- return source.identities ?? (source.authors === "wallet" ? ["wallet"] : void 0);
752
809
  }
753
- var windowSchema = z5.object({ start: timestamp, end: timestamp.optional() }).strict().refine(
810
+ var windowSchema = z6.object({ start: timestamp, end: timestamp.optional() }).strict().refine(
754
811
  (w) => w.end === void 0 || w.end > w.start,
755
812
  "End must follow start"
756
813
  );
757
- var trackerDefinitionSchema = z5.object({
814
+ var trackerDefinitionSchema = z6.object({
758
815
  key: identifier,
759
- title: z5.string().trim().min(1).max(120),
816
+ title: z6.string().trim().min(1).max(120),
760
817
  source: trackerSourceSchema,
761
818
  window: windowSchema,
762
- refreshSeconds: z5.number().int().min(300).max(86400).default(21600),
763
- maxPages: z5.number().int().min(1).max(1e3).default(60)
819
+ refreshSeconds: z6.number().int().min(300).max(86400).default(21600),
820
+ maxPages: z6.number().int().min(1).max(1e3).default(60)
764
821
  }).strict();
765
- var trackerArtifactSchema = z5.union([
822
+ var trackerArtifactSchema = z6.union([
766
823
  trackerDefinitionSchema,
767
- z5.object({ code: z5.string().min(1).max(2e6) }).strict()
824
+ z6.object({ code: z6.string().min(1).max(2e6) }).strict()
768
825
  ]);
769
- var publishedTrackerSchema = z5.object({
826
+ var publishedTrackerSchema = z6.object({
770
827
  id: identifier,
771
828
  version: identifier,
772
829
  definition: trackerDefinitionSchema,
773
830
  publishedAt: timestamp,
774
- actor: z5.string().nullable()
831
+ actor: z6.string().nullable()
775
832
  });
776
- var trackerStatusSchema = z5.object({
833
+ var trackerStatusSchema = z6.object({
777
834
  published: publishedTrackerSchema,
778
- paused: z5.boolean(),
779
- state: z5.enum(["idle", "syncing", "error", "complete"]),
835
+ paused: z6.boolean(),
836
+ state: z6.enum(["idle", "syncing", "error", "complete"]),
780
837
  lastStartedAt: timestamp.nullable(),
781
838
  lastCompletedAt: timestamp.nullable(),
782
839
  nextSyncAt: timestamp.nullable(),
783
- coverage: z5.enum(["unknown", "partial", "complete"]),
784
- error: z5.string().nullable(),
840
+ coverage: z6.enum(["unknown", "partial", "complete"]),
841
+ error: z6.string().nullable(),
785
842
  records: count
786
843
  });
787
- var trackerControlSchema = z5.object({
844
+ var trackerControlSchema = z6.object({
788
845
  actionId: identifier,
789
- action: z5.enum(["pause", "resume", "refresh"])
846
+ action: z6.enum(["pause", "resume", "refresh"])
790
847
  }).strict();
791
- var trackerAccountSchema = z5.strictObject({
848
+ var trackerAccountSchema = z6.strictObject({
792
849
  kind: identityKindSchema.optional(),
793
850
  id: externalId
794
851
  });
795
- var trackerRecordInputSchema = z5.object({
852
+ var trackerRecordInputSchema = z6.object({
796
853
  id: externalId,
797
854
  occurredAt: timestamp,
798
855
  observedAt: timestamp,
799
- author: z5.object({
856
+ author: z6.object({
800
857
  id: externalId,
801
- verified: z5.boolean().nullable().default(null),
858
+ verified: z6.boolean().nullable().default(null),
802
859
  /** The author's identity kind; needed when the source names more than one. */
803
860
  kind: identityKindSchema.optional()
804
861
  }).strict().nullable().default(null),
805
862
  /** Named accounts besides the author, by the roles the custom source declares. */
806
- accounts: z5.record(accountRoleSchema, trackerAccountSchema).refine(
863
+ accounts: z6.record(accountRoleSchema, trackerAccountSchema).refine(
807
864
  (accounts) => Object.keys(accounts).length <= 10,
808
865
  "At most 10 accounts"
809
866
  ).optional(),
810
- data: z5.record(z5.string(), z5.json()),
811
- removed: z5.boolean().default(false)
867
+ data: z6.record(z6.string(), z6.json()),
868
+ removed: z6.boolean().default(false)
812
869
  }).strict().refine(
813
870
  (v) => new TextEncoder().encode(JSON.stringify(v.data)).byteLength <= 131072,
814
871
  "Record exceeds 128 KB"
815
872
  );
816
873
  var trackerRecordSchema = trackerRecordInputSchema.safeExtend({
817
- source: z5.string(),
874
+ source: z6.string(),
818
875
  firstSeenAt: timestamp,
819
876
  /** Present only when includeEvidence is true; custom sources have no X evidence. */
820
877
  evidence: trackerEvidenceSchema.nullable().optional()
821
878
  });
822
- var trackerIngestSchema = z5.object({
879
+ var trackerIngestSchema = z6.object({
823
880
  actionId: identifier,
824
- records: z5.array(trackerRecordInputSchema).min(1).max(100)
881
+ records: z6.array(trackerRecordInputSchema).min(1).max(100)
825
882
  }).strict();
826
- var trackerIngestResultSchema = z5.object({
883
+ var trackerIngestResultSchema = z6.object({
827
884
  stored: count,
828
885
  /** Tracker-trigger decisions this ingest caused. Absent from servers without tracker triggers. */
829
- admissions: z5.object({
886
+ admissions: z6.object({
830
887
  admitted: count,
831
888
  skipped: count,
832
889
  /**
@@ -847,11 +904,11 @@ var trackerOutcomeFields = {
847
904
  /** The release admitted, or the one active when the observation was skipped. */
848
905
  release: identifier,
849
906
  /** The account attribution resolved or failed to resolve, such as a CAIP-10 wallet ID. */
850
- account: z5.string().nullable(),
907
+ account: z6.string().nullable(),
851
908
  createdAt: timestamp,
852
909
  updatedAt: timestamp,
853
910
  /** Null for automatic decisions; the staff actor after a retry. */
854
- actor: z5.string().nullable()
911
+ actor: z6.string().nullable()
855
912
  };
856
913
  var trackerSkipCodes = [
857
914
  /** The quest is paused or no longer active. */
@@ -884,84 +941,84 @@ var trackerSkipCodes = [
884
941
  /** The attributed member has not completed the quest's prerequisites. */
885
942
  "prerequisites-incomplete"
886
943
  ];
887
- var trackerOutcomeSchema = z5.discriminatedUnion("state", [
888
- z5.strictObject({
944
+ var trackerOutcomeSchema = z6.discriminatedUnion("state", [
945
+ z6.strictObject({
889
946
  ...trackerOutcomeFields,
890
- state: z5.literal("admitted"),
891
- code: z5.null(),
892
- reason: z5.null(),
947
+ state: z6.literal("admitted"),
948
+ code: z6.null(),
949
+ reason: z6.null(),
893
950
  /** The attributed member. */
894
951
  member: identifier,
895
952
  /** The admitted attempt. Its evaluation, decision and rewards live on the attempt. */
896
953
  attempt: identifier
897
954
  }),
898
- z5.strictObject({
955
+ z6.strictObject({
899
956
  ...trackerOutcomeFields,
900
- state: z5.literal("skipped"),
957
+ state: z6.literal("skipped"),
901
958
  /** Why the observation was skipped, as one of `trackerSkipCodes`. */
902
- code: z5.string().min(1),
959
+ code: z6.string().min(1),
903
960
  /** Why the observation was skipped, for people. */
904
- reason: z5.string(),
961
+ reason: z6.string(),
905
962
  /** The attributed member, when attribution got that far. */
906
963
  member: identifier.nullable(),
907
964
  attempt: identifier.nullable()
908
965
  })
909
966
  ]);
910
- var trackerOutcomeQuerySchema = z5.strictObject({
967
+ var trackerOutcomeQuerySchema = z6.strictObject({
911
968
  /** Quest key or ID. */
912
969
  quest: identifier.optional(),
913
970
  record: externalId.optional(),
914
971
  member: identifier.optional(),
915
- state: z5.enum(["admitted", "skipped"]).optional(),
972
+ state: z6.enum(["admitted", "skipped"]).optional(),
916
973
  /** Only skips with this code, such as `unlinked-account`. */
917
- code: z5.string().min(1).max(100).optional(),
918
- limit: z5.coerce.number().int().min(1).max(100).default(25),
974
+ code: z6.string().min(1).max(100).optional(),
975
+ limit: z6.coerce.number().int().min(1).max(100).default(25),
919
976
  /** Opaque cursor from `next`: older outcomes. */
920
- before: z5.string().max(512).optional()
977
+ before: z6.string().max(512).optional()
921
978
  });
922
- var trackerOutcomePageSchema = z5.strictObject({
979
+ var trackerOutcomePageSchema = z6.strictObject({
923
980
  /** Newest first. */
924
- items: z5.array(trackerOutcomeSchema).max(100),
925
- next: z5.string().nullable()
981
+ items: z6.array(trackerOutcomeSchema).max(100),
982
+ next: z6.string().nullable()
926
983
  });
927
- var trackerOutcomeRetrySchema = z5.strictObject({
984
+ var trackerOutcomeRetrySchema = z6.strictObject({
928
985
  actionId: identifier,
929
986
  /** Quest key or ID. */
930
987
  quest: identifier,
931
988
  record: externalId,
932
989
  observedAt: timestamp
933
990
  });
934
- var booleanQuery = z5.union([
935
- z5.boolean(),
936
- z5.enum(["true", "false"]).transform((v) => v === "true")
991
+ var booleanQuery = z6.union([
992
+ z6.boolean(),
993
+ z6.enum(["true", "false"]).transform((v) => v === "true")
937
994
  ]);
938
- var trackerQuerySchema = z5.object({
995
+ var trackerQuerySchema = z6.object({
939
996
  author: externalId.optional(),
940
997
  member: identifier.optional(),
941
998
  verified: booleanQuery.optional(),
942
- since: z5.coerce.number().int().safe().nonnegative().optional(),
943
- until: z5.coerce.number().int().safe().nonnegative().optional(),
999
+ since: z6.coerce.number().int().safe().nonnegative().optional(),
1000
+ until: z6.coerce.number().int().safe().nonnegative().optional(),
944
1001
  removed: booleanQuery.default(false),
945
- minLikes: z5.coerce.number().int().safe().nonnegative().optional(),
946
- minViews: z5.coerce.number().int().safe().nonnegative().optional(),
947
- limit: z5.coerce.number().int().min(1).max(100).default(25),
948
- cursor: z5.string().max(2048).optional(),
1002
+ minLikes: z6.coerce.number().int().safe().nonnegative().optional(),
1003
+ minViews: z6.coerce.number().int().safe().nonnegative().optional(),
1004
+ limit: z6.coerce.number().int().min(1).max(100).default(25),
1005
+ cursor: z6.string().max(2048).optional(),
949
1006
  includeEvidence: booleanQuery.optional()
950
1007
  }).strict().refine(
951
1008
  (q) => q.since === void 0 || q.until === void 0 || q.until > q.since,
952
1009
  "Until must follow since"
953
1010
  );
954
- var trackerPageSchema = z5.object({
1011
+ var trackerPageSchema = z6.object({
955
1012
  tracker: identifier,
956
- items: z5.array(trackerRecordSchema),
957
- nextCursor: z5.string().nullable(),
1013
+ items: z6.array(trackerRecordSchema),
1014
+ nextCursor: z6.string().nullable(),
958
1015
  total: count,
959
1016
  status: trackerStatusSchema
960
1017
  });
961
- var trackerSummarySchema = z5.object({
1018
+ var trackerSummarySchema = z6.object({
962
1019
  records: count,
963
1020
  authors: count,
964
- metrics: z5.object({
1021
+ metrics: z6.object({
965
1022
  likes: count,
966
1023
  replies: count,
967
1024
  reposts: count,
@@ -977,31 +1034,31 @@ var trackerPreviewLimits = {
977
1034
  posts: 100,
978
1035
  days: 30
979
1036
  };
980
- var trackerPreviewInputSchema = z5.object({
1037
+ var trackerPreviewInputSchema = z6.object({
981
1038
  query: xSearchSourceSchema.shape.query,
982
1039
  /** Start of the searched window. The window ends when the sample is fetched. */
983
1040
  since: timestamp
984
1041
  }).strict();
985
- var trackerPreviewSchema = z5.object({
986
- query: z5.string(),
1042
+ var trackerPreviewSchema = z6.object({
1043
+ query: z6.string(),
987
1044
  since: timestamp,
988
1045
  fetchedAt: timestamp,
989
1046
  pages: count,
990
1047
  /** Every match in the sample, newest first, verified or not. */
991
- posts: z5.array(xTweetSchema).max(trackerPreviewLimits.posts),
1048
+ posts: z6.array(xTweetSchema).max(trackerPreviewLimits.posts),
992
1049
  /** X had more matches than the sample holds. */
993
- more: z5.boolean()
1050
+ more: z6.boolean()
994
1051
  });
995
1052
 
996
1053
  // src/content.ts
997
- import { z as z6 } from "zod";
998
- var timestamp2 = z6.number().int().safe().nonnegative().max(864e13);
999
- var contentPolicySchema = z6.strictObject({
1054
+ import { z as z7 } from "zod";
1055
+ var timestamp2 = z7.number().int().safe().nonnegative().max(864e13);
1056
+ var contentPolicySchema = z7.strictObject({
1000
1057
  tracker: identifier,
1001
1058
  window: trackerDefinitionSchema.shape.window,
1002
- enrollment: z6.enum(["none", "required"]).default("none"),
1003
- posts: z6.enum(["after-enrollment", "since-start"]).default("after-enrollment"),
1004
- historical: z6.enum(["automatic", "claim", "staff"]).default("claim")
1059
+ enrollment: z7.enum(["none", "required"]).default("none"),
1060
+ posts: z7.enum(["after-enrollment", "since-start"]).default("after-enrollment"),
1061
+ historical: z7.enum(["automatic", "claim", "staff"]).default("claim")
1005
1062
  });
1006
1063
  var admittedContentSchema = xContentBodySchema.extend({
1007
1064
  tracker: identifier,
@@ -1009,59 +1066,59 @@ var admittedContentSchema = xContentBodySchema.extend({
1009
1066
  observation: identifier,
1010
1067
  attribution: trackerContentSchema.shape.attribution.options[0],
1011
1068
  enrolledAt: timestamp2.nullable(),
1012
- completionKey: z6.string().min(1).max(200)
1069
+ completionKey: z7.string().min(1).max(200)
1013
1070
  });
1014
- var contentEnrollmentInputSchema = z6.strictObject({
1071
+ var contentEnrollmentInputSchema = z7.strictObject({
1015
1072
  actionId: identifier,
1016
1073
  quest: identifier,
1017
1074
  member: identifier
1018
1075
  });
1019
- var contentEnrollmentSchema = z6.strictObject({
1076
+ var contentEnrollmentSchema = z7.strictObject({
1020
1077
  quest: identifier,
1021
1078
  member: identifier,
1022
1079
  enrolledAt: timestamp2
1023
1080
  });
1024
1081
  var contentReleaseInputSchema = contentEnrollmentInputSchema.extend({
1025
- content: z6.string().min(1).max(256)
1082
+ content: z7.string().min(1).max(256)
1026
1083
  });
1027
- var contentAdmissionSchema = z6.strictObject({
1084
+ var contentAdmissionSchema = z7.strictObject({
1028
1085
  quest: identifier,
1029
- content: z6.string().min(1).max(256),
1086
+ content: z7.string().min(1).max(256),
1030
1087
  release: identifier,
1031
- state: z6.enum(["pending", "admitted", "excluded"]),
1032
- reason: z6.string().nullable(),
1088
+ state: z7.enum(["pending", "admitted", "excluded"]),
1089
+ reason: z7.string().nullable(),
1033
1090
  attempt: identifier.nullable()
1034
1091
  });
1035
- var contentAdmissionQuerySchema = z6.strictObject({
1092
+ var contentAdmissionQuerySchema = z7.strictObject({
1036
1093
  quest: identifier,
1037
1094
  member: identifier.optional(),
1038
- content: z6.string().min(1).max(256).optional(),
1095
+ content: z7.string().min(1).max(256).optional(),
1039
1096
  cursor: pageCursorSchema.optional()
1040
1097
  });
1041
- var contentAdmissionPageSchema = z6.strictObject({
1042
- items: z6.array(contentAdmissionSchema),
1098
+ var contentAdmissionPageSchema = z7.strictObject({
1099
+ items: z7.array(contentAdmissionSchema),
1043
1100
  nextCursor: pageCursorSchema.nullable()
1044
1101
  });
1045
- var contentQualificationDecisionSchema = z6.strictObject({
1046
- kind: z6.enum(["accept", "reject", "review", "superseded"]),
1047
- reason: z6.string().nullable()
1102
+ var contentQualificationDecisionSchema = z7.strictObject({
1103
+ kind: z7.enum(["accept", "reject", "review", "superseded"]),
1104
+ reason: z7.string().nullable()
1048
1105
  });
1049
- var contentQualificationQuerySchema = z6.strictObject({
1106
+ var contentQualificationQuerySchema = z7.strictObject({
1050
1107
  quest: identifier,
1051
1108
  member: identifier.optional(),
1052
- content: z6.string().min(1).max(256).optional(),
1109
+ content: z7.string().min(1).max(256).optional(),
1053
1110
  cursor: pageCursorSchema.optional()
1054
1111
  });
1055
- var contentQualificationSchema = z6.strictObject({
1112
+ var contentQualificationSchema = z7.strictObject({
1056
1113
  quest: identifier,
1057
- content: z6.string(),
1114
+ content: z7.string(),
1058
1115
  member: identifier,
1059
1116
  release: identifier,
1060
1117
  attempt: identifier,
1061
1118
  revision: identifier,
1062
1119
  observation: identifier,
1063
- current: z6.boolean(),
1064
- state: z6.enum([
1120
+ current: z7.boolean(),
1121
+ state: z7.enum([
1065
1122
  "pending",
1066
1123
  "qualified",
1067
1124
  "unqualified",
@@ -1072,18 +1129,18 @@ var contentQualificationSchema = z6.strictObject({
1072
1129
  "blocked",
1073
1130
  "unavailable"
1074
1131
  ]),
1075
- reason: z6.string().nullable(),
1076
- reward: z6.strictObject({
1132
+ reason: z7.string().nullable(),
1133
+ reward: z7.strictObject({
1077
1134
  attempt: identifier.nullable(),
1078
1135
  completion: identifier.nullable(),
1079
- state: z6.enum(["unresolved", "awarded", "excluded"])
1136
+ state: z7.enum(["unresolved", "awarded", "excluded"])
1080
1137
  })
1081
1138
  });
1082
- var contentQualificationPageSchema = z6.strictObject({
1083
- items: z6.array(contentQualificationSchema),
1139
+ var contentQualificationPageSchema = z7.strictObject({
1140
+ items: z7.array(contentQualificationSchema),
1084
1141
  nextCursor: pageCursorSchema.nullable()
1085
1142
  });
1086
- var contentMetricSchema = z6.enum([
1143
+ var contentMetricSchema = z7.enum([
1087
1144
  "likes",
1088
1145
  "replies",
1089
1146
  "reposts",
@@ -1091,21 +1148,21 @@ var contentMetricSchema = z6.enum([
1091
1148
  "views",
1092
1149
  "bookmarks"
1093
1150
  ]);
1094
- var contentMetricsSchema = z6.partialRecord(
1151
+ var contentMetricsSchema = z7.partialRecord(
1095
1152
  contentMetricSchema,
1096
- z6.number().int().safe().nonnegative()
1153
+ z7.number().int().safe().nonnegative()
1097
1154
  );
1098
- var contentPerformancePolicySchema = z6.strictObject({
1099
- metrics: z6.array(contentMetricSchema).min(1).max(6).refine(
1155
+ var contentPerformancePolicySchema = z7.strictObject({
1156
+ metrics: z7.array(contentMetricSchema).min(1).max(6).refine(
1100
1157
  (values) => new Set(values).size === values.length,
1101
1158
  "Metrics must be unique"
1102
1159
  ),
1103
- maxAgeMs: z6.number().int().positive().max(864e5).default(36e5)
1160
+ maxAgeMs: z7.number().int().positive().max(864e5).default(36e5)
1104
1161
  });
1105
1162
 
1106
1163
  // src/calendar.ts
1107
- import { z as z7 } from "zod";
1108
- var timestamp3 = z7.number().int().safe();
1164
+ import { z as z8 } from "zod";
1165
+ var timestamp3 = z8.number().int().safe();
1109
1166
  var fixedOffset = /^(?:[+-]|(?:Etc\/)?GMT[+-]\d|(?:EST|MST|HST)$)/i;
1110
1167
  function canonicalTimeZone(zone) {
1111
1168
  let resolved;
@@ -1121,18 +1178,18 @@ function canonicalTimeZone(zone) {
1121
1178
  }
1122
1179
  return fixedOffset.test(zone) || fixedOffset.test(resolved) ? null : resolved;
1123
1180
  }
1124
- var timeZoneSchema = z7.string().min(1).max(100).transform((zone, ctx) => {
1181
+ var timeZoneSchema = z8.string().min(1).max(100).transform((zone, ctx) => {
1125
1182
  const canonical = canonicalTimeZone(zone);
1126
1183
  if (canonical === null) {
1127
1184
  ctx.addIssue({
1128
1185
  code: "custom",
1129
1186
  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"
1130
1187
  });
1131
- return z7.NEVER;
1188
+ return z8.NEVER;
1132
1189
  }
1133
1190
  return canonical;
1134
1191
  });
1135
- var timeZoneNameSchema = z7.string().min(1).max(100);
1192
+ var timeZoneNameSchema = z8.string().min(1).max(100);
1136
1193
  var movedTimeZone = (what) => `${what} no longer take a timeZone: they follow the project calendar. Set calendar.timeZone in relay.json or in Console settings.`;
1137
1194
  var record = (value) => typeof value === "object" && value !== null;
1138
1195
  function refuseStreakTimeZone(value, ctx) {
@@ -1156,99 +1213,99 @@ function refuseWindowTimeZone(value, ctx) {
1156
1213
  }
1157
1214
  return value;
1158
1215
  }
1159
- var calendarPeriodSchema = z7.enum(["lifetime", "day", "week", "month"]);
1160
- var projectCalendarSchema = z7.object({
1216
+ var calendarPeriodSchema = z8.enum(["lifetime", "day", "week", "month"]);
1217
+ var projectCalendarSchema = z8.object({
1161
1218
  /** The timezone of the current calendar day. */
1162
1219
  timeZone: timeZoneNameSchema,
1163
1220
  /** The current calendar date, such as `2026-10-01`. */
1164
- today: z7.string(),
1221
+ today: z8.string(),
1165
1222
  /** When the current calendar day ends, in epoch milliseconds. */
1166
1223
  nextBoundary: timestamp3,
1167
1224
  /** A change that takes effect at the next day boundary, or null. */
1168
- pending: z7.object({ timeZone: timeZoneNameSchema, effectiveAt: timestamp3 }).nullable(),
1225
+ pending: z8.object({ timeZone: timeZoneNameSchema, effectiveAt: timestamp3 }).nullable(),
1169
1226
  /** The `calendar.timeZone` the last deployment that declared one set, or null. */
1170
1227
  declared: timeZoneNameSchema.nullable(),
1171
1228
  /**
1172
1229
  * A stored timezone the calendar no longer accepts, such as a fixed offset a streak named before
1173
1230
  * v1. The calendar reads it as UTC until an operator chooses a timezone. Null otherwise.
1174
1231
  */
1175
- unsupported: z7.string().nullable().default(null)
1232
+ unsupported: z8.string().nullable().default(null)
1176
1233
  });
1177
- var projectCalendarInputSchema = z7.object({
1234
+ var projectCalendarInputSchema = z8.object({
1178
1235
  actionId: identifier,
1179
1236
  timeZone: timeZoneSchema,
1180
- reason: z7.string().trim().min(1).max(500)
1237
+ reason: z8.string().trim().min(1).max(500)
1181
1238
  }).strict();
1182
- var projectCalendarDeclarationSchema = z7.object({ timeZone: timeZoneSchema }).strict();
1239
+ var projectCalendarDeclarationSchema = z8.object({ timeZone: timeZoneSchema }).strict();
1183
1240
 
1184
1241
  // src/streaks.ts
1185
- import { z as z8 } from "zod";
1186
- var streakPolicySchema = z8.object({
1187
- kind: z8.literal("streak"),
1188
- days: z8.number().int().min(1).max(3650)
1189
- });
1190
- var streakProgressSchema = z8.object({
1191
- goal: z8.number().int().positive(),
1192
- current: z8.number().int().nonnegative(),
1193
- best: z8.number().int().nonnegative(),
1194
- today: z8.string(),
1195
- todayQualified: z8.boolean(),
1242
+ import { z as z9 } from "zod";
1243
+ var streakPolicySchema = z9.object({
1244
+ kind: z9.literal("streak"),
1245
+ days: z9.number().int().min(1).max(3650)
1246
+ });
1247
+ var streakProgressSchema = z9.object({
1248
+ goal: z9.number().int().positive(),
1249
+ current: z9.number().int().nonnegative(),
1250
+ best: z9.number().int().nonnegative(),
1251
+ today: z9.string(),
1252
+ todayQualified: z9.boolean(),
1196
1253
  timeZone: timeZoneNameSchema,
1197
- nextBoundary: z8.number().int(),
1198
- pendingTimeZone: z8.object({
1254
+ nextBoundary: z9.number().int(),
1255
+ pendingTimeZone: z9.object({
1199
1256
  timeZone: timeZoneNameSchema,
1200
- effectiveAt: z8.number().int()
1257
+ effectiveAt: z9.number().int()
1201
1258
  }).nullable(),
1202
- days: z8.array(
1203
- z8.object({
1204
- day: z8.number().int(),
1205
- date: z8.string(),
1259
+ days: z9.array(
1260
+ z9.object({
1261
+ day: z9.number().int(),
1262
+ date: z9.string(),
1206
1263
  // The zone the day was recorded in, as stored: days from before v1 can name a fixed offset.
1207
- timeZone: z8.string(),
1208
- occurredAt: z8.number().int()
1264
+ timeZone: z9.string(),
1265
+ occurredAt: z9.number().int()
1209
1266
  })
1210
1267
  ),
1211
- milestone: z8.discriminatedUnion("status", [
1212
- z8.object({ status: z8.literal("pending") }),
1213
- z8.object({
1214
- status: z8.literal("awarded"),
1215
- completion: z8.string(),
1216
- achievedAt: z8.number().int()
1268
+ milestone: z9.discriminatedUnion("status", [
1269
+ z9.object({ status: z9.literal("pending") }),
1270
+ z9.object({
1271
+ status: z9.literal("awarded"),
1272
+ completion: z9.string(),
1273
+ achievedAt: z9.number().int()
1217
1274
  }),
1218
- z8.object({
1219
- status: z8.literal("budget-exhausted"),
1220
- budget: z8.string(),
1221
- achievedAt: z8.number().int()
1275
+ z9.object({
1276
+ status: z9.literal("budget-exhausted"),
1277
+ budget: z9.string(),
1278
+ achievedAt: z9.number().int()
1222
1279
  })
1223
1280
  ])
1224
1281
  });
1225
1282
 
1226
1283
  // src/tracker-triggers.ts
1227
- import { z as z9 } from "zod";
1228
- var timestamp4 = z9.number().int().safe().nonnegative().max(864e13);
1229
- var count2 = z9.number().int().safe().nonnegative();
1230
- var trackerTriggerModeSchema = z9.enum([
1284
+ import { z as z10 } from "zod";
1285
+ var timestamp4 = z10.number().int().safe().nonnegative().max(864e13);
1286
+ var count2 = z10.number().int().safe().nonnegative();
1287
+ var trackerTriggerModeSchema = z10.enum([
1231
1288
  "new-record",
1232
1289
  "new-observation",
1233
1290
  "data-changed"
1234
1291
  ]);
1235
1292
  function defaultTriggerMode(source) {
1236
- return source === "x-search" ? "new-record" : "new-observation";
1293
+ return source === "custom" ? "new-observation" : "new-record";
1237
1294
  }
1238
- var trackerBoundSchema = z9.union([
1239
- z9.number().finite(),
1240
- z9.strictObject({ setting: z9.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/) })
1295
+ var trackerBoundSchema = z10.union([
1296
+ z10.number().finite(),
1297
+ z10.strictObject({ setting: z10.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/) })
1241
1298
  ]);
1242
- var dataPath = z9.string().max(200).regex(
1299
+ var dataPath = z10.string().max(200).regex(
1243
1300
  /^[^.\s]+(\.[^.\s]+)*$/,
1244
1301
  "Use dot-separated keys, such as metrics.likes"
1245
1302
  );
1246
- var trackerConditionSchema = z9.union([
1247
- z9.strictObject({
1303
+ var trackerConditionSchema = z10.union([
1304
+ z10.strictObject({
1248
1305
  path: dataPath,
1249
- equals: z9.union([z9.string().max(1e3), z9.number().finite(), z9.boolean()])
1306
+ equals: z10.union([z10.string().max(1e3), z10.number().finite(), z10.boolean()])
1250
1307
  }),
1251
- z9.strictObject({
1308
+ z10.strictObject({
1252
1309
  path: dataPath,
1253
1310
  gt: trackerBoundSchema.optional(),
1254
1311
  gte: trackerBoundSchema.optional(),
@@ -1261,9 +1318,9 @@ var trackerConditionSchema = z9.union([
1261
1318
  "Compare with equals, gt, gte, lt or lte"
1262
1319
  )
1263
1320
  ]);
1264
- var trackerWhereSchema = z9.union([
1321
+ var trackerWhereSchema = z10.union([
1265
1322
  trackerConditionSchema,
1266
- z9.array(trackerConditionSchema).min(1).max(10)
1323
+ z10.array(trackerConditionSchema).min(1).max(10)
1267
1324
  ]);
1268
1325
  function whereConditions(where) {
1269
1326
  return where === void 0 ? [] : Array.isArray(where) ? where : [where];
@@ -1275,19 +1332,23 @@ function whereSettings(where) {
1275
1332
  )
1276
1333
  );
1277
1334
  }
1278
- var trackerTriggerPolicySchema = z9.strictObject({
1335
+ var trackerTriggerPolicySchema = z10.strictObject({
1279
1336
  /** The tracker's authoring key; publication binds it to the tracker's stable ID. */
1280
1337
  tracker: identifier,
1281
- source: z9.enum(["x-search", "custom"]),
1338
+ /**
1339
+ * The tracker's source kind, one of `trackerSourceKinds` today. An open string, so readers of
1340
+ * releases keep parsing them when a later Relay adds a managed source.
1341
+ */
1342
+ source: z10.string().min(1).max(100),
1282
1343
  /** Which observations fire; absent means the source's default (`defaultTriggerMode`). */
1283
1344
  on: trackerTriggerModeSchema.optional(),
1284
1345
  where: trackerWhereSchema.optional(),
1285
1346
  /**
1286
- * The record account the quest pays: `author`, `inReplyTo` for an X post, or a named account of
1287
- * a custom record. Relay attributes it through verified links; evaluators cannot redirect it.
1347
+ * The record account the quest pays: `author`, `inReplyTo` for an X post, `messageAuthor` for a
1348
+ * Discord reaction, or a named account of a custom record. Relay attributes it through verified links; evaluators cannot redirect it.
1288
1349
  * Releases published before account roles store `"replied-to"` for `inReplyTo`.
1289
1350
  */
1290
- beneficiary: z9.union([accountRoleSchema, z9.literal("replied-to")])
1351
+ beneficiary: z10.union([accountRoleSchema, z10.literal("replied-to")])
1291
1352
  });
1292
1353
  function triggerMode(policy) {
1293
1354
  return policy.on ?? defaultTriggerMode(policy.source);
@@ -1296,52 +1357,52 @@ function beneficiaryRole(policy) {
1296
1357
  return policy.beneficiary === "replied-to" ? "inReplyTo" : policy.beneficiary;
1297
1358
  }
1298
1359
  var xLink = {
1299
- issuer: z9.string().min(1),
1360
+ issuer: z10.string().min(1),
1300
1361
  /** The account's stable user ID. */
1301
- subject: z9.string().min(1).max(256),
1362
+ subject: z10.string().min(1).max(256),
1302
1363
  /** The member's account selection revision. */
1303
1364
  revision: count2,
1304
1365
  /** When the member linked the account; null when unknown. */
1305
1366
  linkedAt: timestamp4.nullable()
1306
1367
  };
1307
- var trackerAttributionSchema = z9.strictObject({
1368
+ var trackerAttributionSchema = z10.strictObject({
1308
1369
  member: identifier,
1309
1370
  capturedAt: timestamp4,
1310
- account: z9.discriminatedUnion("provider", [
1311
- z9.strictObject({
1312
- provider: z9.literal("wallet"),
1371
+ account: z10.discriminatedUnion("provider", [
1372
+ z10.strictObject({
1373
+ provider: z10.literal("wallet"),
1313
1374
  /** Canonical CAIP-10 account ID, as the record names it. */
1314
- id: z9.string().min(5).max(256),
1375
+ id: z10.string().min(5).max(256),
1315
1376
  /** The wallet link's revision. */
1316
1377
  revision: count2,
1317
1378
  /** When the member verified the wallet. */
1318
1379
  linkedAt: timestamp4.nullable()
1319
1380
  }),
1320
- z9.strictObject({ provider: z9.literal("x"), ...xLink }),
1321
- z9.strictObject({ provider: z9.literal("discord"), ...xLink }),
1322
- z9.strictObject({
1323
- provider: z9.literal("member"),
1381
+ z10.strictObject({ provider: z10.literal("x"), ...xLink }),
1382
+ z10.strictObject({ provider: z10.literal("discord"), ...xLink }),
1383
+ z10.strictObject({
1384
+ provider: z10.literal("member"),
1324
1385
  /** The member ID the record names. */
1325
1386
  id: identifier
1326
1387
  })
1327
1388
  ])
1328
1389
  });
1329
- var trackerTriggerRecordSchema = z9.strictObject({
1330
- id: z9.string().min(1).max(256),
1331
- source: z9.string(),
1390
+ var trackerTriggerRecordSchema = z10.strictObject({
1391
+ id: z10.string().min(1).max(256),
1392
+ source: z10.string(),
1332
1393
  occurredAt: timestamp4,
1333
1394
  observedAt: timestamp4,
1334
1395
  firstSeenAt: timestamp4,
1335
- author: z9.strictObject({
1336
- id: z9.string().min(1).max(256),
1337
- verified: z9.boolean().nullable(),
1396
+ author: z10.strictObject({
1397
+ id: z10.string().min(1).max(256),
1398
+ verified: z10.boolean().nullable(),
1338
1399
  kind: identityKindSchema.optional()
1339
1400
  }).nullable(),
1340
- accounts: z9.record(accountRoleSchema, trackerAccountSchema).optional(),
1341
- data: z9.record(z9.string(), z9.json()),
1342
- removed: z9.boolean()
1401
+ accounts: z10.record(accountRoleSchema, trackerAccountSchema).optional(),
1402
+ data: z10.record(z10.string(), z10.json()),
1403
+ removed: z10.boolean()
1343
1404
  });
1344
- var trackerTriggerContextSchema = z9.strictObject({
1405
+ var trackerTriggerContextSchema = z10.strictObject({
1345
1406
  /** The tracker's stable ID. */
1346
1407
  tracker: identifier,
1347
1408
  /** The tracker's authoring key. */
@@ -1350,111 +1411,70 @@ var trackerTriggerContextSchema = z9.strictObject({
1350
1411
  * The record account the attempt pays, as the quest's release names it. Releases published
1351
1412
  * before account roles name `inReplyTo` `"replied-to"`, which their bundled evaluators expect.
1352
1413
  */
1353
- beneficiary: z9.union([accountRoleSchema, z9.literal("replied-to")]),
1414
+ beneficiary: z10.union([accountRoleSchema, z10.literal("replied-to")]),
1354
1415
  record: trackerTriggerRecordSchema,
1355
- /** The captured X post of this observation; null for custom trackers. */
1356
- x: z9.strictObject({
1416
+ /** The captured X post of this observation; null for other trackers. */
1417
+ x: z10.strictObject({
1357
1418
  evidence: trackerEvidenceSchema,
1358
1419
  content: xContentBodySchema
1359
1420
  }).nullable(),
1360
1421
  attribution: trackerAttributionSchema
1361
1422
  });
1362
1423
 
1363
- // src/observations.ts
1364
- import { z as z10 } from "zod";
1365
- var name = z10.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,199}$/);
1366
- var observationInputSchema = z10.object({
1367
- id: name,
1368
- source: name,
1369
- type: name,
1370
- member: identifier,
1371
- actor: z10.object({ provider: identifier, subject: z10.string().min(1).max(200) }).strict().optional(),
1372
- occurredAt: z10.number().int().nonnegative().max(864e13),
1373
- data: z10.record(z10.string(), z10.json())
1374
- }).strict().refine(
1375
- (value) => JSON.stringify(value.data).length <= 32768,
1376
- "Observation data exceeds 32 KB"
1377
- );
1378
- var observationSchema = observationInputSchema.safeExtend({
1379
- receivedAt: z10.number().int().nonnegative()
1380
- });
1381
- var observationTriggerSchema = z10.object({ source: name, type: name }).strict();
1382
- var completionPolicySchema = z10.discriminatedUnion("kind", [
1424
+ // src/completion.ts
1425
+ import { z as z11 } from "zod";
1426
+ var name = z11.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,199}$/);
1427
+ var completionPolicySchema = z11.discriminatedUnion("kind", [
1383
1428
  streakPolicySchema,
1384
- z10.object({ kind: z10.literal("once") }).strict(),
1385
- z10.object({ kind: z10.literal("keyed") }).strict()
1429
+ z11.object({ kind: z11.literal("once") }).strict(),
1430
+ z11.object({ kind: z11.literal("keyed") }).strict()
1386
1431
  ]);
1387
- var completionKeySchema = z10.string().min(1).max(500);
1388
- var budgetSchema = z10.object({
1432
+ var completionKeySchema = z11.string().min(1).max(500);
1433
+ var budgetSchema = z11.object({
1389
1434
  id: name,
1390
- scope: z10.enum(["member", "project"]),
1435
+ scope: z11.enum(["member", "project"]),
1391
1436
  /**
1392
1437
  * The project calendar period of the attempt's eligibility time that one bucket covers:
1393
1438
  * `"day"`, `"week"` (ISO, starting on Monday) or `"month"` in the project timezone.
1394
1439
  * `"lifetime"` never resets.
1395
1440
  */
1396
1441
  period: calendarPeriodSchema,
1397
- limit: z10.number().int().positive().max(Number.MAX_SAFE_INTEGER),
1398
- cost: z10.union([
1399
- z10.number().int().positive().max(Number.MAX_SAFE_INTEGER),
1400
- z10.object({ balance: name }).strict()
1442
+ limit: z11.number().int().positive().max(Number.MAX_SAFE_INTEGER),
1443
+ cost: z11.union([
1444
+ z11.number().int().positive().max(Number.MAX_SAFE_INTEGER),
1445
+ z11.object({ balance: name }).strict()
1401
1446
  ])
1402
1447
  }).strict();
1403
- var observationReceiptSchema = z10.object({
1404
- id: name,
1405
- source: name,
1406
- attempts: z10.array(z10.string()),
1407
- receivedAt: z10.number()
1408
- });
1409
- var discordReactionSchema = z10.object({
1410
- guildId: z10.string(),
1411
- channelId: z10.string(),
1412
- messageId: z10.string(),
1413
- userId: z10.string(),
1414
- messageAuthorId: z10.string().nullable().default(null),
1415
- actorRoles: z10.array(z10.string()).default([]),
1416
- emoji: z10.object({ id: z10.string().nullable(), name: z10.string() }),
1417
- messagePublishedAt: z10.number()
1418
- }).strict();
1419
- var discordMessageSchema = z10.object({
1420
- guildId: z10.string(),
1421
- channelId: z10.string(),
1422
- messageId: z10.string(),
1423
- userId: z10.string(),
1424
- content: z10.string().nullable(),
1425
- replyTo: z10.string().nullable(),
1426
- publishedAt: z10.number()
1427
- }).strict();
1428
1448
 
1429
1449
  // src/integrations.ts
1430
- import { z as z11 } from "zod";
1431
- var integrationProviderSchema = z11.enum(["discord"]);
1432
- var discordServerSchema = z11.object({
1433
- id: z11.string().regex(/^[0-9]{1,20}$/),
1434
- name: z11.string().min(1),
1435
- icon: z11.string().nullable()
1450
+ import { z as z12 } from "zod";
1451
+ var integrationProviderSchema = z12.enum(["discord"]);
1452
+ var discordServerSchema = z12.object({
1453
+ id: z12.string().regex(/^[0-9]{1,20}$/),
1454
+ name: z12.string().min(1),
1455
+ icon: z12.string().nullable()
1436
1456
  });
1437
- var projectIntegrationSchema = z11.object({
1457
+ var projectIntegrationSchema = z12.object({
1438
1458
  provider: integrationProviderSchema,
1439
- configured: z11.boolean(),
1440
- status: z11.enum(["disconnected", "ready", "attention"]),
1441
- revision: z11.number().int().nonnegative(),
1459
+ configured: z12.boolean(),
1460
+ status: z12.enum(["disconnected", "ready", "attention"]),
1461
+ revision: z12.number().int().nonnegative(),
1442
1462
  server: discordServerSchema.nullable(),
1443
- issue: z11.string().nullable(),
1444
- connectedAt: z11.number().default(0)
1463
+ issue: z12.string().nullable(),
1464
+ connectedAt: z12.number().default(0)
1445
1465
  });
1446
1466
 
1447
1467
  // src/submission-input.ts
1448
- import { z as z12 } from "zod";
1449
- var textOptionsSchema = z12.object({
1450
- required: z12.boolean().default(true),
1451
- minLength: z12.number().int().min(0).max(1e4).default(1),
1452
- maxLength: z12.number().int().min(1).max(1e4).default(1e4)
1468
+ import { z as z13 } from "zod";
1469
+ var textOptionsSchema = z13.object({
1470
+ required: z13.boolean().default(true),
1471
+ minLength: z13.number().int().min(0).max(1e4).default(1),
1472
+ maxLength: z13.number().int().min(1).max(1e4).default(1e4)
1453
1473
  }).strict().refine(
1454
1474
  (v) => v.minLength <= v.maxLength,
1455
1475
  "minLength must not exceed maxLength"
1456
1476
  );
1457
- var hostSchema = z12.string().min(1).max(253).refine((host) => {
1477
+ var hostSchema = z13.string().min(1).max(253).refine((host) => {
1458
1478
  if (!/^[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$/i.test(host) || host.includes("..")) {
1459
1479
  return false;
1460
1480
  }
@@ -1465,13 +1485,13 @@ var hostSchema = z12.string().min(1).max(253).refine((host) => {
1465
1485
  return false;
1466
1486
  }
1467
1487
  }, "Use a hostname without a scheme, path, port, or wildcard");
1468
- var urlOptionsSchema = z12.object({
1469
- required: z12.boolean().default(true),
1470
- allowedHosts: z12.array(hostSchema).min(1).max(100).optional()
1488
+ var urlOptionsSchema = z13.object({
1489
+ required: z13.boolean().default(true),
1490
+ allowedHosts: z13.array(hostSchema).min(1).max(100).optional()
1471
1491
  }).strict();
1472
- var textEvidenceSchema = z12.object({ kind: z12.literal("text"), value: z12.string().max(1e4) }).strict();
1473
- var urlEvidenceSchema = z12.object({ kind: z12.literal("url"), value: z12.string().max(2048) }).strict();
1474
- var valueEvidenceSchema = z12.discriminatedUnion("kind", [
1492
+ var textEvidenceSchema = z13.object({ kind: z13.literal("text"), value: z13.string().max(1e4) }).strict();
1493
+ var urlEvidenceSchema = z13.object({ kind: z13.literal("url"), value: z13.string().max(2048) }).strict();
1494
+ var valueEvidenceSchema = z13.discriminatedUnion("kind", [
1475
1495
  textEvidenceSchema,
1476
1496
  urlEvidenceSchema
1477
1497
  ]);
@@ -1534,22 +1554,22 @@ function xPostId(value) {
1534
1554
  }
1535
1555
 
1536
1556
  // src/quiz.ts
1537
- import { z as z13 } from "zod";
1538
- var quizId = z13.string().regex(/^[a-zA-Z0-9_-]+$/).max(100);
1539
- var quizChoiceSchema = z13.object({ id: quizId, label: z13.string().trim().min(1).max(500) }).strict();
1540
- var quizQuestionSchema = z13.object({
1557
+ import { z as z14 } from "zod";
1558
+ var quizId = z14.string().regex(/^[a-zA-Z0-9_-]+$/).max(100);
1559
+ var quizChoiceSchema = z14.object({ id: quizId, label: z14.string().trim().min(1).max(500) }).strict();
1560
+ var quizQuestionSchema = z14.object({
1541
1561
  id: quizId,
1542
- prompt: z13.string().trim().min(1).max(1e3),
1543
- choices: z13.array(quizChoiceSchema).min(2).max(8).refine(
1562
+ prompt: z14.string().trim().min(1).max(1e3),
1563
+ choices: z14.array(quizChoiceSchema).min(2).max(8).refine(
1544
1564
  (choices) => new Set(choices.map((choice) => choice.id)).size === choices.length,
1545
1565
  "Choice IDs must be unique"
1546
1566
  )
1547
1567
  }).strict();
1548
- var quizQuestionsSchema = z13.array(quizQuestionSchema).min(1).max(20).refine(
1568
+ var quizQuestionsSchema = z14.array(quizQuestionSchema).min(1).max(20).refine(
1549
1569
  (questions) => new Set(questions.map((question) => question.id)).size === questions.length,
1550
1570
  "Question IDs must be unique"
1551
1571
  );
1552
- var quizContentSchema = z13.array(
1572
+ var quizContentSchema = z14.array(
1553
1573
  quizQuestionSchema.extend({ correct: quizId }).refine(
1554
1574
  (question) => question.choices.some((choice) => choice.id === question.correct),
1555
1575
  "Choose a correct answer from the available choices"
@@ -1560,97 +1580,97 @@ var quizContentSchema = z13.array(
1560
1580
  );
1561
1581
 
1562
1582
  // src/resources.ts
1563
- import { z as z14 } from "zod";
1564
- var channelSourceSchema = z14.object({
1565
- provider: z14.literal("discord"),
1566
- resource: z14.literal("channel"),
1567
- types: z14.array(z14.enum(["text", "announcement"])).min(1)
1583
+ import { z as z15 } from "zod";
1584
+ var channelSourceSchema = z15.object({
1585
+ provider: z15.literal("discord"),
1586
+ resource: z15.literal("channel"),
1587
+ types: z15.array(z15.enum(["text", "announcement"])).min(1)
1568
1588
  }).strict();
1569
- var resourceSourceSchema = z14.union([
1570
- z14.object({
1571
- provider: z14.literal("domino"),
1572
- resource: z14.literal("point-ledger")
1589
+ var resourceSourceSchema = z15.union([
1590
+ z15.object({
1591
+ provider: z15.literal("domino"),
1592
+ resource: z15.literal("point-ledger")
1573
1593
  }).strict(),
1574
1594
  channelSourceSchema,
1575
- z14.object({
1576
- provider: z14.literal("discord"),
1577
- resource: z14.literal("role"),
1578
- assignable: z14.boolean().default(false)
1595
+ z15.object({
1596
+ provider: z15.literal("discord"),
1597
+ resource: z15.literal("role"),
1598
+ assignable: z15.boolean().default(false)
1579
1599
  }).strict()
1580
1600
  ]);
1581
- var resourceRequestSchema = z14.object({
1601
+ var resourceRequestSchema = z15.object({
1582
1602
  source: resourceSourceSchema,
1583
- query: z14.string().max(100).optional(),
1584
- cursor: z14.string().regex(/^\d{1,6}$/).optional(),
1585
- ids: z14.array(z14.string().min(1).max(100)).max(50).optional()
1603
+ query: z15.string().max(100).optional(),
1604
+ cursor: z15.string().regex(/^\d{1,6}$/).optional(),
1605
+ ids: z15.array(z15.string().min(1).max(100)).max(50).optional()
1586
1606
  }).strict();
1587
- var resourceOptionsSchema = z14.object({
1588
- revision: z14.number().int(),
1589
- options: z14.array(
1590
- z14.object({
1591
- id: z14.string(),
1592
- label: z14.string(),
1593
- description: z14.string().optional(),
1594
- group: z14.string().optional(),
1595
- disabledReason: z14.string().optional()
1607
+ var resourceOptionsSchema = z15.object({
1608
+ revision: z15.number().int(),
1609
+ options: z15.array(
1610
+ z15.object({
1611
+ id: z15.string(),
1612
+ label: z15.string(),
1613
+ description: z15.string().optional(),
1614
+ group: z15.string().optional(),
1615
+ disabledReason: z15.string().optional()
1596
1616
  })
1597
1617
  ),
1598
- cursor: z14.string().nullable()
1618
+ cursor: z15.string().nullable()
1599
1619
  });
1600
1620
 
1601
1621
  // src/settings.ts
1602
- import { z as z16 } from "zod";
1622
+ import { z as z17 } from "zod";
1603
1623
 
1604
1624
  // src/setting-values.ts
1605
- import { z as z15 } from "zod";
1606
- var settingInstant = z15.iso.datetime({ offset: true }).transform((value) => new Date(value).toISOString());
1607
- var settingResourceId = z15.union([
1608
- z15.literal(""),
1609
- z15.string().regex(/^\S{1,200}$/)
1625
+ import { z as z16 } from "zod";
1626
+ var settingInstant = z16.iso.datetime({ offset: true }).transform((value) => new Date(value).toISOString());
1627
+ var settingResourceId = z16.union([
1628
+ z16.literal(""),
1629
+ z16.string().regex(/^\S{1,200}$/)
1610
1630
  ]);
1611
1631
 
1612
1632
  // src/settings.ts
1613
- var base = { label: z16.string().min(1), description: z16.string().optional() };
1614
- var settingFieldSchema = z16.discriminatedUnion("kind", [
1615
- z16.object({ ...base, kind: z16.literal("point-ledger"), default: identifier }).strict(),
1616
- z16.object({ ...base, kind: z16.literal("datetime"), default: settingInstant }).strict(),
1617
- z16.object({
1633
+ var base = { label: z17.string().min(1), description: z17.string().optional() };
1634
+ var settingFieldSchema = z17.discriminatedUnion("kind", [
1635
+ z17.object({ ...base, kind: z17.literal("point-ledger"), default: identifier }).strict(),
1636
+ z17.object({ ...base, kind: z17.literal("datetime"), default: settingInstant }).strict(),
1637
+ z17.object({
1618
1638
  ...base,
1619
- kind: z16.literal("resource"),
1639
+ kind: z17.literal("resource"),
1620
1640
  default: settingResourceId,
1621
1641
  source: resourceSourceSchema
1622
1642
  }).strict(),
1623
- z16.object({ ...base, kind: z16.literal("quiz"), default: quizContentSchema }).strict(),
1624
- z16.object({
1643
+ z17.object({ ...base, kind: z17.literal("quiz"), default: quizContentSchema }).strict(),
1644
+ z17.object({
1625
1645
  ...base,
1626
- kind: z16.literal("text"),
1627
- default: z16.string(),
1628
- minLength: z16.number().int().nonnegative(),
1629
- maxLength: z16.number().int().positive(),
1630
- multiline: z16.boolean()
1646
+ kind: z17.literal("text"),
1647
+ default: z17.string(),
1648
+ minLength: z17.number().int().nonnegative(),
1649
+ maxLength: z17.number().int().positive(),
1650
+ multiline: z17.boolean()
1631
1651
  }).strict(),
1632
- z16.object({
1652
+ z17.object({
1633
1653
  ...base,
1634
- kind: z16.literal("integer"),
1635
- default: z16.number().int(),
1636
- min: z16.number().int(),
1637
- max: z16.number().int()
1654
+ kind: z17.literal("integer"),
1655
+ default: z17.number().int(),
1656
+ min: z17.number().int(),
1657
+ max: z17.number().int()
1638
1658
  }).strict(),
1639
- z16.object({ ...base, kind: z16.literal("boolean"), default: z16.boolean() }).strict(),
1640
- z16.object({
1659
+ z17.object({ ...base, kind: z17.literal("boolean"), default: z17.boolean() }).strict(),
1660
+ z17.object({
1641
1661
  ...base,
1642
- kind: z16.literal("choice"),
1643
- default: z16.string(),
1644
- options: z16.array(z16.string().min(1)).min(1)
1662
+ kind: z17.literal("choice"),
1663
+ default: z17.string(),
1664
+ options: z17.array(z17.string().min(1)).min(1)
1645
1665
  }).strict()
1646
1666
  ]);
1647
- var settingsFieldsSchema = z16.record(
1648
- z16.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/),
1667
+ var settingsFieldsSchema = z17.record(
1668
+ z17.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/),
1649
1669
  settingFieldSchema
1650
1670
  );
1651
- var settingsValuesSchema = z16.record(
1652
- z16.string(),
1653
- z16.union([z16.string(), z16.number().finite(), z16.boolean(), quizContentSchema])
1671
+ var settingsValuesSchema = z17.record(
1672
+ z17.string(),
1673
+ z17.union([z17.string(), z17.number().finite(), z17.boolean(), quizContentSchema])
1654
1674
  );
1655
1675
  function parseSettings(fields, input) {
1656
1676
  const shape = {};
@@ -1669,20 +1689,20 @@ function parseSettings(fields, input) {
1669
1689
  shape[key] = quizContentSchema.default(field.default);
1670
1690
  break;
1671
1691
  case "text":
1672
- shape[key] = z16.string().min(field.minLength).max(field.maxLength).default(field.default);
1692
+ shape[key] = z17.string().min(field.minLength).max(field.maxLength).default(field.default);
1673
1693
  break;
1674
1694
  case "integer":
1675
- shape[key] = z16.number().int().min(field.min).max(field.max).default(field.default);
1695
+ shape[key] = z17.number().int().min(field.min).max(field.max).default(field.default);
1676
1696
  break;
1677
1697
  case "boolean":
1678
- shape[key] = z16.boolean().default(field.default);
1698
+ shape[key] = z17.boolean().default(field.default);
1679
1699
  break;
1680
1700
  case "choice":
1681
- shape[key] = z16.enum(field.options).default(field.default);
1701
+ shape[key] = z17.enum(field.options).default(field.default);
1682
1702
  break;
1683
1703
  }
1684
1704
  }
1685
- return settingsValuesSchema.parse(z16.object(shape).strict().parse(input));
1705
+ return settingsValuesSchema.parse(z17.object(shape).strict().parse(input));
1686
1706
  }
1687
1707
  function missingResourceSettings(fields, values) {
1688
1708
  return Object.entries(fields).filter(([key, field]) => field.kind === "resource" && !values[key]).map(([key]) => key);
@@ -1692,43 +1712,43 @@ function compatibleSettingKinds(previous, next) {
1692
1712
  }
1693
1713
 
1694
1714
  // src/schema.ts
1695
- import { z as z17 } from "zod";
1696
- var pointsRewardSchema = z17.object({
1697
- kind: z17.literal("points").default("points"),
1715
+ import { z as z18 } from "zod";
1716
+ var pointsRewardSchema = z18.object({
1717
+ kind: z18.literal("points").default("points"),
1698
1718
  balance: identifier,
1699
- amount: z17.number().int().min(0).max(1e4)
1719
+ amount: z18.number().int().min(0).max(1e4)
1700
1720
  }).strict();
1701
- var tieredRewardDefinitionSchema = z17.object({
1721
+ var tieredRewardDefinitionSchema = z18.object({
1702
1722
  id: identifier,
1703
- title: z17.string().min(1).max(120),
1704
- tiers: z17.array(
1705
- z17.object({ id: identifier, title: z17.string().min(1).max(120) }).strict()
1723
+ title: z18.string().min(1).max(120),
1724
+ tiers: z18.array(
1725
+ z18.object({ id: identifier, title: z18.string().min(1).max(120) }).strict()
1706
1726
  ).min(1).max(20).refine(
1707
1727
  (tiers) => new Set(tiers.map((t) => t.id)).size === tiers.length,
1708
1728
  "Tier IDs must be unique"
1709
1729
  ),
1710
- inventory: z17.object({ kind: z17.literal("untracked") }).strict(),
1711
- fulfillment: z17.object({ kind: z17.literal("staff-handover") }).strict()
1730
+ inventory: z18.object({ kind: z18.literal("untracked") }).strict(),
1731
+ fulfillment: z18.object({ kind: z18.literal("staff-handover") }).strict()
1712
1732
  }).strict();
1713
- var tieredRewardReferenceSchema = z17.object({
1733
+ var tieredRewardReferenceSchema = z18.object({
1714
1734
  id: identifier,
1715
1735
  key: identifier.nullable()
1716
1736
  });
1717
- var tierRewardSchema = z17.object({
1718
- kind: z17.literal("tier"),
1737
+ var tierRewardSchema = z18.object({
1738
+ kind: z18.literal("tier"),
1719
1739
  reward: tieredRewardDefinitionSchema,
1720
1740
  tier: identifier
1721
1741
  }).strict().refine(
1722
1742
  (value) => value.reward.tiers.some((t) => t.id === value.tier),
1723
1743
  "Unknown reward tier"
1724
1744
  );
1725
- var integrationRewardSchema = z17.object({
1726
- kind: z17.literal("integration"),
1727
- provider: z17.literal("discord"),
1728
- action: z17.literal("grant-role"),
1729
- roleId: z17.string().regex(/^[0-9]{1,20}$/)
1745
+ var integrationRewardSchema = z18.object({
1746
+ kind: z18.literal("integration"),
1747
+ provider: z18.literal("discord"),
1748
+ action: z18.literal("grant-role"),
1749
+ roleId: z18.string().regex(/^[0-9]{1,20}$/)
1730
1750
  }).strict();
1731
- var rewardSchema = z17.union([
1751
+ var rewardSchema = z18.union([
1732
1752
  pointsRewardSchema,
1733
1753
  tierRewardSchema,
1734
1754
  integrationRewardSchema
@@ -1739,76 +1759,75 @@ function rewardKey(reward) {
1739
1759
  }
1740
1760
  return reward.kind === "points" ? "points:" + reward.balance : "tier:" + reward.reward.id;
1741
1761
  }
1742
- var triggerSchema = z17.union([
1743
- z17.object({
1744
- kind: z17.literal("manual"),
1745
- input: z17.literal("text"),
1762
+ var triggerSchema = z18.union([
1763
+ z18.object({
1764
+ kind: z18.literal("manual"),
1765
+ input: z18.literal("text"),
1746
1766
  constraints: textOptionsSchema,
1747
- actor: z17.enum(["member", "staff"]).optional()
1767
+ actor: z18.enum(["member", "staff"]).optional()
1748
1768
  }).strict(),
1749
- z17.object({
1750
- kind: z17.literal("manual"),
1751
- input: z17.literal("url"),
1769
+ z18.object({
1770
+ kind: z18.literal("manual"),
1771
+ input: z18.literal("url"),
1752
1772
  constraints: urlOptionsSchema,
1753
- actor: z17.enum(["member", "staff"]).optional()
1773
+ actor: z18.enum(["member", "staff"]).optional()
1754
1774
  }).strict(),
1755
- z17.object({
1756
- kind: z17.literal("manual"),
1757
- input: z17.enum(["photo", "quiz", "none"]),
1758
- actor: z17.enum(["member", "staff"]).optional()
1775
+ z18.object({
1776
+ kind: z18.literal("manual"),
1777
+ input: z18.enum(["photo", "quiz", "none"]),
1778
+ actor: z18.enum(["member", "staff"]).optional()
1759
1779
  }).strict(),
1760
- z17.object({
1761
- kind: z17.literal("automatic"),
1762
- observation: observationTriggerSchema.optional(),
1780
+ z18.object({
1781
+ kind: z18.literal("automatic"),
1763
1782
  content: contentPolicySchema.optional(),
1764
1783
  tracker: trackerTriggerPolicySchema.optional()
1765
1784
  }).strict().refine(
1766
- (value) => [value.observation, value.content, value.tracker].filter(Boolean).length <= 1,
1785
+ (value) => !(value.content && value.tracker),
1767
1786
  "Choose one automatic trigger source"
1768
1787
  )
1769
1788
  ]);
1770
- var prerequisiteSchema = z17.object({ quest: identifier });
1771
- var photoResultSchema = z17.object({
1772
- kind: z17.enum(["pass", "fail", "unclear"]),
1773
- reason: z17.string().min(1).max(2e3)
1789
+ var prerequisiteSchema = z18.object({ quest: identifier });
1790
+ var photoResultSchema = z18.object({
1791
+ kind: z18.enum(["pass", "fail", "unclear"]),
1792
+ reason: z18.string().min(1).max(2e3)
1774
1793
  }).strict();
1775
- var textReviewInputSchema = z17.object({
1776
- text: z17.string().min(1).max(16e3).refine((value) => value.trim().length > 0, "Text must not be blank"),
1777
- criteria: z17.string().trim().min(1).max(2e3)
1794
+ var textReviewInputSchema = z18.object({
1795
+ text: z18.string().min(1).max(16e3).refine((value) => value.trim().length > 0, "Text must not be blank"),
1796
+ criteria: z18.string().trim().min(1).max(2e3)
1778
1797
  }).strict();
1779
1798
  var textResultSchema = photoResultSchema;
1780
- var decisionSchema = z17.discriminatedUnion("kind", [
1781
- z17.object({
1782
- kind: z17.literal("accept"),
1783
- rewards: z17.array(rewardSchema).max(10),
1799
+ var decisionSchema = z18.discriminatedUnion("kind", [
1800
+ z18.object({
1801
+ kind: z18.literal("accept"),
1802
+ rewards: z18.array(rewardSchema).max(10),
1784
1803
  completionKey: completionKeySchema.optional()
1785
1804
  }).strict(),
1786
- z17.object({
1787
- kind: z17.literal("reject"),
1788
- reason: z17.string().min(1).max(2e3),
1805
+ z18.object({
1806
+ kind: z18.literal("reject"),
1807
+ reason: z18.string().min(1).max(2e3),
1789
1808
  /** The evaluator asked for human review, but review is off for the quest, so this is a reject. */
1790
- requestedReview: z17.literal(true).optional()
1809
+ requestedReview: z18.literal(true).optional()
1791
1810
  }).strict(),
1792
- z17.object({
1793
- kind: z17.literal("review"),
1794
- reason: z17.string().min(1).max(2e3),
1795
- rewards: z17.array(rewardSchema).max(10).optional(),
1811
+ z18.object({
1812
+ kind: z18.literal("review"),
1813
+ reason: z18.string().min(1).max(2e3),
1814
+ rewards: z18.array(rewardSchema).max(10).optional(),
1796
1815
  completionKey: completionKeySchema.optional()
1797
1816
  }).strict()
1798
1817
  ]);
1799
- var reviewModeSchema = z17.enum(["workers-ai"]);
1800
- var storedReviewModeSchema = z17.enum([
1818
+ var reviewModeSchema = z18.enum(["workers-ai"]);
1819
+ var storedReviewModeSchema = z18.enum([
1801
1820
  "fixture-pass",
1802
1821
  "fixture-fail",
1803
1822
  "fixture-unclear",
1804
1823
  "fixture-error",
1805
1824
  "workers-ai"
1806
1825
  ]);
1807
- var rewardBundleSchema = z17.array(rewardSchema).max(10).refine(
1826
+ var rewardBundleSchema = z18.array(rewardSchema).max(10).refine(
1808
1827
  (rewards) => new Set(rewards.map(rewardKey)).size === rewards.length,
1809
1828
  "Use one entry per balance or shared reward"
1810
1829
  );
1811
- var mediaUrlSchema = z17.string().max(2e3).refine((value) => {
1830
+ var mediaUrlSchema = z18.string().max(2e3).refine((value) => {
1812
1831
  if (/^\/(?!\/)[^\\\s]*$/.test(value)) {
1813
1832
  return true;
1814
1833
  }
@@ -1818,85 +1837,85 @@ var mediaUrlSchema = z17.string().max(2e3).refine((value) => {
1818
1837
  return false;
1819
1838
  }
1820
1839
  }, "Use an HTTPS URL or a same-site path beginning with /");
1821
- var questPresentationSchema = z17.object({
1840
+ var questPresentationSchema = z18.object({
1822
1841
  quiz: quizQuestionsSchema.optional(),
1823
- instructions: z17.string().max(4e3).optional(),
1824
- video: z17.object({
1842
+ instructions: z18.string().max(4e3).optional(),
1843
+ video: z18.object({
1825
1844
  url: mediaUrlSchema,
1826
1845
  poster: mediaUrlSchema.optional(),
1827
- captions: z17.object({
1846
+ captions: z18.object({
1828
1847
  url: mediaUrlSchema,
1829
- language: z17.string().min(2).max(20),
1830
- label: z17.string().min(1).max(80)
1848
+ language: z18.string().min(2).max(20),
1849
+ label: z18.string().min(1).max(80)
1831
1850
  }).strict().optional()
1832
1851
  }).strict().optional()
1833
1852
  }).strict();
1834
- var questProfileSchema = z17.object({ visible: z17.boolean() }).strict();
1835
- var questDescriptionSchema = z17.object({
1853
+ var questProfileSchema = z18.object({ visible: z18.boolean() }).strict();
1854
+ var questDescriptionSchema = z18.object({
1836
1855
  quest: identifier,
1837
- runtimeVersion: z17.union([z17.literal(1), z17.literal(2)]).default(1),
1838
- title: z17.string().min(1).max(120),
1856
+ runtimeVersion: z18.union([z18.literal(1), z18.literal(2)]).default(1),
1857
+ title: z18.string().min(1).max(120),
1839
1858
  presentation: questPresentationSchema.default({}),
1840
- integrations: z17.array(integrationProviderSchema).max(10).default([]),
1859
+ integrations: z18.array(integrationProviderSchema).max(10).default([]),
1841
1860
  fields: settingsFieldsSchema,
1842
1861
  values: settingsValuesSchema,
1843
1862
  rewards: rewardBundleSchema,
1844
- humanReview: z17.boolean(),
1863
+ humanReview: z18.boolean(),
1845
1864
  trigger: triggerSchema,
1846
1865
  performance: contentPerformancePolicySchema.optional(),
1847
- requires: z17.array(prerequisiteSchema).max(30).default([]),
1848
- completion: z17.preprocess(refuseStreakTimeZone, completionPolicySchema),
1849
- visibility: z17.enum(["visible", "hidden"]).default("visible"),
1866
+ requires: z18.array(prerequisiteSchema).max(30).default([]),
1867
+ completion: z18.preprocess(refuseStreakTimeZone, completionPolicySchema),
1868
+ visibility: z18.enum(["visible", "hidden"]).default("visible"),
1850
1869
  /**
1851
1870
  * Whether completions show on participant profiles (`/v1/profiles/:id/completions`). Absent
1852
1871
  * is hidden. Optional, not defaulted: releases carry the key only when the author sets it, so
1853
1872
  * clients and pods that predate it (strict release schemas) still read every other release.
1854
1873
  */
1855
1874
  profile: questProfileSchema.optional(),
1856
- budgets: z17.array(budgetSchema).max(20).default([])
1875
+ budgets: z18.array(budgetSchema).max(20).default([])
1857
1876
  }).strict();
1858
- var artifactSchema = z17.object({ code: z17.string().min(1).max(1e6) }).strict();
1877
+ var artifactSchema = z18.object({ code: z18.string().min(1).max(1e6) }).strict();
1859
1878
  var releaseSchema = artifactSchema.extend({
1860
1879
  settings: settingsValuesSchema,
1861
1880
  provider: reviewModeSchema,
1862
1881
  expectedRelease: identifier.nullable().optional(),
1863
- settingRenames: z17.record(z17.string(), z17.string()).optional()
1882
+ settingRenames: z18.record(z18.string(), z18.string()).optional()
1864
1883
  }).strict();
1865
- var batchReleaseSchema = z17.object({ releases: z17.array(releaseSchema).min(1).max(50) }).strict();
1866
- var questSettingsInputSchema = z17.object({
1884
+ var batchReleaseSchema = z18.object({ releases: z18.array(releaseSchema).min(1).max(50) }).strict();
1885
+ var questSettingsInputSchema = z18.object({
1867
1886
  quest: identifier,
1868
1887
  expectedRelease: identifier,
1869
1888
  set: settingsValuesSchema,
1870
- reset: z17.array(z17.string())
1889
+ reset: z18.array(z18.string())
1871
1890
  }).strict();
1872
1891
  var storedQuestDescriptionSchema = questDescriptionSchema.extend({
1873
1892
  completion: completionPolicySchema
1874
1893
  });
1875
1894
  var storedReleaseSchema = storedQuestDescriptionSchema.extend({
1876
1895
  key: identifier.optional(),
1877
- code: z17.string(),
1896
+ code: z18.string(),
1878
1897
  provider: storedReviewModeSchema,
1879
1898
  id: identifier,
1880
- createdAt: z17.number(),
1881
- legacy: z17.boolean().default(false),
1882
- origin: z17.object({ typeVersion: identifier }).strict().optional(),
1883
- lifecycle: z17.enum(["active", "paused", "archived"]).default("active"),
1884
- configuration: z17.object({
1899
+ createdAt: z18.number(),
1900
+ legacy: z18.boolean().default(false),
1901
+ origin: z18.object({ typeVersion: identifier }).strict().optional(),
1902
+ lifecycle: z18.enum(["active", "paused", "archived"]).default("active"),
1903
+ configuration: z18.object({
1885
1904
  defaults: settingsValuesSchema,
1886
1905
  overrides: settingsValuesSchema,
1887
- preserved: z17.array(z17.string())
1906
+ preserved: z18.array(z18.string())
1888
1907
  }).strict().optional()
1889
1908
  });
1890
- var legacyReleaseSchema = z17.object({
1909
+ var legacyReleaseSchema = z18.object({
1891
1910
  quest: identifier,
1892
- title: z17.string(),
1893
- criteria: z17.string(),
1894
- humanReview: z17.boolean(),
1911
+ title: z18.string(),
1912
+ criteria: z18.string(),
1913
+ humanReview: z18.boolean(),
1895
1914
  rewards: rewardBundleSchema,
1896
- code: z17.string(),
1915
+ code: z18.string(),
1897
1916
  provider: storedReviewModeSchema,
1898
1917
  id: identifier,
1899
- createdAt: z17.number()
1918
+ createdAt: z18.number()
1900
1919
  }).transform((r) => {
1901
1920
  const { criteria, ...stored } = r;
1902
1921
  return storedReleaseSchema.parse({
@@ -1908,15 +1927,15 @@ var legacyReleaseSchema = z17.object({
1908
1927
  legacy: true
1909
1928
  });
1910
1929
  });
1911
- var publishedReleaseSchema = z17.union([
1930
+ var publishedReleaseSchema = z18.union([
1912
1931
  storedReleaseSchema,
1913
1932
  legacyReleaseSchema
1914
1933
  ]);
1915
- var templateSchema = z17.object({
1916
- code: z17.string(),
1934
+ var templateSchema = z18.object({
1935
+ code: z18.string(),
1917
1936
  definition: questDescriptionSchema
1918
1937
  });
1919
- var quizAnswersSchema = z17.record(identifier, identifier).refine(
1938
+ var quizAnswersSchema = z18.record(identifier, identifier).refine(
1920
1939
  (answers) => Object.keys(answers).length > 0 && Object.keys(answers).length <= 50,
1921
1940
  "Provide between 1 and 50 answers"
1922
1941
  ).transform(
@@ -1924,33 +1943,33 @@ var quizAnswersSchema = z17.record(identifier, identifier).refine(
1924
1943
  Object.entries(answers).sort(([a], [b]) => a.localeCompare(b))
1925
1944
  )
1926
1945
  );
1927
- var quizEvidenceSchema = z17.object({
1928
- kind: z17.literal("quiz"),
1946
+ var quizEvidenceSchema = z18.object({
1947
+ kind: z18.literal("quiz"),
1929
1948
  release: identifier.optional(),
1930
1949
  answers: quizAnswersSchema
1931
1950
  }).strict();
1932
- var submissionEvidenceSchema = z17.union([
1951
+ var submissionEvidenceSchema = z18.union([
1933
1952
  quizEvidenceSchema,
1934
1953
  textEvidenceSchema,
1935
1954
  urlEvidenceSchema
1936
1955
  ]);
1937
- var submitSchema = z17.object({
1956
+ var submitSchema = z18.object({
1938
1957
  actionId: identifier,
1939
1958
  quest: identifier,
1940
1959
  member: identifier,
1941
1960
  evidence: identifier.optional(),
1942
1961
  input: submissionEvidenceSchema.optional(),
1943
1962
  release: identifier.optional(),
1944
- faultAfterReview: z17.boolean().optional()
1963
+ faultAfterReview: z18.boolean().optional()
1945
1964
  }).strict();
1946
- var attemptSchema = z17.object({
1965
+ var attemptSchema = z18.object({
1947
1966
  id: identifier,
1948
1967
  release: identifier,
1949
1968
  quest: identifier,
1950
1969
  member: identifier,
1951
1970
  evidence: identifier.nullable(),
1952
1971
  input: submissionEvidenceSchema.optional(),
1953
- status: z17.enum([
1972
+ status: z18.enum([
1954
1973
  "queued",
1955
1974
  "evaluating",
1956
1975
  "accepted",
@@ -1959,75 +1978,75 @@ var attemptSchema = z17.object({
1959
1978
  "needs-review",
1960
1979
  "failed"
1961
1980
  ]),
1962
- reason: z17.string().nullable(),
1963
- retries: z17.number(),
1964
- generation: z17.number(),
1965
- completion: z17.string().nullable(),
1981
+ reason: z18.string().nullable(),
1982
+ retries: z18.number(),
1983
+ generation: z18.number(),
1984
+ completion: z18.string().nullable(),
1966
1985
  reviewRewards: rewardBundleSchema.nullable().default(null),
1967
1986
  /**
1968
1987
  * The evaluator asked for human review of a quest with review off, so Domino rejected the attempt
1969
1988
  * with the evaluator's reason. Only set on a rejected attempt.
1970
1989
  */
1971
- requestedReview: z17.boolean().default(false),
1972
- createdAt: z17.number()
1973
- });
1974
- var eventSchema = z17.object({
1975
- id: z17.number(),
1976
- attempt: z17.string().nullable(),
1977
- kind: z17.string(),
1978
- detail: z17.string(),
1979
- actor: z17.string().nullable().default(null),
1980
- at: z17.number()
1981
- });
1982
- var pickupSelectionSchema = z17.object({
1990
+ requestedReview: z18.boolean().default(false),
1991
+ createdAt: z18.number()
1992
+ });
1993
+ var eventSchema = z18.object({
1994
+ id: z18.number(),
1995
+ attempt: z18.string().nullable(),
1996
+ kind: z18.string(),
1997
+ detail: z18.string(),
1998
+ actor: z18.string().nullable().default(null),
1999
+ at: z18.number()
2000
+ });
2001
+ var pickupSelectionSchema = z18.object({
1983
2002
  item: identifier,
1984
- revision: z17.number().int().nonnegative()
2003
+ revision: z18.number().int().nonnegative()
1985
2004
  }).strict();
1986
- var pickupAllocationSchema = z17.object({
2005
+ var pickupAllocationSchema = z18.object({
1987
2006
  item: identifier,
1988
- label: z17.string().min(1).max(80)
2007
+ label: z18.string().min(1).max(80)
1989
2008
  }).strict();
1990
- var pickupPolicySchema = z17.discriminatedUnion("kind", [
1991
- z17.object({ kind: z17.literal("untracked") }).strict(),
1992
- z17.object({
1993
- kind: z17.literal("at-pickup"),
1994
- tiers: z17.array(
1995
- z17.object({
2009
+ var pickupPolicySchema = z18.discriminatedUnion("kind", [
2010
+ z18.object({ kind: z18.literal("untracked") }).strict(),
2011
+ z18.object({
2012
+ kind: z18.literal("at-pickup"),
2013
+ tiers: z18.array(
2014
+ z18.object({
1996
2015
  tier: identifier,
1997
- variants: z17.array(pickupAllocationSchema).min(1).max(100)
2016
+ variants: z18.array(pickupAllocationSchema).min(1).max(100)
1998
2017
  }).strict()
1999
2018
  ).min(1).max(100)
2000
2019
  }).strict()
2001
2020
  ]);
2002
- var pickupCatalogSchema = z17.object({
2021
+ var pickupCatalogSchema = z18.object({
2003
2022
  reward: tieredRewardDefinitionSchema,
2004
- revision: z17.number().int().nonnegative(),
2023
+ revision: z18.number().int().nonnegative(),
2005
2024
  policy: pickupPolicySchema
2006
2025
  });
2007
- var pickupAvailabilitySchema = z17.discriminatedUnion("kind", [
2008
- z17.object({ kind: z17.literal("untracked") }).strict(),
2009
- z17.object({
2010
- kind: z17.literal("at-pickup"),
2011
- revision: z17.number().int().nonnegative(),
2012
- variants: z17.array(
2026
+ var pickupAvailabilitySchema = z18.discriminatedUnion("kind", [
2027
+ z18.object({ kind: z18.literal("untracked") }).strict(),
2028
+ z18.object({
2029
+ kind: z18.literal("at-pickup"),
2030
+ revision: z18.number().int().nonnegative(),
2031
+ variants: z18.array(
2013
2032
  pickupAllocationSchema.extend({
2014
- available: z17.number().int().nonnegative()
2033
+ available: z18.number().int().nonnegative()
2015
2034
  })
2016
2035
  )
2017
2036
  }).strict()
2018
2037
  ]);
2019
- var configurePickupSchema = z17.object({
2038
+ var configurePickupSchema = z18.object({
2020
2039
  reward: identifier,
2021
- revision: z17.number().int().nonnegative(),
2040
+ revision: z18.number().int().nonnegative(),
2022
2041
  actionId: identifier,
2023
- policy: z17.discriminatedUnion("kind", [
2024
- z17.object({ kind: z17.literal("untracked") }).strict(),
2025
- z17.object({
2026
- kind: z17.literal("at-pickup"),
2027
- tiers: z17.array(
2028
- z17.object({
2042
+ policy: z18.discriminatedUnion("kind", [
2043
+ z18.object({ kind: z18.literal("untracked") }).strict(),
2044
+ z18.object({
2045
+ kind: z18.literal("at-pickup"),
2046
+ tiers: z18.array(
2047
+ z18.object({
2029
2048
  tier: identifier,
2030
- variants: z17.array(
2049
+ variants: z18.array(
2031
2050
  pickupAllocationSchema.extend({
2032
2051
  item: identifier.optional()
2033
2052
  })
@@ -2043,164 +2062,161 @@ var entitlementBase = {
2043
2062
  reward: tieredRewardDefinitionSchema,
2044
2063
  earnedTier: identifier,
2045
2064
  tier: identifier,
2046
- revision: z17.number().int().positive()
2065
+ revision: z18.number().int().positive()
2047
2066
  };
2048
- var entitlementSchema = z17.discriminatedUnion("status", [
2049
- z17.object({ ...entitlementBase, status: z17.literal("available") }).strict(),
2050
- z17.object({
2067
+ var entitlementSchema = z18.discriminatedUnion("status", [
2068
+ z18.object({ ...entitlementBase, status: z18.literal("available") }).strict(),
2069
+ z18.object({
2051
2070
  ...entitlementBase,
2052
- status: z17.literal("handing-over"),
2071
+ status: z18.literal("handing-over"),
2053
2072
  handover: identifier,
2054
- startedAt: z17.number(),
2073
+ startedAt: z18.number(),
2055
2074
  allocation: pickupAllocationSchema.optional()
2056
2075
  }).strict(),
2057
- z17.object({
2076
+ z18.object({
2058
2077
  ...entitlementBase,
2059
- status: z17.literal("collected"),
2078
+ status: z18.literal("collected"),
2060
2079
  handover: identifier,
2061
- startedAt: z17.number(),
2080
+ startedAt: z18.number(),
2062
2081
  allocation: pickupAllocationSchema.optional(),
2063
- collectedAt: z17.number()
2082
+ collectedAt: z18.number()
2064
2083
  }).strict()
2065
2084
  ]);
2066
- var beginHandoverSchema = z17.object({
2085
+ var beginHandoverSchema = z18.object({
2067
2086
  actionId: identifier,
2068
- revision: z17.number().int().positive(),
2087
+ revision: z18.number().int().positive(),
2069
2088
  selection: pickupSelectionSchema.optional()
2070
2089
  }).strict();
2071
- var confirmHandoverSchema = z17.object({ actionId: identifier, handover: identifier }).strict();
2072
- var completionRecordSchema = z17.object({
2073
- key: z17.string().default("once"),
2090
+ var confirmHandoverSchema = z18.object({ actionId: identifier, handover: identifier }).strict();
2091
+ var completionRecordSchema = z18.object({
2092
+ key: z18.string().default("once"),
2074
2093
  id: identifier,
2075
2094
  quest: identifier,
2076
2095
  member: identifier
2077
2096
  });
2078
- var questAvailabilitySchema = z17.discriminatedUnion("kind", [
2079
- z17.object({
2080
- kind: z17.literal("available"),
2081
- input: z17.enum(["photo", "quiz", "none", "text", "url"])
2082
- }).strict(),
2083
- z17.object({ kind: z17.literal("completed") }).strict(),
2084
- z17.object({
2085
- kind: z17.literal("locked"),
2086
- missing: z17.array(z17.object({ quest: identifier, title: z17.string() })).min(1)
2097
+ var questAvailabilitySchema = z18.discriminatedUnion("kind", [
2098
+ z18.object({
2099
+ kind: z18.literal("available"),
2100
+ input: z18.enum(["photo", "quiz", "none", "text", "url"])
2087
2101
  }).strict(),
2088
- z17.object({ kind: z17.literal("staff-required") }).strict(),
2089
- z17.object({
2090
- kind: z17.literal("automatic"),
2091
- observation: observationTriggerSchema.optional()
2102
+ z18.object({ kind: z18.literal("completed") }).strict(),
2103
+ z18.object({
2104
+ kind: z18.literal("locked"),
2105
+ missing: z18.array(z18.object({ quest: identifier, title: z18.string() })).min(1)
2092
2106
  }).strict(),
2093
- z17.object({ kind: z17.literal("checking"), attempt: identifier }).strict(),
2094
- z17.object({ kind: z17.literal("needs-review"), attempt: identifier }).strict(),
2095
- z17.object({ kind: z17.literal("retryable"), attempt: identifier }).strict()
2107
+ z18.object({ kind: z18.literal("staff-required") }).strict(),
2108
+ z18.object({ kind: z18.literal("automatic") }).strict(),
2109
+ z18.object({ kind: z18.literal("checking"), attempt: identifier }).strict(),
2110
+ z18.object({ kind: z18.literal("needs-review"), attempt: identifier }).strict(),
2111
+ z18.object({ kind: z18.literal("retryable"), attempt: identifier }).strict()
2096
2112
  ]);
2097
- var memberProgressSchema = z17.object({
2113
+ var memberProgressSchema = z18.object({
2098
2114
  member: identifier,
2099
- quests: z17.array(
2100
- z17.object({
2115
+ quests: z18.array(
2116
+ z18.object({
2101
2117
  quest: identifier,
2102
2118
  key: identifier.optional(),
2103
2119
  release: identifier.optional(),
2104
- title: z17.string(),
2120
+ title: z18.string(),
2105
2121
  presentation: questPresentationSchema.default({}),
2106
- connections: z17.array(authProviderSchema).default([]),
2122
+ connections: z18.array(authProviderSchema).default([]),
2107
2123
  trigger: triggerSchema,
2108
2124
  availability: questAvailabilitySchema,
2109
- completed: z17.boolean(),
2125
+ completed: z18.boolean(),
2110
2126
  completion: completionPolicySchema.default({ kind: "once" }),
2111
2127
  streak: streakProgressSchema.nullable().optional(),
2112
- completionCount: z17.number().int().nonnegative().default(0),
2113
- visibility: z17.enum(["visible", "hidden"]).default("visible"),
2114
- missing: z17.array(z17.object({ quest: identifier, title: z17.string() })),
2128
+ completionCount: z18.number().int().nonnegative().default(0),
2129
+ visibility: z18.enum(["visible", "hidden"]).default("visible"),
2130
+ missing: z18.array(z18.object({ quest: identifier, title: z18.string() })),
2115
2131
  attempt: attemptSchema.nullable()
2116
2132
  })
2117
2133
  ),
2118
- entitlements: z17.array(entitlementSchema)
2119
- });
2120
- var snapshotSchema = z17.object({
2121
- releases: z17.array(publishedReleaseSchema),
2122
- completions: z17.array(completionRecordSchema),
2123
- entitlements: z17.array(entitlementSchema),
2124
- attempts: z17.array(attemptSchema),
2125
- balances: z17.array(
2126
- z17.object({
2127
- member: z17.string(),
2128
- balance: z17.string(),
2129
- earned: z17.number(),
2130
- held: z17.number(),
2131
- available: z17.number()
2134
+ entitlements: z18.array(entitlementSchema)
2135
+ });
2136
+ var snapshotSchema = z18.object({
2137
+ releases: z18.array(publishedReleaseSchema),
2138
+ completions: z18.array(completionRecordSchema),
2139
+ entitlements: z18.array(entitlementSchema),
2140
+ attempts: z18.array(attemptSchema),
2141
+ balances: z18.array(
2142
+ z18.object({
2143
+ member: z18.string(),
2144
+ balance: z18.string(),
2145
+ earned: z18.number(),
2146
+ held: z18.number(),
2147
+ available: z18.number()
2132
2148
  })
2133
2149
  ),
2134
- events: z17.array(eventSchema)
2150
+ events: z18.array(eventSchema)
2135
2151
  });
2136
- var evidenceSchema = z17.object({
2152
+ var evidenceSchema = z18.object({
2137
2153
  id: identifier,
2138
2154
  member: identifier,
2139
- type: z17.enum(["image/jpeg", "image/png"]),
2140
- size: z17.number()
2155
+ type: z18.enum(["image/jpeg", "image/png"]),
2156
+ size: z18.number()
2141
2157
  });
2142
- var errorSchema = z17.object({
2143
- error: z17.string(),
2144
- code: z17.string().optional(),
2145
- missing: z17.array(z17.object({ quest: identifier, title: z17.string() })).optional()
2158
+ var errorSchema = z18.object({
2159
+ error: z18.string(),
2160
+ code: z18.string().optional(),
2161
+ missing: z18.array(z18.object({ quest: identifier, title: z18.string() })).optional()
2146
2162
  });
2147
- var staffDecisionSchema = z17.object({
2163
+ var staffDecisionSchema = z18.object({
2148
2164
  actionId: identifier,
2149
- generation: z17.number().int().nonnegative(),
2150
- decision: z17.enum(["accept", "reject"]),
2151
- reason: z17.string().trim().min(1).max(2e3)
2165
+ generation: z18.number().int().nonnegative(),
2166
+ decision: z18.enum(["accept", "reject"]),
2167
+ reason: z18.string().trim().min(1).max(2e3)
2152
2168
  }).strict();
2153
- var stockSchema = z17.object({ item: identifier, quantity: z17.number().int().min(0).max(1e4) }).strict();
2154
- var reservationSchema = z17.object({
2169
+ var stockSchema = z18.object({ item: identifier, quantity: z18.number().int().min(0).max(1e4) }).strict();
2170
+ var reservationSchema = z18.object({
2155
2171
  actionId: identifier,
2156
2172
  member: identifier,
2157
2173
  item: identifier,
2158
2174
  balance: identifier,
2159
- price: z17.number().int().positive().max(1e4)
2175
+ price: z18.number().int().positive().max(1e4)
2160
2176
  }).strict();
2161
2177
  var pageOptions = {
2162
- limit: z17.number().int().min(1).max(100).default(25),
2163
- cursor: z17.string().min(1).max(4096).optional()
2178
+ limit: z18.number().int().min(1).max(100).default(25),
2179
+ cursor: z18.string().min(1).max(4096).optional()
2164
2180
  };
2165
- var reviewListSchema = z17.object({
2181
+ var reviewListSchema = z18.object({
2166
2182
  ...pageOptions,
2167
2183
  member: identifier.optional(),
2168
2184
  quest: identifier.optional()
2169
2185
  }).strict();
2170
- var memberListSchema = z17.object({
2186
+ var memberListSchema = z18.object({
2171
2187
  ...pageOptions,
2172
2188
  prefix: identifier.optional()
2173
2189
  }).strict();
2174
- var reviewItemSchema = z17.object({
2190
+ var reviewItemSchema = z18.object({
2175
2191
  attempt: attemptSchema,
2176
- title: z17.string(),
2177
- checks: z17.array(
2178
- z17.object({ criteria: z17.string(), result: photoResultSchema })
2192
+ title: z18.string(),
2193
+ checks: z18.array(
2194
+ z18.object({ criteria: z18.string(), result: photoResultSchema })
2179
2195
  )
2180
2196
  });
2181
- var reviewPageSchema = z17.object({
2182
- items: z17.array(reviewItemSchema).max(100),
2183
- nextCursor: z17.string().nullable()
2197
+ var reviewPageSchema = z18.object({
2198
+ items: z18.array(reviewItemSchema).max(100),
2199
+ nextCursor: z18.string().nullable()
2184
2200
  });
2185
- var memberPageSchema = z17.object({
2186
- items: z17.array(z17.object({ member: identifier })).max(100),
2187
- nextCursor: z17.string().nullable()
2201
+ var memberPageSchema = z18.object({
2202
+ items: z18.array(z18.object({ member: identifier })).max(100),
2203
+ nextCursor: z18.string().nullable()
2188
2204
  });
2189
- var createStockItemSchema = z17.object({ actionId: identifier, name: z17.string().trim().min(1).max(80) }).strict();
2190
- var stockItemSchema = z17.object({ id: identifier, name: z17.string() });
2191
- var contentPerformanceSnapshotSchema = z17.strictObject({
2205
+ var createStockItemSchema = z18.object({ actionId: identifier, name: z18.string().trim().min(1).max(80) }).strict();
2206
+ var stockItemSchema = z18.object({ id: identifier, name: z18.string() });
2207
+ var contentPerformanceSnapshotSchema = z18.strictObject({
2192
2208
  contentAttempt: identifier,
2193
2209
  observation: identifier,
2194
- observedAt: z17.number().int().safe().nonnegative(),
2210
+ observedAt: z18.number().int().safe().nonnegative(),
2195
2211
  metrics: contentMetricsSchema,
2196
2212
  rewards: rewardBundleSchema
2197
2213
  });
2198
2214
  var contentPerformanceQuerySchema = contentQualificationQuerySchema.extend({
2199
- content: z17.string().min(1).max(256)
2215
+ content: z18.string().min(1).max(256)
2200
2216
  });
2201
- var contentPerformancePageSchema = z17.strictObject({
2202
- current: z17.strictObject({
2203
- state: z17.enum([
2217
+ var contentPerformancePageSchema = z18.strictObject({
2218
+ current: z18.strictObject({
2219
+ state: z18.enum([
2204
2220
  "content-pending",
2205
2221
  "content-unqualified",
2206
2222
  "waiting",
@@ -2211,19 +2227,19 @@ var contentPerformancePageSchema = z17.strictObject({
2211
2227
  "failed",
2212
2228
  "superseded"
2213
2229
  ]),
2214
- reason: z17.string().nullable(),
2230
+ reason: z18.string().nullable(),
2215
2231
  contentAttempt: identifier,
2216
2232
  attempt: identifier.nullable(),
2217
2233
  reward: contentQualificationSchema.shape.reward
2218
2234
  }),
2219
- items: z17.array(
2220
- z17.strictObject({
2235
+ items: z18.array(
2236
+ z18.strictObject({
2221
2237
  attempt: identifier,
2222
2238
  contentAttempt: identifier,
2223
2239
  observation: identifier,
2224
- observedAt: z17.number(),
2240
+ observedAt: z18.number(),
2225
2241
  metrics: contentMetricsSchema,
2226
- state: z17.enum([
2242
+ state: z18.enum([
2227
2243
  "pending",
2228
2244
  "qualified",
2229
2245
  "unqualified",
@@ -2231,7 +2247,7 @@ var contentPerformancePageSchema = z17.strictObject({
2231
2247
  "failed",
2232
2248
  "superseded"
2233
2249
  ]),
2234
- reason: z17.string().nullable()
2250
+ reason: z18.string().nullable()
2235
2251
  })
2236
2252
  ),
2237
2253
  nextCursor: pageCursorSchema.nullable()
@@ -2246,6 +2262,12 @@ export {
2246
2262
  identifier,
2247
2263
  pageCursorSchema,
2248
2264
  pageQuerySchema,
2265
+ discordMessageSchema,
2266
+ discordMessagesSourceSchema,
2267
+ discordReactionsSourceSchema,
2268
+ discordMessageDataSchema,
2269
+ discordMessageTextDataSchema,
2270
+ discordReactionDataSchema,
2249
2271
  trackerDataMaxBranches,
2250
2272
  trackerDataMaxEntries,
2251
2273
  trackerDataSchemaSchema,
@@ -2269,6 +2291,7 @@ export {
2269
2291
  xSearchSourceSchema,
2270
2292
  customSourceSchema,
2271
2293
  trackerSourceSchema,
2294
+ trackerSourceKinds,
2272
2295
  sourceIdentities,
2273
2296
  trackerDefinitionSchema,
2274
2297
  trackerArtifactSchema,
@@ -2330,15 +2353,9 @@ export {
2330
2353
  trackerAttributionSchema,
2331
2354
  trackerTriggerRecordSchema,
2332
2355
  trackerTriggerContextSchema,
2333
- observationInputSchema,
2334
- observationSchema,
2335
- observationTriggerSchema,
2336
2356
  completionPolicySchema,
2337
2357
  completionKeySchema,
2338
2358
  budgetSchema,
2339
- observationReceiptSchema,
2340
- discordReactionSchema,
2341
- discordMessageSchema,
2342
2359
  integrationProviderSchema,
2343
2360
  discordServerSchema,
2344
2361
  projectIntegrationSchema,