letagents 0.11.1 → 0.12.1
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/LICENSE +65 -0
- package/README.md +7 -4
- package/dist/mcp/codenames.js +5 -3
- package/dist/mcp/codex-session.js +500 -0
- package/dist/mcp/config-reader.js +1 -1
- package/dist/mcp/git-remote.js +3 -3
- package/dist/mcp/local-state.js +58 -0
- package/dist/mcp/server.js +337 -59
- package/dist/mcp/sse-client.js +19 -3
- package/dist/shared/room-agent-prompts.js +25 -0
- package/package.json +5 -3
package/dist/mcp/local-state.js
CHANGED
|
@@ -226,3 +226,61 @@ export function touchRoomSession(roomId, lastMessageId) {
|
|
|
226
226
|
});
|
|
227
227
|
return updated;
|
|
228
228
|
}
|
|
229
|
+
export function getCurrentCodexLiveSession(roomId) {
|
|
230
|
+
const state = readLocalState();
|
|
231
|
+
const sessionIds = state.current_codex_live_session_ids;
|
|
232
|
+
if (!sessionIds) {
|
|
233
|
+
return null;
|
|
234
|
+
}
|
|
235
|
+
if (roomId) {
|
|
236
|
+
const sessionId = sessionIds[roomId];
|
|
237
|
+
return sessionId ? (state.codex_live_sessions?.[sessionId] ?? null) : null;
|
|
238
|
+
}
|
|
239
|
+
let best = null;
|
|
240
|
+
for (const id of Object.values(sessionIds)) {
|
|
241
|
+
const session = state.codex_live_sessions?.[id];
|
|
242
|
+
if (session && (!best || session.updated_at > best.updated_at)) {
|
|
243
|
+
best = session;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return best;
|
|
247
|
+
}
|
|
248
|
+
export function getStoredCodexLiveSession(sessionId) {
|
|
249
|
+
const state = readLocalState();
|
|
250
|
+
return state.codex_live_sessions?.[sessionId] ?? null;
|
|
251
|
+
}
|
|
252
|
+
export function listStoredCodexLiveSessions() {
|
|
253
|
+
const state = readLocalState();
|
|
254
|
+
return Object.values(state.codex_live_sessions ?? {}).sort((left, right) => right.updated_at.localeCompare(left.updated_at));
|
|
255
|
+
}
|
|
256
|
+
export function saveCodexLiveSession(session, makeCurrent = true) {
|
|
257
|
+
updateLocalState((state) => {
|
|
258
|
+
state.codex_live_sessions = state.codex_live_sessions ?? {};
|
|
259
|
+
state.codex_live_sessions[session.session_id] = session;
|
|
260
|
+
if (makeCurrent) {
|
|
261
|
+
state.current_codex_live_session_ids = state.current_codex_live_session_ids ?? {};
|
|
262
|
+
state.current_codex_live_session_ids[session.room_id] = session.session_id;
|
|
263
|
+
}
|
|
264
|
+
return state;
|
|
265
|
+
});
|
|
266
|
+
return session;
|
|
267
|
+
}
|
|
268
|
+
export function updateCodexLiveSession(sessionId, updater) {
|
|
269
|
+
let updatedSession = null;
|
|
270
|
+
updateLocalState((state) => {
|
|
271
|
+
const existing = state.codex_live_sessions?.[sessionId];
|
|
272
|
+
if (!existing) {
|
|
273
|
+
return state;
|
|
274
|
+
}
|
|
275
|
+
const updated = updater(existing);
|
|
276
|
+
state.codex_live_sessions = state.codex_live_sessions ?? {};
|
|
277
|
+
state.codex_live_sessions[sessionId] = updated;
|
|
278
|
+
state.current_codex_live_session_ids = state.current_codex_live_session_ids ?? {};
|
|
279
|
+
if (!state.current_codex_live_session_ids[updated.room_id]) {
|
|
280
|
+
state.current_codex_live_session_ids[updated.room_id] = sessionId;
|
|
281
|
+
}
|
|
282
|
+
updatedSession = updated;
|
|
283
|
+
return state;
|
|
284
|
+
});
|
|
285
|
+
return updatedSession;
|
|
286
|
+
}
|