@hol-org/rb-client 0.1.182 → 0.1.183

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
@@ -311,6 +311,40 @@ var chatDeliveryStateSchema = import_zod2.z.enum([
311
311
  "timeout",
312
312
  "cancelled"
313
313
  ]);
314
+ var chatAttachmentStateSchema = import_zod2.z.object({
315
+ supported: import_zod2.z.boolean(),
316
+ status: import_zod2.z.enum([
317
+ "unsupported",
318
+ "available",
319
+ "selected",
320
+ "uploading",
321
+ "scanning",
322
+ "ready",
323
+ "failed",
324
+ "rejected"
325
+ ]),
326
+ maxBytes: import_zod2.z.number().nullable().optional(),
327
+ acceptedMimeTypes: import_zod2.z.array(import_zod2.z.string()).optional(),
328
+ reason: import_zod2.z.string().optional()
329
+ });
330
+ var chatTimelineEntrySchema = import_zod2.z.object({
331
+ messageId: import_zod2.z.string(),
332
+ kind: import_zod2.z.enum([
333
+ "user",
334
+ "assistant",
335
+ "system",
336
+ "tool",
337
+ "payment",
338
+ "delivery",
339
+ "error"
340
+ ]),
341
+ content: import_zod2.z.string(),
342
+ timestamp: import_zod2.z.string(),
343
+ deliveryState: chatDeliveryStateSchema.optional(),
344
+ errorCode: import_zod2.z.string().optional(),
345
+ metadata: import_zod2.z.record(jsonValueSchema).optional(),
346
+ attachment: chatAttachmentStateSchema.optional()
347
+ });
314
348
  var chatReadinessStatusSchema = import_zod2.z.enum([
315
349
  "responsive",
316
350
  "delivery_only",
@@ -408,6 +442,17 @@ var chatReadinessResponseSchema = import_zod2.z.object({
408
442
  details: import_zod2.z.string().optional()
409
443
  }).optional()
410
444
  });
445
+ var chatSessionResumeResponseSchema = import_zod2.z.object({
446
+ sessionId: import_zod2.z.string(),
447
+ uaid: import_zod2.z.string().nullable().optional(),
448
+ agentUrl: import_zod2.z.string().nullable().optional(),
449
+ route: chatRouteSummarySchema,
450
+ transport: import_zod2.z.string(),
451
+ history: import_zod2.z.array(chatHistoryEntrySchema),
452
+ historyTtlSeconds: import_zod2.z.number().optional(),
453
+ visibility: import_zod2.z.enum(["private", "public"]).optional(),
454
+ state: chatSessionStateSchema
455
+ });
411
456
  var metadataFacetSchema = import_zod2.z.record(
412
457
  import_zod2.z.union([
413
458
  import_zod2.z.array(jsonValueSchema),
@@ -3117,6 +3162,7 @@ function createChatApi(client, encryptedManager) {
3117
3162
  start: (options) => client.startChat(options),
3118
3163
  readiness: (payload) => client.checkChatReadiness(payload),
3119
3164
  createSession: (payload) => client.createSession(payload),
3165
+ resumeSession: (sessionId) => client.resumeSession(sessionId),
3120
3166
  sendMessage: (payload) => client.sendMessage(payload),
3121
3167
  retryMessage: (messageId, payload) => client.retryMessage(messageId, payload),
3122
3168
  cancelSession: (sessionId) => client.cancelSession(sessionId),
@@ -3144,6 +3190,9 @@ async function checkChatReadiness(client, payload) {
3144
3190
  if (agentUrl) {
3145
3191
  body.agentUrl = agentUrl;
3146
3192
  }
3193
+ if (payload.forceRefresh !== void 0) {
3194
+ body.forceRefresh = payload.forceRefresh;
3195
+ }
3147
3196
  const raw = await client.requestJson("/chat/readiness", {
3148
3197
  method: "POST",
3149
3198
  body,
@@ -3178,6 +3227,9 @@ async function createSession(client, payload, allowHistoryAutoTopUp = true) {
3178
3227
  if (payload.visibility) {
3179
3228
  body.visibility = payload.visibility;
3180
3229
  }
3230
+ if (payload.idempotencyKey) {
3231
+ body.idempotencyKey = payload.idempotencyKey;
3232
+ }
3181
3233
  try {
3182
3234
  const raw = await client.requestJson("/chat/session", {
3183
3235
  method: "POST",
@@ -3198,6 +3250,21 @@ async function createSession(client, payload, allowHistoryAutoTopUp = true) {
3198
3250
  throw error;
3199
3251
  }
3200
3252
  }
3253
+ async function resumeSession(client, sessionId) {
3254
+ const normalized = sessionId.trim();
3255
+ if (!normalized) {
3256
+ throw new Error("sessionId is required to resume a chat session");
3257
+ }
3258
+ const raw = await client.requestJson(
3259
+ `/chat/session/${encodeURIComponent(normalized)}/resume`,
3260
+ { method: "GET" }
3261
+ );
3262
+ return client.parseWithSchema(
3263
+ raw,
3264
+ chatSessionResumeResponseSchema,
3265
+ "chat session resume response"
3266
+ );
3267
+ }
3201
3268
  async function startChat(client, encryptedManager, options) {
3202
3269
  if ("uaid" in options && options.uaid) {
3203
3270
  return startConversation(client, encryptedManager, {
@@ -7278,6 +7345,9 @@ var RegistryBrokerClient = class _RegistryBrokerClient {
7278
7345
  async createSession(payload, allowHistoryAutoTopUp = true) {
7279
7346
  return createSession(this, payload, allowHistoryAutoTopUp);
7280
7347
  }
7348
+ async resumeSession(sessionId) {
7349
+ return resumeSession(this, sessionId);
7350
+ }
7281
7351
  async checkChatReadiness(payload) {
7282
7352
  return checkChatReadiness(this, payload);
7283
7353
  }