zapry-openclaw-plugin 0.0.1

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/src/types.ts ADDED
@@ -0,0 +1,175 @@
1
+ export const DEFAULT_ACCOUNT_ID = "default";
2
+ export const DEFAULT_API_BASE_URL = "https://openapi-dev.mimo.immo";
3
+
4
+ export type ZapryAccountConfig = {
5
+ botToken?: string;
6
+ apiBaseUrl?: string;
7
+ mode?: "polling" | "webhook";
8
+ webhookUrl?: string;
9
+ enabled?: boolean;
10
+ name?: string;
11
+ dm?: {
12
+ policy?: string;
13
+ allowFrom?: string[];
14
+ };
15
+ };
16
+
17
+ export type ZapryChannelConfig = {
18
+ enabled?: boolean;
19
+ botToken?: string;
20
+ apiBaseUrl?: string;
21
+ mode?: "polling" | "webhook";
22
+ webhookUrl?: string;
23
+ accounts?: Record<string, ZapryAccountConfig>;
24
+ dm?: {
25
+ policy?: string;
26
+ allowFrom?: string[];
27
+ };
28
+ };
29
+
30
+ export type ResolvedZapryAccount = {
31
+ accountId: string;
32
+ name?: string;
33
+ enabled: boolean;
34
+ botToken: string;
35
+ tokenSource: "config" | "env";
36
+ config: {
37
+ apiBaseUrl: string;
38
+ mode: "polling" | "webhook";
39
+ webhookUrl?: string;
40
+ dm?: { policy?: string; allowFrom?: string[] };
41
+ };
42
+ };
43
+
44
+ export type ZapryApiResponse<T = unknown> = {
45
+ ok: boolean;
46
+ result?: T;
47
+ error_code?: number;
48
+ description?: string;
49
+ };
50
+
51
+ export type ZaprySendOpts = {
52
+ replyToMessageId?: string;
53
+ messageThreadId?: string;
54
+ replyMarkup?: unknown;
55
+ accountId?: string;
56
+ };
57
+
58
+ export type ZaprySendResult = {
59
+ ok: boolean;
60
+ messageId?: string;
61
+ error?: string;
62
+ };
63
+
64
+ // ── Profile Source (auto-sync to Zapry platform) ──
65
+
66
+ export type ProfileSourceSkill = {
67
+ skillKey: string;
68
+ skillVersion: string;
69
+ source: string;
70
+ path: string;
71
+ content: string;
72
+ sha256: string;
73
+ bytes: number;
74
+ };
75
+
76
+ export type ProfileSource = {
77
+ version: string;
78
+ source: string;
79
+ agentKey: string;
80
+ snapshotId: string;
81
+ soulMd: string;
82
+ skills: ProfileSourceSkill[];
83
+ };
84
+
85
+ export type DerivedProfile = {
86
+ name?: string;
87
+ role?: string;
88
+ vibe?: string;
89
+ emoji?: string;
90
+ avatar?: string;
91
+ tags?: string[];
92
+ summary?: string;
93
+ skills?: string[];
94
+ routeTags?: string[];
95
+ derivedVersion?: string;
96
+ derivedAt?: string;
97
+ overrideRevision?: number;
98
+ };
99
+
100
+ // ── Feed / Post (snake_case, 对齐 openapi-server 新响应格式) ──
101
+
102
+ export type PostComment = {
103
+ id: number;
104
+ user_id: number;
105
+ text: string;
106
+ time: number;
107
+ nick: string;
108
+ avatar: string;
109
+ type: number;
110
+ };
111
+
112
+ export type PostInfo = {
113
+ id: number;
114
+ user_id: number;
115
+ desc: string;
116
+ text: string;
117
+ media: string;
118
+ ctime: number;
119
+ nick: string;
120
+ avatar: string;
121
+ praise_count: number;
122
+ comment_count: number;
123
+ share_count: number;
124
+ can_share: number;
125
+ };
126
+
127
+ export type FeedItem = {
128
+ info: PostInfo;
129
+ comments: PostComment[];
130
+ };
131
+
132
+ export type FeedListResponse = {
133
+ items: FeedItem[];
134
+ pages: number;
135
+ };
136
+
137
+ export type CreatePostResponse = {
138
+ created: boolean;
139
+ dynamic_id: number;
140
+ };
141
+
142
+ // ── Chat History ──
143
+
144
+ export type ChatHistoryMessage = {
145
+ message_id: string;
146
+ from_id: string;
147
+ from_name?: string;
148
+ is_bot: boolean;
149
+ chat_id: string;
150
+ text?: string;
151
+ type: string;
152
+ timestamp: number;
153
+ media_url?: string;
154
+ };
155
+
156
+ export type ChatHistoryResponse = {
157
+ chat_id: string;
158
+ count: number;
159
+ messages: ChatHistoryMessage[];
160
+ };
161
+
162
+ // ── Profile ──
163
+
164
+ export type SetMyProfilePayload = {
165
+ profileSource: ProfileSource;
166
+ };
167
+
168
+ export type SetMyProfileResponse = {
169
+ ok: boolean;
170
+ unsupported_profile_source?: boolean;
171
+ derived?: {
172
+ snapshotId?: string;
173
+ profile?: DerivedProfile;
174
+ };
175
+ };