opencode-claw 0.2.2 → 0.2.3
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/channels/router.js
CHANGED
|
@@ -45,7 +45,6 @@ function peerKey(channel, peerId) {
|
|
|
45
45
|
}
|
|
46
46
|
async function handleCommand(cmd, msg, deps, activeStreams) {
|
|
47
47
|
const key = buildSessionKey(msg.channel, msg.peerId, msg.threadId);
|
|
48
|
-
const prefix = `${msg.channel}:${msg.peerId}`;
|
|
49
48
|
switch (cmd.name) {
|
|
50
49
|
case "new": {
|
|
51
50
|
const id = await deps.sessions.newSession(key, cmd.args || undefined);
|
|
@@ -58,7 +57,7 @@ async function handleCommand(cmd, msg, deps, activeStreams) {
|
|
|
58
57
|
return `Switched to session: ${cmd.args}`;
|
|
59
58
|
}
|
|
60
59
|
case "sessions": {
|
|
61
|
-
const list = await deps.sessions.listSessions(
|
|
60
|
+
const list = await deps.sessions.listSessions(key);
|
|
62
61
|
if (list.length === 0)
|
|
63
62
|
return "No sessions found.";
|
|
64
63
|
return list
|
|
@@ -13,7 +13,7 @@ export declare function createSessionManager(client: OpencodeClient, config: Ses
|
|
|
13
13
|
resolveSession: (key: string, title?: string) => Promise<string>;
|
|
14
14
|
switchSession: (key: string, targetId: string) => Promise<void>;
|
|
15
15
|
newSession: (key: string, title?: string) => Promise<string>;
|
|
16
|
-
listSessions: (
|
|
16
|
+
listSessions: (key: string) => Promise<SessionInfo[]>;
|
|
17
17
|
currentSession: (key: string) => string | undefined;
|
|
18
18
|
persist: () => Promise<void>;
|
|
19
19
|
};
|
package/dist/sessions/manager.js
CHANGED
|
@@ -39,20 +39,17 @@ export function createSessionManager(client, config, map, logger) {
|
|
|
39
39
|
logger.info("sessions: created and switched to new session", { key, id: session.data.id });
|
|
40
40
|
return session.data.id;
|
|
41
41
|
}
|
|
42
|
-
async function listSessions(
|
|
42
|
+
async function listSessions(key) {
|
|
43
43
|
const all = await client.session.list();
|
|
44
44
|
const sessions = all.data ?? [];
|
|
45
|
-
const
|
|
46
|
-
return
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
createdAt: session?.time.created,
|
|
54
|
-
};
|
|
55
|
-
});
|
|
45
|
+
const activeId = map.get(key);
|
|
46
|
+
return sessions.map((s) => ({
|
|
47
|
+
id: s.id,
|
|
48
|
+
key: [...map.entries()].find(([, id]) => id === s.id)?.[0] ?? "(external)",
|
|
49
|
+
title: s.title ?? s.id,
|
|
50
|
+
active: s.id === activeId,
|
|
51
|
+
createdAt: s.time.created,
|
|
52
|
+
}));
|
|
56
53
|
}
|
|
57
54
|
function currentSession(key) {
|
|
58
55
|
return map.get(key);
|