@testerpaykit/sdk 1.1.0 → 1.2.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/dist/index.d.mts CHANGED
@@ -170,6 +170,35 @@ interface TesterPayKitConfig {
170
170
  * Contract: configuration.weeklySubmissionDay
171
171
  */
172
172
  weeklySubmissionDay?: number;
173
+ /**
174
+ * Extra state the live link to Claude Code reports as `app_state`
175
+ * (MCP `device_snapshot`). Must return JSON-serialisable data. Can also be
176
+ * set later via `sdk.liveStateProvider`.
177
+ */
178
+ liveStateProvider?: () => unknown;
179
+ }
180
+ /** One step verdict of a checklist pass (`step` is 1-based). */
181
+ interface ChecklistStepResult {
182
+ step: number;
183
+ passed: boolean;
184
+ note?: string;
185
+ }
186
+ /** The latest pass through a checklist task (by this tester or the AI). */
187
+ interface ChecklistRun {
188
+ status: 'passed' | 'failed' | 'incomplete' | string;
189
+ steps: ChecklistStepResult[];
190
+ summary?: string;
191
+ at: string;
192
+ tester?: string;
193
+ }
194
+ /** One task of a project's checklist: what should be tested. */
195
+ interface ChecklistTask {
196
+ id: string;
197
+ title: string;
198
+ description?: string;
199
+ steps: string[];
200
+ mine?: ChecklistRun;
201
+ ai?: ChecklistRun;
173
202
  }
174
203
  /**
175
204
  * Main TesterPayKit SDK class.
@@ -216,6 +245,11 @@ declare class TesterPayKit {
216
245
  readonly environment: 'local' | 'prod';
217
246
  private static readonly LOG_BUFFER_MAX;
218
247
  private _logBuffer;
248
+ /**
249
+ * Host hook for the live link's `app_state` (see
250
+ * `TesterPayKitConfig.liveStateProvider`). Settable at any time.
251
+ */
252
+ liveStateProvider: (() => unknown) | null;
219
253
  constructor(config: TesterPayKitConfig);
220
254
  get onTokenReady(): Promise<void>;
221
255
  get isAuthenticated(): boolean;
@@ -614,6 +648,37 @@ declare class TesterPayKit {
614
648
  * Used by TpkWorkboardScreen to show the current build info block.
615
649
  */
616
650
  getAppInfo(): AppMetadata;
651
+ private _liveApi;
652
+ /**
653
+ * One-time WebSocket URL for the live link to the developer's Claude Code
654
+ * session (POST /v1/testers/me/live). Fetch a fresh one for every connect.
655
+ * Throws when the call fails.
656
+ */
657
+ openLiveLink(): Promise<string>;
658
+ /**
659
+ * "Send to Claude": one line plus what the screen showed
660
+ * (POST /v1/testers/me/live/notes). Throws when the call fails.
661
+ */
662
+ sendLiveNote(input: {
663
+ text: string;
664
+ snapshot: Record<string, unknown>;
665
+ screenshotBase64?: string | null;
666
+ }): Promise<string>;
667
+ /**
668
+ * The project's checklist ("What to test") with this tester's last pass.
669
+ * Soft-fails to [] (offline, not logged in, older api-client).
670
+ */
671
+ getChecklist(): Promise<ChecklistTask[]>;
672
+ /**
673
+ * One pass through a checklist task, a verdict per step
674
+ * (POST /v1/testers/me/checklist/:id/runs). Resolves with the run status;
675
+ * throws when the call fails.
676
+ */
677
+ submitChecklistRun(input: {
678
+ taskId: string;
679
+ stepResults: ChecklistStepResult[];
680
+ summary?: string;
681
+ }): Promise<string>;
617
682
  /**
618
683
  * Fetch the tester's assigned tasks.
619
684
  * Delegates to apiClient.getMyTasks. Soft-fails to an empty TaskListResponse
@@ -905,4 +970,4 @@ declare class DeviceIdManager {
905
970
  }
906
971
 
907
972
  export { DeviceIdManager, EventTracker, MetricsAggregator, Outbox, SessionManager, TesterPayKit, ValidationConstants };
908
- export type { CaptureFlags, MetricsAggregatorConfig, SessionEndReason, TesterPayKitConfig };
973
+ export type { CaptureFlags, ChecklistRun, ChecklistStepResult, ChecklistTask, MetricsAggregatorConfig, SessionEndReason, TesterPayKitConfig };
package/dist/index.d.ts CHANGED
@@ -170,6 +170,35 @@ interface TesterPayKitConfig {
170
170
  * Contract: configuration.weeklySubmissionDay
171
171
  */
172
172
  weeklySubmissionDay?: number;
173
+ /**
174
+ * Extra state the live link to Claude Code reports as `app_state`
175
+ * (MCP `device_snapshot`). Must return JSON-serialisable data. Can also be
176
+ * set later via `sdk.liveStateProvider`.
177
+ */
178
+ liveStateProvider?: () => unknown;
179
+ }
180
+ /** One step verdict of a checklist pass (`step` is 1-based). */
181
+ interface ChecklistStepResult {
182
+ step: number;
183
+ passed: boolean;
184
+ note?: string;
185
+ }
186
+ /** The latest pass through a checklist task (by this tester or the AI). */
187
+ interface ChecklistRun {
188
+ status: 'passed' | 'failed' | 'incomplete' | string;
189
+ steps: ChecklistStepResult[];
190
+ summary?: string;
191
+ at: string;
192
+ tester?: string;
193
+ }
194
+ /** One task of a project's checklist: what should be tested. */
195
+ interface ChecklistTask {
196
+ id: string;
197
+ title: string;
198
+ description?: string;
199
+ steps: string[];
200
+ mine?: ChecklistRun;
201
+ ai?: ChecklistRun;
173
202
  }
174
203
  /**
175
204
  * Main TesterPayKit SDK class.
@@ -216,6 +245,11 @@ declare class TesterPayKit {
216
245
  readonly environment: 'local' | 'prod';
217
246
  private static readonly LOG_BUFFER_MAX;
218
247
  private _logBuffer;
248
+ /**
249
+ * Host hook for the live link's `app_state` (see
250
+ * `TesterPayKitConfig.liveStateProvider`). Settable at any time.
251
+ */
252
+ liveStateProvider: (() => unknown) | null;
219
253
  constructor(config: TesterPayKitConfig);
220
254
  get onTokenReady(): Promise<void>;
221
255
  get isAuthenticated(): boolean;
@@ -614,6 +648,37 @@ declare class TesterPayKit {
614
648
  * Used by TpkWorkboardScreen to show the current build info block.
615
649
  */
616
650
  getAppInfo(): AppMetadata;
651
+ private _liveApi;
652
+ /**
653
+ * One-time WebSocket URL for the live link to the developer's Claude Code
654
+ * session (POST /v1/testers/me/live). Fetch a fresh one for every connect.
655
+ * Throws when the call fails.
656
+ */
657
+ openLiveLink(): Promise<string>;
658
+ /**
659
+ * "Send to Claude": one line plus what the screen showed
660
+ * (POST /v1/testers/me/live/notes). Throws when the call fails.
661
+ */
662
+ sendLiveNote(input: {
663
+ text: string;
664
+ snapshot: Record<string, unknown>;
665
+ screenshotBase64?: string | null;
666
+ }): Promise<string>;
667
+ /**
668
+ * The project's checklist ("What to test") with this tester's last pass.
669
+ * Soft-fails to [] (offline, not logged in, older api-client).
670
+ */
671
+ getChecklist(): Promise<ChecklistTask[]>;
672
+ /**
673
+ * One pass through a checklist task, a verdict per step
674
+ * (POST /v1/testers/me/checklist/:id/runs). Resolves with the run status;
675
+ * throws when the call fails.
676
+ */
677
+ submitChecklistRun(input: {
678
+ taskId: string;
679
+ stepResults: ChecklistStepResult[];
680
+ summary?: string;
681
+ }): Promise<string>;
617
682
  /**
618
683
  * Fetch the tester's assigned tasks.
619
684
  * Delegates to apiClient.getMyTasks. Soft-fails to an empty TaskListResponse
@@ -905,4 +970,4 @@ declare class DeviceIdManager {
905
970
  }
906
971
 
907
972
  export { DeviceIdManager, EventTracker, MetricsAggregator, Outbox, SessionManager, TesterPayKit, ValidationConstants };
908
- export type { CaptureFlags, MetricsAggregatorConfig, SessionEndReason, TesterPayKitConfig };
973
+ export type { CaptureFlags, ChecklistRun, ChecklistStepResult, ChecklistTask, MetricsAggregatorConfig, SessionEndReason, TesterPayKitConfig };
package/dist/index.js CHANGED
@@ -930,6 +930,11 @@ var _TesterPayKit = class _TesterPayKit {
930
930
  this._serverSessionId = null;
931
931
  this._pendingSessionEvents = [];
932
932
  this._logBuffer = [];
933
+ /**
934
+ * Host hook for the live link's `app_state` (see
935
+ * `TesterPayKitConfig.liveStateProvider`). Settable at any time.
936
+ */
937
+ this.liveStateProvider = null;
933
938
  this._serverSessionInFlight = null;
934
939
  this.config = {
935
940
  autoStartSession: true,
@@ -962,6 +967,7 @@ var _TesterPayKit = class _TesterPayKit {
962
967
  this.anonymousAuthReady = new Promise((resolve) => {
963
968
  this._resolveAnonymousAuth = resolve;
964
969
  });
970
+ this.liveStateProvider = config.liveStateProvider ?? null;
965
971
  }
966
972
  // ── Alias (contract: lifecycle.readiness.onTokenReady) ─────────────────────
967
973
  get onTokenReady() {
@@ -1933,6 +1939,54 @@ var _TesterPayKit = class _TesterPayKit {
1933
1939
  getAppInfo() {
1934
1940
  return this.config.appMetadata;
1935
1941
  }
1942
+ // ── Live link to Claude Code + checklist ──────────────────────────────────
1943
+ _liveApi(name) {
1944
+ const api = this.config.apiClient;
1945
+ if (!api || typeof api[name] !== "function") {
1946
+ throw new Error(`apiClient does not implement ${name} (needs @testerpaykit/api-client >= 1.7.0)`);
1947
+ }
1948
+ return api;
1949
+ }
1950
+ /**
1951
+ * One-time WebSocket URL for the live link to the developer's Claude Code
1952
+ * session (POST /v1/testers/me/live). Fetch a fresh one for every connect.
1953
+ * Throws when the call fails.
1954
+ */
1955
+ async openLiveLink() {
1956
+ const api = this._liveApi("openLiveLink");
1957
+ return api.openLiveLink(this.config.projectId);
1958
+ }
1959
+ /**
1960
+ * "Send to Claude": one line plus what the screen showed
1961
+ * (POST /v1/testers/me/live/notes). Throws when the call fails.
1962
+ */
1963
+ async sendLiveNote(input) {
1964
+ const api = this._liveApi("sendLiveNote");
1965
+ return api.sendLiveNote({ projectId: this.config.projectId, ...input });
1966
+ }
1967
+ /**
1968
+ * The project's checklist ("What to test") with this tester's last pass.
1969
+ * Soft-fails to [] (offline, not logged in, older api-client).
1970
+ */
1971
+ async getChecklist() {
1972
+ try {
1973
+ const api = this._liveApi("getChecklist");
1974
+ const tasks = await api.getChecklist(this.config.projectId);
1975
+ return Array.isArray(tasks) ? tasks.filter((t) => t && typeof t.id === "string" && Array.isArray(t.steps)) : [];
1976
+ } catch (e) {
1977
+ this.log(`getChecklist: failed \u2014 ${String(e)}`);
1978
+ return [];
1979
+ }
1980
+ }
1981
+ /**
1982
+ * One pass through a checklist task, a verdict per step
1983
+ * (POST /v1/testers/me/checklist/:id/runs). Resolves with the run status;
1984
+ * throws when the call fails.
1985
+ */
1986
+ async submitChecklistRun(input) {
1987
+ const api = this._liveApi("submitChecklistRun");
1988
+ return api.submitChecklistRun({ projectId: this.config.projectId, ...input });
1989
+ }
1936
1990
  /**
1937
1991
  * Fetch the tester's assigned tasks.
1938
1992
  * Delegates to apiClient.getMyTasks. Soft-fails to an empty TaskListResponse
package/dist/index.mjs CHANGED
@@ -897,6 +897,11 @@ var _TesterPayKit = class _TesterPayKit {
897
897
  this._serverSessionId = null;
898
898
  this._pendingSessionEvents = [];
899
899
  this._logBuffer = [];
900
+ /**
901
+ * Host hook for the live link's `app_state` (see
902
+ * `TesterPayKitConfig.liveStateProvider`). Settable at any time.
903
+ */
904
+ this.liveStateProvider = null;
900
905
  this._serverSessionInFlight = null;
901
906
  this.config = {
902
907
  autoStartSession: true,
@@ -929,6 +934,7 @@ var _TesterPayKit = class _TesterPayKit {
929
934
  this.anonymousAuthReady = new Promise((resolve) => {
930
935
  this._resolveAnonymousAuth = resolve;
931
936
  });
937
+ this.liveStateProvider = config.liveStateProvider ?? null;
932
938
  }
933
939
  // ── Alias (contract: lifecycle.readiness.onTokenReady) ─────────────────────
934
940
  get onTokenReady() {
@@ -1900,6 +1906,54 @@ var _TesterPayKit = class _TesterPayKit {
1900
1906
  getAppInfo() {
1901
1907
  return this.config.appMetadata;
1902
1908
  }
1909
+ // ── Live link to Claude Code + checklist ──────────────────────────────────
1910
+ _liveApi(name) {
1911
+ const api = this.config.apiClient;
1912
+ if (!api || typeof api[name] !== "function") {
1913
+ throw new Error(`apiClient does not implement ${name} (needs @testerpaykit/api-client >= 1.7.0)`);
1914
+ }
1915
+ return api;
1916
+ }
1917
+ /**
1918
+ * One-time WebSocket URL for the live link to the developer's Claude Code
1919
+ * session (POST /v1/testers/me/live). Fetch a fresh one for every connect.
1920
+ * Throws when the call fails.
1921
+ */
1922
+ async openLiveLink() {
1923
+ const api = this._liveApi("openLiveLink");
1924
+ return api.openLiveLink(this.config.projectId);
1925
+ }
1926
+ /**
1927
+ * "Send to Claude": one line plus what the screen showed
1928
+ * (POST /v1/testers/me/live/notes). Throws when the call fails.
1929
+ */
1930
+ async sendLiveNote(input) {
1931
+ const api = this._liveApi("sendLiveNote");
1932
+ return api.sendLiveNote({ projectId: this.config.projectId, ...input });
1933
+ }
1934
+ /**
1935
+ * The project's checklist ("What to test") with this tester's last pass.
1936
+ * Soft-fails to [] (offline, not logged in, older api-client).
1937
+ */
1938
+ async getChecklist() {
1939
+ try {
1940
+ const api = this._liveApi("getChecklist");
1941
+ const tasks = await api.getChecklist(this.config.projectId);
1942
+ return Array.isArray(tasks) ? tasks.filter((t) => t && typeof t.id === "string" && Array.isArray(t.steps)) : [];
1943
+ } catch (e) {
1944
+ this.log(`getChecklist: failed \u2014 ${String(e)}`);
1945
+ return [];
1946
+ }
1947
+ }
1948
+ /**
1949
+ * One pass through a checklist task, a verdict per step
1950
+ * (POST /v1/testers/me/checklist/:id/runs). Resolves with the run status;
1951
+ * throws when the call fails.
1952
+ */
1953
+ async submitChecklistRun(input) {
1954
+ const api = this._liveApi("submitChecklistRun");
1955
+ return api.submitChecklistRun({ projectId: this.config.projectId, ...input });
1956
+ }
1903
1957
  /**
1904
1958
  * Fetch the tester's assigned tasks.
1905
1959
  * Delegates to apiClient.getMyTasks. Soft-fails to an empty TaskListResponse
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testerpaykit/sdk",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "TesterPayKit SDK - Core business logic",
5
5
  "files": [
6
6
  "dist",