@domino-sdk/relay 1.0.0-next.8 → 1.0.0-next.9

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.
@@ -1,53 +1,502 @@
1
1
  import { z } from 'zod';
2
+ import { P as PhotoResult } from './schema-Di3aLSiK.js';
2
3
 
3
- declare const resourceSourceSchema: z.ZodUnion<readonly [z.ZodObject<{
4
- provider: z.ZodLiteral<"domino">;
5
- resource: z.ZodLiteral<"point-ledger">;
6
- }, z.core.$strict>, z.ZodObject<{
7
- provider: z.ZodLiteral<"discord">;
8
- resource: z.ZodLiteral<"channel">;
9
- types: z.ZodArray<z.ZodEnum<{
10
- text: "text";
11
- announcement: "announcement";
12
- }>>;
4
+ /**
5
+ * Which record observations fire a tracker trigger. `"new-record"`: the first observation of each
6
+ * record this tracker collects. `"new-observation"`: every observation that becomes its record's
7
+ * current one (a new record, or a later `observedAt`). `"data-changed"`: a new record, or a current
8
+ * observation whose `data` differs from the record's previous one.
9
+ */
10
+ declare const trackerTriggerModeSchema: z.ZodEnum<{
11
+ "new-record": "new-record";
12
+ "new-observation": "new-observation";
13
+ "data-changed": "data-changed";
14
+ }>;
15
+ type TrackerTriggerMode = z.infer<typeof trackerTriggerModeSchema>;
16
+ /** X trackers fire on discoveries; custom trackers on every new sample. */
17
+ declare function defaultTriggerMode(source: "x-search" | "custom"): TrackerTriggerMode;
18
+ /** A bound in a tracker trigger filter: a number, or the quest's integer setting of that name. */
19
+ declare const trackerBoundSchema: z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
20
+ setting: z.ZodString;
21
+ }, z.core.$strict>]>;
22
+ type TrackerBound = z.infer<typeof trackerBoundSchema>;
23
+ /**
24
+ * Which firing observations a tracker trigger admits, judged on the record's `data` before any
25
+ * attribution. `equals` matches a string, number or boolean exactly. `gt`, `gte`, `lt` and `lte`
26
+ * compare a number, or an integer string such as a base-unit balance, and all must hold.
27
+ * Observations that do not match are not trigger events: they record no outcome.
28
+ */
29
+ declare const trackerConditionSchema: z.ZodUnion<readonly [z.ZodObject<{
30
+ path: z.ZodString;
31
+ equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
13
32
  }, z.core.$strict>, z.ZodObject<{
14
- provider: z.ZodLiteral<"discord">;
15
- resource: z.ZodLiteral<"role">;
16
- assignable: z.ZodDefault<z.ZodBoolean>;
33
+ path: z.ZodString;
34
+ gt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
35
+ setting: z.ZodString;
36
+ }, z.core.$strict>]>>;
37
+ gte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
38
+ setting: z.ZodString;
39
+ }, z.core.$strict>]>>;
40
+ lt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
41
+ setting: z.ZodString;
42
+ }, z.core.$strict>]>>;
43
+ lte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
44
+ setting: z.ZodString;
45
+ }, z.core.$strict>]>>;
17
46
  }, z.core.$strict>]>;
18
- type ResourceSource = z.infer<typeof resourceSourceSchema>;
19
- declare const resourceRequestSchema: z.ZodObject<{
20
- source: z.ZodUnion<readonly [z.ZodObject<{
21
- provider: z.ZodLiteral<"domino">;
22
- resource: z.ZodLiteral<"point-ledger">;
47
+ type TrackerCondition = z.infer<typeof trackerConditionSchema>;
48
+ /** One condition, or a list of conditions that must all hold. */
49
+ declare const trackerWhereSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
50
+ path: z.ZodString;
51
+ equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
52
+ }, z.core.$strict>, z.ZodObject<{
53
+ path: z.ZodString;
54
+ gt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
55
+ setting: z.ZodString;
56
+ }, z.core.$strict>]>>;
57
+ gte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
58
+ setting: z.ZodString;
59
+ }, z.core.$strict>]>>;
60
+ lt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
61
+ setting: z.ZodString;
62
+ }, z.core.$strict>]>>;
63
+ lte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
64
+ setting: z.ZodString;
65
+ }, z.core.$strict>]>>;
66
+ }, z.core.$strict>]>, z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
67
+ path: z.ZodString;
68
+ equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
69
+ }, z.core.$strict>, z.ZodObject<{
70
+ path: z.ZodString;
71
+ gt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
72
+ setting: z.ZodString;
73
+ }, z.core.$strict>]>>;
74
+ gte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
75
+ setting: z.ZodString;
76
+ }, z.core.$strict>]>>;
77
+ lt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
78
+ setting: z.ZodString;
79
+ }, z.core.$strict>]>>;
80
+ lte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
81
+ setting: z.ZodString;
82
+ }, z.core.$strict>]>>;
83
+ }, z.core.$strict>]>>]>;
84
+ type TrackerWhere = z.infer<typeof trackerWhereSchema>;
85
+ /** The conditions of a filter, as a list. */
86
+ declare function whereConditions(where: TrackerWhere | undefined): TrackerCondition[];
87
+ /** The settings a filter compares with. */
88
+ declare function whereSettings(where: TrackerWhere | undefined): string[];
89
+ type Scalar = string | number | boolean;
90
+ type Lower = [never, 0, 1, 2, 3, 4];
91
+ /** The declared string keys of an object type, leaving out index signatures. */
92
+ type KnownKeys<D> = keyof {
93
+ [K in keyof D as string extends K ? never : number extends K ? never : K extends string ? K : never]: 0;
94
+ };
95
+ type LeafEntries<K extends string, V, N extends number> = unknown extends V ? {
96
+ path: K | `${K}.${string}`;
97
+ value: Scalar;
98
+ } : ([Extract<V, Scalar>] extends [never] ? never : {
99
+ path: K;
100
+ value: Extract<V, Scalar>;
101
+ }) | (DataLeaves<Exclude<V, Scalar | null | undefined>, Lower[N]> extends infer E ? E extends {
102
+ path: infer P extends string;
103
+ value: infer T;
104
+ } ? {
105
+ path: `${K}.${P}`;
106
+ value: T;
107
+ } : never : never);
108
+ /**
109
+ * Every dot-separated path into `D` that ends at a string, number or boolean, with the value
110
+ * there, to five levels deep. A record (`z.record`) takes any key; an object with declared keys
111
+ * takes only those. Arrays end a path: filters do not index into them.
112
+ */
113
+ 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 : {
114
+ [K in KnownKeys<D> & keyof D]-?: LeafEntries<K & string, D[K], N>;
115
+ }[KnownKeys<D> & keyof D] : never;
116
+ /** A filter bound: a number, or the quest's integer setting `S`. */
117
+ type Bound<S extends string = string> = number | {
118
+ setting: S;
119
+ };
120
+ type Comparison<S extends string> = {
121
+ equals?: never;
122
+ gt?: Bound<S>;
123
+ gte?: Bound<S>;
124
+ lt?: Bound<S>;
125
+ lte?: Bound<S>;
126
+ };
127
+ /**
128
+ * One filter condition on records whose `data` is `D`: `path` names a field, `equals` takes a
129
+ * value that field can hold, and comparisons need a number or string (integer string) field.
130
+ * Untyped data takes any path.
131
+ */
132
+ type Condition<D, S extends string = string> = unknown extends D ? TrackerCondition : DataLeaves<D> extends infer E ? E extends {
133
+ path: infer P;
134
+ value: infer V;
135
+ } ? {
136
+ path: P;
137
+ equals: V;
138
+ gt?: never;
139
+ gte?: never;
140
+ lt?: never;
141
+ lte?: never;
142
+ } | ([Extract<V, number | string>] extends [never] ? never : {
143
+ path: P;
144
+ } & Comparison<S>) : never : never;
145
+ /** A typed filter: one condition, or a list of at most 10 conditions that must all hold. */
146
+ type Where<D, S extends string = string> = Condition<D, S> | readonly [Condition<D, S>, ...Condition<D, S>[]];
147
+ type BoundSetting<B> = B extends {
148
+ setting: infer S extends string;
149
+ } ? S : never;
150
+ /** The setting names a filter compares with. */
151
+ type WhereSetting<W> = W extends readonly (infer C)[] ? WhereSetting<C> : W extends object ? {
152
+ [K in "gt" | "gte" | "lt" | "lte"]: K extends keyof W ? BoundSetting<W[K]> : never;
153
+ }["gt" | "gte" | "lt" | "lte"] : never;
154
+ /**
155
+ * A quest's tracker trigger as published: bound to the tracker's stable ID at publication. Keys
156
+ * that equal their default are left out, so a policy without `where` or a non-default `on` keeps
157
+ * the shape SDKs before 0.28 read.
158
+ */
159
+ declare const trackerTriggerPolicySchema: z.ZodObject<{
160
+ /** The tracker's authoring key; publication binds it to the tracker's stable ID. */
161
+ tracker: z.ZodString;
162
+ source: z.ZodEnum<{
163
+ custom: "custom";
164
+ "x-search": "x-search";
165
+ }>;
166
+ /** Which observations fire; absent means the source's default (`defaultTriggerMode`). */
167
+ on: z.ZodOptional<z.ZodEnum<{
168
+ "new-record": "new-record";
169
+ "new-observation": "new-observation";
170
+ "data-changed": "data-changed";
171
+ }>>;
172
+ where: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
173
+ path: z.ZodString;
174
+ equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
23
175
  }, z.core.$strict>, z.ZodObject<{
24
- provider: z.ZodLiteral<"discord">;
25
- resource: z.ZodLiteral<"channel">;
26
- types: z.ZodArray<z.ZodEnum<{
27
- text: "text";
28
- announcement: "announcement";
29
- }>>;
176
+ path: z.ZodString;
177
+ gt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
178
+ setting: z.ZodString;
179
+ }, z.core.$strict>]>>;
180
+ gte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
181
+ setting: z.ZodString;
182
+ }, z.core.$strict>]>>;
183
+ lt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
184
+ setting: z.ZodString;
185
+ }, z.core.$strict>]>>;
186
+ lte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
187
+ setting: z.ZodString;
188
+ }, z.core.$strict>]>>;
189
+ }, z.core.$strict>]>, z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
190
+ path: z.ZodString;
191
+ equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
30
192
  }, z.core.$strict>, z.ZodObject<{
193
+ path: z.ZodString;
194
+ gt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
195
+ setting: z.ZodString;
196
+ }, z.core.$strict>]>>;
197
+ gte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
198
+ setting: z.ZodString;
199
+ }, z.core.$strict>]>>;
200
+ lt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
201
+ setting: z.ZodString;
202
+ }, z.core.$strict>]>>;
203
+ lte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
204
+ setting: z.ZodString;
205
+ }, z.core.$strict>]>>;
206
+ }, z.core.$strict>]>>]>>;
207
+ /**
208
+ * The record account the quest pays: `author`, `inReplyTo` for an X post, or a named account of
209
+ * a custom record. Relay attributes it through verified links; evaluators cannot redirect it.
210
+ * Releases published before account roles store `"replied-to"` for `inReplyTo`.
211
+ */
212
+ beneficiary: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"replied-to">]>;
213
+ }, z.core.$strict>;
214
+ type TrackerTriggerPolicy = z.infer<typeof trackerTriggerPolicySchema>;
215
+ /** The firing mode a published policy uses: its `on`, or its source's default. */
216
+ declare function triggerMode(policy: Pick<TrackerTriggerPolicy, "on" | "source">): TrackerTriggerMode;
217
+ /** The record role a published policy pays. A stored `"replied-to"` is the `inReplyTo` role. */
218
+ declare function beneficiaryRole(policy: Pick<TrackerTriggerPolicy, "beneficiary">): AccountRole;
219
+ /** Who the record pays and through which verified link, captured at admission. */
220
+ declare const trackerAttributionSchema: z.ZodObject<{
221
+ member: z.ZodString;
222
+ capturedAt: z.ZodNumber;
223
+ account: z.ZodDiscriminatedUnion<[z.ZodObject<{
224
+ provider: z.ZodLiteral<"wallet">;
225
+ /** Canonical CAIP-10 account ID, as the record names it. */
226
+ id: z.ZodString;
227
+ /** The wallet link's revision. */
228
+ revision: z.ZodNumber;
229
+ /** When the member verified the wallet. */
230
+ linkedAt: z.ZodNullable<z.ZodNumber>;
231
+ }, z.core.$strict>, z.ZodObject<{
232
+ issuer: z.ZodString;
233
+ /** The account's stable user ID. */
234
+ subject: z.ZodString;
235
+ /** The member's account selection revision. */
236
+ revision: z.ZodNumber;
237
+ /** When the member linked the account; null when unknown. */
238
+ linkedAt: z.ZodNullable<z.ZodNumber>;
239
+ provider: z.ZodLiteral<"x">;
240
+ }, z.core.$strict>, z.ZodObject<{
241
+ issuer: z.ZodString;
242
+ /** The account's stable user ID. */
243
+ subject: z.ZodString;
244
+ /** The member's account selection revision. */
245
+ revision: z.ZodNumber;
246
+ /** When the member linked the account; null when unknown. */
247
+ linkedAt: z.ZodNullable<z.ZodNumber>;
31
248
  provider: z.ZodLiteral<"discord">;
32
- resource: z.ZodLiteral<"role">;
33
- assignable: z.ZodDefault<z.ZodBoolean>;
34
- }, z.core.$strict>]>;
35
- query: z.ZodOptional<z.ZodString>;
36
- cursor: z.ZodOptional<z.ZodString>;
37
- ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
249
+ }, z.core.$strict>, z.ZodObject<{
250
+ provider: z.ZodLiteral<"member">;
251
+ /** The member ID the record names. */
252
+ id: z.ZodString;
253
+ }, z.core.$strict>], "provider">;
38
254
  }, z.core.$strict>;
39
- declare const resourceOptionsSchema: z.ZodObject<{
40
- revision: z.ZodNumber;
41
- options: z.ZodArray<z.ZodObject<{
255
+ type TrackerAttribution = z.infer<typeof trackerAttributionSchema>;
256
+ /** The record observation that triggered the attempt, as stored. */
257
+ declare const trackerTriggerRecordSchema: z.ZodObject<{
258
+ id: z.ZodString;
259
+ source: z.ZodString;
260
+ occurredAt: z.ZodNumber;
261
+ observedAt: z.ZodNumber;
262
+ firstSeenAt: z.ZodNumber;
263
+ author: z.ZodNullable<z.ZodObject<{
42
264
  id: z.ZodString;
43
- label: z.ZodString;
44
- description: z.ZodOptional<z.ZodString>;
45
- group: z.ZodOptional<z.ZodString>;
46
- disabledReason: z.ZodOptional<z.ZodString>;
47
- }, z.core.$strip>>;
48
- cursor: z.ZodNullable<z.ZodString>;
49
- }, z.core.$strip>;
50
- type ResourceOption = z.infer<typeof resourceOptionsSchema>["options"][number];
265
+ verified: z.ZodNullable<z.ZodBoolean>;
266
+ kind: z.ZodOptional<z.ZodEnum<{
267
+ x: "x";
268
+ discord: "discord";
269
+ member: "member";
270
+ wallet: "wallet";
271
+ }>>;
272
+ }, z.core.$strict>>;
273
+ accounts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
274
+ kind: z.ZodOptional<z.ZodEnum<{
275
+ x: "x";
276
+ discord: "discord";
277
+ member: "member";
278
+ wallet: "wallet";
279
+ }>>;
280
+ id: z.ZodString;
281
+ }, z.core.$strict>>>;
282
+ data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
283
+ removed: z.ZodBoolean;
284
+ }, z.core.$strict>;
285
+ /** Immutable admission input of a tracker-triggered attempt: the pinned observation and who it pays. */
286
+ declare const trackerTriggerContextSchema: z.ZodObject<{
287
+ /** The tracker's stable ID. */
288
+ tracker: z.ZodString;
289
+ /** The tracker's authoring key. */
290
+ key: z.ZodString;
291
+ /**
292
+ * The record account the attempt pays, as the quest's release names it. Releases published
293
+ * before account roles name `inReplyTo` `"replied-to"`, which their bundled evaluators expect.
294
+ */
295
+ beneficiary: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"replied-to">]>;
296
+ record: z.ZodObject<{
297
+ id: z.ZodString;
298
+ source: z.ZodString;
299
+ occurredAt: z.ZodNumber;
300
+ observedAt: z.ZodNumber;
301
+ firstSeenAt: z.ZodNumber;
302
+ author: z.ZodNullable<z.ZodObject<{
303
+ id: z.ZodString;
304
+ verified: z.ZodNullable<z.ZodBoolean>;
305
+ kind: z.ZodOptional<z.ZodEnum<{
306
+ x: "x";
307
+ discord: "discord";
308
+ member: "member";
309
+ wallet: "wallet";
310
+ }>>;
311
+ }, z.core.$strict>>;
312
+ accounts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
313
+ kind: z.ZodOptional<z.ZodEnum<{
314
+ x: "x";
315
+ discord: "discord";
316
+ member: "member";
317
+ wallet: "wallet";
318
+ }>>;
319
+ id: z.ZodString;
320
+ }, z.core.$strict>>>;
321
+ data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
322
+ removed: z.ZodBoolean;
323
+ }, z.core.$strict>;
324
+ /** The captured X post of this observation; null for custom trackers. */
325
+ x: z.ZodNullable<z.ZodObject<{
326
+ evidence: z.ZodObject<{
327
+ contentRevision: z.ZodString;
328
+ observation: z.ZodString;
329
+ }, z.core.$strict>;
330
+ content: z.ZodObject<{
331
+ version: z.ZodLiteral<1>;
332
+ id: z.ZodString;
333
+ authorId: z.ZodString;
334
+ publishedAt: z.ZodNumber;
335
+ text: z.ZodString;
336
+ isReply: z.ZodBoolean;
337
+ isRetweet: z.ZodBoolean;
338
+ isQuoteTweet: z.ZodBoolean;
339
+ media: z.ZodNullable<z.ZodArray<z.ZodObject<{
340
+ type: z.ZodString;
341
+ url: z.ZodString;
342
+ }, z.core.$strict>>>;
343
+ mentionedAuthorIds: z.ZodNullable<z.ZodArray<z.ZodString>>;
344
+ videoLengthSeconds: z.ZodNullable<z.ZodNumber>;
345
+ references: z.ZodObject<{
346
+ replyId: z.ZodNullable<z.ZodString>;
347
+ replyAuthorId: z.ZodNullable<z.ZodString>;
348
+ quoteId: z.ZodNullable<z.ZodString>;
349
+ quoteAuthorId: z.ZodNullable<z.ZodString>;
350
+ repostId: z.ZodNullable<z.ZodString>;
351
+ repostAuthorId: z.ZodNullable<z.ZodString>;
352
+ }, z.core.$strict>;
353
+ }, z.core.$strict>;
354
+ }, z.core.$strict>>;
355
+ attribution: z.ZodObject<{
356
+ member: z.ZodString;
357
+ capturedAt: z.ZodNumber;
358
+ account: z.ZodDiscriminatedUnion<[z.ZodObject<{
359
+ provider: z.ZodLiteral<"wallet">;
360
+ /** Canonical CAIP-10 account ID, as the record names it. */
361
+ id: z.ZodString;
362
+ /** The wallet link's revision. */
363
+ revision: z.ZodNumber;
364
+ /** When the member verified the wallet. */
365
+ linkedAt: z.ZodNullable<z.ZodNumber>;
366
+ }, z.core.$strict>, z.ZodObject<{
367
+ issuer: z.ZodString;
368
+ /** The account's stable user ID. */
369
+ subject: z.ZodString;
370
+ /** The member's account selection revision. */
371
+ revision: z.ZodNumber;
372
+ /** When the member linked the account; null when unknown. */
373
+ linkedAt: z.ZodNullable<z.ZodNumber>;
374
+ provider: z.ZodLiteral<"x">;
375
+ }, z.core.$strict>, z.ZodObject<{
376
+ issuer: z.ZodString;
377
+ /** The account's stable user ID. */
378
+ subject: z.ZodString;
379
+ /** The member's account selection revision. */
380
+ revision: z.ZodNumber;
381
+ /** When the member linked the account; null when unknown. */
382
+ linkedAt: z.ZodNullable<z.ZodNumber>;
383
+ provider: z.ZodLiteral<"discord">;
384
+ }, z.core.$strict>, z.ZodObject<{
385
+ provider: z.ZodLiteral<"member">;
386
+ /** The member ID the record names. */
387
+ id: z.ZodString;
388
+ }, z.core.$strict>], "provider">;
389
+ }, z.core.$strict>;
390
+ }, z.core.$strict>;
391
+ /**
392
+ * The pinned observation of a tracker-triggered attempt. With a typed tracker, `record.data` has
393
+ * the tracker's data type: ingestion validated it against the tracker's schema.
394
+ */
395
+ type TrackerTriggerContext<D = unknown> = unknown extends D ? z.infer<typeof trackerTriggerContextSchema> : Omit<z.infer<typeof trackerTriggerContextSchema>, "record"> & {
396
+ record: Omit<z.infer<typeof trackerTriggerContextSchema>["record"], "data"> & {
397
+ data: D;
398
+ };
399
+ };
400
+
401
+ /**
402
+ * The serializable form of a custom tracker's record `data` schema: a subset of JSON Schema
403
+ * (draft 2020-12) that `customSource(namespace, { data })` derives from a zod schema. It is stored
404
+ * with the tracker definition, and ingestion validates each record's `data` against it. The subset
405
+ * leaves out string patterns and formats, whose regular expressions Relay would otherwise run on
406
+ * every ingested record, and every keyword whose meaning needs references or evaluation state.
407
+ */
408
+ type TrackerDataSchema = {
409
+ type?: "object" | "array" | "string" | "number" | "integer" | "boolean" | "null";
410
+ properties?: Record<string, TrackerDataSchema>;
411
+ required?: string[];
412
+ additionalProperties?: boolean | TrackerDataSchema;
413
+ propertyNames?: {
414
+ type: "string";
415
+ enum?: string[];
416
+ };
417
+ items?: TrackerDataSchema;
418
+ minItems?: number;
419
+ maxItems?: number;
420
+ minLength?: number;
421
+ maxLength?: number;
422
+ minimum?: number;
423
+ maximum?: number;
424
+ exclusiveMinimum?: number;
425
+ exclusiveMaximum?: number;
426
+ enum?: (string | number | boolean | null)[];
427
+ const?: string | number | boolean | null;
428
+ anyOf?: TrackerDataSchema[];
429
+ oneOf?: TrackerDataSchema[];
430
+ allOf?: TrackerDataSchema[];
431
+ };
432
+ /** The most branches one union may list. */
433
+ declare const trackerDataMaxBranches = 16;
434
+ /** The most properties, `required` keys, enum values or allowed key names one schema node lists. */
435
+ declare const trackerDataMaxEntries = 256;
436
+ /**
437
+ * A stored tracker data schema: an object schema in the supported subset, at most 32 KB and
438
+ * nested at most 16 levels deep, whose unions list at most 16 branches and, inside another union's
439
+ * branch, at most one branch with properties, items or unions of its own, and whose nodes list at
440
+ * most 256 properties, `required` keys, enum values or allowed key names.
441
+ */
442
+ declare const trackerDataSchemaSchema: z.ZodPipe<z.ZodUnknown, z.ZodType<TrackerDataSchema, unknown, z.core.$ZodTypeInternals<TrackerDataSchema, unknown>>>;
443
+ /**
444
+ * Converts a zod object schema into the tracker data subset. Throws, naming the field, for types
445
+ * JSON cannot carry (dates, bigints), for refinements and transforms, which Relay cannot run at
446
+ * ingestion, and for string patterns and formats.
447
+ */
448
+ declare function trackerDataSchema(schema: z.ZodType): TrackerDataSchema;
449
+ /**
450
+ * Why a record's data does not match its tracker's schema. `too-complex` means validation spent
451
+ * its step budget before deciding.
452
+ */
453
+ type TrackerDataIssue = {
454
+ kind: "mismatch" | "too-complex";
455
+ path: string;
456
+ reason: string;
457
+ };
458
+ /**
459
+ * Validation steps one record may use. Every unit of work costs a step: each schema node visited
460
+ * for a value, each object key and `required` key checked, each literal property scanned, each enum
461
+ * lookup. A step costs well under a microsecond, so one record stays within tens of milliseconds.
462
+ */
463
+ declare const trackerDataRecordSteps = 250000;
464
+ /** Validation steps one ingest batch, or one page of records, may use across its records. */
465
+ declare const trackerDataBatchSteps = 6000000;
466
+ /** A step allowance that validation draws down; share one across a batch. */
467
+ type TrackerDataBudget = {
468
+ steps: number;
469
+ };
470
+ /**
471
+ * The first way a record's `data` fails its tracker's schema, or null when it matches. Validation
472
+ * draws on `budget`, which defaults to one record's allowance; when it runs out the result is a
473
+ * `too-complex` issue rather than a decision.
474
+ */
475
+ declare function trackerDataIssue(schema: TrackerDataSchema, data: unknown, budget?: TrackerDataBudget): TrackerDataIssue | null;
476
+ /**
477
+ * Validates several records' data on one shared allowance: each record may use at most one
478
+ * record's steps, and all of them together at most one batch's. Returns each record's issue, in
479
+ * order; once the allowance is spent, every remaining record is `too-complex`.
480
+ */
481
+ declare function trackerDataIssues(schema: TrackerDataSchema, records: readonly unknown[]): (TrackerDataIssue | null)[];
482
+ /**
483
+ * The JSON types the value at a dot-separated `data` path can have under the schema, or null when
484
+ * the schema declares no such path. A key must be a declared property, or fall under a record's or
485
+ * loose object's value schema; an unconstrained value (`z.unknown()`) has every path and type.
486
+ */
487
+ declare function trackerDataPathTypes(schema: TrackerDataSchema, path: string): Set<string> | null;
488
+ /**
489
+ * Wraps a reader so `records(handle)` returns only records whose data matches the handle's data
490
+ * schema, the one the quest's types come from, and counts the rest in `excluded`. Reads by key
491
+ * string and of X trackers pass through.
492
+ */
493
+ declare function schemaCheckedReader(reader: TrackerReader): TrackerReader;
494
+ /**
495
+ * Why a filter cannot match records of a tracker's declared data schema, or null when it can: each
496
+ * path must be declared, `equals` must name a value its field can hold, and a comparison needs a
497
+ * number or string field.
498
+ */
499
+ declare function whereSchemaIssue(schema: TrackerDataSchema, where: TrackerWhere | undefined): string | null;
51
500
 
52
501
  /** Keep provider fields, including verification details, rather than projecting them away. */
53
502
  declare const xTweetSchema: z.ZodObject<{
@@ -202,6 +651,7 @@ declare const customSourceSchema: z.ZodObject<{
202
651
  }>>>;
203
652
  accounts: z.ZodOptional<z.ZodArray<z.ZodString>>;
204
653
  authors: z.ZodOptional<z.ZodLiteral<"wallet">>;
654
+ data: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodType<TrackerDataSchema, unknown, z.core.$ZodTypeInternals<TrackerDataSchema, unknown>>>>;
205
655
  }, z.core.$strict>;
206
656
  declare const trackerSourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
207
657
  kind: z.ZodLiteral<"x-search">;
@@ -217,6 +667,7 @@ declare const trackerSourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
217
667
  }>>>;
218
668
  accounts: z.ZodOptional<z.ZodArray<z.ZodString>>;
219
669
  authors: z.ZodOptional<z.ZodLiteral<"wallet">>;
670
+ data: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodType<TrackerDataSchema, unknown, z.core.$ZodTypeInternals<TrackerDataSchema, unknown>>>>;
220
671
  }, z.core.$strict>], "kind">;
221
672
  type TrackerSource = z.infer<typeof trackerSourceSchema>;
222
673
  /**
@@ -225,6 +676,20 @@ type TrackerSource = z.infer<typeof trackerSourceSchema>;
225
676
  * source's authors are opaque IDs.
226
677
  */
227
678
  declare function sourceIdentities(source: TrackerSource): IdentityKind[] | undefined;
679
+ /**
680
+ * Type-only marker for the `data` a source's records carry. It never exists at runtime: sources
681
+ * and trackers stay plain, serializable definitions.
682
+ */
683
+ declare const recordData: unique symbol;
684
+ /** A source or tracker whose records carry `data` of type `D`. */
685
+ type WithRecordData<D> = {
686
+ readonly [recordData]?: D;
687
+ };
688
+ /**
689
+ * The record `data` type of a source or tracker: the provider payload for X, the declared schema's
690
+ * input type for a custom source, or `unknown` for one that declares none.
691
+ */
692
+ type TrackerData<T> = T extends WithRecordData<infer D> ? unknown extends D ? unknown : D : unknown;
228
693
  declare const trackerDefinitionSchema: z.ZodObject<{
229
694
  key: z.ZodString;
230
695
  title: z.ZodString;
@@ -242,6 +707,7 @@ declare const trackerDefinitionSchema: z.ZodObject<{
242
707
  }>>>;
243
708
  accounts: z.ZodOptional<z.ZodArray<z.ZodString>>;
244
709
  authors: z.ZodOptional<z.ZodLiteral<"wallet">>;
710
+ data: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodType<TrackerDataSchema, unknown, z.core.$ZodTypeInternals<TrackerDataSchema, unknown>>>>;
245
711
  }, z.core.$strict>], "kind">;
246
712
  window: z.ZodObject<{
247
713
  start: z.ZodNumber;
@@ -267,6 +733,7 @@ declare const trackerArtifactSchema: z.ZodUnion<readonly [z.ZodObject<{
267
733
  }>>>;
268
734
  accounts: z.ZodOptional<z.ZodArray<z.ZodString>>;
269
735
  authors: z.ZodOptional<z.ZodLiteral<"wallet">>;
736
+ data: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodType<TrackerDataSchema, unknown, z.core.$ZodTypeInternals<TrackerDataSchema, unknown>>>>;
270
737
  }, z.core.$strict>], "kind">;
271
738
  window: z.ZodObject<{
272
739
  start: z.ZodNumber;
@@ -278,6 +745,11 @@ declare const trackerArtifactSchema: z.ZodUnion<readonly [z.ZodObject<{
278
745
  code: z.ZodString;
279
746
  }, z.core.$strict>]>;
280
747
  type TrackerDefinition = z.infer<typeof trackerDefinitionSchema>;
748
+ /**
749
+ * A tracker definition whose records carry `data` of type `D`. Quests reference it as a handle:
750
+ * `where` paths and `ctx.tracker.record.data` follow from `D`.
751
+ */
752
+ type Tracker<D = unknown> = TrackerDefinition & WithRecordData<D>;
281
753
  declare const publishedTrackerSchema: z.ZodObject<{
282
754
  id: z.ZodString;
283
755
  version: z.ZodString;
@@ -298,6 +770,7 @@ declare const publishedTrackerSchema: z.ZodObject<{
298
770
  }>>>;
299
771
  accounts: z.ZodOptional<z.ZodArray<z.ZodString>>;
300
772
  authors: z.ZodOptional<z.ZodLiteral<"wallet">>;
773
+ data: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodType<TrackerDataSchema, unknown, z.core.$ZodTypeInternals<TrackerDataSchema, unknown>>>>;
301
774
  }, z.core.$strict>], "kind">;
302
775
  window: z.ZodObject<{
303
776
  start: z.ZodNumber;
@@ -330,6 +803,7 @@ declare const trackerStatusSchema: z.ZodObject<{
330
803
  }>>>;
331
804
  accounts: z.ZodOptional<z.ZodArray<z.ZodString>>;
332
805
  authors: z.ZodOptional<z.ZodLiteral<"wallet">>;
806
+ data: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodType<TrackerDataSchema, unknown, z.core.$ZodTypeInternals<TrackerDataSchema, unknown>>>>;
333
807
  }, z.core.$strict>], "kind">;
334
808
  window: z.ZodObject<{
335
809
  start: z.ZodNumber;
@@ -483,7 +957,7 @@ declare const trackerIngestResultSchema: z.ZodObject<{
483
957
  * in this order and records the first that fails. Later versions may add codes; treat an unknown
484
958
  * code as a skip whose `reason` explains it.
485
959
  */
486
- declare const trackerSkipCodes: readonly ["quest-paused", "before-activation", "record-removed", "content-unavailable", "no-account", "beneficiary-is-author", "unlinked-account", "ambiguous-account", "not-joined", "prerequisites-incomplete"];
960
+ declare const trackerSkipCodes: readonly ["quest-paused", "before-activation", "record-removed", "invalid-record-data", "content-unavailable", "no-account", "beneficiary-is-author", "unlinked-account", "ambiguous-account", "not-joined", "prerequisites-incomplete"];
487
961
  type TrackerSkipCode = (typeof trackerSkipCodes)[number];
488
962
  /**
489
963
  * One tracker-trigger decision: a quest admitted an attempt for a record observation, or skipped
@@ -690,6 +1164,7 @@ declare const trackerPageSchema: z.ZodObject<{
690
1164
  }>>>;
691
1165
  accounts: z.ZodOptional<z.ZodArray<z.ZodString>>;
692
1166
  authors: z.ZodOptional<z.ZodLiteral<"wallet">>;
1167
+ data: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodType<TrackerDataSchema, unknown, z.core.$ZodTypeInternals<TrackerDataSchema, unknown>>>>;
693
1168
  }, z.core.$strict>], "kind">;
694
1169
  window: z.ZodObject<{
695
1170
  start: z.ZodNumber;
@@ -753,6 +1228,7 @@ declare const trackerSummarySchema: z.ZodObject<{
753
1228
  }>>>;
754
1229
  accounts: z.ZodOptional<z.ZodArray<z.ZodString>>;
755
1230
  authors: z.ZodOptional<z.ZodLiteral<"wallet">>;
1231
+ data: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodType<TrackerDataSchema, unknown, z.core.$ZodTypeInternals<TrackerDataSchema, unknown>>>>;
756
1232
  }, z.core.$strict>], "kind">;
757
1233
  window: z.ZodObject<{
758
1234
  start: z.ZodNumber;
@@ -783,6 +1259,22 @@ declare const trackerSummarySchema: z.ZodObject<{
783
1259
  records: z.ZodNumber;
784
1260
  }, z.core.$strip>;
785
1261
  }, z.core.$strip>;
1262
+ /** A record whose `data` has type `D`; untyped records keep JSON object data. */
1263
+ type TypedTrackerRecord<D> = unknown extends D ? TrackerRecord : Omit<TrackerRecord, "data"> & {
1264
+ data: D;
1265
+ };
1266
+ /**
1267
+ * A page of tracker records whose `data` has type `D`. A page read with a typed tracker handle
1268
+ * leaves out records whose data does not match the handle's schema, such as records stored before
1269
+ * the schema changed, and counts them in `excluded`; `total` and the cursor still count every
1270
+ * record.
1271
+ */
1272
+ type TrackerPage<D = unknown> = Omit<z.infer<typeof trackerPageSchema>, "items"> & (unknown extends D ? {
1273
+ items: TrackerRecord[];
1274
+ } : {
1275
+ items: TypedTrackerRecord<D>[];
1276
+ excluded: number;
1277
+ });
786
1278
  /** Preview bounds: one sample, never stored, never a tracker. */
787
1279
  declare const trackerPreviewLimits: {
788
1280
  readonly pages: 3;
@@ -830,468 +1322,243 @@ type TrackerReader = {
830
1322
  content(reference: string | {
831
1323
  key: string;
832
1324
  }, query: TrackerContentQuery): Promise<TrackerContent>;
833
- records(reference: string | {
1325
+ /** A page of records; with a tracker handle, each record's `data` has the tracker's type. */
1326
+ records<T extends string | {
834
1327
  key: string;
835
- }, query?: TrackerQuery): Promise<z.infer<typeof trackerPageSchema>>;
1328
+ }>(reference: T, query?: TrackerQuery): Promise<TrackerPage<TrackerData<T>>>;
836
1329
  summary(reference: string | {
837
1330
  key: string;
838
1331
  }, query?: TrackerQuery): Promise<z.infer<typeof trackerSummarySchema>>;
839
1332
  };
840
1333
 
841
- declare const xIdSchema: z.ZodString;
842
- declare const xConnectionSchema: z.ZodObject<{
843
- userId: z.ZodString;
844
- }, z.core.$strip>;
845
- declare const xProfileSchema: z.ZodObject<{
846
- id: z.ZodString;
847
- username: z.ZodString;
848
- name: z.ZodString;
849
- bio: z.ZodNullable<z.ZodString>;
850
- profileImageUrl: z.ZodNullable<z.ZodString>;
851
- followersCount: z.ZodNullable<z.ZodNumber>;
852
- verified: z.ZodNullable<z.ZodBoolean>;
853
- }, z.core.$strip>;
854
- declare const xPostSchema: z.ZodObject<{
855
- id: z.ZodString;
856
- userId: z.ZodString;
857
- content: z.ZodString;
858
- createdAt: z.ZodISODateTime;
859
- author: z.ZodObject<{
860
- id: z.ZodString;
861
- username: z.ZodString;
862
- name: z.ZodString;
863
- verified: z.ZodDefault<z.ZodNullable<z.ZodBoolean>>;
864
- }, z.core.$loose>;
865
- likeCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
866
- replyCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
867
- retweetCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
868
- quoteCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
869
- viewCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
870
- bookmarkCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
871
- isReply: z.ZodBoolean;
872
- isRetweet: z.ZodBoolean;
873
- isQuoteTweet: z.ZodBoolean;
874
- quotedTweetId: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
875
- inReplyToUserId: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
876
- inReplyToStatusId: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
877
- retweetedTweetId: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
878
- media: z.ZodPipe<z.ZodUnknown, z.ZodTransform<{
879
- type: string;
880
- url: string;
881
- }[], unknown>>;
882
- }, z.core.$loose>;
883
- declare const xRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
884
- operation: z.ZodLiteral<"connection">;
1334
+ /**
1335
+ * Quest code names an image; the platform fetches, decodes and pins it. No bytes or URLs cross the
1336
+ * sandbox boundary, so a quest cannot make the platform fetch an arbitrary address.
1337
+ */
1338
+ declare const imageReferenceSchema: z.ZodUnion<readonly [z.ZodObject<{
1339
+ evidence: z.ZodString;
885
1340
  }, z.core.$strict>, z.ZodObject<{
886
- operation: z.ZodLiteral<"profile">;
1341
+ x: z.ZodLiteral<"profile">;
887
1342
  }, z.core.$strict>, z.ZodObject<{
888
- operation: z.ZodLiteral<"post">;
1343
+ x: z.ZodLiteral<"post">;
889
1344
  postId: z.ZodString;
1345
+ index: z.ZodDefault<z.ZodNumber>;
890
1346
  }, z.core.$strict>, z.ZodObject<{
891
- operation: z.ZodLiteral<"follows">;
892
- userId: z.ZodString;
893
- }, z.core.$strict>, z.ZodObject<{
894
- operation: z.ZodLiteral<"reposted">;
895
- postId: z.ZodString;
896
- }, z.core.$strict>], "operation">;
897
- type XConnection = z.infer<typeof xConnectionSchema>;
898
- type XProfile = z.infer<typeof xProfileSchema>;
899
- type XPost = z.infer<typeof xPostSchema>;
900
- interface XReader {
901
- connection(): Promise<XConnection | null>;
902
- profile(): Promise<XProfile>;
903
- post(input: {
904
- postId: string;
905
- }): Promise<XPost>;
906
- follows(input: {
907
- userId: string;
908
- }): Promise<boolean>;
909
- reposted(input: {
910
- postId: string;
911
- }): Promise<boolean>;
912
- }
913
-
914
- /**
915
- * Which record observations fire a tracker trigger. `"new-record"`: the first observation of each
916
- * record this tracker collects. `"new-observation"`: every observation that becomes its record's
917
- * current one (a new record, or a later `observedAt`). `"data-changed"`: a new record, or a current
918
- * observation whose `data` differs from the record's previous one.
919
- */
920
- declare const trackerTriggerModeSchema: z.ZodEnum<{
921
- "new-record": "new-record";
922
- "new-observation": "new-observation";
923
- "data-changed": "data-changed";
924
- }>;
925
- type TrackerTriggerMode = z.infer<typeof trackerTriggerModeSchema>;
926
- /** X trackers fire on discoveries; custom trackers on every new sample. */
927
- declare function defaultTriggerMode(source: "x-search" | "custom"): TrackerTriggerMode;
928
- /** A bound in a tracker trigger filter: a number, or the quest's integer setting of that name. */
929
- declare const trackerBoundSchema: z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
930
- setting: z.ZodString;
931
- }, z.core.$strict>]>;
932
- type TrackerBound = z.infer<typeof trackerBoundSchema>;
933
- /**
934
- * Which firing observations a tracker trigger admits, judged on the record's `data` before any
935
- * attribution. `equals` matches a string, number or boolean exactly. `gt`, `gte`, `lt` and `lte`
936
- * compare a number, or an integer string such as a base-unit balance, and all must hold.
937
- * Observations that do not match are not trigger events: they record no outcome.
938
- */
939
- declare const trackerWhereSchema: z.ZodUnion<readonly [z.ZodObject<{
940
- path: z.ZodString;
941
- equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
942
- }, z.core.$strict>, z.ZodObject<{
943
- path: z.ZodString;
944
- gt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
945
- setting: z.ZodString;
946
- }, z.core.$strict>]>>;
947
- gte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
948
- setting: z.ZodString;
949
- }, z.core.$strict>]>>;
950
- lt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
951
- setting: z.ZodString;
952
- }, z.core.$strict>]>>;
953
- lte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
954
- setting: z.ZodString;
955
- }, z.core.$strict>]>>;
956
- }, z.core.$strict>]>;
957
- type TrackerWhere = z.infer<typeof trackerWhereSchema>;
958
- /**
959
- * A quest's tracker trigger as published: bound to the tracker's stable ID at publication. Keys
960
- * that equal their default are left out, so a policy without `where` or a non-default `on` keeps
961
- * the shape SDKs before 0.28 read.
962
- */
963
- declare const trackerTriggerPolicySchema: z.ZodObject<{
964
- /** The tracker's authoring key; publication binds it to the tracker's stable ID. */
965
- tracker: z.ZodString;
966
- source: z.ZodEnum<{
967
- custom: "custom";
968
- "x-search": "x-search";
969
- }>;
970
- /** Which observations fire; absent means the source's default (`defaultTriggerMode`). */
971
- on: z.ZodOptional<z.ZodEnum<{
972
- "new-record": "new-record";
973
- "new-observation": "new-observation";
974
- "data-changed": "data-changed";
975
- }>>;
976
- where: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
977
- path: z.ZodString;
978
- equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
979
- }, z.core.$strict>, z.ZodObject<{
980
- path: z.ZodString;
981
- gt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
982
- setting: z.ZodString;
983
- }, z.core.$strict>]>>;
984
- gte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
985
- setting: z.ZodString;
986
- }, z.core.$strict>]>>;
987
- lt: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
988
- setting: z.ZodString;
989
- }, z.core.$strict>]>>;
990
- lte: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
991
- setting: z.ZodString;
992
- }, z.core.$strict>]>>;
993
- }, z.core.$strict>]>>;
994
- /**
995
- * The record account the quest pays: `author`, `inReplyTo` for an X post, or a named account of
996
- * a custom record. Relay attributes it through verified links; evaluators cannot redirect it.
997
- * Releases published before account roles store `"replied-to"` for `inReplyTo`.
998
- */
999
- beneficiary: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"replied-to">]>;
1347
+ asset: z.ZodString;
1348
+ }, z.core.$strict>]>;
1349
+ type ImageReference = z.input<typeof imageReferenceSchema>;
1350
+ declare const imageFieldSchema: z.ZodObject<{
1351
+ type: z.ZodEnum<{
1352
+ string: "string";
1353
+ number: "number";
1354
+ boolean: "boolean";
1355
+ }>;
1356
+ description: z.ZodString;
1000
1357
  }, z.core.$strict>;
1001
- type TrackerTriggerPolicy = z.infer<typeof trackerTriggerPolicySchema>;
1002
- /** The firing mode a published policy uses: its `on`, or its source's default. */
1003
- declare function triggerMode(policy: Pick<TrackerTriggerPolicy, "on" | "source">): TrackerTriggerMode;
1004
- /** The record role a published policy pays. A stored `"replied-to"` is the `inReplyTo` role. */
1005
- declare function beneficiaryRole(policy: Pick<TrackerTriggerPolicy, "beneficiary">): AccountRole;
1006
- /** Who the record pays and through which verified link, captured at admission. */
1007
- declare const trackerAttributionSchema: z.ZodObject<{
1008
- member: z.ZodString;
1009
- capturedAt: z.ZodNumber;
1010
- account: z.ZodDiscriminatedUnion<[z.ZodObject<{
1011
- provider: z.ZodLiteral<"wallet">;
1012
- /** Canonical CAIP-10 account ID, as the record names it. */
1013
- id: z.ZodString;
1014
- /** The wallet link's revision. */
1015
- revision: z.ZodNumber;
1016
- /** When the member verified the wallet. */
1017
- linkedAt: z.ZodNullable<z.ZodNumber>;
1358
+ declare const imageFieldsSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
1359
+ type: z.ZodEnum<{
1360
+ string: "string";
1361
+ number: "number";
1362
+ boolean: "boolean";
1363
+ }>;
1364
+ description: z.ZodString;
1365
+ }, z.core.$strict>>;
1366
+ type ImageFields = z.input<typeof imageFieldsSchema>;
1367
+ declare const imageRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1368
+ operation: z.ZodLiteral<"inspect">;
1369
+ image: z.ZodUnion<readonly [z.ZodObject<{
1370
+ evidence: z.ZodString;
1018
1371
  }, z.core.$strict>, z.ZodObject<{
1019
- issuer: z.ZodString;
1020
- /** The account's stable user ID. */
1021
- subject: z.ZodString;
1022
- /** The member's account selection revision. */
1023
- revision: z.ZodNumber;
1024
- /** When the member linked the account; null when unknown. */
1025
- linkedAt: z.ZodNullable<z.ZodNumber>;
1026
- provider: z.ZodLiteral<"x">;
1372
+ x: z.ZodLiteral<"profile">;
1027
1373
  }, z.core.$strict>, z.ZodObject<{
1028
- issuer: z.ZodString;
1029
- /** The account's stable user ID. */
1030
- subject: z.ZodString;
1031
- /** The member's account selection revision. */
1032
- revision: z.ZodNumber;
1033
- /** When the member linked the account; null when unknown. */
1034
- linkedAt: z.ZodNullable<z.ZodNumber>;
1035
- provider: z.ZodLiteral<"discord">;
1374
+ x: z.ZodLiteral<"post">;
1375
+ postId: z.ZodString;
1376
+ index: z.ZodDefault<z.ZodNumber>;
1036
1377
  }, z.core.$strict>, z.ZodObject<{
1037
- provider: z.ZodLiteral<"member">;
1038
- /** The member ID the record names. */
1039
- id: z.ZodString;
1040
- }, z.core.$strict>], "provider">;
1041
- }, z.core.$strict>;
1042
- type TrackerAttribution = z.infer<typeof trackerAttributionSchema>;
1043
- /** The record observation that triggered the attempt, as stored. */
1044
- declare const trackerTriggerRecordSchema: z.ZodObject<{
1045
- id: z.ZodString;
1046
- source: z.ZodString;
1047
- occurredAt: z.ZodNumber;
1048
- observedAt: z.ZodNumber;
1049
- firstSeenAt: z.ZodNumber;
1050
- author: z.ZodNullable<z.ZodObject<{
1051
- id: z.ZodString;
1052
- verified: z.ZodNullable<z.ZodBoolean>;
1053
- kind: z.ZodOptional<z.ZodEnum<{
1054
- x: "x";
1055
- discord: "discord";
1056
- member: "member";
1057
- wallet: "wallet";
1058
- }>>;
1378
+ asset: z.ZodString;
1379
+ }, z.core.$strict>]>;
1380
+ }, z.core.$strict>, z.ZodObject<{
1381
+ operation: z.ZodLiteral<"compare">;
1382
+ images: z.ZodTuple<[z.ZodUnion<readonly [z.ZodObject<{
1383
+ evidence: z.ZodString;
1384
+ }, z.core.$strict>, z.ZodObject<{
1385
+ x: z.ZodLiteral<"profile">;
1386
+ }, z.core.$strict>, z.ZodObject<{
1387
+ x: z.ZodLiteral<"post">;
1388
+ postId: z.ZodString;
1389
+ index: z.ZodDefault<z.ZodNumber>;
1390
+ }, z.core.$strict>, z.ZodObject<{
1391
+ asset: z.ZodString;
1392
+ }, z.core.$strict>]>, z.ZodUnion<readonly [z.ZodObject<{
1393
+ evidence: z.ZodString;
1394
+ }, z.core.$strict>, z.ZodObject<{
1395
+ x: z.ZodLiteral<"profile">;
1396
+ }, z.core.$strict>, z.ZodObject<{
1397
+ x: z.ZodLiteral<"post">;
1398
+ postId: z.ZodString;
1399
+ index: z.ZodDefault<z.ZodNumber>;
1400
+ }, z.core.$strict>, z.ZodObject<{
1401
+ asset: z.ZodString;
1402
+ }, z.core.$strict>]>], null>;
1403
+ }, z.core.$strict>, z.ZodObject<{
1404
+ operation: z.ZodLiteral<"review">;
1405
+ images: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1406
+ evidence: z.ZodString;
1407
+ }, z.core.$strict>, z.ZodObject<{
1408
+ x: z.ZodLiteral<"profile">;
1409
+ }, z.core.$strict>, z.ZodObject<{
1410
+ x: z.ZodLiteral<"post">;
1411
+ postId: z.ZodString;
1412
+ index: z.ZodDefault<z.ZodNumber>;
1413
+ }, z.core.$strict>, z.ZodObject<{
1414
+ asset: z.ZodString;
1415
+ }, z.core.$strict>]>>;
1416
+ criteria: z.ZodString;
1417
+ }, z.core.$strict>, z.ZodObject<{
1418
+ operation: z.ZodLiteral<"extract">;
1419
+ image: z.ZodUnion<readonly [z.ZodObject<{
1420
+ evidence: z.ZodString;
1421
+ }, z.core.$strict>, z.ZodObject<{
1422
+ x: z.ZodLiteral<"profile">;
1423
+ }, z.core.$strict>, z.ZodObject<{
1424
+ x: z.ZodLiteral<"post">;
1425
+ postId: z.ZodString;
1426
+ index: z.ZodDefault<z.ZodNumber>;
1427
+ }, z.core.$strict>, z.ZodObject<{
1428
+ asset: z.ZodString;
1429
+ }, z.core.$strict>]>;
1430
+ fields: z.ZodRecord<z.ZodString, z.ZodObject<{
1431
+ type: z.ZodEnum<{
1432
+ string: "string";
1433
+ number: "number";
1434
+ boolean: "boolean";
1435
+ }>;
1436
+ description: z.ZodString;
1059
1437
  }, z.core.$strict>>;
1060
- accounts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1061
- kind: z.ZodOptional<z.ZodEnum<{
1062
- x: "x";
1063
- discord: "discord";
1064
- member: "member";
1065
- wallet: "wallet";
1066
- }>>;
1067
- id: z.ZodString;
1068
- }, z.core.$strict>>>;
1069
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
1070
- removed: z.ZodBoolean;
1438
+ }, z.core.$strict>, z.ZodObject<{
1439
+ operation: z.ZodLiteral<"seen">;
1440
+ image: z.ZodUnion<readonly [z.ZodObject<{
1441
+ evidence: z.ZodString;
1442
+ }, z.core.$strict>, z.ZodObject<{
1443
+ x: z.ZodLiteral<"profile">;
1444
+ }, z.core.$strict>, z.ZodObject<{
1445
+ x: z.ZodLiteral<"post">;
1446
+ postId: z.ZodString;
1447
+ index: z.ZodDefault<z.ZodNumber>;
1448
+ }, z.core.$strict>, z.ZodObject<{
1449
+ asset: z.ZodString;
1450
+ }, z.core.$strict>]>;
1451
+ maxDistance: z.ZodDefault<z.ZodNumber>;
1452
+ }, z.core.$strict>], "operation">;
1453
+ type ImageRequest = z.input<typeof imageRequestSchema>;
1454
+ declare const imageInspectionSchema: z.ZodObject<{
1455
+ width: z.ZodNumber;
1456
+ height: z.ZodNumber;
1457
+ format: z.ZodEnum<{
1458
+ jpeg: "jpeg";
1459
+ png: "png";
1460
+ webp: "webp";
1461
+ gif: "gif";
1462
+ avif: "avif";
1463
+ }>;
1464
+ bytes: z.ZodNumber;
1465
+ sha256: z.ZodString;
1466
+ phash: z.ZodString;
1467
+ dhash: z.ZodString;
1071
1468
  }, z.core.$strict>;
1072
- /** Immutable admission input of a tracker-triggered attempt: the pinned observation and who it pays. */
1073
- declare const trackerTriggerContextSchema: z.ZodObject<{
1074
- /** The tracker's stable ID. */
1075
- tracker: z.ZodString;
1076
- /** The tracker's authoring key. */
1469
+ type ImageInspection = z.infer<typeof imageInspectionSchema>;
1470
+ declare const imageComparisonSchema: z.ZodObject<{
1471
+ identical: z.ZodBoolean;
1472
+ phashDistance: z.ZodNumber;
1473
+ dhashDistance: z.ZodNumber;
1474
+ }, z.core.$strict>;
1475
+ type ImageComparison = z.infer<typeof imageComparisonSchema>;
1476
+ declare const imageExtractionSchema: z.ZodObject<{
1477
+ values: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
1478
+ reason: z.ZodString;
1479
+ }, z.core.$strict>;
1480
+ type ImageExtraction = z.infer<typeof imageExtractionSchema>;
1481
+ declare const imageSightingsSchema: z.ZodObject<{
1482
+ matches: z.ZodNumber;
1483
+ closestDistance: z.ZodNullable<z.ZodNumber>;
1484
+ firstSeenAt: z.ZodNullable<z.ZodNumber>;
1485
+ }, z.core.$strict>;
1486
+ type ImageSightings = z.infer<typeof imageSightingsSchema>;
1487
+ /**
1488
+ * One reference image in a deployment bundle: a reference, never the bytes. The CLI uploads each
1489
+ * file to storage before the preview; a hosted build stages it. `path` is where the bundle found
1490
+ * the file, relative to relay.json; the platform ignores it.
1491
+ */
1492
+ declare const imageAssetArtifactSchema: z.ZodObject<{
1077
1493
  key: z.ZodString;
1078
- /**
1079
- * The record account the attempt pays, as the quest's release names it. Releases published
1080
- * before account roles name `inReplyTo` `"replied-to"`, which their bundled evaluators expect.
1081
- */
1082
- beneficiary: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"replied-to">]>;
1083
- record: z.ZodObject<{
1084
- id: z.ZodString;
1085
- source: z.ZodString;
1086
- occurredAt: z.ZodNumber;
1087
- observedAt: z.ZodNumber;
1088
- firstSeenAt: z.ZodNumber;
1089
- author: z.ZodNullable<z.ZodObject<{
1090
- id: z.ZodString;
1091
- verified: z.ZodNullable<z.ZodBoolean>;
1092
- kind: z.ZodOptional<z.ZodEnum<{
1093
- x: "x";
1094
- discord: "discord";
1095
- member: "member";
1096
- wallet: "wallet";
1097
- }>>;
1098
- }, z.core.$strict>>;
1099
- accounts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1100
- kind: z.ZodOptional<z.ZodEnum<{
1101
- x: "x";
1102
- discord: "discord";
1103
- member: "member";
1104
- wallet: "wallet";
1105
- }>>;
1106
- id: z.ZodString;
1107
- }, z.core.$strict>>>;
1108
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
1109
- removed: z.ZodBoolean;
1110
- }, z.core.$strict>;
1111
- /** The captured X post of this observation; null for custom trackers. */
1112
- x: z.ZodNullable<z.ZodObject<{
1113
- evidence: z.ZodObject<{
1114
- contentRevision: z.ZodString;
1115
- observation: z.ZodString;
1116
- }, z.core.$strict>;
1117
- content: z.ZodObject<{
1118
- version: z.ZodLiteral<1>;
1119
- id: z.ZodString;
1120
- authorId: z.ZodString;
1121
- publishedAt: z.ZodNumber;
1122
- text: z.ZodString;
1123
- isReply: z.ZodBoolean;
1124
- isRetweet: z.ZodBoolean;
1125
- isQuoteTweet: z.ZodBoolean;
1126
- media: z.ZodNullable<z.ZodArray<z.ZodObject<{
1127
- type: z.ZodString;
1128
- url: z.ZodString;
1129
- }, z.core.$strict>>>;
1130
- mentionedAuthorIds: z.ZodNullable<z.ZodArray<z.ZodString>>;
1131
- videoLengthSeconds: z.ZodNullable<z.ZodNumber>;
1132
- references: z.ZodObject<{
1133
- replyId: z.ZodNullable<z.ZodString>;
1134
- replyAuthorId: z.ZodNullable<z.ZodString>;
1135
- quoteId: z.ZodNullable<z.ZodString>;
1136
- quoteAuthorId: z.ZodNullable<z.ZodString>;
1137
- repostId: z.ZodNullable<z.ZodString>;
1138
- repostAuthorId: z.ZodNullable<z.ZodString>;
1139
- }, z.core.$strict>;
1140
- }, z.core.$strict>;
1141
- }, z.core.$strict>>;
1142
- attribution: z.ZodObject<{
1143
- member: z.ZodString;
1144
- capturedAt: z.ZodNumber;
1145
- account: z.ZodDiscriminatedUnion<[z.ZodObject<{
1146
- provider: z.ZodLiteral<"wallet">;
1147
- /** Canonical CAIP-10 account ID, as the record names it. */
1148
- id: z.ZodString;
1149
- /** The wallet link's revision. */
1150
- revision: z.ZodNumber;
1151
- /** When the member verified the wallet. */
1152
- linkedAt: z.ZodNullable<z.ZodNumber>;
1153
- }, z.core.$strict>, z.ZodObject<{
1154
- issuer: z.ZodString;
1155
- /** The account's stable user ID. */
1156
- subject: z.ZodString;
1157
- /** The member's account selection revision. */
1158
- revision: z.ZodNumber;
1159
- /** When the member linked the account; null when unknown. */
1160
- linkedAt: z.ZodNullable<z.ZodNumber>;
1161
- provider: z.ZodLiteral<"x">;
1162
- }, z.core.$strict>, z.ZodObject<{
1163
- issuer: z.ZodString;
1164
- /** The account's stable user ID. */
1165
- subject: z.ZodString;
1166
- /** The member's account selection revision. */
1167
- revision: z.ZodNumber;
1168
- /** When the member linked the account; null when unknown. */
1169
- linkedAt: z.ZodNullable<z.ZodNumber>;
1170
- provider: z.ZodLiteral<"discord">;
1171
- }, z.core.$strict>, z.ZodObject<{
1172
- provider: z.ZodLiteral<"member">;
1173
- /** The member ID the record names. */
1174
- id: z.ZodString;
1175
- }, z.core.$strict>], "provider">;
1176
- }, z.core.$strict>;
1494
+ sha256: z.ZodString;
1495
+ size: z.ZodNumber;
1496
+ path: z.ZodOptional<z.ZodString>;
1177
1497
  }, z.core.$strict>;
1178
- type TrackerTriggerContext = z.infer<typeof trackerTriggerContextSchema>;
1179
-
1180
- declare const observationInputSchema: z.ZodObject<{
1181
- id: z.ZodString;
1182
- source: z.ZodString;
1183
- type: z.ZodString;
1184
- member: z.ZodString;
1185
- actor: z.ZodOptional<z.ZodObject<{
1186
- provider: z.ZodString;
1187
- subject: z.ZodString;
1498
+ type ImageAssetArtifact = z.infer<typeof imageAssetArtifactSchema>;
1499
+ /** Ask for upload URLs for images the project's storage does not hold yet. */
1500
+ declare const imageUploadRequestSchema: z.ZodObject<{
1501
+ images: z.ZodArray<z.ZodObject<{
1502
+ sha256: z.ZodString;
1503
+ size: z.ZodNumber;
1504
+ type: z.ZodEnum<{
1505
+ "image/jpeg": "image/jpeg";
1506
+ "image/png": "image/png";
1507
+ "image/webp": "image/webp";
1508
+ }>;
1188
1509
  }, z.core.$strict>>;
1189
- occurredAt: z.ZodNumber;
1190
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
1191
1510
  }, z.core.$strict>;
1192
- declare const observationSchema: z.ZodObject<{
1193
- id: z.ZodString;
1194
- source: z.ZodString;
1195
- type: z.ZodString;
1196
- member: z.ZodString;
1197
- actor: z.ZodOptional<z.ZodObject<{
1198
- provider: z.ZodString;
1199
- subject: z.ZodString;
1511
+ /** `upload` is null when the image is already stored; otherwise PUT the exact bytes before it expires. */
1512
+ declare const imageUploadsSchema: z.ZodObject<{
1513
+ images: z.ZodArray<z.ZodObject<{
1514
+ sha256: z.ZodString;
1515
+ upload: z.ZodNullable<z.ZodObject<{
1516
+ url: z.ZodString;
1517
+ headers: z.ZodRecord<z.ZodString, z.ZodString>;
1518
+ expiresAt: z.ZodNumber;
1519
+ }, z.core.$strict>>;
1200
1520
  }, z.core.$strict>>;
1201
- occurredAt: z.ZodNumber;
1202
- data: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
1203
- receivedAt: z.ZodNumber;
1204
- }, z.core.$strict>;
1205
- type Observation = z.infer<typeof observationSchema>;
1206
- declare const observationTriggerSchema: z.ZodObject<{
1207
- source: z.ZodString;
1208
- type: z.ZodString;
1209
1521
  }, z.core.$strict>;
1210
- declare const completionPolicySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1211
- kind: z.ZodLiteral<"streak">;
1212
- days: z.ZodNumber;
1213
- timeZone: z.ZodString;
1214
- }, z.core.$strict>, z.ZodObject<{
1215
- kind: z.ZodLiteral<"once">;
1216
- }, z.core.$strict>, z.ZodObject<{
1217
- kind: z.ZodLiteral<"keyed">;
1218
- }, z.core.$strict>], "kind">;
1219
- declare const completionKeySchema: z.ZodString;
1220
- declare const budgetSchema: z.ZodObject<{
1221
- id: z.ZodString;
1222
- scope: z.ZodEnum<{
1223
- member: "member";
1224
- project: "project";
1225
- }>;
1226
- period: z.ZodEnum<{
1227
- day: "day";
1228
- lifetime: "lifetime";
1229
- week: "week";
1522
+ declare const publishedImageSchema: z.ZodObject<{
1523
+ key: z.ZodString;
1524
+ sha256: z.ZodString;
1525
+ type: z.ZodEnum<{
1526
+ "image/jpeg": "image/jpeg";
1527
+ "image/png": "image/png";
1528
+ "image/webp": "image/webp";
1230
1529
  }>;
1231
- limit: z.ZodNumber;
1232
- cost: z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
1233
- balance: z.ZodString;
1234
- }, z.core.$strict>]>;
1235
- }, z.core.$strict>;
1236
- type Budget = z.infer<typeof budgetSchema>;
1237
- declare const observationReceiptSchema: z.ZodObject<{
1238
- id: z.ZodString;
1239
- source: z.ZodString;
1240
- attempts: z.ZodArray<z.ZodString>;
1241
- receivedAt: z.ZodNumber;
1242
- }, z.core.$strip>;
1243
- declare const discordReactionSchema: z.ZodObject<{
1244
- guildId: z.ZodString;
1245
- channelId: z.ZodString;
1246
- messageId: z.ZodString;
1247
- userId: z.ZodString;
1248
- messageAuthorId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1249
- actorRoles: z.ZodDefault<z.ZodArray<z.ZodString>>;
1250
- emoji: z.ZodObject<{
1251
- id: z.ZodNullable<z.ZodString>;
1252
- name: z.ZodString;
1253
- }, z.core.$strip>;
1254
- messagePublishedAt: z.ZodNumber;
1255
- }, z.core.$strict>;
1256
- declare const discordMessageSchema: z.ZodObject<{
1257
- guildId: z.ZodString;
1258
- channelId: z.ZodString;
1259
- messageId: z.ZodString;
1260
- userId: z.ZodString;
1261
- content: z.ZodNullable<z.ZodString>;
1262
- replyTo: z.ZodNullable<z.ZodString>;
1263
- publishedAt: z.ZodNumber;
1530
+ size: z.ZodNumber;
1531
+ width: z.ZodNumber;
1532
+ height: z.ZodNumber;
1264
1533
  }, z.core.$strict>;
1265
- type DiscordMessage = z.infer<typeof discordMessageSchema>;
1266
-
1267
- declare const integrationProviderSchema: z.ZodEnum<{
1268
- discord: "discord";
1269
- }>;
1270
- type IntegrationProvider = z.infer<typeof integrationProviderSchema>;
1271
- declare const discordServerSchema: z.ZodObject<{
1272
- id: z.ZodString;
1273
- name: z.ZodString;
1274
- icon: z.ZodNullable<z.ZodString>;
1275
- }, z.core.$strip>;
1276
- declare const projectIntegrationSchema: z.ZodObject<{
1277
- provider: z.ZodEnum<{
1278
- discord: "discord";
1279
- }>;
1280
- configured: z.ZodBoolean;
1281
- status: z.ZodEnum<{
1282
- disconnected: "disconnected";
1283
- ready: "ready";
1284
- attention: "attention";
1534
+ type PublishedImage = z.infer<typeof publishedImageSchema>;
1535
+ type Extracted<F extends ImageFields> = {
1536
+ [K in keyof F]: (F[K]["type"] extends "number" ? number : F[K]["type"] extends "boolean" ? boolean : string) | null;
1537
+ };
1538
+ /** Evaluator `ctx.images`. Each call uses one of the evaluation's eight capability calls. */
1539
+ interface ImageReader {
1540
+ inspect(image: ImageReference): Promise<ImageInspection>;
1541
+ compare(a: ImageReference, b: ImageReference): Promise<ImageComparison>;
1542
+ review(options: {
1543
+ images: ImageReference[];
1544
+ criteria: string;
1545
+ }): Promise<PhotoResult>;
1546
+ extract<const F extends ImageFields>(options: {
1547
+ image: ImageReference;
1548
+ fields: F;
1549
+ }): Promise<{
1550
+ values: Extracted<F>;
1551
+ reason: string;
1285
1552
  }>;
1286
- revision: z.ZodNumber;
1287
- server: z.ZodNullable<z.ZodObject<{
1288
- id: z.ZodString;
1289
- name: z.ZodString;
1290
- icon: z.ZodNullable<z.ZodString>;
1291
- }, z.core.$strip>>;
1292
- issue: z.ZodNullable<z.ZodString>;
1293
- connectedAt: z.ZodDefault<z.ZodNumber>;
1294
- }, z.core.$strip>;
1295
- type ProjectIntegration = z.infer<typeof projectIntegrationSchema>;
1553
+ /**
1554
+ * Records the image for this attempt, then counts other participants' recorded images within
1555
+ * `maxDistance`. The record is written when `seen` runs, not when the attempt is decided, so it
1556
+ * stays even if the attempt is rejected: concurrent submissions of one photo must see each
1557
+ * other. Replays reuse the captured result.
1558
+ */
1559
+ seen(image: ImageReference, options?: {
1560
+ maxDistance?: number;
1561
+ }): Promise<ImageSightings>;
1562
+ }
1296
1563
 
1297
- export { publishedTrackerSchema as $, type AccountRole as A, type Budget as B, type XProfile as C, type DiscordMessage as D, type XTweet as E, accountRoleSchema as F, beneficiaryRole as G, budgetSchema as H, type IdentityKind as I, completionKeySchema as J, completionPolicySchema as K, customSourceSchema as L, defaultTriggerMode as M, discordMessageSchema as N, type Observation as O, type ProjectIntegration as P, discordReactionSchema as Q, type ResourceSource as R, discordServerSchema as S, type TrackerDefinition as T, identityKindSchema as U, integrationProviderSchema as V, observationInputSchema as W, type XReader as X, observationReceiptSchema as Y, observationSchema as Z, projectIntegrationSchema as _, type TrackerTriggerContext as a, resourceOptionsSchema as a0, resourceRequestSchema as a1, resourceSourceSchema as a2, sourceIdentities as a3, trackerAccountSchema as a4, trackerArtifactSchema as a5, trackerAttributionSchema as a6, trackerBoundSchema as a7, trackerContentQuerySchema as a8, trackerContentReadSchema as a9, xConnectionSchema as aA, xContentBodySchema as aB, xIdSchema as aC, xPostSchema as aD, xProfileSchema as aE, xRequestSchema as aF, xSearchSourceSchema as aG, xTweetSchema as aH, trackerContentSchema as aa, trackerControlSchema as ab, trackerEvidenceSchema as ac, trackerIngestResultSchema as ad, trackerIngestSchema as ae, trackerOutcomePageSchema as af, trackerOutcomeQuerySchema as ag, trackerOutcomeRetrySchema as ah, trackerOutcomeSchema as ai, trackerPageSchema as aj, trackerPreviewInputSchema as ak, trackerPreviewLimits as al, trackerPreviewSchema as am, trackerQuerySchema as an, trackerRecordInputSchema as ao, trackerRecordSchema as ap, trackerSkipCodes as aq, trackerSourceSchema as ar, trackerStatusSchema as as, trackerSummarySchema as at, trackerTriggerModeSchema as au, trackerTriggerPolicySchema as av, trackerTriggerRecordSchema as aw, trackerWhereSchema as ax, triggerMode as ay, xAccountRoles as az, type TrackerReader as b, type TrackerTriggerMode as c, type TrackerWhere as d, type TrackerTriggerPolicy as e, type IntegrationProvider as f, trackerTriggerContextSchema as g, type ResourceOption as h, type TrackerAccount as i, type TrackerAttribution as j, type TrackerBound as k, type TrackerContent as l, type TrackerContentQuery as m, type TrackerOutcome as n, observationTriggerSchema as o, type TrackerOutcomeQuery as p, type TrackerPreview as q, type TrackerPreviewInput as r, type TrackerQuery as s, trackerDefinitionSchema as t, type TrackerRecord as u, type TrackerSkipCode as v, type TrackerSource as w, type TrackerStatus as x, type XConnection as y, type XPost as z };
1564
+ export { defaultTriggerMode as $, type AccountRole as A, type Bound as B, type Condition as C, type DataLeaves as D, type TrackerAttribution as E, type TrackerBound as F, type TrackerCondition as G, type TrackerContent as H, type IdentityKind as I, type TrackerContentQuery as J, type TrackerDataIssue as K, type TrackerOutcome as L, type TrackerOutcomeQuery as M, type TrackerPreview as N, type TrackerPreviewInput as O, type PublishedImage as P, type TrackerQuery as Q, type TrackerRecord as R, type TrackerSkipCode as S, type TrackerDefinition as T, type TrackerStatus as U, type TrackerWhere as V, type WithRecordData as W, type XTweet as X, type TypedTrackerRecord as Y, accountRoleSchema as Z, beneficiaryRole as _, type TrackerSource as a, identityKindSchema as a0, imageAssetArtifactSchema as a1, imageComparisonSchema as a2, imageExtractionSchema as a3, imageFieldSchema as a4, imageFieldsSchema as a5, imageInspectionSchema as a6, imageReferenceSchema as a7, imageRequestSchema as a8, imageSightingsSchema as a9, trackerPreviewLimits as aA, trackerPreviewSchema as aB, trackerQuerySchema as aC, trackerRecordInputSchema as aD, trackerRecordSchema as aE, trackerSkipCodes as aF, trackerSourceSchema as aG, trackerStatusSchema as aH, trackerSummarySchema as aI, trackerTriggerModeSchema as aJ, trackerTriggerPolicySchema as aK, trackerTriggerRecordSchema as aL, trackerWhereSchema as aM, triggerMode as aN, whereConditions as aO, whereSettings as aP, xAccountRoles as aQ, xContentBodySchema as aR, xTweetSchema as aS, type TrackerDataBudget as aT, schemaCheckedReader as aU, trackerDataBatchSteps as aV, trackerDataIssue as aW, trackerDataIssues as aX, trackerDataPathTypes as aY, trackerDataRecordSteps as aZ, whereSchemaIssue as a_, imageUploadRequestSchema as aa, imageUploadsSchema as ab, publishedImageSchema as ac, publishedTrackerSchema as ad, sourceIdentities as ae, trackerAccountSchema as af, trackerArtifactSchema as ag, trackerAttributionSchema as ah, trackerBoundSchema as ai, trackerConditionSchema as aj, trackerContentQuerySchema as ak, trackerContentReadSchema as al, trackerContentSchema as am, trackerControlSchema as an, trackerDataMaxBranches as ao, trackerDataMaxEntries as ap, trackerDataSchemaSchema as aq, trackerEvidenceSchema as ar, trackerIngestResultSchema as as, trackerIngestSchema as at, trackerOutcomePageSchema as au, trackerOutcomeQuerySchema as av, trackerOutcomeRetrySchema as aw, trackerOutcomeSchema as ax, trackerPageSchema as ay, trackerPreviewInputSchema as az, type Tracker as b, customSourceSchema as c, type TrackerData as d, type TrackerTriggerContext as e, type TrackerTriggerPolicy as f, type TrackerReader as g, type ImageReader as h, type Where as i, type TrackerTriggerMode as j, type WhereSetting as k, type TrackerDataSchema as l, type TrackerPage as m, trackerDataSchema as n, trackerTriggerContextSchema as o, type ImageAssetArtifact as p, type ImageComparison as q, type ImageExtraction as r, type ImageFields as s, trackerDefinitionSchema as t, type ImageInspection as u, type ImageReference as v, type ImageRequest as w, xSearchSourceSchema as x, type ImageSightings as y, type TrackerAccount as z };