@crossworks/client-types 0.232.335 → 0.232.336

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crossworks/client-types",
3
- "version": "0.232.335",
3
+ "version": "0.232.336",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
package/src/dto/client.ts CHANGED
@@ -224,3 +224,44 @@ export type ClientSigninSenderPreview = {
224
224
  /** Why an admin's sender choice was refused (the 4xx `reason`). */
225
225
  export type ClientSenderRefusedReason =
226
226
  'account-not-found' | 'account-cannot-send' | 'no-sent-folder' | 'folders-unreadable';
227
+
228
+ // ── Client chat (client logins C4) ───────────────────────────────────────
229
+
230
+ /** One message of a client's own chat thread. */
231
+ export type ClientChatMessage = {
232
+ id: string;
233
+ direction: 'inbound' | 'outbound';
234
+ text: string;
235
+ status: 'pending' | 'complete' | 'failed';
236
+ failed: boolean;
237
+ createdAt: string;
238
+ };
239
+
240
+ /** GET /api/client/chat[?before=ISO]: the client's own thread with the
241
+ * client-responder, newest page first (50 a page). `agent` null = the chat
242
+ * is not open (no enabled client-level client-responder): the dock says so
243
+ * and offers no input. Poll it (every few seconds while a reply is pending):
244
+ * there is no live stream for clients. */
245
+ export type ClientChatThread = {
246
+ agent: { name: string } | null;
247
+ messages: ClientChatMessage[];
248
+ };
249
+
250
+ /** POST /api/client/chat { text } -> 202: the turn is queued; the reply
251
+ * lands in the thread. A retry with the same Idempotency-Key is the same
252
+ * turn. */
253
+ export type ClientChatQueued = { turnId: string };
254
+
255
+ /** Why a client chat send was refused (the 4xx `reason`): 409 `chat-closed`
256
+ * (no client-level agent), 409 `idempotency-key-reused`, 429 `rate-limited`
257
+ * (6 a minute), 429 `daily_cap` or `token_budget` (the member caps, per
258
+ * client login per UTC day). */
259
+ export type ClientChatRefusedReason =
260
+ 'chat-closed' | 'idempotency-key-reused' | 'rate-limited' | 'daily_cap' | 'token_budget';
261
+
262
+ /** GET /api/team-admin/clients/usage: each client login's chat use today
263
+ * (UTC) against the caps every client login has (the member caps). */
264
+ export type ClientChatUsage = {
265
+ limits: { dailyTurns: number; dailyTokens: number };
266
+ rows: { loginId: string; turnsToday: number; tokensToday: number }[];
267
+ };
package/src/dto/rows.ts CHANGED
@@ -560,6 +560,10 @@ export type TeamRequest = {
560
560
  contactName: string | null;
561
561
  /** When the owner last posted a resolution to the member for this request. */
562
562
  notifiedAt: string | null;
563
+ /** True for a request a CLIENT login filed through the client-responder
564
+ * (client logins C4, 0.232.336 on): the reply still goes into that
565
+ * login's thread. Absent on older brains = a member's request. */
566
+ fromClient?: boolean;
563
567
  };
564
568
 
565
569
  /** The newest thing waiting in one "needs you" queue: its title and who it
package/src/index.ts CHANGED
@@ -118,6 +118,11 @@ export type {
118
118
  } from './dto/logins';
119
119
  export type {
120
120
  ClientAdminRefusedReason,
121
+ ClientChatMessage,
122
+ ClientChatQueued,
123
+ ClientChatRefusedReason,
124
+ ClientChatThread,
125
+ ClientChatUsage,
121
126
  ClientLinkSignIn,
122
127
  ClientCodeAvailability,
123
128
  ClientCodeRequested,