@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 +70 -0
- package/dist/index.d.cts +315 -29
- package/dist/index.d.ts +315 -29
- package/dist/index.js +70 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -250,6 +250,40 @@ var chatDeliveryStateSchema = z2.enum([
|
|
|
250
250
|
"timeout",
|
|
251
251
|
"cancelled"
|
|
252
252
|
]);
|
|
253
|
+
var chatAttachmentStateSchema = z2.object({
|
|
254
|
+
supported: z2.boolean(),
|
|
255
|
+
status: z2.enum([
|
|
256
|
+
"unsupported",
|
|
257
|
+
"available",
|
|
258
|
+
"selected",
|
|
259
|
+
"uploading",
|
|
260
|
+
"scanning",
|
|
261
|
+
"ready",
|
|
262
|
+
"failed",
|
|
263
|
+
"rejected"
|
|
264
|
+
]),
|
|
265
|
+
maxBytes: z2.number().nullable().optional(),
|
|
266
|
+
acceptedMimeTypes: z2.array(z2.string()).optional(),
|
|
267
|
+
reason: z2.string().optional()
|
|
268
|
+
});
|
|
269
|
+
var chatTimelineEntrySchema = z2.object({
|
|
270
|
+
messageId: z2.string(),
|
|
271
|
+
kind: z2.enum([
|
|
272
|
+
"user",
|
|
273
|
+
"assistant",
|
|
274
|
+
"system",
|
|
275
|
+
"tool",
|
|
276
|
+
"payment",
|
|
277
|
+
"delivery",
|
|
278
|
+
"error"
|
|
279
|
+
]),
|
|
280
|
+
content: z2.string(),
|
|
281
|
+
timestamp: z2.string(),
|
|
282
|
+
deliveryState: chatDeliveryStateSchema.optional(),
|
|
283
|
+
errorCode: z2.string().optional(),
|
|
284
|
+
metadata: z2.record(jsonValueSchema).optional(),
|
|
285
|
+
attachment: chatAttachmentStateSchema.optional()
|
|
286
|
+
});
|
|
253
287
|
var chatReadinessStatusSchema = z2.enum([
|
|
254
288
|
"responsive",
|
|
255
289
|
"delivery_only",
|
|
@@ -347,6 +381,17 @@ var chatReadinessResponseSchema = z2.object({
|
|
|
347
381
|
details: z2.string().optional()
|
|
348
382
|
}).optional()
|
|
349
383
|
});
|
|
384
|
+
var chatSessionResumeResponseSchema = z2.object({
|
|
385
|
+
sessionId: z2.string(),
|
|
386
|
+
uaid: z2.string().nullable().optional(),
|
|
387
|
+
agentUrl: z2.string().nullable().optional(),
|
|
388
|
+
route: chatRouteSummarySchema,
|
|
389
|
+
transport: z2.string(),
|
|
390
|
+
history: z2.array(chatHistoryEntrySchema),
|
|
391
|
+
historyTtlSeconds: z2.number().optional(),
|
|
392
|
+
visibility: z2.enum(["private", "public"]).optional(),
|
|
393
|
+
state: chatSessionStateSchema
|
|
394
|
+
});
|
|
350
395
|
var metadataFacetSchema = z2.record(
|
|
351
396
|
z2.union([
|
|
352
397
|
z2.array(jsonValueSchema),
|
|
@@ -3056,6 +3101,7 @@ function createChatApi(client, encryptedManager) {
|
|
|
3056
3101
|
start: (options) => client.startChat(options),
|
|
3057
3102
|
readiness: (payload) => client.checkChatReadiness(payload),
|
|
3058
3103
|
createSession: (payload) => client.createSession(payload),
|
|
3104
|
+
resumeSession: (sessionId) => client.resumeSession(sessionId),
|
|
3059
3105
|
sendMessage: (payload) => client.sendMessage(payload),
|
|
3060
3106
|
retryMessage: (messageId, payload) => client.retryMessage(messageId, payload),
|
|
3061
3107
|
cancelSession: (sessionId) => client.cancelSession(sessionId),
|
|
@@ -3083,6 +3129,9 @@ async function checkChatReadiness(client, payload) {
|
|
|
3083
3129
|
if (agentUrl) {
|
|
3084
3130
|
body.agentUrl = agentUrl;
|
|
3085
3131
|
}
|
|
3132
|
+
if (payload.forceRefresh !== void 0) {
|
|
3133
|
+
body.forceRefresh = payload.forceRefresh;
|
|
3134
|
+
}
|
|
3086
3135
|
const raw = await client.requestJson("/chat/readiness", {
|
|
3087
3136
|
method: "POST",
|
|
3088
3137
|
body,
|
|
@@ -3117,6 +3166,9 @@ async function createSession(client, payload, allowHistoryAutoTopUp = true) {
|
|
|
3117
3166
|
if (payload.visibility) {
|
|
3118
3167
|
body.visibility = payload.visibility;
|
|
3119
3168
|
}
|
|
3169
|
+
if (payload.idempotencyKey) {
|
|
3170
|
+
body.idempotencyKey = payload.idempotencyKey;
|
|
3171
|
+
}
|
|
3120
3172
|
try {
|
|
3121
3173
|
const raw = await client.requestJson("/chat/session", {
|
|
3122
3174
|
method: "POST",
|
|
@@ -3137,6 +3189,21 @@ async function createSession(client, payload, allowHistoryAutoTopUp = true) {
|
|
|
3137
3189
|
throw error;
|
|
3138
3190
|
}
|
|
3139
3191
|
}
|
|
3192
|
+
async function resumeSession(client, sessionId) {
|
|
3193
|
+
const normalized = sessionId.trim();
|
|
3194
|
+
if (!normalized) {
|
|
3195
|
+
throw new Error("sessionId is required to resume a chat session");
|
|
3196
|
+
}
|
|
3197
|
+
const raw = await client.requestJson(
|
|
3198
|
+
`/chat/session/${encodeURIComponent(normalized)}/resume`,
|
|
3199
|
+
{ method: "GET" }
|
|
3200
|
+
);
|
|
3201
|
+
return client.parseWithSchema(
|
|
3202
|
+
raw,
|
|
3203
|
+
chatSessionResumeResponseSchema,
|
|
3204
|
+
"chat session resume response"
|
|
3205
|
+
);
|
|
3206
|
+
}
|
|
3140
3207
|
async function startChat(client, encryptedManager, options) {
|
|
3141
3208
|
if ("uaid" in options && options.uaid) {
|
|
3142
3209
|
return startConversation(client, encryptedManager, {
|
|
@@ -7216,6 +7283,9 @@ var RegistryBrokerClient = class _RegistryBrokerClient {
|
|
|
7216
7283
|
async createSession(payload, allowHistoryAutoTopUp = true) {
|
|
7217
7284
|
return createSession(this, payload, allowHistoryAutoTopUp);
|
|
7218
7285
|
}
|
|
7286
|
+
async resumeSession(sessionId) {
|
|
7287
|
+
return resumeSession(this, sessionId);
|
|
7288
|
+
}
|
|
7219
7289
|
async checkChatReadiness(payload) {
|
|
7220
7290
|
return checkChatReadiness(this, payload);
|
|
7221
7291
|
}
|