@cstar.help/js 0.18.1 → 0.18.4

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.cjs CHANGED
@@ -51,7 +51,7 @@ var ErrorType = {
51
51
  API_ERROR: "api_error",
52
52
  SERVER_ERROR: "server_error"
53
53
  };
54
- var DEFAULT_DOC_URL = "https://cstar.help/developers/api/errors";
54
+ var DEFAULT_DOC_URL = "https://www.cstar.help/developers/errors";
55
55
  function normalizeArgs(messageOrStatus, maybeBody, defaults) {
56
56
  if (typeof messageOrStatus === "string") {
57
57
  return {
@@ -94,7 +94,7 @@ var CStarAuthenticationErrorImpl = class extends CStarErrorImpl {
94
94
  const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
95
95
  type: ErrorType.AUTHENTICATION_ERROR,
96
96
  code: "authentication_failed",
97
- doc_url: `${DEFAULT_DOC_URL}#authentication-error`
97
+ doc_url: `${DEFAULT_DOC_URL}#authentication-errors`
98
98
  });
99
99
  super(statusCode, resolved);
100
100
  this.name = "CStarAuthenticationError";
@@ -105,11 +105,11 @@ var CStarRateLimitErrorImpl = class extends CStarErrorImpl {
105
105
  const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
106
106
  type: ErrorType.RATE_LIMIT_ERROR,
107
107
  code: "rate_limit_exceeded",
108
- doc_url: `${DEFAULT_DOC_URL}#rate-limit-error`
108
+ doc_url: `${DEFAULT_DOC_URL}#rate_limit_exceeded`
109
109
  });
110
110
  super(statusCode === 0 ? 429 : statusCode, resolved);
111
111
  this.name = "CStarRateLimitError";
112
- this.retryAfter = retryAfter ?? 60;
112
+ this.retryAfter = retryAfter;
113
113
  }
114
114
  };
115
115
  var CStarNotFoundErrorImpl = class extends CStarErrorImpl {
@@ -117,7 +117,7 @@ var CStarNotFoundErrorImpl = class extends CStarErrorImpl {
117
117
  const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
118
118
  type: ErrorType.NOT_FOUND_ERROR,
119
119
  code: "resource_not_found",
120
- doc_url: `${DEFAULT_DOC_URL}#not-found-error`
120
+ doc_url: `${DEFAULT_DOC_URL}#resource_not_found`
121
121
  });
122
122
  super(statusCode, resolved);
123
123
  this.name = "CStarNotFoundError";
@@ -128,7 +128,7 @@ var CStarValidationErrorImpl = class extends CStarErrorImpl {
128
128
  const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
129
129
  type: ErrorType.INVALID_REQUEST_ERROR,
130
130
  code: "validation_error",
131
- doc_url: `${DEFAULT_DOC_URL}#validation-error`
131
+ doc_url: `${DEFAULT_DOC_URL}#invalid-request-errors`
132
132
  });
133
133
  super(statusCode, resolved);
134
134
  this.name = "CStarValidationError";
@@ -139,7 +139,7 @@ var CStarPermissionErrorImpl = class extends CStarErrorImpl {
139
139
  const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
140
140
  type: ErrorType.PERMISSION_ERROR,
141
141
  code: "permission_denied",
142
- doc_url: `${DEFAULT_DOC_URL}#permission-error`
142
+ doc_url: `${DEFAULT_DOC_URL}#insufficient_permissions`
143
143
  });
144
144
  super(statusCode, resolved);
145
145
  this.name = "CStarPermissionError";
@@ -150,7 +150,7 @@ var CStarConflictErrorImpl = class extends CStarErrorImpl {
150
150
  const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
151
151
  type: ErrorType.CONFLICT_ERROR,
152
152
  code: "conflict",
153
- doc_url: `${DEFAULT_DOC_URL}#conflict-error`
153
+ doc_url: `${DEFAULT_DOC_URL}#resource_conflict`
154
154
  });
155
155
  super(statusCode, resolved);
156
156
  this.name = "CStarConflictError";
@@ -161,7 +161,7 @@ var CStarServerErrorImpl = class extends CStarErrorImpl {
161
161
  const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
162
162
  type: ErrorType.SERVER_ERROR,
163
163
  code: "server_error",
164
- doc_url: `${DEFAULT_DOC_URL}#server-error`
164
+ doc_url: `${DEFAULT_DOC_URL}#server-errors`
165
165
  });
166
166
  super(statusCode, resolved);
167
167
  this.name = "CStarServerError";
@@ -172,7 +172,7 @@ var CStarFeatureDisabledErrorImpl = class extends CStarErrorImpl {
172
172
  const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
173
173
  type: ErrorType.FEATURE_NOT_CONFIGURED,
174
174
  code: "feature_not_configured",
175
- doc_url: `${DEFAULT_DOC_URL}#feature-not-configured`
175
+ doc_url: `${DEFAULT_DOC_URL}#feature_disabled`
176
176
  });
177
177
  super(statusCode, resolved);
178
178
  this.name = "CStarFeatureDisabledError";
@@ -182,12 +182,12 @@ var CStarFeatureDisabledErrorImpl = class extends CStarErrorImpl {
182
182
  };
183
183
  var CStarRealtimeUnavailableErrorImpl = class extends CStarErrorImpl {
184
184
  constructor(message) {
185
- const resolved = message ?? "EventSource is not available in this environment. Real-time subscriptions only work in the browser. Move the call to a client-only path (`useEffect` / `onMount`), or pass an `eventSource` polyfill via the realtime options. See https://cstar.help/developers/sdk/realtime#ssr";
185
+ const resolved = message ?? "EventSource is not available in this environment. Real-time subscriptions only work in the browser. Move the call to a client-only path (`useEffect` / `onMount`), or pass an `eventSource` polyfill via the realtime options. See https://www.cstar.help/developers/sdk/js/realtime#ssr";
186
186
  super(0, {
187
187
  type: ErrorType.API_ERROR,
188
188
  code: "realtime_unavailable",
189
189
  message: resolved,
190
- doc_url: "https://cstar.help/developers/sdk/realtime#ssr"
190
+ doc_url: "https://www.cstar.help/developers/sdk/js/realtime#ssr"
191
191
  });
192
192
  this.name = "CStarRealtimeUnavailableError";
193
193
  }
@@ -263,7 +263,10 @@ function parseError(statusCode, body, retryAfter) {
263
263
  doc_url: DEFAULT_DOC_URL
264
264
  };
265
265
  if (statusCode === 429) {
266
- return new CStarRateLimitError(statusCode, errorBody, retryAfter ?? 60);
266
+ return new CStarRateLimitError(statusCode, errorBody, retryAfter);
267
+ }
268
+ if (errorBody.code === "feature_disabled") {
269
+ return new CStarFeatureDisabledError(statusCode, errorBody);
267
270
  }
268
271
  const StatusCls = STATUS_TO_CLASS[statusCode];
269
272
  if (StatusCls) {
@@ -278,7 +281,7 @@ function parseError(statusCode, body, retryAfter) {
278
281
  }
279
282
 
280
283
  // src/client.ts
281
- var SDK_VERSION = "0.18.1";
284
+ var SDK_VERSION = "0.18.4";
282
285
  var DEFAULT_BASE_URL = "https://www.cstar.help";
283
286
  var DEFAULT_API_VERSION = "2026-03-01";
284
287
  var DEFAULT_MAX_RETRIES = 3;
@@ -298,7 +301,7 @@ var HttpClient = class {
298
301
  this.lastMeta = { requestId: null, timestamp: null, pagination: null };
299
302
  if (!config || typeof config.apiKey !== "string" || config.apiKey.length === 0) {
300
303
  throw new Error(
301
- "[cStar] CStarClient: apiKey is required. Pass a secret key (sk_live_... / sk_test_...). Publishable keys (pk_...) cannot read team endpoints; use them with LibraryClient or CommunityClient. See https://cstar.help/developers/quickstart"
304
+ "[cStar] CStarClient: apiKey is required. Pass a secret key (sk_live_... / sk_test_...). Publishable keys (pk_...) cannot read team endpoints; use them with LibraryClient or CommunityClient. See https://www.cstar.help/developers/quickstart"
302
305
  );
303
306
  }
304
307
  if (typeof config.teamId !== "string" || config.teamId.length === 0) {
@@ -361,7 +364,7 @@ var HttpClient = class {
361
364
  let inProgressWaitMs = null;
362
365
  for (let attempt = 0; attempt <= this.config.maxRetries; attempt++) {
363
366
  if (attempt > 0 && lastError) {
364
- const delay = inProgressWaitMs ?? (lastError instanceof CStarRateLimitError ? Math.min(lastError.retryAfter * 1e3, RATE_LIMIT_RETRY_CAP_MS) : this.getBackoffDelay(attempt));
367
+ const delay = inProgressWaitMs ?? (lastError instanceof CStarRateLimitError ? Math.min((lastError.retryAfter ?? 1) * 1e3, RATE_LIMIT_RETRY_CAP_MS) : this.getBackoffDelay(attempt));
365
368
  inProgressWaitMs = null;
366
369
  await this.sleep(delay);
367
370
  }
@@ -379,7 +382,7 @@ var HttpClient = class {
379
382
  type: "connection_error",
380
383
  code: "network_error",
381
384
  message: `Network request failed: ${networkErr.message}`,
382
- doc_url: "https://www.cstar.help/developers/errors#connection-errors"
385
+ doc_url: "https://www.cstar.help/developers/errors#network_error"
383
386
  });
384
387
  if (canRetryAmbiguousFailure && attempt < this.config.maxRetries) continue;
385
388
  throw lastError;
@@ -415,7 +418,8 @@ var HttpClient = class {
415
418
  }
416
419
  if (response.status === 429) {
417
420
  lastError = parseError(429, errorBody, retryAfter);
418
- if (attempt < this.config.maxRetries) continue;
421
+ const worthWaiting = retryAfter !== void 0 && retryAfter * 1e3 <= RATE_LIMIT_RETRY_CAP_MS;
422
+ if (worthWaiting && attempt < this.config.maxRetries) continue;
419
423
  throw lastError;
420
424
  }
421
425
  lastError = parseError(response.status, errorBody);
@@ -1252,6 +1256,15 @@ var WebhooksResource = class extends BaseResource {
1252
1256
  constructor(client) {
1253
1257
  super(client, "/webhooks");
1254
1258
  }
1259
+ /**
1260
+ * Create a webhook endpoint. Its answer carries the signing secret, so the
1261
+ * API keeps it out of the Idempotency-Key cache: an `idempotencyKey` is
1262
+ * not sent, and a network error or 5xx is not retried, since the webhook
1263
+ * may already exist. List webhooks before creating it again.
1264
+ */
1265
+ async create(params, _options) {
1266
+ return this.client.request("POST", this.basePath, { body: params });
1267
+ }
1255
1268
  /** Send a test delivery to a webhook endpoint. */
1256
1269
  async test(webhookId, params) {
1257
1270
  return this.client.request(
@@ -1286,11 +1299,14 @@ var WebhooksResource = class extends BaseResource {
1286
1299
  async unsubscribe(subscriptionId) {
1287
1300
  await this.client.request("DELETE", `/webhooks/subscribe/${subscriptionId}`);
1288
1301
  }
1289
- /** Register a CLI listener (returns listenerId and signing secret). */
1290
- async listen(params, options) {
1302
+ /**
1303
+ * Register a CLI listener (returns listenerId and signing secret). The API
1304
+ * ignores Idempotency-Key here (the answer is a secret), so an
1305
+ * `idempotencyKey` is not sent and a network error or 5xx is not retried.
1306
+ */
1307
+ async listen(params, _options) {
1291
1308
  return this.client.request("POST", "/webhooks/listen", {
1292
- body: params,
1293
- idempotencyKey: options?.idempotencyKey
1309
+ body: params
1294
1310
  });
1295
1311
  }
1296
1312
  /** Deregister a CLI listener. */
@@ -1700,11 +1716,15 @@ var AttachmentsResource = class {
1700
1716
  params?.bucket ? { query: { bucket: params.bucket } } : void 0
1701
1717
  );
1702
1718
  }
1703
- /** Delete an attachment. */
1704
- async del(attachmentId) {
1719
+ /**
1720
+ * Delete a stored file. Pass `storagePath` and `bucket` from `list()`, as
1721
+ * for `get()`. A path with no file in that bucket is a 404.
1722
+ */
1723
+ async del(storagePath, params) {
1705
1724
  return this.client.request(
1706
1725
  "DELETE",
1707
- `/attachments/${attachmentId}`
1726
+ `/attachments/${storagePath}`,
1727
+ params?.bucket ? { query: { bucket: params.bucket } } : void 0
1708
1728
  );
1709
1729
  }
1710
1730
  };
@@ -1878,10 +1898,9 @@ var ExportResource = class {
1878
1898
  constructor(client) {
1879
1899
  this.client = client;
1880
1900
  }
1881
- async create(params, options) {
1901
+ async create(params, _options) {
1882
1902
  return this.client.request("POST", "/export", {
1883
1903
  body: params,
1884
- idempotencyKey: options?.idempotencyKey,
1885
1904
  responseType: params.format === "csv" ? "text" : "json"
1886
1905
  });
1887
1906
  }
@@ -2097,7 +2116,10 @@ var GameActivityResource = class {
2097
2116
  query: params ? { ...params } : void 0
2098
2117
  });
2099
2118
  }
2100
- /** Get activity for a specific member. */
2119
+ /**
2120
+ * Get activity for a specific member. `memberId` is the player's user id:
2121
+ * the `memberId` game responses return, and `userId` on `members.list()`.
2122
+ */
2101
2123
  async forMember(memberId, params) {
2102
2124
  return this.client.request("GET", `/game/activity/member/${memberId}`, {
2103
2125
  query: params ? { ...params } : void 0
@@ -2286,7 +2308,10 @@ var GameResource = class {
2286
2308
  query: params ? { ...params } : void 0
2287
2309
  });
2288
2310
  }
2289
- /** Get a specific player's stats by membership ID. */
2311
+ /**
2312
+ * Get a specific player's stats. `memberId` is the player's user id: the
2313
+ * `memberId` game responses return, and `userId` on `members.list()`.
2314
+ */
2290
2315
  async getPlayer(memberId) {
2291
2316
  return this.client.request("GET", `/game/player/${memberId}`);
2292
2317
  }
@@ -2575,9 +2600,9 @@ var OfflineQueue = class {
2575
2600
  // src/types/generated/webhookEvents.ts
2576
2601
  var WEBHOOK_EVENT_SAMPLES = {
2577
2602
  "agent.preferences_updated": {
2578
- "team_id": "team_01H8X9YZ7E0J3K4M5N6U",
2579
- "member_id": "mem_01H8X9YZ7E0J3K4M5N6U",
2580
- "agent_id": "agt_01H8X9YZ7E0J3K4M5N6U",
2603
+ "team_id": "550e8400-e29b-41d4-a716-446655440000",
2604
+ "member_id": "550e8400-e29b-41d4-a716-446655440010",
2605
+ "agent_id": "550e8400-e29b-41d4-a716-446655440001",
2581
2606
  "changed": [
2582
2607
  "boringMode"
2583
2608
  ],
@@ -2587,143 +2612,197 @@ var WEBHOOK_EVENT_SAMPLES = {
2587
2612
  },
2588
2613
  "article.created": {
2589
2614
  "article": {
2590
- "id": "art_01H8X9YZ7E0J3K4M5N6U",
2615
+ "id": "art_Yb3kQ9mT2pLx",
2591
2616
  "title": "How to reset your password",
2592
2617
  "slug": "how-to-reset-your-password",
2618
+ "status": "draft",
2593
2619
  "is_public": false,
2594
- "created_at": "2026-04-27T18:42:11.000Z"
2620
+ "published_at": "2026-04-27T19:00:00.000Z",
2621
+ "created_at": "2026-04-27T18:42:11.000Z",
2622
+ "updated_at": "2026-04-27T19:00:00.000Z"
2595
2623
  }
2596
2624
  },
2597
2625
  "article.deleted": {
2598
- "id": "art_01H8X9YZ7E0J3K4M5N6U"
2626
+ "id": "art_Yb3kQ9mT2pLx"
2599
2627
  },
2600
2628
  "article.published": {
2601
2629
  "article": {
2602
- "id": "art_01H8X9YZ7E0J3K4M5N6U",
2630
+ "id": "art_Yb3kQ9mT2pLx",
2603
2631
  "title": "How to reset your password",
2604
2632
  "slug": "how-to-reset-your-password",
2633
+ "status": "published",
2605
2634
  "is_public": true,
2606
- "published_at": "2026-04-27T19:00:00.000Z"
2635
+ "published_at": "2026-04-27T19:00:00.000Z",
2636
+ "created_at": "2026-04-27T18:42:11.000Z",
2637
+ "updated_at": "2026-04-27T19:00:00.000Z"
2607
2638
  }
2608
2639
  },
2609
2640
  "article.updated": {
2610
2641
  "article": {
2611
- "id": "art_01H8X9YZ7E0J3K4M5N6U",
2642
+ "id": "art_Yb3kQ9mT2pLx",
2612
2643
  "title": "How to reset your password (updated)",
2613
2644
  "slug": "how-to-reset-your-password",
2614
- "is_public": true
2645
+ "status": "published",
2646
+ "is_public": true,
2647
+ "published_at": "2026-04-27T19:00:00.000Z",
2648
+ "created_at": "2026-04-27T18:42:11.000Z",
2649
+ "updated_at": "2026-04-27T19:00:00.000Z"
2650
+ },
2651
+ "changes": {
2652
+ "title": {
2653
+ "from": "How to reset your password",
2654
+ "to": "How to reset your password (updated)"
2655
+ },
2656
+ "slug": {
2657
+ "from": "reset-password",
2658
+ "to": "how-to-reset-your-password"
2659
+ },
2660
+ "status": {
2661
+ "from": "draft",
2662
+ "to": "published"
2663
+ },
2664
+ "is_public": {
2665
+ "from": false,
2666
+ "to": true
2667
+ }
2615
2668
  }
2616
2669
  },
2617
2670
  "boss.damaged": {
2618
2671
  "boss": {
2619
- "id": "boss_thunder_drake",
2672
+ "name": "The Thunder Drake",
2620
2673
  "current_hp": 740
2621
2674
  },
2622
2675
  "damage": 120,
2676
+ "defeated": false,
2623
2677
  "by": {
2624
- "agent_id": "usr_01H8X9YZ7E0J3K4M5N6S",
2625
- "name": "Riley"
2678
+ "agent_id": "550e8400-e29b-41d4-a716-446655440001"
2626
2679
  }
2627
2680
  },
2628
2681
  "boss.defeated": {
2629
2682
  "boss": {
2630
- "id": "boss_thunder_drake",
2631
- "name": "The Thunder Drake"
2683
+ "name": "The Thunder Drake",
2684
+ "level": 4
2632
2685
  },
2633
2686
  "final_blow_by": {
2634
- "agent_id": "usr_01H8X9YZ7E0J3K4M5N6S",
2687
+ "agent_id": "550e8400-e29b-41d4-a716-446655440001",
2635
2688
  "name": "Riley"
2636
- },
2637
- "team_xp_awarded": 1500
2689
+ }
2638
2690
  },
2639
2691
  "boss.spawned": {
2640
2692
  "boss": {
2641
2693
  "id": "boss_thunder_drake",
2642
2694
  "name": "The Thunder Drake",
2643
2695
  "level": 4,
2696
+ "type": "dragon",
2697
+ "difficulty": "hard",
2644
2698
  "max_hp": 1200
2645
2699
  }
2646
2700
  },
2647
2701
  "community_post.commented": {
2702
+ "post": {
2703
+ "id": "550e8400-e29b-41d4-a716-446655440040"
2704
+ },
2648
2705
  "comment": {
2649
- "id": "cmt_01H8X9YZ7E0J3K4M5N6X",
2650
- "post_id": "post_01H8X9YZ7E0J3K4M5N6W",
2651
- "content": "I would love this. Bumping for visibility.",
2652
- "author_id": "cus_01H8X9YZ7E0J3K4M5N6Q",
2706
+ "id": "550e8400-e29b-41d4-a716-446655440041",
2707
+ "post_id": "550e8400-e29b-41d4-a716-446655440040",
2708
+ "body": "I would love this. Bumping for visibility.",
2709
+ "is_official": false,
2710
+ "author_name": "Casey Patel",
2653
2711
  "created_at": "2026-04-27T18:55:02.000Z"
2654
2712
  }
2655
2713
  },
2656
2714
  "community_post.created": {
2657
2715
  "post": {
2658
- "id": "post_01H8X9YZ7E0J3K4M5N6W",
2659
- "prefixed_id": "IDEA-42",
2716
+ "id": "550e8400-e29b-41d4-a716-446655440040",
2660
2717
  "title": "Add Slack-style threading to tickets",
2661
2718
  "status": "open",
2662
2719
  "visibility": "public",
2663
- "topic": "feature-requests",
2664
2720
  "created_at": "2026-04-27T18:42:11.000Z"
2665
2721
  }
2666
2722
  },
2667
2723
  "community_post.deleted": {
2668
2724
  "post": {
2669
- "id": "post_01H8X9YZ7E0J3K4M5N6W",
2670
- "prefixed_id": "IDEA-42",
2725
+ "id": "550e8400-e29b-41d4-a716-446655440040",
2671
2726
  "title": "Add Slack-style threading to tickets"
2672
2727
  }
2673
2728
  },
2674
2729
  "community_post.status_changed": {
2675
2730
  "post": {
2676
- "id": "post_01H8X9YZ7E0J3K4M5N6W",
2731
+ "id": "550e8400-e29b-41d4-a716-446655440040",
2677
2732
  "title": "Add Slack-style threading to tickets",
2678
2733
  "status": "planned",
2679
- "visibility": "public"
2680
- }
2734
+ "visibility": "public",
2735
+ "created_at": "2026-04-27T18:42:11.000Z"
2736
+ },
2737
+ "previous_status": "open"
2681
2738
  },
2682
2739
  "community_post.updated": {
2683
2740
  "post": {
2684
- "id": "post_01H8X9YZ7E0J3K4M5N6W",
2741
+ "id": "550e8400-e29b-41d4-a716-446655440040",
2685
2742
  "title": "Add Slack-style threading to tickets (revised)",
2686
2743
  "status": "open",
2687
- "visibility": "public"
2744
+ "visibility": "public",
2745
+ "created_at": "2026-04-27T18:42:11.000Z"
2688
2746
  }
2689
2747
  },
2690
2748
  "community_post.voted": {
2691
2749
  "post": {
2692
- "id": "post_01H8X9YZ7E0J3K4M5N6W",
2750
+ "id": "550e8400-e29b-41d4-a716-446655440040",
2693
2751
  "vote_count": 13
2694
2752
  },
2695
2753
  "voter": {
2696
- "id": "cus_01H8X9YZ7E0J3K4M5N6Q"
2754
+ "id": "cus_no9EfYa0dg5O"
2697
2755
  },
2698
2756
  "direction": "up"
2699
2757
  },
2700
2758
  "customer.created": {
2701
2759
  "customer": {
2702
- "id": "cus_01H8X9YZ7E0J3K4M5N6Q",
2760
+ "id": "cus_no9EfYa0dg5O",
2703
2761
  "name": "Casey Patel",
2704
2762
  "email": "casey@example.com",
2705
2763
  "status": "active",
2764
+ "sentiment": "neutral",
2706
2765
  "tags": [
2707
2766
  "trial"
2708
2767
  ],
2709
- "created_at": "2026-04-27T18:42:11.000Z"
2768
+ "created_at": "2026-04-27T18:42:11.000Z",
2769
+ "updated_at": "2026-04-27T18:42:11.000Z"
2710
2770
  }
2711
2771
  },
2712
2772
  "customer.deleted": {
2713
- "id": "cus_01H8X9YZ7E0J3K4M5N6Q"
2773
+ "id": "cus_no9EfYa0dg5O"
2714
2774
  },
2715
2775
  "customer.updated": {
2716
2776
  "customer": {
2717
- "id": "cus_01H8X9YZ7E0J3K4M5N6Q",
2777
+ "id": "cus_no9EfYa0dg5O",
2718
2778
  "name": "Casey Patel",
2719
2779
  "email": "casey@example.com",
2720
2780
  "status": "active",
2781
+ "sentiment": "neutral",
2721
2782
  "tags": [
2722
2783
  "trial",
2723
2784
  "paying"
2724
- ]
2785
+ ],
2786
+ "created_at": "2026-04-27T18:42:11.000Z",
2787
+ "updated_at": "2026-04-27T18:42:11.000Z"
2725
2788
  },
2726
2789
  "changes": {
2790
+ "name": {
2791
+ "from": "Casey",
2792
+ "to": "Casey Patel"
2793
+ },
2794
+ "email": {
2795
+ "from": "casey@old.example.com",
2796
+ "to": "casey@example.com"
2797
+ },
2798
+ "status": {
2799
+ "from": "active",
2800
+ "to": "inactive"
2801
+ },
2802
+ "sentiment": {
2803
+ "from": "neutral",
2804
+ "to": "happy"
2805
+ },
2727
2806
  "tags": {
2728
2807
  "from": [
2729
2808
  "trial"
@@ -2736,51 +2815,59 @@ var WEBHOOK_EVENT_SAMPLES = {
2736
2815
  }
2737
2816
  },
2738
2817
  "customer_group.created": {
2739
- "group": {
2740
- "id": "grp_01H8X9YZ7E0J3K4M5N6T",
2818
+ "customer_group": {
2819
+ "id": "550e8400-e29b-41d4-a716-446655440030",
2741
2820
  "name": "Pro Plan",
2742
- "color": "indigo",
2743
- "member_count": 0
2821
+ "slug": "pro-plan",
2822
+ "description": "Customers on the Pro plan",
2823
+ "customer_count": 0,
2824
+ "created_at": "2026-04-27T18:42:11.000Z",
2825
+ "updated_at": "2026-04-27T18:42:11.000Z"
2744
2826
  }
2745
2827
  },
2746
2828
  "customer_group.deleted": {
2747
2829
  "customer_group": {
2748
- "id": "grp_01H8X9YZ7E0J3K4M5N6T"
2830
+ "id": "550e8400-e29b-41d4-a716-446655440030"
2749
2831
  }
2750
2832
  },
2751
2833
  "customer_group.updated": {
2752
- "group": {
2753
- "id": "grp_01H8X9YZ7E0J3K4M5N6T",
2834
+ "customer_group": {
2835
+ "id": "550e8400-e29b-41d4-a716-446655440030",
2754
2836
  "name": "Pro Plan (Annual)",
2755
- "color": "indigo",
2756
- "member_count": 38
2837
+ "slug": "pro-plan",
2838
+ "description": "Customers on the Pro plan",
2839
+ "customer_count": 38,
2840
+ "created_at": "2026-04-27T18:42:11.000Z",
2841
+ "updated_at": "2026-04-27T18:42:11.000Z"
2757
2842
  }
2758
2843
  },
2759
2844
  "player.achievement_unlocked": {
2760
2845
  "player": {
2761
- "agent_id": "usr_01H8X9YZ7E0J3K4M5N6S",
2846
+ "agent_id": "550e8400-e29b-41d4-a716-446655440001",
2762
2847
  "name": "Riley"
2763
2848
  },
2764
2849
  "achievement": {
2765
2850
  "id": "first_resolve",
2766
2851
  "name": "First Resolve",
2852
+ "description": "Resolve your first ticket",
2853
+ "rarity": "common",
2767
2854
  "xp": 50
2768
2855
  }
2769
2856
  },
2770
2857
  "player.level_up": {
2771
2858
  "player": {
2772
- "agent_id": "usr_01H8X9YZ7E0J3K4M5N6S",
2859
+ "agent_id": "550e8400-e29b-41d4-a716-446655440001",
2773
2860
  "name": "Riley"
2774
2861
  },
2775
2862
  "level": {
2776
2863
  "from": 7,
2777
2864
  "to": 8
2778
2865
  },
2779
- "title_unlocked": "Apprentice Healer"
2866
+ "total_xp": 4200
2780
2867
  },
2781
2868
  "player.quest_completed": {
2782
2869
  "player": {
2783
- "agent_id": "usr_01H8X9YZ7E0J3K4M5N6S",
2870
+ "agent_id": "550e8400-e29b-41d4-a716-446655440001",
2784
2871
  "name": "Riley"
2785
2872
  },
2786
2873
  "quest": {
@@ -2791,7 +2878,7 @@ var WEBHOOK_EVENT_SAMPLES = {
2791
2878
  },
2792
2879
  "player.streak_milestone": {
2793
2880
  "player": {
2794
- "agent_id": "usr_01H8X9YZ7E0J3K4M5N6S",
2881
+ "agent_id": "550e8400-e29b-41d4-a716-446655440001",
2795
2882
  "name": "Riley"
2796
2883
  },
2797
2884
  "streak_days": 5,
@@ -2799,51 +2886,56 @@ var WEBHOOK_EVENT_SAMPLES = {
2799
2886
  },
2800
2887
  "player.xp_gained": {
2801
2888
  "player": {
2802
- "agent_id": "usr_01H8X9YZ7E0J3K4M5N6S",
2889
+ "agent_id": "550e8400-e29b-41d4-a716-446655440001",
2803
2890
  "name": "Riley"
2804
2891
  },
2805
2892
  "amount": 75,
2806
2893
  "reason": "ticket.resolved",
2807
- "ticket_id": "tkt_01H8X9YZ7E0J3K4M5N6P"
2894
+ "ticket_id": "tkt_UR8A3OR3Vshq"
2808
2895
  },
2809
2896
  "social.high_five_sent": {
2897
+ "id": "550e8400-e29b-41d4-a716-446655440051",
2810
2898
  "from_team": {
2811
- "id": "team_acme",
2899
+ "id": "550e8400-e29b-41d4-a716-446655440000",
2812
2900
  "name": "Acme Support"
2813
2901
  },
2814
2902
  "to_team": {
2815
- "id": "team_globex",
2903
+ "id": "550e8400-e29b-41d4-a716-446655440003",
2816
2904
  "name": "Globex Support"
2817
2905
  },
2818
- "message": "Thanks for the assist!"
2906
+ "sent_by": {
2907
+ "agent_id": "550e8400-e29b-41d4-a716-446655440001",
2908
+ "name": "Riley"
2909
+ },
2910
+ "message": "Thanks for the assist!",
2911
+ "created_at": "2026-04-27T18:55:02.000Z"
2819
2912
  },
2820
2913
  "social.one_up_sent": {
2914
+ "id": "550e8400-e29b-41d4-a716-446655440050",
2821
2915
  "from": {
2822
- "agent_id": "usr_01H8X9YZ7E0J3K4M5N6S",
2916
+ "agent_id": "550e8400-e29b-41d4-a716-446655440001",
2823
2917
  "name": "Riley"
2824
2918
  },
2825
2919
  "to": {
2826
- "agent_id": "usr_01H8X9YZ7E0J3K4M5N6V",
2920
+ "agent_id": "550e8400-e29b-41d4-a716-446655440002",
2827
2921
  "name": "Sam"
2828
2922
  },
2829
- "ticket_id": "tkt_01H8X9YZ7E0J3K4M5N6P",
2830
- "message": "Great empathy on this one"
2923
+ "message": "Great empathy on this one",
2924
+ "gold_amount": 0,
2925
+ "created_at": "2026-04-27T18:55:02.000Z"
2831
2926
  },
2832
2927
  "survey.submitted": {
2833
2928
  "survey": {
2834
- "id": "svy_01H8X9YZ7E0J3K4M5N6Y",
2835
- "ticket_id": "tkt_01H8X9YZ7E0J3K4M5N6P",
2836
- "score": 5,
2929
+ "id": "550e8400-e29b-41d4-a716-446655440060",
2930
+ "ticket_id": "tkt_UR8A3OR3Vshq",
2931
+ "rating": 5,
2837
2932
  "comment": "Resolved fast, thank you!",
2933
+ "agent_id": "550e8400-e29b-41d4-a716-446655440001",
2838
2934
  "submitted_at": "2026-04-27T19:30:00.000Z"
2839
- },
2840
- "customer": {
2841
- "id": "cus_01H8X9YZ7E0J3K4M5N6Q",
2842
- "email": "casey@example.com"
2843
2935
  }
2844
2936
  },
2845
2937
  "team.preferences_updated": {
2846
- "team_id": "team_01H8X9YZ7E0J3K4M5N6U",
2938
+ "team_id": "550e8400-e29b-41d4-a716-446655440000",
2847
2939
  "changed": [
2848
2940
  "bossBattlesEnabled"
2849
2941
  ],
@@ -2853,91 +2945,159 @@ var WEBHOOK_EVENT_SAMPLES = {
2853
2945
  },
2854
2946
  "ticket.assigned": {
2855
2947
  "ticket": {
2856
- "id": "tkt_01H8X9YZ7E0J3K4M5N6P",
2857
- "prefixed_id": "CST-1024"
2948
+ "id": "tkt_UR8A3OR3Vshq",
2949
+ "title": "Cannot reset password",
2950
+ "status": "open",
2951
+ "priority": "normal",
2952
+ "channel": "widget",
2953
+ "tags": [
2954
+ "billing"
2955
+ ],
2956
+ "customer_id": "cus_no9EfYa0dg5O",
2957
+ "assigned_to": "550e8400-e29b-41d4-a716-446655440001",
2958
+ "dashboard_url": "https://www.cstar.help/team/acme/tickets?selected=3d3c850d-b6ff-4117-9dea-87e8dc4ba108",
2959
+ "created_at": "2026-04-27T18:42:11.000Z",
2960
+ "updated_at": "2026-04-27T18:50:02.000Z"
2858
2961
  },
2859
2962
  "assignee": {
2860
- "id": "usr_01H8X9YZ7E0J3K4M5N6S",
2963
+ "id": "550e8400-e29b-41d4-a716-446655440001",
2861
2964
  "name": "Riley",
2862
2965
  "email": "riley@acme.test"
2863
2966
  },
2864
- "previous_assignee": null
2967
+ "previous_assignee": {
2968
+ "id": "550e8400-e29b-41d4-a716-446655440002",
2969
+ "name": "Sam",
2970
+ "email": "sam@acme.test"
2971
+ }
2865
2972
  },
2866
2973
  "ticket.closed": {
2867
2974
  "ticket": {
2868
- "id": "tkt_01H8X9YZ7E0J3K4M5N6P",
2869
- "prefixed_id": "CST-1024",
2975
+ "id": "tkt_UR8A3OR3Vshq",
2870
2976
  "title": "Cannot reset password",
2871
2977
  "status": "closed",
2872
2978
  "priority": "normal",
2873
- "channel": "widget"
2979
+ "channel": "widget",
2980
+ "tags": [
2981
+ "billing"
2982
+ ],
2983
+ "customer_id": "cus_no9EfYa0dg5O",
2984
+ "assigned_to": "550e8400-e29b-41d4-a716-446655440001",
2985
+ "dashboard_url": "https://www.cstar.help/team/acme/tickets?selected=3d3c850d-b6ff-4117-9dea-87e8dc4ba108",
2986
+ "created_at": "2026-04-27T18:42:11.000Z",
2987
+ "updated_at": "2026-04-27T18:50:02.000Z"
2874
2988
  },
2875
2989
  "changes": {
2990
+ "title": {
2991
+ "from": "Cannot reset password",
2992
+ "to": "Password reset link expired"
2993
+ },
2876
2994
  "status": {
2877
2995
  "from": "open",
2878
2996
  "to": "closed"
2997
+ },
2998
+ "priority": {
2999
+ "from": "normal",
3000
+ "to": "high"
3001
+ },
3002
+ "assigned_to": {
3003
+ "from": "550e8400-e29b-41d4-a716-446655440002",
3004
+ "to": "550e8400-e29b-41d4-a716-446655440001"
3005
+ },
3006
+ "tags": {
3007
+ "from": [
3008
+ "billing"
3009
+ ],
3010
+ "to": [
3011
+ "billing",
3012
+ "urgent"
3013
+ ]
2879
3014
  }
2880
3015
  }
2881
3016
  },
2882
3017
  "ticket.created": {
2883
3018
  "ticket": {
2884
- "id": "tkt_01H8X9YZ7E0J3K4M5N6P",
2885
- "prefixed_id": "CST-1024",
3019
+ "id": "tkt_UR8A3OR3Vshq",
2886
3020
  "title": "Cannot reset password",
2887
3021
  "status": "new",
2888
3022
  "priority": "normal",
2889
3023
  "channel": "widget",
2890
- "customer_id": "cus_01H8X9YZ7E0J3K4M5N6Q",
2891
- "created_at": "2026-04-27T18:42:11.000Z"
3024
+ "tags": [
3025
+ "billing"
3026
+ ],
3027
+ "customer_id": "cus_no9EfYa0dg5O",
3028
+ "assigned_to": "550e8400-e29b-41d4-a716-446655440001",
3029
+ "dashboard_url": "https://www.cstar.help/team/acme/tickets?selected=3d3c850d-b6ff-4117-9dea-87e8dc4ba108",
3030
+ "created_at": "2026-04-27T18:42:11.000Z",
3031
+ "updated_at": "2026-04-27T18:50:02.000Z"
2892
3032
  },
2893
3033
  "customer": {
2894
- "id": "cus_01H8X9YZ7E0J3K4M5N6Q",
3034
+ "id": "cus_no9EfYa0dg5O",
2895
3035
  "name": "Casey Patel",
2896
3036
  "email": "casey@example.com"
2897
3037
  }
2898
3038
  },
2899
3039
  "ticket.deleted": {
2900
- "id": "CST-1024"
3040
+ "id": "tkt_UR8A3OR3Vshq"
2901
3041
  },
2902
3042
  "ticket.message_added": {
2903
3043
  "ticket": {
2904
- "id": "tkt_01H8X9YZ7E0J3K4M5N6P",
2905
- "dashboard_url": "https://www.cstar.help/team/acme/tickets?selected=tkt_01H8X9YZ7E0J3K4M5N6P"
3044
+ "id": "tkt_UR8A3OR3Vshq",
3045
+ "dashboard_url": "https://www.cstar.help/team/acme/tickets?selected=3d3c850d-b6ff-4117-9dea-87e8dc4ba108"
2906
3046
  },
2907
3047
  "message": {
2908
- "id": "msg_01H8X9YZ7E0J3K4M5N6R",
3048
+ "id": "msg_Hq2Lm8Xc4RtZ",
2909
3049
  "sender": "agent",
2910
3050
  "sender_name": "Riley",
3051
+ "message_type": "public",
2911
3052
  "content": "I just sent a reset link to your inbox. Let me know if it lands.",
2912
3053
  "created_at": "2026-04-27T18:55:02.000Z"
2913
3054
  },
2914
3055
  "customer": {
2915
- "id": "cus_01H8X9YZ7E0J3K4M5N6Q",
3056
+ "id": "cus_no9EfYa0dg5O",
2916
3057
  "name": "Casey Patel",
2917
3058
  "email": "casey@example.com"
2918
3059
  }
2919
3060
  },
2920
3061
  "ticket.updated": {
2921
3062
  "ticket": {
2922
- "id": "tkt_01H8X9YZ7E0J3K4M5N6P",
2923
- "prefixed_id": "CST-1024",
3063
+ "id": "tkt_UR8A3OR3Vshq",
2924
3064
  "title": "Cannot reset password",
2925
3065
  "status": "open",
2926
3066
  "priority": "high",
2927
- "channel": "widget"
3067
+ "channel": "widget",
3068
+ "tags": [
3069
+ "billing"
3070
+ ],
3071
+ "customer_id": "cus_no9EfYa0dg5O",
3072
+ "assigned_to": "550e8400-e29b-41d4-a716-446655440001",
3073
+ "dashboard_url": "https://www.cstar.help/team/acme/tickets?selected=3d3c850d-b6ff-4117-9dea-87e8dc4ba108",
3074
+ "created_at": "2026-04-27T18:42:11.000Z",
3075
+ "updated_at": "2026-04-27T18:50:02.000Z"
2928
3076
  },
2929
3077
  "changes": {
3078
+ "title": {
3079
+ "from": "Cannot reset password",
3080
+ "to": "Password reset link expired"
3081
+ },
3082
+ "status": {
3083
+ "from": "open",
3084
+ "to": "pending"
3085
+ },
2930
3086
  "priority": {
2931
3087
  "from": "normal",
2932
3088
  "to": "high"
2933
3089
  },
3090
+ "assigned_to": {
3091
+ "from": "550e8400-e29b-41d4-a716-446655440002",
3092
+ "to": "550e8400-e29b-41d4-a716-446655440001"
3093
+ },
2934
3094
  "tags": {
2935
3095
  "from": [
2936
- "bug"
3096
+ "billing"
2937
3097
  ],
2938
3098
  "to": [
2939
- "bug",
2940
- "feature-request"
3099
+ "billing",
3100
+ "urgent"
2941
3101
  ]
2942
3102
  }
2943
3103
  }
@@ -3016,7 +3176,7 @@ var CStarClient = class {
3016
3176
  this.ai = new AiResource(this._httpClient);
3017
3177
  this.views = new ViewsResource(this._httpClient);
3018
3178
  this.billing = new BillingResource(this._httpClient);
3019
- this.realtime = new CStarRealtime(this._httpClient);
3179
+ this.realtime = new CStarRealtime(this._httpClient, config.realtime);
3020
3180
  if (config.offline) {
3021
3181
  const queueOpts = typeof config.offline === "object" ? config.offline : void 0;
3022
3182
  this.offlineQueue = new OfflineQueue(this._httpClient, queueOpts);