@empiricalrun/playwright-utils 0.71.0 → 0.71.1

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
@@ -1,5 +1,12 @@
1
1
  # @empiricalrun/playwright-utils
2
2
 
3
+ ## 0.71.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 5318fe2: Cross-shard test locks keep renewing the leases a test already holds while it waits for its next lock
8
+ - 6dd4caf: Cross-shard test locks recognise their own write after a retried request, instead of reporting a lost lease or waiting on themselves
9
+
3
10
  ## 0.71.0
4
11
 
5
12
  ### Minor Changes
@@ -1798,6 +1798,30 @@ export interface paths {
1798
1798
  patch?: never;
1799
1799
  trace?: never;
1800
1800
  };
1801
+ "/api/chat-sessions": {
1802
+ parameters: {
1803
+ query?: never;
1804
+ header?: never;
1805
+ path?: never;
1806
+ cookie?: never;
1807
+ };
1808
+ /**
1809
+ * 🤖 List chat sessions
1810
+ * @description Returns a page of chat sessions in scope, each enriched with the creator's Supabase user details. Pass `entity_type` and `entity_id` for the sessions linked to a test run, task or rule (links are added with `POST /api/chat-sessions/{id}/entity-links`); add `show_closed=true` to include finished sessions.
1811
+ */
1812
+ get: operations["listChatSessions"];
1813
+ put?: never;
1814
+ /**
1815
+ * ⚙️ Create a chat session
1816
+ * @description Creates a chat session in the scoped project for a Hive agent (`agent`, default `main`) and delivers its first message (awaited, so the 201 means the message landed). An agent or version Hive does not serve is rejected with a 400, and an organization that billing blocks with a 402, before anything is created.
1817
+ */
1818
+ post: operations["createChatSession"];
1819
+ delete?: never;
1820
+ options?: never;
1821
+ head?: never;
1822
+ patch?: never;
1823
+ trace?: never;
1824
+ };
1801
1825
  "/api/chat-sessions/{id}/alarms": {
1802
1826
  parameters: {
1803
1827
  query?: never;
@@ -1840,6 +1864,30 @@ export interface paths {
1840
1864
  patch: operations["updateChatSessionAlarm"];
1841
1865
  trace?: never;
1842
1866
  };
1867
+ "/api/chat-sessions/{id}/entity-links": {
1868
+ parameters: {
1869
+ query?: never;
1870
+ header?: never;
1871
+ path?: never;
1872
+ cookie?: never;
1873
+ };
1874
+ /**
1875
+ * 🤖 List a chat session's links
1876
+ * @description The test runs, tasks and rules a session is linked to, oldest first.
1877
+ */
1878
+ get: operations["listChatSessionEntityLinks"];
1879
+ put?: never;
1880
+ /**
1881
+ * 🤖 Link a chat session to a test run, task or rule
1882
+ * @description Links an existing session to a test run, task or rule in its project, so the session page shows it and `GET /api/chat-sessions?entity_type=&entity_id=` finds the session. Use it when a running session takes on a run it was not created for. To link a new session, use `empirical session --link test_run:<id>`. Idempotent: linking again returns the existing link, with any new `test_case_ids` added. A link without `test_case_ids` covers the whole run and stays that way.
1883
+ */
1884
+ post: operations["createChatSessionEntityLink"];
1885
+ delete?: never;
1886
+ options?: never;
1887
+ head?: never;
1888
+ patch?: never;
1889
+ trace?: never;
1890
+ };
1843
1891
  "/api/chat-sessions/{id}/session-state": {
1844
1892
  parameters: {
1845
1893
  query?: never;
@@ -2764,30 +2812,6 @@ export interface paths {
2764
2812
  patch?: never;
2765
2813
  trace?: never;
2766
2814
  };
2767
- "/api/chat-sessions": {
2768
- parameters: {
2769
- query?: never;
2770
- header?: never;
2771
- path?: never;
2772
- cookie?: never;
2773
- };
2774
- /**
2775
- * ⚙️ List chat sessions
2776
- * @description Returns a page of chat sessions in scope, each enriched with the creator's Supabase user details. Pass `entity_type` and `entity_id` for the sessions linked to a test run, task or rule.
2777
- */
2778
- get: operations["listChatSessions"];
2779
- put?: never;
2780
- /**
2781
- * ⚙️ Create a chat session
2782
- * @description Creates a chat session in the scoped project for a Hive agent (`agent`, default `main`) and delivers its first message (awaited, so the 201 means the message landed). An agent or version Hive does not serve is rejected with a 400, and an organization that billing blocks with a 402, before anything is created.
2783
- */
2784
- post: operations["createChatSession"];
2785
- delete?: never;
2786
- options?: never;
2787
- head?: never;
2788
- patch?: never;
2789
- trace?: never;
2790
- };
2791
2815
  "/api/chat-sessions/{id}": {
2792
2816
  parameters: {
2793
2817
  query?: never;
@@ -7546,6 +7570,8 @@ export interface components {
7546
7570
  fail_rate: number;
7547
7571
  /** @description Flaky rate as a percentage (0-100). */
7548
7572
  flaky_rate: number;
7573
+ /** @description Mean duration in ms across all attempts of a result, skipped results excluded. 0 when the test has not run. */
7574
+ avg_duration_ms: number;
7549
7575
  };
7550
7576
  /** @description History of test executions for this test case. */
7551
7577
  history: components["schemas"]["TestCaseHistoryEntry"][];
@@ -7579,6 +7605,8 @@ export interface components {
7579
7605
  fail_rate: number;
7580
7606
  /** @description Flaky rate as a percentage (0-100). */
7581
7607
  flaky_rate: number;
7608
+ /** @description Mean duration in ms across all attempts of a result, skipped results excluded. 0 when the test has not run. */
7609
+ avg_duration_ms: number;
7582
7610
  };
7583
7611
  };
7584
7612
  AnalyticsTestCasesResponse: {
@@ -8184,6 +8212,26 @@ export interface components {
8184
8212
  /** @description ISO 8601 creation time. */
8185
8213
  created_at: string;
8186
8214
  };
8215
+ ChatSessionEntityLinkListResponse: {
8216
+ /** @description Response payload. */
8217
+ data: components["schemas"]["ChatSessionEntityLink"][];
8218
+ };
8219
+ ChatSessionEntityLinkResponse: {
8220
+ /** @description Response payload. */
8221
+ data: {
8222
+ /**
8223
+ * @description Linked entity type.
8224
+ * @enum {string}
8225
+ */
8226
+ entity_type: "test_run" | "task" | "rule";
8227
+ /** @description Linked entity ID. */
8228
+ entity_id: number;
8229
+ /** @description Test case IDs in the run this session is scoped to. Empty for the whole run, and for tasks and rules. */
8230
+ test_case_ids: string[];
8231
+ /** @description ISO 8601 creation time. */
8232
+ created_at: string;
8233
+ };
8234
+ };
8187
8235
  ChatSessionEntryRange: {
8188
8236
  /** @description Session log entries in log_seq order. */
8189
8237
  entries: unknown[];
@@ -11192,7 +11240,7 @@ export interface components {
11192
11240
  value?: (string | number | boolean | unknown[] | {
11193
11241
  [key: string]: unknown;
11194
11242
  }) | null;
11195
- /** @description Increments on every write. Send it as `If-Match` to make a write conditional. */
11243
+ /** @description Increases on every write and is never reused for a key, even after it expires or is deleted. Send it as `If-Match` to make a write conditional. */
11196
11244
  version: number;
11197
11245
  /**
11198
11246
  * Format: date-time
@@ -11240,7 +11288,7 @@ export interface components {
11240
11288
  value?: (string | number | boolean | unknown[] | {
11241
11289
  [key: string]: unknown;
11242
11290
  }) | null;
11243
- /** @description Increments on every write. Send it as `If-Match` to make a write conditional. */
11291
+ /** @description Increases on every write and is never reused for a key, even after it expires or is deleted. Send it as `If-Match` to make a write conditional. */
11244
11292
  version: number;
11245
11293
  /**
11246
11294
  * Format: date-time
@@ -19961,8 +20009,8 @@ export interface operations {
19961
20009
  search?: string;
19962
20010
  /** @description Comma-separated list of tags to filter by. */
19963
20011
  tags?: string;
19964
- /** @description Field to order results by. One of `fail_rate`, `flaky_rate`, `last_run`. Defaults to `fail_rate`. */
19965
- order_by?: "fail_rate" | "flaky_rate" | "last_run";
20012
+ /** @description Field to order results by. One of `fail_rate`, `flaky_rate`, `last_run`, `duration` (mean `avg_duration_ms`, slowest first with `desc`). Defaults to `fail_rate`. */
20013
+ order_by?: "fail_rate" | "flaky_rate" | "last_run" | "duration";
19966
20014
  /** @description Sort direction, `asc` or `desc`. Defaults to `desc`. */
19967
20015
  order?: "asc" | "desc";
19968
20016
  /** @description Maximum number of test cases to return (1-500). */
@@ -20195,8 +20243,8 @@ export interface operations {
20195
20243
  search?: string;
20196
20244
  /** @description Comma-separated list of tags to filter by. */
20197
20245
  tags?: string;
20198
- /** @description Field to order results by. One of `fail_rate`, `flaky_rate`, `last_run`. Defaults to `fail_rate`. */
20199
- order_by?: "fail_rate" | "flaky_rate" | "last_run";
20246
+ /** @description Field to order results by. One of `fail_rate`, `flaky_rate`, `last_run`, `duration` (mean `avg_duration_ms`, slowest first with `desc`). Defaults to `fail_rate`. */
20247
+ order_by?: "fail_rate" | "flaky_rate" | "last_run" | "duration";
20200
20248
  /** @description Sort direction, `asc` or `desc`. Defaults to `desc`. */
20201
20249
  order?: "asc" | "desc";
20202
20250
  /** @description Maximum number of test cases to return (1-500). */
@@ -22822,6 +22870,149 @@ export interface operations {
22822
22870
  };
22823
22871
  };
22824
22872
  };
22873
+ listChatSessions: {
22874
+ parameters: {
22875
+ query?: {
22876
+ /** @description Restrict to a single project (ignored for bound principals). */
22877
+ project_id?: number;
22878
+ /** @description Include closed sessions when `true`. */
22879
+ show_closed?: boolean | null;
22880
+ /** @description Filter sessions by preset (all, active, merged). */
22881
+ preset?: "all" | "active" | "merged";
22882
+ /** @description Page number (1-indexed). Default 1. */
22883
+ page?: number;
22884
+ /** @description Items per page. Default 10. */
22885
+ per_page?: number;
22886
+ /** @description Optional Manager sidebar category: executor sessions, or all non-manager/non-executor user-facing sessions. */
22887
+ category?: "executor" | "user";
22888
+ /** @description Comma-separated project IDs to include. */
22889
+ project_ids?: string;
22890
+ /** @description Comma-separated project IDs to exclude. */
22891
+ exclude_project_ids?: string;
22892
+ /** @description Comma-separated creator user IDs to filter by. */
22893
+ user_ids?: string;
22894
+ /** @description Matches the session title, the creator's name or email, or the session ID. */
22895
+ search?: string;
22896
+ /** @description Only sessions updated within this many days. */
22897
+ updated_within_days?: number;
22898
+ /** @description URL-encoded JSON array of generic filter conditions. */
22899
+ filters?: string;
22900
+ /** @description Only sessions linked to this entity type. Requires `entity_id`. */
22901
+ entity_type?: "test_run" | "task" | "rule";
22902
+ /** @description Only sessions linked to this entity ID. Requires `entity_type`. */
22903
+ entity_id?: number;
22904
+ };
22905
+ header?: never;
22906
+ path?: never;
22907
+ cookie?: never;
22908
+ };
22909
+ requestBody?: never;
22910
+ responses: {
22911
+ /** @description Page of chat sessions. */
22912
+ 200: {
22913
+ headers: {
22914
+ [name: string]: unknown;
22915
+ };
22916
+ content: {
22917
+ "application/json": components["schemas"]["ChatSessionListResponse"];
22918
+ };
22919
+ };
22920
+ /** @description Invalid request. */
22921
+ 400: {
22922
+ headers: {
22923
+ [name: string]: unknown;
22924
+ };
22925
+ content: {
22926
+ "application/json": components["schemas"]["ErrorResponse"];
22927
+ };
22928
+ };
22929
+ /** @description Project not found or not accessible. */
22930
+ 404: {
22931
+ headers: {
22932
+ [name: string]: unknown;
22933
+ };
22934
+ content: {
22935
+ "application/json": components["schemas"]["ErrorResponse"];
22936
+ };
22937
+ };
22938
+ };
22939
+ };
22940
+ createChatSession: {
22941
+ parameters: {
22942
+ query?: never;
22943
+ header?: never;
22944
+ path?: never;
22945
+ cookie?: never;
22946
+ };
22947
+ requestBody: {
22948
+ content: {
22949
+ "application/json": {
22950
+ /** @description First message for the agent. Required: a session without one never starts. */
22951
+ message: string;
22952
+ /** @description Hive agent to run, as `<name>` (its `@latest` version) or `<name>@<version>`, e.g. `main-worker@2`. Defaults to `main-worker`. Rejected with a 400 when Hive does not serve that agent or version. The agent version decides the model, tools and prompt; `model` still overrides its model. List agents with `GET /api/hive/agents`. */
22953
+ agent?: string | null;
22954
+ /**
22955
+ * @deprecated
22956
+ * @description Deprecated alias of `agent`. The legacy values `chat` and `triage` mean the default agent.
22957
+ */
22958
+ mode?: string | null;
22959
+ /** @description What the session is about: test runs, tasks or rules. Each must belong to the session's project, otherwise the request fails with a 400. */
22960
+ links?: ({
22961
+ /** @enum {string} */
22962
+ entity_type: "test_run";
22963
+ entity_id: number;
22964
+ /** @description Test case IDs in the run this session is scoped to. Omit for the whole run. */
22965
+ test_case_ids?: string[] | null;
22966
+ /**
22967
+ * @deprecated
22968
+ * @description Deprecated alias of `test_case_ids`.
22969
+ */
22970
+ pw_test_ids?: string[] | null;
22971
+ } | {
22972
+ /** @enum {string} */
22973
+ entity_type: "task" | "rule";
22974
+ entity_id: number;
22975
+ })[] | null;
22976
+ model?: string | null;
22977
+ /** @description Deprecated. Sessions start on the project default branch; a different branch is added to `message` as an instruction to work from it. */
22978
+ base_branch?: string | null;
22979
+ /** Format: uuid */
22980
+ created_by?: string | null;
22981
+ /** @description When the caller is an agent session, wake it the next time this session waits for input (one-shot). Defaults to false. Ignored for other callers. */
22982
+ subscribe?: boolean | null;
22983
+ };
22984
+ };
22985
+ };
22986
+ responses: {
22987
+ /** @description The created chat session. */
22988
+ 201: {
22989
+ headers: {
22990
+ [name: string]: unknown;
22991
+ };
22992
+ content: {
22993
+ "application/json": components["schemas"]["ChatSessionCreateResponse"];
22994
+ };
22995
+ };
22996
+ /** @description Invalid request. */
22997
+ 400: {
22998
+ headers: {
22999
+ [name: string]: unknown;
23000
+ };
23001
+ content: {
23002
+ "application/json": components["schemas"]["ErrorResponse"];
23003
+ };
23004
+ };
23005
+ /** @description Billing blocked: an overdue invoice, a failed renewal, no active plan, or the spend limit reached. */
23006
+ 402: {
23007
+ headers: {
23008
+ [name: string]: unknown;
23009
+ };
23010
+ content: {
23011
+ "application/json": components["schemas"]["ErrorResponse"];
23012
+ };
23013
+ };
23014
+ };
23015
+ };
22825
23016
  listChatSessionAlarms: {
22826
23017
  parameters: {
22827
23018
  query?: never;
@@ -23116,6 +23307,89 @@ export interface operations {
23116
23307
  };
23117
23308
  };
23118
23309
  };
23310
+ listChatSessionEntityLinks: {
23311
+ parameters: {
23312
+ query?: never;
23313
+ header?: never;
23314
+ path: {
23315
+ /** @description Chat session ID. */
23316
+ id: number;
23317
+ };
23318
+ cookie?: never;
23319
+ };
23320
+ requestBody?: never;
23321
+ responses: {
23322
+ /** @description The session's links. */
23323
+ 200: {
23324
+ headers: {
23325
+ [name: string]: unknown;
23326
+ };
23327
+ content: {
23328
+ "application/json": components["schemas"]["ChatSessionEntityLinkListResponse"];
23329
+ };
23330
+ };
23331
+ /** @description Chat session not found. */
23332
+ 404: {
23333
+ headers: {
23334
+ [name: string]: unknown;
23335
+ };
23336
+ content: {
23337
+ "application/json": components["schemas"]["ErrorResponse"];
23338
+ };
23339
+ };
23340
+ };
23341
+ };
23342
+ createChatSessionEntityLink: {
23343
+ parameters: {
23344
+ query?: never;
23345
+ header?: never;
23346
+ path: {
23347
+ /** @description Chat session ID. */
23348
+ id: number;
23349
+ };
23350
+ cookie?: never;
23351
+ };
23352
+ requestBody: {
23353
+ content: {
23354
+ "application/json": {
23355
+ /** @enum {string} */
23356
+ entity_type: "test_run";
23357
+ entity_id: number;
23358
+ /** @description Test case IDs in the run this session is scoped to. Omit for the whole run. */
23359
+ test_case_ids?: string[] | null;
23360
+ /**
23361
+ * @deprecated
23362
+ * @description Deprecated alias of `test_case_ids`.
23363
+ */
23364
+ pw_test_ids?: string[] | null;
23365
+ } | {
23366
+ /** @enum {string} */
23367
+ entity_type: "task" | "rule";
23368
+ entity_id: number;
23369
+ };
23370
+ };
23371
+ };
23372
+ responses: {
23373
+ /** @description The session's link to the entity. */
23374
+ 200: {
23375
+ headers: {
23376
+ [name: string]: unknown;
23377
+ };
23378
+ content: {
23379
+ "application/json": components["schemas"]["ChatSessionEntityLinkResponse"];
23380
+ };
23381
+ };
23382
+ /** @description Chat session not found, or the entity is not in the session's project. */
23383
+ 404: {
23384
+ headers: {
23385
+ [name: string]: unknown;
23386
+ };
23387
+ content: {
23388
+ "application/json": components["schemas"]["ErrorResponse"];
23389
+ };
23390
+ };
23391
+ };
23392
+ };
23119
23393
  getChatSessionState: {
23120
23394
  parameters: {
23121
23395
  query?: {
@@ -25794,149 +26068,6 @@ export interface operations {
25794
26068
  };
25795
26069
  };
25796
26070
  };
25797
- listChatSessions: {
25798
- parameters: {
25799
- query?: {
25800
- /** @description Restrict to a single project (ignored for bound principals). */
25801
- project_id?: number;
25802
- /** @description Include closed sessions when `true`. */
25803
- show_closed?: boolean | null;
25804
- /** @description Filter sessions by preset (all, active, merged). */
25805
- preset?: "all" | "active" | "merged";
25806
- /** @description Page number (1-indexed). Default 1. */
25807
- page?: number;
25808
- /** @description Items per page. Default 10. */
25809
- per_page?: number;
25810
- /** @description Optional Manager sidebar category: executor sessions, or all non-manager/non-executor user-facing sessions. */
25811
- category?: "executor" | "user";
25812
- /** @description Comma-separated project IDs to include. */
25813
- project_ids?: string;
25814
- /** @description Comma-separated project IDs to exclude. */
25815
- exclude_project_ids?: string;
25816
- /** @description Comma-separated creator user IDs to filter by. */
25817
- user_ids?: string;
25818
- /** @description Matches the session title, the creator's name or email, or the session ID. */
25819
- search?: string;
25820
- /** @description Only sessions updated within this many days. */
25821
- updated_within_days?: number;
25822
- /** @description URL-encoded JSON array of generic filter conditions. */
25823
- filters?: string;
25824
- /** @description Only sessions linked to this entity type. Requires `entity_id`. */
25825
- entity_type?: "test_run" | "task" | "rule";
25826
- /** @description Only sessions linked to this entity ID. Requires `entity_type`. */
25827
- entity_id?: number;
25828
- };
25829
- header?: never;
25830
- path?: never;
25831
- cookie?: never;
25832
- };
25833
- requestBody?: never;
25834
- responses: {
25835
- /** @description Page of chat sessions. */
25836
- 200: {
25837
- headers: {
25838
- [name: string]: unknown;
25839
- };
25840
- content: {
25841
- "application/json": components["schemas"]["ChatSessionListResponse"];
25842
- };
25843
- };
25844
- /** @description Invalid request. */
25845
- 400: {
25846
- headers: {
25847
- [name: string]: unknown;
25848
- };
25849
- content: {
25850
- "application/json": components["schemas"]["ErrorResponse"];
25851
- };
25852
- };
25853
- /** @description Project not found or not accessible. */
25854
- 404: {
25855
- headers: {
25856
- [name: string]: unknown;
25857
- };
25858
- content: {
25859
- "application/json": components["schemas"]["ErrorResponse"];
25860
- };
25861
- };
25862
- };
25863
- };
25864
- createChatSession: {
25865
- parameters: {
25866
- query?: never;
25867
- header?: never;
25868
- path?: never;
25869
- cookie?: never;
25870
- };
25871
- requestBody: {
25872
- content: {
25873
- "application/json": {
25874
- /** @description First message for the agent. Required: a session without one never starts. */
25875
- message: string;
25876
- /** @description Hive agent to run, as `<name>` (its `@latest` version) or `<name>@<version>`, e.g. `main-worker@2`. Defaults to `main-worker`. Rejected with a 400 when Hive does not serve that agent or version. The agent version decides the model, tools and prompt; `model` still overrides its model. List agents with `GET /api/hive/agents`. */
25877
- agent?: string | null;
25878
- /**
25879
- * @deprecated
25880
- * @description Deprecated alias of `agent`. The legacy values `chat` and `triage` mean the default agent.
25881
- */
25882
- mode?: string | null;
25883
- /** @description What the session is about: test runs, tasks or rules. Each must belong to the session's project, otherwise the request fails with a 400. */
25884
- links?: ({
25885
- /** @enum {string} */
25886
- entity_type: "test_run";
25887
- entity_id: number;
25888
- /** @description Test case IDs in the run this session is scoped to. Omit for the whole run. */
25889
- test_case_ids?: string[] | null;
25890
- /**
25891
- * @deprecated
25892
- * @description Deprecated alias of `test_case_ids`.
25893
- */
25894
- pw_test_ids?: string[] | null;
25895
- } | {
25896
- /** @enum {string} */
25897
- entity_type: "task" | "rule";
25898
- entity_id: number;
25899
- })[] | null;
25900
- model?: string | null;
25901
- /** @description Deprecated. Sessions start on the project default branch; a different branch is added to `message` as an instruction to work from it. */
25902
- base_branch?: string | null;
25903
- /** Format: uuid */
25904
- created_by?: string | null;
25905
- /** @description When the caller is an agent session, wake it the next time this session waits for input (one-shot). Defaults to false. Ignored for other callers. */
25906
- subscribe?: boolean | null;
25907
- };
25908
- };
25909
- };
25910
- responses: {
25911
- /** @description The created chat session. */
25912
- 201: {
25913
- headers: {
25914
- [name: string]: unknown;
25915
- };
25916
- content: {
25917
- "application/json": components["schemas"]["ChatSessionCreateResponse"];
25918
- };
25919
- };
25920
- /** @description Invalid request. */
25921
- 400: {
25922
- headers: {
25923
- [name: string]: unknown;
25924
- };
25925
- content: {
25926
- "application/json": components["schemas"]["ErrorResponse"];
25927
- };
25928
- };
25929
- /** @description Billing blocked: an overdue invoice, a failed renewal, no active plan, or the spend limit reached. */
25930
- 402: {
25931
- headers: {
25932
- [name: string]: unknown;
25933
- };
25934
- content: {
25935
- "application/json": components["schemas"]["ErrorResponse"];
25936
- };
25937
- };
25938
- };
25939
- };
25940
26071
  getChatSession: {
25941
26072
  parameters: {
25942
26073
  query?: never;