@stellaris/metrics-shared 0.1.6 → 0.1.7
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/bff-service.d.ts +140 -43
- package/package.json +1 -1
- package/schemas/rpa-event.ts +22 -2
package/bff-service.d.ts
CHANGED
|
@@ -899,17 +899,29 @@ declare const app: import("hono/hono-base").HonoBase<{}, {
|
|
|
899
899
|
agentConfigId: string;
|
|
900
900
|
stage: "success" | "queued" | "executing" | "failed";
|
|
901
901
|
eventType: "reply-message";
|
|
902
|
-
payload:
|
|
902
|
+
payload: {
|
|
903
|
+
[x: string]: unknown;
|
|
904
|
+
platform: string;
|
|
905
|
+
uid: string;
|
|
906
|
+
userId?: string | undefined;
|
|
907
|
+
};
|
|
903
908
|
message?: string | null | undefined;
|
|
904
909
|
timestamp?: number | undefined;
|
|
910
|
+
sequence?: number | undefined;
|
|
905
911
|
} | {
|
|
906
912
|
shopId: string;
|
|
907
913
|
agentConfigId: string;
|
|
908
914
|
stage: "success" | "queued" | "executing" | "failed";
|
|
909
915
|
eventType: "change-cs-status";
|
|
910
|
-
payload:
|
|
916
|
+
payload: {
|
|
917
|
+
[x: string]: unknown;
|
|
918
|
+
platform: string;
|
|
919
|
+
uid: string;
|
|
920
|
+
userId?: string | undefined;
|
|
921
|
+
};
|
|
911
922
|
message?: string | null | undefined;
|
|
912
923
|
timestamp?: number | undefined;
|
|
924
|
+
sequence?: number | undefined;
|
|
913
925
|
} | {
|
|
914
926
|
shopId: string;
|
|
915
927
|
agentConfigId: string;
|
|
@@ -922,6 +934,20 @@ declare const app: import("hono/hono-base").HonoBase<{}, {
|
|
|
922
934
|
};
|
|
923
935
|
message?: string | null | undefined;
|
|
924
936
|
timestamp?: number | undefined;
|
|
937
|
+
sequence?: number | undefined;
|
|
938
|
+
} | {
|
|
939
|
+
shopId: string;
|
|
940
|
+
agentConfigId: string;
|
|
941
|
+
stage: "success" | "queued" | "executing" | "failed";
|
|
942
|
+
eventType: "handoff-to-human";
|
|
943
|
+
payload: {
|
|
944
|
+
platform: string;
|
|
945
|
+
userId: string;
|
|
946
|
+
uid: string;
|
|
947
|
+
};
|
|
948
|
+
message?: string | null | undefined;
|
|
949
|
+
timestamp?: number | undefined;
|
|
950
|
+
sequence?: number | undefined;
|
|
925
951
|
};
|
|
926
952
|
};
|
|
927
953
|
output: {
|
|
@@ -2140,17 +2166,29 @@ declare const app: import("hono/hono-base").HonoBase<{}, {
|
|
|
2140
2166
|
agentConfigId: string;
|
|
2141
2167
|
stage: "success" | "queued" | "executing" | "failed";
|
|
2142
2168
|
eventType: "reply-message";
|
|
2143
|
-
payload:
|
|
2169
|
+
payload: {
|
|
2170
|
+
[x: string]: unknown;
|
|
2171
|
+
platform: string;
|
|
2172
|
+
uid: string;
|
|
2173
|
+
userId?: string | undefined;
|
|
2174
|
+
};
|
|
2144
2175
|
message?: string | null | undefined;
|
|
2145
2176
|
timestamp?: number | undefined;
|
|
2177
|
+
sequence?: number | undefined;
|
|
2146
2178
|
} | {
|
|
2147
2179
|
shopId: string;
|
|
2148
2180
|
agentConfigId: string;
|
|
2149
2181
|
stage: "success" | "queued" | "executing" | "failed";
|
|
2150
2182
|
eventType: "change-cs-status";
|
|
2151
|
-
payload:
|
|
2183
|
+
payload: {
|
|
2184
|
+
[x: string]: unknown;
|
|
2185
|
+
platform: string;
|
|
2186
|
+
uid: string;
|
|
2187
|
+
userId?: string | undefined;
|
|
2188
|
+
};
|
|
2152
2189
|
message?: string | null | undefined;
|
|
2153
2190
|
timestamp?: number | undefined;
|
|
2191
|
+
sequence?: number | undefined;
|
|
2154
2192
|
} | {
|
|
2155
2193
|
shopId: string;
|
|
2156
2194
|
agentConfigId: string;
|
|
@@ -2163,11 +2201,24 @@ declare const app: import("hono/hono-base").HonoBase<{}, {
|
|
|
2163
2201
|
};
|
|
2164
2202
|
message?: string | null | undefined;
|
|
2165
2203
|
timestamp?: number | undefined;
|
|
2204
|
+
sequence?: number | undefined;
|
|
2205
|
+
} | {
|
|
2206
|
+
shopId: string;
|
|
2207
|
+
agentConfigId: string;
|
|
2208
|
+
stage: "success" | "queued" | "executing" | "failed";
|
|
2209
|
+
eventType: "handoff-to-human";
|
|
2210
|
+
payload: {
|
|
2211
|
+
platform: string;
|
|
2212
|
+
userId: string;
|
|
2213
|
+
uid: string;
|
|
2214
|
+
};
|
|
2215
|
+
message?: string | null | undefined;
|
|
2216
|
+
timestamp?: number | undefined;
|
|
2217
|
+
sequence?: number | undefined;
|
|
2166
2218
|
};
|
|
2167
2219
|
};
|
|
2168
2220
|
output: {
|
|
2169
2221
|
success: true;
|
|
2170
|
-
clients: number;
|
|
2171
2222
|
};
|
|
2172
2223
|
outputFormat: "json";
|
|
2173
2224
|
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
@@ -2183,17 +2234,29 @@ declare const app: import("hono/hono-base").HonoBase<{}, {
|
|
|
2183
2234
|
agentConfigId: string;
|
|
2184
2235
|
stage: "success" | "queued" | "executing" | "failed";
|
|
2185
2236
|
eventType: "reply-message";
|
|
2186
|
-
payload:
|
|
2237
|
+
payload: {
|
|
2238
|
+
[x: string]: unknown;
|
|
2239
|
+
platform: string;
|
|
2240
|
+
uid: string;
|
|
2241
|
+
userId?: string | undefined;
|
|
2242
|
+
};
|
|
2187
2243
|
message?: string | null | undefined;
|
|
2188
2244
|
timestamp?: number | undefined;
|
|
2245
|
+
sequence?: number | undefined;
|
|
2189
2246
|
} | {
|
|
2190
2247
|
shopId: string;
|
|
2191
2248
|
agentConfigId: string;
|
|
2192
2249
|
stage: "success" | "queued" | "executing" | "failed";
|
|
2193
2250
|
eventType: "change-cs-status";
|
|
2194
|
-
payload:
|
|
2251
|
+
payload: {
|
|
2252
|
+
[x: string]: unknown;
|
|
2253
|
+
platform: string;
|
|
2254
|
+
uid: string;
|
|
2255
|
+
userId?: string | undefined;
|
|
2256
|
+
};
|
|
2195
2257
|
message?: string | null | undefined;
|
|
2196
2258
|
timestamp?: number | undefined;
|
|
2259
|
+
sequence?: number | undefined;
|
|
2197
2260
|
} | {
|
|
2198
2261
|
shopId: string;
|
|
2199
2262
|
agentConfigId: string;
|
|
@@ -2206,72 +2269,106 @@ declare const app: import("hono/hono-base").HonoBase<{}, {
|
|
|
2206
2269
|
};
|
|
2207
2270
|
message?: string | null | undefined;
|
|
2208
2271
|
timestamp?: number | undefined;
|
|
2272
|
+
sequence?: number | undefined;
|
|
2273
|
+
} | {
|
|
2274
|
+
shopId: string;
|
|
2275
|
+
agentConfigId: string;
|
|
2276
|
+
stage: "success" | "queued" | "executing" | "failed";
|
|
2277
|
+
eventType: "handoff-to-human";
|
|
2278
|
+
payload: {
|
|
2279
|
+
platform: string;
|
|
2280
|
+
userId: string;
|
|
2281
|
+
uid: string;
|
|
2282
|
+
};
|
|
2283
|
+
message?: string | null | undefined;
|
|
2284
|
+
timestamp?: number | undefined;
|
|
2285
|
+
sequence?: number | undefined;
|
|
2209
2286
|
})[];
|
|
2210
2287
|
};
|
|
2211
2288
|
};
|
|
2212
2289
|
output: {
|
|
2213
2290
|
success: true;
|
|
2214
2291
|
count: number;
|
|
2215
|
-
clients: number;
|
|
2216
2292
|
};
|
|
2217
2293
|
outputFormat: "json";
|
|
2218
2294
|
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
2219
2295
|
};
|
|
2220
2296
|
};
|
|
2221
|
-
}
|
|
2297
|
+
}, "/api/rpa-events"> | import("hono/types").MergeSchemaPath<{
|
|
2222
2298
|
"/recent": {
|
|
2223
2299
|
$get: {
|
|
2224
|
-
input: {
|
|
2300
|
+
input: {
|
|
2301
|
+
query: {
|
|
2302
|
+
shopId: string | string[];
|
|
2303
|
+
limit?: string | string[] | undefined;
|
|
2304
|
+
};
|
|
2305
|
+
};
|
|
2225
2306
|
output: {
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
eventType: "change-cs-status";
|
|
2241
|
-
payload: {
|
|
2242
|
-
[x: string]: import("hono/utils/types").JSONValue;
|
|
2243
|
-
};
|
|
2244
|
-
message?: string | null | undefined;
|
|
2245
|
-
timestamp?: number | undefined;
|
|
2246
|
-
} | {
|
|
2307
|
+
error: string;
|
|
2308
|
+
};
|
|
2309
|
+
outputFormat: "json";
|
|
2310
|
+
status: 400;
|
|
2311
|
+
} | {
|
|
2312
|
+
input: {
|
|
2313
|
+
query: {
|
|
2314
|
+
shopId: string | string[];
|
|
2315
|
+
limit?: string | string[] | undefined;
|
|
2316
|
+
};
|
|
2317
|
+
};
|
|
2318
|
+
output: {
|
|
2319
|
+
sessions: {
|
|
2320
|
+
sessionId: string;
|
|
2247
2321
|
shopId: string;
|
|
2248
2322
|
agentConfigId: string;
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
}
|
|
2323
|
+
platform: string;
|
|
2324
|
+
uid: string;
|
|
2325
|
+
userId: string;
|
|
2326
|
+
status: "active";
|
|
2327
|
+
lastEventType: string;
|
|
2328
|
+
lastStage: string;
|
|
2329
|
+
lastEventSeq: number;
|
|
2330
|
+
lastEventAt: number;
|
|
2331
|
+
lastMessage?: string | null | undefined;
|
|
2332
|
+
}[];
|
|
2259
2333
|
total: number;
|
|
2334
|
+
totalByShop: {
|
|
2335
|
+
[x: string]: number;
|
|
2336
|
+
};
|
|
2337
|
+
snapshotSeqByShop: {
|
|
2338
|
+
[x: string]: number;
|
|
2339
|
+
};
|
|
2260
2340
|
};
|
|
2261
2341
|
outputFormat: "json";
|
|
2262
2342
|
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
2343
|
+
} | {
|
|
2344
|
+
input: {
|
|
2345
|
+
query: {
|
|
2346
|
+
shopId: string | string[];
|
|
2347
|
+
limit?: string | string[] | undefined;
|
|
2348
|
+
};
|
|
2349
|
+
};
|
|
2350
|
+
output: {
|
|
2351
|
+
error: string;
|
|
2352
|
+
};
|
|
2353
|
+
outputFormat: "json";
|
|
2354
|
+
status: 500;
|
|
2263
2355
|
};
|
|
2264
2356
|
};
|
|
2265
2357
|
} & {
|
|
2266
2358
|
"/stream": {
|
|
2267
2359
|
$get: {
|
|
2268
|
-
input: {
|
|
2360
|
+
input: {
|
|
2361
|
+
query: {
|
|
2362
|
+
shopId: string | string[];
|
|
2363
|
+
limit?: string | string[] | undefined;
|
|
2364
|
+
};
|
|
2365
|
+
};
|
|
2269
2366
|
output: {};
|
|
2270
2367
|
outputFormat: string;
|
|
2271
2368
|
status: import("hono/utils/http-status").StatusCode;
|
|
2272
2369
|
};
|
|
2273
2370
|
};
|
|
2274
|
-
}, "/api/rpa-
|
|
2371
|
+
}, "/api/rpa-sessions">, "/", "/health">;
|
|
2275
2372
|
export type AppType = typeof app;
|
|
2276
2373
|
|
|
2277
2374
|
export {
|
package/package.json
CHANGED
package/schemas/rpa-event.ts
CHANGED
|
@@ -7,18 +7,27 @@ export const rpaEventBaseSchema = z.object({
|
|
|
7
7
|
stage: z.enum(["queued", "executing", "success", "failed"]),
|
|
8
8
|
message: z.string().nullable().optional(),
|
|
9
9
|
timestamp: z.number().optional(),
|
|
10
|
+
sequence: z.number().int().optional(),
|
|
10
11
|
});
|
|
11
12
|
|
|
12
13
|
// 回复消息事件
|
|
13
14
|
export const replyMessageEventSchema = rpaEventBaseSchema.extend({
|
|
14
15
|
eventType: z.literal("reply-message"),
|
|
15
|
-
payload: z.
|
|
16
|
+
payload: z.looseObject({
|
|
17
|
+
platform: z.string(),
|
|
18
|
+
uid: z.string(),
|
|
19
|
+
userId: z.string().optional(),
|
|
20
|
+
}),
|
|
16
21
|
});
|
|
17
22
|
|
|
18
23
|
// 变更客服状态事件
|
|
19
24
|
export const changeCsStatusEventSchema = rpaEventBaseSchema.extend({
|
|
20
25
|
eventType: z.literal("change-cs-status"),
|
|
21
|
-
payload: z.
|
|
26
|
+
payload: z.looseObject({
|
|
27
|
+
platform: z.string(),
|
|
28
|
+
uid: z.string(),
|
|
29
|
+
userId: z.string().optional(),
|
|
30
|
+
}),
|
|
22
31
|
});
|
|
23
32
|
|
|
24
33
|
// 用户消息事件
|
|
@@ -31,11 +40,22 @@ export const userMessageEventSchema = rpaEventBaseSchema.extend({
|
|
|
31
40
|
}),
|
|
32
41
|
});
|
|
33
42
|
|
|
43
|
+
// 转接人工成功事件
|
|
44
|
+
export const handoffToHumanEventSchema = rpaEventBaseSchema.extend({
|
|
45
|
+
eventType: z.literal("handoff-to-human"),
|
|
46
|
+
payload: z.object({
|
|
47
|
+
platform: z.string(),
|
|
48
|
+
userId: z.string(),
|
|
49
|
+
uid: z.string(),
|
|
50
|
+
}),
|
|
51
|
+
});
|
|
52
|
+
|
|
34
53
|
// RPA 事件 Schema (Discriminated Union)
|
|
35
54
|
export const rpaEventSchema = z.discriminatedUnion("eventType", [
|
|
36
55
|
replyMessageEventSchema,
|
|
37
56
|
changeCsStatusEventSchema,
|
|
38
57
|
userMessageEventSchema,
|
|
58
|
+
handoffToHumanEventSchema,
|
|
39
59
|
]);
|
|
40
60
|
|
|
41
61
|
export type RpaEvent = z.infer<typeof rpaEventSchema>;
|