@meetopenbot/pi 0.1.3 → 1.0.0
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/session.js +4 -2
- package/dist/state.js +6 -2
- package/package.json +2 -2
package/dist/session.js
CHANGED
|
@@ -12,7 +12,7 @@ const hasPiByok = (provider) => {
|
|
|
12
12
|
resolveByokApiKey('deepseek'));
|
|
13
13
|
};
|
|
14
14
|
const buildSessionKey = (state, byok) => {
|
|
15
|
-
const scope = state.threadId ? `${state.channelId}:${state.threadId}` : state.channelId;
|
|
15
|
+
const scope = state.threadId ? `${state.channelId ?? ''}:${state.threadId}` : (state.channelId ?? '');
|
|
16
16
|
return `${scope}:${byok ? 'byok' : 'credits'}`;
|
|
17
17
|
};
|
|
18
18
|
const resolveModel = async (config, modelRegistry) => {
|
|
@@ -83,7 +83,9 @@ export const disposePiSession = (sessionKey) => {
|
|
|
83
83
|
sessionCache.delete(sessionKey);
|
|
84
84
|
};
|
|
85
85
|
export const disposePiSessionsForThread = (state) => {
|
|
86
|
-
const prefix = state.threadId
|
|
86
|
+
const prefix = state.threadId
|
|
87
|
+
? `${state.channelId ?? ''}:${state.threadId}:`
|
|
88
|
+
: `${state.channelId ?? ''}:`;
|
|
87
89
|
for (const key of sessionCache.keys()) {
|
|
88
90
|
if (key.startsWith(prefix))
|
|
89
91
|
disposePiSession(key);
|
package/dist/state.js
CHANGED
|
@@ -7,13 +7,17 @@ export const readPersistedState = (state) => {
|
|
|
7
7
|
return typeof record.sessionFile === 'string' ? { sessionFile: record.sessionFile } : {};
|
|
8
8
|
};
|
|
9
9
|
export const persistPiState = async (state, storage, patch) => {
|
|
10
|
+
const channelId = state.channelId;
|
|
11
|
+
if (!channelId) {
|
|
12
|
+
throw new Error('channelId is required to persist Pi session state');
|
|
13
|
+
}
|
|
10
14
|
if (state.threadId) {
|
|
11
15
|
await storage.patchThreadState({
|
|
12
|
-
channelId
|
|
16
|
+
channelId,
|
|
13
17
|
threadId: state.threadId,
|
|
14
18
|
state: patch,
|
|
15
19
|
});
|
|
16
20
|
return;
|
|
17
21
|
}
|
|
18
|
-
await storage.patchChannelState({ channelId
|
|
22
|
+
await storage.patchChannelState({ channelId, state: patch });
|
|
19
23
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meetopenbot/pi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "OpenBot agent plugin powered by the Pi coding agent SDK.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@earendil-works/pi-ai": "^0.79.1",
|
|
23
23
|
"@earendil-works/pi-coding-agent": "^0.79.1",
|
|
24
|
-
"@meetopenbot/plugin-sdk": "^0.
|
|
24
|
+
"@meetopenbot/plugin-sdk": "^1.0.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/node": "^25.9.2",
|