@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.
- package/README.md +39 -17
- package/dist/index.js +3 -1
- package/dist/src/api-client.js +71 -12
- package/dist/src/api-types.test-d.js +10 -0
- package/dist/src/channel.js +5 -5
- package/dist/src/channel.setup.js +4 -17
- package/dist/src/clawchat-memory.js +290 -0
- package/dist/src/clawchat-metadata.js +235 -0
- package/dist/src/client.js +31 -93
- package/dist/src/commands.js +3 -3
- package/dist/src/config.js +58 -3
- package/dist/src/group-message-coalescer.js +107 -0
- package/dist/src/inbound.js +24 -28
- package/dist/src/login.runtime.js +82 -19
- package/dist/src/media-runtime.js +2 -3
- package/dist/src/message-mapper.js +1 -1
- package/dist/src/mock-transport.js +31 -0
- package/dist/src/outbound.js +281 -56
- package/dist/src/plugin-prompts.js +76 -0
- package/dist/src/profile-prompt.js +150 -0
- package/dist/src/profile-sync.js +169 -0
- package/dist/src/prompt-injection.js +25 -0
- package/dist/src/protocol-types.js +63 -0
- package/dist/src/protocol-types.typecheck.js +1 -0
- package/dist/src/protocol.js +2 -2
- package/dist/src/reply-dispatcher.js +143 -40
- package/dist/src/runtime.js +813 -109
- package/dist/src/storage.js +636 -0
- package/dist/src/tools-schema.js +70 -10
- package/dist/src/tools.js +600 -112
- package/dist/src/ws-alignment.js +8 -0
- package/dist/src/ws-client.js +588 -0
- package/index.ts +6 -1
- package/openclaw.plugin.json +44 -4
- package/package.json +4 -3
- package/prompts/platform.md +7 -0
- package/skills/clawchat/SKILL.md +90 -0
- package/src/api-client.test.ts +360 -15
- package/src/api-client.ts +127 -25
- package/src/api-types.test-d.ts +12 -0
- package/src/api-types.ts +71 -4
- package/src/buffered-stream.test.ts +1 -1
- package/src/buffered-stream.ts +1 -1
- package/src/channel.outbound.test.ts +270 -60
- package/src/channel.setup.ts +9 -18
- package/src/channel.test.ts +33 -25
- package/src/channel.ts +5 -7
- package/src/clawchat-memory.test.ts +372 -0
- package/src/clawchat-memory.ts +363 -0
- package/src/clawchat-metadata.test.ts +350 -0
- package/src/clawchat-metadata.ts +352 -0
- package/src/client.test.ts +57 -48
- package/src/client.ts +37 -129
- package/src/commands.test.ts +2 -2
- package/src/commands.ts +3 -3
- package/src/config.test.ts +169 -4
- package/src/config.ts +86 -6
- package/src/group-message-coalescer.test.ts +223 -0
- package/src/group-message-coalescer.ts +154 -0
- package/src/inbound.test.ts +106 -19
- package/src/inbound.ts +31 -35
- package/src/login.runtime.test.ts +294 -11
- package/src/login.runtime.ts +90 -21
- package/src/manifest.test.ts +86 -14
- package/src/media-runtime.test.ts +31 -2
- package/src/media-runtime.ts +7 -10
- package/src/message-mapper.test.ts +2 -2
- package/src/message-mapper.ts +2 -2
- package/src/mock-transport.test.ts +35 -0
- package/src/mock-transport.ts +38 -0
- package/src/outbound.test.ts +811 -95
- package/src/outbound.ts +332 -65
- package/src/plugin-entry.test.ts +3 -1
- package/src/plugin-prompts.test.ts +78 -0
- package/src/plugin-prompts.ts +92 -0
- package/src/profile-prompt.test.ts +435 -0
- package/src/profile-prompt.ts +208 -0
- package/src/profile-sync.test.ts +611 -0
- package/src/profile-sync.ts +268 -0
- package/src/prompt-injection.test.ts +39 -0
- package/src/prompt-injection.ts +45 -0
- package/src/protocol-types.test.ts +69 -0
- package/src/protocol-types.ts +296 -0
- package/src/protocol-types.typecheck.ts +89 -0
- package/src/protocol.ts +2 -2
- package/src/reply-dispatcher.test.ts +720 -135
- package/src/reply-dispatcher.ts +174 -42
- package/src/runtime.test.ts +3884 -337
- package/src/runtime.ts +956 -128
- package/src/storage.test.ts +692 -0
- package/src/storage.ts +989 -0
- package/src/streaming.test.ts +1 -1
- package/src/streaming.ts +1 -1
- package/src/tools-schema.ts +115 -13
- package/src/tools.test.ts +501 -10
- package/src/tools.ts +739 -133
- package/src/ws-alignment.ts +9 -0
- package/src/ws-client.test.ts +1218 -0
- package/src/ws-client.ts +662 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ConnectPayload,
|
|
3
|
+
EmptyPayload,
|
|
4
|
+
Envelope,
|
|
5
|
+
Fragment,
|
|
6
|
+
MessagePayload,
|
|
7
|
+
OfflineBatchPayload,
|
|
8
|
+
ProtocolFragment,
|
|
9
|
+
Sender,
|
|
10
|
+
StreamAddPayload,
|
|
11
|
+
StreamDonePayload,
|
|
12
|
+
} from "./protocol-types.ts";
|
|
13
|
+
|
|
14
|
+
type Assert<T extends true> = T;
|
|
15
|
+
type IsAssignable<From, To> = [From] extends [To] ? true : false;
|
|
16
|
+
type IsEqual<Actual, Expected> =
|
|
17
|
+
(<T>() => T extends Actual ? 1 : 2) extends <T>() => T extends Expected ? 1 : 2
|
|
18
|
+
? true
|
|
19
|
+
: false;
|
|
20
|
+
type Not<T extends boolean> = T extends true ? false : true;
|
|
21
|
+
|
|
22
|
+
type _SenderRequiresType = Assert<
|
|
23
|
+
Not<IsAssignable<{ id: string; nick_name: string }, Sender>>
|
|
24
|
+
>;
|
|
25
|
+
|
|
26
|
+
type _MaterializedMessageIdMayBeOmittedOnUplink = Assert<
|
|
27
|
+
IsAssignable<
|
|
28
|
+
{ message_mode: string; message: MessagePayload["message"] },
|
|
29
|
+
MessagePayload
|
|
30
|
+
>
|
|
31
|
+
>;
|
|
32
|
+
|
|
33
|
+
type _KnownTextFragmentRequiresText = Assert<
|
|
34
|
+
Not<IsAssignable<{ kind: "text" }, Fragment>>
|
|
35
|
+
>;
|
|
36
|
+
|
|
37
|
+
type _KnownMentionFragmentRequiresUserId = Assert<
|
|
38
|
+
Not<IsAssignable<{ kind: "mention" }, Fragment>>
|
|
39
|
+
>;
|
|
40
|
+
|
|
41
|
+
type _UnknownWireFragmentsAreRepresentable = Assert<
|
|
42
|
+
IsAssignable<{ kind: "sticker"; sticker_id: string }, ProtocolFragment>
|
|
43
|
+
>;
|
|
44
|
+
|
|
45
|
+
type _MaterializedMessageBodyUsesWireFragments = Assert<
|
|
46
|
+
IsEqual<MessagePayload["message"]["body"]["fragments"], Fragment[]>
|
|
47
|
+
>;
|
|
48
|
+
|
|
49
|
+
type _MaterializedMessageRejectsMalformedKnownFragments = Assert<
|
|
50
|
+
Not<
|
|
51
|
+
IsAssignable<
|
|
52
|
+
{
|
|
53
|
+
message_mode: string;
|
|
54
|
+
message: {
|
|
55
|
+
body: { fragments: [{ kind: "text" }] };
|
|
56
|
+
context: MessagePayload["message"]["context"];
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
MessagePayload
|
|
60
|
+
>
|
|
61
|
+
>
|
|
62
|
+
>;
|
|
63
|
+
|
|
64
|
+
type _StreamCompletionUsesWireFragments = Assert<
|
|
65
|
+
IsEqual<StreamDonePayload["fragments"], Fragment[]>
|
|
66
|
+
>;
|
|
67
|
+
|
|
68
|
+
type _StreamCompletionPayloadIsFlat = Assert<
|
|
69
|
+
Not<"message" extends keyof StreamDonePayload ? true : false>
|
|
70
|
+
>;
|
|
71
|
+
|
|
72
|
+
type _ConnectPayloadAllowsCanonicalMinimum = Assert<
|
|
73
|
+
IsAssignable<{ token: string; nonce: string }, ConnectPayload>
|
|
74
|
+
>;
|
|
75
|
+
|
|
76
|
+
type _StreamAddPayloadAllowsCanonicalMinimum = Assert<
|
|
77
|
+
IsAssignable<
|
|
78
|
+
{ message_id: string; sequence: number; fragments: Fragment[] },
|
|
79
|
+
StreamAddPayload
|
|
80
|
+
>
|
|
81
|
+
>;
|
|
82
|
+
|
|
83
|
+
type _OfflineBatchPayloadCarriesEnvelopes = Assert<
|
|
84
|
+
IsAssignable<{ batch_id: number; items: Envelope[]; remaining: number }, OfflineBatchPayload>
|
|
85
|
+
>;
|
|
86
|
+
|
|
87
|
+
type _ControlPayloadsAreEmptyObjects = Assert<
|
|
88
|
+
IsAssignable<Record<string, never>, EmptyPayload>
|
|
89
|
+
>;
|
package/src/protocol.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Local narrow guards for inbound protocol envelopes.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* payload to `
|
|
4
|
+
* Raw client events hand us `Envelope<unknown>`. Before casting the
|
|
5
|
+
* payload to `MessagePayload` we run these cheap structural checks
|
|
6
6
|
* so runtime errors surface as skipped messages, not crashes.
|
|
7
7
|
*/
|
|
8
8
|
|