@domino-sdk/relay 1.61.0 → 1.63.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 (88) hide show
  1. package/CHANGELOG.md +276 -8
  2. package/README.md +3 -2
  3. package/dist/{schema-CZ6Rj0ZF.d.ts → accounts-nz3mzfRQ.d.ts} +3146 -1765
  4. package/dist/action-9Xl0StBg.d.ts +33 -0
  5. package/dist/{attempt-captures-DYnJVkfg.d.ts → attempt-captures-DMi8oR9T.d.ts} +1 -1
  6. package/dist/authoring.d.ts +171 -49
  7. package/dist/authoring.js +158 -49
  8. package/dist/{automatic-outcomes-If88LR9f.d.ts → automatic-outcomes-C_LLQU1p.d.ts} +15 -1
  9. package/dist/avatar.d.ts +1 -1
  10. package/dist/browser.d.ts +15 -11
  11. package/dist/browser.js +18 -12
  12. package/dist/capability-error-CuI_F7yM.d.ts +296 -0
  13. package/dist/{pages-K7-KjSXw.d.ts → catalog-BaTOKpNw.d.ts} +56 -567
  14. package/dist/{chunk-XBV2CK2H.js → chunk-3RFP6GT5.js} +15 -3
  15. package/dist/{chunk-VURRFVNP.js → chunk-4GQW43UU.js} +239 -361
  16. package/dist/chunk-4NOFSGAL.js +320 -0
  17. package/dist/{chunk-24I4R732.js → chunk-5XLZ34PV.js} +34 -19
  18. package/dist/{chunk-L77O64I4.js → chunk-7X67QLPB.js} +43 -43
  19. package/dist/{chunk-RHBS5FJL.js → chunk-7Z4SZ6YM.js} +3 -3
  20. package/dist/{chunk-QEAS4ZGS.js → chunk-AQOL3SK5.js} +1 -1
  21. package/dist/chunk-EHUSD3O2.js +377 -0
  22. package/dist/chunk-FO2LCZTL.js +19 -0
  23. package/dist/{chunk-DYXDZFKA.js → chunk-FU5CGNTR.js} +166 -178
  24. package/dist/chunk-FWLQ5XCS.js +21 -0
  25. package/dist/chunk-GLH6MEI2.js +193 -0
  26. package/dist/chunk-ICXZZNPS.js +199 -0
  27. package/dist/{chunk-ZDJLPN4L.js → chunk-ID3BZXFZ.js} +2696 -2693
  28. package/dist/chunk-KP2MCX3R.js +587 -0
  29. package/dist/{chunk-SKGTNTLF.js → chunk-LZWXCBUB.js} +213 -297
  30. package/dist/chunk-MTKRIQEU.js +31 -0
  31. package/dist/{chunk-4OC7REYX.js → chunk-MWMCQLCG.js} +3 -3
  32. package/dist/{chunk-PPB7HALD.js → chunk-N4BDKS6Y.js} +27 -26
  33. package/dist/{chunk-5I54XBK2.js → chunk-N4LNEGQX.js} +2 -2
  34. package/dist/chunk-NQDEWJWE.js +554 -0
  35. package/dist/chunk-QR6HH4DI.js +508 -0
  36. package/dist/chunk-TLSQETTY.js +41 -0
  37. package/dist/{chunk-MHPKEVEW.js → chunk-U66GUVSG.js} +7 -2
  38. package/dist/{chunk-KDR2VAJP.js → chunk-UYVJZR33.js} +2 -2
  39. package/dist/chunk-UZ765UGH.js +18 -0
  40. package/dist/{chunk-7A4J67ZL.js → chunk-VWQGWGCH.js} +7 -7
  41. package/dist/chunk-W7YSMSGC.js +725 -0
  42. package/dist/{client-C51w7fMb.d.ts → client-DHmG7rn6.d.ts} +126 -93
  43. package/dist/{announcements-CHx3-HBw.d.ts → dashboards-CLemT6kj.d.ts} +14 -137
  44. package/dist/{deployments-kWoHFaqj.d.ts → deployments-DTULi7dF.d.ts} +450 -18
  45. package/dist/identity-integration-DOeNZaxF.d.ts +1271 -0
  46. package/dist/index.d.ts +13 -11
  47. package/dist/index.js +16 -11
  48. package/dist/internal.d.ts +29 -13
  49. package/dist/internal.js +57 -17
  50. package/dist/{integrations-B3y36OaB.d.ts → limits-kNzYdZ00.d.ts} +464 -53
  51. package/dist/{offers-BoV4ryUc.d.ts → offers-CYeN_I0Y.d.ts} +22 -4
  52. package/dist/{participant-activity-DHL8QYks.d.ts → participant-activity-D-Drp24G.d.ts} +16 -3
  53. package/dist/portal-proxy.d.ts +75 -2
  54. package/dist/portal-proxy.js +153 -25
  55. package/dist/react/index.d.ts +214 -27
  56. package/dist/react/index.js +196 -42
  57. package/dist/{action-DBzILFx9.d.ts → request-error-D_dUPLwo.d.ts} +1 -31
  58. package/dist/reward-deliveries-drp-x1G-.d.ts +782 -0
  59. package/dist/runtime/authoring.js +1 -1
  60. package/dist/runtime/chunks/UGDV5W4N.js +1 -0
  61. package/dist/runtime/manifest.json +3 -3
  62. package/dist/runtime/schema.js +1 -1
  63. package/dist/schema.d.ts +330 -31
  64. package/dist/schema.js +147 -91
  65. package/dist/server/index.d.ts +14 -12
  66. package/dist/server/index.js +6425 -6260
  67. package/dist/sign-in-providers-B1Q9eDRm.d.ts +44 -0
  68. package/dist/submission-input-DZCbjQUH.d.ts +343 -0
  69. package/dist/{telegram-browser-BUceZIGZ.d.ts → telegram-browser-NL0Asmsi.d.ts} +46 -6
  70. package/dist/telegram.d.ts +64 -0
  71. package/dist/telegram.js +23 -0
  72. package/dist/testing.d.ts +326 -27
  73. package/dist/testing.js +440 -90
  74. package/dist/tracker-data-esm3WG8R.d.ts +1881 -0
  75. package/dist/{transport-BrX9pIGN.d.ts → transport-Czht_irp.d.ts} +43483 -38512
  76. package/dist/{wallet-CIqFoxdm.d.ts → wallet-B7e06v4m.d.ts} +32 -9
  77. package/package.json +5 -1
  78. package/dist/accounts-DoabriBX.d.ts +0 -306
  79. package/dist/capability-error-DufwG3G0.d.ts +0 -159
  80. package/dist/chunk-3Y3L2F54.js +0 -982
  81. package/dist/chunk-DHXDBAJF.js +0 -544
  82. package/dist/chunk-EN3M5Z4J.js +0 -13
  83. package/dist/chunk-QNUHWK7R.js +0 -602
  84. package/dist/chunk-SE4PFJPT.js +0 -247
  85. package/dist/groups-CqcA2Ycs.d.ts +0 -2827
  86. package/dist/runtime/chunks/5QVFB4TU.js +0 -1
  87. package/dist/submission-input-C54Q8yAD.d.ts +0 -146
  88. package/dist/x-D1PGi8Sq.d.ts +0 -331
package/dist/testing.d.ts CHANGED
@@ -1,11 +1,20 @@
1
- import { ar as memberIdentitySchema, as as pointBalanceSchema, at as trackerQuerySchema, au as trackerPageSchema, av as trackerSummarySchema, aw as TrackerContentQuery, ax as trackerContentSchema, ay as photoResultSchema, a7 as TextReviewInput, R as Reward, a9 as Decision, az as TrackerAttribution, U as Tracker, V as TrackerData, ae as ContentBody, a5 as TrackerTriggerContext, ak as TrackerPage } from './schema-CZ6Rj0ZF.js';
1
+ import { d3 as pointBalanceSchema, bD as discordMemberSchema, bG as discordMessageSchema, cZ as photoResultSchema, a8 as TextReviewInput, H as Reward, ac as Decision, P as PointBalance, y as PointLedgerReference, u as PointEntry, o as LeaderboardPage } from './accounts-nz3mzfRQ.js';
2
2
  import * as z from 'zod';
3
- import { m as discordMemberSchema, n as discordMessageSchema, t as telegramChatMemberSchema } from './accounts-DoabriBX.js';
4
- import { b as CapabilityFailure, m as memberCompletionSchema } from './capability-error-DufwG3G0.js';
5
- export { C as CapabilityError } from './capability-error-DufwG3G0.js';
6
- import { x as xConnectionSchema, a as xProfileSchema, b as xPostSchema, c as ImageReference, i as imageInspectionSchema, d as imageComparisonSchema, e as imageSightingsSchema } from './x-D1PGi8Sq.js';
7
- import { aj as profileReferralSchema, ak as linkedWalletSchema, al as walletBalanceSchema, am as walletNftsSchema, K as WalletCallArgument, an as walletCallSchema, ao as walletDelegationsSchema, T as WalletEventCondition, ap as walletEventsSchema, aq as walletTransactionsSchema } from './wallet-CIqFoxdm.js';
8
- export { A as AttemptCapture, C as CapturedFact } from './attempt-captures-DYnJVkfg.js';
3
+ import { N as NftCollection, aO as profileReferralSchema, aE as linkedWalletSchema, aY as walletBalanceSchema, b2 as walletNftsSchema, M as WalletCallArgument, aZ as walletCallSchema, a$ as walletDelegationsSchema, U as WalletEventCondition, b0 as walletEventsSchema, b7 as walletTransactionsSchema, v as WalletReader } from './wallet-B7e06v4m.js';
4
+ import { f as CapabilityFailure, q as memberCompletionSchema } from './capability-error-CuI_F7yM.js';
5
+ export { C as CapabilityError } from './capability-error-CuI_F7yM.js';
6
+ import { C as xConnectionSchema, G as xProfileSchema, F as xPostSchema, g as ImageReference, u as imageInspectionSchema, q as imageComparisonSchema, x as imageSightingsSchema } from './limits-kNzYdZ00.js';
7
+ export { L as Limits, l as limits } from './limits-kNzYdZ00.js';
8
+ import { aM as memberIdentitySchema, bf as trackerQuerySchema, ba as trackerPageSchema, bo as trackerSummarySchema, ac as TrackerContentQuery, aX as trackerContentSchema, a8 as TrackerAttribution, o as Tracker, p as TrackerData, H as ContentBody, B as TrackerTriggerContext, U as TrackerPage } from './tracker-data-esm3WG8R.js';
9
+ import { C as telegramConnectionSchema, y as telegramChatMemberSchema, e as TelegramReader } from './submission-input-DZCbjQUH.js';
10
+ import { EvaluationMember } from './authoring.js';
11
+ export { A as AttemptCapture, C as CapturedFact } from './attempt-captures-DMi8oR9T.js';
12
+ import { b as ParticipantSession, R as RelayEvent } from './participant-activity-D-Drp24G.js';
13
+ import { B as Badge } from './offers-CYeN_I0Y.js';
14
+ import { b as QuestView, q as questExperienceSchema } from './catalog-BaTOKpNw.js';
15
+ import './streaks-0YuipsUQ.js';
16
+ import './dashboards-CLemT6kj.js';
17
+ import './units-CwgsPB_r.js';
9
18
 
10
19
  /** One project time-zone change: from `effectiveAt` on, days are counted in `timeZone`. */
11
20
  type CalendarSegment = {
@@ -217,6 +226,123 @@ type CapabilityKind = keyof typeof capabilityRequestSchemas;
217
226
  type CapabilityRequest = {
218
227
  [K in CapabilityKind]: z.output<(typeof capabilityRequestSchemas)[K]>;
219
228
  }[CapabilityKind];
229
+ /**
230
+ * `ctx.telegram.connection()` and `member()`'s request. It stays out of `CapabilityRequest`: that union is closed in
231
+ * SDK 1.x's public `CapabilityCall` and `ReplayDivergence`, and gaining a member would break code
232
+ * that switches over it (docs/adr/0011-telegram.md). The kit answers and numbers Telegram calls as
233
+ * Relay does, but lists them only in a run's `capabilityCalls`, not in the deprecated `calls`.
234
+ */
235
+ declare const telegramRequestSchema: z.ZodObject<{
236
+ kind: z.ZodLiteral<"telegram">;
237
+ input: z.ZodUnion<readonly [z.ZodObject<{
238
+ chat: z.ZodString;
239
+ }, z.core.$strict>, z.ZodObject<{
240
+ operation: z.ZodLiteral<"connection">;
241
+ }, z.core.$strict>]>;
242
+ }, z.core.$strict>;
243
+ type TelegramRequest = z.output<typeof telegramRequestSchema>;
244
+ /**
245
+ * `ctx.wallet.nfts()`'s request. Like Telegram's, it stays out of the closed `CapabilityRequest`:
246
+ * the kit answers and numbers NFT reads, but lists them only in a run's `capabilityCalls`, not in the deprecated `calls`.
247
+ */
248
+ declare const walletNftsRequestSchema: z.ZodObject<{
249
+ kind: z.ZodLiteral<"wallet-nfts">;
250
+ collection: z.ZodString & z.ZodType<NftCollection, string, z.core.$ZodTypeInternals<NftCollection, string>>;
251
+ address: z.ZodNullable<z.ZodString>;
252
+ }, z.core.$strict>;
253
+ type WalletNftsRequest = z.output<typeof walletNftsRequestSchema>;
254
+ declare const walletEventsRequestSchema: z.ZodObject<{
255
+ kind: z.ZodLiteral<"wallet-events">;
256
+ event: z.ZodString & z.ZodType<`eip155:${number}:0x${string} ${string}`, string, z.core.$ZodTypeInternals<`eip155:${number}:0x${string} ${string}`, string>>;
257
+ account: z.ZodString;
258
+ since: z.ZodNumber;
259
+ afterActivation: z.ZodBoolean;
260
+ where: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodObject<{
261
+ gte: z.ZodString;
262
+ }, z.core.$strict>]>>>;
263
+ address: z.ZodNullable<z.ZodString>;
264
+ newest: z.ZodOptional<z.ZodNumber>;
265
+ }, z.core.$strict>;
266
+ type WalletEventsRequest = z.output<typeof walletEventsRequestSchema>;
267
+ /** `ctx.wallet.transactions()`'s request: answered and numbered like event reads, and unlisted the same way. */
268
+ declare const walletTransactionsRequestSchema: z.ZodObject<{
269
+ kind: z.ZodLiteral<"wallet-transactions">;
270
+ program: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
271
+ since: z.ZodNumber;
272
+ afterActivation: z.ZodBoolean;
273
+ mint: z.ZodNullable<z.ZodString>;
274
+ address: z.ZodNullable<z.ZodString>;
275
+ }, z.core.$strict>;
276
+ type WalletTransactionsRequest = z.output<typeof walletTransactionsRequestSchema>;
277
+ /**
278
+ * `ctx.wallet.call()`'s and `ctx.wallet.delegations()`'s requests. Like NFT reads, they stay out of
279
+ * the closed `CapabilityRequest`: the kit answers and numbers them, but lists them only in a run's `capabilityCalls`, not in the deprecated `calls`.
280
+ */
281
+ declare const walletCallRequestSchema: z.ZodObject<{
282
+ kind: z.ZodLiteral<"wallet-call">;
283
+ call: z.ZodString & z.ZodType<`eip155:${number}:0x${string} function ${string}`, string, z.core.$ZodTypeInternals<`eip155:${number}:0x${string} function ${string}`, string>>;
284
+ args: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
285
+ wallet: z.ZodLiteral<true>;
286
+ }, z.core.$strict>, z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
287
+ address: z.ZodNullable<z.ZodString>;
288
+ }, z.core.$strict>;
289
+ type WalletCallRequest = z.output<typeof walletCallRequestSchema>;
290
+ declare const walletDelegationsRequestSchema: z.ZodObject<{
291
+ kind: z.ZodLiteral<"wallet-delegations">;
292
+ chain: z.ZodCustom<`cosmos:${string}`, `cosmos:${string}`>;
293
+ validator: z.ZodNullable<z.ZodString>;
294
+ address: z.ZodNullable<z.ZodString>;
295
+ }, z.core.$strict>;
296
+ type WalletDelegationsRequest = z.output<typeof walletDelegationsRequestSchema>;
297
+ /**
298
+ * `ctx.member.balance()`, `completions()`, `groups()`, `enrolled()` and `referrals()`, which read
299
+ * Relay's own state of the member. Like Telegram's, they stay out of the closed `CapabilityRequest`: the kit answers and
300
+ * numbers them, but lists them only in a run's `capabilityCalls`, not in the deprecated `calls`.
301
+ */
302
+ declare const memberStateRequestSchemas: {
303
+ "member-balance": z.ZodObject<{
304
+ kind: z.ZodLiteral<"member-balance">;
305
+ ledger: z.ZodString;
306
+ }, z.core.$strict>;
307
+ "member-completions": z.ZodObject<{
308
+ kind: z.ZodLiteral<"member-completions">;
309
+ quest: z.ZodNullable<z.ZodString>;
310
+ since: z.ZodNullable<z.ZodNumber>;
311
+ limit: z.ZodNumber;
312
+ }, z.core.$strict>;
313
+ "member-groups": z.ZodObject<{
314
+ kind: z.ZodLiteral<"member-groups">;
315
+ }, z.core.$strict>;
316
+ "member-enrolled": z.ZodObject<{
317
+ kind: z.ZodLiteral<"member-enrolled">;
318
+ campaign: z.ZodString;
319
+ }, z.core.$strict>;
320
+ "member-referrals": z.ZodObject<{
321
+ kind: z.ZodLiteral<"member-referrals">;
322
+ program: z.ZodString;
323
+ }, z.core.$strict>;
324
+ };
325
+ type MemberStateRequest = z.output<(typeof memberStateRequestSchemas)[keyof typeof memberStateRequestSchemas]>;
326
+ /** Every request the kit answers: the public `CapabilityRequest` kinds, Telegram's, NFT, contract call and delegation reads, and the member's state. */
327
+ type KitRequest = CapabilityRequest | TelegramRequest | WalletNftsRequest | WalletCallRequest | WalletDelegationsRequest | WalletEventsRequest | WalletTransactionsRequest | MemberStateRequest;
328
+ /**
329
+ * The capability kinds this release of the kit knows, one per reader method family.
330
+ *
331
+ * @compat open
332
+ */
333
+ type KnownCapabilityKind = KitRequest["kind"];
334
+ /**
335
+ * One capability request quest code sent, as Relay validated it: `kind` names the reader, and the
336
+ * other fields are the wire request's, such as `{ kind: "wallet-events", event, account, since }`.
337
+ * Open: a later release adds kinds, and a request of a kind this release does not know keeps its
338
+ * fields. Compare it whole, or narrow on `kind` and read the fields you expect.
339
+ *
340
+ * @compat output
341
+ */
342
+ type CapabilityCallRequest = {
343
+ kind: KnownCapabilityKind | (string & {});
344
+ [field: string]: unknown;
345
+ };
220
346
 
221
347
  /** A result as a fake writes it: Relay's result schema fills defaults before quest code reads it. */
222
348
  type Result<S extends z.ZodType> = z.input<S>;
@@ -257,7 +383,7 @@ type WalletDelegationsQueryRequest = {
257
383
  };
258
384
  /**
259
385
  * An event query as Relay receives it: `afterActivation` false, and `where` and `address` null,
260
- * when the quest leaves them out.
386
+ * when the quest leaves them out; `newest` only when the quest sets it.
261
387
  */
262
388
  type WalletEventsQueryRequest = {
263
389
  event: string;
@@ -266,6 +392,7 @@ type WalletEventsQueryRequest = {
266
392
  afterActivation: boolean;
267
393
  where: Record<string, WalletEventCondition> | null;
268
394
  address: string | null;
395
+ newest?: number;
269
396
  };
270
397
  /**
271
398
  * A transaction query as Relay receives it: `afterActivation` false, and `mint` and `address`
@@ -301,7 +428,7 @@ type TrackerFacts = {
301
428
  * Reads of the member's own accounts default to a member who has linked nothing:
302
429
  * `member.identities()`, `wallet.list()`, `wallet.balance()`, `wallet.nfts()`, `wallet.call()`,
303
430
  * `wallet.delegations()`, `x.connection()`, `x.profile()`,
304
- * `x.follows()`, `x.reposted()`, `discord.member()` and `telegram.member()` resolve to null. Once the test links an
431
+ * `x.follows()`, `x.reposted()`, `discord.member()`, `telegram.connection()` and `telegram.member()` resolve to null. Once the test links an
305
432
  * account (`wallet.list` or `x.connection` set to a value), supply every read of it the quest
306
433
  * makes. Every other read (the member's balances, completions, groups, campaigns and referrals, an
307
434
  * X post, a Discord message, trackers, images and AI review) needs an answer: a call without one
@@ -350,31 +477,30 @@ type TestFacts = {
350
477
  ], Result<typeof walletBalanceSchema> | null>;
351
478
  /**
352
479
  * `ctx.wallet.nfts({ collection })`. Like `balance`, it reads null while the member has no
353
- * linked wallet of the collection's family (EVM or Solana). A run's `calls` does not list NFT reads: its request type is closed in
354
- * SDK 1.x.
480
+ * linked wallet of the collection's family (EVM or Solana). A run's `capabilityCalls` lists these calls; the deprecated `calls` does not.
355
481
  */
356
482
  nfts?: FakeAnswer<[
357
483
  query: WalletNftsQueryRequest
358
484
  ], Result<typeof walletNftsSchema> | null>;
359
485
  /**
360
486
  * `ctx.wallet.call({ call, args })`. Like `balance`, it reads null while the member has no
361
- * linked EVM wallet. A run's `calls` does not list contract calls: its request type is closed
362
- * in SDK 1.x.
487
+ * linked EVM wallet. A run's `capabilityCalls` lists these calls; the deprecated `calls` does not.
363
488
  */
364
489
  call?: FakeAnswer<[
365
490
  query: WalletCallQueryRequest
366
491
  ], Result<typeof walletCallSchema> | null>;
367
492
  /**
368
493
  * `ctx.wallet.delegations({ chain, validator })`. Like `balance`, it reads null while the member
369
- * has no wallet linked on that Cosmos network. A run's `calls` does not list delegation reads.
494
+ * has no wallet linked on that Cosmos network. A run's `capabilityCalls` lists these calls; the deprecated `calls` does not.
370
495
  */
371
496
  delegations?: FakeAnswer<[
372
497
  query: WalletDelegationsQueryRequest
373
498
  ], Result<typeof walletDelegationsSchema> | null>;
374
499
  /**
375
500
  * `ctx.wallet.events({ event, account, since })`. Like `balance`, it reads null while the
376
- * member has no linked EVM wallet. The kit does not apply `where` or `since`: answer with the
377
- * logs Relay would return. A run's `calls` does not list event reads.
501
+ * member has no linked EVM wallet. The kit does not apply `where`, `since` or `newest`: answer
502
+ * with the logs Relay would return, and `complete: false` for a `newest` read that left older
503
+ * events out. A run's `capabilityCalls` lists these calls; the deprecated `calls` does not.
378
504
  */
379
505
  events?: FakeAnswer<[
380
506
  query: WalletEventsQueryRequest
@@ -383,7 +509,7 @@ type TestFacts = {
383
509
  * `ctx.wallet.transactions({ program, since })`. Like `balance`, it reads null while the
384
510
  * member has no linked Solana wallet. The kit does not apply `program`, `since` or `mint`:
385
511
  * answer with the transactions Relay would return, with `instructions` when the program's
386
- * setting has an Anchor IDL. A run's `calls` does not list transaction reads.
512
+ * setting has an Anchor IDL. A run's `capabilityCalls` lists these calls; the deprecated `calls` does not.
387
513
  */
388
514
  transactions?: FakeAnswer<[
389
515
  query: WalletTransactionsQueryRequest
@@ -414,11 +540,13 @@ type TestFacts = {
414
540
  ], Result<typeof discordMessageSchema> | null>;
415
541
  };
416
542
  /**
417
- * `ctx.telegram.member({ chat })`, which the testing kit supplies to every quest as Relay does.
418
- * Throw `new CapabilityError("integration-required", …)` to act out a chat the project has not
419
- * connected. A run's `calls` does not list Telegram calls: its request type is closed in SDK 1.x.
543
+ * `ctx.telegram.connection()` and `ctx.telegram.member({ chat })`, which the testing kit supplies
544
+ * to every quest as Relay does. `connection` is answered once per run, as Relay pins the account.
545
+ * Throw `new CapabilityError("integration-required", …)` from `member` to act out a chat the
546
+ * project has not connected. A run's `capabilityCalls` lists these calls; the deprecated `calls` does not.
420
547
  */
421
548
  telegram?: {
549
+ connection?: FakeAnswer<[], Result<typeof telegramConnectionSchema> | null>;
422
550
  member?: FakeAnswer<[
423
551
  input: {
424
552
  chat: string;
@@ -488,6 +616,8 @@ declare const defaultSeed = "attempt_test";
488
616
  /**
489
617
  * The most capability calls one hosted evaluation run can make, shared by all capabilities. The
490
618
  * next call throws a `CapabilityError` with code `capability-limit`.
619
+ *
620
+ * @deprecated Use `limits.capabilityCalls`, which a 1.x release can raise.
491
621
  */
492
622
  declare const maxCapabilityCalls = 8;
493
623
  /**
@@ -570,7 +700,8 @@ type RunQuestOptions<Q extends TestableQuest = TestableQuest> = {
570
700
  facts?: TestFacts;
571
701
  };
572
702
  /**
573
- * One capability call, as Relay captures it for replay.
703
+ * One capability call, as Relay captures it for replay. Its request type is closed in SDK 1.x, so
704
+ * lists of it leave out the kinds it cannot name; use `CapabilityCallRecord`.
574
705
  *
575
706
  * @compat output
576
707
  */
@@ -579,6 +710,17 @@ type CapabilityCall = {
579
710
  request: CapabilityRequest;
580
711
  outcome: CapabilityOutcome;
581
712
  };
713
+ /**
714
+ * One capability call of any kind, as Relay captures it for replay: its position in the run, the
715
+ * request quest code sent, and the value or failure quest code received.
716
+ *
717
+ * @compat output
718
+ */
719
+ type CapabilityCallRecord = {
720
+ sequence: number;
721
+ request: CapabilityCallRequest;
722
+ outcome: CapabilityOutcome;
723
+ };
582
724
  /**
583
725
  * The published release a run used: what `describe` returned for the settings.
584
726
  *
@@ -604,8 +746,15 @@ type QuestDiagnostic = {
604
746
  type TestContext<Q extends TestableQuest = TestableQuest> = {
605
747
  /** The host context to pass to `quest.evaluate`. */
606
748
  context: QuestHostContext<Q>;
607
- /** The capability calls quest code has made so far, in order. */
749
+ /**
750
+ * The capability calls of the kinds `CapabilityRequest` names, in order.
751
+ *
752
+ * @deprecated Use `capabilityCalls`, which lists every kind: Telegram, NFT, contract call,
753
+ * delegation, wallet event and transaction reads and the member's state are missing here.
754
+ */
608
755
  calls: CapabilityCall[];
756
+ /** Every capability call quest code has made so far, of any kind, in order. */
757
+ capabilityCalls: CapabilityCallRecord[];
609
758
  /** What `quest.evaluate` has reported so far that had no effect. */
610
759
  diagnostics: QuestDiagnostic[];
611
760
  release: TestRelease;
@@ -616,7 +765,15 @@ type TestContext<Q extends TestableQuest = TestableQuest> = {
616
765
  /** @compat output */
617
766
  type QuestRun = {
618
767
  decision: Decision;
768
+ /**
769
+ * The capability calls of the kinds `CapabilityRequest` names, in order.
770
+ *
771
+ * @deprecated Use `capabilityCalls`, which lists every kind: Telegram, NFT, contract call,
772
+ * delegation, wallet event and transaction reads and the member's state are missing here.
773
+ */
619
774
  calls: CapabilityCall[];
775
+ /** Every capability call the run made, of any kind, in order. `runQuest` always sets it. */
776
+ capabilityCalls?: CapabilityCallRecord[];
620
777
  release: TestRelease;
621
778
  /**
622
779
  * What the run did that had no effect; Relay records none of it for hosted attempts. `runQuest`
@@ -626,6 +783,8 @@ type QuestRun = {
626
783
  };
627
784
  /** What `runQuest` resolves with. */
628
785
  type DiagnosedRun = QuestRun & {
786
+ /** Every capability call the run made, of any kind, in order. */
787
+ capabilityCalls: CapabilityCallRecord[];
629
788
  /** What the run did that had no effect; Relay records none of it for hosted attempts. */
630
789
  diagnostics: QuestDiagnostic[];
631
790
  };
@@ -651,13 +810,36 @@ declare function createTestContext<Q extends TestableQuest>(quest: Q, options?:
651
810
  * capability readers answered from `facts` and checked against Relay's capability contracts, and
652
811
  * the decision's rewards checked against the published bundle.
653
812
  *
654
- * Resolves with the decision and every capability call. Rejects with a capability failure that
813
+ * Resolves with the decision and every capability call, in `capabilityCalls`. Rejects with a capability failure that
655
814
  * escaped quest code, as thrown or wrapped (Relay retries a retryable one); with an
656
815
  * `EvaluatorError` for anything else quest code threw, which Relay fails the attempt with once;
657
816
  * or with a `TestSetupError` for a call the facts cannot answer.
658
817
  */
659
818
  declare function runQuest<Q extends TestableQuest>(quest: Q, options?: RunQuestOptions<Q>): Promise<DiagnosedRun>;
660
819
 
820
+ /**
821
+ * An `EvaluationMember` for a test that builds its own evaluation context, such as one that calls
822
+ * `quest.evaluate` with readers of its own. Pass the methods the code under test reads; the rest
823
+ * answer for a member with no linked accounts, completions, groups or enrollments, and `balance`
824
+ * and `referrals` fail as Relay does for an unknown ledger or program. A minor release can give
825
+ * `EvaluationMember` a method; this helper gives it a default, so a test that uses it keeps
826
+ * compiling. `createTestContext` and `runQuest` create the member themselves.
827
+ */
828
+ declare function fakeEvaluationMember(member?: Partial<EvaluationMember>): EvaluationMember;
829
+
830
+ /**
831
+ * A `WalletReader` with every method Relay supplies, answered from `facts.wallet` as `runQuest`
832
+ * answers it: a member with no linked wallet unless `facts.wallet.list` links one. Use it in a
833
+ * test that builds its own evaluation context; a minor release that adds a reader method gives it
834
+ * here too, so the test keeps compiling and the new method keeps working.
835
+ */
836
+ declare function fakeWalletReader(facts?: Pick<TestFacts, "wallet">): Required<WalletReader>;
837
+ /**
838
+ * A `TelegramReader` with every method Relay supplies, answered from `facts.telegram` as
839
+ * `runQuest` answers it: a member who has not linked Telegram unless the facts say otherwise.
840
+ */
841
+ declare function fakeTelegramReader(facts?: Pick<TestFacts, "telegram">): Required<TelegramReader>;
842
+
661
843
  type Kind = Decision["kind"];
662
844
  type DecisionOf<K extends Kind> = Extract<Decision, {
663
845
  kind: K;
@@ -760,7 +942,8 @@ type ReplayOptions = {
760
942
  facts?: TestFacts;
761
943
  };
762
944
  /**
763
- * The first call the capture could not answer.
945
+ * The first call the capture could not answer, when its kind is one `CapabilityRequest` names.
946
+ * Use `CapabilityDivergence`, which reports every kind.
764
947
  *
765
948
  * @compat output
766
949
  */
@@ -775,6 +958,27 @@ type ReplayDivergence = {
775
958
  recorded: Record<string, unknown> | null;
776
959
  replayed: CapabilityRequest;
777
960
  };
961
+ /**
962
+ * Why the capture could not answer a call. `"new"`: the captured run made no such call.
963
+ * `"changed"`: it sent another request. `"uncaptured"`: its answer was a retryable failure Relay
964
+ * did not keep.
965
+ *
966
+ * @compat open
967
+ */
968
+ type KnownDivergenceReason = "new" | "changed" | "uncaptured";
969
+ /**
970
+ * The first call the capture could not answer, of any capability kind.
971
+ *
972
+ * @compat output
973
+ */
974
+ type CapabilityDivergence = {
975
+ sequence: number;
976
+ reason: KnownDivergenceReason | (string & {});
977
+ /** The request the captured run sent at this position; null for a new call. */
978
+ recorded: Record<string, unknown> | null;
979
+ /** The request current quest code sent. */
980
+ replayed: CapabilityCallRequest;
981
+ };
778
982
  /** @compat output */
779
983
  type AttemptReplay = {
780
984
  /** What the current quest code decides; null when the replay stopped at a divergence. */
@@ -786,9 +990,26 @@ type AttemptReplay = {
786
990
  * key. Null when either is missing.
787
991
  */
788
992
  changed: boolean | null;
789
- /** The first call the capture could not answer, or null when it answered every call. */
993
+ /**
994
+ * The first call the capture could not answer, or null when it answered every call or the
995
+ * first such call is of a kind `CapabilityRequest` does not name.
996
+ *
997
+ * @deprecated Use `capabilityDivergence`, which reports every kind.
998
+ */
790
999
  divergence: ReplayDivergence | null;
1000
+ /**
1001
+ * The first call the capture could not answer, of any kind, or null when it answered every
1002
+ * call. `replayAttempt` always sets it.
1003
+ */
1004
+ capabilityDivergence?: CapabilityDivergence | null;
1005
+ /**
1006
+ * The capability calls of the kinds `CapabilityRequest` names, in order.
1007
+ *
1008
+ * @deprecated Use `capabilityCalls`, which lists every kind.
1009
+ */
791
1010
  calls: CapabilityCall[];
1011
+ /** Every capability call the replay made, of any kind, in order. `replayAttempt` always sets it. */
1012
+ capabilityCalls?: CapabilityCallRecord[];
792
1013
  };
793
1014
  /**
794
1015
  * Evaluates current quest code against a captured attempt: the release's settings and rewards,
@@ -801,6 +1022,84 @@ type AttemptReplay = {
801
1022
  * alters a past outcome. A call the capture cannot answer stops the replay unless `facts`
802
1023
  * answers it; the result names the first one.
803
1024
  */
804
- declare function replayAttempt<Q extends TestableQuest>(quest: Q, capture: unknown, options?: ReplayOptions): Promise<AttemptReplay>;
1025
+ declare function replayAttempt<Q extends TestableQuest>(quest: Q, capture: unknown, options?: ReplayOptions): Promise<AttemptReplay & {
1026
+ capabilityDivergence: CapabilityDivergence | null;
1027
+ capabilityCalls: CapabilityCallRecord[];
1028
+ }>;
1029
+
1030
+ type Experience = z.output<typeof questExperienceSchema>;
1031
+ /**
1032
+ * What `createFakeRelay` answers with. Every seed is optional; an omitted one answers empty.
1033
+ *
1034
+ * @experimental A minor release can change it, like `createFakeRelay`.
1035
+ */
1036
+ type FakeRelayOptions = {
1037
+ /** The signed-in member's ID, or null (the default) for a signed-out visitor. */
1038
+ member?: string | null;
1039
+ /** The session's project scope. Defaults to `org_test`, `project_test` and `test`. */
1040
+ scope?: Pick<ParticipantSession, "organization" | "project" | "environment">;
1041
+ /** The member's quests, as `GET /v1/me/experience` lists them. */
1042
+ quests?: QuestView[];
1043
+ /** The experience's collections. */
1044
+ collections?: Experience["collections"];
1045
+ /** The experience's entitlements. */
1046
+ entitlements?: Experience["entitlements"];
1047
+ /**
1048
+ * The member's balance in each ledger (`GET /v1/me/points`). `GET /v1/point-ledgers` lists these
1049
+ * ledgers unless `ledgers` is given.
1050
+ */
1051
+ balances?: PointBalance[];
1052
+ /** The project's ledgers (`GET /v1/point-ledgers`). */
1053
+ ledgers?: PointLedgerReference[];
1054
+ /** Each ledger's history (`GET /v1/me/points/:ledger/history`), keyed by ledger key or ID. */
1055
+ pointHistory?: Record<string, PointEntry[]>;
1056
+ /** The member's activity feed (`GET /v1/me/activity`), oldest event first. */
1057
+ activity?: RelayEvent[];
1058
+ /** The project's active badge catalog (`GET /v1/badges/catalog` and `GET /v1/badges`). */
1059
+ badges?: Badge[];
1060
+ /** Each board's standings (`GET /v1/leaderboards/:board`), keyed by the board's key or ID. */
1061
+ leaderboards?: Record<string, LeaderboardPage>;
1062
+ /**
1063
+ * Answers for routes the fake does not cover, or replacements for ones it does, keyed
1064
+ * `"METHOD /v1/path"`. A `:name` path segment matches any one segment, as in
1065
+ * `"POST /v1/me/submissions/:submission/submit"`.
1066
+ */
1067
+ routes?: Record<string, (request: Request) => Response | Promise<Response>>;
1068
+ };
1069
+ /**
1070
+ * One request the fake answered: its method and `/v1/...` path, without the query.
1071
+ *
1072
+ * @experimental A minor release can change it, like `createFakeRelay`.
1073
+ */
1074
+ type FakeRelayRequest = {
1075
+ method: string;
1076
+ path: string;
1077
+ };
1078
+ /**
1079
+ * The fake `createFakeRelay` returns.
1080
+ *
1081
+ * @experimental A minor release can change it, like `createFakeRelay`.
1082
+ */
1083
+ type FakeRelay = {
1084
+ /** Answers one request. Use it from a Playwright `page.route` handler or an MSW handler. */
1085
+ handle(request: Request): Promise<Response>;
1086
+ /** A `fetch` that answers from the fake, for `createRelayClient({ fetch })`. */
1087
+ fetch: typeof fetch;
1088
+ /** Every request answered so far, in order. */
1089
+ readonly requests: FakeRelayRequest[];
1090
+ };
1091
+ /**
1092
+ * An in-memory participant API for UI tests: it answers what `RelayProvider` and the hooks read
1093
+ * from the seeds, as Relay would, under `/v1/...` and the hosted proxy's `/relay/v1/...`.
1094
+ *
1095
+ * Every answer is checked against the schema the SDK reads it with, so a seed Relay could never
1096
+ * send throws a `TestSetupError` naming the route. A participant route the fake does not cover
1097
+ * answers 501 with code `not-faked`, so a test cannot pass on an empty answer; `routes` answers
1098
+ * it instead. Any other path answers 404 with code `route-not-found`, as the proxy does.
1099
+ *
1100
+ * @experimental Outside the 1.x compatibility promise: a minor release can change its options,
1101
+ * the routes it fakes and its answers, as the participant API it imitates grows.
1102
+ */
1103
+ declare function createFakeRelay(options?: FakeRelayOptions): FakeRelay;
805
1104
 
806
- export { type AttemptReplay, type CalendarSegment, type CapabilityCall, type CapabilityOutcome, type CapabilityRequest, Decision, DecisionAssertionError, EvaluatorError, type FakeAnswer, type QuestDiagnostic, type QuestHostContext, type QuestInputOf, type QuestRun, type ReplayDivergence, type ReplayOptions, type RunQuestOptions, type TestContext, type TestFacts, type TestRelease, TestSetupError, type TestableQuest, type TrackerFacts, type TrackerObservationInput, type TrackerReadRequest, type TrackerRecordInput, type WalletBalanceRequest, createTestContext, defaultMember, defaultNow, defaultSeed, expectAccept, expectDefer, expectProgress, expectReject, expectReview, maxCapabilityCalls, replayAttempt, runQuest, trackerObservation, trackerPage };
1105
+ export { type AttemptReplay, type CalendarSegment, type CapabilityCall, type CapabilityCallRecord, type CapabilityCallRequest, type CapabilityDivergence, type CapabilityOutcome, type CapabilityRequest, Decision, DecisionAssertionError, EvaluatorError, type FakeAnswer, type FakeRelay, type FakeRelayOptions, type FakeRelayRequest, type KnownCapabilityKind, type KnownDivergenceReason, type QuestDiagnostic, type QuestHostContext, type QuestInputOf, type QuestRun, type ReplayDivergence, type ReplayOptions, type RunQuestOptions, type TestContext, type TestFacts, type TestRelease, TestSetupError, type TestableQuest, type TrackerFacts, type TrackerObservationInput, type TrackerReadRequest, type TrackerRecordInput, type WalletBalanceRequest, createFakeRelay, createTestContext, defaultMember, defaultNow, defaultSeed, expectAccept, expectDefer, expectProgress, expectReject, expectReview, fakeEvaluationMember, fakeTelegramReader, fakeWalletReader, maxCapabilityCalls, replayAttempt, runQuest, trackerObservation, trackerPage };