@domino-sdk/relay 1.21.0 → 1.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/accounts-B31dWEYD.d.ts +292 -0
  2. package/dist/{attempt-captures-ByzZyggX.d.ts → attempt-captures-JDIgz2lY.d.ts} +1 -1
  3. package/dist/authoring.d.ts +112 -49
  4. package/dist/authoring.js +37 -3
  5. package/dist/{automatic-outcomes-BBSdMf0R.d.ts → automatic-outcomes-T9lEIvTj.d.ts} +1 -1
  6. package/dist/browser.d.ts +8 -8
  7. package/dist/browser.js +10 -9
  8. package/dist/{chunk-WQT4H2PI.js → chunk-57KARWUC.js} +1 -1
  9. package/dist/{chunk-EMLDFUTV.js → chunk-6UFXPKLA.js} +6 -1
  10. package/dist/{chunk-GMKJPHN4.js → chunk-AXQYGVOP.js} +1 -1
  11. package/dist/{chunk-JIQHUDVZ.js → chunk-B4EZ76WX.js} +1 -1
  12. package/dist/{chunk-T47OFHHX.js → chunk-E7MVYASS.js} +1 -1
  13. package/dist/{chunk-CVQG2AZZ.js → chunk-ENBQ6UEE.js} +2 -2
  14. package/dist/{chunk-NGP2NMZ4.js → chunk-G75JVB4D.js} +1 -1
  15. package/dist/{chunk-5ZRDK4KQ.js → chunk-GB26FIZT.js} +96 -118
  16. package/dist/{chunk-YXAK2637.js → chunk-JUQ2GNMD.js} +1 -1
  17. package/dist/{chunk-XSLRNFIY.js → chunk-MRU7GX2V.js} +1 -1
  18. package/dist/{chunk-YVBWCT4S.js → chunk-RPEGZW27.js} +2 -2
  19. package/dist/{chunk-NHHM5ASX.js → chunk-SMUYGCGP.js} +4 -4
  20. package/dist/{chunk-7YRXDG7R.js → chunk-UCZGXYCN.js} +9 -7
  21. package/dist/chunk-W33PYWYQ.js +102 -0
  22. package/dist/{chunk-5P5PTZ3T.js → chunk-WOGCRDFT.js} +1 -1
  23. package/dist/{chunk-H4FL5WA5.js → chunk-XQE22UKY.js} +13 -11
  24. package/dist/{client-DSlycgar.d.ts → client-HG0uMG0Q.d.ts} +6 -6
  25. package/dist/{deployments-nNS4spO9.d.ts → deployments-B--Shwgx.d.ts} +121 -109
  26. package/dist/{groups-jLLG7MML.d.ts → groups-CfyRewkJ.d.ts} +1 -1
  27. package/dist/{images-BPiPqVKn.d.ts → images-DwNmzqWv.d.ts} +1 -1
  28. package/dist/index.d.ts +9 -9
  29. package/dist/index.js +9 -8
  30. package/dist/{integrations-Cr9EhGI_.d.ts → integrations-BMNtARU_.d.ts} +2 -0
  31. package/dist/internal.d.ts +9 -9
  32. package/dist/internal.js +8 -8
  33. package/dist/{offers-CPqiF3dZ.d.ts → offers-CEwkAGsB.d.ts} +2 -2
  34. package/dist/{pages-1h1387a3.d.ts → pages-D1xrbGJl.d.ts} +6 -1
  35. package/dist/{telegram-DALZ7GdF.d.ts → participant-activity-DYdUUhw2.d.ts} +1 -40
  36. package/dist/portal-proxy.js +3 -3
  37. package/dist/react/index.d.ts +11 -11
  38. package/dist/react/index.js +10 -9
  39. package/dist/{schema-Br3c1GOu.d.ts → schema-D57mhL2q.d.ts} +1427 -1422
  40. package/dist/schema.d.ts +325 -323
  41. package/dist/schema.js +29 -11
  42. package/dist/server/index.d.ts +9 -9
  43. package/dist/server/index.js +59 -15
  44. package/dist/{submission-input-BEJ9qENg.d.ts → submission-input-DjXg0o-r.d.ts} +2 -2
  45. package/dist/{telegram-browser-CGB01TaB.d.ts → telegram-browser-DaP0Rawg.d.ts} +2 -3
  46. package/dist/testing.d.ts +18 -6
  47. package/dist/testing.js +42 -7
  48. package/dist/{transport-DUc8QwDl.d.ts → transport-BZbTTtBk.d.ts} +2216 -2007
  49. package/package.json +1 -1
  50. package/dist/accounts-5ciAkCMP.d.ts +0 -147
@@ -17,890 +17,358 @@ declare const ledgerSettingSchema: z.core.$ZodBranded<z.ZodUnion<[z.ZodString, z
17
17
  type LedgerSetting = z.output<typeof ledgerSettingSchema>;
18
18
  type LedgerReference = LedgerHandle | LedgerSetting;
19
19
 
20
+ /** Keep provider fields, including verification details, rather than projecting them away. */
21
+ declare const xTweetSchema: z.ZodObject<{
22
+ id: z.ZodString;
23
+ userId: z.ZodString;
24
+ content: z.ZodString;
25
+ createdAt: z.ZodISODateTime;
26
+ author: z.ZodObject<{
27
+ id: z.ZodString;
28
+ username: z.ZodString;
29
+ name: z.ZodString;
30
+ verified: z.ZodDefault<z.ZodNullable<z.ZodBoolean>>;
31
+ }, z.core.$loose>;
32
+ likeCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
33
+ replyCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
34
+ retweetCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
35
+ quoteCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
36
+ viewCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
37
+ bookmarkCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
38
+ isReply: z.ZodBoolean;
39
+ isRetweet: z.ZodBoolean;
40
+ isQuoteTweet: z.ZodBoolean;
41
+ }, z.core.$loose>;
42
+ type XTweet = z.infer<typeof xTweetSchema>;
43
+ /** Matches tracker_x_content_body_v1 in migration 0054. Version projection changes;
44
+ * retained bodies must remain readable without rewriting their evidence identities. */
45
+ declare const xContentBodySchema: z.ZodObject<{
46
+ version: z.ZodLiteral<1>;
47
+ id: z.ZodString;
48
+ authorId: z.ZodString;
49
+ publishedAt: z.ZodNumber;
50
+ text: z.ZodString;
51
+ isReply: z.ZodBoolean;
52
+ isRetweet: z.ZodBoolean;
53
+ isQuoteTweet: z.ZodBoolean;
54
+ media: z.ZodNullable<z.ZodArray<z.ZodObject<{
55
+ type: z.ZodString;
56
+ url: z.ZodString;
57
+ }, z.core.$strict>>>;
58
+ mentionedAuthorIds: z.ZodNullable<z.ZodArray<z.ZodString>>;
59
+ videoLengthSeconds: z.ZodNullable<z.ZodNumber>;
60
+ references: z.ZodObject<{
61
+ replyId: z.ZodNullable<z.ZodString>;
62
+ replyAuthorId: z.ZodNullable<z.ZodString>;
63
+ quoteId: z.ZodNullable<z.ZodString>;
64
+ quoteAuthorId: z.ZodNullable<z.ZodString>;
65
+ repostId: z.ZodNullable<z.ZodString>;
66
+ repostAuthorId: z.ZodNullable<z.ZodString>;
67
+ }, z.core.$strict>;
68
+ }, z.core.$strict>;
69
+ declare const trackerContentQuerySchema: z.ZodObject<{
70
+ id: z.ZodString;
71
+ observation: z.ZodString;
72
+ }, z.core.$strict>;
73
+ type TrackerContentQuery = z.infer<typeof trackerContentQuerySchema>;
74
+ declare const trackerContentReadSchema: z.ZodObject<{
75
+ id: z.ZodString;
76
+ observation: z.ZodString;
77
+ member: z.ZodString;
78
+ }, z.core.$strict>;
79
+ declare const trackerEvidenceSchema: z.ZodObject<{
80
+ contentRevision: z.ZodString;
81
+ observation: z.ZodString;
82
+ }, z.core.$strict>;
83
+ declare const trackerContentSchema: z.ZodObject<{
84
+ tracker: z.ZodString;
85
+ source: z.ZodLiteral<"x">;
86
+ evidence: z.ZodObject<{
87
+ contentRevision: z.ZodString;
88
+ observation: z.ZodString;
89
+ }, z.core.$strict>;
90
+ content: z.ZodObject<{
91
+ version: z.ZodLiteral<1>;
92
+ id: z.ZodString;
93
+ authorId: z.ZodString;
94
+ publishedAt: z.ZodNumber;
95
+ text: z.ZodString;
96
+ isReply: z.ZodBoolean;
97
+ isRetweet: z.ZodBoolean;
98
+ isQuoteTweet: z.ZodBoolean;
99
+ media: z.ZodNullable<z.ZodArray<z.ZodObject<{
100
+ type: z.ZodString;
101
+ url: z.ZodString;
102
+ }, z.core.$strict>>>;
103
+ mentionedAuthorIds: z.ZodNullable<z.ZodArray<z.ZodString>>;
104
+ videoLengthSeconds: z.ZodNullable<z.ZodNumber>;
105
+ references: z.ZodObject<{
106
+ replyId: z.ZodNullable<z.ZodString>;
107
+ replyAuthorId: z.ZodNullable<z.ZodString>;
108
+ quoteId: z.ZodNullable<z.ZodString>;
109
+ quoteAuthorId: z.ZodNullable<z.ZodString>;
110
+ repostId: z.ZodNullable<z.ZodString>;
111
+ repostAuthorId: z.ZodNullable<z.ZodString>;
112
+ }, z.core.$strict>;
113
+ }, z.core.$strict>;
114
+ observedAt: z.ZodNumber;
115
+ removed: z.ZodBoolean;
116
+ attribution: z.ZodDiscriminatedUnion<[z.ZodObject<{
117
+ kind: z.ZodLiteral<"linked">;
118
+ account: z.ZodObject<{
119
+ provider: z.ZodLiteral<"x">;
120
+ issuer: z.ZodString;
121
+ subject: z.ZodString;
122
+ revision: z.ZodNumber;
123
+ linkedAt: z.ZodNullable<z.ZodNumber>;
124
+ }, z.core.$strict>;
125
+ member: z.ZodString;
126
+ capturedAt: z.ZodNumber;
127
+ }, z.core.$strict>, z.ZodObject<{
128
+ kind: z.ZodLiteral<"unlinked">;
129
+ member: z.ZodString;
130
+ capturedAt: z.ZodNumber;
131
+ }, z.core.$strict>, z.ZodObject<{
132
+ kind: z.ZodLiteral<"different-author">;
133
+ member: z.ZodString;
134
+ capturedAt: z.ZodNumber;
135
+ }, z.core.$strict>], "kind">;
136
+ }, z.core.$strict>;
137
+ type TrackerContent = z.infer<typeof trackerContentSchema>;
138
+ /** The identity kinds Relay defines. Your own app's kinds are `app:<name>`. */
139
+ declare const knownIdentityKinds: readonly ["wallet", "x", "discord", "member"];
140
+ type KnownIdentityKind = (typeof knownIdentityKinds)[number];
20
141
  /**
21
- * Which record observations fire a tracker trigger. `"new-record"`: the first observation of each
22
- * record this tracker collects. `"new-observation"`: every observation that becomes its record's
23
- * current one (a new record, or a later `observedAt`). `"data-changed"`: a new record, or a current
24
- * observation whose `data` differs from the record's previous one.
142
+ * An identity kind your app owns: `app:` and a name of lowercase letters, digits, `_` or `-`
143
+ * (at most 40), such as `app:telegram` or `app:acme`. The identity integration created with this
144
+ * kind is the only one that can link it: each member it signs in gets the app's subject as an
145
+ * identity of this kind in the project.
25
146
  */
26
- declare const trackerTriggerModeSchema: z.ZodEnum<{
27
- "new-record": "new-record";
28
- "new-observation": "new-observation";
29
- "data-changed": "data-changed";
30
- }>;
31
- type TrackerTriggerMode = z.infer<typeof trackerTriggerModeSchema>;
147
+ declare const appIdentityKindSchema: z.ZodTemplateLiteral<`app:${string}`>;
148
+ type AppIdentityKind = `app:${string}`;
32
149
  /**
33
- * Custom trackers fire on every new sample; X and Discord trackers on each record they collect,
34
- * since a post, message or reaction is one event.
150
+ * The verified identities a custom tracker's record accounts can be. Relay attributes each to a
151
+ * member through a verified link: `wallet` a canonical CAIP-10 account ID the member linked, `x`
152
+ * and `discord` the stable user ID of the member's selected account, `member` a Domino member ID,
153
+ * and `app:<name>` the subject your app's identity integration signed the member in with.
35
154
  */
36
- declare function defaultTriggerMode(source: string): TrackerTriggerMode;
37
- /** A bound in a tracker trigger filter: a number, or the quest's integer setting of that name. */
38
- declare const trackerBoundSchema: z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
39
- setting: z.ZodString;
40
- }, z.core.$strict>]>;
41
- type TrackerBound = z.infer<typeof trackerBoundSchema>;
155
+ declare const identityKindSchema: z.ZodUnion<readonly [z.ZodEnum<{
156
+ member: "member";
157
+ discord: "discord";
158
+ x: "x";
159
+ wallet: "wallet";
160
+ }>, z.ZodTemplateLiteral<`app:${string}`>]>;
161
+ type IdentityKind = KnownIdentityKind | AppIdentityKind;
162
+ /** Whether a kind is one your app owns, `app:<name>`. */
163
+ declare const isAppIdentityKind: (kind: string) => kind is AppIdentityKind;
42
164
  /**
43
- * Which firing observations a tracker trigger admits, judged on the record's `data` before any
44
- * attribution. `equals` matches a string, number or boolean exactly. `gt`, `gte`, `lt` and `lte`
45
- * compare a number, or an integer string such as a base-unit balance, and all must hold.
46
- * Observations that do not match are not trigger events: they record no outcome.
165
+ * An identity kind as responses and evaluator contexts carry it: one of `IdentityKind`, or a kind
166
+ * a later Relay adds. Compare it with the kinds you handle and keep a default branch.
47
167
  */
48
- declare const trackerConditionSchema: z.ZodUnion<readonly [z.ZodObject<{
49
- path: z.ZodString;
50
- equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
51
- }, z.core.$strict>, z.ZodObject<{
52
- path: z.ZodString;
53
- gt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
54
- setting: z.ZodString;
55
- }, z.core.$strict>]>>;
56
- gte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
57
- setting: z.ZodString;
58
- }, z.core.$strict>]>>;
59
- lt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
60
- setting: z.ZodString;
61
- }, z.core.$strict>]>>;
62
- lte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
63
- setting: z.ZodString;
64
- }, z.core.$strict>]>>;
65
- }, z.core.$strict>]>;
66
- type TrackerCondition = z.infer<typeof trackerConditionSchema>;
67
- /** One condition, or a list of conditions that must all hold. */
68
- declare const trackerWhereSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
69
- path: z.ZodString;
70
- equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
71
- }, z.core.$strict>, z.ZodObject<{
72
- path: z.ZodString;
73
- gt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
74
- setting: z.ZodString;
75
- }, z.core.$strict>]>>;
76
- gte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
77
- setting: z.ZodString;
78
- }, z.core.$strict>]>>;
79
- lt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
80
- setting: z.ZodString;
81
- }, z.core.$strict>]>>;
82
- lte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
83
- setting: z.ZodString;
84
- }, z.core.$strict>]>>;
85
- }, z.core.$strict>]>, z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
86
- path: z.ZodString;
87
- equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
88
- }, z.core.$strict>, z.ZodObject<{
89
- path: z.ZodString;
90
- gt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
91
- setting: z.ZodString;
92
- }, z.core.$strict>]>>;
93
- gte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
94
- setting: z.ZodString;
95
- }, z.core.$strict>]>>;
96
- lt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
97
- setting: z.ZodString;
98
- }, z.core.$strict>]>>;
99
- lte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
100
- setting: z.ZodString;
101
- }, z.core.$strict>]>>;
102
- }, z.core.$strict>]>>]>;
103
- type TrackerWhere = z.infer<typeof trackerWhereSchema>;
104
- /** The conditions of a filter, as a list. */
105
- declare function whereConditions(where: TrackerWhere | undefined): TrackerCondition[];
106
- /** The settings a filter compares with. */
107
- declare function whereSettings(where: TrackerWhere | undefined): string[];
108
- type Scalar = string | number | boolean;
109
- type Lower = [never, 0, 1, 2, 3, 4];
110
- /** The declared string keys of an object type, leaving out index signatures. */
111
- type KnownKeys<D> = keyof {
112
- [K in keyof D as string extends K ? never : number extends K ? never : K extends string ? K : never]: 0;
113
- };
114
- type LeafEntries<K extends string, V, N extends number> = unknown extends V ? {
115
- path: K | `${K}.${string}`;
116
- value: Scalar;
117
- } : ([Extract<V, Scalar>] extends [never] ? never : {
118
- path: K;
119
- value: Extract<V, Scalar>;
120
- }) | (DataLeaves<Exclude<V, Scalar | null | undefined>, Lower[N]> extends infer E ? E extends {
121
- path: infer P extends string;
122
- value: infer T;
123
- } ? {
124
- path: `${K}.${P}`;
125
- value: T;
126
- } : never : never);
168
+ type OpenIdentityKind = IdentityKind | (string & {});
169
+ /** Reads any identity kind a response carries; `identityKindSchema` checks the ones you send. */
170
+ declare const openIdentityKindSchema: z.ZodType<OpenIdentityKind>;
127
171
  /**
128
- * Every dot-separated path into `D` that ends at a string, number or boolean, with the value
129
- * there, to five levels deep. A record (`z.record`) takes any key; an object with declared keys
130
- * takes only those. Arrays end a path: filters do not index into them.
172
+ * One of a member's identities that trackers attribute records through, other than wallets and
173
+ * the member ID itself: the member's selected X and Discord accounts, and each `app:<name>`
174
+ * identity an identity integration linked in the project. `ctx.wallet.list()` lists wallets.
131
175
  */
132
- type DataLeaves<D, N extends number = 5> = [N] extends [never] ? never : D extends readonly unknown[] ? never : D extends object ? [KnownKeys<D>] extends [never] ? string extends keyof D ? LeafEntries<string, D[string & keyof D], N> : never : {
133
- [K in KnownKeys<D> & keyof D]-?: LeafEntries<K & string, D[K], N>;
134
- }[KnownKeys<D> & keyof D] : never;
135
- /** A filter bound: a number, or the quest's integer setting `S`. */
136
- type Bound<S extends string = string> = number | {
137
- setting: S;
138
- };
139
- type Comparison<S extends string> = {
140
- equals?: never;
141
- gt?: Bound<S>;
142
- gte?: Bound<S>;
143
- lt?: Bound<S>;
144
- lte?: Bound<S>;
145
- };
176
+ declare const memberIdentitySchema: z.ZodObject<{
177
+ kind: z.ZodType<OpenIdentityKind, unknown, z.core.$ZodTypeInternals<OpenIdentityKind, unknown>>;
178
+ subject: z.ZodString;
179
+ revision: z.ZodNumber;
180
+ linkedAt: z.ZodNullable<z.ZodNumber>;
181
+ }, z.core.$strip>;
182
+ type MemberIdentity = z.infer<typeof memberIdentitySchema>;
146
183
  /**
147
- * One filter condition on records whose `data` is `D`: `path` names a field, `equals` takes a
148
- * value that field can hold, and comparisons need a number or string (integer string) field.
149
- * Untyped data takes any path.
184
+ * A named account on a record, such as `author` or `inReplyTo`. A tracker-triggered quest pays the
185
+ * member behind one role, its `beneficiary`.
150
186
  */
151
- type Condition<D, S extends string = string> = unknown extends D ? TrackerCondition : DataLeaves<D> extends infer E ? E extends {
152
- path: infer P;
153
- value: infer V;
154
- } ? {
155
- path: P;
156
- equals: V;
157
- gt?: never;
158
- gte?: never;
159
- lt?: never;
160
- lte?: never;
161
- } | ([Extract<V, number | string>] extends [never] ? never : {
162
- path: P;
163
- } & Comparison<S>) : never : never;
164
- /** A typed filter: one condition, or a list of at most 10 conditions that must all hold. */
165
- type Where<D, S extends string = string> = Condition<D, S> | readonly [Condition<D, S>, ...Condition<D, S>[]];
166
- type BoundSetting<B> = B extends {
167
- setting: infer S extends string;
168
- } ? S : never;
169
- /** The setting names a filter compares with. */
170
- type WhereSetting<W> = W extends readonly (infer C)[] ? WhereSetting<C> : W extends object ? {
171
- [K in "gt" | "gte" | "lt" | "lte"]: K extends keyof W ? BoundSetting<W[K]> : never;
172
- }["gt" | "gte" | "lt" | "lte"] : never;
187
+ declare const accountRoleSchema: z.ZodString;
188
+ type AccountRole = z.infer<typeof accountRoleSchema>;
189
+ /** The roles an X post exposes: who wrote it, and whose post it replies to. */
190
+ declare const xAccountRoles: readonly ["author", "inReplyTo"];
191
+ /** A content metric's name, such as `likes` or `views`: a letter, then letters and digits. */
192
+ declare const contentMetricNameSchema: z.ZodString;
193
+ /** The counters an X search source measures on each post. */
194
+ declare const xContentMetrics: readonly ["likes", "replies", "reposts", "quotes", "views", "bookmarks"];
195
+ /** The metric names an X post's observation measures. */
196
+ type XContentMetric = (typeof xContentMetrics)[number];
173
197
  /**
174
- * Whether members must enroll in the quest (`relay.quests.enroll`) before their activity counts.
175
- * `"none"`, the default, counts every member who has joined the project.
198
+ * A custom source's content shape, as stored. The body schema is the `body` property of the
199
+ * source's `data` schema, which `customSource(namespace, { content })` derives as
200
+ * `{ body, metrics? }`; `metrics` lists the counters each observation may measure.
176
201
  */
177
- declare const triggerEnrollmentSchema: z.ZodEnum<{
178
- none: "none";
179
- required: "required";
180
- }>;
181
- type TriggerEnrollment = z.infer<typeof triggerEnrollmentSchema>;
202
+ declare const customContentSchema: z.ZodObject<{
203
+ metrics: z.ZodArray<z.ZodString>;
204
+ }, z.core.$strict>;
205
+ declare const xSearchSourceSchema: z.ZodObject<{
206
+ kind: z.ZodLiteral<"x-search">;
207
+ query: z.ZodString;
208
+ }, z.core.$strict>;
209
+ declare const customSourceSchema: z.ZodObject<{
210
+ kind: z.ZodLiteral<"custom">;
211
+ namespace: z.ZodString;
212
+ identities: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodEnum<{
213
+ member: "member";
214
+ discord: "discord";
215
+ x: "x";
216
+ wallet: "wallet";
217
+ }>, z.ZodTemplateLiteral<`app:${string}`>]>>>;
218
+ accounts: z.ZodOptional<z.ZodArray<z.ZodString>>;
219
+ data: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodType<TrackerDataSchema, unknown, z.core.$ZodTypeInternals<TrackerDataSchema, unknown>>>>;
220
+ content: z.ZodOptional<z.ZodObject<{
221
+ metrics: z.ZodArray<z.ZodString>;
222
+ }, z.core.$strict>>;
223
+ }, z.core.$strict>;
224
+ declare const trackerSourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
225
+ kind: z.ZodLiteral<"x-search">;
226
+ query: z.ZodString;
227
+ }, z.core.$strict>, z.ZodObject<{
228
+ kind: z.ZodLiteral<"custom">;
229
+ namespace: z.ZodString;
230
+ identities: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodEnum<{
231
+ member: "member";
232
+ discord: "discord";
233
+ x: "x";
234
+ wallet: "wallet";
235
+ }>, z.ZodTemplateLiteral<`app:${string}`>]>>>;
236
+ accounts: z.ZodOptional<z.ZodArray<z.ZodString>>;
237
+ data: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodType<TrackerDataSchema, unknown, z.core.$ZodTypeInternals<TrackerDataSchema, unknown>>>>;
238
+ content: z.ZodOptional<z.ZodObject<{
239
+ metrics: z.ZodArray<z.ZodString>;
240
+ }, z.core.$strict>>;
241
+ }, z.core.$strict>, z.ZodObject<{
242
+ kind: z.ZodLiteral<"discord-messages">;
243
+ text: z.ZodOptional<z.ZodBoolean>;
244
+ }, z.core.$strict>, z.ZodObject<{
245
+ kind: z.ZodLiteral<"discord-reactions">;
246
+ }, z.core.$strict>], "kind">;
247
+ type TrackerSource = z.infer<typeof trackerSourceSchema>;
248
+ /** Every kind of tracker source: X search, your own records, and the two Discord streams. */
249
+ declare const trackerSourceKinds: readonly ["x-search", "custom", "discord-messages", "discord-reactions"];
250
+ type TrackerSourceKind = (typeof trackerSourceKinds)[number];
182
251
  /**
183
- * The earliest activity a tracker trigger considers. `"activation"`, the default: records that
184
- * occurred since the quest was published (or last unarchived), others skipped with
185
- * `before-activation`. `"window"`: every record in the tracker's window. `"enrollment"`, with
186
- * required enrollment: records that occurred since the member enrolled, others skipped with
187
- * `before-enrollment`.
252
+ * The identity kinds a source's record accounts are: `x` for an X tracker, `discord` for a Discord
253
+ * one, a custom source's `identities`, or undefined when a custom source's authors are opaque IDs.
188
254
  */
189
- declare const triggerSinceSchema: z.ZodEnum<{
190
- window: "window";
191
- activation: "activation";
192
- enrollment: "enrollment";
193
- }>;
194
- type TriggerSince = z.infer<typeof triggerSinceSchema>;
255
+ declare function sourceIdentities(source: TrackerSource): IdentityKind[] | undefined;
256
+ declare function sourceIdentities(source: TrackerSourceResponse): OpenIdentityKind[] | undefined;
195
257
  /**
196
- * Who releases historical activity: a record that occurred before the member linked the account
197
- * it pays (an unknown link time counts as before), or before the member enrolled. `"staff"`: only
198
- * a reviewer's retry. `"claim"`: also the member, with `relay.quests.claim`. `"automatic"`: Relay
199
- * admits it like any other activity.
258
+ * The content a source's records carry, or undefined for one without content: an X search source
259
+ * measures the six X counters on each post body, and a custom source declares its metrics with
260
+ * `content`. Only a tracker whose source has content can trigger `content()` quests.
200
261
  */
201
- declare const triggerHistoricalSchema: z.ZodEnum<{
202
- staff: "staff";
203
- claim: "claim";
204
- automatic: "automatic";
205
- }>;
206
- type TriggerHistorical = z.infer<typeof triggerHistoricalSchema>;
262
+ declare function sourceContent(source: TrackerSource): {
263
+ metrics: readonly string[];
264
+ } | undefined;
207
265
  /**
208
- * A quest's tracker trigger as published: bound to the tracker's stable ID at publication.
209
- * Authoring materializes the firing mode so the stored policy is unambiguous.
266
+ * Type-only marker for the content a source's records carry: the body type `B` and the metric
267
+ * names `M`. Like `WithRecordData`, it never exists at runtime.
210
268
  */
211
- declare const trackerTriggerPolicySchema: z.ZodObject<{
212
- /** The tracker's authoring key; publication binds it to the tracker's stable ID. */
213
- tracker: z.ZodString;
214
- /**
215
- * The tracker's source kind, one of `trackerSourceKinds` today. An open string, so readers of
216
- * releases keep parsing them when a later Relay adds a managed source.
217
- */
218
- source: z.ZodString;
219
- /** Which observations fire. */
220
- on: z.ZodEnum<{
221
- "new-record": "new-record";
222
- "new-observation": "new-observation";
223
- "data-changed": "data-changed";
224
- }>;
225
- where: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
226
- path: z.ZodString;
227
- equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
228
- }, z.core.$strict>, z.ZodObject<{
229
- path: z.ZodString;
230
- gt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
231
- setting: z.ZodString;
232
- }, z.core.$strict>]>>;
233
- gte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
234
- setting: z.ZodString;
235
- }, z.core.$strict>]>>;
236
- lt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
237
- setting: z.ZodString;
238
- }, z.core.$strict>]>>;
239
- lte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
240
- setting: z.ZodString;
241
- }, z.core.$strict>]>>;
242
- }, z.core.$strict>]>, z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
243
- path: z.ZodString;
244
- equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
245
- }, z.core.$strict>, z.ZodObject<{
246
- path: z.ZodString;
247
- gt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
248
- setting: z.ZodString;
249
- }, z.core.$strict>]>>;
250
- gte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
251
- setting: z.ZodString;
252
- }, z.core.$strict>]>>;
253
- lt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
254
- setting: z.ZodString;
255
- }, z.core.$strict>]>>;
256
- lte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
257
- setting: z.ZodString;
258
- }, z.core.$strict>]>>;
259
- }, z.core.$strict>]>>]>>;
260
- /**
261
- * The record account the quest pays: `author`, `inReplyTo` for an X post, `messageAuthor` for a
262
- * Discord reaction, or a named account of a custom record. Relay attributes it through
263
- * verified links; evaluators cannot redirect it.
264
- */
265
- beneficiary: z.ZodString;
266
- /** Absent means `"none"`. */
267
- enrollment: z.ZodOptional<z.ZodEnum<{
268
- none: "none";
269
- required: "required";
270
- }>>;
271
- /** Absent means `"activation"`. */
272
- since: z.ZodOptional<z.ZodEnum<{
273
- window: "window";
274
- activation: "activation";
275
- enrollment: "enrollment";
276
- }>>;
277
- /** Absent means `"staff"`, or `"claim"` on a content quest. */
278
- historical: z.ZodOptional<z.ZodEnum<{
279
- staff: "staff";
280
- claim: "claim";
281
- automatic: "automatic";
282
- }>>;
283
- /**
284
- * A content quest (`content({ tracker })`): one completion per content item, a content stage
285
- * that re-evaluates edits and runs `performance`, firing on each new record and paying its
286
- * author.
287
- */
288
- content: z.ZodOptional<z.ZodLiteral<true>>;
289
- }, z.core.$strict>;
290
- type TrackerTriggerPolicy = z.infer<typeof trackerTriggerPolicySchema>;
291
- /** The firing mode a published policy uses. */
292
- declare function triggerMode(policy: Pick<TrackerTriggerPolicy, "on">): TrackerTriggerMode;
293
- /** A published policy's admission options, with their defaults filled in. */
294
- declare function triggerAdmission(policy: Pick<TrackerTriggerPolicy, "enrollment" | "since" | "historical" | "content">): {
295
- enrollment: TriggerEnrollment;
296
- since: TriggerSince;
297
- historical: TriggerHistorical;
269
+ declare const contentShape: unique symbol;
270
+ /** A source or tracker whose records carry content with body `B` and metrics `M`. */
271
+ type WithContent<B, M extends string> = {
272
+ readonly [contentShape]: {
273
+ body: B;
274
+ metrics: M;
275
+ };
298
276
  };
299
- /** The record role a published policy pays. */
300
- declare function beneficiaryRole(policy: Pick<TrackerTriggerPolicy, "beneficiary">): AccountRole;
277
+ /** The content body type of a content source or tracker. */
278
+ type ContentBody<T> = T extends WithContent<infer B, string> ? B : never;
279
+ /** The metric names a content source or tracker measures. */
280
+ type ContentMetricName<T> = T extends WithContent<unknown, infer M> ? M : never;
301
281
  /**
302
- * Who the record pays and through which verified link, captured at admission. `account.provider`
303
- * is the beneficiary account's identity kind. A kind a later Relay adds reads as the last variant,
304
- * `{ provider: string }`, so branch on `provider` with a default branch.
282
+ * Type-only marker for the `data` a source's records carry. It never exists at runtime: sources
283
+ * and trackers stay plain, serializable definitions.
305
284
  */
306
- declare const trackerAttributionSchema: z.ZodObject<{
307
- member: z.ZodString;
308
- capturedAt: z.ZodNumber;
309
- account: z.ZodUnion<readonly [z.ZodObject<{
310
- provider: z.ZodLiteral<"wallet">;
311
- id: z.ZodString;
312
- revision: z.ZodNumber;
313
- linkedAt: z.ZodNullable<z.ZodNumber>;
314
- }, z.core.$strip>, z.ZodObject<{
315
- issuer: z.ZodString;
316
- subject: z.ZodString;
317
- revision: z.ZodNumber;
318
- linkedAt: z.ZodNullable<z.ZodNumber>;
319
- provider: z.ZodLiteral<"x">;
320
- }, z.core.$strip>, z.ZodObject<{
321
- issuer: z.ZodString;
322
- subject: z.ZodString;
323
- revision: z.ZodNumber;
324
- linkedAt: z.ZodNullable<z.ZodNumber>;
325
- provider: z.ZodLiteral<"discord">;
326
- }, z.core.$strip>, z.ZodObject<{
327
- provider: z.ZodLiteral<"member">;
328
- id: z.ZodString;
329
- }, z.core.$strip>, z.ZodObject<{
330
- provider: z.ZodTemplateLiteral<`app:${string}`>;
331
- subject: z.ZodString;
332
- revision: z.ZodNumber;
333
- linkedAt: z.ZodNullable<z.ZodNumber>;
334
- }, z.core.$strip>, z.ZodObject<{
335
- provider: z.ZodString;
336
- }, z.core.$strip>]>;
337
- }, z.core.$strip>;
338
- type TrackerAttribution = z.infer<typeof trackerAttributionSchema>;
339
- /** The record observation that triggered the attempt, as stored. */
340
- declare const trackerTriggerRecordSchema: z.ZodObject<{
341
- id: z.ZodString;
342
- source: z.ZodString;
343
- occurredAt: z.ZodNumber;
344
- observedAt: z.ZodNumber;
345
- firstSeenAt: z.ZodNumber;
346
- author: z.ZodNullable<z.ZodObject<{
347
- id: z.ZodString;
348
- verified: z.ZodNullable<z.ZodBoolean>;
349
- kind: z.ZodOptional<z.ZodType<OpenIdentityKind, unknown, z.core.$ZodTypeInternals<OpenIdentityKind, unknown>>>;
350
- }, z.core.$strip>>;
351
- accounts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
352
- kind: z.ZodOptional<z.ZodType<OpenIdentityKind, unknown, z.core.$ZodTypeInternals<OpenIdentityKind, unknown>>>;
353
- id: z.ZodString;
354
- }, z.core.$strip>>>;
355
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
356
- removed: z.ZodBoolean;
357
- }, z.core.$strip>;
358
- /** The captured content of one observation: the body, its revision, and the observation. */
359
- declare const trackerContentStageSchema: z.ZodObject<{
360
- revision: z.ZodString;
361
- observation: z.ZodString;
362
- body: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
363
- }, z.core.$strip>;
364
- /** Immutable admission input of a tracker-triggered attempt: the pinned observation and who it pays. */
365
- declare const trackerTriggerContextSchema: z.ZodObject<{
366
- tracker: z.ZodString;
367
- key: z.ZodString;
368
- beneficiary: z.ZodString;
369
- record: z.ZodObject<{
370
- id: z.ZodString;
371
- source: z.ZodString;
372
- occurredAt: z.ZodNumber;
373
- observedAt: z.ZodNumber;
374
- firstSeenAt: z.ZodNumber;
375
- author: z.ZodNullable<z.ZodObject<{
376
- id: z.ZodString;
377
- verified: z.ZodNullable<z.ZodBoolean>;
378
- kind: z.ZodOptional<z.ZodType<OpenIdentityKind, unknown, z.core.$ZodTypeInternals<OpenIdentityKind, unknown>>>;
379
- }, z.core.$strip>>;
380
- accounts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
381
- kind: z.ZodOptional<z.ZodType<OpenIdentityKind, unknown, z.core.$ZodTypeInternals<OpenIdentityKind, unknown>>>;
382
- id: z.ZodString;
383
- }, z.core.$strip>>>;
384
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
385
- removed: z.ZodBoolean;
386
- }, z.core.$strip>;
387
- content: z.ZodOptional<z.ZodObject<{
388
- revision: z.ZodString;
389
- observation: z.ZodString;
390
- body: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
391
- }, z.core.$strip>>;
392
- attribution: z.ZodObject<{
393
- member: z.ZodString;
394
- capturedAt: z.ZodNumber;
395
- account: z.ZodUnion<readonly [z.ZodObject<{
396
- provider: z.ZodLiteral<"wallet">;
397
- id: z.ZodString;
398
- revision: z.ZodNumber;
399
- linkedAt: z.ZodNullable<z.ZodNumber>;
400
- }, z.core.$strip>, z.ZodObject<{
401
- issuer: z.ZodString;
402
- subject: z.ZodString;
403
- revision: z.ZodNumber;
404
- linkedAt: z.ZodNullable<z.ZodNumber>;
405
- provider: z.ZodLiteral<"x">;
406
- }, z.core.$strip>, z.ZodObject<{
407
- issuer: z.ZodString;
408
- subject: z.ZodString;
409
- revision: z.ZodNumber;
410
- linkedAt: z.ZodNullable<z.ZodNumber>;
411
- provider: z.ZodLiteral<"discord">;
412
- }, z.core.$strip>, z.ZodObject<{
413
- provider: z.ZodLiteral<"member">;
414
- id: z.ZodString;
415
- }, z.core.$strip>, z.ZodObject<{
416
- provider: z.ZodTemplateLiteral<`app:${string}`>;
417
- subject: z.ZodString;
418
- revision: z.ZodNumber;
419
- linkedAt: z.ZodNullable<z.ZodNumber>;
420
- }, z.core.$strip>, z.ZodObject<{
421
- provider: z.ZodString;
422
- }, z.core.$strip>]>;
423
- }, z.core.$strip>;
424
- enrolledAt: z.ZodOptional<z.ZodNumber>;
425
- }, z.core.$strip>;
426
- /**
427
- * The pinned observation of a tracker-triggered attempt. With a typed tracker, `record.data` has
428
- * the tracker's data type: ingestion validated it against the tracker's schema.
429
- */
430
- type ContextShape = z.infer<typeof trackerTriggerContextSchema>;
431
- type ContextRecord<D> = unknown extends D ? {
432
- record: ContextShape["record"];
433
- } : {
434
- record: Omit<ContextShape["record"], "data"> & {
435
- data: D;
436
- };
437
- };
438
- type ContextContent<B> = [B] extends [never] ? {
439
- content?: ContextShape["content"];
440
- } : {
441
- content: Omit<NonNullable<ContextShape["content"]>, "body"> & {
442
- body: B;
443
- };
285
+ declare const recordData: unique symbol;
286
+ /** A source or tracker whose records carry `data` of type `D`. */
287
+ type WithRecordData<D> = {
288
+ readonly [recordData]?: D;
444
289
  };
445
290
  /**
446
- * The pinned observation of a tracker-triggered attempt. With a typed tracker, `record.data` has
447
- * the tracker's data type: ingestion validated it against the tracker's schema. On a content
448
- * source, `content.body` has the source's body type.
291
+ * The record `data` type of a source or tracker: the provider payload for X, the declared schema's
292
+ * input type for a custom source, or `unknown` for one that declares none.
449
293
  */
450
- type TrackerTriggerContext<D = unknown, B = never> = Omit<ContextShape, "record" | "content"> & ContextRecord<D> & ContextContent<B>;
451
-
294
+ type TrackerData<T> = T extends WithRecordData<infer D> ? unknown extends D ? unknown : D : unknown;
295
+ declare const trackerDefinitionSchema: z.ZodObject<{
296
+ key: z.ZodString;
297
+ title: z.ZodString;
298
+ source: z.ZodDiscriminatedUnion<[z.ZodObject<{
299
+ kind: z.ZodLiteral<"x-search">;
300
+ query: z.ZodString;
301
+ }, z.core.$strict>, z.ZodObject<{
302
+ kind: z.ZodLiteral<"custom">;
303
+ namespace: z.ZodString;
304
+ identities: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodEnum<{
305
+ member: "member";
306
+ discord: "discord";
307
+ x: "x";
308
+ wallet: "wallet";
309
+ }>, z.ZodTemplateLiteral<`app:${string}`>]>>>;
310
+ accounts: z.ZodOptional<z.ZodArray<z.ZodString>>;
311
+ data: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodType<TrackerDataSchema, unknown, z.core.$ZodTypeInternals<TrackerDataSchema, unknown>>>>;
312
+ content: z.ZodOptional<z.ZodObject<{
313
+ metrics: z.ZodArray<z.ZodString>;
314
+ }, z.core.$strict>>;
315
+ }, z.core.$strict>, z.ZodObject<{
316
+ kind: z.ZodLiteral<"discord-messages">;
317
+ text: z.ZodOptional<z.ZodBoolean>;
318
+ }, z.core.$strict>, z.ZodObject<{
319
+ kind: z.ZodLiteral<"discord-reactions">;
320
+ }, z.core.$strict>], "kind">;
321
+ window: z.ZodObject<{
322
+ start: z.ZodNumber;
323
+ end: z.ZodOptional<z.ZodNumber>;
324
+ }, z.core.$strict>;
325
+ refreshSeconds: z.ZodDefault<z.ZodNumber>;
326
+ maxPages: z.ZodDefault<z.ZodNumber>;
327
+ }, z.core.$strict>;
328
+ declare const trackerArtifactSchema: z.ZodUnion<readonly [z.ZodObject<{
329
+ key: z.ZodString;
330
+ title: z.ZodString;
331
+ source: z.ZodDiscriminatedUnion<[z.ZodObject<{
332
+ kind: z.ZodLiteral<"x-search">;
333
+ query: z.ZodString;
334
+ }, z.core.$strict>, z.ZodObject<{
335
+ kind: z.ZodLiteral<"custom">;
336
+ namespace: z.ZodString;
337
+ identities: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodEnum<{
338
+ member: "member";
339
+ discord: "discord";
340
+ x: "x";
341
+ wallet: "wallet";
342
+ }>, z.ZodTemplateLiteral<`app:${string}`>]>>>;
343
+ accounts: z.ZodOptional<z.ZodArray<z.ZodString>>;
344
+ data: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodType<TrackerDataSchema, unknown, z.core.$ZodTypeInternals<TrackerDataSchema, unknown>>>>;
345
+ content: z.ZodOptional<z.ZodObject<{
346
+ metrics: z.ZodArray<z.ZodString>;
347
+ }, z.core.$strict>>;
348
+ }, z.core.$strict>, z.ZodObject<{
349
+ kind: z.ZodLiteral<"discord-messages">;
350
+ text: z.ZodOptional<z.ZodBoolean>;
351
+ }, z.core.$strict>, z.ZodObject<{
352
+ kind: z.ZodLiteral<"discord-reactions">;
353
+ }, z.core.$strict>], "kind">;
354
+ window: z.ZodObject<{
355
+ start: z.ZodNumber;
356
+ end: z.ZodOptional<z.ZodNumber>;
357
+ }, z.core.$strict>;
358
+ refreshSeconds: z.ZodDefault<z.ZodNumber>;
359
+ maxPages: z.ZodDefault<z.ZodNumber>;
360
+ }, z.core.$strict>, z.ZodObject<{
361
+ code: z.ZodString;
362
+ }, z.core.$strict>]>;
363
+ type TrackerDefinition = z.infer<typeof trackerDefinitionSchema>;
452
364
  /**
453
- * The serializable form of a custom tracker's record `data` schema: a subset of JSON Schema
454
- * (draft 2020-12) that `customSource(namespace, { data })` derives from a zod schema. It is stored
455
- * with the tracker definition, and ingestion validates each record's `data` against it. The subset
456
- * leaves out string patterns and formats, whose regular expressions Relay would otherwise run on
457
- * every ingested record, and every keyword whose meaning needs references or evaluation state.
365
+ * A tracker definition whose records carry `data` of type `D`. Quests reference it as a handle:
366
+ * `where` paths and `ctx.tracker.record.data` follow from `D`.
458
367
  */
459
- type TrackerDataSchema = {
460
- type?: "object" | "array" | "string" | "number" | "integer" | "boolean" | "null";
461
- properties?: Record<string, TrackerDataSchema>;
462
- required?: string[];
463
- additionalProperties?: boolean | TrackerDataSchema;
464
- propertyNames?: {
465
- type: "string";
466
- enum?: string[];
467
- };
468
- items?: TrackerDataSchema;
469
- minItems?: number;
470
- maxItems?: number;
471
- minLength?: number;
472
- maxLength?: number;
473
- minimum?: number;
474
- maximum?: number;
475
- exclusiveMinimum?: number;
476
- exclusiveMaximum?: number;
477
- enum?: (string | number | boolean | null)[];
478
- const?: string | number | boolean | null;
479
- anyOf?: TrackerDataSchema[];
480
- oneOf?: TrackerDataSchema[];
481
- allOf?: TrackerDataSchema[];
482
- };
483
- /** The most branches one union may list. */
484
- declare const trackerDataMaxBranches = 16;
485
- /** The most properties, `required` keys, enum values or allowed key names one schema node lists. */
486
- declare const trackerDataMaxEntries = 256;
487
- /**
488
- * A stored tracker data schema: an object schema in the supported subset, at most 32 KB and
489
- * nested at most 16 levels deep, whose unions list at most 16 branches and, inside another union's
490
- * branch, at most one branch with properties, items or unions of its own, and whose nodes list at
491
- * most 256 properties, `required` keys, enum values or allowed key names.
492
- */
493
- declare const trackerDataSchemaSchema: z.ZodPipe<z.ZodUnknown, z.ZodType<TrackerDataSchema, unknown, z.core.$ZodTypeInternals<TrackerDataSchema, unknown>>>;
494
- /**
495
- * Converts a zod object schema into the tracker data subset. Throws, naming the field, for types
496
- * JSON cannot carry (dates, bigints), for refinements and transforms, which Relay cannot run at
497
- * ingestion, and for string patterns and formats.
498
- */
499
- declare function trackerDataSchema(schema: z.ZodType): TrackerDataSchema;
500
- /**
501
- * Why a record's data does not match its tracker's schema. `too-complex` means validation spent
502
- * its step budget before deciding.
503
- */
504
- type TrackerDataIssue = {
505
- kind: "mismatch" | "too-complex";
506
- path: string;
507
- reason: string;
508
- };
509
- /**
510
- * Validation steps one record may use. Every unit of work costs a step: each schema node visited
511
- * for a value, each object key and `required` key checked, each literal property scanned, each enum
512
- * lookup. A step costs well under a microsecond, so one record stays within tens of milliseconds.
513
- */
514
- declare const trackerDataRecordSteps = 250000;
515
- /** Validation steps one ingest batch, or one page of records, may use across its records. */
516
- declare const trackerDataBatchSteps = 6000000;
517
- /** A step allowance that validation draws down; share one across a batch. */
518
- type TrackerDataBudget = {
519
- steps: number;
520
- };
521
- /**
522
- * The first way a record's `data` fails its tracker's schema, or null when it matches. Validation
523
- * draws on `budget`, which defaults to one record's allowance; when it runs out the result is a
524
- * `too-complex` issue rather than a decision.
525
- */
526
- declare function trackerDataIssue(schema: TrackerDataSchema, data: unknown, budget?: TrackerDataBudget): TrackerDataIssue | null;
527
- /**
528
- * Validates several records' data on one shared allowance: each record may use at most one
529
- * record's steps, and all of them together at most one batch's. Returns each record's issue, in
530
- * order; once the allowance is spent, every remaining record is `too-complex`.
531
- */
532
- declare function trackerDataIssues(schema: TrackerDataSchema, records: readonly unknown[]): (TrackerDataIssue | null)[];
533
- /**
534
- * The JSON types the value at a dot-separated `data` path can have under the schema, or null when
535
- * the schema declares no such path. A key must be a declared property, or fall under a record's or
536
- * loose object's value schema; an unconstrained value (`z.unknown()`) has every path and type.
537
- */
538
- declare function trackerDataPathTypes(schema: TrackerDataSchema, path: string): Set<string> | null;
539
- /**
540
- * Wraps a reader so `records(handle)` returns only records whose data matches the handle's data
541
- * schema, the one the quest's types come from, and counts the rest in `excluded`. Reads by key
542
- * string and of managed trackers (X and Discord), whose records Relay writes, pass through.
543
- */
544
- declare function schemaCheckedReader(reader: TrackerReader): TrackerReader;
545
- /**
546
- * Why a filter cannot match records of a tracker's declared data schema, or null when it can: each
547
- * path must be declared, `equals` must name a value its field can hold, and a comparison needs a
548
- * number or string field.
549
- */
550
- declare function whereSchemaIssue(schema: TrackerDataSchema, where: TrackerWhere | undefined): string | null;
551
-
552
- /** Keep provider fields, including verification details, rather than projecting them away. */
553
- declare const xTweetSchema: z.ZodObject<{
554
- id: z.ZodString;
555
- userId: z.ZodString;
556
- content: z.ZodString;
557
- createdAt: z.ZodISODateTime;
558
- author: z.ZodObject<{
559
- id: z.ZodString;
560
- username: z.ZodString;
561
- name: z.ZodString;
562
- verified: z.ZodDefault<z.ZodNullable<z.ZodBoolean>>;
563
- }, z.core.$loose>;
564
- likeCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
565
- replyCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
566
- retweetCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
567
- quoteCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
568
- viewCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
569
- bookmarkCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
570
- isReply: z.ZodBoolean;
571
- isRetweet: z.ZodBoolean;
572
- isQuoteTweet: z.ZodBoolean;
573
- }, z.core.$loose>;
574
- type XTweet = z.infer<typeof xTweetSchema>;
575
- /** Matches tracker_x_content_body_v1 in migration 0054. Version projection changes;
576
- * retained bodies must remain readable without rewriting their evidence identities. */
577
- declare const xContentBodySchema: z.ZodObject<{
578
- version: z.ZodLiteral<1>;
579
- id: z.ZodString;
580
- authorId: z.ZodString;
581
- publishedAt: z.ZodNumber;
582
- text: z.ZodString;
583
- isReply: z.ZodBoolean;
584
- isRetweet: z.ZodBoolean;
585
- isQuoteTweet: z.ZodBoolean;
586
- media: z.ZodNullable<z.ZodArray<z.ZodObject<{
587
- type: z.ZodString;
588
- url: z.ZodString;
589
- }, z.core.$strict>>>;
590
- mentionedAuthorIds: z.ZodNullable<z.ZodArray<z.ZodString>>;
591
- videoLengthSeconds: z.ZodNullable<z.ZodNumber>;
592
- references: z.ZodObject<{
593
- replyId: z.ZodNullable<z.ZodString>;
594
- replyAuthorId: z.ZodNullable<z.ZodString>;
595
- quoteId: z.ZodNullable<z.ZodString>;
596
- quoteAuthorId: z.ZodNullable<z.ZodString>;
597
- repostId: z.ZodNullable<z.ZodString>;
598
- repostAuthorId: z.ZodNullable<z.ZodString>;
599
- }, z.core.$strict>;
600
- }, z.core.$strict>;
601
- declare const trackerContentQuerySchema: z.ZodObject<{
602
- id: z.ZodString;
603
- observation: z.ZodString;
604
- }, z.core.$strict>;
605
- type TrackerContentQuery = z.infer<typeof trackerContentQuerySchema>;
606
- declare const trackerContentReadSchema: z.ZodObject<{
607
- id: z.ZodString;
608
- observation: z.ZodString;
609
- member: z.ZodString;
610
- }, z.core.$strict>;
611
- declare const trackerEvidenceSchema: z.ZodObject<{
612
- contentRevision: z.ZodString;
613
- observation: z.ZodString;
614
- }, z.core.$strict>;
615
- declare const trackerContentSchema: z.ZodObject<{
616
- tracker: z.ZodString;
617
- source: z.ZodLiteral<"x">;
618
- evidence: z.ZodObject<{
619
- contentRevision: z.ZodString;
620
- observation: z.ZodString;
621
- }, z.core.$strict>;
622
- content: z.ZodObject<{
623
- version: z.ZodLiteral<1>;
624
- id: z.ZodString;
625
- authorId: z.ZodString;
626
- publishedAt: z.ZodNumber;
627
- text: z.ZodString;
628
- isReply: z.ZodBoolean;
629
- isRetweet: z.ZodBoolean;
630
- isQuoteTweet: z.ZodBoolean;
631
- media: z.ZodNullable<z.ZodArray<z.ZodObject<{
632
- type: z.ZodString;
633
- url: z.ZodString;
634
- }, z.core.$strict>>>;
635
- mentionedAuthorIds: z.ZodNullable<z.ZodArray<z.ZodString>>;
636
- videoLengthSeconds: z.ZodNullable<z.ZodNumber>;
637
- references: z.ZodObject<{
638
- replyId: z.ZodNullable<z.ZodString>;
639
- replyAuthorId: z.ZodNullable<z.ZodString>;
640
- quoteId: z.ZodNullable<z.ZodString>;
641
- quoteAuthorId: z.ZodNullable<z.ZodString>;
642
- repostId: z.ZodNullable<z.ZodString>;
643
- repostAuthorId: z.ZodNullable<z.ZodString>;
644
- }, z.core.$strict>;
645
- }, z.core.$strict>;
646
- observedAt: z.ZodNumber;
647
- removed: z.ZodBoolean;
648
- attribution: z.ZodDiscriminatedUnion<[z.ZodObject<{
649
- kind: z.ZodLiteral<"linked">;
650
- account: z.ZodObject<{
651
- provider: z.ZodLiteral<"x">;
652
- issuer: z.ZodString;
653
- subject: z.ZodString;
654
- revision: z.ZodNumber;
655
- linkedAt: z.ZodNullable<z.ZodNumber>;
656
- }, z.core.$strict>;
657
- member: z.ZodString;
658
- capturedAt: z.ZodNumber;
659
- }, z.core.$strict>, z.ZodObject<{
660
- kind: z.ZodLiteral<"unlinked">;
661
- member: z.ZodString;
662
- capturedAt: z.ZodNumber;
663
- }, z.core.$strict>, z.ZodObject<{
664
- kind: z.ZodLiteral<"different-author">;
665
- member: z.ZodString;
666
- capturedAt: z.ZodNumber;
667
- }, z.core.$strict>], "kind">;
668
- }, z.core.$strict>;
669
- type TrackerContent = z.infer<typeof trackerContentSchema>;
670
- /** The identity kinds Relay defines. Your own app's kinds are `app:<name>`. */
671
- declare const knownIdentityKinds: readonly ["wallet", "x", "discord", "member"];
672
- type KnownIdentityKind = (typeof knownIdentityKinds)[number];
673
- /**
674
- * An identity kind your app owns: `app:` and a name of lowercase letters, digits, `_` or `-`
675
- * (at most 40), such as `app:telegram` or `app:acme`. The identity integration created with this
676
- * kind is the only one that can link it: each member it signs in gets the app's subject as an
677
- * identity of this kind in the project.
678
- */
679
- declare const appIdentityKindSchema: z.ZodTemplateLiteral<`app:${string}`>;
680
- type AppIdentityKind = `app:${string}`;
681
- /**
682
- * The verified identities a custom tracker's record accounts can be. Relay attributes each to a
683
- * member through a verified link: `wallet` a canonical CAIP-10 account ID the member linked, `x`
684
- * and `discord` the stable user ID of the member's selected account, `member` a Domino member ID,
685
- * and `app:<name>` the subject your app's identity integration signed the member in with.
686
- */
687
- declare const identityKindSchema: z.ZodUnion<readonly [z.ZodEnum<{
688
- member: "member";
689
- discord: "discord";
690
- x: "x";
691
- wallet: "wallet";
692
- }>, z.ZodTemplateLiteral<`app:${string}`>]>;
693
- type IdentityKind = KnownIdentityKind | AppIdentityKind;
694
- /** Whether a kind is one your app owns, `app:<name>`. */
695
- declare const isAppIdentityKind: (kind: string) => kind is AppIdentityKind;
696
- /**
697
- * An identity kind as responses and evaluator contexts carry it: one of `IdentityKind`, or a kind
698
- * a later Relay adds. Compare it with the kinds you handle and keep a default branch.
699
- */
700
- type OpenIdentityKind = IdentityKind | (string & {});
701
- /** Reads any identity kind a response carries; `identityKindSchema` checks the ones you send. */
702
- declare const openIdentityKindSchema: z.ZodType<OpenIdentityKind>;
703
- /**
704
- * One of a member's identities that trackers attribute records through, other than wallets and
705
- * the member ID itself: the member's selected X and Discord accounts, and each `app:<name>`
706
- * identity an identity integration linked in the project. `ctx.wallet.list()` lists wallets.
707
- */
708
- declare const memberIdentitySchema: z.ZodObject<{
709
- kind: z.ZodType<OpenIdentityKind, unknown, z.core.$ZodTypeInternals<OpenIdentityKind, unknown>>;
710
- subject: z.ZodString;
711
- revision: z.ZodNumber;
712
- linkedAt: z.ZodNullable<z.ZodNumber>;
713
- }, z.core.$strip>;
714
- type MemberIdentity = z.infer<typeof memberIdentitySchema>;
715
- /**
716
- * A named account on a record, such as `author` or `inReplyTo`. A tracker-triggered quest pays the
717
- * member behind one role, its `beneficiary`.
718
- */
719
- declare const accountRoleSchema: z.ZodString;
720
- type AccountRole = z.infer<typeof accountRoleSchema>;
721
- /** The roles an X post exposes: who wrote it, and whose post it replies to. */
722
- declare const xAccountRoles: readonly ["author", "inReplyTo"];
723
- /** A content metric's name, such as `likes` or `views`: a letter, then letters and digits. */
724
- declare const contentMetricNameSchema: z.ZodString;
725
- /** The counters an X search source measures on each post. */
726
- declare const xContentMetrics: readonly ["likes", "replies", "reposts", "quotes", "views", "bookmarks"];
727
- /** The metric names an X post's observation measures. */
728
- type XContentMetric = (typeof xContentMetrics)[number];
729
- /**
730
- * A custom source's content shape, as stored. The body schema is the `body` property of the
731
- * source's `data` schema, which `customSource(namespace, { content })` derives as
732
- * `{ body, metrics? }`; `metrics` lists the counters each observation may measure.
733
- */
734
- declare const customContentSchema: z.ZodObject<{
735
- metrics: z.ZodArray<z.ZodString>;
736
- }, z.core.$strict>;
737
- declare const xSearchSourceSchema: z.ZodObject<{
738
- kind: z.ZodLiteral<"x-search">;
739
- query: z.ZodString;
740
- }, z.core.$strict>;
741
- declare const customSourceSchema: z.ZodObject<{
742
- kind: z.ZodLiteral<"custom">;
743
- namespace: z.ZodString;
744
- identities: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodEnum<{
745
- member: "member";
746
- discord: "discord";
747
- x: "x";
748
- wallet: "wallet";
749
- }>, z.ZodTemplateLiteral<`app:${string}`>]>>>;
750
- accounts: z.ZodOptional<z.ZodArray<z.ZodString>>;
751
- data: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodType<TrackerDataSchema, unknown, z.core.$ZodTypeInternals<TrackerDataSchema, unknown>>>>;
752
- content: z.ZodOptional<z.ZodObject<{
753
- metrics: z.ZodArray<z.ZodString>;
754
- }, z.core.$strict>>;
755
- }, z.core.$strict>;
756
- declare const trackerSourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
757
- kind: z.ZodLiteral<"x-search">;
758
- query: z.ZodString;
759
- }, z.core.$strict>, z.ZodObject<{
760
- kind: z.ZodLiteral<"custom">;
761
- namespace: z.ZodString;
762
- identities: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodEnum<{
763
- member: "member";
764
- discord: "discord";
765
- x: "x";
766
- wallet: "wallet";
767
- }>, z.ZodTemplateLiteral<`app:${string}`>]>>>;
768
- accounts: z.ZodOptional<z.ZodArray<z.ZodString>>;
769
- data: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodType<TrackerDataSchema, unknown, z.core.$ZodTypeInternals<TrackerDataSchema, unknown>>>>;
770
- content: z.ZodOptional<z.ZodObject<{
771
- metrics: z.ZodArray<z.ZodString>;
772
- }, z.core.$strict>>;
773
- }, z.core.$strict>, z.ZodObject<{
774
- kind: z.ZodLiteral<"discord-messages">;
775
- text: z.ZodOptional<z.ZodBoolean>;
776
- }, z.core.$strict>, z.ZodObject<{
777
- kind: z.ZodLiteral<"discord-reactions">;
778
- }, z.core.$strict>], "kind">;
779
- type TrackerSource = z.infer<typeof trackerSourceSchema>;
780
- /** Every kind of tracker source: X search, your own records, and the two Discord streams. */
781
- declare const trackerSourceKinds: readonly ["x-search", "custom", "discord-messages", "discord-reactions"];
782
- type TrackerSourceKind = (typeof trackerSourceKinds)[number];
783
- /**
784
- * The identity kinds a source's record accounts are: `x` for an X tracker, `discord` for a Discord
785
- * one, a custom source's `identities`, or undefined when a custom source's authors are opaque IDs.
786
- */
787
- declare function sourceIdentities(source: TrackerSource): IdentityKind[] | undefined;
788
- declare function sourceIdentities(source: TrackerSourceResponse): OpenIdentityKind[] | undefined;
789
- /**
790
- * The content a source's records carry, or undefined for one without content: an X search source
791
- * measures the six X counters on each post body, and a custom source declares its metrics with
792
- * `content`. Only a tracker whose source has content can trigger `content()` quests.
793
- */
794
- declare function sourceContent(source: TrackerSource): {
795
- metrics: readonly string[];
796
- } | undefined;
797
- /**
798
- * Type-only marker for the content a source's records carry: the body type `B` and the metric
799
- * names `M`. Like `WithRecordData`, it never exists at runtime.
800
- */
801
- declare const contentShape: unique symbol;
802
- /** A source or tracker whose records carry content with body `B` and metrics `M`. */
803
- type WithContent<B, M extends string> = {
804
- readonly [contentShape]: {
805
- body: B;
806
- metrics: M;
807
- };
808
- };
809
- /** The content body type of a content source or tracker. */
810
- type ContentBody<T> = T extends WithContent<infer B, string> ? B : never;
811
- /** The metric names a content source or tracker measures. */
812
- type ContentMetricName<T> = T extends WithContent<unknown, infer M> ? M : never;
813
- /**
814
- * Type-only marker for the `data` a source's records carry. It never exists at runtime: sources
815
- * and trackers stay plain, serializable definitions.
816
- */
817
- declare const recordData: unique symbol;
818
- /** A source or tracker whose records carry `data` of type `D`. */
819
- type WithRecordData<D> = {
820
- readonly [recordData]?: D;
821
- };
822
- /**
823
- * The record `data` type of a source or tracker: the provider payload for X, the declared schema's
824
- * input type for a custom source, or `unknown` for one that declares none.
825
- */
826
- type TrackerData<T> = T extends WithRecordData<infer D> ? unknown extends D ? unknown : D : unknown;
827
- declare const trackerDefinitionSchema: z.ZodObject<{
828
- key: z.ZodString;
829
- title: z.ZodString;
830
- source: z.ZodDiscriminatedUnion<[z.ZodObject<{
831
- kind: z.ZodLiteral<"x-search">;
832
- query: z.ZodString;
833
- }, z.core.$strict>, z.ZodObject<{
834
- kind: z.ZodLiteral<"custom">;
835
- namespace: z.ZodString;
836
- identities: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodEnum<{
837
- member: "member";
838
- discord: "discord";
839
- x: "x";
840
- wallet: "wallet";
841
- }>, z.ZodTemplateLiteral<`app:${string}`>]>>>;
842
- accounts: z.ZodOptional<z.ZodArray<z.ZodString>>;
843
- data: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodType<TrackerDataSchema, unknown, z.core.$ZodTypeInternals<TrackerDataSchema, unknown>>>>;
844
- content: z.ZodOptional<z.ZodObject<{
845
- metrics: z.ZodArray<z.ZodString>;
846
- }, z.core.$strict>>;
847
- }, z.core.$strict>, z.ZodObject<{
848
- kind: z.ZodLiteral<"discord-messages">;
849
- text: z.ZodOptional<z.ZodBoolean>;
850
- }, z.core.$strict>, z.ZodObject<{
851
- kind: z.ZodLiteral<"discord-reactions">;
852
- }, z.core.$strict>], "kind">;
853
- window: z.ZodObject<{
854
- start: z.ZodNumber;
855
- end: z.ZodOptional<z.ZodNumber>;
856
- }, z.core.$strict>;
857
- refreshSeconds: z.ZodDefault<z.ZodNumber>;
858
- maxPages: z.ZodDefault<z.ZodNumber>;
859
- }, z.core.$strict>;
860
- declare const trackerArtifactSchema: z.ZodUnion<readonly [z.ZodObject<{
861
- key: z.ZodString;
862
- title: z.ZodString;
863
- source: z.ZodDiscriminatedUnion<[z.ZodObject<{
864
- kind: z.ZodLiteral<"x-search">;
865
- query: z.ZodString;
866
- }, z.core.$strict>, z.ZodObject<{
867
- kind: z.ZodLiteral<"custom">;
868
- namespace: z.ZodString;
869
- identities: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodEnum<{
870
- member: "member";
871
- discord: "discord";
872
- x: "x";
873
- wallet: "wallet";
874
- }>, z.ZodTemplateLiteral<`app:${string}`>]>>>;
875
- accounts: z.ZodOptional<z.ZodArray<z.ZodString>>;
876
- data: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodType<TrackerDataSchema, unknown, z.core.$ZodTypeInternals<TrackerDataSchema, unknown>>>>;
877
- content: z.ZodOptional<z.ZodObject<{
878
- metrics: z.ZodArray<z.ZodString>;
879
- }, z.core.$strict>>;
880
- }, z.core.$strict>, z.ZodObject<{
881
- kind: z.ZodLiteral<"discord-messages">;
882
- text: z.ZodOptional<z.ZodBoolean>;
883
- }, z.core.$strict>, z.ZodObject<{
884
- kind: z.ZodLiteral<"discord-reactions">;
885
- }, z.core.$strict>], "kind">;
886
- window: z.ZodObject<{
887
- start: z.ZodNumber;
888
- end: z.ZodOptional<z.ZodNumber>;
889
- }, z.core.$strict>;
890
- refreshSeconds: z.ZodDefault<z.ZodNumber>;
891
- maxPages: z.ZodDefault<z.ZodNumber>;
892
- }, z.core.$strict>, z.ZodObject<{
893
- code: z.ZodString;
894
- }, z.core.$strict>]>;
895
- type TrackerDefinition = z.infer<typeof trackerDefinitionSchema>;
896
- /**
897
- * A tracker definition whose records carry `data` of type `D`. Quests reference it as a handle:
898
- * `where` paths and `ctx.tracker.record.data` follow from `D`.
899
- */
900
- /** Type-only source roles, preserved by authoring handles after runtime schema validation. */
901
- declare const accountRoles: unique symbol;
902
- type WithAccountRoles<R extends string> = {
903
- readonly [accountRoles]?: R;
368
+ /** Type-only source roles, preserved by authoring handles after runtime schema validation. */
369
+ declare const accountRoles: unique symbol;
370
+ type WithAccountRoles<R extends string> = {
371
+ readonly [accountRoles]?: R;
904
372
  };
905
373
  type RoleOf<T> = typeof accountRoles extends keyof T ? Extract<T[typeof accountRoles], string> : string;
906
374
  type SourceRoles<S extends TrackerSource> = typeof accountRoles extends keyof S ? RoleOf<S> : S extends {
@@ -1024,621 +492,1153 @@ declare const publishedTrackerSchema: z.ZodObject<{
1024
492
  publishedAt: z.ZodNumber;
1025
493
  actor: z.ZodNullable<z.ZodString>;
1026
494
  }, z.core.$strip>;
1027
- declare const trackerStatusSchema: z.ZodObject<{
1028
- archivedAt: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
1029
- published: z.ZodObject<{
495
+ declare const trackerStatusSchema: z.ZodObject<{
496
+ archivedAt: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
497
+ published: z.ZodObject<{
498
+ id: z.ZodString;
499
+ version: z.ZodString;
500
+ definition: z.ZodObject<{
501
+ source: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
502
+ kind: z.ZodLiteral<"x-search">;
503
+ query: z.ZodString;
504
+ }, z.core.$strip>, z.ZodObject<{
505
+ identities: z.ZodOptional<z.ZodArray<z.ZodType<OpenIdentityKind, unknown, z.core.$ZodTypeInternals<OpenIdentityKind, unknown>>>>;
506
+ kind: z.ZodLiteral<"custom">;
507
+ namespace: z.ZodString;
508
+ accounts: z.ZodOptional<z.ZodArray<z.ZodString>>;
509
+ data: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodType<TrackerDataSchema, unknown, z.core.$ZodTypeInternals<TrackerDataSchema, unknown>>>>;
510
+ content: z.ZodOptional<z.ZodObject<{
511
+ metrics: z.ZodArray<z.ZodString>;
512
+ }, z.core.$strict>>;
513
+ }, z.core.$strip>, z.ZodObject<{
514
+ kind: z.ZodLiteral<"discord-messages">;
515
+ text: z.ZodOptional<z.ZodBoolean>;
516
+ }, z.core.$strip>, z.ZodObject<{
517
+ kind: z.ZodLiteral<"discord-reactions">;
518
+ }, z.core.$strip>], "kind">, z.ZodObject<{
519
+ kind: z.ZodString;
520
+ }, z.core.$catchall<z.ZodJSONSchema>>]>;
521
+ window: z.ZodObject<{
522
+ start: z.ZodNumber;
523
+ end: z.ZodOptional<z.ZodNumber>;
524
+ }, z.core.$strip>;
525
+ key: z.ZodString;
526
+ title: z.ZodString;
527
+ refreshSeconds: z.ZodDefault<z.ZodNumber>;
528
+ maxPages: z.ZodDefault<z.ZodNumber>;
529
+ }, z.core.$strip>;
530
+ publishedAt: z.ZodNumber;
531
+ actor: z.ZodNullable<z.ZodString>;
532
+ }, z.core.$strip>;
533
+ paused: z.ZodBoolean;
534
+ state: z.ZodEnum<{
535
+ error: "error";
536
+ idle: "idle";
537
+ syncing: "syncing";
538
+ complete: "complete";
539
+ }>;
540
+ lastStartedAt: z.ZodNullable<z.ZodNumber>;
541
+ lastCompletedAt: z.ZodNullable<z.ZodNumber>;
542
+ nextSyncAt: z.ZodNullable<z.ZodNumber>;
543
+ coverage: z.ZodEnum<{
544
+ unknown: "unknown";
545
+ complete: "complete";
546
+ partial: "partial";
547
+ }>;
548
+ error: z.ZodNullable<z.ZodString>;
549
+ records: z.ZodNumber;
550
+ }, z.core.$strip>;
551
+ type TrackerStatus = z.infer<typeof trackerStatusSchema>;
552
+ declare const trackerControlSchema: z.ZodObject<{
553
+ actionId: z.ZodString;
554
+ action: z.ZodEnum<{
555
+ pause: "pause";
556
+ resume: "resume";
557
+ refresh: "refresh";
558
+ }>;
559
+ }, z.core.$strict>;
560
+ /**
561
+ * An account a record names, of one of its custom source's identity kinds. `kind` may be left out
562
+ * when the source names exactly one.
563
+ */
564
+ declare const trackerAccountSchema: z.ZodObject<{
565
+ kind: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
566
+ member: "member";
567
+ discord: "discord";
568
+ x: "x";
569
+ wallet: "wallet";
570
+ }>, z.ZodTemplateLiteral<`app:${string}`>]>>;
571
+ id: z.ZodString;
572
+ }, z.core.$strict>;
573
+ type TrackerAccount = z.infer<typeof trackerAccountSchema>;
574
+ declare const trackerRecordInputSchema: z.ZodObject<{
575
+ id: z.ZodString;
576
+ occurredAt: z.ZodNumber;
577
+ observedAt: z.ZodNumber;
578
+ author: z.ZodDefault<z.ZodNullable<z.ZodObject<{
579
+ id: z.ZodString;
580
+ verified: z.ZodDefault<z.ZodNullable<z.ZodBoolean>>;
581
+ kind: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
582
+ member: "member";
583
+ discord: "discord";
584
+ x: "x";
585
+ wallet: "wallet";
586
+ }>, z.ZodTemplateLiteral<`app:${string}`>]>>;
587
+ }, z.core.$strict>>>;
588
+ accounts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
589
+ kind: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
590
+ member: "member";
591
+ discord: "discord";
592
+ x: "x";
593
+ wallet: "wallet";
594
+ }>, z.ZodTemplateLiteral<`app:${string}`>]>>;
595
+ id: z.ZodString;
596
+ }, z.core.$strict>>>;
597
+ data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
598
+ removed: z.ZodDefault<z.ZodBoolean>;
599
+ }, z.core.$strict>;
600
+ /** A record account as reads return it: any kind, including one a later Relay adds. */
601
+ declare const trackerRecordAccountSchema: z.ZodObject<{
602
+ kind: z.ZodOptional<z.ZodType<OpenIdentityKind, unknown, z.core.$ZodTypeInternals<OpenIdentityKind, unknown>>>;
603
+ id: z.ZodString;
604
+ }, z.core.$strip>;
605
+ /**
606
+ * A stored record as reads return it. Unlike `trackerRecordInputSchema`, it reads identity kinds a
607
+ * later Relay adds and ignores fields it does not know.
608
+ */
609
+ declare const trackerRecordSchema: z.ZodObject<{
610
+ id: z.ZodString;
611
+ occurredAt: z.ZodNumber;
612
+ observedAt: z.ZodNumber;
613
+ author: z.ZodDefault<z.ZodNullable<z.ZodObject<{
614
+ id: z.ZodString;
615
+ verified: z.ZodDefault<z.ZodNullable<z.ZodBoolean>>;
616
+ kind: z.ZodOptional<z.ZodType<OpenIdentityKind, unknown, z.core.$ZodTypeInternals<OpenIdentityKind, unknown>>>;
617
+ }, z.core.$strip>>>;
618
+ accounts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
619
+ kind: z.ZodOptional<z.ZodType<OpenIdentityKind, unknown, z.core.$ZodTypeInternals<OpenIdentityKind, unknown>>>;
620
+ id: z.ZodString;
621
+ }, z.core.$strip>>>;
622
+ data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
623
+ removed: z.ZodDefault<z.ZodBoolean>;
624
+ source: z.ZodString;
625
+ firstSeenAt: z.ZodNumber;
626
+ evidence: z.ZodOptional<z.ZodNullable<z.ZodObject<{
627
+ contentRevision: z.ZodString;
628
+ observation: z.ZodString;
629
+ }, z.core.$strict>>>;
630
+ }, z.core.$strip>;
631
+ type TrackerRecord = z.infer<typeof trackerRecordSchema>;
632
+ declare const trackerIngestSchema: z.ZodObject<{
633
+ actionId: z.ZodString;
634
+ records: z.ZodArray<z.ZodObject<{
1030
635
  id: z.ZodString;
1031
- version: z.ZodString;
1032
- definition: z.ZodObject<{
1033
- source: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
1034
- kind: z.ZodLiteral<"x-search">;
1035
- query: z.ZodString;
1036
- }, z.core.$strip>, z.ZodObject<{
1037
- identities: z.ZodOptional<z.ZodArray<z.ZodType<OpenIdentityKind, unknown, z.core.$ZodTypeInternals<OpenIdentityKind, unknown>>>>;
1038
- kind: z.ZodLiteral<"custom">;
1039
- namespace: z.ZodString;
1040
- accounts: z.ZodOptional<z.ZodArray<z.ZodString>>;
1041
- data: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodType<TrackerDataSchema, unknown, z.core.$ZodTypeInternals<TrackerDataSchema, unknown>>>>;
1042
- content: z.ZodOptional<z.ZodObject<{
1043
- metrics: z.ZodArray<z.ZodString>;
1044
- }, z.core.$strict>>;
1045
- }, z.core.$strip>, z.ZodObject<{
1046
- kind: z.ZodLiteral<"discord-messages">;
1047
- text: z.ZodOptional<z.ZodBoolean>;
1048
- }, z.core.$strip>, z.ZodObject<{
1049
- kind: z.ZodLiteral<"discord-reactions">;
1050
- }, z.core.$strip>], "kind">, z.ZodObject<{
1051
- kind: z.ZodString;
1052
- }, z.core.$catchall<z.ZodJSONSchema>>]>;
1053
- window: z.ZodObject<{
1054
- start: z.ZodNumber;
1055
- end: z.ZodOptional<z.ZodNumber>;
1056
- }, z.core.$strip>;
1057
- key: z.ZodString;
1058
- title: z.ZodString;
1059
- refreshSeconds: z.ZodDefault<z.ZodNumber>;
1060
- maxPages: z.ZodDefault<z.ZodNumber>;
1061
- }, z.core.$strip>;
1062
- publishedAt: z.ZodNumber;
636
+ occurredAt: z.ZodNumber;
637
+ observedAt: z.ZodNumber;
638
+ author: z.ZodDefault<z.ZodNullable<z.ZodObject<{
639
+ id: z.ZodString;
640
+ verified: z.ZodDefault<z.ZodNullable<z.ZodBoolean>>;
641
+ kind: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
642
+ member: "member";
643
+ discord: "discord";
644
+ x: "x";
645
+ wallet: "wallet";
646
+ }>, z.ZodTemplateLiteral<`app:${string}`>]>>;
647
+ }, z.core.$strict>>>;
648
+ accounts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
649
+ kind: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
650
+ member: "member";
651
+ discord: "discord";
652
+ x: "x";
653
+ wallet: "wallet";
654
+ }>, z.ZodTemplateLiteral<`app:${string}`>]>>;
655
+ id: z.ZodString;
656
+ }, z.core.$strict>>>;
657
+ data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
658
+ removed: z.ZodDefault<z.ZodBoolean>;
659
+ }, z.core.$strict>>;
660
+ }, z.core.$strict>;
661
+ declare const trackerIngestResultSchema: z.ZodObject<{
662
+ stored: z.ZodNumber;
663
+ admissions: z.ZodOptional<z.ZodObject<{
664
+ admitted: z.ZodNumber;
665
+ skipped: z.ZodNumber;
666
+ filtered: z.ZodOptional<z.ZodNumber>;
667
+ }, z.core.$strip>>;
668
+ }, z.core.$strip>;
669
+ /**
670
+ * Why a tracker trigger skipped an observation, as a stable machine code. Relay applies the rules
671
+ * in this order and records the first that fails. Later versions may add codes; treat an unknown
672
+ * code as a skip whose `reason` explains it.
673
+ *
674
+ * Relay decides a skip again on its own only when the member event that clears it happens:
675
+ * `unlinked-account` when a member links the account, `ambiguous-account` when a conflicting link
676
+ * is removed, `not-joined` when the member joins, `not-enrolled` when the member enrolls. Every
677
+ * other skip is final unless a reviewer retries it, or, for `historical` under
678
+ * `historical: "claim"`, the member claims it.
679
+ */
680
+ declare const trackerSkipCodes: readonly ["quest-paused", "before-activation", "outside-window", "future-record", "record-removed", "invalid-record-data", "content-unavailable", "no-account", "beneficiary-is-author", "unlinked-account", "ambiguous-account", "not-joined", "already-completed", "not-enrolled", "before-enrollment", "historical", "prerequisites-incomplete"];
681
+ /**
682
+ * A skip code this SDK knows.
683
+ *
684
+ * @compat open
685
+ */
686
+ type KnownTrackerSkipCode = (typeof trackerSkipCodes)[number];
687
+ /** A known skip code, or one a newer Relay sends. */
688
+ type TrackerSkipCode = KnownTrackerSkipCode | (string & {});
689
+ /**
690
+ * One tracker-trigger decision: a quest admitted an attempt for a record observation, or skipped
691
+ * it with a code and reason. Operators read these to see why a quest did or did not run.
692
+ */
693
+ declare const trackerOutcomeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
694
+ state: z.ZodLiteral<"admitted">;
695
+ code: z.ZodNull;
696
+ reason: z.ZodNull;
697
+ member: z.ZodString;
698
+ attempt: z.ZodString;
699
+ quest: z.ZodString;
700
+ tracker: z.ZodString;
701
+ record: z.ZodString;
702
+ observedAt: z.ZodNumber;
703
+ release: z.ZodString;
704
+ account: z.ZodNullable<z.ZodString>;
705
+ createdAt: z.ZodNumber;
706
+ updatedAt: z.ZodNumber;
707
+ actor: z.ZodNullable<z.ZodString>;
708
+ }, z.core.$strip>, z.ZodObject<{
709
+ state: z.ZodLiteral<"skipped">;
710
+ code: z.ZodString;
711
+ reason: z.ZodString;
712
+ window: z.ZodOptional<z.ZodEnum<{
713
+ quest: "quest";
714
+ tracker: "tracker";
715
+ }>>;
716
+ member: z.ZodNullable<z.ZodString>;
717
+ attempt: z.ZodNullable<z.ZodString>;
718
+ quest: z.ZodString;
719
+ tracker: z.ZodString;
720
+ record: z.ZodString;
721
+ observedAt: z.ZodNumber;
722
+ release: z.ZodString;
723
+ account: z.ZodNullable<z.ZodString>;
724
+ createdAt: z.ZodNumber;
725
+ updatedAt: z.ZodNumber;
726
+ actor: z.ZodNullable<z.ZodString>;
727
+ }, z.core.$strip>], "state">;
728
+ type TrackerOutcome = z.infer<typeof trackerOutcomeSchema>;
729
+ /** Which of a tracker's trigger outcomes to read: filters, and a page's `nextCursor` as `cursor`. */
730
+ declare const trackerTriggerOutcomeQuerySchema: z.ZodObject<{
731
+ cursor: z.ZodOptional<z.ZodString>;
732
+ /** Quest key or ID. */
733
+ quest: z.ZodOptional<z.ZodString>;
734
+ record: z.ZodOptional<z.ZodString>;
735
+ member: z.ZodOptional<z.ZodString>;
736
+ state: z.ZodOptional<z.ZodEnum<{
737
+ admitted: "admitted";
738
+ skipped: "skipped";
739
+ }>>;
740
+ /** Only skips with this code, such as `unlinked-account`. */
741
+ code: z.ZodOptional<z.ZodString>;
742
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
743
+ }, z.core.$strict>;
744
+ type TrackerTriggerOutcomeQuery = z.input<typeof trackerTriggerOutcomeQuerySchema>;
745
+ /** One page of a tracker's trigger outcomes, newest first. */
746
+ declare const trackerTriggerOutcomePageSchema: z.ZodObject<{
747
+ items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
748
+ state: z.ZodLiteral<"admitted">;
749
+ code: z.ZodNull;
750
+ reason: z.ZodNull;
751
+ member: z.ZodString;
752
+ attempt: z.ZodString;
753
+ quest: z.ZodString;
754
+ tracker: z.ZodString;
755
+ record: z.ZodString;
756
+ observedAt: z.ZodNumber;
757
+ release: z.ZodString;
758
+ account: z.ZodNullable<z.ZodString>;
759
+ createdAt: z.ZodNumber;
760
+ updatedAt: z.ZodNumber;
1063
761
  actor: z.ZodNullable<z.ZodString>;
1064
- }, z.core.$strip>;
1065
- paused: z.ZodBoolean;
1066
- state: z.ZodEnum<{
1067
- error: "error";
1068
- idle: "idle";
1069
- syncing: "syncing";
1070
- complete: "complete";
1071
- }>;
1072
- lastStartedAt: z.ZodNullable<z.ZodNumber>;
1073
- lastCompletedAt: z.ZodNullable<z.ZodNumber>;
1074
- nextSyncAt: z.ZodNullable<z.ZodNumber>;
1075
- coverage: z.ZodEnum<{
1076
- unknown: "unknown";
1077
- complete: "complete";
1078
- partial: "partial";
1079
- }>;
1080
- error: z.ZodNullable<z.ZodString>;
1081
- records: z.ZodNumber;
762
+ }, z.core.$strip>, z.ZodObject<{
763
+ state: z.ZodLiteral<"skipped">;
764
+ code: z.ZodString;
765
+ reason: z.ZodString;
766
+ window: z.ZodOptional<z.ZodEnum<{
767
+ quest: "quest";
768
+ tracker: "tracker";
769
+ }>>;
770
+ member: z.ZodNullable<z.ZodString>;
771
+ attempt: z.ZodNullable<z.ZodString>;
772
+ quest: z.ZodString;
773
+ tracker: z.ZodString;
774
+ record: z.ZodString;
775
+ observedAt: z.ZodNumber;
776
+ release: z.ZodString;
777
+ account: z.ZodNullable<z.ZodString>;
778
+ createdAt: z.ZodNumber;
779
+ updatedAt: z.ZodNumber;
780
+ actor: z.ZodNullable<z.ZodString>;
781
+ }, z.core.$strip>], "state">>;
782
+ nextCursor: z.ZodNullable<z.ZodString>;
1082
783
  }, z.core.$strip>;
1083
- type TrackerStatus = z.infer<typeof trackerStatusSchema>;
1084
- declare const trackerControlSchema: z.ZodObject<{
784
+ /** @compat output */
785
+ type TrackerTriggerOutcomePage = z.infer<typeof trackerTriggerOutcomePageSchema>;
786
+ /** @deprecated Use `trackerTriggerOutcomeQuerySchema`. Removed in 2.0.0. */
787
+ declare const trackerOutcomeQuerySchema: z.ZodObject<{
788
+ /** Opaque cursor from `next`: older outcomes. */
789
+ before: z.ZodOptional<z.ZodString>;
790
+ /** Quest key or ID. */
791
+ quest: z.ZodOptional<z.ZodString>;
792
+ record: z.ZodOptional<z.ZodString>;
793
+ member: z.ZodOptional<z.ZodString>;
794
+ state: z.ZodOptional<z.ZodEnum<{
795
+ admitted: "admitted";
796
+ skipped: "skipped";
797
+ }>>;
798
+ /** Only skips with this code, such as `unlinked-account`. */
799
+ code: z.ZodOptional<z.ZodString>;
800
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
801
+ }, z.core.$strict>;
802
+ /** @deprecated Use `TrackerTriggerOutcomeQuery`. Removed in 2.0.0. */
803
+ type TrackerOutcomeQuery = z.input<typeof trackerOutcomeQuerySchema>;
804
+ /** @deprecated Use `trackerTriggerOutcomePageSchema`. Removed in 2.0.0. */
805
+ declare const trackerOutcomePageSchema: z.ZodObject<{
806
+ /** Newest first. */
807
+ items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
808
+ state: z.ZodLiteral<"admitted">;
809
+ code: z.ZodNull;
810
+ reason: z.ZodNull;
811
+ member: z.ZodString;
812
+ attempt: z.ZodString;
813
+ quest: z.ZodString;
814
+ tracker: z.ZodString;
815
+ record: z.ZodString;
816
+ observedAt: z.ZodNumber;
817
+ release: z.ZodString;
818
+ account: z.ZodNullable<z.ZodString>;
819
+ createdAt: z.ZodNumber;
820
+ updatedAt: z.ZodNumber;
821
+ actor: z.ZodNullable<z.ZodString>;
822
+ }, z.core.$strip>, z.ZodObject<{
823
+ state: z.ZodLiteral<"skipped">;
824
+ code: z.ZodString;
825
+ reason: z.ZodString;
826
+ window: z.ZodOptional<z.ZodEnum<{
827
+ quest: "quest";
828
+ tracker: "tracker";
829
+ }>>;
830
+ member: z.ZodNullable<z.ZodString>;
831
+ attempt: z.ZodNullable<z.ZodString>;
832
+ quest: z.ZodString;
833
+ tracker: z.ZodString;
834
+ record: z.ZodString;
835
+ observedAt: z.ZodNumber;
836
+ release: z.ZodString;
837
+ account: z.ZodNullable<z.ZodString>;
838
+ createdAt: z.ZodNumber;
839
+ updatedAt: z.ZodNumber;
840
+ actor: z.ZodNullable<z.ZodString>;
841
+ }, z.core.$strip>], "state">>;
842
+ next: z.ZodNullable<z.ZodString>;
843
+ }, z.core.$strict>;
844
+ /** Re-runs admission for one skipped observation under the quest's current release and links. */
845
+ declare const trackerOutcomeRetrySchema: z.ZodObject<{
1085
846
  actionId: z.ZodString;
1086
- action: z.ZodEnum<{
1087
- pause: "pause";
1088
- resume: "resume";
1089
- refresh: "refresh";
1090
- }>;
847
+ /** Quest key or ID. */
848
+ quest: z.ZodString;
849
+ record: z.ZodString;
850
+ observedAt: z.ZodNumber;
1091
851
  }, z.core.$strict>;
1092
- /**
1093
- * An account a record names, of one of its custom source's identity kinds. `kind` may be left out
1094
- * when the source names exactly one.
1095
- */
1096
- declare const trackerAccountSchema: z.ZodObject<{
1097
- kind: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
1098
- member: "member";
1099
- discord: "discord";
1100
- x: "x";
1101
- wallet: "wallet";
1102
- }>, z.ZodTemplateLiteral<`app:${string}`>]>>;
1103
- id: z.ZodString;
852
+ declare const trackerQuerySchema: z.ZodObject<{
853
+ author: z.ZodOptional<z.ZodString>;
854
+ member: z.ZodOptional<z.ZodString>;
855
+ verified: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodPipe<z.ZodEnum<{
856
+ true: "true";
857
+ false: "false";
858
+ }>, z.ZodTransform<boolean, "true" | "false">>]>>;
859
+ since: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
860
+ until: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
861
+ removed: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodPipe<z.ZodEnum<{
862
+ true: "true";
863
+ false: "false";
864
+ }>, z.ZodTransform<boolean, "true" | "false">>]>>;
865
+ minLikes: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
866
+ minViews: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
867
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
868
+ cursor: z.ZodOptional<z.ZodString>;
869
+ includeEvidence: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodPipe<z.ZodEnum<{
870
+ true: "true";
871
+ false: "false";
872
+ }>, z.ZodTransform<boolean, "true" | "false">>]>>;
1104
873
  }, z.core.$strict>;
1105
- type TrackerAccount = z.infer<typeof trackerAccountSchema>;
1106
- declare const trackerRecordInputSchema: z.ZodObject<{
1107
- id: z.ZodString;
1108
- occurredAt: z.ZodNumber;
1109
- observedAt: z.ZodNumber;
1110
- author: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1111
- id: z.ZodString;
1112
- verified: z.ZodDefault<z.ZodNullable<z.ZodBoolean>>;
1113
- kind: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
1114
- member: "member";
1115
- discord: "discord";
1116
- x: "x";
1117
- wallet: "wallet";
1118
- }>, z.ZodTemplateLiteral<`app:${string}`>]>>;
1119
- }, z.core.$strict>>>;
1120
- accounts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1121
- kind: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
1122
- member: "member";
1123
- discord: "discord";
1124
- x: "x";
1125
- wallet: "wallet";
1126
- }>, z.ZodTemplateLiteral<`app:${string}`>]>>;
874
+ type TrackerQuery = z.input<typeof trackerQuerySchema>;
875
+ declare const trackerPageSchema: z.ZodObject<{
876
+ tracker: z.ZodString;
877
+ items: z.ZodArray<z.ZodObject<{
1127
878
  id: z.ZodString;
1128
- }, z.core.$strict>>>;
1129
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
1130
- removed: z.ZodDefault<z.ZodBoolean>;
1131
- }, z.core.$strict>;
1132
- /** A record account as reads return it: any kind, including one a later Relay adds. */
1133
- declare const trackerRecordAccountSchema: z.ZodObject<{
1134
- kind: z.ZodOptional<z.ZodType<OpenIdentityKind, unknown, z.core.$ZodTypeInternals<OpenIdentityKind, unknown>>>;
1135
- id: z.ZodString;
879
+ occurredAt: z.ZodNumber;
880
+ observedAt: z.ZodNumber;
881
+ author: z.ZodDefault<z.ZodNullable<z.ZodObject<{
882
+ id: z.ZodString;
883
+ verified: z.ZodDefault<z.ZodNullable<z.ZodBoolean>>;
884
+ kind: z.ZodOptional<z.ZodType<OpenIdentityKind, unknown, z.core.$ZodTypeInternals<OpenIdentityKind, unknown>>>;
885
+ }, z.core.$strip>>>;
886
+ accounts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
887
+ kind: z.ZodOptional<z.ZodType<OpenIdentityKind, unknown, z.core.$ZodTypeInternals<OpenIdentityKind, unknown>>>;
888
+ id: z.ZodString;
889
+ }, z.core.$strip>>>;
890
+ data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
891
+ removed: z.ZodDefault<z.ZodBoolean>;
892
+ source: z.ZodString;
893
+ firstSeenAt: z.ZodNumber;
894
+ evidence: z.ZodOptional<z.ZodNullable<z.ZodObject<{
895
+ contentRevision: z.ZodString;
896
+ observation: z.ZodString;
897
+ }, z.core.$strict>>>;
898
+ }, z.core.$strip>>;
899
+ nextCursor: z.ZodNullable<z.ZodString>;
900
+ total: z.ZodNumber;
901
+ status: z.ZodObject<{
902
+ archivedAt: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
903
+ published: z.ZodObject<{
904
+ id: z.ZodString;
905
+ version: z.ZodString;
906
+ definition: z.ZodObject<{
907
+ source: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
908
+ kind: z.ZodLiteral<"x-search">;
909
+ query: z.ZodString;
910
+ }, z.core.$strip>, z.ZodObject<{
911
+ identities: z.ZodOptional<z.ZodArray<z.ZodType<OpenIdentityKind, unknown, z.core.$ZodTypeInternals<OpenIdentityKind, unknown>>>>;
912
+ kind: z.ZodLiteral<"custom">;
913
+ namespace: z.ZodString;
914
+ accounts: z.ZodOptional<z.ZodArray<z.ZodString>>;
915
+ data: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodType<TrackerDataSchema, unknown, z.core.$ZodTypeInternals<TrackerDataSchema, unknown>>>>;
916
+ content: z.ZodOptional<z.ZodObject<{
917
+ metrics: z.ZodArray<z.ZodString>;
918
+ }, z.core.$strict>>;
919
+ }, z.core.$strip>, z.ZodObject<{
920
+ kind: z.ZodLiteral<"discord-messages">;
921
+ text: z.ZodOptional<z.ZodBoolean>;
922
+ }, z.core.$strip>, z.ZodObject<{
923
+ kind: z.ZodLiteral<"discord-reactions">;
924
+ }, z.core.$strip>], "kind">, z.ZodObject<{
925
+ kind: z.ZodString;
926
+ }, z.core.$catchall<z.ZodJSONSchema>>]>;
927
+ window: z.ZodObject<{
928
+ start: z.ZodNumber;
929
+ end: z.ZodOptional<z.ZodNumber>;
930
+ }, z.core.$strip>;
931
+ key: z.ZodString;
932
+ title: z.ZodString;
933
+ refreshSeconds: z.ZodDefault<z.ZodNumber>;
934
+ maxPages: z.ZodDefault<z.ZodNumber>;
935
+ }, z.core.$strip>;
936
+ publishedAt: z.ZodNumber;
937
+ actor: z.ZodNullable<z.ZodString>;
938
+ }, z.core.$strip>;
939
+ paused: z.ZodBoolean;
940
+ state: z.ZodEnum<{
941
+ error: "error";
942
+ idle: "idle";
943
+ syncing: "syncing";
944
+ complete: "complete";
945
+ }>;
946
+ lastStartedAt: z.ZodNullable<z.ZodNumber>;
947
+ lastCompletedAt: z.ZodNullable<z.ZodNumber>;
948
+ nextSyncAt: z.ZodNullable<z.ZodNumber>;
949
+ coverage: z.ZodEnum<{
950
+ unknown: "unknown";
951
+ complete: "complete";
952
+ partial: "partial";
953
+ }>;
954
+ error: z.ZodNullable<z.ZodString>;
955
+ records: z.ZodNumber;
956
+ }, z.core.$strip>;
1136
957
  }, z.core.$strip>;
1137
- /**
1138
- * A stored record as reads return it. Unlike `trackerRecordInputSchema`, it reads identity kinds a
1139
- * later Relay adds and ignores fields it does not know.
1140
- */
1141
- declare const trackerRecordSchema: z.ZodObject<{
1142
- id: z.ZodString;
1143
- occurredAt: z.ZodNumber;
1144
- observedAt: z.ZodNumber;
1145
- author: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1146
- id: z.ZodString;
1147
- verified: z.ZodDefault<z.ZodNullable<z.ZodBoolean>>;
1148
- kind: z.ZodOptional<z.ZodType<OpenIdentityKind, unknown, z.core.$ZodTypeInternals<OpenIdentityKind, unknown>>>;
1149
- }, z.core.$strip>>>;
1150
- accounts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1151
- kind: z.ZodOptional<z.ZodType<OpenIdentityKind, unknown, z.core.$ZodTypeInternals<OpenIdentityKind, unknown>>>;
1152
- id: z.ZodString;
1153
- }, z.core.$strip>>>;
1154
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
1155
- removed: z.ZodDefault<z.ZodBoolean>;
1156
- source: z.ZodString;
1157
- firstSeenAt: z.ZodNumber;
1158
- evidence: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1159
- contentRevision: z.ZodString;
1160
- observation: z.ZodString;
1161
- }, z.core.$strict>>>;
958
+ declare const trackerSummarySchema: z.ZodObject<{
959
+ records: z.ZodNumber;
960
+ authors: z.ZodNumber;
961
+ metrics: z.ZodObject<{
962
+ likes: z.ZodNumber;
963
+ replies: z.ZodNumber;
964
+ reposts: z.ZodNumber;
965
+ quotes: z.ZodNumber;
966
+ views: z.ZodNumber;
967
+ bookmarks: z.ZodNumber;
968
+ }, z.core.$strip>;
969
+ missingMetrics: z.ZodNumber;
970
+ status: z.ZodObject<{
971
+ archivedAt: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
972
+ published: z.ZodObject<{
973
+ id: z.ZodString;
974
+ version: z.ZodString;
975
+ definition: z.ZodObject<{
976
+ source: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
977
+ kind: z.ZodLiteral<"x-search">;
978
+ query: z.ZodString;
979
+ }, z.core.$strip>, z.ZodObject<{
980
+ identities: z.ZodOptional<z.ZodArray<z.ZodType<OpenIdentityKind, unknown, z.core.$ZodTypeInternals<OpenIdentityKind, unknown>>>>;
981
+ kind: z.ZodLiteral<"custom">;
982
+ namespace: z.ZodString;
983
+ accounts: z.ZodOptional<z.ZodArray<z.ZodString>>;
984
+ data: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodType<TrackerDataSchema, unknown, z.core.$ZodTypeInternals<TrackerDataSchema, unknown>>>>;
985
+ content: z.ZodOptional<z.ZodObject<{
986
+ metrics: z.ZodArray<z.ZodString>;
987
+ }, z.core.$strict>>;
988
+ }, z.core.$strip>, z.ZodObject<{
989
+ kind: z.ZodLiteral<"discord-messages">;
990
+ text: z.ZodOptional<z.ZodBoolean>;
991
+ }, z.core.$strip>, z.ZodObject<{
992
+ kind: z.ZodLiteral<"discord-reactions">;
993
+ }, z.core.$strip>], "kind">, z.ZodObject<{
994
+ kind: z.ZodString;
995
+ }, z.core.$catchall<z.ZodJSONSchema>>]>;
996
+ window: z.ZodObject<{
997
+ start: z.ZodNumber;
998
+ end: z.ZodOptional<z.ZodNumber>;
999
+ }, z.core.$strip>;
1000
+ key: z.ZodString;
1001
+ title: z.ZodString;
1002
+ refreshSeconds: z.ZodDefault<z.ZodNumber>;
1003
+ maxPages: z.ZodDefault<z.ZodNumber>;
1004
+ }, z.core.$strip>;
1005
+ publishedAt: z.ZodNumber;
1006
+ actor: z.ZodNullable<z.ZodString>;
1007
+ }, z.core.$strip>;
1008
+ paused: z.ZodBoolean;
1009
+ state: z.ZodEnum<{
1010
+ error: "error";
1011
+ idle: "idle";
1012
+ syncing: "syncing";
1013
+ complete: "complete";
1014
+ }>;
1015
+ lastStartedAt: z.ZodNullable<z.ZodNumber>;
1016
+ lastCompletedAt: z.ZodNullable<z.ZodNumber>;
1017
+ nextSyncAt: z.ZodNullable<z.ZodNumber>;
1018
+ coverage: z.ZodEnum<{
1019
+ unknown: "unknown";
1020
+ complete: "complete";
1021
+ partial: "partial";
1022
+ }>;
1023
+ error: z.ZodNullable<z.ZodString>;
1024
+ records: z.ZodNumber;
1025
+ }, z.core.$strip>;
1162
1026
  }, z.core.$strip>;
1163
- type TrackerRecord = z.infer<typeof trackerRecordSchema>;
1164
- declare const trackerIngestSchema: z.ZodObject<{
1165
- actionId: z.ZodString;
1166
- records: z.ZodArray<z.ZodObject<{
1027
+ /** A record whose `data` has type `D`; untyped records keep JSON object data. */
1028
+ type TypedTrackerRecord<D> = unknown extends D ? TrackerRecord : Omit<TrackerRecord, "data"> & {
1029
+ data: D;
1030
+ };
1031
+ /**
1032
+ * A page of tracker records whose `data` has type `D`. A page read with a typed tracker handle
1033
+ * leaves out records whose data does not match the handle's schema, such as records stored before
1034
+ * the schema changed, and counts them in `excluded`; `total` and the cursor still count every
1035
+ * record.
1036
+ */
1037
+ type TrackerPage<D = unknown> = Omit<z.infer<typeof trackerPageSchema>, "items"> & (unknown extends D ? {
1038
+ items: TrackerRecord[];
1039
+ } : {
1040
+ items: TypedTrackerRecord<D>[];
1041
+ excluded: number;
1042
+ });
1043
+ /** Preview bounds: one sample, never stored, never a tracker. */
1044
+ declare const trackerPreviewLimits: {
1045
+ readonly pages: 3;
1046
+ readonly posts: 100;
1047
+ readonly days: 30;
1048
+ };
1049
+ /** A bounded X search sample for exploring a query before defining a tracker in code. */
1050
+ declare const trackerPreviewInputSchema: z.ZodObject<{
1051
+ query: z.ZodString;
1052
+ since: z.ZodNumber;
1053
+ }, z.core.$strict>;
1054
+ type TrackerPreviewInput = z.input<typeof trackerPreviewInputSchema>;
1055
+ declare const trackerPreviewSchema: z.ZodObject<{
1056
+ query: z.ZodString;
1057
+ since: z.ZodNumber;
1058
+ fetchedAt: z.ZodNumber;
1059
+ pages: z.ZodNumber;
1060
+ posts: z.ZodArray<z.ZodObject<{
1167
1061
  id: z.ZodString;
1168
- occurredAt: z.ZodNumber;
1169
- observedAt: z.ZodNumber;
1170
- author: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1062
+ userId: z.ZodString;
1063
+ content: z.ZodString;
1064
+ createdAt: z.ZodISODateTime;
1065
+ author: z.ZodObject<{
1171
1066
  id: z.ZodString;
1067
+ username: z.ZodString;
1068
+ name: z.ZodString;
1172
1069
  verified: z.ZodDefault<z.ZodNullable<z.ZodBoolean>>;
1173
- kind: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
1174
- member: "member";
1175
- discord: "discord";
1176
- x: "x";
1177
- wallet: "wallet";
1178
- }>, z.ZodTemplateLiteral<`app:${string}`>]>>;
1179
- }, z.core.$strict>>>;
1180
- accounts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1181
- kind: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
1182
- member: "member";
1183
- discord: "discord";
1184
- x: "x";
1185
- wallet: "wallet";
1186
- }>, z.ZodTemplateLiteral<`app:${string}`>]>>;
1187
- id: z.ZodString;
1188
- }, z.core.$strict>>>;
1189
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
1190
- removed: z.ZodDefault<z.ZodBoolean>;
1191
- }, z.core.$strict>>;
1192
- }, z.core.$strict>;
1193
- declare const trackerIngestResultSchema: z.ZodObject<{
1194
- stored: z.ZodNumber;
1195
- admissions: z.ZodOptional<z.ZodObject<{
1196
- admitted: z.ZodNumber;
1197
- skipped: z.ZodNumber;
1198
- filtered: z.ZodOptional<z.ZodNumber>;
1199
- }, z.core.$strip>>;
1070
+ }, z.core.$loose>;
1071
+ likeCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1072
+ replyCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1073
+ retweetCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1074
+ quoteCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1075
+ viewCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1076
+ bookmarkCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1077
+ isReply: z.ZodBoolean;
1078
+ isRetweet: z.ZodBoolean;
1079
+ isQuoteTweet: z.ZodBoolean;
1080
+ }, z.core.$loose>>;
1081
+ more: z.ZodBoolean;
1200
1082
  }, z.core.$strip>;
1083
+ type TrackerPreview = z.infer<typeof trackerPreviewSchema>;
1084
+ /**
1085
+ * A tracker read inside an evaluation: the management query plus `asOf`, in epoch milliseconds.
1086
+ * Only records that occurred at or before `asOf` count, each as its latest observation Relay had
1087
+ * stored when the attempt first read a tracker. `asOf` defaults to `ctx.eligibleAt`; pass
1088
+ * `ctx.now` to read everything stored by then.
1089
+ */
1090
+ type TrackerReadQuery = TrackerQuery & {
1091
+ asOf?: number;
1092
+ };
1093
+ /**
1094
+ * Read-only capabilities in hosted quest evaluation; results are captured for replay. Every read
1095
+ * in one attempt sees the same stored observations: the attempt pins a snapshot watermark at its
1096
+ * first tracker read, so two reads cannot disagree and a retry reads what the first run read.
1097
+ * An unknown tracker, or a query the tracker cannot answer, throws `CapabilityError` with code
1098
+ * `"author-error"`.
1099
+ */
1100
+ type TrackerReader = {
1101
+ /**
1102
+ * Captures an X body and attribution to the evaluating member, with no live metrics. Null when
1103
+ * the tracker has no such record or observation.
1104
+ */
1105
+ content(reference: Tracker, query: TrackerContentQuery): Promise<TrackerContent | null>;
1106
+ /** A page of records; with a tracker handle, each record's `data` has the tracker's type. */
1107
+ records<T extends Tracker>(reference: T, query?: TrackerReadQuery): Promise<TrackerPage<TrackerData<T>>>;
1108
+ summary(reference: Tracker, query?: TrackerReadQuery): Promise<z.infer<typeof trackerSummarySchema>>;
1109
+ };
1110
+
1111
+ /**
1112
+ * Which record observations fire a tracker trigger. `"new-record"`: the first observation of each
1113
+ * record this tracker collects. `"new-observation"`: every observation that becomes its record's
1114
+ * current one (a new record, or a later `observedAt`). `"data-changed"`: a new record, or a current
1115
+ * observation whose `data` differs from the record's previous one.
1116
+ */
1117
+ declare const trackerTriggerModeSchema: z.ZodEnum<{
1118
+ "new-record": "new-record";
1119
+ "new-observation": "new-observation";
1120
+ "data-changed": "data-changed";
1121
+ }>;
1122
+ type TrackerTriggerMode = z.infer<typeof trackerTriggerModeSchema>;
1123
+ /**
1124
+ * Custom trackers fire on every new sample; X and Discord trackers on each record they collect,
1125
+ * since a post, message or reaction is one event.
1126
+ */
1127
+ declare function defaultTriggerMode(source: string): TrackerTriggerMode;
1128
+ /** A bound in a tracker trigger filter: a number, or the quest's integer setting of that name. */
1129
+ declare const trackerBoundSchema: z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
1130
+ setting: z.ZodString;
1131
+ }, z.core.$strict>]>;
1132
+ type TrackerBound = z.infer<typeof trackerBoundSchema>;
1133
+ /**
1134
+ * Which firing observations a tracker trigger admits, judged on the record's `data` before any
1135
+ * attribution. `equals` matches a string, number or boolean exactly. `gt`, `gte`, `lt` and `lte`
1136
+ * compare a number, or an integer string such as a base-unit balance, and all must hold.
1137
+ * Observations that do not match are not trigger events: they record no outcome.
1138
+ */
1139
+ declare const trackerConditionSchema: z.ZodUnion<readonly [z.ZodObject<{
1140
+ path: z.ZodString;
1141
+ equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
1142
+ }, z.core.$strict>, z.ZodObject<{
1143
+ path: z.ZodString;
1144
+ gt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
1145
+ setting: z.ZodString;
1146
+ }, z.core.$strict>]>>;
1147
+ gte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
1148
+ setting: z.ZodString;
1149
+ }, z.core.$strict>]>>;
1150
+ lt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
1151
+ setting: z.ZodString;
1152
+ }, z.core.$strict>]>>;
1153
+ lte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
1154
+ setting: z.ZodString;
1155
+ }, z.core.$strict>]>>;
1156
+ }, z.core.$strict>]>;
1157
+ type TrackerCondition = z.infer<typeof trackerConditionSchema>;
1158
+ /** One condition, or a list of conditions that must all hold. */
1159
+ declare const trackerWhereSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
1160
+ path: z.ZodString;
1161
+ equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
1162
+ }, z.core.$strict>, z.ZodObject<{
1163
+ path: z.ZodString;
1164
+ gt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
1165
+ setting: z.ZodString;
1166
+ }, z.core.$strict>]>>;
1167
+ gte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
1168
+ setting: z.ZodString;
1169
+ }, z.core.$strict>]>>;
1170
+ lt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
1171
+ setting: z.ZodString;
1172
+ }, z.core.$strict>]>>;
1173
+ lte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
1174
+ setting: z.ZodString;
1175
+ }, z.core.$strict>]>>;
1176
+ }, z.core.$strict>]>, z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1177
+ path: z.ZodString;
1178
+ equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
1179
+ }, z.core.$strict>, z.ZodObject<{
1180
+ path: z.ZodString;
1181
+ gt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
1182
+ setting: z.ZodString;
1183
+ }, z.core.$strict>]>>;
1184
+ gte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
1185
+ setting: z.ZodString;
1186
+ }, z.core.$strict>]>>;
1187
+ lt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
1188
+ setting: z.ZodString;
1189
+ }, z.core.$strict>]>>;
1190
+ lte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
1191
+ setting: z.ZodString;
1192
+ }, z.core.$strict>]>>;
1193
+ }, z.core.$strict>]>>]>;
1194
+ type TrackerWhere = z.infer<typeof trackerWhereSchema>;
1195
+ /** The conditions of a filter, as a list. */
1196
+ declare function whereConditions(where: TrackerWhere | undefined): TrackerCondition[];
1197
+ /** The settings a filter compares with. */
1198
+ declare function whereSettings(where: TrackerWhere | undefined): string[];
1199
+ type Scalar = string | number | boolean;
1200
+ type Lower = [never, 0, 1, 2, 3, 4];
1201
+ /** The declared string keys of an object type, leaving out index signatures. */
1202
+ type KnownKeys<D> = keyof {
1203
+ [K in keyof D as string extends K ? never : number extends K ? never : K extends string ? K : never]: 0;
1204
+ };
1205
+ type LeafEntries<K extends string, V, N extends number> = unknown extends V ? {
1206
+ path: K | `${K}.${string}`;
1207
+ value: Scalar;
1208
+ } : ([Extract<V, Scalar>] extends [never] ? never : {
1209
+ path: K;
1210
+ value: Extract<V, Scalar>;
1211
+ }) | (DataLeaves<Exclude<V, Scalar | null | undefined>, Lower[N]> extends infer E ? E extends {
1212
+ path: infer P extends string;
1213
+ value: infer T;
1214
+ } ? {
1215
+ path: `${K}.${P}`;
1216
+ value: T;
1217
+ } : never : never);
1218
+ /**
1219
+ * Every dot-separated path into `D` that ends at a string, number or boolean, with the value
1220
+ * there, to five levels deep. A record (`z.record`) takes any key; an object with declared keys
1221
+ * takes only those. Arrays end a path: filters do not index into them.
1222
+ */
1223
+ type DataLeaves<D, N extends number = 5> = [N] extends [never] ? never : D extends readonly unknown[] ? never : D extends object ? [KnownKeys<D>] extends [never] ? string extends keyof D ? LeafEntries<string, D[string & keyof D], N> : never : {
1224
+ [K in KnownKeys<D> & keyof D]-?: LeafEntries<K & string, D[K], N>;
1225
+ }[KnownKeys<D> & keyof D] : never;
1226
+ /** A filter bound: a number, or the quest's integer setting `S`. */
1227
+ type Bound<S extends string = string> = number | {
1228
+ setting: S;
1229
+ };
1230
+ type Comparison<S extends string> = {
1231
+ equals?: never;
1232
+ gt?: Bound<S>;
1233
+ gte?: Bound<S>;
1234
+ lt?: Bound<S>;
1235
+ lte?: Bound<S>;
1236
+ };
1201
1237
  /**
1202
- * Why a tracker trigger skipped an observation, as a stable machine code. Relay applies the rules
1203
- * in this order and records the first that fails. Later versions may add codes; treat an unknown
1204
- * code as a skip whose `reason` explains it.
1205
- *
1206
- * Relay decides a skip again on its own only when the member event that clears it happens:
1207
- * `unlinked-account` when a member links the account, `ambiguous-account` when a conflicting link
1208
- * is removed, `not-joined` when the member joins, `not-enrolled` when the member enrolls. Every
1209
- * other skip is final unless a reviewer retries it, or, for `historical` under
1210
- * `historical: "claim"`, the member claims it.
1238
+ * One filter condition on records whose `data` is `D`: `path` names a field, `equals` takes a
1239
+ * value that field can hold, and comparisons need a number or string (integer string) field.
1240
+ * Untyped data takes any path.
1211
1241
  */
1212
- declare const trackerSkipCodes: readonly ["quest-paused", "before-activation", "outside-window", "future-record", "record-removed", "invalid-record-data", "content-unavailable", "no-account", "beneficiary-is-author", "unlinked-account", "ambiguous-account", "not-joined", "already-completed", "not-enrolled", "before-enrollment", "historical", "prerequisites-incomplete"];
1242
+ type Condition<D, S extends string = string> = unknown extends D ? TrackerCondition : DataLeaves<D> extends infer E ? E extends {
1243
+ path: infer P;
1244
+ value: infer V;
1245
+ } ? {
1246
+ path: P;
1247
+ equals: V;
1248
+ gt?: never;
1249
+ gte?: never;
1250
+ lt?: never;
1251
+ lte?: never;
1252
+ } | ([Extract<V, number | string>] extends [never] ? never : {
1253
+ path: P;
1254
+ } & Comparison<S>) : never : never;
1255
+ /** A typed filter: one condition, or a list of at most 10 conditions that must all hold. */
1256
+ type Where<D, S extends string = string> = Condition<D, S> | readonly [Condition<D, S>, ...Condition<D, S>[]];
1257
+ type BoundSetting<B> = B extends {
1258
+ setting: infer S extends string;
1259
+ } ? S : never;
1260
+ /** The setting names a filter compares with. */
1261
+ type WhereSetting<W> = W extends readonly (infer C)[] ? WhereSetting<C> : W extends object ? {
1262
+ [K in "gt" | "gte" | "lt" | "lte"]: K extends keyof W ? BoundSetting<W[K]> : never;
1263
+ }["gt" | "gte" | "lt" | "lte"] : never;
1213
1264
  /**
1214
- * A skip code this SDK knows.
1215
- *
1216
- * @compat open
1265
+ * Whether members must enroll in the quest (`relay.quests.enroll`) before their activity counts.
1266
+ * `"none"`, the default, counts every member who has joined the project.
1217
1267
  */
1218
- type KnownTrackerSkipCode = (typeof trackerSkipCodes)[number];
1219
- /** A known skip code, or one a newer Relay sends. */
1220
- type TrackerSkipCode = KnownTrackerSkipCode | (string & {});
1268
+ declare const triggerEnrollmentSchema: z.ZodEnum<{
1269
+ none: "none";
1270
+ required: "required";
1271
+ }>;
1272
+ type TriggerEnrollment = z.infer<typeof triggerEnrollmentSchema>;
1221
1273
  /**
1222
- * One tracker-trigger decision: a quest admitted an attempt for a record observation, or skipped
1223
- * it with a code and reason. Operators read these to see why a quest did or did not run.
1274
+ * The earliest activity a tracker trigger considers. `"activation"`, the default: records that
1275
+ * occurred since the quest was published (or last unarchived), others skipped with
1276
+ * `before-activation`. `"window"`: every record in the tracker's window. `"enrollment"`, with
1277
+ * required enrollment: records that occurred since the member enrolled, others skipped with
1278
+ * `before-enrollment`.
1224
1279
  */
1225
- declare const trackerOutcomeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1226
- state: z.ZodLiteral<"admitted">;
1227
- code: z.ZodNull;
1228
- reason: z.ZodNull;
1229
- member: z.ZodString;
1230
- attempt: z.ZodString;
1231
- quest: z.ZodString;
1280
+ declare const triggerSinceSchema: z.ZodEnum<{
1281
+ window: "window";
1282
+ activation: "activation";
1283
+ enrollment: "enrollment";
1284
+ }>;
1285
+ type TriggerSince = z.infer<typeof triggerSinceSchema>;
1286
+ /**
1287
+ * Who releases historical activity: a record that occurred before the member linked the account
1288
+ * it pays (an unknown link time counts as before), or before the member enrolled. `"staff"`: only
1289
+ * a reviewer's retry. `"claim"`: also the member, with `relay.quests.claim`. `"automatic"`: Relay
1290
+ * admits it like any other activity.
1291
+ */
1292
+ declare const triggerHistoricalSchema: z.ZodEnum<{
1293
+ staff: "staff";
1294
+ claim: "claim";
1295
+ automatic: "automatic";
1296
+ }>;
1297
+ type TriggerHistorical = z.infer<typeof triggerHistoricalSchema>;
1298
+ /**
1299
+ * A quest's tracker trigger as published: bound to the tracker's stable ID at publication.
1300
+ * Authoring materializes the firing mode so the stored policy is unambiguous.
1301
+ */
1302
+ declare const trackerTriggerPolicySchema: z.ZodObject<{
1303
+ /** The tracker's authoring key; publication binds it to the tracker's stable ID. */
1232
1304
  tracker: z.ZodString;
1233
- record: z.ZodString;
1234
- observedAt: z.ZodNumber;
1235
- release: z.ZodString;
1236
- account: z.ZodNullable<z.ZodString>;
1237
- createdAt: z.ZodNumber;
1238
- updatedAt: z.ZodNumber;
1239
- actor: z.ZodNullable<z.ZodString>;
1240
- }, z.core.$strip>, z.ZodObject<{
1241
- state: z.ZodLiteral<"skipped">;
1242
- code: z.ZodString;
1243
- reason: z.ZodString;
1244
- window: z.ZodOptional<z.ZodEnum<{
1245
- quest: "quest";
1246
- tracker: "tracker";
1305
+ /**
1306
+ * The tracker's source kind, one of `trackerSourceKinds` today. An open string, so readers of
1307
+ * releases keep parsing them when a later Relay adds a managed source.
1308
+ */
1309
+ source: z.ZodString;
1310
+ /** Which observations fire. */
1311
+ on: z.ZodEnum<{
1312
+ "new-record": "new-record";
1313
+ "new-observation": "new-observation";
1314
+ "data-changed": "data-changed";
1315
+ }>;
1316
+ where: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
1317
+ path: z.ZodString;
1318
+ equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
1319
+ }, z.core.$strict>, z.ZodObject<{
1320
+ path: z.ZodString;
1321
+ gt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
1322
+ setting: z.ZodString;
1323
+ }, z.core.$strict>]>>;
1324
+ gte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
1325
+ setting: z.ZodString;
1326
+ }, z.core.$strict>]>>;
1327
+ lt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
1328
+ setting: z.ZodString;
1329
+ }, z.core.$strict>]>>;
1330
+ lte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
1331
+ setting: z.ZodString;
1332
+ }, z.core.$strict>]>>;
1333
+ }, z.core.$strict>]>, z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1334
+ path: z.ZodString;
1335
+ equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
1336
+ }, z.core.$strict>, z.ZodObject<{
1337
+ path: z.ZodString;
1338
+ gt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
1339
+ setting: z.ZodString;
1340
+ }, z.core.$strict>]>>;
1341
+ gte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
1342
+ setting: z.ZodString;
1343
+ }, z.core.$strict>]>>;
1344
+ lt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
1345
+ setting: z.ZodString;
1346
+ }, z.core.$strict>]>>;
1347
+ lte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
1348
+ setting: z.ZodString;
1349
+ }, z.core.$strict>]>>;
1350
+ }, z.core.$strict>]>>]>>;
1351
+ /**
1352
+ * The record account the quest pays: `author`, `inReplyTo` for an X post, `messageAuthor` for a
1353
+ * Discord reaction, or a named account of a custom record. Relay attributes it through
1354
+ * verified links; evaluators cannot redirect it.
1355
+ */
1356
+ beneficiary: z.ZodString;
1357
+ /** Absent means `"none"`. */
1358
+ enrollment: z.ZodOptional<z.ZodEnum<{
1359
+ none: "none";
1360
+ required: "required";
1247
1361
  }>>;
1248
- member: z.ZodNullable<z.ZodString>;
1249
- attempt: z.ZodNullable<z.ZodString>;
1250
- quest: z.ZodString;
1251
- tracker: z.ZodString;
1252
- record: z.ZodString;
1253
- observedAt: z.ZodNumber;
1254
- release: z.ZodString;
1255
- account: z.ZodNullable<z.ZodString>;
1256
- createdAt: z.ZodNumber;
1257
- updatedAt: z.ZodNumber;
1258
- actor: z.ZodNullable<z.ZodString>;
1259
- }, z.core.$strip>], "state">;
1260
- type TrackerOutcome = z.infer<typeof trackerOutcomeSchema>;
1261
- /** Which of a tracker's trigger outcomes to read: filters, and a page's `nextCursor` as `cursor`. */
1262
- declare const trackerTriggerOutcomeQuerySchema: z.ZodObject<{
1263
- cursor: z.ZodOptional<z.ZodString>;
1264
- /** Quest key or ID. */
1265
- quest: z.ZodOptional<z.ZodString>;
1266
- record: z.ZodOptional<z.ZodString>;
1267
- member: z.ZodOptional<z.ZodString>;
1268
- state: z.ZodOptional<z.ZodEnum<{
1269
- admitted: "admitted";
1270
- skipped: "skipped";
1362
+ /** Absent means `"activation"`. */
1363
+ since: z.ZodOptional<z.ZodEnum<{
1364
+ window: "window";
1365
+ activation: "activation";
1366
+ enrollment: "enrollment";
1271
1367
  }>>;
1272
- /** Only skips with this code, such as `unlinked-account`. */
1273
- code: z.ZodOptional<z.ZodString>;
1274
- limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
1368
+ /** Absent means `"staff"`, or `"claim"` on a content quest. */
1369
+ historical: z.ZodOptional<z.ZodEnum<{
1370
+ staff: "staff";
1371
+ claim: "claim";
1372
+ automatic: "automatic";
1373
+ }>>;
1374
+ /**
1375
+ * A content quest (`content({ tracker })`): one completion per content item, a content stage
1376
+ * that re-evaluates edits and runs `performance`, firing on each new record and paying its
1377
+ * author.
1378
+ */
1379
+ content: z.ZodOptional<z.ZodLiteral<true>>;
1275
1380
  }, z.core.$strict>;
1276
- type TrackerTriggerOutcomeQuery = z.input<typeof trackerTriggerOutcomeQuerySchema>;
1277
- /** One page of a tracker's trigger outcomes, newest first. */
1278
- declare const trackerTriggerOutcomePageSchema: z.ZodObject<{
1279
- items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1280
- state: z.ZodLiteral<"admitted">;
1281
- code: z.ZodNull;
1282
- reason: z.ZodNull;
1283
- member: z.ZodString;
1284
- attempt: z.ZodString;
1285
- quest: z.ZodString;
1286
- tracker: z.ZodString;
1287
- record: z.ZodString;
1288
- observedAt: z.ZodNumber;
1289
- release: z.ZodString;
1290
- account: z.ZodNullable<z.ZodString>;
1291
- createdAt: z.ZodNumber;
1292
- updatedAt: z.ZodNumber;
1293
- actor: z.ZodNullable<z.ZodString>;
1381
+ type TrackerTriggerPolicy = z.infer<typeof trackerTriggerPolicySchema>;
1382
+ /** The firing mode a published policy uses. */
1383
+ declare function triggerMode(policy: Pick<TrackerTriggerPolicy, "on">): TrackerTriggerMode;
1384
+ /** A published policy's admission options, with their defaults filled in. */
1385
+ declare function triggerAdmission(policy: Pick<TrackerTriggerPolicy, "enrollment" | "since" | "historical" | "content">): {
1386
+ enrollment: TriggerEnrollment;
1387
+ since: TriggerSince;
1388
+ historical: TriggerHistorical;
1389
+ };
1390
+ /** The record role a published policy pays. */
1391
+ declare function beneficiaryRole(policy: Pick<TrackerTriggerPolicy, "beneficiary">): AccountRole;
1392
+ /**
1393
+ * Who the record pays and through which verified link, captured at admission. `account.provider`
1394
+ * is the beneficiary account's identity kind. A kind a later Relay adds reads as the last variant,
1395
+ * `{ provider: string }`, so branch on `provider` with a default branch.
1396
+ */
1397
+ declare const trackerAttributionSchema: z.ZodObject<{
1398
+ member: z.ZodString;
1399
+ capturedAt: z.ZodNumber;
1400
+ account: z.ZodUnion<readonly [z.ZodObject<{
1401
+ provider: z.ZodLiteral<"wallet">;
1402
+ id: z.ZodString;
1403
+ revision: z.ZodNumber;
1404
+ linkedAt: z.ZodNullable<z.ZodNumber>;
1405
+ }, z.core.$strip>, z.ZodObject<{
1406
+ issuer: z.ZodString;
1407
+ subject: z.ZodString;
1408
+ revision: z.ZodNumber;
1409
+ linkedAt: z.ZodNullable<z.ZodNumber>;
1410
+ provider: z.ZodLiteral<"x">;
1411
+ }, z.core.$strip>, z.ZodObject<{
1412
+ issuer: z.ZodString;
1413
+ subject: z.ZodString;
1414
+ revision: z.ZodNumber;
1415
+ linkedAt: z.ZodNullable<z.ZodNumber>;
1416
+ provider: z.ZodLiteral<"discord">;
1417
+ }, z.core.$strip>, z.ZodObject<{
1418
+ provider: z.ZodLiteral<"member">;
1419
+ id: z.ZodString;
1294
1420
  }, z.core.$strip>, z.ZodObject<{
1295
- state: z.ZodLiteral<"skipped">;
1296
- code: z.ZodString;
1297
- reason: z.ZodString;
1298
- window: z.ZodOptional<z.ZodEnum<{
1299
- quest: "quest";
1300
- tracker: "tracker";
1301
- }>>;
1302
- member: z.ZodNullable<z.ZodString>;
1303
- attempt: z.ZodNullable<z.ZodString>;
1304
- quest: z.ZodString;
1305
- tracker: z.ZodString;
1306
- record: z.ZodString;
1307
- observedAt: z.ZodNumber;
1308
- release: z.ZodString;
1309
- account: z.ZodNullable<z.ZodString>;
1310
- createdAt: z.ZodNumber;
1311
- updatedAt: z.ZodNumber;
1312
- actor: z.ZodNullable<z.ZodString>;
1313
- }, z.core.$strip>], "state">>;
1314
- nextCursor: z.ZodNullable<z.ZodString>;
1315
- }, z.core.$strip>;
1316
- /** @compat output */
1317
- type TrackerTriggerOutcomePage = z.infer<typeof trackerTriggerOutcomePageSchema>;
1318
- /** @deprecated Use `trackerTriggerOutcomeQuerySchema`. Removed in 2.0.0. */
1319
- declare const trackerOutcomeQuerySchema: z.ZodObject<{
1320
- /** Opaque cursor from `next`: older outcomes. */
1321
- before: z.ZodOptional<z.ZodString>;
1322
- /** Quest key or ID. */
1323
- quest: z.ZodOptional<z.ZodString>;
1324
- record: z.ZodOptional<z.ZodString>;
1325
- member: z.ZodOptional<z.ZodString>;
1326
- state: z.ZodOptional<z.ZodEnum<{
1327
- admitted: "admitted";
1328
- skipped: "skipped";
1329
- }>>;
1330
- /** Only skips with this code, such as `unlinked-account`. */
1331
- code: z.ZodOptional<z.ZodString>;
1332
- limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
1333
- }, z.core.$strict>;
1334
- /** @deprecated Use `TrackerTriggerOutcomeQuery`. Removed in 2.0.0. */
1335
- type TrackerOutcomeQuery = z.input<typeof trackerOutcomeQuerySchema>;
1336
- /** @deprecated Use `trackerTriggerOutcomePageSchema`. Removed in 2.0.0. */
1337
- declare const trackerOutcomePageSchema: z.ZodObject<{
1338
- /** Newest first. */
1339
- items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1340
- state: z.ZodLiteral<"admitted">;
1341
- code: z.ZodNull;
1342
- reason: z.ZodNull;
1343
- member: z.ZodString;
1344
- attempt: z.ZodString;
1345
- quest: z.ZodString;
1346
- tracker: z.ZodString;
1347
- record: z.ZodString;
1348
- observedAt: z.ZodNumber;
1349
- release: z.ZodString;
1350
- account: z.ZodNullable<z.ZodString>;
1351
- createdAt: z.ZodNumber;
1352
- updatedAt: z.ZodNumber;
1353
- actor: z.ZodNullable<z.ZodString>;
1421
+ provider: z.ZodTemplateLiteral<`app:${string}`>;
1422
+ subject: z.ZodString;
1423
+ revision: z.ZodNumber;
1424
+ linkedAt: z.ZodNullable<z.ZodNumber>;
1354
1425
  }, z.core.$strip>, z.ZodObject<{
1355
- state: z.ZodLiteral<"skipped">;
1356
- code: z.ZodString;
1357
- reason: z.ZodString;
1358
- window: z.ZodOptional<z.ZodEnum<{
1359
- quest: "quest";
1360
- tracker: "tracker";
1361
- }>>;
1362
- member: z.ZodNullable<z.ZodString>;
1363
- attempt: z.ZodNullable<z.ZodString>;
1364
- quest: z.ZodString;
1365
- tracker: z.ZodString;
1366
- record: z.ZodString;
1367
- observedAt: z.ZodNumber;
1368
- release: z.ZodString;
1369
- account: z.ZodNullable<z.ZodString>;
1370
- createdAt: z.ZodNumber;
1371
- updatedAt: z.ZodNumber;
1372
- actor: z.ZodNullable<z.ZodString>;
1373
- }, z.core.$strip>], "state">>;
1374
- next: z.ZodNullable<z.ZodString>;
1375
- }, z.core.$strict>;
1376
- /** Re-runs admission for one skipped observation under the quest's current release and links. */
1377
- declare const trackerOutcomeRetrySchema: z.ZodObject<{
1378
- actionId: z.ZodString;
1379
- /** Quest key or ID. */
1380
- quest: z.ZodString;
1381
- record: z.ZodString;
1426
+ provider: z.ZodString;
1427
+ }, z.core.$strip>]>;
1428
+ }, z.core.$strip>;
1429
+ type TrackerAttribution = z.infer<typeof trackerAttributionSchema>;
1430
+ /** The record observation that triggered the attempt, as stored. */
1431
+ declare const trackerTriggerRecordSchema: z.ZodObject<{
1432
+ id: z.ZodString;
1433
+ source: z.ZodString;
1434
+ occurredAt: z.ZodNumber;
1382
1435
  observedAt: z.ZodNumber;
1383
- }, z.core.$strict>;
1384
- declare const trackerQuerySchema: z.ZodObject<{
1385
- author: z.ZodOptional<z.ZodString>;
1386
- member: z.ZodOptional<z.ZodString>;
1387
- verified: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodPipe<z.ZodEnum<{
1388
- true: "true";
1389
- false: "false";
1390
- }>, z.ZodTransform<boolean, "true" | "false">>]>>;
1391
- since: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
1392
- until: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
1393
- removed: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodPipe<z.ZodEnum<{
1394
- true: "true";
1395
- false: "false";
1396
- }>, z.ZodTransform<boolean, "true" | "false">>]>>;
1397
- minLikes: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
1398
- minViews: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
1399
- limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
1400
- cursor: z.ZodOptional<z.ZodString>;
1401
- includeEvidence: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodPipe<z.ZodEnum<{
1402
- true: "true";
1403
- false: "false";
1404
- }>, z.ZodTransform<boolean, "true" | "false">>]>>;
1405
- }, z.core.$strict>;
1406
- type TrackerQuery = z.input<typeof trackerQuerySchema>;
1407
- declare const trackerPageSchema: z.ZodObject<{
1436
+ firstSeenAt: z.ZodNumber;
1437
+ author: z.ZodNullable<z.ZodObject<{
1438
+ id: z.ZodString;
1439
+ verified: z.ZodNullable<z.ZodBoolean>;
1440
+ kind: z.ZodOptional<z.ZodType<OpenIdentityKind, unknown, z.core.$ZodTypeInternals<OpenIdentityKind, unknown>>>;
1441
+ }, z.core.$strip>>;
1442
+ accounts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1443
+ kind: z.ZodOptional<z.ZodType<OpenIdentityKind, unknown, z.core.$ZodTypeInternals<OpenIdentityKind, unknown>>>;
1444
+ id: z.ZodString;
1445
+ }, z.core.$strip>>>;
1446
+ data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
1447
+ removed: z.ZodBoolean;
1448
+ }, z.core.$strip>;
1449
+ /** The captured content of one observation: the body, its revision, and the observation. */
1450
+ declare const trackerContentStageSchema: z.ZodObject<{
1451
+ revision: z.ZodString;
1452
+ observation: z.ZodString;
1453
+ body: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
1454
+ }, z.core.$strip>;
1455
+ /** Immutable admission input of a tracker-triggered attempt: the pinned observation and who it pays. */
1456
+ declare const trackerTriggerContextSchema: z.ZodObject<{
1408
1457
  tracker: z.ZodString;
1409
- items: z.ZodArray<z.ZodObject<{
1458
+ key: z.ZodString;
1459
+ beneficiary: z.ZodString;
1460
+ record: z.ZodObject<{
1410
1461
  id: z.ZodString;
1462
+ source: z.ZodString;
1411
1463
  occurredAt: z.ZodNumber;
1412
1464
  observedAt: z.ZodNumber;
1413
- author: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1465
+ firstSeenAt: z.ZodNumber;
1466
+ author: z.ZodNullable<z.ZodObject<{
1414
1467
  id: z.ZodString;
1415
- verified: z.ZodDefault<z.ZodNullable<z.ZodBoolean>>;
1468
+ verified: z.ZodNullable<z.ZodBoolean>;
1416
1469
  kind: z.ZodOptional<z.ZodType<OpenIdentityKind, unknown, z.core.$ZodTypeInternals<OpenIdentityKind, unknown>>>;
1417
- }, z.core.$strip>>>;
1470
+ }, z.core.$strip>>;
1418
1471
  accounts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1419
1472
  kind: z.ZodOptional<z.ZodType<OpenIdentityKind, unknown, z.core.$ZodTypeInternals<OpenIdentityKind, unknown>>>;
1420
1473
  id: z.ZodString;
1421
1474
  }, z.core.$strip>>>;
1422
1475
  data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
1423
- removed: z.ZodDefault<z.ZodBoolean>;
1424
- source: z.ZodString;
1425
- firstSeenAt: z.ZodNumber;
1426
- evidence: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1427
- contentRevision: z.ZodString;
1428
- observation: z.ZodString;
1429
- }, z.core.$strict>>>;
1476
+ removed: z.ZodBoolean;
1477
+ }, z.core.$strip>;
1478
+ content: z.ZodOptional<z.ZodObject<{
1479
+ revision: z.ZodString;
1480
+ observation: z.ZodString;
1481
+ body: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
1430
1482
  }, z.core.$strip>>;
1431
- nextCursor: z.ZodNullable<z.ZodString>;
1432
- total: z.ZodNumber;
1433
- status: z.ZodObject<{
1434
- archivedAt: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
1435
- published: z.ZodObject<{
1483
+ attribution: z.ZodObject<{
1484
+ member: z.ZodString;
1485
+ capturedAt: z.ZodNumber;
1486
+ account: z.ZodUnion<readonly [z.ZodObject<{
1487
+ provider: z.ZodLiteral<"wallet">;
1436
1488
  id: z.ZodString;
1437
- version: z.ZodString;
1438
- definition: z.ZodObject<{
1439
- source: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
1440
- kind: z.ZodLiteral<"x-search">;
1441
- query: z.ZodString;
1442
- }, z.core.$strip>, z.ZodObject<{
1443
- identities: z.ZodOptional<z.ZodArray<z.ZodType<OpenIdentityKind, unknown, z.core.$ZodTypeInternals<OpenIdentityKind, unknown>>>>;
1444
- kind: z.ZodLiteral<"custom">;
1445
- namespace: z.ZodString;
1446
- accounts: z.ZodOptional<z.ZodArray<z.ZodString>>;
1447
- data: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodType<TrackerDataSchema, unknown, z.core.$ZodTypeInternals<TrackerDataSchema, unknown>>>>;
1448
- content: z.ZodOptional<z.ZodObject<{
1449
- metrics: z.ZodArray<z.ZodString>;
1450
- }, z.core.$strict>>;
1451
- }, z.core.$strip>, z.ZodObject<{
1452
- kind: z.ZodLiteral<"discord-messages">;
1453
- text: z.ZodOptional<z.ZodBoolean>;
1454
- }, z.core.$strip>, z.ZodObject<{
1455
- kind: z.ZodLiteral<"discord-reactions">;
1456
- }, z.core.$strip>], "kind">, z.ZodObject<{
1457
- kind: z.ZodString;
1458
- }, z.core.$catchall<z.ZodJSONSchema>>]>;
1459
- window: z.ZodObject<{
1460
- start: z.ZodNumber;
1461
- end: z.ZodOptional<z.ZodNumber>;
1462
- }, z.core.$strip>;
1463
- key: z.ZodString;
1464
- title: z.ZodString;
1465
- refreshSeconds: z.ZodDefault<z.ZodNumber>;
1466
- maxPages: z.ZodDefault<z.ZodNumber>;
1467
- }, z.core.$strip>;
1468
- publishedAt: z.ZodNumber;
1469
- actor: z.ZodNullable<z.ZodString>;
1470
- }, z.core.$strip>;
1471
- paused: z.ZodBoolean;
1472
- state: z.ZodEnum<{
1473
- error: "error";
1474
- idle: "idle";
1475
- syncing: "syncing";
1476
- complete: "complete";
1477
- }>;
1478
- lastStartedAt: z.ZodNullable<z.ZodNumber>;
1479
- lastCompletedAt: z.ZodNullable<z.ZodNumber>;
1480
- nextSyncAt: z.ZodNullable<z.ZodNumber>;
1481
- coverage: z.ZodEnum<{
1482
- unknown: "unknown";
1483
- complete: "complete";
1484
- partial: "partial";
1485
- }>;
1486
- error: z.ZodNullable<z.ZodString>;
1487
- records: z.ZodNumber;
1488
- }, z.core.$strip>;
1489
- }, z.core.$strip>;
1490
- declare const trackerSummarySchema: z.ZodObject<{
1491
- records: z.ZodNumber;
1492
- authors: z.ZodNumber;
1493
- metrics: z.ZodObject<{
1494
- likes: z.ZodNumber;
1495
- replies: z.ZodNumber;
1496
- reposts: z.ZodNumber;
1497
- quotes: z.ZodNumber;
1498
- views: z.ZodNumber;
1499
- bookmarks: z.ZodNumber;
1500
- }, z.core.$strip>;
1501
- missingMetrics: z.ZodNumber;
1502
- status: z.ZodObject<{
1503
- archivedAt: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
1504
- published: z.ZodObject<{
1489
+ revision: z.ZodNumber;
1490
+ linkedAt: z.ZodNullable<z.ZodNumber>;
1491
+ }, z.core.$strip>, z.ZodObject<{
1492
+ issuer: z.ZodString;
1493
+ subject: z.ZodString;
1494
+ revision: z.ZodNumber;
1495
+ linkedAt: z.ZodNullable<z.ZodNumber>;
1496
+ provider: z.ZodLiteral<"x">;
1497
+ }, z.core.$strip>, z.ZodObject<{
1498
+ issuer: z.ZodString;
1499
+ subject: z.ZodString;
1500
+ revision: z.ZodNumber;
1501
+ linkedAt: z.ZodNullable<z.ZodNumber>;
1502
+ provider: z.ZodLiteral<"discord">;
1503
+ }, z.core.$strip>, z.ZodObject<{
1504
+ provider: z.ZodLiteral<"member">;
1505
1505
  id: z.ZodString;
1506
- version: z.ZodString;
1507
- definition: z.ZodObject<{
1508
- source: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
1509
- kind: z.ZodLiteral<"x-search">;
1510
- query: z.ZodString;
1511
- }, z.core.$strip>, z.ZodObject<{
1512
- identities: z.ZodOptional<z.ZodArray<z.ZodType<OpenIdentityKind, unknown, z.core.$ZodTypeInternals<OpenIdentityKind, unknown>>>>;
1513
- kind: z.ZodLiteral<"custom">;
1514
- namespace: z.ZodString;
1515
- accounts: z.ZodOptional<z.ZodArray<z.ZodString>>;
1516
- data: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodType<TrackerDataSchema, unknown, z.core.$ZodTypeInternals<TrackerDataSchema, unknown>>>>;
1517
- content: z.ZodOptional<z.ZodObject<{
1518
- metrics: z.ZodArray<z.ZodString>;
1519
- }, z.core.$strict>>;
1520
- }, z.core.$strip>, z.ZodObject<{
1521
- kind: z.ZodLiteral<"discord-messages">;
1522
- text: z.ZodOptional<z.ZodBoolean>;
1523
- }, z.core.$strip>, z.ZodObject<{
1524
- kind: z.ZodLiteral<"discord-reactions">;
1525
- }, z.core.$strip>], "kind">, z.ZodObject<{
1526
- kind: z.ZodString;
1527
- }, z.core.$catchall<z.ZodJSONSchema>>]>;
1528
- window: z.ZodObject<{
1529
- start: z.ZodNumber;
1530
- end: z.ZodOptional<z.ZodNumber>;
1531
- }, z.core.$strip>;
1532
- key: z.ZodString;
1533
- title: z.ZodString;
1534
- refreshSeconds: z.ZodDefault<z.ZodNumber>;
1535
- maxPages: z.ZodDefault<z.ZodNumber>;
1536
- }, z.core.$strip>;
1537
- publishedAt: z.ZodNumber;
1538
- actor: z.ZodNullable<z.ZodString>;
1539
- }, z.core.$strip>;
1540
- paused: z.ZodBoolean;
1541
- state: z.ZodEnum<{
1542
- error: "error";
1543
- idle: "idle";
1544
- syncing: "syncing";
1545
- complete: "complete";
1546
- }>;
1547
- lastStartedAt: z.ZodNullable<z.ZodNumber>;
1548
- lastCompletedAt: z.ZodNullable<z.ZodNumber>;
1549
- nextSyncAt: z.ZodNullable<z.ZodNumber>;
1550
- coverage: z.ZodEnum<{
1551
- unknown: "unknown";
1552
- complete: "complete";
1553
- partial: "partial";
1554
- }>;
1555
- error: z.ZodNullable<z.ZodString>;
1556
- records: z.ZodNumber;
1506
+ }, z.core.$strip>, z.ZodObject<{
1507
+ provider: z.ZodTemplateLiteral<`app:${string}`>;
1508
+ subject: z.ZodString;
1509
+ revision: z.ZodNumber;
1510
+ linkedAt: z.ZodNullable<z.ZodNumber>;
1511
+ }, z.core.$strip>, z.ZodObject<{
1512
+ provider: z.ZodString;
1513
+ }, z.core.$strip>]>;
1557
1514
  }, z.core.$strip>;
1515
+ enrolledAt: z.ZodOptional<z.ZodNumber>;
1558
1516
  }, z.core.$strip>;
1559
- /** A record whose `data` has type `D`; untyped records keep JSON object data. */
1560
- type TypedTrackerRecord<D> = unknown extends D ? TrackerRecord : Omit<TrackerRecord, "data"> & {
1561
- data: D;
1562
- };
1563
1517
  /**
1564
- * A page of tracker records whose `data` has type `D`. A page read with a typed tracker handle
1565
- * leaves out records whose data does not match the handle's schema, such as records stored before
1566
- * the schema changed, and counts them in `excluded`; `total` and the cursor still count every
1567
- * record.
1518
+ * The pinned observation of a tracker-triggered attempt. With a typed tracker, `record.data` has
1519
+ * the tracker's data type: ingestion validated it against the tracker's schema.
1568
1520
  */
1569
- type TrackerPage<D = unknown> = Omit<z.infer<typeof trackerPageSchema>, "items"> & (unknown extends D ? {
1570
- items: TrackerRecord[];
1521
+ type ContextShape = z.infer<typeof trackerTriggerContextSchema>;
1522
+ type ContextRecord<D> = unknown extends D ? {
1523
+ record: ContextShape["record"];
1571
1524
  } : {
1572
- items: TypedTrackerRecord<D>[];
1573
- excluded: number;
1574
- });
1575
- /** Preview bounds: one sample, never stored, never a tracker. */
1576
- declare const trackerPreviewLimits: {
1577
- readonly pages: 3;
1578
- readonly posts: 100;
1579
- readonly days: 30;
1525
+ record: Omit<ContextShape["record"], "data"> & {
1526
+ data: D;
1527
+ };
1528
+ };
1529
+ type ContextContent<B> = [B] extends [never] ? {
1530
+ content?: ContextShape["content"];
1531
+ } : {
1532
+ content: Omit<NonNullable<ContextShape["content"]>, "body"> & {
1533
+ body: B;
1534
+ };
1580
1535
  };
1581
- /** A bounded X search sample for exploring a query before defining a tracker in code. */
1582
- declare const trackerPreviewInputSchema: z.ZodObject<{
1583
- query: z.ZodString;
1584
- since: z.ZodNumber;
1585
- }, z.core.$strict>;
1586
- type TrackerPreviewInput = z.input<typeof trackerPreviewInputSchema>;
1587
- declare const trackerPreviewSchema: z.ZodObject<{
1588
- query: z.ZodString;
1589
- since: z.ZodNumber;
1590
- fetchedAt: z.ZodNumber;
1591
- pages: z.ZodNumber;
1592
- posts: z.ZodArray<z.ZodObject<{
1593
- id: z.ZodString;
1594
- userId: z.ZodString;
1595
- content: z.ZodString;
1596
- createdAt: z.ZodISODateTime;
1597
- author: z.ZodObject<{
1598
- id: z.ZodString;
1599
- username: z.ZodString;
1600
- name: z.ZodString;
1601
- verified: z.ZodDefault<z.ZodNullable<z.ZodBoolean>>;
1602
- }, z.core.$loose>;
1603
- likeCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1604
- replyCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1605
- retweetCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1606
- quoteCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1607
- viewCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1608
- bookmarkCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1609
- isReply: z.ZodBoolean;
1610
- isRetweet: z.ZodBoolean;
1611
- isQuoteTweet: z.ZodBoolean;
1612
- }, z.core.$loose>>;
1613
- more: z.ZodBoolean;
1614
- }, z.core.$strip>;
1615
- type TrackerPreview = z.infer<typeof trackerPreviewSchema>;
1616
1536
  /**
1617
- * A tracker read inside an evaluation: the management query plus `asOf`, in epoch milliseconds.
1618
- * Only records that occurred at or before `asOf` count, each as its latest observation Relay had
1619
- * stored when the attempt first read a tracker. `asOf` defaults to `ctx.eligibleAt`; pass
1620
- * `ctx.now` to read everything stored by then.
1537
+ * The pinned observation of a tracker-triggered attempt. With a typed tracker, `record.data` has
1538
+ * the tracker's data type: ingestion validated it against the tracker's schema. On a content
1539
+ * source, `content.body` has the source's body type.
1621
1540
  */
1622
- type TrackerReadQuery = TrackerQuery & {
1623
- asOf?: number;
1541
+ type TrackerTriggerContext<D = unknown, B = never> = Omit<ContextShape, "record" | "content"> & ContextRecord<D> & ContextContent<B>;
1542
+
1543
+ /**
1544
+ * The serializable form of a custom tracker's record `data` schema: a subset of JSON Schema
1545
+ * (draft 2020-12) that `customSource(namespace, { data })` derives from a zod schema. It is stored
1546
+ * with the tracker definition, and ingestion validates each record's `data` against it. The subset
1547
+ * leaves out string patterns and formats, whose regular expressions Relay would otherwise run on
1548
+ * every ingested record, and every keyword whose meaning needs references or evaluation state.
1549
+ */
1550
+ type TrackerDataSchema = {
1551
+ type?: "object" | "array" | "string" | "number" | "integer" | "boolean" | "null";
1552
+ properties?: Record<string, TrackerDataSchema>;
1553
+ required?: string[];
1554
+ additionalProperties?: boolean | TrackerDataSchema;
1555
+ propertyNames?: {
1556
+ type: "string";
1557
+ enum?: string[];
1558
+ };
1559
+ items?: TrackerDataSchema;
1560
+ minItems?: number;
1561
+ maxItems?: number;
1562
+ minLength?: number;
1563
+ maxLength?: number;
1564
+ minimum?: number;
1565
+ maximum?: number;
1566
+ exclusiveMinimum?: number;
1567
+ exclusiveMaximum?: number;
1568
+ enum?: (string | number | boolean | null)[];
1569
+ const?: string | number | boolean | null;
1570
+ anyOf?: TrackerDataSchema[];
1571
+ oneOf?: TrackerDataSchema[];
1572
+ allOf?: TrackerDataSchema[];
1624
1573
  };
1574
+ /** The most branches one union may list. */
1575
+ declare const trackerDataMaxBranches = 16;
1576
+ /** The most properties, `required` keys, enum values or allowed key names one schema node lists. */
1577
+ declare const trackerDataMaxEntries = 256;
1625
1578
  /**
1626
- * Read-only capabilities in hosted quest evaluation; results are captured for replay. Every read
1627
- * in one attempt sees the same stored observations: the attempt pins a snapshot watermark at its
1628
- * first tracker read, so two reads cannot disagree and a retry reads what the first run read.
1629
- * An unknown tracker, or a query the tracker cannot answer, throws `CapabilityError` with code
1630
- * `"author-error"`.
1579
+ * A stored tracker data schema: an object schema in the supported subset, at most 32 KB and
1580
+ * nested at most 16 levels deep, whose unions list at most 16 branches and, inside another union's
1581
+ * branch, at most one branch with properties, items or unions of its own, and whose nodes list at
1582
+ * most 256 properties, `required` keys, enum values or allowed key names.
1631
1583
  */
1632
- type TrackerReader = {
1633
- /**
1634
- * Captures an X body and attribution to the evaluating member, with no live metrics. Null when
1635
- * the tracker has no such record or observation.
1636
- */
1637
- content(reference: Tracker, query: TrackerContentQuery): Promise<TrackerContent | null>;
1638
- /** A page of records; with a tracker handle, each record's `data` has the tracker's type. */
1639
- records<T extends Tracker>(reference: T, query?: TrackerReadQuery): Promise<TrackerPage<TrackerData<T>>>;
1640
- summary(reference: Tracker, query?: TrackerReadQuery): Promise<z.infer<typeof trackerSummarySchema>>;
1584
+ declare const trackerDataSchemaSchema: z.ZodPipe<z.ZodUnknown, z.ZodType<TrackerDataSchema, unknown, z.core.$ZodTypeInternals<TrackerDataSchema, unknown>>>;
1585
+ /**
1586
+ * Converts a zod object schema into the tracker data subset. Throws, naming the field, for types
1587
+ * JSON cannot carry (dates, bigints), for refinements and transforms, which Relay cannot run at
1588
+ * ingestion, and for string patterns and formats.
1589
+ */
1590
+ declare function trackerDataSchema(schema: z.ZodType): TrackerDataSchema;
1591
+ /**
1592
+ * Why a record's data does not match its tracker's schema. `too-complex` means validation spent
1593
+ * its step budget before deciding.
1594
+ */
1595
+ type TrackerDataIssue = {
1596
+ kind: "mismatch" | "too-complex";
1597
+ path: string;
1598
+ reason: string;
1599
+ };
1600
+ /**
1601
+ * Validation steps one record may use. Every unit of work costs a step: each schema node visited
1602
+ * for a value, each object key and `required` key checked, each literal property scanned, each enum
1603
+ * lookup. A step costs well under a microsecond, so one record stays within tens of milliseconds.
1604
+ */
1605
+ declare const trackerDataRecordSteps = 250000;
1606
+ /** Validation steps one ingest batch, or one page of records, may use across its records. */
1607
+ declare const trackerDataBatchSteps = 6000000;
1608
+ /** A step allowance that validation draws down; share one across a batch. */
1609
+ type TrackerDataBudget = {
1610
+ steps: number;
1641
1611
  };
1612
+ /**
1613
+ * The first way a record's `data` fails its tracker's schema, or null when it matches. Validation
1614
+ * draws on `budget`, which defaults to one record's allowance; when it runs out the result is a
1615
+ * `too-complex` issue rather than a decision.
1616
+ */
1617
+ declare function trackerDataIssue(schema: TrackerDataSchema, data: unknown, budget?: TrackerDataBudget): TrackerDataIssue | null;
1618
+ /**
1619
+ * Validates several records' data on one shared allowance: each record may use at most one
1620
+ * record's steps, and all of them together at most one batch's. Returns each record's issue, in
1621
+ * order; once the allowance is spent, every remaining record is `too-complex`.
1622
+ */
1623
+ declare function trackerDataIssues(schema: TrackerDataSchema, records: readonly unknown[]): (TrackerDataIssue | null)[];
1624
+ /**
1625
+ * The JSON types the value at a dot-separated `data` path can have under the schema, or null when
1626
+ * the schema declares no such path. A key must be a declared property, or fall under a record's or
1627
+ * loose object's value schema; an unconstrained value (`z.unknown()`) has every path and type.
1628
+ */
1629
+ declare function trackerDataPathTypes(schema: TrackerDataSchema, path: string): Set<string> | null;
1630
+ /**
1631
+ * Wraps a reader so `records(handle)` returns only records whose data matches the handle's data
1632
+ * schema, the one the quest's types come from, and counts the rest in `excluded`. Reads by key
1633
+ * string and of managed trackers (X and Discord), whose records Relay writes, pass through.
1634
+ */
1635
+ declare function schemaCheckedReader(reader: TrackerReader): TrackerReader;
1636
+ /**
1637
+ * Why a filter cannot match records of a tracker's declared data schema, or null when it can: each
1638
+ * path must be declared, `equals` must name a value its field can hold, and a comparison needs a
1639
+ * number or string field.
1640
+ */
1641
+ declare function whereSchemaIssue(schema: TrackerDataSchema, where: TrackerWhere | undefined): string | null;
1642
1642
 
1643
1643
  declare const pointsRewardSchema: z.ZodObject<{
1644
1644
  kind: z.ZodDefault<z.ZodLiteral<"points">>;
@@ -2310,6 +2310,7 @@ declare const questDescriptionSchema: z.ZodObject<{
2310
2310
  minLength: z.ZodNumber;
2311
2311
  maxLength: z.ZodNumber;
2312
2312
  multiline: z.ZodBoolean;
2313
+ picker: z.ZodOptional<z.ZodString>;
2313
2314
  label: z.ZodString;
2314
2315
  description: z.ZodOptional<z.ZodString>;
2315
2316
  }, z.core.$strict>, z.ZodObject<{
@@ -2760,6 +2761,7 @@ declare const storedQuestDescriptionSchema: z.ZodObject<{
2760
2761
  minLength: z.ZodNumber;
2761
2762
  maxLength: z.ZodNumber;
2762
2763
  multiline: z.ZodBoolean;
2764
+ picker: z.ZodOptional<z.ZodString>;
2763
2765
  label: z.ZodString;
2764
2766
  description: z.ZodOptional<z.ZodString>;
2765
2767
  }, z.core.$strict>, z.ZodObject<{
@@ -3121,6 +3123,7 @@ declare const publishedReleaseSchema: z.ZodObject<{
3121
3123
  minLength: z.ZodNumber;
3122
3124
  maxLength: z.ZodNumber;
3123
3125
  multiline: z.ZodBoolean;
3126
+ picker: z.ZodOptional<z.ZodString>;
3124
3127
  label: z.ZodString;
3125
3128
  description: z.ZodOptional<z.ZodString>;
3126
3129
  }, z.core.$strict>, z.ZodObject<{
@@ -3583,6 +3586,7 @@ declare const templateSchema: z.ZodObject<{
3583
3586
  minLength: z.ZodNumber;
3584
3587
  maxLength: z.ZodNumber;
3585
3588
  multiline: z.ZodBoolean;
3589
+ picker: z.ZodOptional<z.ZodString>;
3586
3590
  label: z.ZodString;
3587
3591
  description: z.ZodOptional<z.ZodString>;
3588
3592
  }, z.core.$strict>, z.ZodObject<{
@@ -5252,6 +5256,7 @@ declare const snapshotSchema: z.ZodObject<{
5252
5256
  minLength: z.ZodNumber;
5253
5257
  maxLength: z.ZodNumber;
5254
5258
  multiline: z.ZodBoolean;
5259
+ picker: z.ZodOptional<z.ZodString>;
5255
5260
  label: z.ZodString;
5256
5261
  description: z.ZodOptional<z.ZodString>;
5257
5262
  }, z.core.$strict>, z.ZodObject<{
@@ -6232,4 +6237,4 @@ declare const contentPerformancePageSchema: z.ZodObject<{
6232
6237
  nextCursor: z.ZodNullable<z.ZodString>;
6233
6238
  }, z.core.$strict>;
6234
6239
 
6235
- export { rewardSchema as $, type Attempt as A, type SourceRoles as B, type LedgerHandle as C, xSearchSourceSchema as D, type Entitlement as E, type XContentMetric as F, type GroupHandle as G, type TrackerTriggerPolicy as H, type IdentityKind as I, type Where as J, type KnownAttemptStatus as K, type LedgerReference as L, type MemberProgress as M, type MemberIdentity as N, type OpenIdentityKind as O, type PhotoResult as P, type QuestBudgetView as Q, type Reward as R, type SubmissionEvidence as S, type TieredRewardReference as T, type TrackerTriggerContext as U, type TrackerReader as V, type WithRecordData as W, type XTweet as X, type TextReviewInput as Y, type TextResult as Z, type Decision as _, AttemptStatus as a, accountRoleSchema as a$, type TrackerTriggerMode as a0, type RoleOf as a1, type WhereSetting as a2, type ContentBody as a3, type BadgeHandle as a4, type ContentMetricName as a5, triggerSchema as a6, type TieredRewardDefinition as a7, type LedgerSetting as a8, type TrackerDataSchema as a9, type ReviewPage as aA, type Snapshot as aB, type TrackerAccount as aC, type TrackerAttribution as aD, type TrackerBound as aE, type TrackerCondition as aF, type TrackerContent as aG, type TrackerContentQuery as aH, type TrackerDataIssue as aI, type TrackerDefinition as aJ, type TrackerDefinitionResponse as aK, type TrackerOutcome as aL, type TrackerOutcomeQuery as aM, type TrackerPreview as aN, type TrackerPreviewInput as aO, type TrackerQuery as aP, type TrackerRecord as aQ, type TrackerSourceKind as aR, type TrackerSourceResponse as aS, type TrackerStatus as aT, type TrackerTriggerOutcomePage as aU, type TrackerTriggerOutcomeQuery as aV, type TrackerWhere as aW, type TriggerEnrollment as aX, type TriggerHistorical as aY, type TriggerSince as aZ, type TypedTrackerRecord as a_, type TrackerPage as aa, type TrackerReadQuery as ab, trackerDataSchema as ac, trackerTriggerContextSchema as ad, type AccountRole as ae, type AppIdentityKind as af, type Bound as ag, type CompletionSource as ah, CompletionSourceKind as ai, type Condition as aj, type ContentPerformanceSnapshot as ak, type DataLeaves as al, type EntitlementCorrection as am, type EntitlementState as an, type KnownCompletionSourceKind as ao, type KnownIdentityKind as ap, type MemberPage as aq, type PickupAvailability as ar, type PublishedRelease as as, type QuestAvailability as at, type QuestDescription as au, type QuestPresentationContent as av, type QuestSettingsInput as aw, type QuestStep as ax, type QuestStepAction as ay, type ReleaseInput as az, type EvaluatorProgress as b, releaseSchema as b$, appIdentityKindSchema as b0, artifactSchema as b1, attemptSchema as b2, badgeReward as b3, badgeRewardSchema as b4, batchReleaseSchema as b5, beginHandoverSchema as b6, beneficiaryRole as b7, completionRecordSchema as b8, completionSourceSchema as b9, mediaUrlSchema as bA, memberIdentitySchema as bB, memberListSchema as bC, memberPageSchema as bD, memberProgressSchema as bE, openIdentityKindSchema as bF, photoResultSchema as bG, pickupAllocationSchema as bH, pickupAvailabilitySchema as bI, pickupCatalogSchema as bJ, pickupPolicySchema as bK, pickupSelectionSchema as bL, pointsRewardSchema as bM, publishedReleaseSchema as bN, publishedTrackerSchema as bO, questAvailabilitySchema as bP, questBudgetViewSchema as bQ, questDescriptionSchema as bR, questPresentationContentSchema as bS, questPresentationRequirementSchema as bT, questPresentationSchema as bU, questProfileSchema as bV, questSettingsInputSchema as bW, questStepActionSchema as bX, questStepSchema as bY, quizAnswersSchema as bZ, quizEvidenceSchema as b_, configurePickupSchema as ba, confirmHandoverSchema as bb, contentMetricNameSchema as bc, contentPerformancePageSchema as bd, contentPerformanceQuerySchema as be, contentPerformanceSnapshotSchema as bf, createStockItemSchema as bg, customContentSchema as bh, decisionSchema as bi, defaultTriggerMode as bj, deferPolicy as bk, entitlementCorrectionSchema as bl, entitlementRecoverySchema as bm, entitlementSchema as bn, entitlementStateSchema as bo, errorSchema as bp, evaluatorProgressSchema as bq, evaluatorProtocol as br, evaluatorProtocolSchema as bs, eventSchema as bt, evidenceSchema as bu, identityKindSchema as bv, integrationRewardSchema as bw, isAppIdentityKind as bx, isKnownTrackerSource as by, knownIdentityKinds as bz, type KnownTrackerSkipCode as c, trackerWhereSchema as c$, reservationSchema as c0, reviewItemSchema as c1, reviewListSchema as c2, reviewModeSchema as c3, reviewPageSchema as c4, rewardBundleSchema as c5, rewardKey as c6, snapshotSchema as c7, sourceContent as c8, sourceIdentities as c9, trackerDefinitionResponseSchema as cA, trackerEvidenceSchema as cB, trackerIngestResultSchema as cC, trackerIngestSchema as cD, trackerOutcomePageSchema as cE, trackerOutcomeQuerySchema as cF, trackerOutcomeRetrySchema as cG, trackerOutcomeSchema as cH, trackerPageSchema as cI, trackerPreviewInputSchema as cJ, trackerPreviewLimits as cK, trackerPreviewSchema as cL, trackerQuerySchema as cM, trackerRecordAccountSchema as cN, trackerRecordInputSchema as cO, trackerRecordSchema as cP, trackerSkipCodes as cQ, trackerSourceKinds as cR, trackerSourceResponseSchema as cS, trackerSourceSchema as cT, trackerStatusSchema as cU, trackerSummarySchema as cV, trackerTriggerModeSchema as cW, trackerTriggerOutcomePageSchema as cX, trackerTriggerOutcomeQuerySchema as cY, trackerTriggerPolicySchema as cZ, trackerTriggerRecordSchema as c_, staffDecisionSchema as ca, stockItemSchema as cb, stockSchema as cc, storedQuestDescriptionSchema as cd, storedReviewModeSchema as ce, submissionEvidenceSchema as cf, submitSchema as cg, templateSchema as ch, textResultSchema as ci, textReviewInputSchema as cj, tierRewardSchema as ck, tieredRewardDefinitionSchema as cl, tieredRewardReferenceSchema as cm, trackerAccountSchema as cn, trackerArtifactSchema as co, trackerAttributionSchema as cp, trackerBoundSchema as cq, trackerConditionSchema as cr, trackerContentQuerySchema as cs, trackerContentReadSchema as ct, trackerContentSchema as cu, trackerContentStageSchema as cv, trackerControlSchema as cw, trackerDataMaxBranches as cx, trackerDataMaxEntries as cy, trackerDataSchemaSchema as cz, type QuestPresentation as d, triggerAdmission as d0, triggerEnrollmentSchema as d1, triggerHistoricalSchema as d2, triggerMode as d3, triggerSinceSchema as d4, whereConditions as d5, whereSettings as d6, xAccountRoles as d7, xContentMetrics as d8, xTweetSchema as d9, type QuestProfile as e, type QuizEvidence as f, type SubmitInput as g, type TrackerSkipCode as h, type TrackerDataBudget as i, trackerDataIssue as j, trackerDataIssues as k, trackerDataPathTypes as l, trackerDataRecordSteps as m, customSourceSchema as n, type WithContent as o, type WithAccountRoles as p, type ResourceHandle as q, type QuestHandle as r, schemaCheckedReader as s, trackerDataBatchSteps as t, type TrackerSource as u, trackerDefinitionSchema as v, whereSchemaIssue as w, xContentBodySchema as x, type Tracker as y, type TrackerData as z };
6240
+ export { type Decision as $, type Attempt as A, type SourceRoles as B, type LedgerHandle as C, type TrackerDataSchema as D, type Entitlement as E, xSearchSourceSchema as F, type GroupHandle as G, type XContentMetric as H, type IdentityKind as I, type TrackerTriggerPolicy as J, type KnownAttemptStatus as K, type LedgerReference as L, type MemberProgress as M, type Where as N, type OpenIdentityKind as O, type PhotoResult as P, type QuestBudgetView as Q, type Reward as R, type SubmissionEvidence as S, type TieredRewardReference as T, type MemberIdentity as U, type TrackerTriggerContext as V, type WithRecordData as W, type XTweet as X, type TrackerReader as Y, type TextReviewInput as Z, type TextResult as _, AttemptStatus as a, accountRoleSchema as a$, rewardSchema as a0, type TrackerTriggerMode as a1, type RoleOf as a2, type WhereSetting as a3, type ContentBody as a4, type BadgeHandle as a5, type ContentMetricName as a6, triggerSchema as a7, type TieredRewardDefinition as a8, type LedgerSetting as a9, type ReviewPage as aA, type Snapshot as aB, type TrackerAccount as aC, type TrackerAttribution as aD, type TrackerBound as aE, type TrackerCondition as aF, type TrackerContent as aG, type TrackerContentQuery as aH, type TrackerDataIssue as aI, type TrackerDefinition as aJ, type TrackerDefinitionResponse as aK, type TrackerOutcome as aL, type TrackerOutcomeQuery as aM, type TrackerPreview as aN, type TrackerPreviewInput as aO, type TrackerQuery as aP, type TrackerRecord as aQ, type TrackerSourceKind as aR, type TrackerSourceResponse as aS, type TrackerStatus as aT, type TrackerTriggerOutcomePage as aU, type TrackerTriggerOutcomeQuery as aV, type TrackerWhere as aW, type TriggerEnrollment as aX, type TriggerHistorical as aY, type TriggerSince as aZ, type TypedTrackerRecord as a_, type TrackerPage as aa, type TrackerReadQuery as ab, trackerDataSchema as ac, trackerTriggerContextSchema as ad, type AccountRole as ae, type AppIdentityKind as af, type Bound as ag, type CompletionSource as ah, CompletionSourceKind as ai, type Condition as aj, type ContentPerformanceSnapshot as ak, type DataLeaves as al, type EntitlementCorrection as am, type EntitlementState as an, type KnownCompletionSourceKind as ao, type KnownIdentityKind as ap, type MemberPage as aq, type PickupAvailability as ar, type PublishedRelease as as, type QuestAvailability as at, type QuestDescription as au, type QuestPresentationContent as av, type QuestSettingsInput as aw, type QuestStep as ax, type QuestStepAction as ay, type ReleaseInput as az, type EvaluatorProgress as b, releaseSchema as b$, appIdentityKindSchema as b0, artifactSchema as b1, attemptSchema as b2, badgeReward as b3, badgeRewardSchema as b4, batchReleaseSchema as b5, beginHandoverSchema as b6, beneficiaryRole as b7, completionRecordSchema as b8, completionSourceSchema as b9, mediaUrlSchema as bA, memberIdentitySchema as bB, memberListSchema as bC, memberPageSchema as bD, memberProgressSchema as bE, openIdentityKindSchema as bF, photoResultSchema as bG, pickupAllocationSchema as bH, pickupAvailabilitySchema as bI, pickupCatalogSchema as bJ, pickupPolicySchema as bK, pickupSelectionSchema as bL, pointsRewardSchema as bM, publishedReleaseSchema as bN, publishedTrackerSchema as bO, questAvailabilitySchema as bP, questBudgetViewSchema as bQ, questDescriptionSchema as bR, questPresentationContentSchema as bS, questPresentationRequirementSchema as bT, questPresentationSchema as bU, questProfileSchema as bV, questSettingsInputSchema as bW, questStepActionSchema as bX, questStepSchema as bY, quizAnswersSchema as bZ, quizEvidenceSchema as b_, configurePickupSchema as ba, confirmHandoverSchema as bb, contentMetricNameSchema as bc, contentPerformancePageSchema as bd, contentPerformanceQuerySchema as be, contentPerformanceSnapshotSchema as bf, createStockItemSchema as bg, customContentSchema as bh, decisionSchema as bi, defaultTriggerMode as bj, deferPolicy as bk, entitlementCorrectionSchema as bl, entitlementRecoverySchema as bm, entitlementSchema as bn, entitlementStateSchema as bo, errorSchema as bp, evaluatorProgressSchema as bq, evaluatorProtocol as br, evaluatorProtocolSchema as bs, eventSchema as bt, evidenceSchema as bu, identityKindSchema as bv, integrationRewardSchema as bw, isAppIdentityKind as bx, isKnownTrackerSource as by, knownIdentityKinds as bz, type KnownTrackerSkipCode as c, trackerWhereSchema as c$, reservationSchema as c0, reviewItemSchema as c1, reviewListSchema as c2, reviewModeSchema as c3, reviewPageSchema as c4, rewardBundleSchema as c5, rewardKey as c6, snapshotSchema as c7, sourceContent as c8, sourceIdentities as c9, trackerDefinitionResponseSchema as cA, trackerEvidenceSchema as cB, trackerIngestResultSchema as cC, trackerIngestSchema as cD, trackerOutcomePageSchema as cE, trackerOutcomeQuerySchema as cF, trackerOutcomeRetrySchema as cG, trackerOutcomeSchema as cH, trackerPageSchema as cI, trackerPreviewInputSchema as cJ, trackerPreviewLimits as cK, trackerPreviewSchema as cL, trackerQuerySchema as cM, trackerRecordAccountSchema as cN, trackerRecordInputSchema as cO, trackerRecordSchema as cP, trackerSkipCodes as cQ, trackerSourceKinds as cR, trackerSourceResponseSchema as cS, trackerSourceSchema as cT, trackerStatusSchema as cU, trackerSummarySchema as cV, trackerTriggerModeSchema as cW, trackerTriggerOutcomePageSchema as cX, trackerTriggerOutcomeQuerySchema as cY, trackerTriggerPolicySchema as cZ, trackerTriggerRecordSchema as c_, staffDecisionSchema as ca, stockItemSchema as cb, stockSchema as cc, storedQuestDescriptionSchema as cd, storedReviewModeSchema as ce, submissionEvidenceSchema as cf, submitSchema as cg, templateSchema as ch, textResultSchema as ci, textReviewInputSchema as cj, tierRewardSchema as ck, tieredRewardDefinitionSchema as cl, tieredRewardReferenceSchema as cm, trackerAccountSchema as cn, trackerArtifactSchema as co, trackerAttributionSchema as cp, trackerBoundSchema as cq, trackerConditionSchema as cr, trackerContentQuerySchema as cs, trackerContentReadSchema as ct, trackerContentSchema as cu, trackerContentStageSchema as cv, trackerControlSchema as cw, trackerDataMaxBranches as cx, trackerDataMaxEntries as cy, trackerDataSchemaSchema as cz, type QuestPresentation as d, triggerAdmission as d0, triggerEnrollmentSchema as d1, triggerHistoricalSchema as d2, triggerMode as d3, triggerSinceSchema as d4, whereConditions as d5, whereSettings as d6, xAccountRoles as d7, xContentMetrics as d8, xTweetSchema as d9, type QuestProfile as e, type QuizEvidence as f, type SubmitInput as g, type TrackerSkipCode as h, type TrackerDataBudget as i, trackerDataIssue as j, trackerDataIssues as k, trackerDataPathTypes as l, trackerDataRecordSteps as m, customSourceSchema as n, type WithContent as o, type WithAccountRoles as p, type ResourceHandle as q, type QuestHandle as r, schemaCheckedReader as s, trackerDataBatchSteps as t, type TrackerSource as u, trackerDefinitionSchema as v, whereSchemaIssue as w, xContentBodySchema as x, type Tracker as y, type TrackerData as z };