@nextclaw/ncp-toolkit 0.4.14 → 0.4.15
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/dist/index.d.ts +2 -0
- package/dist/index.js +7 -4
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ declare class DefaultNcpAgentConversationStateManager implements NcpAgentConvers
|
|
|
17
17
|
reset: () => void;
|
|
18
18
|
hydrate: (payload: NcpAgentConversationHydrationParams) => void;
|
|
19
19
|
dispatch: (event: NcpEndpointEvent) => Promise<void>;
|
|
20
|
+
dispatchBatch: (events: readonly NcpEndpointEvent[]) => Promise<void>;
|
|
21
|
+
private applyEvent;
|
|
20
22
|
handleMessageSent: (payload: NcpMessageSentPayload) => void;
|
|
21
23
|
handleMessageAbort: (payload: NcpMessageAbortPayload) => void;
|
|
22
24
|
handleMessageTextStart: (payload: NcpTextStartPayload) => void;
|
package/dist/index.js
CHANGED
|
@@ -151,8 +151,14 @@ var DefaultNcpAgentConversationStateManager = class {
|
|
|
151
151
|
this.stateVersion += 1;
|
|
152
152
|
this.notifyListeners();
|
|
153
153
|
};
|
|
154
|
-
dispatch =
|
|
154
|
+
dispatch = (event) => this.dispatchBatch([event]);
|
|
155
|
+
dispatchBatch = async (events) => {
|
|
156
|
+
if (!events.length) return;
|
|
155
157
|
const versionBeforeDispatch = this.stateVersion;
|
|
158
|
+
events.forEach(this.applyEvent);
|
|
159
|
+
if (this.stateVersion !== versionBeforeDispatch) this.notifyListeners();
|
|
160
|
+
};
|
|
161
|
+
applyEvent = (event) => {
|
|
156
162
|
switch (event.type) {
|
|
157
163
|
case NcpEventType.MessageSent:
|
|
158
164
|
this.handleMessageSent(event.payload);
|
|
@@ -211,9 +217,6 @@ var DefaultNcpAgentConversationStateManager = class {
|
|
|
211
217
|
default:
|
|
212
218
|
break;
|
|
213
219
|
}
|
|
214
|
-
if (this.stateVersion !== versionBeforeDispatch) {
|
|
215
|
-
this.notifyListeners();
|
|
216
|
-
}
|
|
217
220
|
};
|
|
218
221
|
handleMessageSent = (payload) => {
|
|
219
222
|
this.upsertMessage(payload.message);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextclaw/ncp-toolkit",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.15",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Toolkit implementations built on top of the NextClaw Communication Protocol.",
|
|
6
6
|
"type": "module",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@nextclaw/ncp": "0.4.
|
|
18
|
+
"@nextclaw/ncp": "0.4.6"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/node": "^20.17.6",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"tsup": "^8.3.5",
|
|
24
24
|
"typescript": "^5.6.3",
|
|
25
25
|
"vitest": "^4.1.2",
|
|
26
|
-
"@nextclaw/ncp-agent-runtime": "0.3.
|
|
26
|
+
"@nextclaw/ncp-agent-runtime": "0.3.6"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
29
|
"build": "tsup src/index.ts --format esm --dts --out-dir dist",
|