@nextclaw/ncp-toolkit 0.5.18 → 0.5.20
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 +10 -1
- package/dist/index.js +12 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -78,7 +78,6 @@ type RuntimeFactoryParams = {
|
|
|
78
78
|
agentId?: string;
|
|
79
79
|
stateManager: NcpAgentConversationStateManager;
|
|
80
80
|
sessionMetadata: Record<string, unknown>;
|
|
81
|
-
setSessionMetadata: (nextMetadata: Record<string, unknown>) => void;
|
|
82
81
|
resolveAssetContentPath?: (assetUri: string) => string | null;
|
|
83
82
|
resolveTools?: (input: NcpAgentRunInput) => ReadonlyArray<OpenAITool> | undefined;
|
|
84
83
|
};
|
|
@@ -125,6 +124,11 @@ interface AgentSessionStore {
|
|
|
125
124
|
event: NcpEndpointEvent;
|
|
126
125
|
updatedAt: string;
|
|
127
126
|
}): Promise<void>;
|
|
127
|
+
setSessionMetadata(params: {
|
|
128
|
+
sessionId: string;
|
|
129
|
+
metadata: Record<string, unknown>;
|
|
130
|
+
updatedAt: string;
|
|
131
|
+
}): Promise<boolean>;
|
|
128
132
|
updateSessionMetadata(params: {
|
|
129
133
|
sessionId: string;
|
|
130
134
|
metadata: Record<string, unknown>;
|
|
@@ -140,6 +144,11 @@ declare class InMemoryAgentSessionStore implements AgentSessionStore {
|
|
|
140
144
|
getSession: (sessionId: string) => Promise<AgentSessionRecord | null>;
|
|
141
145
|
listSessions: () => Promise<AgentSessionRecord[]>;
|
|
142
146
|
saveSession: (session: AgentSessionRecord) => Promise<void>;
|
|
147
|
+
setSessionMetadata: (params: {
|
|
148
|
+
sessionId: string;
|
|
149
|
+
metadata: Record<string, unknown>;
|
|
150
|
+
updatedAt: string;
|
|
151
|
+
}) => Promise<boolean>;
|
|
143
152
|
updateSessionMetadata: (params: {
|
|
144
153
|
sessionId: string;
|
|
145
154
|
metadata: Record<string, unknown>;
|
package/dist/index.js
CHANGED
|
@@ -675,7 +675,7 @@ var InMemoryAgentSessionStore = class {
|
|
|
675
675
|
saveSession = async (session) => {
|
|
676
676
|
this.sessions.set(session.sessionId, structuredClone(session));
|
|
677
677
|
};
|
|
678
|
-
|
|
678
|
+
setSessionMetadata = async (params) => {
|
|
679
679
|
const { metadata, sessionId, updatedAt } = params;
|
|
680
680
|
const session = this.sessions.get(sessionId);
|
|
681
681
|
if (!session) return false;
|
|
@@ -686,6 +686,17 @@ var InMemoryAgentSessionStore = class {
|
|
|
686
686
|
});
|
|
687
687
|
return true;
|
|
688
688
|
};
|
|
689
|
+
updateSessionMetadata = async (params) => {
|
|
690
|
+
const session = this.sessions.get(params.sessionId);
|
|
691
|
+
if (!session) return false;
|
|
692
|
+
return await this.setSessionMetadata({
|
|
693
|
+
...params,
|
|
694
|
+
metadata: {
|
|
695
|
+
...session.metadata ? structuredClone(session.metadata) : {},
|
|
696
|
+
...structuredClone(params.metadata)
|
|
697
|
+
}
|
|
698
|
+
});
|
|
699
|
+
};
|
|
689
700
|
deleteSession = async (sessionId) => {
|
|
690
701
|
const session = this.sessions.get(sessionId);
|
|
691
702
|
if (!session) return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextclaw/ncp-toolkit",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.20",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Toolkit implementations built on top of the NextClaw Communication Protocol.",
|
|
6
6
|
"type": "module",
|
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@nextclaw/ncp": "0.5.
|
|
18
|
+
"@nextclaw/ncp": "0.5.15"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/node": "^20.17.6",
|
|
22
22
|
"prettier": "^3.3.3",
|
|
23
23
|
"typescript": "^5.6.3",
|
|
24
24
|
"vitest": "^4.1.2",
|
|
25
|
-
"@nextclaw/ncp-agent-runtime": "0.3.
|
|
25
|
+
"@nextclaw/ncp-agent-runtime": "0.3.26"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"build": "tsdown src/index.ts --dts --clean --target es2022 --no-fixedExtension",
|