@testerpaykit/api-client 1.7.0 → 3.1.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,43 @@
2
2
 
3
3
  All notable changes to `@testerpaykit/api-client` are documented here.
4
4
 
5
+ ## 3.1.0 — 2026-11-14
6
+
7
+ ### Added
8
+ - `clientHeader` in `ApiClientConfig`: sent as `X-TPK-Client` on every
9
+ request (e.g. `expo/2.2.0`). Default none.
10
+ - Version check: on a 426 `client_outdated` answer the client calls
11
+ `onClientOutdated(info)` once, `clientOutdated` holds the info, and every
12
+ later request rejects with `ClientOutdatedError` before it reaches the
13
+ network (no `response`, so retry queues keep their work).
14
+ `markClientOutdated(info)` blocks a client created later in the same run.
15
+ Also exported: `TPK_CLIENT_HEADER`, `parseClientOutdated`, the
16
+ `ClientOutdatedInfo` type.
17
+
18
+ ## 3.0.0 — 2026-11-10
19
+
20
+ Breaking: `startPhoneVerification`, `confirmPhoneVerification` and their types
21
+ removed. Testers confirm their number once in the TPK app (decision
22
+ 2026-11-10).
23
+
24
+ ### Added
25
+ - `createAppLink({ projectId, platform })` → `{ code, url, appUrl, expiresAt }`:
26
+ a short-lived code for confirming this install in the TPK app.
27
+
28
+ ## 2.0.0 — 2026-11-07
29
+
30
+ Breaking: `submitSessionEndFeedback` removed.
31
+
32
+ ### Added
33
+ - `onTesterGate` — called on any 403 `phone_required` /
34
+ `approval_required` answer (SDKs hide their tester UI on it). Type
35
+ `TesterGateReason`.
36
+
37
+ ### Removed
38
+ - `submitSessionEndFeedback` and `FeedbackResponse`: `/v1/session-feedback`
39
+ never existed on the API. Session feedback goes out as a
40
+ `generalFeedback` bug report.
41
+
5
42
  ## 1.7.0 — 2026-11-01
6
43
 
7
44
  ### Added
package/dist/index.d.mts CHANGED
@@ -1,5 +1,122 @@
1
1
  import { TokenManager, IApiClient, LoginRequest, LoginResponse, WeeklySummary, RemoteAiSession, VoiceBugExtractResponse, QuickActionKind } from '@testerpaykit/core';
2
2
 
3
+ /** `play` = play money in the pilot: real ledger rows, never a payout.
4
+ * Every UI labels such amounts "Spielgeld · Pilot" / "Play money · pilot". */
5
+ type MoneyMode = 'play' | 'test' | 'live';
6
+ type WorkState = 'offered' | 'active' | 'paused' | 'review' | 'disputed' | 'approved' | 'cancelled';
7
+ interface PaidAssignment {
8
+ id: string;
9
+ project_id: string;
10
+ tester_id: string;
11
+ title: string;
12
+ project_name: string;
13
+ mode: MoneyMode;
14
+ terms_version: 1;
15
+ rate_cents: number;
16
+ minimum_cents: number;
17
+ budget_cents: number;
18
+ seconds: number;
19
+ running_since: string | null;
20
+ state: WorkState;
21
+ revision: number;
22
+ amount_cents: number | null;
23
+ review_due: string | null;
24
+ review_note: string | null;
25
+ completion_note: string | null;
26
+ }
27
+ /** time = paid assignment · task = checklist task on its announced time ·
28
+ * bonus = idea bonus · bug_bonus · reproduction · retest (one per round). */
29
+ type MoneyKind = 'time' | 'task' | 'bonus' | 'bug_bonus' | 'reproduction' | 'retest' | 'start_bonus';
30
+ interface MoneyEntry {
31
+ id: string;
32
+ project_id: string;
33
+ project_name: string;
34
+ tester_id: string;
35
+ mode: MoneyMode;
36
+ kind: MoneyKind;
37
+ reason: string;
38
+ amount_cents: number;
39
+ currency: 'eur';
40
+ /** review = waits for the 3-working-day window, then released. */
41
+ status: 'review' | 'approved' | 'processing' | 'transferred' | 'held';
42
+ units: number;
43
+ review_due: string | null;
44
+ review_note: string | null;
45
+ bug_id: string | null;
46
+ task_preset_id: string | null;
47
+ created_at: string;
48
+ transfer_id: string | null;
49
+ }
50
+ /** Sums in the current mode, in cents. Bonuses never count towards the 5 € floor. */
51
+ interface MoneyTotals {
52
+ in_review_cents: number;
53
+ released_cents: number;
54
+ bonus_cents: number;
55
+ held_cents: number;
56
+ total_cents: number;
57
+ }
58
+ interface CompensationRates {
59
+ rate_cents_per_minute: number;
60
+ minimum_cents: number;
61
+ bug_bonus_cents: {
62
+ easy: number;
63
+ medium: number;
64
+ hard: number;
65
+ };
66
+ reproduction_cents: number;
67
+ retest_per_fix_cents: number;
68
+ retest_round_minimum_cents: number;
69
+ idea_bonus_choices_cents: number[];
70
+ review_working_days: number;
71
+ /** Start bonus, booked once per person on the first phone confirmation. */
72
+ start_bonus_cents?: number;
73
+ }
74
+ interface CompensationWallet {
75
+ /** Current mode; `play` = label every amount as play money. */
76
+ mode: MoneyMode;
77
+ currency: 'eur';
78
+ server_time: string;
79
+ rates: CompensationRates;
80
+ /** The person = every app install with the same confirmed phone. */
81
+ person: {
82
+ handle: string | null;
83
+ phone_confirmed: boolean;
84
+ tester_count: number;
85
+ apps: Array<{
86
+ project_id: string;
87
+ project_name: string;
88
+ }>;
89
+ };
90
+ /** Whole person across apps … */
91
+ totals: MoneyTotals;
92
+ /** … and the share of this app install. */
93
+ this_app: MoneyTotals;
94
+ assignments: PaidAssignment[];
95
+ entries: MoneyEntry[];
96
+ balances: Record<MoneyMode, Record<MoneyEntry['status'], number>>;
97
+ legacy: Array<{
98
+ id: string;
99
+ source: string;
100
+ amount_cents: number;
101
+ status: string;
102
+ }>;
103
+ }
104
+ interface WorkCommand {
105
+ assignment_id: string;
106
+ request_id: string;
107
+ revision: number;
108
+ action: 'start' | 'pause' | 'submit' | 'submit_partial' | 'decline';
109
+ accept_terms_version?: 1;
110
+ seconds?: number;
111
+ note?: string;
112
+ }
113
+ interface PushRegistration {
114
+ installation_id: string;
115
+ app_id: string;
116
+ token?: string;
117
+ enabled: boolean;
118
+ }
119
+
3
120
  /** Body of a "Send to Claude" note (see `sendLiveNote`). */
4
121
  interface LiveNoteInput {
5
122
  projectId: string;
@@ -45,7 +162,37 @@ interface ApiClientConfig {
45
162
  baseURL?: string;
46
163
  apiKey: string;
47
164
  tokenManager?: TokenManager;
165
+ /**
166
+ * Sent as `X-TPK-Client` on every request, e.g. `expo/2.2.0` (decision
167
+ * 2026-11-14 "Mindestversion je Client-Art"). Default none: the server
168
+ * then serves the request without a version check.
169
+ */
170
+ clientHeader?: string;
171
+ }
172
+ /** Request header a client identifies itself with (`<kind>/<version>`). */
173
+ declare const TPK_CLIENT_HEADER = "X-TPK-Client";
174
+ /** Body of a 426 `client_outdated` answer: this client is below the
175
+ * minimum version the server still serves. Fields are null when the
176
+ * request carried no `X-TPK-Client`. */
177
+ interface ClientOutdatedInfo {
178
+ kind: string | null;
179
+ min: string | null;
180
+ yours: string | null;
181
+ message: string | null;
182
+ }
183
+ /**
184
+ * Thrown instead of sending, for every request after a 426
185
+ * `client_outdated` (see `TesterPayKitApiClient.clientOutdated`). It has
186
+ * no `response`, so callers that retry on network errors keep their
187
+ * queued work for a newer build instead of dropping it.
188
+ */
189
+ declare class ClientOutdatedError extends Error {
190
+ readonly info: ClientOutdatedInfo;
191
+ readonly code = "TPK_CLIENT_OUTDATED";
192
+ constructor(info: ClientOutdatedInfo);
48
193
  }
194
+ /** The `client_outdated` body of a 426 answer, else null. */
195
+ declare function parseClientOutdated(status: number | undefined, body: unknown): ClientOutdatedInfo | null;
49
196
  /**
50
197
  * TesterPayKit API Client implementation using Axios.
51
198
  *
@@ -54,10 +201,32 @@ interface ApiClientConfig {
54
201
  * - Request/response interceptors for auth headers
55
202
  * - Integration with TokenManager for token lifecycle
56
203
  */
204
+ /** The tester gate's 403 codes (migrations 075 + 077). */
205
+ type TesterGateReason = 'phone_required' | 'approval_required';
57
206
  declare class TesterPayKitApiClient implements IApiClient {
58
207
  private client;
59
208
  private tokenManager;
60
209
  private apiKey;
210
+ /**
211
+ * Called on any 403 `phone_required` / `approval_required` answer: the
212
+ * tester is not (or no longer) cleared to report. SDKs hide their
213
+ * tester UI on it. The request still rejects as before.
214
+ */
215
+ onTesterGate: ((reason: TesterGateReason) => void) | null;
216
+ /**
217
+ * Called once, on the first 426 `client_outdated` answer. From then on
218
+ * this client sends nothing: every request rejects with
219
+ * [ClientOutdatedError] before it reaches the network.
220
+ */
221
+ onClientOutdated: ((info: ClientOutdatedInfo) => void) | null;
222
+ private outdated;
223
+ /** Set after a 426 `client_outdated`; null while the server serves us. */
224
+ get clientOutdated(): ClientOutdatedInfo | null;
225
+ /**
226
+ * Blocks this client as if it had received the 426 itself (an earlier
227
+ * client in the same app run did). Does not call [onClientOutdated].
228
+ */
229
+ markClientOutdated(info: ClientOutdatedInfo): void;
61
230
  constructor(config: ApiClientConfig);
62
231
  /**
63
232
  * Setup request/response interceptors for JWT authentication.
@@ -263,6 +432,28 @@ declare class TesterPayKitApiClient implements IApiClient {
263
432
  * GET /v1/testers/me/profile.
264
433
  */
265
434
  getMyProfile(): Promise<TesterProfile>;
435
+ /**
436
+ * POST /v1/testers/me/phone/link — a short-lived code for confirming this
437
+ * install in the TPK app (decision 2026-11-10, replaces the SMS dialog).
438
+ * Open `appUrl` (TPK app installed) or `url` (web page with an install
439
+ * hint); the person allows it there, then GET /v1/testers/me/profile
440
+ * reports the install as confirmed.
441
+ */
442
+ createAppLink(input: {
443
+ projectId?: string;
444
+ platform?: 'ios' | 'android' | 'web';
445
+ }): Promise<AppLinkResponse>;
446
+ getCompensation(): Promise<CompensationWallet>;
447
+ recordPaidWork(command: WorkCommand): Promise<PaidAssignment>;
448
+ registerCompensationPush(registration: PushRegistration): Promise<void>;
449
+ getPayoutAccount(): Promise<{
450
+ has_account: boolean;
451
+ transfers_active: boolean;
452
+ payments_configured: boolean;
453
+ }>;
454
+ createPayoutAccountLink(): Promise<{
455
+ url: string;
456
+ }>;
266
457
  /** GET /v1/testers/me/points — current point balance + breakdown. */
267
458
  getMyPoints(): Promise<TesterPoints>;
268
459
  /**
@@ -315,7 +506,7 @@ declare class TesterPayKitApiClient implements IApiClient {
315
506
  *
316
507
  * RAG over the project's knowledge-base markdown files. Embeds the
317
508
  * question, retrieves top-K nearest chunks via pgvector cosine
318
- * similarity, and asks gpt-4o-mini to synthesise an answer that
509
+ * similarity, and asks gpt-6-luna to synthesise an answer that
319
510
  * STRICTLY cites those chunks. Answer language tracks the
320
511
  * question (English / German).
321
512
  *
@@ -338,11 +529,6 @@ declare class TesterPayKitApiClient implements IApiClient {
338
529
  * Server keys on device_token — a second POST with the same token updates the row.
339
530
  */
340
531
  registerDevice(input: RegisterDeviceInput): Promise<TesterDeviceResponse>;
341
- /**
342
- * POST /v1/session-feedback
343
- * Submit end-of-session feedback (rating, comments, etc.).
344
- */
345
- submitSessionEndFeedback(payload: Record<string, unknown>): Promise<FeedbackResponse>;
346
532
  /**
347
533
  * Upload an attachment directly (not tied to a specific bug report).
348
534
  * POST /v1/attachments — alternate path from the contract alongside
@@ -372,7 +558,7 @@ declare class TesterPayKitApiClient implements IApiClient {
372
558
  * Contract: wire.bug_reports.voiceExtractBugFields
373
559
  *
374
560
  * Sends base64-encoded audio to the server. The server runs Whisper
375
- * (transcription) + gpt-4o-mini (structured extraction) and returns
561
+ * (transcription) + gpt-6-luna (structured extraction) and returns
376
562
  * pre-filled bug-report fields in the tester's language.
377
563
  *
378
564
  * Wire body uses snake_case per contract. Timeout is 60 s because
@@ -410,7 +596,7 @@ interface KnowledgeBaseAnswer {
410
596
  citations: KnowledgeBaseCitation[];
411
597
  /** Resolved project UUID — useful for telemetry / dedup. */
412
598
  projectId: string;
413
- /** Echo of the model used for the answer (e.g. "gpt-4o-mini"). */
599
+ /** Echo of the model used for the answer (e.g. "gpt-6-luna"). */
414
600
  model?: string;
415
601
  }
416
602
  interface KnowledgeBaseCitation {
@@ -667,13 +853,26 @@ interface EnrollmentResponse {
667
853
  interface TesterProfile {
668
854
  id: string;
669
855
  email?: string | null;
856
+ /** System handle, e.g. "sad-banana" (migration 074). */
670
857
  handle?: string | null;
858
+ /** True once this install confirmed a phone number. */
859
+ phoneVerified?: boolean;
860
+ /** True once an admin approved the person (migration 077). */
861
+ approved?: boolean;
671
862
  fullName?: string | null;
672
863
  rating?: number | null;
673
864
  pointsTotal?: number | null;
674
865
  status?: string;
675
866
  createdAt?: string;
676
867
  }
868
+ interface AppLinkResponse {
869
+ code: string;
870
+ /** Web page: opens the TPK app via universal link, else an install hint. */
871
+ url: string;
872
+ /** testerpaykit://link/<code>, opens the TPK app directly. */
873
+ appUrl: string;
874
+ expiresAt: string;
875
+ }
677
876
  interface TesterPoints {
678
877
  total: number;
679
878
  breakdown?: Record<string, number>;
@@ -730,12 +929,6 @@ interface TesterDeviceResponse {
730
929
  deviceToken: string;
731
930
  deviceType: string;
732
931
  }
733
- /** Response from POST /v1/session-feedback */
734
- interface FeedbackResponse {
735
- id: string;
736
- status: string;
737
- message?: string;
738
- }
739
932
  /** A single retest item from GET /v1/testers/me/retests */
740
933
  interface RetestItem {
741
934
  id: string;
@@ -784,5 +977,5 @@ interface TaskStep {
784
977
  estimatedMinutes?: number | null;
785
978
  }
786
979
 
787
- export { TesterPayKitApiClient };
788
- export type { AnonymousLoginResponse, ApiClientConfig, BugCategory, BugReportAttachmentInput, BugReportAttachmentResponse, BugReportPayload, BugReportResponse, BugReportType, BugSeverity, ChecklistRun, ChecklistRunInput, ChecklistStepResult, ChecklistTask, EarningsSummary, EndTesterSessionInput, EnrollmentResponse, FeedbackResponse, KnowledgeBaseAnswer, KnowledgeBaseCitation, KnowledgeFile, KnowledgeFileSummary, LiveNoteInput, MyBugReportSummary, MyBugReportsResponse, NotificationsResult, PayoutRecord, RegisterDeviceInput, RetestItem, RetestStepVerdicts, SdkUpdateInfo, SessionBreadcrumbInput, SessionBreadcrumbsResponse, SessionEventInput, SessionEventsResponse, StartTesterSessionInput, SubmissionResponse, TaskListFilter, TaskListResponse, TaskPreset, TaskStep, TesterDeviceResponse, TesterPoints, TesterProfile, TesterSessionEndReason, TesterSessionResponse, TesterTask, TpkNotification };
980
+ export { ClientOutdatedError, TPK_CLIENT_HEADER, TesterPayKitApiClient, parseClientOutdated };
981
+ export type { AnonymousLoginResponse, ApiClientConfig, AppLinkResponse, BugCategory, BugReportAttachmentInput, BugReportAttachmentResponse, BugReportPayload, BugReportResponse, BugReportType, BugSeverity, ChecklistRun, ChecklistRunInput, ChecklistStepResult, ChecklistTask, ClientOutdatedInfo, CompensationRates, CompensationWallet, EarningsSummary, EndTesterSessionInput, EnrollmentResponse, KnowledgeBaseAnswer, KnowledgeBaseCitation, KnowledgeFile, KnowledgeFileSummary, LiveNoteInput, MoneyEntry, MoneyKind, MoneyMode, MoneyTotals, MyBugReportSummary, MyBugReportsResponse, NotificationsResult, PaidAssignment, PayoutRecord, PushRegistration, RegisterDeviceInput, RetestItem, RetestStepVerdicts, SdkUpdateInfo, SessionBreadcrumbInput, SessionBreadcrumbsResponse, SessionEventInput, SessionEventsResponse, StartTesterSessionInput, SubmissionResponse, TaskListFilter, TaskListResponse, TaskPreset, TaskStep, TesterDeviceResponse, TesterGateReason, TesterPoints, TesterProfile, TesterSessionEndReason, TesterSessionResponse, TesterTask, TpkNotification, WorkCommand, WorkState };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,122 @@
1
1
  import { TokenManager, IApiClient, LoginRequest, LoginResponse, WeeklySummary, RemoteAiSession, VoiceBugExtractResponse, QuickActionKind } from '@testerpaykit/core';
2
2
 
3
+ /** `play` = play money in the pilot: real ledger rows, never a payout.
4
+ * Every UI labels such amounts "Spielgeld · Pilot" / "Play money · pilot". */
5
+ type MoneyMode = 'play' | 'test' | 'live';
6
+ type WorkState = 'offered' | 'active' | 'paused' | 'review' | 'disputed' | 'approved' | 'cancelled';
7
+ interface PaidAssignment {
8
+ id: string;
9
+ project_id: string;
10
+ tester_id: string;
11
+ title: string;
12
+ project_name: string;
13
+ mode: MoneyMode;
14
+ terms_version: 1;
15
+ rate_cents: number;
16
+ minimum_cents: number;
17
+ budget_cents: number;
18
+ seconds: number;
19
+ running_since: string | null;
20
+ state: WorkState;
21
+ revision: number;
22
+ amount_cents: number | null;
23
+ review_due: string | null;
24
+ review_note: string | null;
25
+ completion_note: string | null;
26
+ }
27
+ /** time = paid assignment · task = checklist task on its announced time ·
28
+ * bonus = idea bonus · bug_bonus · reproduction · retest (one per round). */
29
+ type MoneyKind = 'time' | 'task' | 'bonus' | 'bug_bonus' | 'reproduction' | 'retest' | 'start_bonus';
30
+ interface MoneyEntry {
31
+ id: string;
32
+ project_id: string;
33
+ project_name: string;
34
+ tester_id: string;
35
+ mode: MoneyMode;
36
+ kind: MoneyKind;
37
+ reason: string;
38
+ amount_cents: number;
39
+ currency: 'eur';
40
+ /** review = waits for the 3-working-day window, then released. */
41
+ status: 'review' | 'approved' | 'processing' | 'transferred' | 'held';
42
+ units: number;
43
+ review_due: string | null;
44
+ review_note: string | null;
45
+ bug_id: string | null;
46
+ task_preset_id: string | null;
47
+ created_at: string;
48
+ transfer_id: string | null;
49
+ }
50
+ /** Sums in the current mode, in cents. Bonuses never count towards the 5 € floor. */
51
+ interface MoneyTotals {
52
+ in_review_cents: number;
53
+ released_cents: number;
54
+ bonus_cents: number;
55
+ held_cents: number;
56
+ total_cents: number;
57
+ }
58
+ interface CompensationRates {
59
+ rate_cents_per_minute: number;
60
+ minimum_cents: number;
61
+ bug_bonus_cents: {
62
+ easy: number;
63
+ medium: number;
64
+ hard: number;
65
+ };
66
+ reproduction_cents: number;
67
+ retest_per_fix_cents: number;
68
+ retest_round_minimum_cents: number;
69
+ idea_bonus_choices_cents: number[];
70
+ review_working_days: number;
71
+ /** Start bonus, booked once per person on the first phone confirmation. */
72
+ start_bonus_cents?: number;
73
+ }
74
+ interface CompensationWallet {
75
+ /** Current mode; `play` = label every amount as play money. */
76
+ mode: MoneyMode;
77
+ currency: 'eur';
78
+ server_time: string;
79
+ rates: CompensationRates;
80
+ /** The person = every app install with the same confirmed phone. */
81
+ person: {
82
+ handle: string | null;
83
+ phone_confirmed: boolean;
84
+ tester_count: number;
85
+ apps: Array<{
86
+ project_id: string;
87
+ project_name: string;
88
+ }>;
89
+ };
90
+ /** Whole person across apps … */
91
+ totals: MoneyTotals;
92
+ /** … and the share of this app install. */
93
+ this_app: MoneyTotals;
94
+ assignments: PaidAssignment[];
95
+ entries: MoneyEntry[];
96
+ balances: Record<MoneyMode, Record<MoneyEntry['status'], number>>;
97
+ legacy: Array<{
98
+ id: string;
99
+ source: string;
100
+ amount_cents: number;
101
+ status: string;
102
+ }>;
103
+ }
104
+ interface WorkCommand {
105
+ assignment_id: string;
106
+ request_id: string;
107
+ revision: number;
108
+ action: 'start' | 'pause' | 'submit' | 'submit_partial' | 'decline';
109
+ accept_terms_version?: 1;
110
+ seconds?: number;
111
+ note?: string;
112
+ }
113
+ interface PushRegistration {
114
+ installation_id: string;
115
+ app_id: string;
116
+ token?: string;
117
+ enabled: boolean;
118
+ }
119
+
3
120
  /** Body of a "Send to Claude" note (see `sendLiveNote`). */
4
121
  interface LiveNoteInput {
5
122
  projectId: string;
@@ -45,7 +162,37 @@ interface ApiClientConfig {
45
162
  baseURL?: string;
46
163
  apiKey: string;
47
164
  tokenManager?: TokenManager;
165
+ /**
166
+ * Sent as `X-TPK-Client` on every request, e.g. `expo/2.2.0` (decision
167
+ * 2026-11-14 "Mindestversion je Client-Art"). Default none: the server
168
+ * then serves the request without a version check.
169
+ */
170
+ clientHeader?: string;
171
+ }
172
+ /** Request header a client identifies itself with (`<kind>/<version>`). */
173
+ declare const TPK_CLIENT_HEADER = "X-TPK-Client";
174
+ /** Body of a 426 `client_outdated` answer: this client is below the
175
+ * minimum version the server still serves. Fields are null when the
176
+ * request carried no `X-TPK-Client`. */
177
+ interface ClientOutdatedInfo {
178
+ kind: string | null;
179
+ min: string | null;
180
+ yours: string | null;
181
+ message: string | null;
182
+ }
183
+ /**
184
+ * Thrown instead of sending, for every request after a 426
185
+ * `client_outdated` (see `TesterPayKitApiClient.clientOutdated`). It has
186
+ * no `response`, so callers that retry on network errors keep their
187
+ * queued work for a newer build instead of dropping it.
188
+ */
189
+ declare class ClientOutdatedError extends Error {
190
+ readonly info: ClientOutdatedInfo;
191
+ readonly code = "TPK_CLIENT_OUTDATED";
192
+ constructor(info: ClientOutdatedInfo);
48
193
  }
194
+ /** The `client_outdated` body of a 426 answer, else null. */
195
+ declare function parseClientOutdated(status: number | undefined, body: unknown): ClientOutdatedInfo | null;
49
196
  /**
50
197
  * TesterPayKit API Client implementation using Axios.
51
198
  *
@@ -54,10 +201,32 @@ interface ApiClientConfig {
54
201
  * - Request/response interceptors for auth headers
55
202
  * - Integration with TokenManager for token lifecycle
56
203
  */
204
+ /** The tester gate's 403 codes (migrations 075 + 077). */
205
+ type TesterGateReason = 'phone_required' | 'approval_required';
57
206
  declare class TesterPayKitApiClient implements IApiClient {
58
207
  private client;
59
208
  private tokenManager;
60
209
  private apiKey;
210
+ /**
211
+ * Called on any 403 `phone_required` / `approval_required` answer: the
212
+ * tester is not (or no longer) cleared to report. SDKs hide their
213
+ * tester UI on it. The request still rejects as before.
214
+ */
215
+ onTesterGate: ((reason: TesterGateReason) => void) | null;
216
+ /**
217
+ * Called once, on the first 426 `client_outdated` answer. From then on
218
+ * this client sends nothing: every request rejects with
219
+ * [ClientOutdatedError] before it reaches the network.
220
+ */
221
+ onClientOutdated: ((info: ClientOutdatedInfo) => void) | null;
222
+ private outdated;
223
+ /** Set after a 426 `client_outdated`; null while the server serves us. */
224
+ get clientOutdated(): ClientOutdatedInfo | null;
225
+ /**
226
+ * Blocks this client as if it had received the 426 itself (an earlier
227
+ * client in the same app run did). Does not call [onClientOutdated].
228
+ */
229
+ markClientOutdated(info: ClientOutdatedInfo): void;
61
230
  constructor(config: ApiClientConfig);
62
231
  /**
63
232
  * Setup request/response interceptors for JWT authentication.
@@ -263,6 +432,28 @@ declare class TesterPayKitApiClient implements IApiClient {
263
432
  * GET /v1/testers/me/profile.
264
433
  */
265
434
  getMyProfile(): Promise<TesterProfile>;
435
+ /**
436
+ * POST /v1/testers/me/phone/link — a short-lived code for confirming this
437
+ * install in the TPK app (decision 2026-11-10, replaces the SMS dialog).
438
+ * Open `appUrl` (TPK app installed) or `url` (web page with an install
439
+ * hint); the person allows it there, then GET /v1/testers/me/profile
440
+ * reports the install as confirmed.
441
+ */
442
+ createAppLink(input: {
443
+ projectId?: string;
444
+ platform?: 'ios' | 'android' | 'web';
445
+ }): Promise<AppLinkResponse>;
446
+ getCompensation(): Promise<CompensationWallet>;
447
+ recordPaidWork(command: WorkCommand): Promise<PaidAssignment>;
448
+ registerCompensationPush(registration: PushRegistration): Promise<void>;
449
+ getPayoutAccount(): Promise<{
450
+ has_account: boolean;
451
+ transfers_active: boolean;
452
+ payments_configured: boolean;
453
+ }>;
454
+ createPayoutAccountLink(): Promise<{
455
+ url: string;
456
+ }>;
266
457
  /** GET /v1/testers/me/points — current point balance + breakdown. */
267
458
  getMyPoints(): Promise<TesterPoints>;
268
459
  /**
@@ -315,7 +506,7 @@ declare class TesterPayKitApiClient implements IApiClient {
315
506
  *
316
507
  * RAG over the project's knowledge-base markdown files. Embeds the
317
508
  * question, retrieves top-K nearest chunks via pgvector cosine
318
- * similarity, and asks gpt-4o-mini to synthesise an answer that
509
+ * similarity, and asks gpt-6-luna to synthesise an answer that
319
510
  * STRICTLY cites those chunks. Answer language tracks the
320
511
  * question (English / German).
321
512
  *
@@ -338,11 +529,6 @@ declare class TesterPayKitApiClient implements IApiClient {
338
529
  * Server keys on device_token — a second POST with the same token updates the row.
339
530
  */
340
531
  registerDevice(input: RegisterDeviceInput): Promise<TesterDeviceResponse>;
341
- /**
342
- * POST /v1/session-feedback
343
- * Submit end-of-session feedback (rating, comments, etc.).
344
- */
345
- submitSessionEndFeedback(payload: Record<string, unknown>): Promise<FeedbackResponse>;
346
532
  /**
347
533
  * Upload an attachment directly (not tied to a specific bug report).
348
534
  * POST /v1/attachments — alternate path from the contract alongside
@@ -372,7 +558,7 @@ declare class TesterPayKitApiClient implements IApiClient {
372
558
  * Contract: wire.bug_reports.voiceExtractBugFields
373
559
  *
374
560
  * Sends base64-encoded audio to the server. The server runs Whisper
375
- * (transcription) + gpt-4o-mini (structured extraction) and returns
561
+ * (transcription) + gpt-6-luna (structured extraction) and returns
376
562
  * pre-filled bug-report fields in the tester's language.
377
563
  *
378
564
  * Wire body uses snake_case per contract. Timeout is 60 s because
@@ -410,7 +596,7 @@ interface KnowledgeBaseAnswer {
410
596
  citations: KnowledgeBaseCitation[];
411
597
  /** Resolved project UUID — useful for telemetry / dedup. */
412
598
  projectId: string;
413
- /** Echo of the model used for the answer (e.g. "gpt-4o-mini"). */
599
+ /** Echo of the model used for the answer (e.g. "gpt-6-luna"). */
414
600
  model?: string;
415
601
  }
416
602
  interface KnowledgeBaseCitation {
@@ -667,13 +853,26 @@ interface EnrollmentResponse {
667
853
  interface TesterProfile {
668
854
  id: string;
669
855
  email?: string | null;
856
+ /** System handle, e.g. "sad-banana" (migration 074). */
670
857
  handle?: string | null;
858
+ /** True once this install confirmed a phone number. */
859
+ phoneVerified?: boolean;
860
+ /** True once an admin approved the person (migration 077). */
861
+ approved?: boolean;
671
862
  fullName?: string | null;
672
863
  rating?: number | null;
673
864
  pointsTotal?: number | null;
674
865
  status?: string;
675
866
  createdAt?: string;
676
867
  }
868
+ interface AppLinkResponse {
869
+ code: string;
870
+ /** Web page: opens the TPK app via universal link, else an install hint. */
871
+ url: string;
872
+ /** testerpaykit://link/<code>, opens the TPK app directly. */
873
+ appUrl: string;
874
+ expiresAt: string;
875
+ }
677
876
  interface TesterPoints {
678
877
  total: number;
679
878
  breakdown?: Record<string, number>;
@@ -730,12 +929,6 @@ interface TesterDeviceResponse {
730
929
  deviceToken: string;
731
930
  deviceType: string;
732
931
  }
733
- /** Response from POST /v1/session-feedback */
734
- interface FeedbackResponse {
735
- id: string;
736
- status: string;
737
- message?: string;
738
- }
739
932
  /** A single retest item from GET /v1/testers/me/retests */
740
933
  interface RetestItem {
741
934
  id: string;
@@ -784,5 +977,5 @@ interface TaskStep {
784
977
  estimatedMinutes?: number | null;
785
978
  }
786
979
 
787
- export { TesterPayKitApiClient };
788
- export type { AnonymousLoginResponse, ApiClientConfig, BugCategory, BugReportAttachmentInput, BugReportAttachmentResponse, BugReportPayload, BugReportResponse, BugReportType, BugSeverity, ChecklistRun, ChecklistRunInput, ChecklistStepResult, ChecklistTask, EarningsSummary, EndTesterSessionInput, EnrollmentResponse, FeedbackResponse, KnowledgeBaseAnswer, KnowledgeBaseCitation, KnowledgeFile, KnowledgeFileSummary, LiveNoteInput, MyBugReportSummary, MyBugReportsResponse, NotificationsResult, PayoutRecord, RegisterDeviceInput, RetestItem, RetestStepVerdicts, SdkUpdateInfo, SessionBreadcrumbInput, SessionBreadcrumbsResponse, SessionEventInput, SessionEventsResponse, StartTesterSessionInput, SubmissionResponse, TaskListFilter, TaskListResponse, TaskPreset, TaskStep, TesterDeviceResponse, TesterPoints, TesterProfile, TesterSessionEndReason, TesterSessionResponse, TesterTask, TpkNotification };
980
+ export { ClientOutdatedError, TPK_CLIENT_HEADER, TesterPayKitApiClient, parseClientOutdated };
981
+ export type { AnonymousLoginResponse, ApiClientConfig, AppLinkResponse, BugCategory, BugReportAttachmentInput, BugReportAttachmentResponse, BugReportPayload, BugReportResponse, BugReportType, BugSeverity, ChecklistRun, ChecklistRunInput, ChecklistStepResult, ChecklistTask, ClientOutdatedInfo, CompensationRates, CompensationWallet, EarningsSummary, EndTesterSessionInput, EnrollmentResponse, KnowledgeBaseAnswer, KnowledgeBaseCitation, KnowledgeFile, KnowledgeFileSummary, LiveNoteInput, MoneyEntry, MoneyKind, MoneyMode, MoneyTotals, MyBugReportSummary, MyBugReportsResponse, NotificationsResult, PaidAssignment, PayoutRecord, PushRegistration, RegisterDeviceInput, RetestItem, RetestStepVerdicts, SdkUpdateInfo, SessionBreadcrumbInput, SessionBreadcrumbsResponse, SessionEventInput, SessionEventsResponse, StartTesterSessionInput, SubmissionResponse, TaskListFilter, TaskListResponse, TaskPreset, TaskStep, TesterDeviceResponse, TesterGateReason, TesterPoints, TesterProfile, TesterSessionEndReason, TesterSessionResponse, TesterTask, TpkNotification, WorkCommand, WorkState };