@newbase-clawchat/openclaw-clawchat 2026.5.12-2 → 2026.5.12-21

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 (99) hide show
  1. package/README.md +39 -17
  2. package/dist/index.js +3 -1
  3. package/dist/src/api-client.js +71 -12
  4. package/dist/src/api-types.test-d.js +10 -0
  5. package/dist/src/channel.js +5 -5
  6. package/dist/src/channel.setup.js +4 -17
  7. package/dist/src/clawchat-memory.js +290 -0
  8. package/dist/src/clawchat-metadata.js +235 -0
  9. package/dist/src/client.js +31 -93
  10. package/dist/src/commands.js +3 -3
  11. package/dist/src/config.js +58 -3
  12. package/dist/src/group-message-coalescer.js +107 -0
  13. package/dist/src/inbound.js +24 -28
  14. package/dist/src/login.runtime.js +82 -19
  15. package/dist/src/media-runtime.js +2 -3
  16. package/dist/src/message-mapper.js +1 -1
  17. package/dist/src/mock-transport.js +31 -0
  18. package/dist/src/outbound.js +281 -56
  19. package/dist/src/plugin-prompts.js +76 -0
  20. package/dist/src/profile-prompt.js +150 -0
  21. package/dist/src/profile-sync.js +169 -0
  22. package/dist/src/prompt-injection.js +25 -0
  23. package/dist/src/protocol-types.js +63 -0
  24. package/dist/src/protocol-types.typecheck.js +1 -0
  25. package/dist/src/protocol.js +2 -2
  26. package/dist/src/reply-dispatcher.js +143 -40
  27. package/dist/src/runtime.js +813 -109
  28. package/dist/src/storage.js +636 -0
  29. package/dist/src/tools-schema.js +70 -10
  30. package/dist/src/tools.js +600 -112
  31. package/dist/src/ws-alignment.js +8 -0
  32. package/dist/src/ws-client.js +588 -0
  33. package/index.ts +6 -1
  34. package/openclaw.plugin.json +44 -4
  35. package/package.json +4 -3
  36. package/prompts/platform.md +7 -0
  37. package/skills/clawchat/SKILL.md +90 -0
  38. package/src/api-client.test.ts +360 -15
  39. package/src/api-client.ts +127 -25
  40. package/src/api-types.test-d.ts +12 -0
  41. package/src/api-types.ts +71 -4
  42. package/src/buffered-stream.test.ts +1 -1
  43. package/src/buffered-stream.ts +1 -1
  44. package/src/channel.outbound.test.ts +270 -60
  45. package/src/channel.setup.ts +9 -18
  46. package/src/channel.test.ts +33 -25
  47. package/src/channel.ts +5 -7
  48. package/src/clawchat-memory.test.ts +372 -0
  49. package/src/clawchat-memory.ts +363 -0
  50. package/src/clawchat-metadata.test.ts +350 -0
  51. package/src/clawchat-metadata.ts +352 -0
  52. package/src/client.test.ts +57 -48
  53. package/src/client.ts +37 -129
  54. package/src/commands.test.ts +2 -2
  55. package/src/commands.ts +3 -3
  56. package/src/config.test.ts +169 -4
  57. package/src/config.ts +86 -6
  58. package/src/group-message-coalescer.test.ts +223 -0
  59. package/src/group-message-coalescer.ts +154 -0
  60. package/src/inbound.test.ts +106 -19
  61. package/src/inbound.ts +31 -35
  62. package/src/login.runtime.test.ts +294 -11
  63. package/src/login.runtime.ts +90 -21
  64. package/src/manifest.test.ts +86 -14
  65. package/src/media-runtime.test.ts +31 -2
  66. package/src/media-runtime.ts +7 -10
  67. package/src/message-mapper.test.ts +2 -2
  68. package/src/message-mapper.ts +2 -2
  69. package/src/mock-transport.test.ts +35 -0
  70. package/src/mock-transport.ts +38 -0
  71. package/src/outbound.test.ts +811 -95
  72. package/src/outbound.ts +332 -65
  73. package/src/plugin-entry.test.ts +3 -1
  74. package/src/plugin-prompts.test.ts +78 -0
  75. package/src/plugin-prompts.ts +92 -0
  76. package/src/profile-prompt.test.ts +435 -0
  77. package/src/profile-prompt.ts +208 -0
  78. package/src/profile-sync.test.ts +611 -0
  79. package/src/profile-sync.ts +268 -0
  80. package/src/prompt-injection.test.ts +39 -0
  81. package/src/prompt-injection.ts +45 -0
  82. package/src/protocol-types.test.ts +69 -0
  83. package/src/protocol-types.ts +296 -0
  84. package/src/protocol-types.typecheck.ts +89 -0
  85. package/src/protocol.ts +2 -2
  86. package/src/reply-dispatcher.test.ts +720 -135
  87. package/src/reply-dispatcher.ts +174 -42
  88. package/src/runtime.test.ts +3884 -337
  89. package/src/runtime.ts +956 -128
  90. package/src/storage.test.ts +692 -0
  91. package/src/storage.ts +989 -0
  92. package/src/streaming.test.ts +1 -1
  93. package/src/streaming.ts +1 -1
  94. package/src/tools-schema.ts +115 -13
  95. package/src/tools.test.ts +501 -10
  96. package/src/tools.ts +739 -133
  97. package/src/ws-alignment.ts +9 -0
  98. package/src/ws-client.test.ts +1218 -0
  99. package/src/ws-client.ts +662 -0
@@ -1,4 +1,4 @@
1
- import type { ClawlingChatClient } from "@newbase-clawchat/sdk";
1
+ import type { ClawlingChatClient } from "./ws-client.ts";
2
2
  import { describe, expect, it, vi } from "vitest";
3
3
  import { sendStreamingText } from "./streaming.ts";
4
4
 
package/src/streaming.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ClawlingChatClient } from "@newbase-clawchat/sdk";
1
+ import type { ClawlingChatClient } from "./ws-client.ts";
2
2
  import {
3
3
  emitStreamAdd,
4
4
  emitStreamCreated,
@@ -1,5 +1,98 @@
1
1
  import { Type, type Static } from "@sinclair/typebox";
2
2
 
3
+ const targetProperties = {
4
+ targetType: Type.Union([Type.Literal("owner"), Type.Literal("user"), Type.Literal("group")], {
5
+ description: "Explicit ClawChat memory target type.",
6
+ }),
7
+ targetId: Type.String({
8
+ minLength: 1,
9
+ description: "Explicit target id. Use owner for owner targets. Do not infer ids from names.",
10
+ }),
11
+ };
12
+
13
+ const ClawchatMetadataPatchSchema = Type.Object(
14
+ {
15
+ nickname: Type.Optional(Type.String()),
16
+ avatar_url: Type.Optional(Type.String()),
17
+ bio: Type.Optional(Type.String()),
18
+ behavior: Type.Optional(Type.String()),
19
+ title: Type.Optional(Type.String()),
20
+ description: Type.Optional(Type.String()),
21
+ },
22
+ { additionalProperties: false, minProperties: 1 },
23
+ );
24
+
25
+ const readBoundsProperties = {
26
+ offset: Type.Optional(
27
+ Type.Integer({
28
+ minimum: 0,
29
+ description: "Zero-based content offset. Default 0.",
30
+ }),
31
+ ),
32
+ limit: Type.Optional(
33
+ Type.Integer({
34
+ minimum: 1,
35
+ maximum: 100000,
36
+ description: "Maximum returned characters. Default 20000, max 100000.",
37
+ }),
38
+ ),
39
+ };
40
+
41
+ export const ClawchatMemoryReadSchema = Type.Object(
42
+ { ...targetProperties, ...readBoundsProperties },
43
+ { additionalProperties: false },
44
+ );
45
+ export type ClawchatMemoryReadParams = Static<typeof ClawchatMemoryReadSchema>;
46
+
47
+ const memoryWriteProperties = {
48
+ mode: Type.Union([Type.Literal("append"), Type.Literal("replace")]),
49
+ content: Type.String({
50
+ description: "Markdown body content. Append requires non-empty content; replace may be empty.",
51
+ }),
52
+ };
53
+
54
+ export const ClawchatMemoryWriteSchema = Type.Object(
55
+ { ...targetProperties, ...memoryWriteProperties },
56
+ { additionalProperties: false },
57
+ );
58
+ export type ClawchatMemoryWriteParams = Static<typeof ClawchatMemoryWriteSchema>;
59
+
60
+ const memoryEditProperties = {
61
+ oldText: Type.String({
62
+ minLength: 1,
63
+ description: "Existing body text span to replace. Must match exactly once.",
64
+ }),
65
+ newText: Type.String({
66
+ description: "Replacement body text.",
67
+ }),
68
+ };
69
+
70
+ export const ClawchatMemoryEditSchema = Type.Object(
71
+ { ...targetProperties, ...memoryEditProperties },
72
+ { additionalProperties: false },
73
+ );
74
+ export type ClawchatMemoryEditParams = Static<typeof ClawchatMemoryEditSchema>;
75
+
76
+ const metadataSyncProperties = {
77
+ direction: Type.Union([Type.Literal("pull"), Type.Literal("push")]),
78
+ fields: Type.Optional(Type.Array(Type.String({ minLength: 1 }), {
79
+ minItems: 1,
80
+ description: "Required for direction=push. Push only these local metadata fields.",
81
+ })),
82
+ };
83
+
84
+ export const ClawchatMetadataSyncSchema = Type.Object(
85
+ { ...targetProperties, ...metadataSyncProperties },
86
+ { additionalProperties: false },
87
+ );
88
+ export type ClawchatMetadataSyncParams = Static<typeof ClawchatMetadataSyncSchema>;
89
+
90
+ export const ClawchatMetadataUpdateSchema = Type.Object(
91
+ { ...targetProperties, patch: ClawchatMetadataPatchSchema },
92
+ { additionalProperties: false },
93
+ );
94
+ export type ClawchatMetadataUpdateParams = Static<typeof ClawchatMetadataUpdateSchema>;
95
+
3
96
  export const ClawchatGetAccountProfileSchema = Type.Object({});
4
97
  export type ClawchatGetAccountProfileParams = Static<typeof ClawchatGetAccountProfileSchema>;
5
98
 
@@ -11,38 +104,47 @@ export const ClawchatGetUserProfileSchema = Type.Object({
11
104
  });
12
105
  export type ClawchatGetUserProfileParams = Static<typeof ClawchatGetUserProfileSchema>;
13
106
 
14
- export const ClawchatListAccountFriendsSchema = Type.Object({
15
- page: Type.Optional(
16
- Type.Integer({
17
- minimum: 1,
18
- description: "1-based page number for the agent's connected ClawChat account friends (default 1)",
107
+ export const ClawchatListAccountFriendsSchema = Type.Object({});
108
+ export type ClawchatListAccountFriendsParams = Static<typeof ClawchatListAccountFriendsSchema>;
109
+
110
+ export const ClawchatSearchUsersSchema = Type.Object({
111
+ q: Type.Optional(
112
+ Type.String({
113
+ description: "Search query for ClawChat username or nickname",
19
114
  }),
20
115
  ),
21
- pageSize: Type.Optional(
116
+ limit: Type.Optional(
22
117
  Type.Integer({
23
118
  minimum: 1,
24
119
  maximum: 100,
25
- description: "Page size 1..100 for the agent's ClawChat-platform contacts (default 20)",
120
+ description: "Max results (default 20)",
26
121
  }),
27
122
  ),
28
123
  });
29
- export type ClawchatListAccountFriendsParams = Static<typeof ClawchatListAccountFriendsSchema>;
124
+ export type ClawchatSearchUsersParams = Static<typeof ClawchatSearchUsersSchema>;
30
125
 
31
- export const ClawchatSearchUsersSchema = Type.Object({
32
- q: Type.Optional(
126
+ export const ClawchatListConversationsSchema = Type.Object({
127
+ before: Type.Optional(
33
128
  Type.String({
34
- description: "Search query for ClawChat username or nickname",
129
+ description: "Cursor; return conversations before this value",
35
130
  }),
36
131
  ),
37
132
  limit: Type.Optional(
38
133
  Type.Integer({
39
134
  minimum: 1,
40
135
  maximum: 100,
41
- description: "Max results (default 20)",
136
+ description: "Max conversations to return",
42
137
  }),
43
138
  ),
44
139
  });
45
- export type ClawchatSearchUsersParams = Static<typeof ClawchatSearchUsersSchema>;
140
+ export type ClawchatListConversationsParams = Static<typeof ClawchatListConversationsSchema>;
141
+
142
+ export const ClawchatGetConversationSchema = Type.Object({
143
+ conversationId: Type.String({
144
+ description: "Concrete ClawChat conversation id to fetch",
145
+ }),
146
+ });
147
+ export type ClawchatGetConversationParams = Static<typeof ClawchatGetConversationSchema>;
46
148
 
47
149
  export const ClawchatListMomentsSchema = Type.Object({
48
150
  before: Type.Optional(