@stellaris/metrics-shared 0.1.7 → 0.1.8

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 CHANGED
@@ -901,9 +901,22 @@ declare const app: import("hono/hono-base").HonoBase<{}, {
901
901
  eventType: "reply-message";
902
902
  payload: {
903
903
  [x: string]: unknown;
904
- platform: string;
904
+ mallId: string;
905
+ shopId: string;
906
+ userId: string;
905
907
  uid: string;
906
- userId?: string | undefined;
908
+ messageId: string;
909
+ content: string;
910
+ aiAgentConfigId: number;
911
+ host: string;
912
+ platformCode: string;
913
+ ignoreTransferred: boolean;
914
+ tbUid?: string | undefined;
915
+ msgId?: string | undefined;
916
+ procState?: string | undefined;
917
+ transferReason?: string | undefined;
918
+ messageType?: "specialSceneTransfer" | undefined;
919
+ orderRemark?: string | undefined;
907
920
  };
908
921
  message?: string | null | undefined;
909
922
  timestamp?: number | undefined;
@@ -915,9 +928,11 @@ declare const app: import("hono/hono-base").HonoBase<{}, {
915
928
  eventType: "change-cs-status";
916
929
  payload: {
917
930
  [x: string]: unknown;
918
- platform: string;
919
- uid: string;
920
- userId?: string | undefined;
931
+ aiAgentConfigId: number;
932
+ host: string;
933
+ status: 3 | 1 | 2;
934
+ platformCode?: string | undefined;
935
+ taskId?: string | undefined;
921
936
  };
922
937
  message?: string | null | undefined;
923
938
  timestamp?: number | undefined;
@@ -935,19 +950,6 @@ declare const app: import("hono/hono-base").HonoBase<{}, {
935
950
  message?: string | null | undefined;
936
951
  timestamp?: number | undefined;
937
952
  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;
951
953
  };
952
954
  };
953
955
  output: {
@@ -2168,9 +2170,22 @@ declare const app: import("hono/hono-base").HonoBase<{}, {
2168
2170
  eventType: "reply-message";
2169
2171
  payload: {
2170
2172
  [x: string]: unknown;
2171
- platform: string;
2173
+ mallId: string;
2174
+ shopId: string;
2175
+ userId: string;
2172
2176
  uid: string;
2173
- userId?: string | undefined;
2177
+ messageId: string;
2178
+ content: string;
2179
+ aiAgentConfigId: number;
2180
+ host: string;
2181
+ platformCode: string;
2182
+ ignoreTransferred: boolean;
2183
+ tbUid?: string | undefined;
2184
+ msgId?: string | undefined;
2185
+ procState?: string | undefined;
2186
+ transferReason?: string | undefined;
2187
+ messageType?: "specialSceneTransfer" | undefined;
2188
+ orderRemark?: string | undefined;
2174
2189
  };
2175
2190
  message?: string | null | undefined;
2176
2191
  timestamp?: number | undefined;
@@ -2182,9 +2197,11 @@ declare const app: import("hono/hono-base").HonoBase<{}, {
2182
2197
  eventType: "change-cs-status";
2183
2198
  payload: {
2184
2199
  [x: string]: unknown;
2185
- platform: string;
2186
- uid: string;
2187
- userId?: string | undefined;
2200
+ aiAgentConfigId: number;
2201
+ host: string;
2202
+ status: 3 | 1 | 2;
2203
+ platformCode?: string | undefined;
2204
+ taskId?: string | undefined;
2188
2205
  };
2189
2206
  message?: string | null | undefined;
2190
2207
  timestamp?: number | undefined;
@@ -2202,19 +2219,6 @@ declare const app: import("hono/hono-base").HonoBase<{}, {
2202
2219
  message?: string | null | undefined;
2203
2220
  timestamp?: number | undefined;
2204
2221
  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;
2218
2222
  };
2219
2223
  };
2220
2224
  output: {
@@ -2236,9 +2240,22 @@ declare const app: import("hono/hono-base").HonoBase<{}, {
2236
2240
  eventType: "reply-message";
2237
2241
  payload: {
2238
2242
  [x: string]: unknown;
2239
- platform: string;
2243
+ mallId: string;
2244
+ shopId: string;
2245
+ userId: string;
2240
2246
  uid: string;
2241
- userId?: string | undefined;
2247
+ messageId: string;
2248
+ content: string;
2249
+ aiAgentConfigId: number;
2250
+ host: string;
2251
+ platformCode: string;
2252
+ ignoreTransferred: boolean;
2253
+ tbUid?: string | undefined;
2254
+ msgId?: string | undefined;
2255
+ procState?: string | undefined;
2256
+ transferReason?: string | undefined;
2257
+ messageType?: "specialSceneTransfer" | undefined;
2258
+ orderRemark?: string | undefined;
2242
2259
  };
2243
2260
  message?: string | null | undefined;
2244
2261
  timestamp?: number | undefined;
@@ -2250,9 +2267,11 @@ declare const app: import("hono/hono-base").HonoBase<{}, {
2250
2267
  eventType: "change-cs-status";
2251
2268
  payload: {
2252
2269
  [x: string]: unknown;
2253
- platform: string;
2254
- uid: string;
2255
- userId?: string | undefined;
2270
+ aiAgentConfigId: number;
2271
+ host: string;
2272
+ status: 3 | 1 | 2;
2273
+ platformCode?: string | undefined;
2274
+ taskId?: string | undefined;
2256
2275
  };
2257
2276
  message?: string | null | undefined;
2258
2277
  timestamp?: number | undefined;
@@ -2270,19 +2289,6 @@ declare const app: import("hono/hono-base").HonoBase<{}, {
2270
2289
  message?: string | null | undefined;
2271
2290
  timestamp?: number | undefined;
2272
2291
  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;
2286
2292
  })[];
2287
2293
  };
2288
2294
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stellaris/metrics-shared",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "type": "module",
5
5
  "main": "./index.ts",
6
6
  "types": "./index.ts",
@@ -1,5 +1,19 @@
1
1
  import z from "zod";
2
2
 
3
+ /**
4
+ * 消息场景类型
5
+ */
6
+ export const messageSceneTypeSchema = z.literal("specialSceneTransfer");
7
+
8
+ /**
9
+ * 客服状态枚举
10
+ */
11
+ export const csStatusSchema = z.union([
12
+ z.literal(1),
13
+ z.literal(2),
14
+ z.literal(3),
15
+ ]);
16
+
3
17
  // RPA 事件基础字段
4
18
  export const rpaEventBaseSchema = z.object({
5
19
  shopId: z.string(),
@@ -14,9 +28,22 @@ export const rpaEventBaseSchema = z.object({
14
28
  export const replyMessageEventSchema = rpaEventBaseSchema.extend({
15
29
  eventType: z.literal("reply-message"),
16
30
  payload: z.looseObject({
17
- platform: z.string(),
31
+ mallId: z.string(),
32
+ shopId: z.string(),
33
+ userId: z.string(),
18
34
  uid: z.string(),
19
- userId: z.string().optional(),
35
+ messageId: z.string(),
36
+ content: z.string(),
37
+ aiAgentConfigId: z.number(),
38
+ host: z.string(),
39
+ platformCode: z.string(),
40
+ tbUid: z.string().optional(),
41
+ msgId: z.string().optional(),
42
+ procState: z.string().optional(),
43
+ transferReason: z.string().optional(),
44
+ messageType: messageSceneTypeSchema.optional(),
45
+ orderRemark: z.string().optional(),
46
+ ignoreTransferred: z.boolean(),
20
47
  }),
21
48
  });
22
49
 
@@ -24,9 +51,11 @@ export const replyMessageEventSchema = rpaEventBaseSchema.extend({
24
51
  export const changeCsStatusEventSchema = rpaEventBaseSchema.extend({
25
52
  eventType: z.literal("change-cs-status"),
26
53
  payload: z.looseObject({
27
- platform: z.string(),
28
- uid: z.string(),
29
- userId: z.string().optional(),
54
+ aiAgentConfigId: z.number(),
55
+ host: z.string(),
56
+ status: csStatusSchema,
57
+ platformCode: z.string().optional(),
58
+ taskId: z.string().optional(),
30
59
  }),
31
60
  });
32
61
 
@@ -40,22 +69,11 @@ export const userMessageEventSchema = rpaEventBaseSchema.extend({
40
69
  }),
41
70
  });
42
71
 
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
-
53
72
  // RPA 事件 Schema (Discriminated Union)
54
73
  export const rpaEventSchema = z.discriminatedUnion("eventType", [
55
74
  replyMessageEventSchema,
56
75
  changeCsStatusEventSchema,
57
76
  userMessageEventSchema,
58
- handoffToHumanEventSchema,
59
77
  ]);
60
78
 
61
79
  export type RpaEvent = z.infer<typeof rpaEventSchema>;