@xpert-ai/plugin-community-wechat 0.1.0

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.
Files changed (69) hide show
  1. package/README.md +353 -0
  2. package/dist/index.d.ts +20 -0
  3. package/dist/index.js +139 -0
  4. package/dist/lib/constants.d.ts +23 -0
  5. package/dist/lib/constants.js +23 -0
  6. package/dist/lib/conversation-user-key.d.ts +13 -0
  7. package/dist/lib/conversation-user-key.js +28 -0
  8. package/dist/lib/conversation.service.d.ts +215 -0
  9. package/dist/lib/conversation.service.js +1179 -0
  10. package/dist/lib/decorators.d.ts +2 -0
  11. package/dist/lib/decorators.js +3 -0
  12. package/dist/lib/entities/index.d.ts +4 -0
  13. package/dist/lib/entities/index.js +4 -0
  14. package/dist/lib/entities/wechat-personal-account.entity.d.ts +19 -0
  15. package/dist/lib/entities/wechat-personal-account.entity.js +83 -0
  16. package/dist/lib/entities/wechat-personal-conversation-binding.entity.d.ts +14 -0
  17. package/dist/lib/entities/wechat-personal-conversation-binding.entity.js +65 -0
  18. package/dist/lib/entities/wechat-personal-message-log.entity.d.ts +27 -0
  19. package/dist/lib/entities/wechat-personal-message-log.entity.js +108 -0
  20. package/dist/lib/entities/wechat-personal-trigger-binding.entity.d.ts +17 -0
  21. package/dist/lib/entities/wechat-personal-trigger-binding.entity.js +71 -0
  22. package/dist/lib/handoff/index.d.ts +4 -0
  23. package/dist/lib/handoff/index.js +4 -0
  24. package/dist/lib/handoff/wechat-personal-chat-callback.processor.d.ts +26 -0
  25. package/dist/lib/handoff/wechat-personal-chat-callback.processor.js +312 -0
  26. package/dist/lib/handoff/wechat-personal-chat-dispatch.service.d.ts +26 -0
  27. package/dist/lib/handoff/wechat-personal-chat-dispatch.service.js +187 -0
  28. package/dist/lib/handoff/wechat-personal-chat-run-state.service.d.ts +21 -0
  29. package/dist/lib/handoff/wechat-personal-chat-run-state.service.js +39 -0
  30. package/dist/lib/handoff/wechat-personal-chat.types.d.ts +69 -0
  31. package/dist/lib/handoff/wechat-personal-chat.types.js +2 -0
  32. package/dist/lib/message.d.ts +49 -0
  33. package/dist/lib/message.js +64 -0
  34. package/dist/lib/remote-components/wechat-personal-workbench/app.js +1831 -0
  35. package/dist/lib/tokens.d.ts +1 -0
  36. package/dist/lib/tokens.js +1 -0
  37. package/dist/lib/types.d.ts +48 -0
  38. package/dist/lib/types.js +365 -0
  39. package/dist/lib/views/wechat-personal-view.provider.d.ts +17 -0
  40. package/dist/lib/views/wechat-personal-view.provider.js +441 -0
  41. package/dist/lib/wechat-personal-channel.strategy.d.ts +33 -0
  42. package/dist/lib/wechat-personal-channel.strategy.js +197 -0
  43. package/dist/lib/wechat-personal-integration.strategy.d.ts +56 -0
  44. package/dist/lib/wechat-personal-integration.strategy.js +217 -0
  45. package/dist/lib/wechat-personal.client.d.ts +29 -0
  46. package/dist/lib/wechat-personal.client.js +146 -0
  47. package/dist/lib/wechat-personal.controller.d.ts +50 -0
  48. package/dist/lib/wechat-personal.controller.js +270 -0
  49. package/dist/lib/wechat-personal.middleware.d.ts +20 -0
  50. package/dist/lib/wechat-personal.middleware.js +267 -0
  51. package/dist/lib/wechat-personal.plugin.d.ts +2 -0
  52. package/dist/lib/wechat-personal.plugin.js +58 -0
  53. package/dist/lib/wechat-personal.templates.d.ts +2 -0
  54. package/dist/lib/wechat-personal.templates.js +100 -0
  55. package/dist/lib/workflow/index.d.ts +5 -0
  56. package/dist/lib/workflow/index.js +5 -0
  57. package/dist/lib/workflow/wechat-personal-trigger-aggregation.service.d.ts +10 -0
  58. package/dist/lib/workflow/wechat-personal-trigger-aggregation.service.js +39 -0
  59. package/dist/lib/workflow/wechat-personal-trigger-aggregation.types.d.ts +30 -0
  60. package/dist/lib/workflow/wechat-personal-trigger-aggregation.types.js +2 -0
  61. package/dist/lib/workflow/wechat-personal-trigger-flush.processor.d.ts +8 -0
  62. package/dist/lib/workflow/wechat-personal-trigger-flush.processor.js +39 -0
  63. package/dist/lib/workflow/wechat-personal-trigger.strategy.d.ts +65 -0
  64. package/dist/lib/workflow/wechat-personal-trigger.strategy.js +511 -0
  65. package/dist/lib/workflow/wechat-personal-trigger.types.d.ts +10 -0
  66. package/dist/lib/workflow/wechat-personal-trigger.types.js +2 -0
  67. package/dist/xpert-wechat-personal-admin-assistant.yaml +103 -0
  68. package/dist/xpert-wechat-personal-user-assistant.yaml +127 -0
  69. package/package.json +79 -0
@@ -0,0 +1,49 @@
1
+ import { Serializable } from '@langchain/core/load/serializable';
2
+ import { IChatMessage } from '@xpert-ai/contracts';
3
+ import type { WechatPersonalChannelStrategy } from './wechat-personal-channel.strategy.js';
4
+ export type WechatPersonalMessageStatus = IChatMessage['status'] | 'thinking' | 'continuing' | 'waiting' | 'done' | 'end' | 'error';
5
+ type WechatPersonalMessageChannel = Pick<WechatPersonalChannelStrategy, 'sendTextByIntegrationId'>;
6
+ export interface WechatPersonalMessageFields {
7
+ id?: string;
8
+ messageId?: string;
9
+ status?: WechatPersonalMessageStatus;
10
+ language?: string;
11
+ }
12
+ type WechatPersonalMessageContext = {
13
+ integrationId: string;
14
+ uuid: string;
15
+ contactId: string;
16
+ chatType?: 'private' | 'group';
17
+ senderId?: string;
18
+ ownerWxid?: string;
19
+ atUsers?: string[];
20
+ wechatChannel: WechatPersonalMessageChannel;
21
+ };
22
+ export declare class WechatPersonalMessage extends Serializable implements Required<WechatPersonalMessageFields> {
23
+ private readonly chatContext;
24
+ lc_namespace: string[];
25
+ lc_serializable: boolean;
26
+ get lc_attributes(): {
27
+ status: WechatPersonalMessageStatus;
28
+ id: string;
29
+ messageId: string;
30
+ language: string;
31
+ };
32
+ id: string;
33
+ messageId: string;
34
+ status: WechatPersonalMessageStatus;
35
+ language: string;
36
+ constructor(chatContext: WechatPersonalMessageContext, options?: WechatPersonalMessageFields);
37
+ get integrationId(): string;
38
+ get uuid(): string;
39
+ get contactId(): string;
40
+ get chatType(): "private" | "group";
41
+ get senderId(): string;
42
+ get ownerWxid(): string;
43
+ update(options: {
44
+ status?: WechatPersonalMessageStatus;
45
+ text?: string;
46
+ }): Promise<void>;
47
+ reply(content: string): Promise<void>;
48
+ }
49
+ export {};
@@ -0,0 +1,64 @@
1
+ import { Serializable } from '@langchain/core/load/serializable';
2
+ export class WechatPersonalMessage extends Serializable {
3
+ get lc_attributes() {
4
+ return {
5
+ status: this.status,
6
+ id: this.id,
7
+ messageId: this.messageId,
8
+ language: this.language
9
+ };
10
+ }
11
+ constructor(chatContext, options) {
12
+ super(options || {});
13
+ this.chatContext = chatContext;
14
+ this.lc_namespace = ['wechat-personal'];
15
+ this.lc_serializable = true;
16
+ this.id = null;
17
+ this.messageId = null;
18
+ this.status = 'thinking';
19
+ this.language = null;
20
+ this.id = options?.id || null;
21
+ this.messageId = options?.messageId || null;
22
+ this.status = options?.status || 'thinking';
23
+ this.language = options?.language || null;
24
+ }
25
+ get integrationId() {
26
+ return this.chatContext.integrationId;
27
+ }
28
+ get uuid() {
29
+ return this.chatContext.uuid;
30
+ }
31
+ get contactId() {
32
+ return this.chatContext.contactId;
33
+ }
34
+ get chatType() {
35
+ return this.chatContext.chatType;
36
+ }
37
+ get senderId() {
38
+ return this.chatContext.senderId;
39
+ }
40
+ get ownerWxid() {
41
+ return this.chatContext.ownerWxid;
42
+ }
43
+ async update(options) {
44
+ if (options.status) {
45
+ this.status = options.status;
46
+ }
47
+ if (options.text) {
48
+ await this.reply(options.text);
49
+ }
50
+ }
51
+ async reply(content) {
52
+ const result = await this.chatContext.wechatChannel.sendTextByIntegrationId(this.integrationId, {
53
+ uuid: this.uuid,
54
+ contactId: this.contactId,
55
+ content,
56
+ atUsers: this.chatContext.atUsers
57
+ });
58
+ if (!result.success) {
59
+ throw new Error(result.error || 'Failed to send WeChat personal message');
60
+ }
61
+ this.id = result.messageId || this.id;
62
+ this.messageId = result.messageId || this.messageId;
63
+ }
64
+ }